15 #ifndef __WXDCDRAWER_H__
16 #define __WXDCDRAWER_H__
25 #include <wx/dcclient.h>
26 #include <wx/dcmemory.h>
60 wxBitmap
GetBuffer()
const {
return wxBitmap( 0, 0 ); }
73 virtual void BlitBuffer( wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
75 virtual void BlitBuffer( wxDC* dc, wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
94 void SetRenderDC( wxDC* dc );
113 void DrawImage(
const wxImage& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
115 void DrawImage(
const a2dImageRGBA& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
117 void DrawRoundedRectangle(
double x,
double y,
double width,
double height,
double radius,
bool pixelsize =
false );
125 void DrawCircle(
double xc,
double yc,
double radius );
127 void DrawEllipse(
double xc,
double yc,
double width,
double height );
129 void DrawLine(
double x1,
double y1,
double x2,
double y2 );
134 virtual void DeviceDrawAnnotation(
const wxString& text, wxCoord x, wxCoord y,
const wxFont& font );
145 virtual void DeviceDrawPolygon(
unsigned int n,
bool spline , wxPolygonFillMode fillStyle );
150 void DeviceDrawLine(
double x1,
double y1,
double x2,
double y2 );
156 void DeviceDrawPixel(
int x1,
int y1,
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a );
159 void DeviceDrawBitmap(
const wxBitmap& bmp,
double x,
double y,
160 bool useMask =
false );
162 void SetLogicalFunction( wxRasterOperationMode
function );
167 virtual void DrawTextDc(
const wxString& text,
double x,
double y );
237 void DrawImage(
const wxImage& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
239 void DrawImage(
const a2dImageRGBA& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
241 void CopyIntoBuffer(
const wxBitmap& bitm );
243 virtual void BlitBuffer( wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
245 virtual void BlitBuffer( wxDC* dc, wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
253 #if wxART2D_USE_FREETYPE
255 void DrawCharFreetype( wxColour col, wxChar c,
int x,
int y, FT_Matrix trans_matrix, FT_Vector vec );
259 virtual void DrawPolygon(
const a2dVertexList* list,
bool spline =
false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
261 virtual void DeviceDrawPolygon(
unsigned int n,
bool spline , wxPolygonFillMode fillStyle );
270 mutable wxMemoryDC m_mdc1, m_mdc2;
271 #if defined(__WXMSW__)
280 #if wxART2D_USE_GRAPHICS_CONTEXT
288 class a2dGcDrawer :
public a2dGcBaseDrawer
290 DECLARE_DYNAMIC_CLASS( a2dGcDrawer )
295 a2dGcDrawer(
int width = 0,
int height = 0 );
298 a2dGcDrawer(
const wxSize& size );
302 a2dGcDrawer(
const wxBitmap& bitmap );
305 wxBitmap GetBuffer()
const;
308 a2dGcDrawer(
const a2dGcDrawer& other );
313 void SetBufferSize(
int w,
int h );
316 wxBitmap GetSubBitmap( wxRect sub_rect )
const;
318 virtual ~a2dGcDrawer();
321 virtual void BeginDraw();
324 virtual void EndDraw();
326 virtual void SetYaxis(
bool up );
330 void BlitBuffer( wxDC* dc, wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
332 void ShiftBuffer(
int dxy,
bool yshift );
334 void DrawPoint(
double xc,
double yc );
336 void DrawImage(
const wxImage& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
338 void DrawImage(
const a2dImageRGBA& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
342 void DoSetActiveStroke();
344 void DoSetActiveFill();
346 void DoSetActiveFont(
const a2dFont& font );
358 #endif // wxART2D_USE_GRAPHICS_CONTEXT
virtual void ExtendClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)=0
extend clipping region with a polygon to which everything drawn will be clipped.
virtual void DeviceDrawPixel(int x1, int y1, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
draw a single, unstroked pixel in device coordinates with the given color
wxBitmap GetBuffer() const
Return the buffer as a bitmap.
virtual void DrawVpath(const a2dVpath *path)
Draw vector path in world coordinates.
void SetBufferSize(int w, int h)
set buffer size to w pixel wide and h pixels heigh
virtual void DestroyClippingRegion()=0
set clipping region off
virtual void BeginDraw()
start to draw on this context (used to initialize a specific drawer)
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
virtual void DrawPolygon(a2dVertexArray *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
Draw polygon in world coordinates using pointarray.
This class implements drawing functions for wxDC based drawing.
This class implements drawing functions for wxDC based drawing.
virtual void DrawCharFreetype(wxChar c)
Draw a freetype character.
wxBitmap GetBuffer() const
return buffer as a bitmap
vertex list of line and arc segments.
virtual void DeviceDrawVerticalLine(int x1, int y1, int y2, bool use_stroke_color)
Draw a pixel-width, unstroked vertical line in device (pixel) coordinates.
a2dDrawStyle
Define the manner in which a2dCanvasView draws to the device.
virtual wxBitmap GetSubBitmap(wxRect sub_rect) const =0
A way to get parts form the buffer that is drawn into.
virtual void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
virtual void ResetStyle()
set a pre-defined style reseting cashed values.
virtual void DrawCharDc(wxChar c)
Draw a dc character.
virtual void DrawPoint(double xc, double yc)=0
draw a single point
wxDC * m_renderDC
The DC to use to draw to the device or buffer ( depends on type of a2dCanvasView ) ...
virtual void DrawPolyPolygon(a2dListOfa2dVertexList polylist, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
draw a list of polygons ( contour clockwise becomes hole )
Drawing context abstraction.
virtual void DrawImage(const wxImage &image, double x, double y, double width, double height, wxUint8 Opacity=255)=0
Draw wxImage in world coordinates.
wxBitmap GetSubBitmap(wxRect sub_rect) const
get part of the buffer given a rect
virtual void ShiftBuffer(int dxy, bool yshift)
quick scroll over small distance
virtual void DrawTextFreetype(const wxString &text, double x, double y)
Draw text in world coordinates, based on a freetype font .
virtual void DoSetActiveStroke()=0
per drawer implementation
virtual void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
virtual void DoSetActiveFill()=0
per drawer implementation
wxDC * GetDeviceDC() const
get the DC that is used for rendering
virtual void DeviceDrawLine(double x1, double y1, double x2, double y2)
draw in pixels
virtual void DrawTextDc(const wxString &text, double x, double y)
Draw text in user coordinates, based on a dc font .
wxMemoryDC * m_memdc
Created at BeginDraw, and destoyed at EndDraw, used to actually draw.
virtual void ExtendAndPushClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)=0
push on stack the current clipping region and extend clipping region
virtual void SetClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)=0
set clipping region from polygon to which everything drawn will be clipped.
Contains graphical drawing context specific classes. a2dDrawer2D and derived classes are used for dra...
a2dBooleanClip
Used for defining how a ClippingRegion defined as a polygon is combined with.
wxClientDC * m_deviceDC
wxDc to draw or blit to the device
virtual void DrawCharFreetype(wxChar c)
Draw a freetype character.
virtual void SetClippingRegionDev(wxCoord minx, wxCoord miny, wxCoord maxx, wxCoord maxy)=0
set clipping region using x y values in device coordinates
virtual wxDC * GetRenderDC() const
get the DC that is used for rendering
virtual void BeginDraw()=0
start to draw on this context (used to initialize a specific drawer)
virtual void DeviceDrawPolygon(unsigned int n, bool spline, wxPolygonFillMode fillStyle)
draw an internal polygon in device coordinates
virtual void DeviceDrawAnnotation(const wxString &text, wxCoord x, wxCoord y, const wxFont &font)
text drawn in device coordinates
void BlitBuffer()
blit whole buffer to device
virtual void PopClippingRegion()=0
pop a previously pushed clipping region
bool m_externalDc
when dc is set from the outside, this is true.
wxBitmap m_buffer
the buffer that is used for rendering
virtual void EndDraw()=0
end drawing on this context (used to reset a specific drawer)
virtual void DrawEllipse(double x, double y, double width, double height)
Draw Ellipse in world coordinates.
virtual void SetBufferSize(int w, int h)=0
Change the buffer size.
virtual void DrawCircle(double x, double y, double radius)
Draw Circle in world coordinates.
void DrawImage(const wxImage &image, double x, double y, double width, double height, wxUint8 Opacity=255)
Draw a wxImage in world coordinates.
virtual void DeviceDrawPolygon(unsigned int n, bool spline, wxPolygonFillMode fillStyle)
draw an internal polygon in device coordinates
virtual void DeviceDrawHorizontalLine(int x1, int y1, int x2, bool use_stroke_color)
Draw a pixel-width, unstroked horizontal line in device (pixel) coordinates.
virtual void EndDraw()
end drawing on this context (used to reset a specific drawer)
virtual void DeviceDrawLines(unsigned int n, bool spline)
draw an internal polyline in device coordinates