cairo/xrint.h

422 lines
8.4 KiB
C
Raw Normal View History

2002-06-11 04:02:23 +00:00
/*
* $XFree86: $
*
* Copyright <EFBFBD> 2002 University of Southern California
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, 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 University
* of Southern California not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. University of Southern California makes
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL UNIVERSITY OF
* SOUTHERN CALIFORNIA 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.
*
* Author: Carl Worth, USC, Information Sciences Institute */
/*
* These definitions are solely for use by the implementation of Xr
* and constitute no kind of standard. If you need any of these
* functions, please drop me a note. Either the library needs new
* functionality, or there's a way to do what you need using the
* existing published interfaces. cworth@isi.edu
*/
#ifndef _XRINT_H_
#define _XRINT_H_
2002-07-23 07:22:23 +00:00
#include <X11/Xlibint.h>
2002-06-11 04:02:23 +00:00
#include "Xr.h"
typedef struct _XrSubPath {
int num_pts;
int pts_size;
XPointDouble *pts;
int closed;
struct _XrSubPath *next;
} XrSubPath;
typedef struct _XrPath {
XrSubPath *head;
XrSubPath *tail;
} XrPath;
2002-07-23 07:22:23 +00:00
typedef struct _XrSurface {
2002-06-11 04:02:23 +00:00
Display *dpy;
Drawable drawable;
unsigned int depth;
2002-07-23 07:22:23 +00:00
unsigned long sa_mask;
XcSurfaceAttributes sa;
XcFormat *xcformat;
2002-06-11 04:02:23 +00:00
2002-07-23 07:22:23 +00:00
XcSurface *xcsurface;
XcSurface *alpha;
} XrSurface;
2002-06-11 04:02:23 +00:00
typedef struct _XrColor {
double red;
double green;
double blue;
double alpha;
2002-07-23 07:22:23 +00:00
XcColor xccolor;
2002-06-11 04:02:23 +00:00
} XrColor;
typedef struct _XrTransform {
double m[3][2];
2002-06-11 04:02:23 +00:00
} XrTransform;
2002-07-23 07:22:23 +00:00
typedef struct _XrTraps {
int num_xtraps;
int xtraps_size;
XTrapezoid *xtraps;
} XrTraps;
#define XR_GSTATE_OPERATOR_DEFAULT XrOperatorOver
2002-06-11 04:02:23 +00:00
#define XR_GSTATE_WINDING_DEFAULT 1
#define XR_GSTATE_LINE_WIDTH_DEFAULT 1.0
2002-07-23 07:22:23 +00:00
#define XR_GSTATE_LINE_CAP_DEFAULT XrLineCapButt
#define XR_GSTATE_LINE_JOIN_DEFAULT XrLineJoinMiter
#define XR_GSTATE_MITER_LIMIT_DEFAULT 10.0
2002-06-11 04:02:23 +00:00
typedef struct _XrGState {
Display *dpy;
2002-07-23 07:22:23 +00:00
XrOperator operator;
2002-06-11 04:02:23 +00:00
int winding;
2002-07-23 07:22:23 +00:00
2002-06-11 04:02:23 +00:00
double line_width;
2002-07-23 07:22:23 +00:00
XrLineCap line_cap;
XrLineJoin line_join;
double miter_limit;
2002-06-11 04:02:23 +00:00
2002-07-23 07:22:23 +00:00
XcFormat *solidFormat;
XcFormat *alphaFormat;
2002-06-11 04:02:23 +00:00
XrColor color;
2002-07-23 07:22:23 +00:00
XrSurface src;
XrSurface surface;
XrTransform ctm;
XrTransform ctm_inverse;
2002-06-11 04:02:23 +00:00
XrPath path;
struct _XrGState *next;
} XrGState;
struct _XrState {
Display *dpy;
XrGState *stack;
};
/* xrstate.c */
#define CURRENT_GSTATE(xrs) (xrs->stack)
XrState *
XrStateCreate(Display *dpy);
void
XrStateInit(XrState *state, Display *dpy);
void
XrStateDeinit(XrState *xrs);
void
XrStateDestroy(XrState *state);
void
XrStatePush(XrState *xrs);
void
XrStatePop(XrState *xrs);
/* xrgstate.c */
XrGState *
XrGStateCreate(Display *dpy);
XrGState *
XrGStateClone(XrGState *gstate);
void
XrGStateInit(XrGState *gstate, Display *dpy);
void
XrGStateInitCopy(XrGState *gstate, XrGState *other);
void
XrGStateDeinit(XrGState *gstate);
void
XrGStateDestroy(XrGState *gstate);
void
XrGStateGetCurrentPoint(XrGState *gstate, XPointDouble *pt);
void
XrGStateSetDrawable(XrGState *gstate, Drawable drawable);
void
XrGStateSetVisual(XrGState *gstate, Visual *visual);
void
XrGStateSetFormat(XrGState *gstate, XrFormat format);
2002-06-11 04:02:23 +00:00
void
2002-07-23 07:22:23 +00:00
XrGStateSetOperator(XrGState *gstate, XrOperator operator);
void
XrGStateSetRGBColor(XrGState *gstate, double red, double green, double blue);
2002-06-11 04:02:23 +00:00
void
XrGStateSetAlpha(XrGState *gstate, double alpha);
void
XrGStateSetLineWidth(XrGState *gstate, double width);
2002-07-23 07:22:23 +00:00
void
XrGStateSetLineCap(XrGState *gstate, XrLineCap line_cap);
void
XrGStateSetLineJoin(XrGState *gstate, XrLineJoin line_join);
void
XrGStateSetMiterLimit(XrGState *gstate, double limit);
2002-06-11 04:02:23 +00:00
void
XrGStateTranslate(XrGState *gstate, double tx, double ty);
void
XrGStateScale(XrGState *gstate, double sx, double sy);
void
XrGStateRotate(XrGState *gstate, double angle);
void
XrGStateNewPath(XrGState *gstate);
void
XrGStateMoveTo(XrGState *gstate, double x, double y);
void
XrGStateLineTo(XrGState *gstate, double x, double y);
void
XrGStateRelMoveTo(XrGState *gstate, double x, double y);
void
XrGStateRelLineTo(XrGState *gstate, double x, double y);
void
XrGStateClosePath(XrGState *gstate);
void
XrGStateStroke(XrGState *gstate);
void
XrGStateFill(XrGState *fill);
/* xrcolor.c */
void
XrColorInit(XrColor *color);
void
XrColorDeinit(XrColor *color);
void
XrColorSetRGB(XrColor *color, double red, double green, double blue);
void
XrColorSetAlpha(XrColor *color, double alpha);
/* xrpath.c */
XrPath *
XrPathCreate(void);
void
XrPathInit(XrPath *path);
void
XrPathInitCopy(XrPath *path, XrPath *other);
void
XrPathReinit(XrPath *path);
void
XrPathDeinit(XrPath *path);
void
XrPathDestroy(XrPath *path);
XrPath *
XrPathClone(XrPath *path);
void
XrPathGetCurrentPoint(XrPath *path, XPointDouble *pt);
int
XrPathNumSubPaths(XrPath *path);
void
XrPathNewSubPath(XrPath *path);
void
XrPathAddPoint(XrPath *path, const XPointDouble *pt);
void
XrPathMoveTo(XrPath *path, const XPointDouble *pt);
void
XrPathLineTo(XrPath *path, const XPointDouble *pt);
void
XrPathClose(XrPath *path);
/* xrsubpath.c */
XrSubPath *
XrSubPathCreate(void);
void
XrSubPathInit(XrSubPath *path);
void
XrSubPathInitCopy(XrSubPath *path, XrSubPath *other);
void
XrSubPathDeinit(XrSubPath *path);
void
XrSubPathDestroy(XrSubPath *path);
XrSubPath *
XrSubPathClone(XrSubPath *path);
void
XrSubPathGetCurrentPoint(XrSubPath *path, XPointDouble *pt);
void
XrSubPathSetCurrentPoint(XrSubPath *path, const XPointDouble *pt);
void
XrSubPathAddPoint(XrSubPath *path, const XPointDouble *pt);
void
XrSubPathClose(XrSubPath *path);
2002-07-23 07:22:23 +00:00
/* xrsurface.c */
2002-06-11 04:02:23 +00:00
void
2002-07-23 07:22:23 +00:00
XrSurfaceInit(XrSurface *surface, Display *dpy);
2002-06-11 04:02:23 +00:00
void
2002-07-23 07:22:23 +00:00
XrSurfaceDeinit(XrSurface *surface);
2002-06-11 04:02:23 +00:00
void
2002-07-23 07:22:23 +00:00
XrSurfaceSetSolidColor(XrSurface *surface, XrColor *color, XcFormat *xcformat);
2002-06-11 04:02:23 +00:00
void
2002-07-23 07:22:23 +00:00
XrSurfaceSetDrawable(XrSurface *surface, Drawable drawable);
void
2002-07-23 07:22:23 +00:00
XrSurfaceSetVisual(XrSurface *surface, Visual *visual);
void
2002-07-23 07:22:23 +00:00
XrSurfaceSetFormat(XrSurface *surface, XrFormat format);
2002-06-11 04:02:23 +00:00
/* xrtransform.c */
void
XrTransformInit(XrTransform *transform);
void
XrTransformDeinit(XrTransform *transform);
2002-06-11 04:02:23 +00:00
void
XrTransformInitMatrix(XrTransform *transform,
double a, double b,
double c, double d,
double tx, double ty);
void
XrTransformInitTranslate(XrTransform *transform,
double tx, double ty);
void
XrTransformInitScale(XrTransform *transform,
double sx, double sy);
void
XrTransformInitRotate(XrTransform *transform,
double angle);
void
XrTransformMultiplyIntoLeft(XrTransform *t1, const XrTransform *t2);
void
XrTransformMultiplyIntoRight(const XrTransform *t1, XrTransform *t2);
void
XrTransformMultiply(const XrTransform *t1, const XrTransform *t2, XrTransform *new);
2002-06-11 04:02:23 +00:00
void
XrTransformPointScaleOnly(XrTransform *transform, XPointDouble *pt);
2002-06-11 04:02:23 +00:00
void
XrTransformPointWithoutTranslate(XrTransform *transform, XPointDouble *pt);
void
XrTransformPoint(XrTransform *transform, XPointDouble *pt);
2002-07-23 07:22:23 +00:00
/* xrtraps.c */
XrTraps *
XrTrapsCreate(void);
void
XrTrapsInit(XrTraps *traps);
void
XrTrapsDeinit(XrTraps *traps);
void
XrTrapsDestroy(XrTraps *traps);
void
XrTrapsAddTrap(XrTraps *traps, XFixed top, XFixed bottom,
XLineFixed left, XLineFixed right);
void
XrTrapsAddTrapFromPoints(XrTraps *traps, XFixed top, XFixed bottom,
XPointFixed left_p1, XPointFixed left_p2,
XPointFixed right_p1, XPointFixed right_p2);
void
XrTrapsTessellateTriangle (XrTraps *traps, XPointDouble *tri);
void
XrTrapsTessellateConvexQuad (XrTraps *traps, XPointDouble *quad);
void
XrTrapsTessellatePath (XrTraps *traps, XrPath *path, int winding);
void
XrTrapsTessellateSubPath (XrTraps *traps, XrSubPath *subpath, int winding);
2002-06-11 04:02:23 +00:00
#endif
2002-07-23 07:22:23 +00:00