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

FXDCWindow.h
Go to the documentation of this file.
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,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (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 GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXDCWindow.h,v 1.46 2006/01/22 17:58:00 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXDCWINDOW_H
25 #define FXDCWINDOW_H
26 
27 #ifndef FXDC_H
28 #include "FXDC.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXApp;
35 class FXDrawable;
36 class FXImage;
37 class FXBitmap;
38 class FXIcon;
39 class FXFont;
40 class FXVisual;
41 
42 
43 /**
44 * Window Device Context
45 *
46 * The Window Device Context allows drawing into an FXDrawable, such as an
47 * on-screen window (FXWindow and derivatives) or an off-screen image (FXImage
48 * and its derivatives).
49 * Because certain hardware resources are locked down, only one FXDCWindow may be
50 * locked on a drawable at any one time.
51 */
52 class FXAPI FXDCWindow : public FXDC {
53  friend class FXFont;
54 protected:
55  FXDrawable *surface; // Drawable surface
56  FXVisual *visual; // Visual of drawable
57  FXRectangle rect; // Paint rectangle inside drawable
58 #ifndef WIN32
59  FXuint flags; // GC Flags
60  FXPixel devfg; // Device foreground pixel value
61  FXPixel devbg; // Device background pixel value
62  void *xftDraw; // Hook used only for XFT support
63 #else
64  FXID oldpalette;
65  FXID oldbrush;
66  FXID oldpen;
67  FXPixel devfg; // Device foreground pixel value
68  FXPixel devbg; // Device background pixel value
69  FXbool needsNewBrush;
70  FXbool needsNewPen;
71  FXbool needsPath;
72  FXbool needsClipReset;
73 #endif
74 private:
75 #ifdef WIN32
76  void updateBrush();
77  void updatePen();
78 #endif
79 private:
80  FXDCWindow();
81  FXDCWindow(const FXDCWindow&);
82  FXDCWindow &operator=(const FXDCWindow&);
83 public:
84 
85  /// Construct for painting in response to expose;
86  /// This sets the clip rectangle to the exposed rectangle
87  FXDCWindow(FXDrawable* drawable,FXEvent* event);
88 
89  /// Construct for normal drawing;
90  /// This sets clip rectangle to the whole drawable
91  FXDCWindow(FXDrawable* drawable);
92 
93  /// Begin locks in a drawable surface
94  void begin(FXDrawable *drawable);
95 
96  /// End unlock the drawable surface
97  void end();
98 
99  /// Read back pixel
100  virtual FXColor readPixel(FXint x,FXint y);
101 
102  /// Draw points
103  virtual void drawPoint(FXint x,FXint y);
104  virtual void drawPoints(const FXPoint* points,FXuint npoints);
105  virtual void drawPointsRel(const FXPoint* points,FXuint npoints);
106 
107  /// Draw lines
108  virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2);
109  virtual void drawLines(const FXPoint* points,FXuint npoints);
110  virtual void drawLinesRel(const FXPoint* points,FXuint npoints);
111  virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments);
112 
113  /// Draw rectangles
114  virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h);
115  virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles);
116 
117  /// Draw rounded rectangle with ellipse with ew and ellips height eh
118  virtual void drawRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
119 
120  /// Draw arcs
121  virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
122  virtual void drawArcs(const FXArc* arcs,FXuint narcs);
123 
124  /// Draw ellipse
125  virtual void drawEllipse(FXint x,FXint y,FXint w,FXint h);
126 
127  /// Filled rectangles
128  virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h);
129  virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles);
130 
131  /// Filled rounded rectangle with ellipse with ew and ellips height eh
132  virtual void fillRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
133 
134  /// Fill chord
135  virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
136  virtual void fillChords(const FXArc* chords,FXuint nchords);
137 
138  /// Draw arcs
139  virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
140  virtual void fillArcs(const FXArc* arcs,FXuint narcs);
141 
142  /// Fill ellipse
143  virtual void fillEllipse(FXint x,FXint y,FXint w,FXint h);
144 
145  /// Filled polygon
146  virtual void fillPolygon(const FXPoint* points,FXuint npoints);
147  virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints);
148  virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints);
149 
150  /// Filled polygon with relative points
151  virtual void fillPolygonRel(const FXPoint* points,FXuint npoints);
152  virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints);
153  virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints);
154 
155  /// Draw hashed box
156  virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1);
157 
158  /// Draw focus rectangle
159  virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h);
160 
161  /// Draw area from source
162  virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy);
163 
164  /// Draw area stretched area from source
165  virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy,FXint dw,FXint dh);
166 
167  /// Draw image
168  virtual void drawImage(const FXImage* image,FXint dx,FXint dy);
169 
170  /// Draw bitmap
171  virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy);
172 
173  /// Draw icon
174  virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy);
175  virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy);
176  virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy);
177 
178  /// Draw string with base line starting at x, y
179  virtual void drawText(FXint x,FXint y,const FXString& string);
180  virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length);
181 
182  /// Draw text starting at x, y over filled background
183  virtual void drawImageText(FXint x,FXint y,const FXString& string);
184  virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length);
185 
186  /// Set foreground/background drawing color
187  virtual void setForeground(FXColor clr);
188  virtual void setBackground(FXColor clr);
189 
190  /// Set dash pattern
191  virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength);
192 
193  /// Set line width
194  virtual void setLineWidth(FXuint linewidth=0);
195 
196  /// Set line cap style
197  virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT);
198 
199  /// Set line join style
200  virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER);
201 
202  /// Set line style
203  virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID);
204 
205  /// Set fill style
206  virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID);
207 
208  /// Set fill rule
209  virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD);
210 
211  /// Set blit function
212  virtual void setFunction(FXFunction func=BLT_SRC);
213 
214  /// Set the tile
215  virtual void setTile(FXImage* tile,FXint dx=0,FXint dy=0);
216 
217  /// Set the stipple pattern
218  virtual void setStipple(FXBitmap *stipple,FXint dx=0,FXint dy=0);
219 
220  /// Set the stipple pattern
221  virtual void setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0);
222 
223  /// Set clip region
224  virtual void setClipRegion(const FXRegion& region);
225 
226  /// Set clip rectangle
227  virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h);
228 
229  /// Set clip rectangle
230  virtual void setClipRectangle(const FXRectangle& rectangle);
231 
232  /// Clear clipping
233  virtual void clearClipRectangle();
234 
235  /// Set clip mask
236  virtual void setClipMask(FXBitmap* mask,FXint dx=0,FXint dy=0);
237 
238  /// Clear clip mask
239  virtual void clearClipMask();
240 
241  /// Set font to draw text with
242  virtual void setFont(FXFont *fnt);
243 
244  /// Clip against child windows
245  virtual void clipChildren(FXbool yes);
246 
247  /// Destructor
248  virtual ~FXDCWindow();
249  };
250 
251 }
252 
253 #endif
Even odd polygon filling.
Definition: FXDC.h:109
unsigned long FXID
Definition: fxdefs.h:442
A Bitmap is a rectangular array of pixels.
Definition: FXBitmap.h:64
char FXchar
Definition: fxdefs.h:387
Rectangle.
Definition: FXRectangle.h:37
Fill with solid color.
Definition: FXDC.h:96
unsigned long FXPixel
Definition: fxdefs.h:451
unsigned int FXuint
Definition: fxdefs.h:396
FXFillRule
Fill Rules.
Definition: FXDC.h:108
FXJoinStyle
Line Join Styles.
Definition: FXDC.h:83
Solid lines.
Definition: FXDC.h:59
#define FXAPI
Definition: fxdefs.h:122
D := S.
Definition: FXDC.h:37
FXuchar FXbool
Definition: fxdefs.h:393
FXCapStyle
Line Cap Styles.
Definition: FXDC.h:70
FXFillStyle
Fill Styles.
Definition: FXDC.h:95
FXuint FXColor
Definition: fxdefs.h:454
Arc.
Definition: FXDC.h:158
Line segment.
Definition: FXDC.h:152
Abstract Device Context.
Definition: FXDC.h:191
FXLineStyle
Line Styles.
Definition: FXDC.h:58
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
FXStipplePattern
Stipple/dither patterns.
Definition: FXDC.h:119
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
FOX Event.
Definition: FXApp.h:125
Butting line end caps.
Definition: FXDC.h:72
Visual describes pixel format of a drawable.
Definition: FXVisual.h:84
Point.
Definition: FXPoint.h:35
Mitered or pointy joints.
Definition: FXDC.h:84
Window Device Context.
Definition: FXDCWindow.h:52
Region.
Definition: FXRegion.h:30
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
FXFunction
Drawing (BITBLT) functions.
Definition: FXDC.h:33
Font class.
Definition: FXFont.h:142
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33
Drawable is an abstract base class for any surface that can be drawn upon, such as a FXWindow...
Definition: FXDrawable.h:41

Copyright © 1997-2005 Jeroen van der Zijp