10cc2eac3Smrg/*
26c321187Smrg
36c321187SmrgCopyright 1988, 1998  The Open Group
46c321187Smrg
56c321187SmrgPermission to use, copy, modify, distribute, and sell this software and its
66c321187Smrgdocumentation for any purpose is hereby granted without fee, provided that
76c321187Smrgthe above copyright notice appear in all copies and that both that
86c321187Smrgcopyright notice and this permission notice appear in supporting
96c321187Smrgdocumentation.
106c321187Smrg
116c321187SmrgThe above copyright notice and this permission notice shall be included in
126c321187Smrgall copies or substantial portions of the Software.
136c321187Smrg
146c321187SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156c321187SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
166c321187SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
176c321187SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
186c321187SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
196c321187SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
206c321187Smrg
216c321187SmrgExcept as contained in this notice, the name of The Open Group shall not be
226c321187Smrgused in advertising or otherwise to promote the sale, use or other dealings
236c321187Smrgin this Software without prior written authorization from The Open Group.
246c321187Smrg
256c321187Smrg*/
266c321187Smrg
276c321187Smrg/*
286c321187Smrg * The interfaces described by this header file are for miscellaneous utilities
296c321187Smrg * and are not part of the Xlib standard.
306c321187Smrg */
316c321187Smrg
326c321187Smrg#ifndef _XMU_H_
336c321187Smrg#define _XMU_H_
346c321187Smrg
35e120bd27Smrg#include <X11/Xfuncproto.h>
366c321187Smrg#include <X11/Intrinsic.h>
376c321187Smrg#include <X11/Xmu/Atoms.h>		/* _XA_... */
386c321187Smrg#include <X11/Xmu/CharSet.h>		/* CopyISOLatin1Lowered */
396c321187Smrg#include <X11/Xmu/Converters.h>		/* CvtStringTo... */
406c321187Smrg#include <X11/Xmu/Drawing.h>		/* DrawRoundedRect, DrawLogo */
416c321187Smrg#include <X11/Xmu/Error.h>		/* PrintDefaultError */
426c321187Smrg#include <X11/Xmu/StdSel.h>		/* ConvertStandardSelection */
436c321187Smrg
446c321187Smrg/*
456c321187Smrg * clip lists
466c321187Smrg */
476c321187Smrgtypedef struct _XmuSegment {
486c321187Smrg  int x1, x2;
496c321187Smrg  struct _XmuSegment *next;
506c321187Smrg} XmuSegment;
516c321187Smrg
520cc2eac3Smrgtypedef struct _XmuScanline {
536c321187Smrg  int y;
546c321187Smrg  XmuSegment *segment;
556c321187Smrg  struct _XmuScanline *next;
566c321187Smrg} XmuScanline;
570cc2eac3Smrg
586c321187Smrgtypedef struct _XmuArea {
590cc2eac3Smrg  XmuScanline *scanline;
606c321187Smrg} XmuArea;
616c321187Smrg
626c321187Smrg#define XmuCreateArea()		XmuNewArea(0, 0, 0, 0)
636c321187Smrg#define XmuAreaOr(dst, src)	XmuAreaOrXor((dst), (src), True)
646c321187Smrg#define XmuAreaXor(dst, src)	XmuAreaOrXor((dst), (src), False)
656c321187Smrg
666c321187Smrg#define XmuDestroyArea(a)					\
676c321187Smrg		  do {						\
686c321187Smrg		    XmuDestroyScanlineList((a)->scanline);	\
696c321187Smrg		    XtFree((char *)(a));			\
706c321187Smrg		  } while (0)
716c321187Smrg
726c321187Smrg#define FreeArea(a)						\
736c321187Smrg		  do {						\
746c321187Smrg		    XmuDestroyScanlineList((a)->scanline);	\
756c321187Smrg		    a->scanline = (Scanline *)0;		\
766c321187Smrg		  } while (0)
776c321187Smrg
786c321187Smrg#define XmuValidSegment(s)	((s)->x1 < (s)->x2)
796c321187Smrg#define XmuSegmentEqu(s1, s2)	((s1)->x1 == (s2)->x1 && (s1)->x2 == (s2)->x2)
806c321187Smrg#define XmuDestroySegment(s)	XtFree((char *)(s))
816c321187Smrg
826c321187Smrg#define XmuDestroyScanline(s)					\
836c321187Smrg		  do {						\
846c321187Smrg		    XmuDestroySegmentList((s)->segment);	\
856c321187Smrg		    XtFree((char*)(s));				\
866c321187Smrg		  } while (0)
876c321187Smrg
886c321187SmrgXmuArea *XmuNewArea(int, int, int, int);
896c321187SmrgXmuArea *XmuAreaDup(XmuArea*);
906c321187SmrgXmuArea *XmuAreaCopy(XmuArea*, XmuArea*);
916c321187SmrgXmuArea *XmuAreaNot(XmuArea*, int, int, int, int);
926c321187SmrgXmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool);
936c321187SmrgXmuArea *XmuAreaAnd(XmuArea*, XmuArea*);
946c321187SmrgBool XmuValidArea(XmuArea*);
956c321187SmrgBool XmuValidScanline(XmuScanline*);
966c321187SmrgBool XmuScanlineEqu(XmuScanline*, XmuScanline*);
976c321187SmrgXmuSegment *XmuNewSegment(int, int);
986c321187Smrgvoid XmuDestroySegmentList(XmuSegment*);
996c321187SmrgXmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*);
1006c321187SmrgBool XmuAppendSegment(XmuSegment*, XmuSegment*);
1016c321187SmrgXmuScanline *XmuOptimizeScanline(XmuScanline*);
1026c321187SmrgXmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int);
1036c321187SmrgXmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*);
1046c321187SmrgXmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*);
1056c321187SmrgXmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*);
1066c321187SmrgXmuScanline *XmuNewScanline(int, int, int);
1076c321187Smrgvoid XmuDestroyScanlineList(XmuScanline*);
1086c321187SmrgXmuArea *XmuOptimizeArea(XmuArea *area);
1096c321187Smrg
1106c321187Smrg#ifndef notdef
1116c321187SmrgXmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*);
1126c321187SmrgXmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*);
1136c321187SmrgXmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*);
1146c321187Smrg#endif /* notdef */
1156c321187Smrg
1166c321187Smrg#ifndef _SYSUTIL_H_
1176c321187Smrgint XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
118e120bd27Smrg    _X_ATTRIBUTE_PRINTF(3,4);
1196c321187Smrg#endif
1206c321187Smrg
1216c321187Smrg#endif /* _XMU_H_ */
1226c321187Smrg
123