#include </home/zeitlin/src/wx/github/interface/wx/graphics.h>
A wxGraphicsRenderer is the instance corresponding to the rendering engine used.
There may be multiple instances on a system, if there are different rendering engines present, but there is always only one instance per engine. This instance is pointed back to by all objects created by it (wxGraphicsContext, wxGraphicsPath etc) and can be retrieved through their wxGraphicsObject::GetRenderer() method. Therefore you can create an additional instance of a path etc. by calling wxGraphicsObject::GetRenderer() and then using the appropriate CreateXXX() function of that renderer.
wxGraphicsPath *path = // from somewhere wxGraphicsBrush *brush = path->GetRenderer()->CreateBrush( *wxBLACK_BRUSH );
Public Member Functions | |
virtual wxGraphicsBitmap | CreateBitmap (const wxBitmap &bitmap)=0 |
Creates wxGraphicsBitmap from an existing wxBitmap. | |
virtual wxGraphicsBitmap | CreateBitmapFromImage (const wxImage &image)=0 |
Creates wxGraphicsBitmap from an existing wxImage. | |
virtual wxImage | CreateImageFromBitmap (const wxGraphicsBitmap &bmp)=0 |
Creates a wxImage from a wxGraphicsBitmap. | |
virtual wxGraphicsBitmap | CreateBitmapFromNativeBitmap (void *bitmap)=0 |
Creates wxGraphicsBitmap from a native bitmap handle. | |
virtual wxGraphicsContext * | CreateContext (wxWindow *window)=0 |
Creates a wxGraphicsContext from a wxWindow. | |
virtual wxGraphicsContext * | CreateContext (const wxWindowDC &windowDC)=0 |
Creates a wxGraphicsContext from a wxWindowDC. | |
virtual wxGraphicsContext * | CreateContext (const wxMemoryDC &memoryDC)=0 |
Creates a wxGraphicsContext from a wxMemoryDC. | |
virtual wxGraphicsContext * | CreateContext (const wxPrinterDC &printerDC)=0 |
Creates a wxGraphicsContext from a wxPrinterDC. | |
virtual wxGraphicsContext * | CreateContext (const wxEnhMetaFileDC &metaFileDC)=0 |
Creates a wxGraphicsContext from a wxEnhMetaFileDC. | |
wxGraphicsContext * | CreateContextFromImage (wxImage &image) |
Creates a wxGraphicsContext associated with a wxImage. | |
virtual wxGraphicsBrush | CreateBrush (const wxBrush &brush)=0 |
Creates a native brush from a wxBrush. | |
virtual wxGraphicsContext * | CreateContextFromNativeContext (void *context)=0 |
Creates a wxGraphicsContext from a native context. | |
virtual wxGraphicsContext * | CreateContextFromNativeWindow (void *window)=0 |
Creates a wxGraphicsContext from a native window. | |
virtual wxGraphicsContext * | CreateMeasuringContext ()=0 |
Creates a wxGraphicsContext that can be used for measuring texts only. | |
virtual wxGraphicsFont | CreateFont (const wxFont &font, const wxColour &col=*wxBLACK)=0 |
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)=0 |
Creates a graphics font with the given characteristics. | |
virtual wxGraphicsBrush | CreateLinearGradientBrush (wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxGraphicsGradientStops &stops)=0 |
Creates a native brush with a linear gradient. | |
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)=0 |
Creates a native affine transformation matrix from the passed in values. | |
virtual wxGraphicsPath | CreatePath ()=0 |
Creates a native graphics path which is initially empty. | |
virtual wxGraphicsPen | CreatePen (const wxPen &pen)=0 |
Creates a native pen from a wxPen. | |
virtual wxGraphicsBrush | CreateRadialGradientBrush (wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, const wxGraphicsGradientStops &stops)=0 |
Creates a native brush with a radial gradient. | |
virtual wxGraphicsBitmap | CreateSubBitmap (const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h)=0 |
Extracts a sub-bitmap from an existing bitmap. | |
Static Public Member Functions | |
static wxGraphicsRenderer * | GetDefaultRenderer () |
Returns the default renderer on this platform. | |
static wxGraphicsRenderer * | GetCairoRenderer () |
virtual wxGraphicsBitmap wxGraphicsRenderer::CreateBitmap | ( | const wxBitmap & | bitmap | ) | [pure virtual] |
Creates wxGraphicsBitmap from an existing wxBitmap.
Returns an invalid wxNullGraphicsBitmap on failure.
virtual wxGraphicsBitmap wxGraphicsRenderer::CreateBitmapFromImage | ( | const wxImage & | image | ) | [pure virtual] |
Creates wxGraphicsBitmap from an existing wxImage.
This method is more efficient than converting wxImage to wxBitmap first and then calling CreateBitmap() but otherwise has the same effect.
Returns an invalid wxNullGraphicsBitmap on failure.
virtual wxGraphicsBitmap wxGraphicsRenderer::CreateBitmapFromNativeBitmap | ( | void * | bitmap | ) | [pure virtual] |
Creates wxGraphicsBitmap from a native bitmap handle.
bitmap meaning is platform-dependent. Currently it's a GDI+ Bitmap
pointer under MSW, CGImage
pointer under OS X or a cairo_surface_t
pointer when using Cairo under any platform.
virtual wxGraphicsBrush wxGraphicsRenderer::CreateBrush | ( | const wxBrush & | brush | ) | [pure virtual] |
Creates a native brush from a wxBrush.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContext | ( | const wxPrinterDC & | printerDC | ) | [pure virtual] |
Creates a wxGraphicsContext from a wxPrinterDC.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContext | ( | const wxEnhMetaFileDC & | metaFileDC | ) | [pure virtual] |
Creates a wxGraphicsContext from a wxEnhMetaFileDC.
This function, as wxEnhMetaFileDC class itself, is only available only under MSW.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContext | ( | wxWindow * | window | ) | [pure virtual] |
Creates a wxGraphicsContext from a wxWindow.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContext | ( | const wxWindowDC & | windowDC | ) | [pure virtual] |
Creates a wxGraphicsContext from a wxWindowDC.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContext | ( | const wxMemoryDC & | memoryDC | ) | [pure virtual] |
Creates a wxGraphicsContext from a wxMemoryDC.
wxGraphicsContext* wxGraphicsRenderer::CreateContextFromImage | ( | wxImage & | image | ) |
Creates a wxGraphicsContext associated with a wxImage.
This function is used by wxContext::CreateFromImage() and is not normally called directly.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContextFromNativeContext | ( | void * | context | ) | [pure virtual] |
Creates a wxGraphicsContext from a native context.
This native context must be a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus, or a cairo_t pointer for cairo.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateContextFromNativeWindow | ( | void * | window | ) | [pure virtual] |
Creates a wxGraphicsContext from a native window.
virtual wxGraphicsFont wxGraphicsRenderer::CreateFont | ( | double | sizeInPixels, |
const wxString & | facename, | ||
int | flags = wxFONTFLAG_DEFAULT , |
||
const wxColour & | col = *wxBLACK |
||
) | [pure virtual] |
Creates a graphics font with the given characteristics.
If possible, the CreateFont() overload taking wxFont should be used instead. The main advantage of this overload is that it can be used without X server connection under Unix when using Cairo.
sizeInPixels | Height of the font in user space units, i.e. normally pixels. Notice that this is different from the overload taking wxFont as wxFont size is specified in points. |
facename | The name of the font. The same font name might not be available under all platforms so the font name can also be empty to use the default platform font. |
flags | Combination of wxFontFlag enum elements. Currently only wxFONTFLAG_ITALIC and wxFONTFLAG_BOLD are supported. By default the normal font version is used. |
col | The font colour, black by default. |
virtual wxGraphicsFont wxGraphicsRenderer::CreateFont | ( | const wxFont & | font, |
const wxColour & | col = *wxBLACK |
||
) | [pure virtual] |
Creates a native graphics font from a wxFont and a text colour.
virtual wxImage wxGraphicsRenderer::CreateImageFromBitmap | ( | const wxGraphicsBitmap & | bmp | ) | [pure virtual] |
Creates a wxImage from a wxGraphicsBitmap.
This method is used by the more convenient wxGraphicsBitmap::ConvertToImage.
virtual wxGraphicsBrush wxGraphicsRenderer::CreateLinearGradientBrush | ( | wxDouble | x1, |
wxDouble | y1, | ||
wxDouble | x2, | ||
wxDouble | y2, | ||
const wxGraphicsGradientStops & | stops | ||
) | [pure virtual] |
Creates a native brush with a linear gradient.
Stops support is new since wxWidgets 2.9.1, previously only the start and end colours could be specified.
virtual wxGraphicsMatrix wxGraphicsRenderer::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 |
||
) | [pure virtual] |
Creates a native affine transformation matrix from the passed in values.
The defaults result in an identity matrix.
virtual wxGraphicsContext* wxGraphicsRenderer::CreateMeasuringContext | ( | ) | [pure virtual] |
Creates a wxGraphicsContext that can be used for measuring texts only.
No drawing commands are allowed.
virtual wxGraphicsPath wxGraphicsRenderer::CreatePath | ( | ) | [pure virtual] |
Creates a native graphics path which is initially empty.
virtual wxGraphicsPen wxGraphicsRenderer::CreatePen | ( | const wxPen & | pen | ) | [pure virtual] |
Creates a native pen from a wxPen.
virtual wxGraphicsBrush wxGraphicsRenderer::CreateRadialGradientBrush | ( | wxDouble | xo, |
wxDouble | yo, | ||
wxDouble | xc, | ||
wxDouble | yc, | ||
wxDouble | radius, | ||
const wxGraphicsGradientStops & | stops | ||
) | [pure virtual] |
Creates a native brush with a radial gradient.
Stops support is new since wxWidgets 2.9.1, previously only the start and end colours could be specified.
virtual wxGraphicsBitmap wxGraphicsRenderer::CreateSubBitmap | ( | const wxGraphicsBitmap & | bitmap, |
wxDouble | x, | ||
wxDouble | y, | ||
wxDouble | w, | ||
wxDouble | h | ||
) | [pure virtual] |
Extracts a sub-bitmap from an existing bitmap.
Currently this function is implemented in the native MSW and OS X versions but not when using Cairo.
static wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer | ( | ) | [static] |
static wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer | ( | ) | [static] |
Returns the default renderer on this platform.
On OS X this is the Core Graphics (a.k.a. Quartz 2D) renderer, on MSW the GDIPlus renderer, and on GTK we currently default to the cairo renderer.