1 /* AbiWord 2 * Copyright (C) 2003 Dom Lachowicz <cinamod@hotmail.com> 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 * 02110-1301 USA. 18 */ 19 20 #ifndef GR_PAINTER_H 21 #define GR_PAINTER_H 22 23 #include "xap_Features.h" 24 #include "gr_Graphics.h" 25 26 class ABI_EXPORT GR_Painter 27 { 28 public: 29 30 GR_Painter (GR_Graphics * pGr, bool bDisableCarets = true); 31 ~GR_Painter (); 32 33 void drawLine(UT_sint32 x1, UT_sint32 y1, UT_sint32 x2, UT_sint32 y2); 34 #if XAP_DONTUSE_XOR 35 #else 36 void xorLine(UT_sint32 x1, UT_sint32 y1, UT_sint32 x2, UT_sint32 y2); 37 void xorRect(UT_sint32 x, UT_sint32 y, UT_sint32 w, UT_sint32 h); 38 void xorRect(const UT_Rect& r); 39 #endif 40 void invertRect(const UT_Rect* pRect); 41 42 void fillRect(const UT_RGBColor& c, UT_sint32 x, UT_sint32 y, 43 UT_sint32 w, UT_sint32 h); 44 void fillRect(GR_Image *pImg, const UT_Rect &src, const UT_Rect & dest); 45 void fillRect(const UT_RGBColor& c, const UT_Rect &r); 46 47 void clearArea(UT_sint32 x, UT_sint32 y, UT_sint32 w, UT_sint32 h); 48 void drawImage(GR_Image* pImg, UT_sint32 xDest, UT_sint32 yDest); 49 void fillRect(GR_Graphics::GR_Color3D c, 50 UT_sint32 x, 51 UT_sint32 y, 52 UT_sint32 w, 53 UT_sint32 h); 54 55 void fillRect(GR_Graphics::GR_Color3D c, UT_Rect &r); 56 void polygon(UT_RGBColor& c, UT_Point *pts, UT_uint32 nPoints); 57 void polyLine(UT_Point * pts, UT_uint32 nPoints); 58 void drawGlyph(UT_uint32 glyph_idx, UT_sint32 xoff, UT_sint32 yoff); 59 void drawChars(const UT_UCSChar* pChars, 60 int iCharOffset, 61 int iLength, 62 UT_sint32 xoff, 63 UT_sint32 yoff, 64 int* pCharWidths = NULL); 65 66 void drawCharsRelativeToBaseline(const UT_UCSChar* pChars, 67 int iCharOffset, 68 int iLength, 69 UT_sint32 xoff, 70 UT_sint32 yoff, 71 int* pCharWidths = NULL); 72 73 void renderChars(GR_RenderInfo & ri); 74 75 76 GR_Image * genImageFromRectangle(const UT_Rect & r); 77 78 // These just call the functions with the same name in GR_Graphics. 79 void beginDoubleBuffering(); 80 void endDoubleBuffering(); 81 82 void suspendDrawing(); 83 void resumeDrawing(); 84 85 private: 86 87 GR_Painter (); 88 GR_Painter (const GR_Painter & rhs); 89 GR_Painter& operator=(const GR_Painter & rhs); 90 91 GR_Graphics * m_pGr; 92 bool m_bCaretsDisabled; 93 94 bool m_bDoubleBufferingToken; 95 bool m_bSuspendDrawingToken; 96 }; 97 98 #endif // GR_PAINTER_H 99