#include <faith/painter.h>
Public Types | |
| Auto | |
| LTR | |
| RTL | |
| enum | TextDirection { Auto, LTR, RTL } |
Public Member Functions | |
| Painter (PaintDevice *dest, const Widget *copyAttrib=0) | |
| Painter () | |
| ~Painter () | |
| void | save () |
| void | restore () |
| void | begin (PaintDevice *dest, const Widget *copyAttrib=0) |
| void | end () |
| Point | xForm (const Point &pt) |
| Rect | xForm (const Rect &pt) |
| Internal::Drawable * | handle () |
| void | drawLine (int ax, int ay, int bx, int by) |
| void | drawLine (const Point &a, const Point &b) |
| void | drawPolygon (const std::vector< Faith::Point > &points, int start=0, int count=-1) |
| void | drawPolygon (int count, const Faith::Point *points) |
| void | drawText (const Point &p, const String &str, int pos=0, int len=-1, TextDirection dir=Auto) |
| void | drawText (int x, int y, const String &str, int pos=0, int len=-1, TextDirection dir=Auto) |
| void | drawText (const Rect &rect, int textflags, const String &str, int pos=0, int len=-1) |
| void | drawText (int x, int y, int w, int h, int textflags, const String &str, int pos=0, int len=-1) |
| void | fillRect (const Rect &rect, const Color &color) |
| void | fillRect (int x, int y, int w, int h, const Color &color) |
| void | drawImage (const Point &p, const Image &image, int fromx=0, int fromy=0, int w=-1, int h=-1) |
| void | drawImage (int x, int y, const Image &image, int fromx=0, int fromy=0, int w=-1, int h=-1) |
| void | drawImage (const Image &image, int fromx=0, int fromy=0, int w=-1, int h=-1) |
| void | drawPixmap (const Point &p, const Faith::Pixmap &pixmap, int fromx=0, int fromy=0, int w=-1, int h=-1) |
| void | drawPixmap (int x, int y, const Faith::Pixmap &pixmap, int fromx=0, int fromy=0, int w=-1, int h=-1) |
| void | drawPixmap (const Faith::Pixmap &pixmap, int fromx=0, int fromy=0, int w=-1, int h=-1) |
| void | drawPoint (const Point &pt) |
| void | drawPoint (int x, int y) |
| void | setBackground (const Color &color) |
| Color | background () const |
| void | setFont (const Font &font) |
| Font | font () const |
| void | setPen (const Pen &pen) |
| Pen | pen () const |
| void | setOrigin (const Point &point) |
| void | setOrigin (int x, int y) |
| Point | origin () const |
| void | setClipRectangle (const Rect &rectangle) |
| Rect | clipRectangle () const |
| void | setClipping (bool c) |
| bool | isClipping () const |
Has various classes for drawing things on a Widget or a Pixmap (any PaintDevice)
This should be called from Widget::paintEvent if used to draw on a Widget
| Faith::Painter::Painter | ( | PaintDevice * | dest, | |
| const Widget * | copyAttrib = 0 | |||
| ) |
Draw on the PaintDevice dest , adopting background colors and other properties from copyAttrib if specified
| Faith::Painter::Painter | ( | ) |
| Faith::Painter::~Painter | ( | ) |
| Color Faith::Painter::background | ( | ) | const |
| void Faith::Painter::begin | ( | PaintDevice * | dest, | |
| const Widget * | copyAttrib = 0 | |||
| ) |
Begins painting on the given device.
If you pass it a copyAttrib, it will take the background color and such of it, which is useful for double buffering
| Rect Faith::Painter::clipRectangle | ( | ) | const |
| void Faith::Painter::drawImage | ( | const Image & | image, | |
| int | fromx = 0, |
|||
| int | fromy = 0, |
|||
| int | w = -1, |
|||
| int | h = -1 | |||
| ) | [inline] |
Draws the image at the origin of the destination
| void Faith::Painter::drawImage | ( | int | x, | |
| int | y, | |||
| const Image & | image, | |||
| int | fromx = 0, |
|||
| int | fromy = 0, |
|||
| int | w = -1, |
|||
| int | h = -1 | |||
| ) | [inline] |
Same as the above but accepts different argument types
| void Faith::Painter::drawImage | ( | const Point & | p, | |
| const Image & | image, | |||
| int | fromx = 0, |
|||
| int | fromy = 0, |
|||
| int | w = -1, |
|||
| int | h = -1 | |||
| ) |
Draws image where its top left is at the point p
The relative of the source can also by specified with x, y, , w, h
Draws a line from the point a to the point b, including the last pixel
| void Faith::Painter::drawLine | ( | int | ax, | |
| int | ay, | |||
| int | bx, | |||
| int | by | |||
| ) | [inline] |
Draws a line from the point (ax,bx) to the point (bx,by), including the last pixel
| void Faith::Painter::drawPixmap | ( | const Faith::Pixmap & | pixmap, | |
| int | fromx = 0, |
|||
| int | fromy = 0, |
|||
| int | w = -1, |
|||
| int | h = -1 | |||
| ) | [inline] |
Same as the above but accepts different argument types
| void Faith::Painter::drawPixmap | ( | int | x, | |
| int | y, | |||
| const Faith::Pixmap & | pixmap, | |||
| int | fromx = 0, |
|||
| int | fromy = 0, |
|||
| int | w = -1, |
|||
| int | h = -1 | |||
| ) | [inline] |
Same as the above but accepts different argument types
| void Faith::Painter::drawPixmap | ( | const Point & | p, | |
| const Faith::Pixmap & | pixmap, | |||
| int | fromx = 0, |
|||
| int | fromy = 0, |
|||
| int | w = -1, |
|||
| int | h = -1 | |||
| ) |
| void Faith::Painter::drawPoint | ( | int | x, | |
| int | y | |||
| ) | [inline] |
Same as the above but accepts different argument types
| void Faith::Painter::drawPolygon | ( | int | count, | |
| const Faith::Point * | points | |||
| ) |
Just like the above but takes different argument types for convenience.
| void Faith::Painter::drawPolygon | ( | const std::vector< Faith::Point > & | points, | |
| int | start = 0, |
|||
| int | count = -1 | |||
| ) |
Draws a filled polygon of all the given points, connecting the point one to the first point. The fill color is the current background color.
| start | begins at points[start] | |
| count | finishes at points[start+count-1] |
| void Faith::Painter::drawText | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h, | |||
| int | textflags, | |||
| const String & | str, | |||
| int | pos = 0, |
|||
| int | len = -1 | |||
| ) | [inline] |
The above function with different parameter types
| void Faith::Painter::drawText | ( | const Rect & | rect, | |
| int | textflags, | |||
| const String & | str, | |||
| int | pos = 0, |
|||
| int | len = -1 | |||
| ) |
Draws the text enclosed in this rectangle (not related to baseline. Will clip, will not word wrap
| void Faith::Painter::drawText | ( | int | x, | |
| int | y, | |||
| const String & | str, | |||
| int | pos = 0, |
|||
| int | len = -1, |
|||
| TextDirection | dir = Auto | |||
| ) | [inline] |
Like the above, but accepts different argument types
| void Faith::Painter::drawText | ( | const Point & | p, | |
| const String & | str, | |||
| int | pos = 0, |
|||
| int | len = -1, |
|||
| TextDirection | dir = Auto | |||
| ) |
Draws the string str at the given point, where you are specifying the baseline of
| void Faith::Painter::end | ( | ) |
Stops drawing on the set PaintDevice
| void Faith::Painter::fillRect | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h, | |||
| const Color & | color | |||
| ) | [inline] |
The same as the above function with different argument types
Fills the rectangle rect with color
| Internal::Drawable* Faith::Painter::handle | ( | ) |
a handle to the graphics device context
| bool Faith::Painter::isClipping | ( | ) | const |
| Point Faith::Painter::origin | ( | ) | const |
Same as the above but accepts different argument types
| Pen Faith::Painter::pen | ( | ) | const |
setPen | void Faith::Painter::restore | ( | ) |
| void Faith::Painter::save | ( | ) |
| void Faith::Painter::setBackground | ( | const Color & | color | ) |
Sets the background color used for fills
| void Faith::Painter::setClipping | ( | bool | c | ) |
if clipping is enabled
| void Faith::Painter::setClipRectangle | ( | const Rect & | rectangle | ) |
sets the region of clipping for when you draw. Painting on the region outside of this rectangle simply has no effect
| void Faith::Painter::setOrigin | ( | int | x, | |
| int | y | |||
| ) | [inline] |
Same as the above but accepts different argument types
| void Faith::Painter::setOrigin | ( | const Point & | point | ) |
sets the position of (0,0) on the destination device.
p.setOrigin(Point(5,5)); p.drawPoint(0,0); *
has the same effect as:
p.drawPoint(5,5); *
| void Faith::Painter::setPen | ( | const Pen & | pen | ) |
set the pen - the color lines and points are drawn with, in addition to the borders of shapes (and more!)
1.4.7