1/*
2
3Copyright 1988, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25*/
26
27/*
28 * The interfaces described by this header file are for miscellaneous utilities
29 * and are not part of the Xlib standard.
30 */
31
32#ifndef _XMU_H_
33#define _XMU_H_
34
35#include <X11/Xfuncproto.h>
36#include <X11/Intrinsic.h>
37#include <X11/Xmu/Atoms.h>		/* _XA_... */
38#include <X11/Xmu/CharSet.h>		/* CopyISOLatin1Lowered */
39#include <X11/Xmu/Converters.h>		/* CvtStringTo... */
40#include <X11/Xmu/Drawing.h>		/* DrawRoundedRect, DrawLogo */
41#include <X11/Xmu/Error.h>		/* PrintDefaultError */
42#include <X11/Xmu/StdSel.h>		/* ConvertStandardSelection */
43
44/*
45 * clip lists
46 */
47typedef struct _XmuSegment {
48  int x1, x2;
49  struct _XmuSegment *next;
50} XmuSegment;
51
52typedef struct _XmuScanline {
53  int y;
54  XmuSegment *segment;
55  struct _XmuScanline *next;
56} XmuScanline;
57
58typedef struct _XmuArea {
59  XmuScanline *scanline;
60} XmuArea;
61
62#define XmuCreateArea()		XmuNewArea(0, 0, 0, 0)
63#define XmuAreaOr(dst, src)	XmuAreaOrXor((dst), (src), True)
64#define XmuAreaXor(dst, src)	XmuAreaOrXor((dst), (src), False)
65
66#define XmuDestroyArea(a)					\
67		  do {						\
68		    XmuDestroyScanlineList((a)->scanline);	\
69		    XtFree((char *)(a));			\
70		  } while (0)
71
72#define FreeArea(a)						\
73		  do {						\
74		    XmuDestroyScanlineList((a)->scanline);	\
75		    a->scanline = (Scanline *)0;		\
76		  } while (0)
77
78#define XmuValidSegment(s)	((s)->x1 < (s)->x2)
79#define XmuSegmentEqu(s1, s2)	((s1)->x1 == (s2)->x1 && (s1)->x2 == (s2)->x2)
80#define XmuDestroySegment(s)	XtFree((char *)(s))
81
82#define XmuDestroyScanline(s)					\
83		  do {						\
84		    XmuDestroySegmentList((s)->segment);	\
85		    XtFree((char*)(s));				\
86		  } while (0)
87
88XmuArea *XmuNewArea(int, int, int, int);
89XmuArea *XmuAreaDup(XmuArea*);
90XmuArea *XmuAreaCopy(XmuArea*, XmuArea*);
91XmuArea *XmuAreaNot(XmuArea*, int, int, int, int);
92XmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool);
93XmuArea *XmuAreaAnd(XmuArea*, XmuArea*);
94Bool XmuValidArea(XmuArea*);
95Bool XmuValidScanline(XmuScanline*);
96Bool XmuScanlineEqu(XmuScanline*, XmuScanline*);
97XmuSegment *XmuNewSegment(int, int);
98void XmuDestroySegmentList(XmuSegment*);
99XmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*);
100Bool XmuAppendSegment(XmuSegment*, XmuSegment*);
101XmuScanline *XmuOptimizeScanline(XmuScanline*);
102XmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int);
103XmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*);
104XmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*);
105XmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*);
106XmuScanline *XmuNewScanline(int, int, int);
107void XmuDestroyScanlineList(XmuScanline*);
108XmuArea *XmuOptimizeArea(XmuArea *area);
109
110#ifndef notdef
111XmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*);
112XmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*);
113XmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*);
114#endif /* notdef */
115
116#ifndef _SYSUTIL_H_
117int XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
118    _X_ATTRIBUTE_PRINTF(3,4);
119#endif
120
121#endif /* _XMU_H_ */
122
123