1 /* 2 3 Copyright 1988, 1998 The Open Group 4 5 Permission to use, copy, modify, distribute, and sell this software and its 6 documentation for any purpose is hereby granted without fee, provided that 7 the above copyright notice appear in all copies and that both that 8 copyright notice and this permission notice appear in supporting 9 documentation. 10 11 The above copyright notice and this permission notice shall be included in 12 all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21 Except as contained in this notice, the name of The Open Group shall not be 22 used in advertising or otherwise to promote the sale, use or other dealings 23 in 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 */ 47 typedef struct _XmuSegment { 48 int x1, x2; 49 struct _XmuSegment *next; 50 } XmuSegment; 51 52 typedef struct _XmuScanline { 53 int y; 54 XmuSegment *segment; 55 struct _XmuScanline *next; 56 } XmuScanline; 57 58 typedef 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 88 XmuArea *XmuNewArea(int, int, int, int); 89 XmuArea *XmuAreaDup(XmuArea*); 90 XmuArea *XmuAreaCopy(XmuArea*, XmuArea*); 91 XmuArea *XmuAreaNot(XmuArea*, int, int, int, int); 92 XmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool); 93 XmuArea *XmuAreaAnd(XmuArea*, XmuArea*); 94 Bool XmuValidArea(XmuArea*); 95 Bool XmuValidScanline(XmuScanline*); 96 Bool XmuScanlineEqu(XmuScanline*, XmuScanline*); 97 XmuSegment *XmuNewSegment(int, int); 98 void XmuDestroySegmentList(XmuSegment*); 99 XmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*); 100 Bool XmuAppendSegment(XmuSegment*, XmuSegment*); 101 XmuScanline *XmuOptimizeScanline(XmuScanline*); 102 XmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int); 103 XmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*); 104 XmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*); 105 XmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*); 106 XmuScanline *XmuNewScanline(int, int, int); 107 void XmuDestroyScanlineList(XmuScanline*); 108 XmuArea *XmuOptimizeArea(XmuArea *area); 109 110 #ifndef notdef 111 XmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*); 112 XmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*); 113 XmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*); 114 #endif /* notdef */ 115 116 #ifndef _SYSUTIL_H_ 117 int XmuSnprintf(char *str, int size, _Xconst char *fmt, ...) 118 _X_ATTRIBUTE_PRINTF(3,4); 119 #endif 120 121 #endif /* _XMU_H_ */ 122 123