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.
18 #include <boost/scoped_ptr.hpp>
33 * QLPainter - a painter implementation for Qt4
35 class QLPainter : public Painter {
37 QLPainter(GuiWorkArea *);
47 /// return the width of the work area in pixels
48 virtual int paperWidth() const;
49 /// return the height of the work area in pixels
50 virtual int paperHeight() const;
52 /// draw a line from point to point
57 line_style = line_solid,
58 line_width = line_thin);
61 * lines - draw a set of lines
62 * @param xp array of points' x co-ords
63 * @param yp array of points' y co-ords
64 * @param np size of the points array
71 line_style = line_solid,
72 line_width = line_thin);
75 virtual void rectangle(
79 line_style = line_solid,
80 line_width = line_thin);
82 /// draw a filled rectangle
83 virtual void fillRectangle(
91 unsigned int w, unsigned int h,
100 /// draw an image from the image cache
101 virtual void image(int x, int y,
103 lyx::graphics::Image const & image);
105 /// draw a string at position x, y (y is the baseline)
106 virtual int text(int x, int y,
107 lyx::docstring const & str, LyXFont const & f);
109 /** Draw a string at position x, y (y is the baseline)
110 * This is just for fast drawing
112 virtual int text(int x, int y,
113 lyx::char_type const * str, size_t l,
116 /// draw a char at position x, y (y is the baseline)
117 virtual int text(int x, int y,
118 lyx::char_type c, LyXFont const & f);
120 /// draw a pixmap from the image cache
121 virtual void drawPixmap(int x, int y, QPixmap const & pixmap);
123 /// draw a pixmap from the image cache
124 virtual void drawImage(int x, int y, QImage const & image);
127 /// draw small caps text
129 \return width of the drawn text.
131 int smallCapsText(int x, int y,
132 QString const & str, LyXFont const & f);
134 /// set pen parameters
135 void setQPainterPen(LColor_color col,
136 line_style ls = line_solid,
137 line_width lw = line_thin);
140 boost::scoped_ptr<QPainter> qp_;
145 LColor::color current_color_;
146 Painter::line_style current_ls_;
147 Painter::line_width current_lw_;
150 } // namespace frontend
153 #endif // QLPAINTER_H