2002-06-11 04:02:23 +00:00
|
|
|
|
/*
|
|
|
|
|
|
* $XFree86: $
|
|
|
|
|
|
*
|
2002-08-14 00:39:43 +00:00
|
|
|
|
* 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
|
2002-08-14 00:39:43 +00:00
|
|
|
|
* 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
|
|
|
|
*
|
2002-08-14 00:39:43 +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
|
|
|
|
|
|
|
|
|
|
#include "xrint.h"
|
|
|
|
|
|
|
2002-10-16 12:57:00 +00:00
|
|
|
|
#define _XR_CURRENT_GSTATE(xrs) (xrs->stack)
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
#define XR_TOLERANCE_MINIMUM 0.0002 /* We're limited by 16 bits of sub-pixel precision */
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
_XrClipValue(double *value, double min, double max);
|
|
|
|
|
|
|
2002-06-11 04:02:23 +00:00
|
|
|
|
XrState *
|
2002-06-14 15:13:44 +00:00
|
|
|
|
XrCreate(Display *dpy)
|
2002-06-11 04:02:23 +00:00
|
|
|
|
{
|
2002-10-16 12:57:00 +00:00
|
|
|
|
return _XrStateCreate(dpy);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrDestroy(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-16 12:57:00 +00:00
|
|
|
|
_XrStateDestroy(xrs);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrSave(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrStatePush(xrs);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrRestore(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrStatePop(xrs);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-11-04 00:24:44 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrPushGroup(XrState *xrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrStatePush(xrs);
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateBeginGroup(_XR_CURRENT_GSTATE(xrs));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrPopGroup(XrState *xrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateEndGroup(_XR_CURRENT_GSTATE(xrs));
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrStatePop(xrs);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2002-06-11 04:02:23 +00:00
|
|
|
|
void
|
2002-06-14 15:13:44 +00:00
|
|
|
|
XrSetDrawable(XrState *xrs, Drawable drawable)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetDrawable(_XR_CURRENT_GSTATE(xrs), drawable);
|
2002-06-14 15:13:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrSetVisual(XrState *xrs, Visual *visual)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetVisual(_XR_CURRENT_GSTATE(xrs), visual);
|
2002-06-14 15:13:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrSetFormat(XrState *xrs, XrFormat format)
|
2002-06-11 04:02:23 +00:00
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetFormat(_XR_CURRENT_GSTATE(xrs), format);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-07-23 07:22:23 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetOperator(XrState *xrs, XrOperator operator)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetOperator(_XR_CURRENT_GSTATE(xrs), operator);
|
2002-07-23 07:22:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-06-11 04:02:23 +00:00
|
|
|
|
void
|
2002-06-14 15:13:44 +00:00
|
|
|
|
XrSetRGBColor(XrState *xrs, double red, double green, double blue)
|
2002-06-11 04:02:23 +00:00
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
_XrClipValue(&red, 0.0, 1.0);
|
|
|
|
|
|
_XrClipValue(&green, 0.0, 1.0);
|
|
|
|
|
|
_XrClipValue(&blue, 0.0, 1.0);
|
|
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateSetRGBColor(_XR_CURRENT_GSTATE(xrs), red, green, blue);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-09-03 08:42:25 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetTolerance(XrState *xrs, double tolerance)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
_XrClipValue(&tolerance, XR_TOLERANCE_MINIMUM, tolerance);
|
|
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateSetTolerance(_XR_CURRENT_GSTATE(xrs), tolerance);
|
2002-09-03 08:42:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-06-11 04:02:23 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetAlpha(XrState *xrs, double alpha)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
_XrClipValue(&alpha, 0.0, 1.0);
|
|
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateSetAlpha(_XR_CURRENT_GSTATE(xrs), alpha);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-10-24 11:27:29 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetFillRule(XrState *xrs, XrFillRule fill_rule)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetFillRule(_XR_CURRENT_GSTATE(xrs), fill_rule);
|
2002-10-24 11:27:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-06-11 04:02:23 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetLineWidth(XrState *xrs, double width)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetLineWidth(_XR_CURRENT_GSTATE(xrs), width);
|
2002-07-23 07:22:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrSetLineCap(XrState *xrs, XrLineCap line_cap)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetLineCap(_XR_CURRENT_GSTATE(xrs), line_cap);
|
2002-07-23 07:22:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrSetLineJoin(XrState *xrs, XrLineJoin line_join)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetLineJoin(_XR_CURRENT_GSTATE(xrs), line_join);
|
2002-07-23 07:22:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-08-15 17:19:28 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetDash(XrState *xrs, double *dashes, int ndash, double offset)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetDash(_XR_CURRENT_GSTATE(xrs), dashes, ndash, offset);
|
2002-08-15 17:19:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-07-23 07:22:23 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetMiterLimit(XrState *xrs, double limit)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetMiterLimit(_XR_CURRENT_GSTATE(xrs), limit);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrTranslate(XrState *xrs, double tx, double ty)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateTranslate(_XR_CURRENT_GSTATE(xrs), tx, ty);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrScale(XrState *xrs, double sx, double sy)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateScale(_XR_CURRENT_GSTATE(xrs), sx, sy);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrRotate(XrState *xrs, double angle)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateRotate(_XR_CURRENT_GSTATE(xrs), angle);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrConcatMatrix(XrState *xrs,
|
|
|
|
|
|
double a, double b,
|
|
|
|
|
|
double c, double d,
|
|
|
|
|
|
double tx, double ty)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateConcatMatrix(_XR_CURRENT_GSTATE(xrs), a, b, c, d, tx, ty);
|
2002-10-23 11:58:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-11-11 12:46:17 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrSetMatrix(XrState *xrs,
|
|
|
|
|
|
double a, double b,
|
|
|
|
|
|
double c, double d,
|
|
|
|
|
|
double tx, double ty)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSetMatrix(_XR_CURRENT_GSTATE(xrs), a, b, c, d, tx, ty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrDefaultMatrix(XrState *xrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateIdentityMatrix(_XR_CURRENT_GSTATE(xrs));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrIdentityMatrix(XrState *xrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateIdentityMatrix(_XR_CURRENT_GSTATE(xrs));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2002-06-11 04:02:23 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrNewPath(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateNewPath(_XR_CURRENT_GSTATE(xrs));
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrMoveTo(XrState *xrs, double x, double y)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateMoveTo(_XR_CURRENT_GSTATE(xrs), x, y);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrLineTo(XrState *xrs, double x, double y)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateLineTo(_XR_CURRENT_GSTATE(xrs), x, y);
|
2002-08-15 05:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrCurveTo(XrState *xrs,
|
|
|
|
|
|
double x1, double y1,
|
|
|
|
|
|
double x2, double y2,
|
|
|
|
|
|
double x3, double y3)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateCurveTo(_XR_CURRENT_GSTATE(xrs),
|
|
|
|
|
|
x1, y1,
|
|
|
|
|
|
x2, y2,
|
|
|
|
|
|
x3, y3);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2002-10-16 12:57:00 +00:00
|
|
|
|
XrRelMoveTo(XrState *xrs, double dx, double dy)
|
2002-06-11 04:02:23 +00:00
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateRelMoveTo(_XR_CURRENT_GSTATE(xrs), dx, dy);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2002-10-16 12:57:00 +00:00
|
|
|
|
XrRelLineTo(XrState *xrs, double dx, double dy)
|
2002-06-11 04:02:23 +00:00
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateRelLineTo(_XR_CURRENT_GSTATE(xrs), dx, dy);
|
2002-08-15 05:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrRelCurveTo(XrState *xrs,
|
2002-10-16 12:57:00 +00:00
|
|
|
|
double dx1, double dy1,
|
|
|
|
|
|
double dx2, double dy2,
|
|
|
|
|
|
double dx3, double dy3)
|
2002-08-15 05:22:59 +00:00
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateRelCurveTo(_XR_CURRENT_GSTATE(xrs),
|
|
|
|
|
|
dx1, dy1,
|
|
|
|
|
|
dx2, dy2,
|
|
|
|
|
|
dx3, dy3);
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrClosePath(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateClosePath(_XR_CURRENT_GSTATE(xrs));
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrStroke(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-16 12:57:00 +00:00
|
|
|
|
if (xrs->status)
|
2002-08-15 05:22:59 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateStroke(_XR_CURRENT_GSTATE(xrs));
|
2002-06-11 04:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrFill(XrState *xrs)
|
|
|
|
|
|
{
|
2002-10-26 07:59:31 +00:00
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateFill(_XR_CURRENT_GSTATE(xrs));
|
|
|
|
|
|
}
|
2002-08-15 05:22:59 +00:00
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
void
|
2002-10-29 17:27:01 +00:00
|
|
|
|
XrSelectFont(XrState *xrs, const char *key)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateSelectFont(_XR_CURRENT_GSTATE(xrs), key);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrScaleFont(XrState *xrs, double scale)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateScaleFont(_XR_CURRENT_GSTATE(xrs), scale);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
XrTransformFont(XrState *xrs,
|
|
|
|
|
|
double a, double b,
|
|
|
|
|
|
double c, double d)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateTransformFont(_XR_CURRENT_GSTATE(xrs),
|
|
|
|
|
|
a, b, c, d);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2002-10-30 21:54:50 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrTextExtents(XrState *xrs,
|
|
|
|
|
|
const unsigned char *utf8,
|
|
|
|
|
|
double *x, double *y,
|
|
|
|
|
|
double *width, double *height,
|
|
|
|
|
|
double *dx, double *dy)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateTextExtents(_XR_CURRENT_GSTATE(xrs), utf8,
|
|
|
|
|
|
x, y, width, height, dx, dy);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2002-10-29 17:27:01 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrShowText(XrState *xrs, const unsigned char *utf8)
|
2002-10-26 07:59:31 +00:00
|
|
|
|
{
|
2002-10-16 12:57:00 +00:00
|
|
|
|
if (xrs->status)
|
2002-08-15 05:22:59 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
2002-10-26 07:59:31 +00:00
|
|
|
|
xrs->status = _XrGStateShowText(_XR_CURRENT_GSTATE(xrs), utf8);
|
2002-08-15 05:22:59 +00:00
|
|
|
|
}
|
2002-10-23 11:58:38 +00:00
|
|
|
|
|
2002-11-01 19:45:30 +00:00
|
|
|
|
void
|
|
|
|
|
|
XrShowImage(XrState *xrs,
|
|
|
|
|
|
char *data,
|
|
|
|
|
|
XrFormat format,
|
|
|
|
|
|
unsigned int width,
|
|
|
|
|
|
unsigned int height,
|
|
|
|
|
|
unsigned int stride)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateShowImage(_XR_CURRENT_GSTATE(xrs),
|
|
|
|
|
|
data, format,
|
|
|
|
|
|
width, height, 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)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (xrs->status)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
xrs->status = _XrGStateShowImageTransform(_XR_CURRENT_GSTATE(xrs),
|
|
|
|
|
|
data, format,
|
|
|
|
|
|
width, height, stride,
|
|
|
|
|
|
a, b,
|
|
|
|
|
|
c, d,
|
|
|
|
|
|
tx, ty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
XrStatus
|
|
|
|
|
|
XrGetStatus(XrState *xrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
return xrs->status;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2002-11-01 19:45:30 +00:00
|
|
|
|
const char *
|
|
|
|
|
|
XrGetStatusString(XrState *xrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (xrs->status) {
|
|
|
|
|
|
case XrStatusSuccess:
|
|
|
|
|
|
return "success";
|
|
|
|
|
|
case XrStatusNoMemory:
|
|
|
|
|
|
return "out of memory";
|
|
|
|
|
|
case XrStatusInvalidRestore:
|
2002-11-04 00:24:44 +00:00
|
|
|
|
return "XrRestore without matching XrSave";
|
|
|
|
|
|
case XrStatusInvalidPopGroup:
|
|
|
|
|
|
return "XrPopGroup without matching XrPushGroup";
|
2002-11-01 19:45:30 +00:00
|
|
|
|
case XrStatusNoCurrentPoint:
|
|
|
|
|
|
return "no current point defined";
|
2002-11-11 12:46:17 +00:00
|
|
|
|
case XrStatusInvalidMatrix:
|
|
|
|
|
|
return "invalid matrix (not invertible)";
|
2002-11-01 19:45:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2002-10-23 11:58:38 +00:00
|
|
|
|
static void
|
|
|
|
|
|
_XrClipValue(double *value, double min, double max)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (*value < min)
|
|
|
|
|
|
*value = min;
|
|
|
|
|
|
else if (*value > max)
|
|
|
|
|
|
*value = max;
|
|
|
|
|
|
}
|