a2dDcDrawer Class Reference
[classes used for drawing with a2dDrawer2D]

This class implements drawing functions for wxDC based drawing. More...

#include <dcdrawer.h>

Inheritance diagram for a2dDcDrawer:

Inheritance graph
[legend]
Collaboration diagram for a2dDcDrawer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 a2dDcDrawer (int width=0, int height=0)
 Drawer having a buffer of w pixel wide and h pixels heigh.
 a2dDcDrawer (const wxSize &size)
 Drawer having a buffer of w pixel wide and h pixels height given by size.
void SetBufferSize (int w, int h)
 set buffer size to w pixel wide and h pixels heigh
wxBitmap GetBuffer () const
 Return the buffer as a bitmap.
wxBitmap GetSubBitmap (wxRect sub_rect) const
 get part of the buffer given a rect
virtual ~a2dDcDrawer ()
 destructor
 a2dDcDrawer (const a2dDcDrawer &other)
 copy constructor
 a2dDcDrawer (const a2dDrawer2D &other)
virtual void BlitBuffer (wxRect rect, const wxPoint &bufferpos=wxPoint(0, 0))
 blit given rect contents within buffer to device
virtual void BlitBuffer (wxDC *dc, wxRect rect, const wxPoint &bufferpos=wxPoint(0, 0))
 used for blitting to a wxDC.
void ResetStyle ()
 set a pre-defined style reseting cashed values.
virtual void BeginDraw ()
 start to draw on this context (used to initialize a specific drawer)
virtual void EndDraw ()
 end drawing on this context (used to reset a specific drawer)
virtual wxDC * GetRenderDC () const
 get the DC that is used for rendering
void SetRenderDC (wxDC *dc)
 set the DC that is used for rendering
wxDC * GetDeviceDC () const
 get the DC that is used for rendering
