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