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