![]() |
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,2002 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.27 2002/01/18 22:42:51 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXDCWINDOW_H 00025 #define FXDCWINDOW_H 00026 00027 #ifndef FXDC_H 00028 #include "FXDC.h" 00029 #endif 00030 00031 00032 00033 class FXApp; 00034 class FXDrawable; 00035 class FXImage; 00036 class FXBitmap; 00037 class FXIcon; 00038 class FXFont; 00039 class FXVisual; 00040 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* gc; // GC 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 FXID dc; 00069 FXbool needsNewBrush; 00070 FXbool needsNewPen; 00071 FXbool needsPath; 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 arcs 00117 virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00118 virtual void drawArcs(const FXArc* arcs,FXuint narcs); 00119 00120 /// Filled rectangles 00121 virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h); 00122 virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles); 00123 00124 /// Draw arcs 00125 virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00126 virtual void fillArcs(const FXArc* arcs,FXuint narcs); 00127 00128 /// Filled polygon 00129 virtual void fillPolygon(const FXPoint* points,FXuint npoints); 00130 virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints); 00131 virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints); 00132 00133 /// Filled polygon with relative points 00134 virtual void fillPolygonRel(const FXPoint* points,FXuint npoints); 00135 virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints); 00136 virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints); 00137 00138 /// Draw hashed box 00139 virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1); 00140 00141 /// Draw focus rectangle 00142 virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h); 00143 00144 /// Draw area from source 00145 virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy); 00146 00147 /// Draw image 00148 virtual void drawImage(const FXImage* image,FXint dx,FXint dy); 00149 00150 /// Draw bitmap 00151 virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy); 00152 00153 /// Draw icon 00154 virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy); 00155 virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy); 00156 virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy); 00157 00158 /// Draw string 00159 virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length); 00160 virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length); 00161 00162 /// Set foreground/background drawing color 00163 virtual void setForeground(FXColor clr); 00164 virtual void setBackground(FXColor clr); 00165 00166 /// Set dash pattern 00167 virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength); 00168 00169 /// Set line width 00170 virtual void setLineWidth(FXuint linewidth=0); 00171 00172 /// Set line cap style 00173 virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT); 00174 00175 /// Set line join style 00176 virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER); 00177 00178 /// Set line style 00179 virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID); 00180 00181 /// Set fill style 00182 virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID); 00183 00184 /// Set fill rule 00185 virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD); 00186 00187 /// Set blit function 00188 virtual void setFunction(FXFunction func=BLT_SRC); 00189 00190 /// Set the tile 00191 virtual void setTile(FXImage* tile,FXint dx=0,FXint dy=0); 00192 00193 /// Set the stipple pattern 00194 virtual void setStipple(FXBitmap *stipple,FXint dx=0,FXint dy=0); 00195 00196 /// Set the stipple pattern 00197 virtual void setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0); 00198 00199 /// Set clip region 00200 virtual void setClipRegion(const FXRegion& region); 00201 00202 /// Set clip rectangle 00203 virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h); 00204 00205 /// Set clip rectangle 00206 virtual void setClipRectangle(const FXRectangle& rectangle); 00207 00208 /// Clear clipping 00209 virtual void clearClipRectangle(); 00210 00211 /// Set clip mask 00212 virtual void setClipMask(FXBitmap* mask,FXint dx=0,FXint dy=0); 00213 00214 /// Clear clip mask 00215 virtual void clearClipMask(); 00216 00217 /// Set font to draw text with 00218 virtual void setTextFont(FXFont *fnt); 00219 00220 /// Clip against child windows 00221 virtual void clipChildren(FXbool yes); 00222 00223 /// Destructor 00224 virtual ~FXDCWindow(); 00225 }; 00226 00227 00228 #endif