00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXDC_H
00025 #define FXDC_H
00026
00027 namespace FX {
00028
00029
00030 enum FXFunction {
00031 BLT_CLR,
00032 BLT_SRC_AND_DST,
00033 BLT_SRC_AND_NOT_DST,
00034 BLT_SRC,
00035 BLT_NOT_SRC_AND_DST,
00036 BLT_DST,
00037 BLT_SRC_XOR_DST,
00038 BLT_SRC_OR_DST,
00039 BLT_NOT_SRC_AND_NOT_DST,
00040 BLT_NOT_SRC_XOR_DST,
00041 BLT_NOT_DST,
00042 BLT_SRC_OR_NOT_DST,
00043 BLT_NOT_SRC,
00044 BLT_NOT_SRC_OR_DST,
00045 BLT_NOT_SRC_OR_NOT_DST,
00046 BLT_SET
00047 };
00048
00049
00050
00051 enum FXLineStyle {
00052 LINE_SOLID,
00053 LINE_ONOFF_DASH,
00054 LINE_DOUBLE_DASH
00055 };
00056
00057
00058
00059 enum FXCapStyle {
00060 CAP_NOT_LAST,
00061 CAP_BUTT,
00062 CAP_ROUND,
00063 CAP_PROJECTING
00064 };
00065
00066
00067
00068 enum FXJoinStyle {
00069 JOIN_MITER,
00070 JOIN_ROUND,
00071 JOIN_BEVEL
00072 };
00073
00074
00075
00076 enum FXFillStyle {
00077 FILL_SOLID,
00078 FILL_TILED,
00079 FILL_STIPPLED,
00080 FILL_OPAQUESTIPPLED
00081 };
00082
00083
00084
00085 enum FXFillRule {
00086 RULE_EVEN_ODD,
00087 RULE_WINDING
00088 };
00089
00090
00091
00092 enum FXStipplePattern {
00093 STIPPLE_0 = 0,
00094 STIPPLE_NONE = 0,
00095 STIPPLE_BLACK = 0,
00096 STIPPLE_1 = 1,
00097 STIPPLE_2 = 2,
00098 STIPPLE_3 = 3,
00099 STIPPLE_4 = 4,
00100 STIPPLE_5 = 5,
00101 STIPPLE_6 = 6,
00102 STIPPLE_7 = 7,
00103 STIPPLE_8 = 8,
00104 STIPPLE_GRAY = 8,
00105 STIPPLE_9 = 9,
00106 STIPPLE_10 = 10,
00107 STIPPLE_11 = 11,
00108 STIPPLE_12 = 12,
00109 STIPPLE_13 = 13,
00110 STIPPLE_14 = 14,
00111 STIPPLE_15 = 15,
00112 STIPPLE_16 = 16,
00113 STIPPLE_WHITE = 16,
00114 STIPPLE_HORZ = 17,
00115 STIPPLE_VERT = 18,
00116 STIPPLE_CROSS = 19,
00117 STIPPLE_DIAG = 20,
00118 STIPPLE_REVDIAG = 21,
00119 STIPPLE_CROSSDIAG = 22
00120 };
00121
00122
00123
00124 struct FXSegment {
00125 FXshort x1,y1,x2,y2;
00126 };
00127
00128
00129
00130 struct FXArc {
00131 FXshort x,y,w,h,a,b;
00132 };
00133
00134
00135 class FXApp;
00136 class FXImage;
00137 class FXBitmap;
00138 class FXIcon;
00139 class FXFont;
00140 class FXDrawable;
00141 class FXRegion;
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 class FXAPI FXDC {
00155 private:
00156 FXApp *app;
00157 protected:
00158 void *ctx;
00159 FXFont *font;
00160 FXStipplePattern pattern;
00161 FXBitmap *stipple;
00162 FXImage *tile;
00163 FXBitmap *mask;
00164 FXRectangle clip;
00165 FXColor fg;
00166 FXColor bg;
00167 FXuint width;
00168 FXCapStyle cap;
00169 FXJoinStyle join;
00170 FXLineStyle style;
00171 FXFillStyle fill;
00172 FXFillRule rule;
00173 FXFunction rop;
00174 FXchar dashpat[32];
00175 FXuint dashlen;
00176 FXuint dashoff;
00177 FXint tx;
00178 FXint ty;
00179 FXint cx;
00180 FXint cy;
00181 private:
00182 FXDC();
00183 FXDC(const FXDC&);
00184 FXDC &operator=(const FXDC&);
00185 public:
00186
00187
00188 FXDC(FXApp* a);
00189
00190
00191 FXApp* getApp() const { return app; }
00192
00193
00194 void* context() const { return ctx; }
00195
00196
00197 virtual FXColor readPixel(FXint x,FXint y);
00198
00199
00200 virtual void drawPoint(FXint x,FXint y);
00201 virtual void drawPoints(const FXPoint* points,FXuint npoints);
00202 virtual void drawPointsRel(const FXPoint* points,FXuint npoints);
00203
00204
00205 virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2);
00206 virtual void drawLines(const FXPoint* points,FXuint npoints);
00207 virtual void drawLinesRel(const FXPoint* points,FXuint npoints);
00208 virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments);
00209
00210
00211 virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h);
00212 virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles);
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
00223 virtual void drawArcs(const FXArc* arcs,FXuint narcs);
00224
00225
00226 virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h);
00227 virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles);
00228
00229
00230 virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
00231 virtual void fillChords(const FXArc* chords,FXuint nchords);
00232
00233
00234 virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
00235 virtual void fillArcs(const FXArc* arcs,FXuint narcs);
00236
00237
00238 virtual void fillPolygon(const FXPoint* points,FXuint npoints);
00239 virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints);
00240 virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints);
00241
00242
00243 virtual void fillPolygonRel(const FXPoint* points,FXuint npoints);
00244 virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints);
00245 virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints);
00246
00247
00248 virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1);
00249
00250
00251 virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h);
00252
00253
00254 virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy);
00255
00256
00257 virtual void drawImage(const FXImage* image,FXint dx,FXint dy);
00258
00259
00260 virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy);
00261
00262
00263 virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy);
00264 virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy);
00265 virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy);
00266
00267
00268 virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length);
00269 virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length);
00270
00271
00272 virtual void setForeground(FXColor clr);
00273
00274
00275 FXColor getForeground() const { return fg; }
00276
00277
00278 virtual void setBackground(FXColor clr);
00279
00280
00281 FXColor getBackground() const { return bg; }
00282
00283
00284
00285
00286
00287
00288
00289
00290 virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength);
00291
00292
00293 const FXchar* getDashPattern() const { return dashpat; }
00294
00295
00296 FXuint getDashOffset() const { return dashoff; }
00297
00298
00299 FXuint getDashLength() const { return dashlen; }
00300
00301
00302 virtual void setLineWidth(FXuint linewidth=0);
00303
00304
00305 FXuint getLineWidth() const { return width; }
00306
00307
00308 virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT);
00309
00310
00311 FXCapStyle getLineCap() const { return cap; }
00312
00313
00314 virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER);
00315
00316
00317 FXJoinStyle getLineJoin() const { return join; }
00318
00319
00320 virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID);
00321
00322
00323 FXLineStyle getLineStyle() const { return style; }
00324
00325
00326 virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID);
00327
00328
00329 FXFillStyle getFillStyle() const { return fill; }
00330
00331
00332 virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD);
00333
00334
00335 FXFillRule getFillRule() const { return rule; }
00336
00337
00338 virtual void setFunction(FXFunction func=BLT_SRC);
00339
00340
00341 FXFunction getFunction() const { return rop; }
00342
00343
00344 virtual void setTile(FXImage* image,FXint dx=0,FXint dy=0);
00345
00346
00347 FXImage *getTile() const { return tile; }
00348
00349
00350 virtual void setStipple(FXBitmap *bitmap,FXint dx=0,FXint dy=0);
00351
00352
00353 FXBitmap *getStippleBitmap() const { return stipple; }
00354
00355
00356 virtual void setStipple(FXStipplePattern pat,FXint dx=0,FXint dy=0);
00357
00358
00359 FXStipplePattern getStipplePattern() const { return pattern; }
00360
00361
00362 virtual void setClipRegion(const FXRegion& region);
00363
00364
00365 virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h);
00366
00367
00368 virtual void setClipRectangle(const FXRectangle& rectangle);
00369
00370
00371 const FXRectangle& getClipRectangle() const { return clip; }
00372
00373
00374 FXint getClipX() const { return clip.x; }
00375
00376
00377 FXint getClipY() const { return clip.y; }
00378
00379
00380 FXint getClipWidth() const { return clip.w; }
00381
00382
00383 FXint getClipHeight() const { return clip.h; }
00384
00385
00386 virtual void clearClipRectangle();
00387
00388
00389 virtual void setClipMask(FXBitmap* bitmap,FXint dx=0,FXint dy=0);
00390
00391
00392 virtual void clearClipMask();
00393
00394
00395 virtual void setFont(FXFont *fnt);
00396
00397
00398 FXFont* getFont() const { return font; }
00399
00400
00401 virtual void clipChildren(FXbool yes);
00402
00403
00404 virtual ~FXDC();
00405 };
00406
00407 }
00408
00409 #endif