void SetClippingRegion (a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
 set clipping region from polygon to which everything drawn will be clipped.
virtual void ExtendClippingRegion (a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)
 extend clipping region with a polygon to which everything drawn will be clipped.
virtual void ExtendAndPushClippingRegion (a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)
 push on stack the current clipping region and extend clipping region
void PopClippingRegion ()
 pop a previously pushed clipping region
void SetClippingRegionDev (wxCoord minx, wxCoord miny, wxCoord width, wxCoord height)
 set clipping region using x y values in device coordinates
void SetClippingRegion (double minx, double miny, double maxx, double maxy)
 set clipping region using x y values in world coordinates
void DestroyClippingRegion ()
 set clipping region off
void DrawImage (const wxImage &image, double x, double y, double width, double height, wxUint8 Opacity=255)
 Draw a wxImage in world coordinates.
void DrawImage (const a2dImageRGBA &image, double x, double y, double width, double height, wxUint8 Opacity=255)
void DrawRoundedRectangle (double x, double y, double width, double height, double radius, bool pixelsize=false)
 Draw RoundedRectangle in world coordinates.
void DrawVpath (const a2dVpath *path)
 Draw vector path in world coordinates.
void DrawPolyPolygon (a2dListOfa2dVertexList polylist, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
 draw a list of polygons ( contour clockwise becomes hole )
void DrawCircle (double xc, double yc, double radius)
 Draw Circle in world coordinates.
void DrawEllipse (double xc, double yc, double width, double height)
 Draw Ellipse in world coordinates.
void DrawLine (double x1, double y1, double x2, double y2)
 Draw line in world coordinates.
void DrawPoint (double xc, double yc)
 draw single point
virtual void DeviceDrawAnnotation (const wxString &text, wxCoord x, wxCoord y, const wxFont &font)
 text drawn in device coordinates

Protected Member Functions

virtual void DoSetDrawStyle (a2dDrawStyle drawstyle)
void DoSetActiveStroke ()
 per drawer implementation
void DoSetActiveFill ()
 per drawer implementation
virtual void DeviceDrawPolygon (unsigned int n, bool spline, wxPolygonFillMode fillStyle)
 draw an internal polygon in device coordinates
virtual void DeviceDrawLines (unsigned int n, bool spline)
 draw an internal polyline in device coordinates
void DeviceDrawLine (double x1, double y1, double x2, double y2)
 draw in pixels
void DeviceDrawHorizontalLine (int x1, int y1, int x2, bool use_stroke_color)
 Draw a pixel-width, unstroked horizontal line in device (pixel) coordinates.
void DeviceDrawVerticalLine (int x1, int y1, int y2, bool use_stroke_color)
 Draw a pixel-width, unstroked vertical line in device (pixel) coordinates.
void DeviceDrawPixel (int x1, int y1, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 draw a single, unstroked pixel in device coordinates with the given color
void DeviceDrawBitmap (const wxBitmap &bmp, double x, double y, bool useMask=false)
 in pixels
void SetLogicalFunction (wxRasterOperationMode function)
virtual void DrawCharDc (wxChar c)
 Draw a dc character.
virtual void DrawTextDc (const wxString &text, double x, double y)
 Draw text in user coordinates, based on a dc font .
virtual void DrawCharFreetype (wxChar c)

Protected Attributes

wxDC * m_renderDC
 The DC to use to draw to the device or buffer ( depends on type of a2dCanvasView ).
wxClientDC * m_deviceDC
 wxDc to draw or blit to the device
bool m_externalDc
 when dc is set from the outside, this is true.


Detailed Description

This class implements drawing functions for wxDC based drawing.

This class implements drawing functions for wxDC based drawing. See a2dCanvasView class for documentation. You must set the DC to use to draw to the device. In case of a buffer you must select the bitmap into the DC yourself.

See also:
class: a2dCanvas

class: a2dRenderImage

Definition at line 43 of file dcdrawer.h.


Member Function Documentation

void a2dDcDrawer::SetBufferSize ( int  w,
int  h 
) [virtual]

set buffer size to w pixel wide and h pixels heigh

Remarks:
SetMappingDeviceRect() is NOT reset.

Implements a2dDrawer2D.

Reimplemented in a2dMemDcDrawer.

Definition at line 160 of file dcdrawer.cpp.

void a2dDcDrawer::ResetStyle (  )  [virtual]

set a pre-defined style reseting cashed values.

setting a style ( stroke fill ) for a a2dDrawer2D, takes into account the style that is currently set for it. If the style being set is equal to the current style, internal nothing is done for the underlying device. Of course this only works if everyone obeys the rules. Routines not using a2dDrawer2D as an entry to device, may fool this trick. Therefore to be sure to start with a proper a2dDrawer2D, first call this function. It will make the a2dDrawer2D style the actual style used on the device.

Reimplemented from a2dDrawer2D.

Definition at line 423 of file dcdrawer.cpp.

void a2dDcDrawer::SetRenderDC ( wxDC *  dc  ) 

set the DC that is used for rendering

Used for setting an external DC ( e.g for printing ) You must set an external before calling BeginDraw() At the end of the printing action, you must call SetRenderDC( NULL ) to Switch back to normal operation, which means the creation of a wxClientDC is handled internal.

Definition at line 192 of file dcdrawer.cpp.

void a2dDcDrawer::ExtendAndPushClippingRegion ( a2dVertexList points,
bool  spline = false,
wxPolygonFillMode  fillStyle = wxODDEVEN_RULE,
a2dBooleanClip  clipoperation = a2dCLIP_AND 
) [virtual]

push on stack the current clipping region and extend clipping region

The clipping region will be extended with a polygon to which everything drawn will be clipped.

Implements a2dDrawer2D.

Definition at line 245 of file dcdrawer.cpp.

void a2dDcDrawer::DrawImage ( const wxImage &  image,
double  x,
double  y,
double  width,
double  height,
wxUint8  Opacity = 255 
) [virtual]

Draw a wxImage in world coordinates.

Currently this implementation does not handle rotated transformations properly.

Implements a2dDrawer2D.

Reimplemented in a2dMemDcDrawer.

Definition at line 784 of file dcdrawer.cpp.

void a2dDcDrawer::DrawCircle ( double  x,
double  y,
double  radius 
) [virtual]

Draw Circle in world coordinates.

Remarks:
circle gets rotates and scaled etc. in x and y when required.

Reimplemented from a2dDrawer2D.

Definition at line 1543 of file dcdrawer.cpp.

void a2dDcDrawer::DrawEllipse ( double  x,
double  y,
double  width,
double  height 
) [virtual]

Draw Ellipse in world coordinates.

Remarks:
ellipse gets rotates and scaled etc. in x and y when required.

Reimplemented from a2dDrawer2D.

Definition at line 1633 of file dcdrawer.cpp.

void a2dDcDrawer::DeviceDrawHorizontalLine ( int  x1,
int  y1,
int  x2,
bool  use_stroke_color 
) [protected, virtual]

Draw a pixel-width, unstroked horizontal line in device (pixel) coordinates.

This method is useful for implementing low level fill routines.

Parameters:
x1 x start of line
x2 x end of line
y1 y of line
use_stroke_color If true, then use the current stroke color If false, then use the current fill color.

Reimplemented from a2dDrawer2D.

Definition at line 1964 of file dcdrawer.cpp.

void a2dDcDrawer::DeviceDrawVerticalLine ( int  x1,
int  y1,
int  y2,
bool  use_stroke_color 
) [protected, virtual]

Draw a pixel-width, unstroked vertical line in device (pixel) coordinates.

This method is useful for implementing low level fill routines.

Parameters:
x1 x of line
y1 y start of line
y2 y end of line
use_stroke_color If true, then use the current stroke color If false, then use the current fill color.

Reimplemented from a2dDrawer2D.

Definition at line 1986 of file dcdrawer.cpp.

void a2dDcDrawer::DrawCharDc ( wxChar  c  )  [protected, virtual]

Draw a dc character.

This is an internal function, used by DrawTextDc This function assumes that the affine matrix has been set up by the calling function in such a way, that the (0,0) coordinate will match with the lowerleft bbox corner of the character. Also mirroring should be performed by the calling function.

Reimplemented from a2dDrawer2D.

Definition at line 2051 of file dcdrawer.cpp.

void a2dDcDrawer::DrawCharFreetype ( wxChar  c  )  [protected, virtual]

Bug:
EW: DrawCharFreetype crashes when zoomed in extremely far.

Reimplemented from a2dDrawer2D.

Definition at line 2160 of file dcdrawer.cpp.


Member Data Documentation

wxDC* a2dDcDrawer::m_renderDC [protected]

The DC to use to draw to the device or buffer ( depends on type of a2dCanvasView ).

In case of a m_buffer you must select the bitmap into the DC yourself.

Definition at line 174 of file dcdrawer.h.

wxClientDC* a2dDcDrawer::m_deviceDC [protected]

wxDc to draw or blit to the device

( either from a blit from the buffer or drawn directly )

Definition at line 178 of file dcdrawer.h.


The documentation for this class was generated from the following files:
a2dDcDrawer Class Reference -- Tue Aug 31 18:22:25 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation