A wxGraphicsContext instance is the object that is drawn upon.
It is created by a renderer using wxGraphicsRenderer::CreateContext(). This can be either directly using a renderer instance, or indirectly using the static convenience Create() functions of wxGraphicsContext that always delegate the task to the default renderer.
{
{
path.MoveToPoint(0.0, 50.0);
path.AddLineToPoint(100.0, 50.0);
path.MoveToPoint(50.0, 0.0);
path.AddLineToPoint(50.0, 100.0 );
path.AddRectangle(25.0, 25.0, 50.0, 50.0);
}
}
A wxGraphicsContext instance is the object that is drawn upon.
Definition graphics.h:352
static wxGraphicsContext * Create()
Create a lightweight context that can be used only for measuring text.
A wxGraphicsPath is a native representation of a geometric path.
Definition graphics.h:21
virtual void AddCircle(wxDouble x, wxDouble y, wxDouble r)
Appends a circle around (x,y) with radius r as a new closed subpath.
A wxPaintDC must be constructed if an application wishes to paint on the client area of a window from...
Definition dcclient.h:36
A paint event is sent when a window's contents needs to be repainted.
Definition event.h:2225
bool wxStringCheck(const wxString &val)
Allows extending a function with the signature:
wxPen * wxRED_PEN
Red pen.
Definition pen.h:409
<>< =''>:</>&;&;< =''>\ , \ </></>
- See also
- wxGraphicsRenderer::CreateContext(), wxGCDC, wxDC
|
| virtual void | Clip (const wxRegion ®ion)=0 |
| | Clips drawings to the specified region.
|
| |
| virtual void | Clip (wxDouble x, wxDouble y, wxDouble w, wxDouble h)=0 |
| | Clips drawings to the specified rectangle.
|
| |
| virtual void | ConcatTransform (const wxGraphicsMatrix &matrix)=0 |
| | Concatenates the passed in transform with the current transform of this context.
|
| |
| virtual wxGraphicsBitmap | CreateBitmap (const wxBitmap &bitmap)=0 |
| | Creates wxGraphicsBitmap from an existing wxBitmap.
|
| |
| virtual wxGraphicsBitmap | CreateBitmapFromImage (const wxImage &image) |
| | Creates wxGraphicsBitmap from an existing wxImage.
|
| |
| virtual wxGraphicsBitmap | CreateSubBitmap (const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h)=0 |
| | Extracts a sub-bitmap from an existing bitmap.
|
| |
| virtual wxGraphicsBrush | CreateBrush (const wxBrush &brush) const |
| | Creates a native brush from a wxBrush.
|
| |
| virtual wxGraphicsFont | CreateFont (const wxFont &font, const wxColour &col= *wxBLACK) const |
| | Creates a native graphics font from a wxFont and a text colour.
|
| |
| virtual wxGraphicsFont | CreateFont (double sizeInPixels, const wxString &facename, int flags=wxFONTFLAG_DEFAULT, const wxColour &col= *wxBLACK) const |
| | Creates a font object with the specified attributes.
|
| |
| wxGraphicsBrush | CreateLinearGradientBrush (wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxColour &c1, const wxColour &c2) const |
| | Creates a native brush with a linear gradient.
|
| |
| wxGraphicsBrush | CreateLinearGradientBrush (wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxGraphicsGradientStops &stops) const |
| |
| virtual 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.
|
| |
| wxGraphicsMatrix | CreateMatrix (const wxAffineMatrix2DBase &mat) const |
| | Creates a native affine transformation matrix from the passed generic one.
|
| |
| wxGraphicsPath | CreatePath () const |
| | Creates a native graphics path which is initially empty.
|
| |
| virtual wxGraphicsPen | CreatePen (const wxPen &pen) const |
| | Creates a native pen from a wxPen.
|
| |
| virtual wxGraphicsBrush | CreateRadialGradientBrush (wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, const wxColour &oColor, const wxColour &cColor) const |
| | Creates a native brush with a radial gradient.
|
| |
| virtual wxGraphicsBrush | CreateRadialGradientBrush (wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, const wxGraphicsGradientStops &stops)=0 |
| |
| virtual void | DrawBitmap (const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h)=0 |
| | Draws the bitmap.
|
| |
| virtual void | DrawBitmap (const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h)=0 |
| |
| virtual void | DrawEllipse (wxDouble x, wxDouble y, wxDouble w, wxDouble h) |
| | Draws an ellipse.
|
| |
| virtual void | DrawIcon (const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h)=0 |
| | Draws the icon.
|
| |
| virtual void | DrawLines (size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) |
| | Draws a polygon.
|
| |
| virtual void | DrawPath (const wxGraphicsPath &path, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) |
| | Draws the path by first filling and then stroking.
|
| |
| virtual void | DrawRectangle (wxDouble x, wxDouble y, wxDouble w, wxDouble h) |
| | Draws a rectangle.
|
| |
| virtual 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) |
| | Draws text at the defined position.
|
| |
| void | DrawText (const wxString &str, wxDouble x, wxDouble y, wxDouble angle) |
| | Draws text at the defined position.
|
| |
| void | DrawText (const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush &backgroundBrush) |
| | Draws text at the defined position.
|
| |
| void | DrawText (const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush &backgroundBrush) |
| | Draws text at the defined position.
|
| |
| virtual void | FillPath (const wxGraphicsPath &path, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)=0 |
| | Fills the path with the current brush.
|
| |
| virtual void * | GetNativeContext ()=0 |
| | Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo_t pointer for cairo).
|
| |
| virtual void | GetPartialTextExtents (const wxString &text, wxArrayDouble &widths) const =0 |
| | Fills the widths array with the widths from the beginning of text to the corresponding character of text.
|
| |
| virtual void | GetTextExtent (const wxString &text, wxDouble *width, wxDouble *height, wxDouble *descent, wxDouble *externalLeading) const =0 |
| | Gets the dimensions of the string using the currently selected font.
|
| |
| virtual wxGraphicsMatrix | GetTransform () const =0 |
| | Gets the current transformation matrix of this context.
|
| |
| virtual void | ResetClip ()=0 |
| | Resets the clipping to original shape.
|
| |
| virtual void | Rotate (wxDouble angle)=0 |
| | Rotates the current transformation matrix (in radians).
|
| |
| virtual void | Scale (wxDouble xScale, wxDouble yScale)=0 |
| | Scales the current transformation matrix.
|
| |
| void | SetBrush (const wxBrush &brush) |
| | Sets the brush for filling paths.
|
| |
| virtual void | SetBrush (const wxGraphicsBrush &brush) |
| | Sets the brush for filling paths.
|
| |
| void | SetFont (const wxFont &font, const wxColour &colour) |
| | Sets the font for drawing text.
|
| |
| virtual void | SetFont (const wxGraphicsFont &font) |
| | Sets the font for drawing text.
|
| |
| void | SetPen (const wxPen &pen) |
| | Sets the pen used for stroking.
|
| |
| virtual void | SetPen (const wxGraphicsPen &pen) |
| | Sets the pen used for stroking.
|
| |
| virtual void | SetTransform (const wxGraphicsMatrix &matrix)=0 |
| | Sets the current transformation matrix of this context.
|
| |
| virtual void | StrokeLine (wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2) |
| | Strokes a single line.
|
| |
| virtual void | StrokeLines (size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints) |
| | Stroke disconnected lines from begin to end points, fastest method available for this purpose.
|
| |
| virtual void | StrokeLines (size_t n, const wxPoint2DDouble *points) |
| | Stroke lines connecting all the points.
|
| |
| virtual void | StrokePath (const wxGraphicsPath &path)=0 |
| | Strokes along a path with the current pen.
|
| |
| virtual void | Translate (wxDouble dx, wxDouble dy)=0 |
| | Translates the current transformation matrix.
|
| |
| virtual void | BeginLayer (wxDouble opacity)=0 |
| | Redirects all rendering is done into a fully transparent temporary context.
|
| |
| virtual void | EndLayer ()=0 |
| | Composites back the drawings into the context with the opacity given at the BeginLayer call.
|
| |
| virtual bool | SetAntialiasMode (wxAntialiasMode antialias)=0 |
| | Sets the antialiasing mode, returns true if it supported.
|
| |
| virtual wxAntialiasMode | GetAntialiasMode () const |
| | Returns the current shape antialiasing mode.
|
| |
| virtual bool | SetInterpolationQuality (wxInterpolationQuality interpolation)=0 |
| | Sets the interpolation quality, returns true if it is supported.
|
| |
| virtual wxInterpolationQuality | GetInterpolationQuality () const |
| | Returns the current interpolation quality.
|
| |
| virtual bool | SetCompositionMode (wxCompositionMode op)=0 |
| | Sets the compositing operator, returns true if it supported.
|
| |
| virtual wxCompositionMode | GetCompositionMode () const |
| | Returns the current compositing operator.
|
| |
| virtual void | PushState ()=0 |
| | Push the current state of the context's transformation matrix on a stack.
|
| |
| virtual void | PopState ()=0 |
| | Pops a stored state from the stack and sets the current transformation matrix to that state.
|
| |
| virtual bool | ShouldOffset () const |
| |
| virtual void | EnableOffset (bool enable=true) |
| |
| void | DisableOffset () |
| |
| bool | OffsetEnabled () |
| |
| virtual bool | StartDoc (const wxString &message) |
| | Begin a new document (relevant only for printing / pdf etc.) If there is a progress dialog, message will be shown.
|
| |
| virtual void | EndDoc () |
| | Done with that document (relevant only for printing / pdf etc.)
|
| |
| virtual void | StartPage (wxDouble width=0, wxDouble height=0) |
| | Opens a new page (relevant only for printing / pdf etc.) with the given size in points.
|
| |
| virtual void | EndPage () |
| | Ends the current page (relevant only for printing / pdf etc.)
|
| |
| virtual void | Flush () |
| | Make sure that the current content of this context is immediately visible.
|
| |
| void | GetSize (wxDouble *width, wxDouble *height) const |
| | Returns the size of the graphics context in device coordinates.
|
| |
| virtual void | GetDPI (wxDouble *dpiX, wxDouble *dpiY) |
| | Returns the resolution of the graphics context in device points per inch.
|
| |
| wxGraphicsRenderer * | GetRenderer () const |
| | Returns the renderer that was used to create this instance, or NULL if it has not been initialized yet.
|
| |
| bool | IsNull () const |
| |
| | wxObject () |
| | Default ctor; initializes to NULL the internal reference data.
|
| |
| | wxObject (const wxObject &other) |
| | Copy ctor.
|
| |
| virtual | ~wxObject () |
| | Destructor.
|
| |
| virtual wxClassInfo * | GetClassInfo () const |
| | This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
|
| |
| wxObjectRefData * | GetRefData () const |
| | Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
|
| |
| bool | IsKindOf (const wxClassInfo *info) const |
| | Determines whether this class is a subclass of (or the same class as) the given class.
|
| |
| bool | IsSameAs (const wxObject &obj) const |
| | Returns true if this object has the same data pointer as obj.
|
| |
| void | Ref (const wxObject &clone) |
| | Makes this object refer to the data in clone.
|
| |
| void | SetRefData (wxObjectRefData *data) |
| | Sets the wxObject::m_refData pointer.
|
| |
| void | UnRef () |
| | Decrements the reference count in the associated data, and if it is zero, deletes the data.
|
| |
| void | UnShare () |
| | This is the same of AllocExclusive() but this method is public.
|
| |
| void | operator delete (void *buf) |
| | The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined.
|
| |
| void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
| | The new operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined.
|
| |