Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXDCWindow.h
1 /********************************************************************************
2 * *
3 * D e v i c e C o n t e x t F o r W i n d o w s a n d I m a g e s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXDCWINDOW_H
22 #define FXDCWINDOW_H
23 
24 #ifndef FXDC_H
25 #include "FXDC.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXApp;
32 class FXDrawable;
33 class FXImage;
34 class FXBitmap;
35 class FXIcon;
36 class FXFont;
37 
38 
48 class FXAPI FXDCWindow : public FXDC {
49  friend class FXFont;
50 protected:
51  FXDrawable *surface; // Drawable surface
52  FXRectangle rect; // Paint rectangle inside drawable
53  FXPixel devfg; // Device foreground pixel value
54  FXPixel devbg; // Device background pixel value
55 #ifdef WIN32
56  FXID oldpalette;
57  FXID oldbrush;
58  FXID oldpen;
59  FXbool needsNewBrush;
60  FXbool needsNewPen;
61  FXbool needsPath;
62  FXbool needsClipReset;
63 #else
64  void *xftDraw;
65  FXuint flags;
66 #endif
67 private:
68 #ifdef WIN32
69  void updateBrush();
70  void updatePen();
71 #endif
72 private:
73  FXDCWindow();
74  FXDCWindow(const FXDCWindow&);
75  FXDCWindow &operator=(const FXDCWindow&);
76 public:
77 
80  FXDCWindow(FXDrawable* draw,FXEvent* event);
81 
84  FXDCWindow(FXDrawable* draw);
85 
87  FXDrawable *drawable() const { return surface; }
88 
90  void begin(FXDrawable *draw);
91 
93  void end();
94 
96  virtual FXColor readPixel(FXint x,FXint y);
97 
99  virtual void drawPoint(FXint x,FXint y);
100  virtual void drawPoints(const FXPoint* points,FXuint npoints);
101  virtual void drawPointsRel(const FXPoint* points,FXuint npoints);
102 
104  virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2);
105  virtual void drawLines(const FXPoint* points,FXuint npoints);
106  virtual void drawLinesRel(const FXPoint* points,FXuint npoints);
107  virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments);
108 
110  virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h);
111  virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles);
112 
114  virtual void drawRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
115 
117  virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
118  virtual void drawArcs(const FXArc* arcs,FXuint narcs);
119 
121  virtual void drawEllipse(FXint x,FXint y,FXint w,FXint h);
122 
124  virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h);
125  virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles);
126 
128  virtual void fillRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
129 
131  virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
132  virtual void fillChords(const FXArc* chords,FXuint nchords);
133 
135  virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
136  virtual void fillArcs(const FXArc* arcs,FXuint narcs);
137 
139  virtual void fillEllipse(FXint x,FXint y,FXint w,FXint h);
140 
142  virtual void fillPolygon(const FXPoint* points,FXuint npoints);
143  virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints);
144  virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints);
145 
147  virtual void fillPolygonRel(const FXPoint* points,FXuint npoints);
148  virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints);
149  virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints);
150 
152  virtual void fillVerticalGradient(FXint x,FXint y,FXint w,FXint h,FXColor top,FXColor bottom);
153 
155  virtual void fillHorizontalGradient(FXint x,FXint y,FXint w,FXint h,FXColor left,FXColor right);
156 
158  virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1);
159 
161  virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h);
162 
164  virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy);
165 
167  virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy,FXint dw,FXint dh);
168 
170  virtual void drawImage(const FXImage* image,FXint dx,FXint dy);
171 
173  virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy);
174 
176  virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy);
177  virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy);
178  virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy);
179 
181  virtual void drawText(FXint x,FXint y,const FXString& string);
182  virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length);
183 
185  virtual void drawImageText(FXint x,FXint y,const FXString& string);
186  virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length);
187 
189  virtual void setForeground(FXColor clr);
190  virtual void setBackground(FXColor clr);
191 
193  virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength);
194 
196  virtual void setLineWidth(FXuint linewidth=0);
197 
199  virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT);
200 
202  virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER);
203 
205  virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID);
206 
208  virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID);
209 
211  virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD);
212 
214  virtual void setFunction(FXFunction func=BLT_SRC);
215 
217  virtual void setTile(FXImage* tile,FXint dx=0,FXint dy=0);
218 
220  virtual void setStipple(FXBitmap *stipple,FXint dx=0,FXint dy=0);
221 
223  virtual void setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0);
224 
226  virtual void setClipRegion(const FXRegion& region);
227 
229  virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h);
230 
232  virtual void setClipRectangle(const FXRectangle& rectangle);
233 
235  virtual void clearClipRectangle();
236 
238  virtual void setClipMask(FXBitmap* mask,FXint dx=0,FXint dy=0);
239 
241  virtual void clearClipMask();
242 
244  virtual void setFont(FXFont *fnt);
245 
247  virtual void clipChildren(FXbool yes);
248 
250  virtual ~FXDCWindow();
251  };
252 
253 }
254 
255 #endif

Copyright © 1997-2016 Jeroen van der Zijp