:param srcPtMask: Source position on the mask.
",
BlitPointSize);
+
+
+ DocDeclStr(
+ wxBitmap , GetAsBitmap(const wxRect *subrect = NULL) const,
+ "", "");
+
DocStr(
//---------------------------------------------------------------------------
%newgroup
-MustHaveApp(wxMemoryDC);
+DocStr(wxDCTextColourChanger,
+"wx.DCTextColourChanger can be used to temporarily change the DC text
+colour and restore it automatically when the object goes out of scope", "");
-DocStr(wxMemoryDC,
-"A memory device context provides a means to draw graphics onto a
-bitmap. A bitmap must be selected into the new memory DC before it may
-be used for anything. Typical usage is as follows::
+class wxDCTextColourChanger
+{
+public:
+ wxDCTextColourChanger(wxDC& dc, const wxColour& col);
+ ~wxDCTextColourChanger();
+};
- dc = wx.MemoryDC()
- dc.SelectObject(bitmap)
- # draw on the dc using any of the Draw methods
- dc.SelectObject(wx.NullBitmap)
- # the bitmap now contains wahtever was drawn upon it
-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.
-", "");
+DocStr(wxDCPenChanger,
+"wx.DCPenChanger can be used to temporarily change the DC pen and
+restore it automatically when the object goes out of scope", "");
-class wxMemoryDC : public wxDC {
+class wxDCPenChanger
+{
public:
- DocCtorStr(
- wxMemoryDC(const wxBitmap& bitmap = wxNullBitmap),
- "Constructs a new memory device context.
+ wxDCPenChanger(wxDC& dc, const wxPen& pen);
+ ~wxDCPenChanger();
+};
-Use the Ok member to test whether the constructor was successful in
-creating a usable device context. If a bitmap is not given to this
-constructor then don't forget to select a bitmap into the DC before
-drawing on it.", "
-:see: `MemoryDCFromDC`");
- DocCtorStrName(
- wxMemoryDC(wxDC* oldDC),
- "Creates a DC that is compatible with the oldDC.", "",
- MemoryDCFromDC);
+DocStr(wxDCBrushChanger,
+"wx.DCBrushChanger can be used to temporarily change the DC brush and
+restore it automatically when the object goes out of scope", "");
-
- DocDeclStr(
- void , SelectObject(const wxBitmap& bitmap),
- "Selects the bitmap into the device context, to use as the memory
-bitmap. Selecting the bitmap into a memory DC allows you to draw into
-the DC, and therefore the bitmap, and also to use Blit to copy the
-bitmap to a window.
+class wxDCBrushChanger
+{
+public:
+ wxDCBrushChanger(wxDC& dc, const wxBrush& brush);
+ ~wxDCBrushChanger();
+};
-If the argument is wx.NullBitmap (or some other uninitialised
-`wx.Bitmap`) the current bitmap is selected out of the device context,
-and the original bitmap restored, allowing the current bitmap to be
-destroyed safely.", "");
-
+
+DocStr(wxDCClipper,
+"wx.wxDCClipper sets the DC's clipping region when it is constructed,
+and then automatically destroys the clipping region when the clipper
+goes out of scope.", "");
+
+class wxDCClipper
+{
+public:
+ %nokwargs wxDCClipper;
+ wxDCClipper(wxDC& dc, const wxRegion& r);
+ wxDCClipper(wxDC& dc, const wxRect& r);
+ wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+ ~wxDCClipper();
};
+
+
+
//---------------------------------------------------------------------------
%newgroup
+//---------------------------------------------------------------------------
+%newgroup
+
+MustHaveApp(wxMemoryDC);
+
+DocStr(wxMemoryDC,
+"A memory device context provides a means to draw graphics onto a
+bitmap. A bitmap must be selected into the new memory DC before it may
+be used for anything. Typical usage is as follows::
+
+ dc = wx.MemoryDC()
+ dc.SelectObject(bitmap)
+ # draw on the dc using any of the Draw methods
+ dc.SelectObject(wx.NullBitmap)
+ # the bitmap now contains wahtever was drawn upon it
+
+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.
+", "");
+
+class wxMemoryDC : public wxWindowDC {
+public:
+ DocCtorStr(
+ wxMemoryDC(wxBitmap& bitmap = wxNullBitmap),
+ "Constructs a new memory device context.
+
+Use the Ok member to test whether the constructor was successful in
+creating a usable device context. If a bitmap is not given to this
+constructor then don't forget to select a bitmap into the DC before
+drawing on it.", "
+
+:see: `MemoryDCFromDC`");
+
+ DocCtorStrName(
+ wxMemoryDC(wxDC* oldDC),
+ "Creates a DC that is compatible with the oldDC.", "",
+ MemoryDCFromDC);
+
+
+ DocDeclStr(
+ void , SelectObject(wxBitmap& bitmap),
+ "Selects the bitmap into the device context, to use as the memory
+bitmap. Selecting the bitmap into a memory DC allows you to draw into
+the DC, and therefore the bitmap, and also to use Blit to copy the
+bitmap to a window.
+
+If the argument is wx.NullBitmap (or some other uninitialised
+`wx.Bitmap`) the current bitmap is selected out of the device context,
+and the original bitmap restored, allowing the current bitmap to be
+destroyed safely.", "");
+
+
+ DocDeclStr(
+ void , SelectObjectAsSource(const wxBitmap& bmp),
+ "", "");
+
+
+};
+
+
//---------------------------------------------------------------------------
%newgroup
"This simple class provides a simple way to avoid flicker: when drawing
on it, everything is in fact first drawn on an in-memory buffer (a
`wx.Bitmap`) and then copied to the screen only once, when this object
-is destroyed.
+is destroyed. You can either provide a buffer bitmap yourself, and
+reuse it the next time something needs painted, or you can let the
+buffered DC create and provide a buffer bitmap itself.
-It can be used in the same way as any other device context.
+Buffered DCs can be used in the same way as any other device context.
wx.BufferedDC itself typically replaces `wx.ClientDC`, if you want to
use it in your EVT_PAINT handler, you should look at
-`wx.BufferedPaintDC`.
+`wx.BufferedPaintDC`. You can also use a wx.BufferedDC without
+providing a target DC. In this case the operations done on the dc
+will only be written to the buffer bitmap and *not* to any window, so
+you will want to have provided the buffer bitmap and then reuse it
+when it needs painted to the window.
Please note that GTK+ 2.0 and OS X provide double buffering themselves
-natively. wxBufferedDC is aware of this however, and will bypass the buffering
-unless an explicit buffer bitmap is given.
+natively. You may want to use `wx.Window.IsDoubleBuffered` to
+determine whether you need to use buffering or not, or use
+`wx.AutoBufferedPaintDC` to avoid needless double buffering on systems
+that already do it automatically.
+
+
", "");
class wxBufferedDC : public wxMemoryDC
{
public:
- %pythonAppend wxBufferedDC
- "self.__dc = args[0] # save a ref so the other dc will not be deleted before self";
-
- %nokwargs wxBufferedDC;
DocStr(
wxBufferedDC,
intended to cover the entire virtual size of a `wx.ScrolledWindow` or
if it only covers the client area. Acceptable values are
``wx.BUFFER_VIRTUAL_AREA`` and ``wx.BUFFER_CLIENT_AREA``.
-
");
+
+ %nokwargs wxBufferedDC;
+ %pythonAppend wxBufferedDC
+"# save a ref so the other dc will not be deleted before self
+ self.__dc = args[0]
+ # also save a ref to the bitmap
+ if len(args) > 1: self.__bmp = args[1]
+";
+
wxBufferedDC( wxDC* dc,
- const wxBitmap& buffer=wxNullBitmap,
+ wxBitmap& buffer=wxNullBitmap,
int style = wxBUFFER_CLIENT_AREA );
wxBufferedDC( wxDC* dc,
const wxSize& area,
"Blits the buffer to the dc, and detaches the dc from the buffer (so it
can be effectively used once only). This is usually only called in
the destructor.", "");
-
+
+ // Set and get the style
+ void SetStyle(int style);
+ int GetStyle() const;
};
{
public:
+ %pythonAppend wxBufferedPaintDC "if len(args) > 1: self.__bmp = args[1]";
+
DocCtorStr(
wxBufferedPaintDC( wxWindow *window,
- const wxBitmap &buffer = wxNullBitmap,
+ wxBitmap &buffer = wxNullBitmap,
int style = wxBUFFER_CLIENT_AREA),
"Create a buffered paint DC. As with `wx.BufferedDC`, you may either
provide the bitmap to be used for buffering or let this object create