4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
16 #include "frontends/Painter.h"
30 * GuiPainter - a painter implementation for Qt4
32 class GuiPainter : public QPainter, public Painter {
34 GuiPainter(QPaintDevice *);
35 virtual ~GuiPainter();
37 /// draw a line from point to point
42 line_style = line_solid,
43 line_width = line_thin);
46 * lines - draw a set of lines
47 * @param xp array of points' x co-ords
48 * @param yp array of points' y co-ords
49 * @param np size of the points array
56 line_style = line_solid,
57 line_width = line_thin);
60 virtual void rectangle(
64 line_style = line_solid,
65 line_width = line_thin);
67 /// draw a filled rectangle
68 virtual void fillRectangle(
76 unsigned int w, unsigned int h,
85 /// draw an image from the image cache
86 virtual void image(int x, int y,
88 lyx::graphics::Image const & image);
90 /// draw a string at position x, y (y is the baseline)
91 virtual int text(int x, int y,
92 docstring const & str, FontInfo const & f);
94 /// draw a char at position x, y (y is the baseline)
95 virtual int text(int x, int y, char_type c, FontInfo const & f);
97 /// start monochrome painting mode, i.e. map every color into [min,max]
98 virtual void enterMonochromeMode(ColorCode const & min,
99 ColorCode const & max);
100 /// leave monochrome painting mode
101 virtual void leaveMonochromeMode();
104 /// draw small caps text
106 \return width of the drawn text.
108 int smallCapsText(int x, int y,
109 QString const & str, FontInfo const & f);
111 /// set pen parameters
112 void setQPainterPen(QColor const & col,
113 line_style ls = line_solid,
114 line_width lw = line_thin);
116 QColor current_color_;
117 Painter::line_style current_ls_;
118 Painter::line_width current_lw_;
120 bool const use_pixmap_cache_;
122 std::stack<QColor> monochrome_min_;
124 std::stack<QColor> monochrome_max_;
125 /// convert into Qt color, possibly applying the monochrome mode
126 QColor computeColor(ColorCode col);
127 /// possibly apply monochrome mode
128 QColor filterColor(QColor const & col);
130 QString generateStringSignature(QString const & str, FontInfo const & f);
133 } // namespace frontend
136 #endif // GUIPAINTER_H