Class for drawing graphics in gagdgets. More...
Inherited by guit::GRenderGraphics.
Public Member Functions | |
GWindow * | window () |
window where the graphics is painted. | |
GRect const & | frame () const |
frame of the drawing area in the window. More... | |
void | translate (float x, float y) |
translates the frame. | |
void | setWinClip (GRect const &) |
sets the clipping area in the window. More... | |
void | setThickness (float) |
changes outline thickness. More... | |
float | wx () const |
position of the drawing area in window coordinates. More... | |
float | glx () const |
position of the drawing area in the window in GL coordinates origin = bottom-left corner of the window. | |
float | width () const |
size of the drawing area. | |
GDim | drawString (float x, float y, GString const &str) |
draws a string. More... | |
void | drawImage (GRect const &, GIcon &) |
draws an image or an icon. | |
void | drawArc (float x, float y, float w, float h, float start, float extent, bool pie=false) |
Draws an arc. More... | |
Static Public Member Functions | |
static bool | readImage (GIcon &) |
reads an image or an icon. | |
void | drawTexture (float x, float y, float w, float h, GTexture texture, GRgba const *={}) |
GL textures. | |
Class for drawing graphics in gagdgets.
Drawing must be performed in a callback function called on a GTrigger::paint trigger. This callback function must create a Graphics object in the stack that won't be reused elsewhere:
All drawXxxx() methods draw relatively to frame(), which is the frame of the gadget that received the paint event. The frame can be translated using translate().
OpenGL can be used for more advanced functionalities. Note that:
|
inline |
position of the drawing area in window coordinates.
origin = top-left corner of the window.
|
inline |
frame of the drawing area in the window.
origin = top-left corner of the window.
void guit::GGraphics::setWinClip | ( | GRect const & | clip) |
sets the clipping area in the window.
the clip is in window coordinates.
void guit::GGraphics::setThickness | ( | float | thickness) |
changes outline thickness.
note: actual effect depends on GL implmenetaion
GDim guit::GGraphics::drawString | ( | float | x, |
float | y, | ||
GString const & | str | ||
) |
draws a string.
y = lower point, should be baseline !!
x, y = is the leftmost lower point. Returns the size of the rectangle enclosing the text. does not take into account multiline text
void guit::GGraphics::drawArc | ( | float | x, |
float | y, | ||
float | w, | ||
float | h, | ||
float | start, | ||
float | extent, | ||
bool | pie = false |
||
) |
Draws an arc.