/* $Id: Scale.h,v 1.1 91/05/20 15:16:00 gnb Exp $ */
/* $Source: /export/sources/x/At/Plotter/tmp/RCS/Scale.h,v $ */

/*

Copyright 1990,1991 by the Massachusetts Institute of Technology

All rights reserved.

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the Massachusetts
Institute of Technology (M.I.T.) not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission.

M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

*/

/*
 * $Log:	Scale.h,v $
 * Revision 1.1  91/05/20  15:16:00  gnb
 * Initial revision
 * 
 * 
 */

#ifndef _AtScale_h
#define _AtScale_h    

#include <X11/Intrinsic.h>
    
typedef enum {AtTransformLINEAR,
		  AtTransformLOG,
		  AtTransformINVALID} AtTransform;

typedef struct {
    double low, high;
    int lowpix, highpix;
    AtTransform transform;
    double mult, offset;
    int errorcode;
} AtScale;

#ifndef P
# ifdef __STDC__
#  define P(args) args
# else
#  define P(args) ()
# endif 
#endif 


extern AtScale *AtScaleCreate P((double, double, int, int, AtTransform));
extern AtScale *AtScaleCopy P((AtScale *));
extern void AtScaleDestroy P((AtScale *));
extern void AtScaleResize P((AtScale *, int, int));
extern void AtScaleRescale P((AtScale *, double, double));
extern void AtScaleChangeTransform P((AtScale *, AtTransform));
extern int AtScaleUserToPixel P((AtScale *, double));
extern double AtScalePixelToUser P((AtScale *, int));
extern char *AtScaleGetErrorMessage P((AtScale *));
extern double _AtScaleAlmostZero;

#define SCALEERROR_NONE 0 
#define SCALEERROR_BOUNDLESS 1 
#define SCALEERROR_BOUNDCLOSE 2 
#define SCALEERROR_LOGNEGATIVE 3 
#define SCALEERROR_NOTRANSFORM 4


#define AtScaleGetLow(scale) (scale->low)
#define AtScaleGetHigh(scale) (scale->high)
#define AtScaleGetLowPix(scale) (scale->lowpix)
#define AtScaleGetHighPix(scale) (scale->highpix)
#define AtScaleGetTransform(scale) (scale->transform)
#define AtScaleGetErrorCode(scale) (scale->errorcode)

/* for use with X Toolkit resources and converters */
#define XtRTransform "Transform"
extern void AtRegisterTransformConverter P((void));

#endif /* _AtScale_h */
