![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * 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 * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1999,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXDCWindow.h,v 1.57 2009/01/06 13:07:22 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXDCWINDOW_H 00024 #define FXDCWINDOW_H 00025 00026 #ifndef FXDC_H 00027 #include "FXDC.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 class FXApp; 00034 class FXDrawable; 00035 class FXImage; 00036 class FXBitmap; 00037 class FXIcon; 00038 class FXFont; 00039 00040 00041 /** 00042 * Window Device Context 00043 * 00044 * The Window Device Context allows drawing into an FXDrawable, such as an 00045 * on-screen window (FXWindow and derivatives) or an off-screen image (FXImage 00046 * and its derivatives). 00047 * Because certain hardware resources are locked down, only one FXDCWindow may be 00048 * locked on a drawable at any one time. 00049 */ 00050 class FXAPI FXDCWindow : public FXDC { 00051 friend class FXFont; 00052 protected: 00053 FXDrawable *surface; // Drawable surface 00054 FXRectangle rect; // Paint rectangle inside drawable 00055 FXPixel devfg; // Device foreground pixel value 00056 FXPixel devbg; // Device background pixel value 00057 #ifdef WIN32 00058 FXID oldpalette; 00059 FXID oldbrush; 00060 FXID oldpen; 00061 FXbool needsNewBrush; 00062 FXbool needsNewPen; 00063 FXbool needsPath; 00064 FXbool needsClipReset; 00065 #else 00066 void *xftDraw; 00067 FXuint flags; 00068 #endif 00069 private: 00070 #ifdef WIN32 00071 void updateBrush(); 00072 void updatePen(); 00073 #endif 00074 private: 00075 FXDCWindow(); 00076 FXDCWindow(const FXDCWindow&); 00077 FXDCWindow &operator=(const FXDCWindow&); 00078 public: 00079 00080 /// Construct for painting in response to expose; 00081 /// This sets the clip rectangle to the exposed rectangle 00082 FXDCWindow(FXDrawable* draw,FXEvent* event); 00083 00084 /// Construct for normal drawing; 00085 /// This sets clip rectangle to the whole drawable 00086 FXDCWindow(FXDrawable* draw); 00087 00088 /// Return active drawable 00089 FXDrawable *drawable() const { return surface; } 00090 00091 /// Begin locks in a drawable surface 00092 void begin(FXDrawable *draw); 00093 00094 /// End unlock the drawable surface 00095 void end(); 00096 00097 /// Read back pixel 00098 virtual FXColor readPixel(FXint x,FXint y); 00099 00100 /// Draw points 00101 virtual void drawPoint(FXint x,FXint y); 00102 virtual void drawPoints(const FXPoint* points,FXuint npoints); 00103 virtual void drawPointsRel(const FXPoint* points,FXuint npoints); 00104 00105 /// Draw lines 00106 virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2); 00107 virtual void drawLines(const FXPoint* points,FXuint npoints); 00108 virtual void drawLinesRel(const FXPoint* points,FXuint npoints); 00109 virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments); 00110 00111 /// Draw rectangles 00112 virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h); 00113 virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles); 00114 00115 /// Draw rounded rectangle with ellipse with ew and ellips height eh 00116 virtual void drawRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh); 00117 00118 /// Draw arcs 00119 virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00120 virtual void drawArcs(const FXArc* arcs,FXuint narcs); 00121 00122 /// Draw ellipse 00123 virtual void drawEllipse(FXint x,FXint y,FXint w,FXint h); 00124 00125 /// Filled rectangles 00126 virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h); 00127 virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles); 00128 00129 /// Filled rounded rectangle with ellipse with ew and ellips height eh 00130 virtual void fillRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh); 00131 00132 /// Fill chord 00133 virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00134 virtual void fillChords(const FXArc* chords,FXuint nchords); 00135 00136 /// Draw arcs 00137 virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00138 virtual void fillArcs(const FXArc* arcs,FXuint narcs); 00139 00140 /// Fill ellipse 00141 virtual void fillEllipse(FXint x,FXint y,FXint w,FXint h); 00142 00143 /// Filled polygon 00144 virtual void fillPolygon(const FXPoint* points,FXuint npoints); 00145 virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints); 00146 virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints); 00147 00148 /// Filled polygon with relative points 00149 virtual void fillPolygonRel(const FXPoint* points,FXuint npoints); 00150 virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints); 00151 virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints); 00152 00153 /// Fill vertical gradient rectangle 00154 virtual void fillVerticalGradient(FXint x,FXint y,FXint w,FXint h,FXColor top,FXColor bottom); 00155 00156 /// Fill horizontal gradient rectangle 00157 virtual void fillHorizontalGradient(FXint x,FXint y,FXint w,FXint h,FXColor left,FXColor right); 00158 00159 /// Draw hashed box 00160 virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1); 00161 00162 /// Draw focus rectangle 00163 virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h); 00164 00165 /// Draw area from source 00166 virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy); 00167 00168 /// Draw area stretched area from source 00169 virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy,FXint dw,FXint dh); 00170 00171 /// Draw image 00172 virtual void drawImage(const FXImage* image,FXint dx,FXint dy); 00173 00174 /// Draw bitmap 00175 virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy); 00176 00177 /// Draw icon 00178 virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy); 00179 virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy); 00180 virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy); 00181 00182 /// Draw string with base line starting at x, y 00183 virtual void drawText(FXint x,FXint y,const FXString& string); 00184 virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length); 00185 00186 /// Draw text starting at x, y over filled background 00187 virtual void drawImageText(FXint x,FXint y,const FXString& string); 00188 virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length); 00189 00190 /// Set foreground/background drawing color 00191 virtual void setForeground(FXColor clr); 00192 virtual void setBackground(FXColor clr); 00193 00194 /// Set dash pattern 00195 virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength); 00196 00197 /// Set line width 00198 virtual void setLineWidth(FXuint linewidth=0); 00199 00200 /// Set line cap style 00201 virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT); 00202 00203 /// Set line join style 00204 virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER); 00205 00206 /// Set line style 00207 virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID); 00208 00209 /// Set fill style 00210 virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID); 00211 00212 /// Set fill rule 00213 virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD); 00214 00215 /// Set blit function 00216 virtual void setFunction(FXFunction func=BLT_SRC); 00217 00218 /// Set the tile 00219 virtual void setTile(FXImage* tile,FXint dx=0,FXint dy=0); 00220 00221 /// Set the stipple pattern 00222 virtual void setStipple(FXBitmap *stipple,FXint dx=0,FXint dy=0); 00223 00224 /// Set the stipple pattern 00225 virtual void setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0); 00226 00227 /// Set clip region 00228 virtual void setClipRegion(const FXRegion& region); 00229 00230 /// Set clip rectangle 00231 virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h); 00232 00233 /// Set clip rectangle 00234 virtual void setClipRectangle(const FXRectangle& rectangle); 00235 00236 /// Clear clipping 00237 virtual void clearClipRectangle(); 00238 00239 /// Set clip mask 00240 virtual void setClipMask(FXBitmap* mask,FXint dx=0,FXint dy=0); 00241 00242 /// Clear clip mask 00243 virtual void clearClipMask(); 00244 00245 /// Set font to draw text with 00246 virtual void setFont(FXFont *fnt); 00247 00248 /// Clip against child windows 00249 virtual void clipChildren(FXbool yes); 00250 00251 /// Destructor 00252 virtual ~FXDCWindow(); 00253 }; 00254 00255 } 00256 00257 #endif
![]() |