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.