1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
#ifndef _Paint_h
#define _Paint_h
/* +-------------------------------------------------------------------+ */
/* | Copyright 1992, 1993, David Koblas (koblas@netcom.com) | */
/* | Copyright 1995, 1996 Torsten Martinsen (bullestock@dk-online.dk) | */
/* | | */
/* | Permission to use, copy, modify, and to distribute this software | */
/* | and its documentation for any purpose is hereby granted without | */
/* | fee, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. There is no | */
/* | representations about the suitability of this software for | */
/* | any purpose. this software is provided "as is" without express | */
/* | or implied warranty. | */
/* | | */
/* +-------------------------------------------------------------------+ */
/* $Id: Paint.h,v 1.8 1996/04/19 08:52:40 torsten Exp $ */
/****************************************************************
*
* Paint widget
*
****************************************************************/
/* Resources:
Name Class RepType Default Value
---- ----- ------- -------------
background Background Pixel XtDefaultBackground
border BorderColor Pixel XtDefaultForeground
borderWidth BorderWidth Dimension 1
destroyCallback Callback Pointer NULL
height Height Dimension 0
mappedWhenManaged MappedWhenManaged Boolean True
sensitive Sensitive Boolean True
width Width Dimension 0
x Position Position 0
y Position Position 0
*/
/* define any special resource names here that are not in <X11/StringDefs.h> */
#define XtNpaintResource "paintResource"
#define XtNpattern "pattern"
#define XtNgrid "grid"
#define XtNsnap "snap"
#define XtNsnapOn "snapOn"
#define XtNlineWidth "lineWidth"
#define XtNfatBack "fatBack"
#define XtNsizeChanged "sizeChanged"
#define XtNundoSize "undoSize"
#define XtNzoom "zoom"
#define XtNpaint "paint"
#define XtNzoomX "zoomX"
#define XtNzoomY "zoomY"
#define XtNdrawWidth "drawWidth"
#define XtNdrawHeight "drawHeight"
#define XtNcompress "compress"
#define XtNdirty "dirty"
#define XtNfillRule "fillRule"
#define XtNregionCallback "regionSetCallback"
#define XtNdownX "downX"
#define XtNdownY "downY"
#define XtNlineForeground "lineForeground"
#define XtNlinePattern "linePattern"
#define XtNlineFillRule "lineFillRule"
#ifndef XtNreadOnly
#define XtNreadOnly "readOnly"
#endif
#ifndef XtNcursor
#define XtNcursor "cursor"
#endif
#define XtNfilename "filename"
#define XtNmenuwidgets "menuwidgets"
#define XtCPaintResource "PaintResource"
#define XtCPattern "Pattern"
#define XtCGrid "Grid"
#define XtCSnap "Snap"
#define XtCSnapOn "SnapOn"
#define XtCLineWidth "LineWidth"
#define XtCFatBack "FatBack"
#define XtCSizeChanged "SizeChanged"
#define XtCUndoSize "UndoSize"
#define XtCZoom "Zoom"
#define XtCPaint "Paint"
#define XtCZoomX "ZoomX"
#define XtCZoomY "ZoomY"
#define XtCDrawWidth "DrawWidth"
#define XtCDrawHeight "DrawHeight"
#define XtCCompress "Compress"
#define XtCDirty "Dirty"
#define XtCFillRule "FillRule"
#define XtCRegionCallback "RegionSetCallback"
#define XtCDownX "DownX"
#define XtCDownY "DownY"
#define XtCLineForeground "LineForeground"
#define XtCLinePattern "LinePattern"
#define XtCLineFillRule "LineFillRule"
#ifndef XtCReadOnly
#define XtCReadOnly "ReadOnly"
#endif
#define XtCfilename "Filename"
#define XtCmenuwidgets "Menuwidgets"
#define NMENUWIDGETS 3
/* declare specific PaintWidget class and instance datatypes */
typedef struct _PaintClassRec *PaintClass;
typedef struct _PaintRec *PaintWidget;
/* declare the class constant */
extern WidgetClass paintWidgetClass;
/*
** Operation callback information
*/
typedef enum {
opPixmap = 0x01, opWindow = 0x02
} OpSurface;
typedef struct {
int refCount;
OpSurface surface;
Drawable drawable;
GC first_gc, second_gc, base_gc;
void *data;
int isFat;
int x, y;
int realX, realY;
int zoom;
Pixmap base;
} OpInfo;
typedef float pwMatrix[2][2];
typedef void (*OpEventProc) (Widget, void *, XEvent *, OpInfo *);
void OpRemoveEventHandler(Widget, int, int, Boolean, OpEventProc, void *);
void OpAddEventHandler(Widget, int, int, Boolean, OpEventProc, void *);
void UndoStart(Widget, OpInfo *);
void UndoStartRectangle(Widget, OpInfo *, XRectangle *);
void UndoStartPoint(Widget, OpInfo *, int, int);
void UndoSetRectangle(Widget, XRectangle *);
void UndoGrow(Widget, int, int);
Pixmap PwUndoStart(Widget, XRectangle *);
void PwUndoSetRectangle(Widget, XRectangle *);
void PwUndoAddRectangle(Widget, XRectangle *);
void Undo(Widget);
void Redo(Widget);
void UndoInitialize(PaintWidget pw, int n);
#define PwZoomParent ((int) -10000)
/*
** Public functions
*/
void PwUpdateFromLast(Widget, XRectangle *);
void PwUpdate(Widget, XRectangle *, Boolean);
void PwUpdateDrawable(Widget, Drawable, XRectangle *);
void PwSetDrawn(Widget, Boolean);
void PwGetPixmap(Widget, Pixmap *, int *, int *);
void PwPutPixmap(Widget w, Pixmap pix);
XRectangle *PwScaleRectangle(Widget, XRectangle *);
XImage *PwGetImage(Widget, XRectangle *);
/*
** Region routines
*/
void PwRegionSet(Widget, XRectangle *, Pixmap, Pixmap);
void PwRegionSetRawPixmap(Widget, Pixmap);
void PwRegionTear(Widget);
Boolean PwRegionGet(Widget, Pixmap *, Pixmap *);
Pixmap PwGetRawPixmap(Widget);
void PwRegionSetMatrix(Widget, pwMatrix);
void PwRegionAppendMatrix(Widget, pwMatrix);
void PwRegionAddScale(Widget, float *, float *);
void PwRegionSetScale(Widget, float *, float *);
void PwRegionReset(Widget, Boolean);
void PwRegionClear(Widget);
void PwRegionFinish(Widget, Boolean);
Boolean PwRegionOff(Widget w, Boolean flag);
typedef Pixmap(*pwRegionDoneProc) (Widget, XImage *, pwMatrix);
void PwRegionSetDone(Widget, pwRegionDoneProc);
void RegionCrop(PaintWidget paint);
void RegionMove(PaintWidget pw, int dx, int dy);
#endif /* _Paint_h */
|