cairo/Xr.h

279 lines
6.8 KiB
C
Raw Normal View History

2002-06-11 04:02:23 +00:00
/*
* $XFree86: $
*
* Copyright <EFBFBD> 2002 Carl D. Worth
2002-06-11 04:02:23 +00:00
*
* 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 Carl
* D. Worth not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Carl D. Worth makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
2002-06-11 04:02:23 +00:00
*
* CARL D. WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL CARL D. WORTH 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.
*/
2002-06-11 04:02:23 +00:00
#ifndef _XR_H_
#define _XR_H_
2002-07-23 07:22:23 +00:00
#include <X11/Xc/Xc.h>
2002-06-11 04:02:23 +00:00
typedef struct _XrState XrState;
/* Functions for manipulating state objects */
XrState *
XrCreate(Display *dpy);
2002-06-11 04:02:23 +00:00
void
XrDestroy(XrState *xrs);
void
XrSave(XrState *xrs);
void
XrRestore(XrState *xrs);
2002-11-04 00:24:44 +00:00
void
XrPushGroup(XrState *xrs);
void
XrPopGroup(XrState *xrs);
2002-06-11 04:02:23 +00:00
/* Modify state */
void
XrSetDrawable(XrState *xrs, Drawable drawable);
void
XrSetVisual(XrState *xrs, Visual *visual);
2002-06-11 04:02:23 +00:00
2002-07-23 07:22:23 +00:00
typedef enum _XrFormat {
XrFormatARGB32 = PictStandardARGB32,
XrFormatRGB32 = PictStandardRGB24,
XrFormatA8 = PictStandardA8,
XrFormatA1 = PictStandardA1
} XrFormat;
2002-06-11 04:02:23 +00:00
void
XrSetFormat(XrState *xrs, XrFormat format);
2002-07-23 07:22:23 +00:00
typedef enum _XrOperator {
XrOperatorClear = PictOpClear,
XrOperatorSrc = PictOpSrc,
XrOperatorDst = PictOpDst,
XrOperatorOver = PictOpOver,
XrOperatorOverReverse = PictOpOverReverse,
XrOperatorIn = PictOpIn,
XrOperatorInReverse = PictOpInReverse,
XrOperatorOut = PictOpOut,
XrOperatorOutReverse = PictOpOutReverse,
XrOperatorAtop = PictOpAtop,
XrOperatorAtopReverse = PictOpAtopReverse,
XrOperatorXor = PictOpXor,
XrOperatorAdd = PictOpAdd,
XrOperatorSaturate = PictOpSaturate,
XrOperatorDisjointClear = PictOpDisjointClear,
XrOperatorDisjointSrc = PictOpDisjointSrc,
XrOperatorDisjointDst = PictOpDisjointDst,
XrOperatorDisjointOver = PictOpDisjointOver,
XrOperatorDisjointOverReverse = PictOpDisjointOverReverse,
XrOperatorDisjointIn = PictOpDisjointIn,
XrOperatorDisjointInReverse = PictOpDisjointInReverse,
XrOperatorDisjointOut = PictOpDisjointOut,
XrOperatorDisjointOutReverse = PictOpDisjointOutReverse,
XrOperatorDisjointAtop = PictOpDisjointAtop,
XrOperatorDisjointAtopReverse = PictOpDisjointAtopReverse,
XrOperatorDisjointXor = PictOpDisjointXor,
XrOperatorConjointClear = PictOpConjointClear,
XrOperatorConjointSrc = PictOpConjointSrc,
XrOperatorConjointDst = PictOpConjointDst,
XrOperatorConjointOver = PictOpConjointOver,
XrOperatorConjointOverReverse = PictOpConjointOverReverse,
XrOperatorConjointIn = PictOpConjointIn,
XrOperatorConjointInReverse = PictOpConjointInReverse,
XrOperatorConjointOut = PictOpConjointOut,
XrOperatorConjointOutReverse = PictOpConjointOutReverse,
XrOperatorConjointAtop = PictOpConjointAtop,
XrOperatorConjointAtopReverse = PictOpConjointAtopReverse,
XrOperatorConjointXor = PictOpConjointXor
} XrOperator;
void
XrSetOperator(XrState *xrs, XrOperator operator);
void
XrSetRGBColor(XrState *xrs, double red, double green, double blue);
2002-06-11 04:02:23 +00:00
void
XrSetTolerance(XrState *xrs, double tolerance);
2002-06-11 04:02:23 +00:00
void
XrSetAlpha(XrState *xrs, double alpha);
2002-10-24 11:27:29 +00:00
typedef enum _XrFillRule { XrFillRuleWinding, XrFillRuleEvenOdd } XrFillRule;
void
XrSetFillRule(XrState *xrs, XrFillRule fill_rule);
2002-06-11 04:02:23 +00:00
void
XrSetLineWidth(XrState *xrs, double width);
2002-07-23 07:22:23 +00:00
typedef enum _XrLineCap { XrLineCapButt, XrLineCapRound, XrLineCapSquare } XrLineCap;
void
XrSetLineCap(XrState *xrs, XrLineCap line_cap);
typedef enum _XrLineJoin { XrLineJoinMiter, XrLineJoinRound, XrLineJoinBevel } XrLineJoin;
void
XrSetLineJoin(XrState *xrs, XrLineJoin line_join);
void
XrSetDash(XrState *xrs, double *dashes, int ndash, double offset);
2002-07-23 07:22:23 +00:00
void
XrSetMiterLimit(XrState *xrs, double limit);
2002-06-11 04:02:23 +00:00
void
XrTranslate(XrState *xrs, double tx, double ty);
void
XrScale(XrState *xrs, double sx, double sy);
void
XrRotate(XrState *xrs, double angle);
void
XrConcatMatrix(XrState *xrs,
double a, double b,
double c, double d,
double tx, double ty);
2002-11-11 12:46:17 +00:00
void
XrSetMatrix(XrState *xrs,
double a, double b,
double c, double d,
double tx, double ty);
/* XXX: Postscript has both a defaultmatrix and an identmatrix. But
there, they do different things. Here, where they perform the same
function, we should probably only have one name to avoid
confusion. Any votes? */
void
XrDefaultMatrix(XrState *xrs);
void
XrIdentityMatrix(XrState *xrs);
/* Path creation functions */
2002-06-11 04:02:23 +00:00
void
XrNewPath(XrState *xrs);
void
XrMoveTo(XrState *xrs, double x, double y);
void
XrLineTo(XrState *xrs, double x, double y);
void
XrCurveTo(XrState *xrs,
double x1, double y1,
double x2, double y2,
double x3, double y3);
2002-06-11 04:02:23 +00:00
void
XrRelMoveTo(XrState *xrs, double dx, double dy);
2002-06-11 04:02:23 +00:00
void
XrRelLineTo(XrState *xrs, double dx, double dy);
2002-06-11 04:02:23 +00:00
void
XrRelCurveTo(XrState *xrs,
double dx1, double dy1,
double dx2, double dy2,
double dx3, double dy3);
2002-06-11 04:02:23 +00:00
void
XrClosePath(XrState *xrs);
/* Painting functions */
2002-06-11 04:02:23 +00:00
void
XrStroke(XrState *xrs);
void
XrFill(XrState *xrs);
2002-10-29 17:27:01 +00:00
/* Font/Text functions */
void
2002-10-29 17:27:01 +00:00
XrSelectFont(XrState *xrs, const char *key);
void
XrScaleFont(XrState *xrs, double scale);
void
XrTransformFont(XrState *xrs,
double a, double b,
double c, double d);
void
XrTextExtents(XrState *xrs,
const unsigned char *utf8,
double *x, double *y,
double *width, double *height,
double *dx, double *dy);
2002-10-29 17:27:01 +00:00
void
XrShowText(XrState *xrs, const unsigned char *utf8);
2002-11-01 19:45:30 +00:00
/* Image functions */
void
XrShowImage(XrState *xrs,
char *data,
XrFormat format,
unsigned int width,
unsigned int height,
unsigned int stride);
void
XrShowImageTransform(XrState *xrs,
char *data,
XrFormat format,
unsigned int width,
unsigned int height,
unsigned int stride,
double a, double b,
double c, double d,
double tx, double ty);
/* Error status queries */
typedef enum _XrStatus {
XrStatusSuccess = 0,
XrStatusNoMemory,
2002-11-01 19:45:30 +00:00
XrStatusInvalidRestore,
2002-11-04 00:24:44 +00:00
XrStatusInvalidPopGroup,
2002-11-11 12:46:17 +00:00
XrStatusNoCurrentPoint,
XrStatusInvalidMatrix
} XrStatus;
XrStatus
XrGetStatus(XrState *xrs);
2002-11-01 19:45:30 +00:00
const char *
XrGetStatusString(XrState *xrs);
2002-06-11 04:02:23 +00:00
#endif
2002-07-23 07:22:23 +00:00