#include <wx/dcmemory.h>
A memory device context provides a means to draw graphics onto a bitmap.
When drawing in to a mono-bitmap, using wxWHITE
, wxWHITE_PEN
and wxWHITE_BRUSH
will draw the background colour (i.e. 0) whereas all other colours will draw the foreground colour (i.e. 1).
A bitmap must be selected into the new memory DC before it may be used for anything. Typical usage is as follows:
Note that the memory DC must be deleted (or the bitmap selected out of it) before a bitmap can be reselected into another memory DC.
And, before performing any other operations on the bitmap data, the bitmap must be selected out of the memory DC:
This happens automatically when wxMemoryDC object goes out of scope.
Note that the scaling factor of the bitmap determines the scaling factor used by this device context, so when using a memory device context as a back buffer for a window, you should typically create the bitmap using the same scale factor as used by the window, e.g.
Public Member Functions | |
wxMemoryDC () | |
Constructs a new memory device context. More... | |
wxMemoryDC (wxDC *dc) | |
Constructs a new memory device context having the same characteristics as the given existing device context. More... | |
wxMemoryDC (wxBitmap &bitmap) | |
Constructs a new memory device context and calls SelectObject() with the given bitmap. More... | |
void | SelectObject (wxBitmap &bitmap) |
Allow using this device context object to modify the given bitmap contents. More... | |
void | SelectObjectAsSource (const wxBitmap &bitmap) |
Selects the given bitmap into the device context, to use as the memory bitmap. More... | |
const wxBitmap & | GetSelectedBitmap () const |
Get the selected bitmap. More... | |
wxBitmap & | GetSelectedBitmap () |
Public Member Functions inherited from wxDC | |
void | CopyAttributes (const wxDC &dc) |
Copy attributes from another DC. More... | |
double | GetContentScaleFactor () const |
Returns the factor used for converting logical pixels to physical ones. More... | |
int | GetDepth () const |
Returns the depth (number of bits/pixel) of this DC. More... | |
wxPoint | GetDeviceOrigin () const |
Returns the current device origin. More... | |
wxRasterOperationMode | GetLogicalFunction () const |
Gets the current logical function. More... | |
wxMappingMode | GetMapMode () const |
Gets the current mapping mode for the device context. More... | |
bool | GetPixel (wxCoord x, wxCoord y, wxColour *colour) const |
Gets in colour the colour at the specified location. More... | |
wxSize | GetPPI () const |
Returns the resolution of the device in pixels per inch. More... | |
wxSize | FromDIP (const wxSize &sz) const |
Convert DPI-independent pixel values to the value in pixels appropriate for the DC. More... | |
wxPoint | FromDIP (const wxPoint &pt) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | FromDIP (int d) const |
Convert DPI-independent value in pixels to the value in pixels appropriate for the DC. More... | |
wxSize | ToDIP (const wxSize &sz) const |
Convert pixel values of the current DC to DPI-independent pixel values. More... | |
wxPoint | ToDIP (const wxPoint &pt) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | ToDIP (int d) const |
Convert pixel values of the current DC to DPI-independent pixel values. More... | |
void | GetSize (wxCoord *width, wxCoord *height) const |
Gets the horizontal and vertical extent of this device context in device units. More... | |
wxSize | GetSize () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | GetSizeMM (wxCoord *width, wxCoord *height) const |
Returns the horizontal and vertical resolution in millimetres. More... | |
wxSize | GetSizeMM () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | GetUserScale (double *x, double *y) const |
Gets the current user scale factor. More... | |
bool | IsOk () const |
Returns true if the DC is ok to use. More... | |
void | SetAxisOrientation (bool xLeftRight, bool yBottomUp) |
Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis). More... | |
void | SetDeviceOrigin (wxCoord x, wxCoord y) |
Sets the device origin (i.e. the origin in pixels after scaling has been applied). More... | |
void | SetLogicalFunction (wxRasterOperationMode function) |
Sets the current logical function for the device context. More... | |
void | SetMapMode (wxMappingMode mode) |
The mapping mode of the device context defines the unit of measurement used to convert logical units to device units. More... | |
void | SetPalette (const wxPalette &palette) |
If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC. More... | |
void | SetUserScale (double xScale, double yScale) |
Sets the user scaling factor, useful for applications which require 'zooming'. More... | |
void * | GetHandle () const |
Returns a value that can be used as a handle to the native drawing context, if this wxDC has something that could be thought of in that way. More... | |
wxBitmap | GetAsBitmap (const wxRect *subrect=NULL) const |
If supported by the platform and the type of DC, fetch the contents of the DC, or a subset of it, as a bitmap. More... | |
void | SetLogicalScale (double x, double y) |
Set the scale to use for translating wxDC coordinates to the physical pixels. More... | |
void | GetLogicalScale (double *x, double *y) const |
Return the scale set by the last call to SetLogicalScale(). More... | |
void | SetLogicalOrigin (wxCoord x, wxCoord y) |
Change the offset used for translating wxDC coordinates. More... | |
virtual wxGraphicsContext * | GetGraphicsContext () const |
If supported by the platform and the wxDC implementation, this method will return the wxGraphicsContext associated with the DC. More... | |
virtual void | SetGraphicsContext (wxGraphicsContext *ctx) |
Associate a wxGraphicsContext with the DC. More... | |
wxCoord | DeviceToLogicalX (wxCoord x) const |
Convert device X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | DeviceToLogicalXRel (wxCoord x) const |
Convert device X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxCoord | DeviceToLogicalY (wxCoord y) const |
Converts device Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | DeviceToLogicalYRel (wxCoord y) const |
Convert device Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxCoord | LogicalToDeviceX (wxCoord x) const |
Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | LogicalToDeviceXRel (wxCoord x) const |
Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxCoord | LogicalToDeviceY (wxCoord y) const |
Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | LogicalToDeviceYRel (wxCoord y) const |
Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxPoint | DeviceToLogical (wxCoord x, wxCoord y) const |
Converts device (x, y) coordinates to logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. More... | |
wxPoint | DeviceToLogical (const wxPoint &pt) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
wxSize | DeviceToLogicalRel (int x, int y) const |
Converts device x, y coordinates to relative logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. More... | |
wxSize | DeviceToLogicalRel (const wxSize &dim) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
wxPoint | LogicalToDevice (wxCoord x, wxCoord y) const |
Converts logical (x, y) coordinates to device coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. More... | |
wxPoint | LogicalToDevice (const wxPoint &pt) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
wxSize | LogicalToDeviceRel (int x, int y) const |
Converts logical x, y coordinates to relative device coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. More... | |
wxSize | LogicalToDeviceRel (const wxSize &dim) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | Clear () |
Clears the device context using the current background brush. More... | |
void | DrawArc (wxCoord xStart, wxCoord yStart, wxCoord xEnd, wxCoord yEnd, wxCoord xc, wxCoord yc) |
Draws an arc from the given start to the given end point. More... | |
void | DrawArc (const wxPoint &ptStart, const wxPoint &ptEnd, const wxPoint ¢re) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawBitmap (const wxBitmap &bitmap, wxCoord x, wxCoord y, bool useMask=false) |
Draw a bitmap on the device context at the specified point. More... | |
void | DrawBitmap (const wxBitmap &bmp, const wxPoint &pt, bool useMask=false) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawCheckMark (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Draws a check mark inside the given rectangle. More... | |
void | DrawCheckMark (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawCircle (wxCoord x, wxCoord y, wxCoord radius) |
Draws a circle with the given centre and radius. More... | |
void | DrawCircle (const wxPoint &pt, wxCoord radius) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Draws an ellipse contained in the rectangle specified either with the given top left corner and the given size or directly. More... | |
void | DrawEllipse (const wxPoint &pt, const wxSize &size) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawEllipse (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawEllipticArc (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double start, double end) |
Draws an arc of an ellipse. More... | |
void | DrawEllipticArc (const wxPoint &pt, const wxSize &sz, double sa, double ea) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawIcon (const wxIcon &icon, wxCoord x, wxCoord y) |
Draw an icon on the display (does nothing if the device context is PostScript). More... | |
void | DrawIcon (const wxIcon &icon, const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawLabel (const wxString &text, const wxBitmap &bitmap, const wxRect &rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1, wxRect *rectBounding=NULL) |
Draw optional bitmap and the text into the given rectangle and aligns it as specified by alignment parameter; it also will emphasize the character with the given index if it is != -1 and return the bounding rectangle if required. More... | |
void | DrawLabel (const wxString &text, const wxRect &rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) |
Draws a line from the first point to the second. More... | |
void | DrawLine (const wxPoint &pt1, const wxPoint &pt2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawLines (int n, const wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0) |
Draws lines using an array of points of size n adding the optional offset coordinate. More... | |
void | DrawLines (const wxPointList *points, wxCoord xoffset=0, wxCoord yoffset=0) |
This method uses a list of wxPoints, adding the optional offset coordinate. More... | |
void | DrawPoint (wxCoord x, wxCoord y) |
Draws a point using the color of the current pen. More... | |
void | DrawPoint (const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawPolygon (int n, const wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE) |
Draws a filled polygon using an array of points of size n, adding the optional offset coordinate. More... | |
void | DrawPolygon (const wxPointList *points, wxCoord xoffset=0, wxCoord yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE) |
This method draws a filled polygon using a list of wxPoints, adding the optional offset coordinate. More... | |
void | DrawPolyPolygon (int n, const int count[], const wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE) |
Draws two or more filled polygons using an array of points, adding the optional offset coordinates. More... | |
void | DrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Draws a rectangle with the given corner coordinate and size. More... | |
void | DrawRectangle (const wxPoint &pt, const wxSize &sz) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRectangle (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRotatedText (const wxString &text, wxCoord x, wxCoord y, double angle) |
Draws the text rotated by angle degrees (positive angles are counterclockwise; the full angle is 360 degrees). More... | |
void | DrawRotatedText (const wxString &text, const wxPoint &point, double angle) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) |
Draws a rectangle with the given top left corner, and with the given size. More... | |
void | DrawRoundedRectangle (const wxPoint &pt, const wxSize &sz, double radius) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRoundedRectangle (const wxRect &rect, double radius) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawSpline (int n, const wxPoint points[]) |
Draws a spline between all given points using the current pen. More... | |
void | DrawSpline (const wxPointList *points) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawSpline (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawText (const wxString &text, wxCoord x, wxCoord y) |
Draws a text string at the specified point, using the current text font, and the current text foreground and background colours. More... | |
void | DrawText (const wxString &text, const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | GradientFillConcentric (const wxRect &rect, const wxColour &initialColour, const wxColour &destColour) |
Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside. More... | |
void | GradientFillConcentric (const wxRect &rect, const wxColour &initialColour, const wxColour &destColour, const wxPoint &circleCenter) |
Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside. More... | |
void | GradientFillLinear (const wxRect &rect, const wxColour &initialColour, const wxColour &destColour, wxDirection nDirection=wxRIGHT) |
Fill the area specified by rect with a linear gradient, starting from initialColour and eventually fading to destColour. More... | |
bool | FloodFill (wxCoord x, wxCoord y, const wxColour &colour, wxFloodFillStyle style=wxFLOOD_SURFACE) |
Flood fills the device context starting from the given point, using the current brush colour, and using a style: More... | |
bool | FloodFill (const wxPoint &pt, const wxColour &col, wxFloodFillStyle style=wxFLOOD_SURFACE) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | CrossHair (wxCoord x, wxCoord y) |
Displays a cross hair using the current pen. More... | |
void | CrossHair (const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DestroyClippingRegion () |
Destroys the current clipping region so that none of the DC is clipped. More... | |
bool | GetClippingBox (wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const |
Gets the rectangle surrounding the current clipping region. More... | |
bool | GetClippingBox (wxRect &rect) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | SetClippingRegion (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region. More... | |
void | SetClippingRegion (const wxPoint &pt, const wxSize &sz) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | SetClippingRegion (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | SetDeviceClippingRegion (const wxRegion ®ion) |
Sets the clipping region for this device context. More... | |
wxCoord | GetCharHeight () const |
Gets the character height of the currently set font. More... | |
wxCoord | GetCharWidth () const |
Gets the average character width of the currently set font. More... | |
wxFontMetrics | GetFontMetrics () const |
Returns the various font characteristics. More... | |
void | GetMultiLineTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *heightLine=NULL, const wxFont *font=NULL) const |
Gets the dimensions of the string using the currently selected font. More... | |
wxSize | GetMultiLineTextExtent (const wxString &string) const |
Gets the dimensions of the string using the currently selected font. More... | |
bool | GetPartialTextExtents (const wxString &text, wxArrayInt &widths) const |
Fills the widths array with the widths from the beginning of text to the corresponding character of text. More... | |
void | GetTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=NULL, wxCoord *externalLeading=NULL, const wxFont *font=NULL) const |
Gets the dimensions of the string using the currently selected font. More... | |
wxSize | GetTextExtent (const wxString &string) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | GetBackgroundMode () const |
Returns the current background mode: wxBRUSHSTYLE_SOLID or wxBRUSHSTYLE_TRANSPARENT . More... | |
const wxFont & | GetFont () const |
Gets the current font. More... | |
wxLayoutDirection | GetLayoutDirection () const |
Gets the current layout direction of the device context. More... | |
const wxColour & | GetTextBackground () const |
Gets the current text background colour. More... | |
const wxColour & | GetTextForeground () const |
Gets the current text foreground colour. More... | |
void | SetBackgroundMode (int mode) |
Change the current background mode. More... | |
void | SetFont (const wxFont &font) |
Sets the current font for the DC. More... | |
void | SetTextBackground (const wxColour &colour) |
Sets the current text background colour for the DC. More... | |
void | SetTextForeground (const wxColour &colour) |
Sets the current text foreground colour for the DC. More... | |
void | SetLayoutDirection (wxLayoutDirection dir) |
Sets the current layout direction for the device context. More... | |
void | CalcBoundingBox (wxCoord x, wxCoord y) |
Adds the specified point to the bounding box which can be retrieved with MinX(), MaxX() and MinY(), MaxY() functions. More... | |
wxCoord | MaxX () const |
Gets the maximum horizontal extent used in drawing commands so far. More... | |
wxCoord | MaxY () const |
Gets the maximum vertical extent used in drawing commands so far. More... | |
wxCoord | MinX () const |
Gets the minimum horizontal extent used in drawing commands so far. More... | |
wxCoord | MinY () const |
Gets the minimum vertical extent used in drawing commands so far. More... | |
void | ResetBoundingBox () |
Resets the bounding box: after a call to this function, the bounding box doesn't contain anything. More... | |
bool | StartDoc (const wxString &message) |
Starts a document (only relevant when outputting to a printer). More... | |
void | StartPage () |
Starts a document page (only relevant when outputting to a printer). More... | |
void | EndDoc () |
Ends a document (only relevant when outputting to a printer). More... | |
void | EndPage () |
Ends a document page (only relevant when outputting to a printer). More... | |
bool | Blit (wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode logicalFunc=wxCOPY, bool useMask=false, wxCoord xsrcMask=wxDefaultCoord, wxCoord ysrcMask=wxDefaultCoord) |
Copy from a source DC to this DC. More... | |
bool | StretchBlit (wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight, wxRasterOperationMode logicalFunc=wxCOPY, bool useMask=false, wxCoord xsrcMask=wxDefaultCoord, wxCoord ysrcMask=wxDefaultCoord) |
Copy from a source DC to this DC possibly changing the scale. More... | |
const wxBrush & | GetBackground () const |
Gets the brush used for painting the background. More... | |
const wxBrush & | GetBrush () const |
Gets the current brush. More... | |
const wxPen & | GetPen () const |
Gets the current pen. More... | |
void | SetBackground (const wxBrush &brush) |
Sets the current background brush for the DC. More... | |
void | SetBrush (const wxBrush &brush) |
Sets the current brush for the DC. More... | |
void | SetPen (const wxPen &pen) |
Sets the current pen for the DC. More... | |
bool | CanUseTransformMatrix () const |
Check if the use of transformation matrix is supported by the current system. More... | |
bool | SetTransformMatrix (const wxAffineMatrix2D &matrix) |
Set the transformation matrix. More... | |
wxAffineMatrix2D | GetTransformMatrix () const |
Return the transformation matrix used by this device context. More... | |
void | ResetTransformMatrix () |
Revert the transformation matrix to identity matrix. More... | |
bool | CanDrawBitmap () const |
Does the DC support drawing bitmaps? More... | |
bool | CanGetTextExtent () const |
Does the DC support calculating the size required to draw text? More... | |
void | GetLogicalOrigin (wxCoord *x, wxCoord *y) const |
Return the coordinates of the logical point (0, 0). More... | |
wxPoint | GetLogicalOrigin () const |
Return the coordinates of the logical point (0, 0). More... | |
Public Member Functions inherited from wxObject | |
wxObject () | |
Default ctor; initializes to NULL the internal reference data. More... | |
wxObject (const wxObject &other) | |
Copy ctor. More... | |
virtual | ~wxObject () |
Destructor. More... | |
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). More... | |
wxObjectRefData * | GetRefData () const |
Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More... | |
bool | IsKindOf (const wxClassInfo *info) const |
Determines whether this class is a subclass of (or the same class as) the given class. More... | |
bool | IsSameAs (const wxObject &obj) const |
Returns true if this object has the same data pointer as obj. More... | |
void | Ref (const wxObject &clone) |
Makes this object refer to the data in clone. More... | |
void | SetRefData (wxObjectRefData *data) |
Sets the wxObject::m_refData pointer. More... | |
void | UnRef () |
Decrements the reference count in the associated data, and if it is zero, deletes the data. More... | |
void | UnShare () |
This is the same of AllocExclusive() but this method is public. More... | |
void | operator delete (void *buf) |
The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More... | |
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. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from wxObject | |
void | AllocExclusive () |
Ensure that this object's data is not shared with any other object. More... | |
virtual wxObjectRefData * | CreateRefData () const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More... | |
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More... | |
Protected Attributes inherited from wxObject | |
wxObjectRefData * | m_refData |
Pointer to an object which is the object's reference-counted data. More... | |
wxMemoryDC::wxMemoryDC | ( | ) |
Constructs a new memory device context.
Use the wxDC::IsOk() member to test whether the constructor was successful in creating a usable device context. Don't forget to select a bitmap into the DC before drawing on it.
wxMemoryDC::wxMemoryDC | ( | wxDC * | dc | ) |
Constructs a new memory device context having the same characteristics as the given existing device context.
This constructor creates a memory device context compatible with dc in wxMSW, the argument is ignored in the other ports. If dc is NULL, a device context compatible with the screen is created, just as with the default constructor.
wxMemoryDC::wxMemoryDC | ( | wxBitmap & | bitmap | ) |
Constructs a new memory device context and calls SelectObject() with the given bitmap.
Use the wxDC::IsOk() member to test whether the constructor was successful in creating a usable device context.
wxBitmap& wxMemoryDC::GetSelectedBitmap | ( | ) |
const wxBitmap& wxMemoryDC::GetSelectedBitmap | ( | ) | const |
Get the selected bitmap.
void wxMemoryDC::SelectObject | ( | wxBitmap & | bitmap | ) |
Allow using this device context object to modify the given bitmap contents.
Note that if you need to only use the existing bitmap contents instead of modifying it, you should use SelectObjectAsSource() instead.
Before using the updated bitmap data, make sure to select it out of context first either by selecting wxNullBitmap into the device context or destroying the device context entirely.
If the bitmap is already selected in this device context, nothing is done. If it is selected in another context, the function asserts and drawing on the bitmap won't work correctly.
void wxMemoryDC::SelectObjectAsSource | ( | const wxBitmap & | bitmap | ) |
Selects the given bitmap into the device context, to use as the memory bitmap.
Selecting the bitmap as source into a memory DC allows you to copy its contents to another device context using wxDC::Blit(). Note that using wxDC::DrawBitmap() or wxDC::DrawIcon() is a simpler way to do the same thing.
If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device context, allowing the current bitmap to be destroyed safely.