$szTitle = "wxgraphicscontext"; include "./_header.inc"; ?>
a wxgraphicscontext instance is the object that is drawn upon. it is created by a renderer using the createcontext calls.., this can be either directly using a renderer instance, or indirectly using the static convenience createxxx functions of wxgraphicscontext that always delegate the task to the default renderer.
derived from
include files
<wx/graphics.h>
members
wxgraphicscontext::create
wxgraphicscontext::createfromnative
wxgraphicscontext::createfromnativewindow
wxgraphicscontext::createpen
wxgraphicscontext::createbrush
wxgraphicscontext::createradialgradientbrush
wxgraphicscontext::createlineargradientbrush
wxgraphicscontext::createfont
wxgraphicscontext::creatematrix
wxgraphicscontext::createpath
wxgraphicscontext::clip
wxgraphicscontext::resetclip
wxgraphicscontext::drawbitmap
wxgraphicscontext::drawellipse
wxgraphicscontext::drawicon
wxgraphicscontext::drawlines
wxgraphicscontext::drawpath
wxgraphicscontext::drawrectangle
wxgraphicscontext::drawroundedrectangle
wxgraphicscontext::drawtext
wxgraphicscontext::fillpath
wxgraphicscontext::strokepath
wxgraphicscontext::getnativecontext
wxgraphicscontext::getpartialtextextents
wxgraphicscontext::gettextextent
wxgraphicscontext::rotate
wxgraphicscontext::scale
wxgraphicscontext::translate
wxgraphicscontext::gettransform
wxgraphicscontext::settransform
wxgraphicscontext::concattransform
wxgraphicscontext::setbrush
wxgraphicscontext::setfont
wxgraphicscontext::setpen
wxgraphicscontext::strokeline
wxgraphicscontext::strokelines
wxgraphicscontext* create(const wxwindowdc& dc)
creates a wxgraphicscontext from a wxwindowdc (eg a wxpaintdc).
wxgraphicscontext* create(wxwindow* window)
creates a wxgraphicscontext from a wxwindow.
see also
wxgraphicsrenderer:: createcontext
creates a wxgraphicscontext from a native context. this native context must be eg a cgcontextref for core graphics, a graphics pointer for gdiplus or a cairo_t pointer for cairo.
wxgraphicscontext* createfromnative(void * context)
creates a wxgraphicscontext from a native window.
see also
wxgraphicsrenderer:: createcontextfromnativecontext
wxgraphicscontext* createfromnativewindow(void * window)
see also
wxgraphicsrenderer:: createcontextfromnativewindow
wxgraphicspen createpen(const wxpen& pen) const
creates a native pen from a wxpen.
wxgraphicsbrush createbrush(const wxbrush& brush) const
creates a native brush from a wxbrush.
wxgraphicsbrush createradialgradientbrush(wxdouble xo, wxdouble yo, wxdouble xc, wxdouble yc, wxdouble radius, const wxcolour& ocolor, const wxcolour& ccolor) const
creates a native brush, having a radial gradient originating at (xo,yc) with color ocolour and ends on a circle around (xc,yc) with radius r and color ccolour
wxgraphicsbrush createlineargradientbrush(wxdouble x1, wxdouble y1, wxdouble x2, wxdouble y2, const wxcolour&c1, const wxcolour&c2) const
creates a native brush, having a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
wxgraphicsfont createfont(const wxfont& font, const wxcolour& col = *wxblack) const
creates a native graphics font from a wxfont and a text colour.
wxgraphicsmatrix creatematrix(wxdouble a = 1.0, wxdouble b = 0.0, wxdouble c = 0.0, wxdouble d = 1.0, wxdouble tx = 0.0, wxdouble ty = 0.0) const
creates a native affine transformation matrix from the passed in values. the defaults result in an identity matrix.
wxgraphicspath createpath() const
creates a native graphics path which is initially empty.
void clip(const wxregion& region)
clips drawings to the region, combined to current clipping region
void clip(wxdouble x, wxdouble y, wxdouble w, wxdouble h)
clips drawings to the rectangle.
void resetclip()
resets the clipping to original shape.
void drawbitmap(const wxbitmap& bmp, wxdouble x, wxdouble y, wxdouble w, wxdouble h)
draws the bitmap. in case of a mono bitmap, this is treated as a mask and the current brushed is used for filling.
void drawellipse(wxdouble x, wxdouble y, wxdouble w, wxdouble h)
draws an ellipse.
void drawicon(const wxicon& icon, wxdouble x, wxdouble y, wxdouble w, wxdouble h)
draws the icon.
void drawlines(size_t n, const wxpoint2ddouble* points, int fillstyle = wxoddeven_rule)
draws a polygon.
void drawpath(const wxgraphicspath& path, int fillstyle = wxoddeven_rule)
draws the path by first filling and then stroking.
void drawrectangle(wxdouble x, wxdouble y, wxdouble w, wxdouble h)
draws a rectangle.
void drawroundedrectangle(wxdouble x, wxdouble y, wxdouble w, wxdouble h, wxdouble radius)
draws a rounded rectangle.
void drawtext(const wxstring& str, wxdouble x, wxdouble y, wxdouble angle)
void drawtext(const wxstring& str, wxdouble x, wxdouble y)
draws a text at the defined position, at the given angle.
void fillpath(const wxgraphicspath& path, int fillstyle = wxoddeven_rule)
fills the path with the current brush.
void strokepath(const wxgraphicspath& path)
strokes along a path with the current pen.
void * getnativecontext()
returns the native context (cgcontextref for core graphics, graphics pointer for gdiplus and cairo_t pointer for cairo).
void getpartialtextextents(const wxstring& text, wxarraydouble& widths) const
fills the widths array with the widths from the beginning of text to the corresponding character of text.
void gettextextent(const wxstring& text, wxdouble* width, wxdouble* height, wxdouble* descent, wxdouble* externalleading) const
gets the dimensions of the string using the currently selected font. string is the text string to measure, w and h are the total width and height respectively, descent is the dimension from the baseline of the font to the bottom of the descender, and externalleading is any extra vertical space added to the font by the font designer (usually is zero).
void rotate(wxdouble angle)
rotates the current transformation matrix (radians),
void scale(wxdouble xscale, wxdouble yscale)
scales the current transformation matrix.
void translate(wxdouble dx, wxdouble dy)
translates the current transformation matrix.
wxgraphicsmatrix gettransform() const
gets the current transformation matrix of this context.
void settransform(const wxgraphicsmatrix& matrix)
sets the current transformation matrix of this context
void concattransform(const wxgraphicsmatrix& matrix)
concatenates the passed in transform with the current transform of this context
void setbrush(const wxbrush& brush)
void setbrush(const wxgraphicsbrush& brush)
sets the brush for filling paths.
void setfont(const wxfont& font, const wxcolour& colour)
void setfont(const wxgraphicsfont& font)
sets the font for drawing text.
void setpen(const wxgraphicspen& pen)
void setpen(const wxpen& pen)
sets the pen used for stroking.
void strokeline(wxdouble x1, wxdouble y1, wxdouble x2, wxdouble y2)
strokes a single line.
void strokelines(size_t n, const wxpoint2ddouble* beginpoints, const wxpoint2ddouble* endpoints)
void strokelines(size_t n, const wxpoint2ddouble* points)
stroke disconnected lines from begin to end points, fastest method available for this purpose.
include "./_footer.inc"; ?>