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