wxArt2D
drawer2d.h
Go to the documentation of this file.
1 /*! \file wx/artbase/drawer2d.h
2  \brief Contains graphical drawing context specific classes.
3  a2dDrawer2D and derived classes are used for drawing primitives.
4 
5  A drawing context which is wxDrawer2 derived, can be used to draw in general.
6  Still it has special features in order to use it for drawing document containing a drawing.
7 
8  \author Klaas Holwerda
9 
10  Copyright: 2000-2004 (c) Klaas Holwerda
11 
12  Licence: wxWidgets Licence
13 
14  RCS-ID: $Id: drawer2d.h,v 1.53 2009/10/06 18:40:31 titato Exp $
15 */
16 
17 #ifndef __WXDRAWER2D_H__
18 #define __WXDRAWER2D_H__
19 
20 #ifndef WX_PRECOMP
21 #include "wx/wx.h"
22 #endif
23 
24 #include "wx/image.h"
25 #include "wx/prntbase.h"
26 #include <wx/module.h>
27 
28 #include "wx/general/genmod.h"
29 #include "wx/artbase/artglob.h"
30 #include "wx/artbase/stylebase.h"
31 #include "wx/artbase/liner.h"
32 #include "wx/artbase/afmatrix.h"
33 #include "wx/artbase/bbox.h"
34 #include "wx/artbase/polyver.h"
35 #include "wx/genart/imagergba.h"
36 
37 #include <vector>
38 
39 #ifdef Round
40 #undef Round
41 #endif
42 #define Round( x ) (int) floor( (x) + 0.5 )
43 
44 #if wxCHECK_VERSION(2,7,1)
45 # define WX_COLOUR_HAS_ALPHA 1
46 #else
47 # define WX_COLOUR_HAS_ALPHA 0
48 #endif
49 
50 //! Used for defining how a ClippingRegion defined as a polygon is combined with
51 /*! the existing clipping region in a a2dCanvasView.
52  \ingroup drawer
53 */
55 {
56  a2dCLIP_AND, /*!< AND operation, the new region is the union/intersection with existing clipping region */
57  a2dCLIP_COPY, /*!< COPY operation, replaces existing clipping region */
58  a2dCLIP_DIFF, /*!< DIFF operation subtracts new region from the existing clipping region */
59  a2dCLIP_OR, /*!< OR operation, the new region is the merge of the given with the existing clipping region */
60  a2dCLIP_XOR /*!< XOR operation, the new region is the complement of the intersection with existing clipping region */
61 };
62 
63 
64 #include "wx/artbase/graphica.h"
65 
66 //! Drawing context abstraction.
67 /*!
68  a2dDrawer2D presents a unified abstract view of underlying system-dependent
69  drawing contexts. It provides a simple low-level interface for
70  drawing rectangles and other basic primitives, and it also handles the
71  mapping and transformations from world coordinates to device coordinates.
72 
73  The current a2dFill and a2dStroke need to be set, those classes are always reference counted,
74  and a2dDrawer2D will increment and decrement them when setting and releasing them.
75  This means that if the reference count reaches zero it will actually be
76  deleted.
77 
78  Mapping from device to Logical/World coordinates needs to be set for a drawer.
79  The Yaxis orientation can also be set via the SetYaxis() method.
80 
81  \par About Transformations
82 
83  There are three different coordinate systems used by a2dDrawer2D, and
84  two transformations that map between them. These are referred to in a2d as
85  - User coordinates
86  - World coordinates
87  - Device coordinates
88 
89  User coordinates are the coordinates you give to drawing functions like
90  DrawCircle(). User coordinates are transformed to World coordinates
91  by the transformation returned from GetTransform().
92  The idea behind user coordinates is that one can draw in a relative coordinate system,
93  which can be at a position, angle and scale relative to the world coordinates.
94  The drawing context will correctly transform the relative coordinates, to world and device.
95  This way of drawing especialy becomes important when working with canvas objects.
96  Inside such object one can use drawing functions relative to the origin of that object,
97  and one does not have to take into account how and where this object is placed in the world
98  coordinate system.
99  World coordinates are transformed to Device coordinates using the
100  transformation returned by GetMappingMatrix(). One can draw
101  in device coordinates without transformations by calling PushIdentityTransform().
102  PopTransform() will restore the previous transformation.
103  As an example one can draw the vertexes in a plot as a circle in device
104  coordinates (with a fixed radius in pixels that is), while the curve itself is draw in normal
105  user coordinates.
106 
107  Given an input point (x,y), the final location on the output device
108  (e.g. screen) in device units (e.g. pixels) for any of the Draw*() methods
109  is given by
110  \code
111  (devx,devy) = GetMappingMatrix() * GetTransform() * (x,y)
112  \endcode
113  The compound of the world-to-device mapping and user-to-world transform
114  is also kept up-to-date. It can be obtained by calling
115  GetUserToDeviceTransform().
116  So we can also say
117  \code
118  (devx,devy) = GetUserToDeviceTransform() * (x,y)
119  \endcode
120 
121  We can also depict this relationship as
122  \verbatim
123  User coordinates
124  / \
125  [ GetTransform() ] |
126  | |
127  World coordinates [ GetUserToDeviceTransform() ]
128  | |
129  [ GetMappingMatrix() ] |
130  \ /
131  Device coordiantes
132  \endverbatim
133 
134  \par The Mapping Matrix
135 
136  The mapping matrix returned by GetMappingMatrix() contains only translation
137  and axis-aligned scaling. So an input of an axis-aligned rectangle is
138  always transformed to another axis-aligned rectangle. This lets you have
139  an unlimited virtual canvas (aka "world") and map different portions of
140  it to the drawing surface. Additionally, some objects like fonts are
141  aware of the orientation of the Y axis defined by the mapping, and will
142  draw right-side up, even if the Y axis is mirrored in the mapping.
143 
144  The mapping matrix can be manipulated using the following methods:
145  - SetMappingUpp()
146  - SetMappingDeviceRect()
147  - SetMinX(), SetMinY()
148  - SetUppX(), SetUppY()
149  - SetMappingWidthHeight()
150  - SetYaxis()
151 
152  \par The User to World Transform Matrix
153 
154  The user-to-world transform matrix returned by GetTransform() is a 2x3
155  affine matrix that can contain translation, rotation, and scaling
156  (including shearing and mirroring).
157 
158  The relative transform can be manipulated with these methods:
159  - SetTransform()
160  - PushTransform()
161  - PopTransform()
162  - Transform()
163 
164 
165  \par double buffering
166 
167  A derived drawing context can be buffered or not. But this class is prepared as a
168  buffered drawing context, so it assumes in certain member fucntions that one is drawing
169  to a buffer. A drawing context which does not use a buffer needs to implement those
170  pur virtual members and give assert.
171 
172  \ingroup drawer docview style
173 
174  \sa a2dDcDrawer, a2dMemDcDrawer, a2dAggDrawer
175 
176 */
177 class A2DARTBASEDLLEXP a2dDrawer2D: public wxObject
178 {
179 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
180  a2dInitCurrentSmartPointerOwner m_initCurrentSmartPointerOwner;
181 #endif
182 
183 public:
184 
185  //!constructor
186  /*!
187  \remark
188  Do not forget to call SetDocument() if used standalone
189  (in a a2dDocumentCommandProcessor setting this is taken care of).
190  */
191  a2dDrawer2D( int width = 0, int height = 0 );
192 
193  //!constructor
194  /*!
195  \remark
196  Do not forget to call SetDocument() if used standalone
197  (in a a2dDocumentCommandProcessor setting this is taken care of)
198  */
199  a2dDrawer2D( const wxSize& size );
200 
201  //!copy constructor
202  a2dDrawer2D( const a2dDrawer2D& other );
203 
204  //!destructor
205  virtual ~a2dDrawer2D();
206 
207  //! the display
208  void SetDisplay( wxWindow* window ) { m_display = window; }
209 
210  //!set at what size to stop drawing
211  inline void SetPrimitiveThreshold( wxUint16 pixels, bool asrect = true ) { m_drawingthreshold = pixels; m_asrectangle = asrect; }
212 
213  //!get drawing threshold \sa SetDrawingThreshold
214  inline wxUint16 GetPrimitiveThreshold() const { return m_drawingthreshold; }
215 
216  //! underneath the threshold draw a rectangle instead of the real object.
217  inline bool GetThresholdDrawRectangle() const { return m_asrectangle; }
218 
219  //!set threshold at which polygon is drawn filled or only outline
220  inline void SetPolygonFillThreshold( wxUint16 pixels ) { m_polygonFillThreshold = pixels; }
221 
222  //!get threshold at which polygon is drawn filled or only outline
223  inline wxUint16 GetPolygonFillThreshold() const { return m_polygonFillThreshold; }
224 
225  //!get the DC that is used for rendering
226  virtual wxDC* GetRenderDC() const { return NULL; }
227 
228  //!get the DC that is used for rendering
229  virtual wxDC* GetDeviceDC() const { return NULL; }
230 
231  //! Set the display aberration of curved shapes
232  /*!
233  The drawing of curved shapes will not deviate more than this from the ideal curve.
234  \remark the smaller the number the longer the drawing takes.
235 
236  \param aber maximum deviation in device coordinates
237  */
238  void SetDisplayAberration( double aber ) { m_displayaberration = aber; }
239 
240  //! Returns the display aberration of curved shapes
241  /*!,
242  The drawing of curved shapes will not deviate more than this from the ideal curve.
243  */
244  double GetDisplayAberration() const { return m_displayaberration; }
245 
246  //! Return the buffer as a bitmap
247  virtual wxBitmap GetBuffer() const = 0;
248 
249  //!Change the buffer size
250  /*!
251  \remark
252  SetMappingDeviceRect() is NOT reset.
253  */
254  virtual void SetBufferSize( int w, int h ) = 0;
255 
256  virtual void CopyIntoBuffer( const wxBitmap& bitm ) {};
257 
258  //! blit whole buffer to device
259  void BlitBuffer();
260 
261  //! blit given rect contents within buffer to device
262  void BlitBuffer( int x, int y, int width, int height, int xbuf = 0, int ybuf = 0 );
263 
264  //! blit given rect contents within buffer to device
265  virtual void BlitBuffer( wxRect rect, const wxPoint& bufferpos = wxPoint( 0, 0 ) ) = 0;
266 
267  //! used for blitting to a wxDC.
268  virtual void BlitBuffer( wxDC* dc, wxRect rect, const wxPoint& bufferpos = wxPoint( 0, 0 ) ) = 0;
269 
270  //! quick scroll over small distance
271  virtual void ShiftBuffer( int WXUNUSED( dxy ), bool WXUNUSED( yshift ) ) {};
272 
273  //!A way to get parts form the buffer that is drawn into.
274  /*!
275  Used for freetype text at the moment since it mixes with the colors already there.
276  */
277  virtual wxBitmap GetSubBitmap( wxRect sub_rect ) const = 0;
278 
279  //!get y axis orientation
280  inline bool GetYaxis() const { return m_yaxis; }
281 
282  //!set if the Yaxis goes up or down
283  virtual void SetYaxis( bool up );
284 
285  //! to change the default mapping (to the complete buffer).
286  /*!
287  By default the mapping from world coordinates to device coordinates is
288  based on the size of the double buffer.
289  For application where the a2dDrawer2D is used as a double buffered device context within
290  a a2dCanvas window, it is better to oversize the buffer of the a2dDrawer2D.
291  This prevents continuously reallocating/redrawing of the buffer after even the smallest resize.
292  To still keep the mapping to what is visible on the window client window, one can
293  independently from the buffer size set the mapping rectangle.
294  Even a rectangle bigger then the buffer rectangle is possible, but of course the a2dDrawer2D
295  will never draw outside the buffer eventually.
296 
297  \param remap if true change mapping to
298  */
299  void SetMappingDeviceRect( int mapx, int mapy, int mapWidth, int mapHeight, bool remap = false );
300 
301  //!Give the virtual size to be displayed, the mapping matrix will be calculated.
302  /*!
303  The current buffer size is used to calculate how to at least display all of the area given.
304 
305  \see SetMappingDeviceRect to map to a different device/buffer rectangle.
306 
307  \remark do not use during start up since window/buffer size is not well defined in that case resulting in
308 
309  \remark bad settings for the mapping.
310 
311  \param vx1: minimum x coordinate of display area
312  \param vy1: minimum y coordinate of display area
313  \param width: width of displayed area in world coordinates
314  \param height: height of displayed area in world coordinates
315  */
316  virtual void SetMappingWidthHeight( double vx1, double vy1, double width, double height );
317 
318  //!Give the virtual size to be displayed, the mapping matrix will be calculated.
319  /*!
320  The current buffer size is used to calculate how to at least display all of the area given.
321 
322  \remark do not use during start up since window/buffer size is not well defined in that case resulting in
323 
324  \remark bad settings for the mapping.
325 
326  \see SetMappingDeviceRect to map to a different device/buffer rectangle.
327 
328  \param box a boundingbox to set mapping
329  */
330  void SetMappingWidthHeight( const a2dBoundingBox& box );
331 
332  //! Give the virtual size to be displayed, the mapping matrix will be calculated.
333  /*!
334  To display all of a drawing, set this here to the boundingbox of the root object
335  of the canvas.
336 
337  So vx1 and vx2 to the minimum x and y of the boundingbox.
338  Calculate xpp and ypp in such a manner that it will show the whole drawing.
339 
340  The buffer size or SetMappingDeviceRect() is used when setting the mapping with this function.
341 
342  \remark when a user-to-world matrix SetTransform() is set, the m_usertodevice is recalculated to take
343  the new mapping matrix and the already set user-to-world matrix into account.
344 
345  \param vx1: minimum x coordinate of display area
346  \param vy1: minimum y coordinate of display area
347  \param xpp: Number of user units per pixel in x
348  \param ypp: Number of user units per pixel in y
349  */
350  void SetMappingUpp( double vx1, double vy1, double xpp, double ypp );
351 
352  //!return xpp Number of user units per pixel in x
353  double GetUppX() const { return m_xpp; }
354 
355  //!return ypp Number of user units per pixel in y
356  double GetUppY() const { return m_ypp; }
357 
358  //!Set Minimal X of the visible part in world coordinates
359  void SetMinX( double x );
360 
361  //!Set Minimal Y of the visible part in world coordinates
362  void SetMinY( double y );
363 
364  //!set world units per pixel in X
365  void SetUppX( double x );
366 
367  //!set world units per pixel in Y
368  void SetUppY( double y );
369 
370  //!if the virtual area has been set already return true else false.
371  /*!
372  Use this during initialization of an application.
373  */
374  bool GetVirtualAreaSet() const { return m_virtualarea_set;}
375 
376  //! when called a mapping change will result not result in a refresh of the m_display.
377  /*!
378  m_refreshDisplay is incremented, and EndRefreshDisplayDisable() does decrement it.
379  When m_refreshDisplay > 0 no refresh is done when changing mapping.
380 
381  Used to prevent looping and unneeded refresh when changing mapping several times within a function.
382  */
383  void StartRefreshDisplayDisable() { m_refreshDisplay++; }
384 
385  //! see StartRefreshDisplayDisable()
386  void EndRefreshDisplayDisable();
387 
388  //! see StartRefreshDisplayDisable()
389  bool GetRefreshDisplayDisable() const { return m_refreshDisplay > 0; }
390 
391  //! get buffer/device width
392  inline int GetWidth() const { return m_width; }
393 
394  //! get buffer/device height
395  inline int GetHeight() const { return m_height; }
396 
397  //! get mapping to device width
398  inline int GetMapWidth() const { return m_mapWidth; }
399 
400  //! get mapping to device height
401  inline int GetMapHeight() const { return m_mapHeight; }
402 
403  //! X mapping position in device coordinates
404  inline int GetMapX() const { return m_mapX; }
405 
406  //! Y mapping position in device coordinates
407  inline int GetMapY() const { return m_mapY; }
408 
409  //!get Minimal X of the visible part in world coordinates
410  double GetVisibleMinX() const;
411 
412  //!get Minimal X of the visible part in world coordinates
413  double GetVisibleMinY() const;
414 
415  //!get Maximum X of the visible part in world coordinates
416  virtual double GetVisibleMaxX() const;
417 
418  //!get Maximum Y of the visible part in world coordinates
419  virtual double GetVisibleMaxY() const;
420 
421  //!get Width of visible part in world coordinates
422  virtual double GetVisibleWidth() const;
423 
424  //!get Height of visible part in world coordinates
425  virtual double GetVisibleHeight() const;
426 
427  //!get visible area as a boundingbox in world coordinates
428  a2dBoundingBox GetVisibleBbox() const;
429 
430  //!convert the bounding box in world coordinates to device coordinates and return that rectangle.
431  wxRect ToDevice( const a2dBoundingBox& bbox );
432 
433  //!convert the rect in device coordinates to a bounding box in world coordinates and return that boundingbox.
434  a2dBoundingBox ToWorld( const wxRect& rect );
435 
436  //! convert x from device to world coordinates
437  inline double DeviceToWorldX( double x ) const { return ( x - m_worldtodevice.GetValue( 2, 0 ) ) / m_worldtodevice.GetValue( 0, 0 ); }
438  //! convert y from device to world coordinates
439  inline double DeviceToWorldY( double y ) const { return ( y - m_worldtodevice.GetValue( 2, 1 ) ) / m_worldtodevice.GetValue( 1, 1 ); }
440  //! convert x relative from device to world coordinates
441  /*!
442  Use this to convert a length of a line for instance
443  */
444  inline double DeviceToWorldXRel( double x ) const { return x / m_worldtodevice.GetValue( 0, 0 ); }
445  //! convert y relative from device to world coordinates
446  /*!
447  Use this to convert a length of a line for instance
448  */
449  inline double DeviceToWorldYRel( double y ) const { return y / m_worldtodevice.GetValue( 1, 1 ); }
450 
451 
452  //! convert x from world to device coordinates
453  inline int WorldToDeviceX( double x ) const { return ( int ) floor( m_worldtodevice.GetValue( 0, 0 ) * x + m_worldtodevice.GetValue( 2, 0 ) + 0.5 ); }
454  //! convert y from world to device coordinates
455  inline int WorldToDeviceY( double y ) const { return ( int ) floor( m_worldtodevice.GetValue( 1, 1 ) * y + m_worldtodevice.GetValue( 2, 1 ) + 0.5 ); }
456  //! convert x relative from world to device coordinates
457  /*!
458  Use this to convert a length of a line for instance
459  */
460  inline int WorldToDeviceXRel( double x ) const {return ( int ) floor( m_worldtodevice.GetValue( 0, 0 ) * x + 0.5 ); }
461  //! convert y relative from world to device coordinates
462  /*!
463  Use this to convert a length of a line for instance
464  */
465  inline int WorldToDeviceYRel( double y ) const {return ( int ) floor( m_worldtodevice.GetValue( 1, 1 ) * y + 0.5 ); }
466  //! convert x relative from world to device coordinates (result not rounded to integer)
467  /*!
468  Use this to convert a length of a line for instance
469  */
470  inline double WorldToDeviceXRelNoRnd( double x ) const {return m_worldtodevice.GetValue( 0, 0 ) * x; }
471  //! convert y relative from world to device coordinates (result not rounded to integer)
472  /*!
473  Use this to convert a length of a line for instance
474  */
475  inline double WorldToDeviceYRelNoRnd( double y ) const {return m_worldtodevice.GetValue( 1, 1 ) * y; }
476 
477  //!get the world-to-device (aka mapping) matrix
478  const a2dAffineMatrix& GetMappingMatrix() { return m_worldtodevice; }
479 
480  //! set world to device matrix ( better use SetMappingWidthHeight() etc. )
481  //! Side ffect m_usertodevice is modified to m_worldtodevice * m_usertoworld
482  void SetMappingMatrix( const a2dAffineMatrix& mapping );
483 
484  //!set user-to-world transform matrix.
485  /*!
486  Sets the current user-to-world transform matrix at the top of the
487  transform stack.
488  The user-to-world matrix transforms all drawing primitives from user
489  coordinates to world coordinates.
490 
491  \param userToWorld The matrix for transforming from user to world.
492  */
493  virtual void SetTransform( const a2dAffineMatrix& userToWorld );
494 
495  //!get the user-to-world transform matrix.
496  /*!
497  The user-to-world matrix transforms all drawing primitives from user
498  coordinates to world coordinates.
499  */
500  inline const a2dAffineMatrix& GetTransform() const { return m_usertoworld; }
501 
502  //! get matrix which transforms directly from user coordinates to device
503  inline const a2dAffineMatrix& GetUserToDeviceTransform() const { return m_usertodevice; }
504 
505  //! Save the current user-to-world transform on the affine stack.
506  virtual void PushTransform();
507 
508  //! push no transform, to draw directly in device coordinates
509  virtual void PushIdentityTransform();
510 
511  //! Save the current transform on the affine stack and then multiply it by the given affine.
512  /*! This is a convenience function that is equivalent to calling
513  \code
514  PushTransform(); Transform(affine);
515  \endcode
516  */
517  virtual void PushTransform( const a2dAffineMatrix& affine );
518 
519  //! Recall the previously saved user-to-world transform off the matrix stack.
520  virtual void PopTransform( void );
521 
522  //!Set the detail level for spline drawing
523  /*!
524  \param aber Accuracy in world coordinates
525  */
526  void SetSplineAberration( double aber );
527 
528  //! set a pre-defined style reseting cashed values.
529  /*! setting a style ( stroke fill ) for a a2dDrawer2D,
530  takes into account the style that is currently set for it.
531  If the style being set is equal to the current style,
532  internal nothing is done for the underlying device.
533  Of course this only works if everyone obeys the rules.
534  Routines not using a2dDrawer2D as an entry to device, may fool
535  this trick. Therefore to be sure to start with a proper a2dDrawer2D,
536  first call this function.
537  It will make the a2dDrawer2D style the actual style used on the device.
538  */
539  virtual void ResetStyle();
540 
541  //!Used to set the current stroke.
542  /*!The a2dStroke objects are reference counted, so passing a stroke pointer
543  * allocated with 'new' to this function will not result in a leak.
544  */
545  void SetDrawerStroke( const a2dStroke& stroke );
546 
547  //!get the current stroke
548  a2dStroke GetDrawerStroke() const { return m_currentstroke; }
549 
550  //!Used to set the current fill
551  /*!The a2dFill objects are reference counted, so passing a fill pointer
552  * allocated with 'new' to this function will not result in a leak.
553  */
554  void SetDrawerFill( const a2dFill& fill );
555 
556  //!get the current fill
557  a2dFill GetDrawerFill() const { return m_currentfill; }
558 
559  //!set font to use for drawing text
560  void SetFont( const a2dFont& font );
561 
562  //!get font used for drawing text
563  a2dFont GetFont() const { return m_currentfont; }
564 
565  //! Use a fixed device height for drawing text.
566  void SetNormalizedFont( bool forceNormalizedFont ) { m_forceNormalizedFont = forceNormalizedFont; }
567 
568  //! Get setting for a fixed device height for drawing text.
569  bool GetNormalizedFont() { return m_forceNormalizedFont; }
570 
571  //!set device text size at which textdrawing will switch to device specific text drawing.
572  //! Small text will only be drawn correctly, when fitting text to pixels.
573  //! For bigger text it is no problem, so at a certain size one switches to device specific drawing
574  //! of text.
575  //! only works if m_forceNormalizedFont = false;
576  void SetSmallTextThreshold( wxUint16 pixels ) { m_smallTextThreshold = pixels; }
577 
578  //! See SetSmallTextThreshold
579  wxUint16 GetSmallTextThreshold() const { return m_smallTextThreshold; }
580 
581  //!Draw vector path in world coordinates
582  virtual void DrawVpath( const a2dVpath* path );
583 
584  //! draw a list of polygons ( contour clockwise becomes hole )
585  virtual void DrawPolyPolygon( a2dListOfa2dVertexList polylist, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
586 
587  //!Draw polygon in world coordinates using pointarray
588  virtual void DrawPolygon( a2dVertexArray* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
589 
590  //!Draw polygon in world coordinates using pointlist
591  virtual void DrawPolygon( const a2dVertexList* list, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
592 
593  //!Draw polyline in world coordinates using pointarray
594  virtual void DrawLines( a2dVertexArray* points, bool spline = false );
595 
596  //!Draw polyline in world coordinates using pointlist
597  virtual void DrawLines( const a2dVertexList* list, bool spline = false );
598 
599  //!Draw line in world coordinates
600  virtual void DrawLine( double x1, double y1, double x2, double y2 );
601 
602  //!Draw Arc in world coordinates
603  virtual void DrawArc( double x1, double y1, double x2, double y2, double xc, double yc, bool chord );
604 
605  //!Draw Elliptic Arc in world coordinates
606  virtual void DrawEllipticArc( double xc, double yc, double width, double height , double sa, double ea, bool chord );
607 
608  //!Draw RoundedRectangle in world coordinates
609  virtual void DrawRoundedRectangle( double x, double y, double width, double height, double radius, bool pixelsize = false );
610 
611  //!Draw CenterRoundedRectangle in world coordinates
612  /*! Draws a rounded rectangle centered at the point (xc,yc) in world
613  coordinates.
614  */
615  virtual void DrawCenterRoundedRectangle( double xc, double yc, double width, double height, double radius, bool pixelsize = false );
616 
617  //!Draw Circle in world coordinates
618  /*! \remark circle gets rotates and scaled etc. in x and y when required.*/
619  virtual void DrawCircle( double x, double y, double radius );
620 
621  //!Draw Ellipse in world coordinates
622  /*! \remark ellipse gets rotates and scaled etc. in x and y when required.*/
623  virtual void DrawEllipse( double x, double y, double width, double height );
624 
625  //! Draw wxImage in world coordinates
626  /*! Draw the wxImage to the screen in such a manner that the
627  image is mapped into the rectangle defined by
628  points (x-width/2,y-width/2) and (x+width/2,y+height/2) in
629  world coordinates, with the center of the image at (x,y).
630 
631  \param image image to draw
632  \param x world x position of center of image
633  \param y world y position of center of image
634  \param width width in world coordinates to map width of image to
635  \param height height in world coordinates to map height of image to
636  */
637  virtual void DrawImage( const wxImage& image, double x, double y, double width, double height, wxUint8 Opacity = 255 ) = 0;
638 
639  virtual void DrawImage( const a2dImageRGBA& image, double x, double y, double width, double height, wxUint8 Opacity = 255 ) = 0;
640 
641  //! Draw wxImage in world coordinates
642  /*! Equivalent to calling
643  DrawImage(image, x,y, image.GetWidth(),image.GetHeight())
644 
645  \param image image to draw
646  \param x world x position of center of image
647  \param y world y position of center of image
648  */
649  void DrawImage( const wxImage& image, double x = 0, double y = 0, wxUint8 Opacity = 255 )
650  { DrawImage( image, x, y, image.GetWidth(), image.GetHeight(), Opacity ); }
651 
652  //! draw a single point
653  virtual void DrawPoint( double xc, double yc ) = 0;
654 
655  //! If true use real scale else different scale by x and y
656  void SetRealScale( bool realScale ) { m_realScale = realScale;}
657 
658  //! Draw text in user coordinates.
659  /*! Draws text at the given position in user coordinates.
660 
661  Adding rotation etc. to the user transform matrix makes it possible
662  to draw rotated text.
663  \param text The text which should be drawn.
664  \param x,y The position to draw at.
665  \param alignment Use this to align the text (eg. wxMINX | wxMINY). See also a2dFontAlignment.
666  \param Background with or without background rectangle
667  \sa SetFont()
668  */
669  virtual void DrawText( const wxString& text, double x, double y, int alignment = wxMINX | wxMINY, bool Background = true );
670 
671  //! text drawn in device coordinates
672  virtual void DeviceDrawAnnotation( const wxString& WXUNUSED( text ), wxCoord WXUNUSED( x ), wxCoord WXUNUSED( y ), const wxFont& WXUNUSED( font ) ) {}
673 
674  //! set drawstyle to use for drawing,
675  /*!
676  The draw style is used for drawing in a certain fashion.
677 
678  The current fill, stroke are not changed while setting a diffrent drawstyle.
679  Therefore first set the required fill and stroke.
680  Setting a2dFIX_STYLE or a2dFIX_STYLE_INVERT can only be reset using ResetFixedStyle().
681  Still it can be temprarely overruled with OverRuleFixedStyle() to be restored with ReStoreFixedStyle().
682 
683  New settings for fill, stroke may or may not have effect in how is drawn, but do change the current fill are stroke,
684  independent of the drawing style.
685  This depends if it makes sense to have a different style when the drawstyle is in action.
686  When drawstyle is set, the last set fill, stroke are made active when needed.
687 
688  \param drawstyle one of the draw styles
689  */
690  void SetDrawStyle( a2dDrawStyle drawstyle );
691 
692  //!get drawstyle used for drawing.
693  a2dDrawStyle GetDrawStyle() const {return m_drawstyle;}
694 
695  //! to modify drawing feature when used as context for printing
696  void SetPrintMode( bool onOff ) { m_printingMode = onOff; }
697 
698  //! id style is FIXED, saves current style and sets style to a2dFILLED
699  void OverRuleFixedStyle();
700 
701  //! only way to reset style after SetDrawStyle( a2dFIXED*** );
702  void ResetFixedStyle();
703 
704  //! when fixed drawing style is set, it can be overruled.
705  /*!
706  The last fixed style stroke and fill are restored.
707  */
708  void ReStoreFixedStyle();
709 
710 
711  //! when set, all drawing functions return immediately.
712  /*!
713  This can be used to render only nested parts of documents. The parent part are drawn from their
714  a2dCanvasObjects, but in reality nothing will be drawn until drawing is enabled for the deeper nested objects.
715  */
716  void SetDisableDrawing( bool disableDrawing ) { m_disableDrawing = disableDrawing; }
717 
718  //! see SetDisableDrawing()
719  bool GetDisableDrawing() { return m_disableDrawing; }
720 
721  /*
722  // clipping region
723  */
724 
725  //!set clipping region from polygon to which everything drawn will be clipped.
726  virtual void SetClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ) = 0;
727 
728  //!extend clipping region with a polygon to which everything drawn will be clipped.
729  virtual void ExtendClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE, a2dBooleanClip clipoperation = a2dCLIP_AND ) = 0;
730 
731  //! push on stack the current clipping region and extend clipping region
732  /*!
733  The clipping region will be extended with a polygon to which everything drawn will be clipped.
734  */
735  virtual void ExtendAndPushClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE, a2dBooleanClip clipoperation = a2dCLIP_AND ) = 0;
736 
737  //!pop a previously pushed clipping region
738  virtual void PopClippingRegion() = 0;
739 
740  //!set clipping region using x y values in device coordinates
741  virtual void SetClippingRegionDev( wxCoord minx, wxCoord miny, wxCoord maxx, wxCoord maxy ) = 0;
742 
743  //!set clipping region using x y values in world coordinates
744  virtual void SetClippingRegion( double minx, double miny, double maxx, double maxy ) = 0;
745 
746  //!set clipping region off
747  virtual void DestroyClippingRegion() = 0;
748 
749  //!what is the current clipping region in world coordinates
750  void GetClippingBox( double& x, double& y, double& w, double& h ) const;
751 
752  //!what is the current clipping region in world coordinates
753  a2dBoundingBox& GetClippingBox() { return m_clipboxworld; }
754 
755  //!what is the current clipping region in world coordinates
756  void GetClippingMinMax( double& xmin, double& ymin, double& xmax, double& ymax ) const;
757 
758  //!what is the current clipping region in device coordinates
759  wxRect& GetClippingBoxDev() { return m_clipboxdev; }
760 
761  //!what is the current clipping region in device coordinates
762  void GetClippingBoxDev( int& x, int& y, int& w, int& h ) const;
763 
764  //! Initialize a drawer
765  void Init();
766 
767  //!start to draw on this context (used to initialize a specific drawer)
768  virtual void BeginDraw() = 0;
769 
770  //!end drawing on this context (used to reset a specific drawer)
771  virtual void EndDraw() = 0;
772 
773  //! when enabling m_useOpacityFactor, this is how transparent
774  /*!
775  \param OpacityFactor Real opacity is set opacity * m_OpacityFactor/255
776  */
777  void SetOpacityFactor( wxUint8 OpacityFactor );
778 
779  //! see SetOpacityFactor()
780  wxUint8 GetOpacityFactor() { return m_OpacityFactor; }
781 
782  //! does a derived drawer have alpha support or not
783  virtual bool HasAlpha() { return false; }
784 
785 public:
786 
787  //! Wrapper for DrawCharStroke
788  /*!
789  ISO C++ seems(?) to forbid directly calling the address of virtual member functions.
790  Calling &a2dDrawer2D::DrawCharStroke refers to the actual function in a2dDrawer2D and
791  does not refer to the virtual function.
792  Calling &(this->DrawCharStroke) should refer to the virtual function and is accepted by
793  some compilers (MSVC, gcc <3.3), but according to gcc 3.4 this is not allowed by ISO C++.
794  Therefore the virtual function is called through this intermediate function
795  */
796  void DrawCharStrokeCb( wxChar c ) { DrawCharStroke( c ); }
797 
798  //! Wrapper for DrawCharFreetype
799  /*! \sa DrawCharStrokeCb */
800  void DrawCharFreetypeCb( wxChar c ) { DrawCharFreetype( c ); }
801 
802  //! Wrapper for DrawCharDc
803  /*! \sa DrawCharStrokeCb */
804  void DrawCharDcCb( wxChar c ) { DrawCharDc( c ); }
805 
806 protected:
807 
808  //! sync with actual API graphical context
809  /*!
810  The stroke is set to the API that is doing the actual drawing.
811  Depending on the API the m_drawStyle should be taken into account, if it does not already
812  yield for any stroke set by SetDrawStyle()
813  */
814  virtual void SetActiveStroke( const a2dStroke& stroke );
815 
816  //! sync with actual API graphical context
817  /*!
818  The fill is set to the API that is doing the actual drawing.
819  Depending on the API the m_drawStyle should be taken into account, if it does not already
820  yield for any stroke set by SetDrawStyle()
821  */
822  virtual void SetActiveFill( const a2dFill& fill );
823 
824  virtual void DoSetDrawStyle( a2dDrawStyle drawstyle ) = 0;
825 
826  //! per drawer implementation
827  virtual void DoSetActiveStroke() = 0;
828 
829  //! per drawer implementation
830  virtual void DoSetActiveFill() = 0;
831 
832  virtual void DoSetActiveFont( const a2dFont& font ) {};
833 
834  //! get active stroke as wxPen
835  wxPen ConvertActiveToPen();
836 
837  //! get active fill as wxBrush
838  wxBrush ConvertActiveToBrush();
839 
840 #if wxART2D_USE_GRAPHICS_CONTEXT
841  wxGraphicsBrush ConvertActiveToGraphicsBrush( wxGraphicsContext* context );
842  wxGraphicsPen ConvertActiveToGraphicsPen( wxGraphicsContext* context );
843 #endif ///wxART2D_USE_GRAPHICS_CONTEXT
844 
845  //! return true if the drawstyle in combination with the active stroke and fill,
846  //! does not require filling
847  inline bool IsStrokeOnly()
848  {
849  return ( m_drawstyle == a2dWIREFRAME ||
850  m_drawstyle == a2dWIREFRAME_ZERO_WIDTH ||
851  m_drawstyle == a2dWIREFRAME_INVERT ||
852  m_drawstyle == a2dWIREFRAME_INVERT_ZERO_WIDTH ||
853  m_activefill.IsNoFill() ||
854  m_activefill.GetStyle() == a2dFILL_TRANSPARENT
855  );
856  }
857 
858  //! return true if the the drawstyle in combination with the active stroke,
859  //! does not require stroking
860  inline bool IsStroked()
861  {
862  return !m_activestroke.IsNoStroke() && !m_activestroke.GetStyle() == a2dSTROKE_TRANSPARENT;
863  }
864 
865 
866  //! convert vertex array containing line and arc segments in user coordinates to device coordinate lines.
867  int ToDeviceLines( a2dVertexArray* points, a2dBoundingBox& devbbox, bool& smallPoly, bool replaceByRectangle = false );
868 
869  //! convert vertex list containing line and arc segments in user coordinates to device coordinate lines.
870  int ToDeviceLines( const a2dVertexList* list, a2dBoundingBox& devbbox, bool& smallPoly, bool replaceByRectangle = false );
871 
872  //!Given the rectangle in world coordinate to be displayed, update the mappingmatrix.
873  /*!
874  To display all of a drawing, set this to the bounding box of the root object
875  of the canvas.
876 
877  So vx1 and vx2 to the minimum x and y of the bounding box.
878  Calculate xpp and ypp in such a manner that it will show the whole drawing.
879 
880  The buffer size or SetMappingDeviceRect() are not used when setting the mapping with this function.
881  In fact all other mapping functions in a2dDrawer2D use this function to set the mapping for the a2dDrawer2D in the end.
882 
883  \remark when a relative world matrix SetTransform() is set, the m_usertodevice
884  is recalculated to take the new mapping matrix and the already set
885  user matrix into account.
886 
887  \param x: map to device x (non zero if canvas window is smaller than drawer)
888  \param y: map to device y (non zero if canvas window is smaller than drawer)
889  \param wx: map to device of this size in x, normally same as width of buffer bitmap
890  \param wy: map to device of this size in y, normally same as height of buffer bitmap
891  \param vx1: minimum x coordinate of display area
892  \param vy1: minimum y coordinate of display area
893  \param xpp: Number of world units per pixel in x
894  \param ypp: Number of world units per pixel in y
895  */
896  void SetMappingUpp( double x, double y, double wx, double wy, double vx1, double vy1, double xpp, double ypp );
897 
898  //! converts internal device points array to spline. Returns new number of points.
899  unsigned int ConvertSplinedPolygon2( unsigned int n );
900 
901  //! converts internal device points array to spline. Returns new number of points.
902  unsigned int ConvertSplinedPolyline2( unsigned int n );
903 
904  //! clip lines
905  bool Clipping( double& x1, double& y1, double& x2, double& y2 );
906 
907  //! clip code of a point
908  int GetClipCode( double x, double y );
909 
910  //!Used for filling with Gradient fill style.
911  void FillPolygon( int n, wxRealPoint points[] );
912 
913  //!Used for filling with Gradient fill style.
914  bool MoveUp( int n, wxRealPoint points[] , double horline, int& index, int direction );
915 
916  //!Used for filling with Gradient fill style.
917  void DetectCriticalPoints( int n, wxRealPoint points[] );
918 
919  // Core text drawing function.
920  /*! This function will draw each character separately using the function drawchar.
921  It will also advance and kern the characters, by adjusting the affine matrices.
922  The character will also be checked against the clipbox.
923  This function assumes (0,0) is the lowerleft bbox corner.
924  This function will not draw the background fill.
925  \param text The text to be drawn.
926  \param x x-Position of the text.
927  \param y y-Position of the text.
928  \param drawchar A function which will draw a given character.
929  */
930  void DrawTextGeneric( const wxString& text, double x, double y, void ( a2dDrawer2D::*drawchar )( wxChar ) );
931 
932  //! Draw a cross instead of a character.
933  virtual void DrawCharUnknown( wxChar c );
934 
935  //! Draw a cross, indicating an unsupported font type for this drawer.
936  /*! Draws text at the given position in user coordinates.
937  Adding rotation etc. to that matrix makes it possible to draw rotated text.
938  \param text draw unknown text
939  \param x x position
940  \param y y position
941  \param words If false, draw a boxed cross for the whole line.
942  If true, draw a piece of line for each word.
943  */
944  virtual void DrawTextUnknown( const wxString& text, double x, double y, bool words = false );
945 
946  //! Draw a stroke character
947  /*! This is an internal function, used by DrawTextStroke.
948  This function assumes that the affine matrix has been set up by the calling function
949  in such a way, that the (0,0) coordinate will match with the lowerleft bbox corner
950  of the character. Also mirroring should be performed by the calling function.
951  */
952  virtual void DrawCharStroke( wxChar c );
953 
954  //! Draw text in user coordinates, based on a stroke font.
955  /* The text will be drawn with (0,0) being the lowerleft bbox corner.
956  The background fill and alignment positioning are handled by DrawText.
957  */
958  virtual void DrawTextStroke( const wxString& text, double x, double y );
959 
960  //! Draw a freetype character
961  /*! This is an internal function, used by DrawTextFreetype
962  This function assumes that the affine matrix has been set up by the calling function
963  in such a way, that the (0,0) coordinate will match with the lowerleft bbox corner
964  of the character. Also mirroring should be performed by the calling function.
965  */
966  virtual void DrawCharFreetype( wxChar c ) { DrawCharUnknown( c ); }
967 
968  //! Draw text in world coordinates, based on a freetype font .
969  /* The text will be drawn with (0,0) being the lowerleft bbox corner.
970  The background fill and alignment positioning are handled by DrawText.
971  */
972  virtual void DrawTextFreetype( const wxString& text, double x, double y )
973  { DrawTextGeneric( text, x, y, &a2dDrawer2D::DrawCharFreetypeCb ); }
974 
975  //! Draw a dc character
976  /*! This is an internal function, used by DrawTextDc
977  This function assumes that the affine matrix has been set up by the calling function
978  in such a way, that the (0,0) coordinate will match with the lowerleft bbox corner
979  of the character. Also mirroring should be performed by the calling function.
980  */
981  virtual void DrawCharDc( wxChar c ) { DrawCharUnknown( c ); }
982 
983  //! Draw text in user coordinates, based on a dc font .
984  /* The text will be drawn with (0,0) being the lowerleft bbox corner.
985  The background fill and alignment positioning are handled by DrawText.
986  */
987  virtual void DrawTextDc( const wxString& text, double x, double y )
988  { DrawTextGeneric( text, x, y, &a2dDrawer2D::DrawCharDcCb ); }
989 
990  //! Convert double points to integer coords in the point cache and return pointer.
991  wxPoint* _convertToIntPointCache( int n, wxRealPoint* pts );
992 
993  //!buffer updating activity possible or not
994  bool m_frozen;
995 
996  //!enable/ disable mouse events handling by canvas
998 
999  //!used while rendering
1001 
1002  //!used while rendering
1004 
1005  //!used while rendering
1007 
1008  //!used while rendering
1010 
1011  //!current font set
1013 
1014  //!drawstyle (like invert mode)
1016 
1017  //! used to restore an overruled fix style
1019 
1020  //! used to restore an overruled fix style
1022 
1023  //! used to restore an overruled fix style
1025 
1026  //! up or down
1027  bool m_yaxis;
1028 
1029  //! virtual coordinates box its miminum X
1030  double m_virt_minX;
1031 
1032  //! virtual coordinates box its miminum Y
1033  double m_virt_minY;
1034 
1035  //!user units per pixel in x
1036  double m_xpp;
1037 
1038  //!user units per pixel in y
1039  double m_ypp;
1040 
1041  //! keep track of this
1043 
1044  //! up or down
1046 
1047  wxUint16 m_smallTextThreshold;
1048 
1049  //! When display refresh is on hold, this triggers a delayed zoom signal, when released.
1051 
1052  //! used internally in some methods to avoid constructor, new, ...
1054 
1055 private:
1056 
1057  void ColourXYLinear( int x1, int x2, int y );
1058  void ColourXYRadial( int x1, int x2, int y );
1059 
1060  //! gradient start stop
1061  double m_dx1, m_dy1, m_dx2, m_dy2, m_radiusd, m_length, m_max_x, m_min_x, m_max_y, m_min_y;
1062  a2dLine m_line;
1063 
1064 protected:
1065 
1066  //! draw an internal polygon in device coordinates
1067  virtual void DeviceDrawPolygon( unsigned int n, bool spline , wxPolygonFillMode fillStyle );
1068 
1069  //! draw an internal polyline in device coordinates
1070  virtual void DeviceDrawLines( unsigned int n, bool spline );
1071 
1072  //!draw in pixels
1073  virtual void DeviceDrawLine( double x1, double y1, double x2, double y2 );
1074 
1075  //! Draw a pixel-width, unstroked horizontal line in device (pixel) coordinates
1076  /*! This method is useful for implementing low level fill routines.
1077 
1078  \param x1 x start of line
1079  \param x2 x end of line
1080  \param y1 y of line
1081  \param use_stroke_color If true, then use the current stroke color
1082  If false, then use the current fill color.
1083  */
1084  virtual void DeviceDrawHorizontalLine( int x1, int y1, int x2, bool use_stroke_color );
1085 
1086  //! Draw a pixel-width, unstroked vertical line in device (pixel) coordinates
1087  /*! This method is useful for implementing low level fill routines.
1088 
1089  \param x1 x of line
1090  \param y1 y start of line
1091  \param y2 y end of line
1092  \param use_stroke_color If true, then use the current stroke color
1093  If false, then use the current fill color.
1094  */
1095  virtual void DeviceDrawVerticalLine( int x1, int y1, int y2, bool use_stroke_color );
1096 
1097  //!draw a single, unstroked pixel in device coordinates with the given color
1098  virtual void DeviceDrawPixel( int x1, int y1, unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255 );
1099 
1100  //! active stroke alpha
1102  //! active stroke alpha
1104  //! active fill alpha
1106  //! active fill alpha
1108 
1109  //! active stroke colours
1110  unsigned char m_colour1redStroke;
1111  //! active stroke colours
1112  unsigned char m_colour1greenStroke;
1113  //! active stroke colours
1114  unsigned char m_colour1blueStroke;
1115 
1116  //! active fill colours
1117  unsigned char m_colour1redFill;
1118  //! active fill colours
1119  unsigned char m_colour1greenFill;
1120  //! active fill colours
1121  unsigned char m_colour1blueFill;
1122 
1123  //! active fill colours
1124  unsigned char m_colour2redFill;
1125  //! active fill colours
1126  unsigned char m_colour2greenFill;
1127  //! active fill colours
1128  unsigned char m_colour2blueFill;
1129 
1130 protected:
1131 
1132  //!world to device coordinate mapping
1134 
1135  //!pointer to current user-to-world transform matrix
1137 
1138  //!pointer to current user-to-device transform matrix ( so includes mapping matrix )
1140 
1141  //!is the virtual area set already (used during startup)
1143 
1144  //! see SetRefreshDisplay()
1146 
1147  //!device size width
1148  int m_width;
1149 
1150  //!device size height
1152 
1153  //! X mapping position in device coordinates
1154  int m_mapX;
1155 
1156  //! Y mapping position in device coordinates
1157  int m_mapY;
1158 
1159  //! width for mapping in device coordinates
1161 
1162  //! height for mapping in device coordinates
1164 
1165  //! critical point list for polygon
1166  a2dCriticalPointList m_CRlist;
1167 
1168  //! scanline list of intersections with polygon
1169  a2dAETList m_AETlist;
1170 
1171  //!cached array for containing transformed device coordinates (integer)
1172  std::vector<wxPoint> m_cpointsInt;
1173 
1174  //!cached array for containing transformed device coordinates (double)
1175  std::vector<wxRealPoint> m_cpointsDouble;
1176 
1177  //! accuracy of spline
1179 
1180  //! pushed clipping regions
1181  a2dClipRegionList m_clipregionlist;
1182 
1183  //!accuracy of arc segment calculation etc. in device coordinates
1185 
1186  //! object smaller than this value will not be rendered
1188 
1189  //! polygon smaller than this value will be rendered non filled.
1191 
1192  //! underneath the threshold draw rectangles if true else nothing
1194 
1195  //! current clipping area in world coordinates
1197 
1198  //! current clipping area in device coordinates
1200 
1201  //! counter for BeginDraw EndDraw calls
1203 
1204  //! view its window.
1205  wxWindow* m_display;
1206 
1207  //! all drawing is disabled when this is true
1209 
1210  //! opacity will be the one set, derived by this
1212 
1213  //! Affine transform stack.
1214  /*! The stack actually is a double stack, for both m_relativetransform and m_usertodevice
1215  This prevents some additional affine matrix multiplications.
1216  The stack is implemented as a 'fixed' array, preventing (slow) dynamic memory allocation.
1217  */
1218  std::vector<a2dAffineMatrix> m_affineStack;
1219 
1220  //! If true use real scale else different scale by x and y
1222 
1223  //! can be used to modify drawing features when used as context for printing
1225 
1226  DECLARE_CLASS( a2dDrawer2D )
1227 
1228 public:
1229 
1230  //! id for changed zoom
1231  //! sent from a2dDrawer2D to a2dEventDistributer when zoom has changed.
1232  const static a2dSignal sig_changedZoom;
1233 
1234 };
1235 
1236 //! class draws nothing, still can be used as a drawing context.
1237 /*!
1238  In cases where a drawing context is not really needed to draw, but
1239  one still wants to follow the same matrix multiplication as if drawn,
1240  this class can be used.
1241  It can simplifies the code a lot if there is a dummy drawer instead of non at all,
1242  which would require testing for that.
1243  A dummy drawer can be used in all cases where normally a real drawer is used.
1244 */
1245 class A2DARTBASEDLLEXP a2dBlindDrawer2D : public a2dDrawer2D
1246 {
1247 public:
1248 
1249  //! Drawer having a buffer of w pixel wide and h pixels heigh
1250  a2dBlindDrawer2D( int w = 100, int h = 100 );
1251 
1252  //! Drawer having a buffer of w pixel wide and h pixels height given by size
1253  a2dBlindDrawer2D( const wxSize& size );
1254 
1255  //!set buffer size to w pixel wide and h pixels heigh
1256  /*!
1257  \remark
1258  SetMappingDeviceRect() is NOT reset.
1259  */
1260  void SetBufferSize( int w, int h );
1261 
1262  wxBitmap GetBuffer() const { return wxBitmap( 0, 0 ); }
1263 
1264  //!get part of the buffer given a rect
1265  wxBitmap GetSubBitmap( wxRect sub_rect ) const;
1266 
1267  //!destructor
1268  virtual ~a2dBlindDrawer2D();
1269 
1270  //!copy constructor
1271  a2dBlindDrawer2D( const a2dBlindDrawer2D& other );
1272 
1273  a2dBlindDrawer2D( const a2dDrawer2D& other );
1274 
1275  virtual void BlitBuffer( wxRect rect, const wxPoint& bufferpos = wxPoint( 0, 0 ) );
1276 
1277  virtual void BlitBuffer( wxDC* dc, wxRect rect, const wxPoint& bufferpos = wxPoint( 0, 0 ) );
1278 
1279  void ResetStyle();
1280 
1281  //!start to draw on this context (used to initialize a specific drawer)
1282  virtual void BeginDraw();
1283 
1284  //!end drawing on this context (used to reset a specific drawer)
1285  virtual void EndDraw();
1286 
1287  void SetClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
1288 
1289  virtual void ExtendClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE, a2dBooleanClip clipoperation = a2dCLIP_AND );
1290 
1291  virtual void ExtendAndPushClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE, a2dBooleanClip clipoperation = a2dCLIP_AND );
1292 
1293  void PopClippingRegion();
1294 
1295  void SetClippingRegionDev( wxCoord minx, wxCoord miny, wxCoord width, wxCoord height );
1296  void SetClippingRegion( double minx, double miny, double maxx, double maxy );
1297  void DestroyClippingRegion();
1298 
1299  void DrawPolygon( a2dVertexArray* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
1300 
1301  void DrawPolygon( const a2dVertexList* list, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
1302 
1303  void DrawLines( a2dVertexArray* points, bool spline = false );
1304 
1305  void DrawLines( const a2dVertexList* list, bool spline = false );
1306 
1307  void DrawLine( double x1, double y1, double x2, double y2 );
1308 
1309  void DrawArc( double x1, double y1, double x2, double y2, double xc, double yc, bool chord );
1310 
1311  void DrawEllipticArc( double xc, double yc, double width, double height , double sa, double ea, bool chord );
1312 
1313  void DrawRoundedRectangle( double x, double y, double width, double height, double radius, bool pixelsize = false );
1314 
1315  void DrawCenterRoundedRectangle( double xc, double yc, double width, double height, double radius, bool pixelsize = false );
1316 
1317  void DrawCircle( double x, double y, double radius );
1318 
1319  void DrawEllipse( double x, double y, double width, double height );
1320 
1321  void DrawImage( const wxImage& image, double x, double y, double width, double height, wxUint8 Opacity = 255 );
1322 
1323  void DrawImage( const a2dImageRGBA& image, double x, double y, double width, double height, wxUint8 Opacity = 255 );
1324 
1325  //more speedy then base, by directly converting to device coordinates.
1326  void DrawVpath( const a2dVpath* path );
1327 
1328  void DrawPoint( double xc, double yc );
1329 
1330  void DeviceDrawAnnotation( const wxString& text, wxCoord x, wxCoord y, const wxFont& font );
1331 
1332 protected:
1333 
1334  virtual void DoSetDrawStyle( a2dDrawStyle drawstyle );
1335 
1336  void DoSetActiveStroke();
1337 
1338  void DoSetActiveFill();
1339 
1340 private:
1341 
1342  DECLARE_DYNAMIC_CLASS( a2dBlindDrawer2D )
1343 };
1344 
1345 
1346 #if wxART2D_USE_GRAPHICS_CONTEXT
1347 
1348 //! wxGraphicsContext based drawing context derived from a2dDrawer2D
1349 /*!
1350  Use wxGraphicsContext from wxWidgets to draw.
1351 
1352  \ingroup drawer
1353 */
1354 class a2dGcBaseDrawer : public a2dDrawer2D
1355 {
1356  DECLARE_CLASS( a2dGcBaseDrawer )
1357 
1358 public:
1359 
1360  //! Drawer having a buffer of w pixel wide and h pixels heigh
1361  a2dGcBaseDrawer( int width = 0, int height = 0, wxGraphicsRenderer* render = NULL, wxGraphicsContext* context = NULL );
1362 
1363  //! copy constructor
1364  a2dGcBaseDrawer( const a2dGcBaseDrawer& other );
1365 
1366  a2dGcBaseDrawer( const a2dDrawer2D& other );
1367 
1368  virtual ~a2dGcBaseDrawer();
1369 
1370  virtual void SetTransform( const a2dAffineMatrix& userToWorld );
1371  virtual void PushTransform();
1372  virtual void PushIdentityTransform();
1373  virtual void PushTransform( const a2dAffineMatrix& affine );
1374  virtual void PopTransform( void );
1375 
1376  virtual void BeginDraw();
1377  virtual void EndDraw();
1378 
1379  virtual void BlitBuffer( wxRect rect, const wxPoint& bufferpos );
1380 
1381  virtual void BlitBuffer( wxDC* dc, wxRect rect, const wxPoint& bufferpos = wxPoint( 0, 0 ) ) = 0;
1382 
1383  void ResetStyle();
1384 
1385  void SetClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
1386 
1387  virtual void ExtendClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE, a2dBooleanClip clipoperation = a2dCLIP_AND );
1388 
1389  virtual void ExtendAndPushClippingRegion( a2dVertexList* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE, a2dBooleanClip clipoperation = a2dCLIP_AND );
1390 
1391  void PopClippingRegion();
1392 
1393  void SetClippingRegionDev( wxCoord minx, wxCoord miny, wxCoord width, wxCoord height );
1394 
1395  void SetClippingRegion( double minx, double miny, double maxx, double maxy );
1396 
1397  void DestroyClippingRegion();
1398 
1399  virtual void DrawRoundedRectangle( double x, double y, double width, double height, double radius, bool pixelsize = false );
1400 
1401  virtual void DrawCircle( double x, double y, double radius );
1402 
1403  void DrawPoint( double xc, double yc );
1404 
1405  virtual void DrawEllipse( double x, double y, double width, double height );
1406 
1407  virtual void DrawLines( const a2dVertexList* list, bool spline );
1408 
1409  virtual void DrawPolygon( a2dVertexArray* points, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
1410 
1411  virtual void DrawPolygon( const a2dVertexList* list, bool spline = false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
1412 
1413  virtual void DrawLines( a2dVertexArray* points, bool spline = false );
1414 
1415  void DrawLine( double x1, double y1, double x2, double y2 );
1416 
1417  void DrawImage( const wxImage& image, double x, double y, double width, double height, wxUint8 Opacity = 255 );
1418 
1419  void DrawImage( const a2dImageRGBA& image, double x, double y, double width, double height, wxUint8 Opacity = 255 );
1420 
1421  void DrawText( const wxString& text, double x, double y, int alignment = wxMINX | wxMINY, bool Background = true );
1422 
1423 protected:
1424 
1425  virtual void DoSetDrawStyle( a2dDrawStyle drawstyle );
1426 
1427  void DoSetActiveStroke();
1428 
1429  void DoSetActiveFill();
1430 
1431  void DoSetActiveFont( const a2dFont& font );
1432 
1433  wxRegion m_clip;
1434 
1435  wxGraphicsRenderer* m_render;
1436  wxGraphicsContext* m_context;
1437 };
1438 
1439 
1440 //! wxGraphicsContext based drawing context derived from a2dDrawer2D
1441 /*!
1442  Use wxGraphicsContext from wxWidgets to draw.
1443 
1444  \ingroup drawer
1445 */
1446 class a2dNativeGcDrawer : public a2dGcBaseDrawer
1447 {
1448  DECLARE_DYNAMIC_CLASS( a2dNativeGcDrawer )
1449 
1450 public:
1451 
1452  //! Drawer having a buffer of w pixel wide and h pixels heigh
1453  a2dNativeGcDrawer( int width = 0, int height = 0, wxGraphicsRenderer* render = NULL, wxGraphicsContext* context = NULL );
1454 
1455  //! Drawer having a buffer of w pixel wide and h pixels height given by size
1456  a2dNativeGcDrawer( const wxSize& size );
1457 
1458  //! bitmap is converted to image on which you can draw.
1459  //! Use GetBuffer() to get a bitmap back.
1460  a2dNativeGcDrawer( const wxBitmap& bitmap );
1461 
1462  //!return buffer as a bitmap
1463  wxBitmap GetBuffer() const;
1464 
1465  //! copy constructor
1466  a2dNativeGcDrawer( const a2dNativeGcDrawer& other );
1467 
1468  a2dNativeGcDrawer( const a2dDrawer2D& other );
1469 
1470  //!set buffer size to w pixel wide and h pixels heigh
1471  void SetBufferSize( int w, int h );
1472 
1473  //!get part of the buffer given a rect
1474  wxBitmap GetSubBitmap( wxRect sub_rect ) const;
1475 
1476  void CopyIntoBuffer( const wxBitmap& bitm );
1477 
1478  virtual ~a2dNativeGcDrawer();
1479 
1480  void InitContext();
1481 
1482  void BlitBuffer( wxDC* dc, wxRect rect, const wxPoint& bufferpos = wxPoint( 0, 0 ) );
1483 
1484  void ShiftBuffer( int dxy, bool yshift );
1485 
1486  void DrawPoint( double xc, double yc );
1487 
1488 protected:
1489 
1490  //!the buffer that is used for rendering
1491  wxBitmap m_buffer;
1492 
1493  //!Created at BeginDraw, and destoyed at EndDraw, used to actually draw
1494  wxMemoryDC m_memdc;
1495 };
1496 #endif // wxART2D_USE_GRAPHICS_CONTEXT
1497 
1498 #endif /* __WXDRAWER2D_H__ */
1499 
int WorldToDeviceXRel(double x) const
convert x relative from world to device coordinates
Definition: drawer2d.h:460
a2dAffineMatrix m_usertodevice
pointer to current user-to-device transform matrix ( so includes mapping matrix ) ...
Definition: drawer2d.h:1139
a2dStroke m_activestroke
used while rendering
Definition: drawer2d.h:1006
a2dBoundingBox & GetClippingBox()
what is the current clipping region in world coordinates
Definition: drawer2d.h:753
a2dDrawStyle m_drawstyle
drawstyle (like invert mode)
Definition: drawer2d.h:1015
bool GetNormalizedFont()
Get setting for a fixed device height for drawing text.
Definition: drawer2d.h:569
double m_xpp
user units per pixel in x
Definition: drawer2d.h:1036
wxUint8 m_StrokeOpacityCol2
active stroke alpha
Definition: drawer2d.h:1103
bool m_asrectangle
underneath the threshold draw rectangles if true else nothing
Definition: drawer2d.h:1193
wxBitmap GetBuffer() const
Return the buffer as a bitmap.
Definition: drawer2d.h:1262
wxUint8 m_StrokeOpacityCol1
active stroke alpha
Definition: drawer2d.h:1101
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
a2dStroke m_fixStrokeRestore
used to restore an overruled fix style
Definition: drawer2d.h:1018
a2dVertexList m_tempPoints
used internally in some methods to avoid constructor, new, ...
Definition: drawer2d.h:1053
a2dFill m_activefill
used while rendering
Definition: drawer2d.h:1009
int WorldToDeviceY(double y) const
convert y from world to device coordinates
Definition: drawer2d.h:455
Stroke and fill base classes.
bool m_realScale
If true use real scale else different scale by x and y.
Definition: drawer2d.h:1221
void SetPrimitiveThreshold(wxUint16 pixels, bool asrect=true)
set at what size to stop drawing
Definition: drawer2d.h:211
std::vector< a2dAffineMatrix > m_affineStack
Affine transform stack.
Definition: drawer2d.h:1218
void SetRealScale(bool realScale)
If true use real scale else different scale by x and y.
Definition: drawer2d.h:656
unsigned char m_colour2blueFill
active fill colours
Definition: drawer2d.h:1128
a2dStroke m_currentstroke
used while rendering
Definition: drawer2d.h:1000
a2dDrawStyle m_fixDrawstyle
used to restore an overruled fix style
Definition: drawer2d.h:1024
int m_refreshDisplay
see SetRefreshDisplay()
Definition: drawer2d.h:1145
int GetMapWidth() const
get mapping to device width
Definition: drawer2d.h:398
bool IsStrokeOnly()
wxART2D_USE_GRAPHICS_CONTEXT
Definition: drawer2d.h:847
std::vector< wxRealPoint > m_cpointsDouble
cached array for containing transformed device coordinates (double)
Definition: drawer2d.h:1175
double DeviceToWorldYRel(double y) const
convert y relative from device to world coordinates
Definition: drawer2d.h:449
wxUint16 m_polygonFillThreshold
polygon smaller than this value will be rendered non filled.
Definition: drawer2d.h:1190
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Definition: stylebase.h:779
void SetPolygonFillThreshold(wxUint16 pixels)
set threshold at which polygon is drawn filled or only outline
Definition: drawer2d.h:220
void SetNormalizedFont(bool forceNormalizedFont)
Use a fixed device height for drawing text.
Definition: drawer2d.h:566
unsigned char m_colour1redFill
active fill colours
Definition: drawer2d.h:1117
void SetDisplayAberration(double aber)
Set the display aberration of curved shapes.
Definition: drawer2d.h:238
bool GetYaxis() const
get y axis orientation
Definition: drawer2d.h:280
bool GetThresholdDrawRectangle() const
underneath the threshold draw a rectangle instead of the real object.
Definition: drawer2d.h:217
a2dFont m_currentfont
current font set
Definition: drawer2d.h:1012
a2dBoundingBox m_clipboxworld
current clipping area in world coordinates
Definition: drawer2d.h:1196
a2dAffineMatrix m_usertoworld
pointer to current user-to-world transform matrix
Definition: drawer2d.h:1136
wxUint16 GetPrimitiveThreshold() const
get drawing threshold
Definition: drawer2d.h:214
void DrawCharFreetypeCb(wxChar c)
Wrapper for DrawCharFreetype.
Definition: drawer2d.h:800
vertex array of line and arc segments.
Definition: polyver.h:494
int m_mapHeight
height for mapping in device coordinates
Definition: drawer2d.h:1163
bool m_fixedStyledOverRuled
keep track of this
Definition: drawer2d.h:1042
unsigned char m_colour1blueStroke
active stroke colours
Definition: drawer2d.h:1114
unsigned char m_colour2redFill
active fill colours
Definition: drawer2d.h:1124
double m_virt_minY
virtual coordinates box its miminum Y
Definition: drawer2d.h:1033
std::vector< wxPoint > m_cpointsInt
cached array for containing transformed device coordinates (integer)
Definition: drawer2d.h:1172
vertex list of line and arc segments.
Definition: polyver.h:600
unsigned char m_colour1blueFill
active fill colours
Definition: drawer2d.h:1121
wxUint8 GetOpacityFactor()
see SetOpacityFactor()
Definition: drawer2d.h:780
a2dDrawStyle GetDrawStyle() const
get drawstyle used for drawing.
Definition: drawer2d.h:693
double GetUppX() const
return xpp Number of user units per pixel in x
Definition: drawer2d.h:353
virtual wxDC * GetDeviceDC() const
get the DC that is used for rendering
Definition: drawer2d.h:229
general vertexlist and array and vector path functions and classes.
a2dDrawStyle
Define the manner in which a2dCanvasView draws to the device.
Definition: artglob.h:280
int GetMapY() const
Y mapping position in device coordinates.
Definition: drawer2d.h:407
int WorldToDeviceYRel(double y) const
convert y relative from world to device coordinates
Definition: drawer2d.h:465
a2dClipRegionList m_clipregionlist
pushed clipping regions
Definition: drawer2d.h:1181
classes for initializing the artbase modules, and set paths to be used for fonts etc.
double DeviceToWorldY(double y) const
convert y from device to world coordinates
Definition: drawer2d.h:439
a2dAffineMatrix m_worldtodevice
world to device coordinate mapping
Definition: drawer2d.h:1133
double m_displayaberration
accuracy of arc segment calculation etc. in device coordinates
Definition: drawer2d.h:1184
class draws nothing, still can be used as a drawing context.
Definition: drawer2d.h:1245
virtual void DrawCharDc(wxChar c)
Draw a dc character.
Definition: drawer2d.h:981
unsigned char m_colour1greenStroke
active stroke colours
Definition: drawer2d.h:1112
wxUint16 m_drawingthreshold
object smaller than this value will not be rendered
Definition: drawer2d.h:1187
double m_ypp
user units per pixel in y
Definition: drawer2d.h:1039
bounding class for optimizing drawing speed.
bool IsStroked()
Definition: drawer2d.h:860
Drawing context abstraction.
Definition: drawer2d.h:177
void SetDisableDrawing(bool disableDrawing)
when set, all drawing functions return immediately.
Definition: drawer2d.h:716
int GetHeight() const
get buffer/device height
Definition: drawer2d.h:395
double GetUppY() const
return ypp Number of user units per pixel in y
Definition: drawer2d.h:356
virtual void ShiftBuffer(int dxy, bool yshift)
quick scroll over small distance
Definition: drawer2d.h:271
virtual void DrawTextFreetype(const wxString &text, double x, double y)
Draw text in world coordinates, based on a freetype font .
Definition: drawer2d.h:972
unsigned char m_colour2greenFill
active fill colours
Definition: drawer2d.h:1126
int WorldToDeviceX(double x) const
convert x from world to device coordinates
Definition: drawer2d.h:453
int m_mapX
X mapping position in device coordinates.
Definition: drawer2d.h:1154
double GetDisplayAberration() const
Returns the display aberration of curved shapes.
Definition: drawer2d.h:244
the wxGraphicContext based drawing context
bool GetDisableDrawing()
see SetDisableDrawing()
Definition: drawer2d.h:719
a2dAETList m_AETlist
scanline list of intersections with polygon
Definition: drawer2d.h:1169
bool m_yaxis
up or down
Definition: drawer2d.h:1027
virtual void DrawTextDc(const wxString &text, double x, double y)
Draw text in user coordinates, based on a dc font .
Definition: drawer2d.h:987
void SetDisplay(wxWindow *window)
the display
Definition: drawer2d.h:208
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
virtual bool HasAlpha()
does a derived drawer have alpha support or not
Definition: drawer2d.h:783
a2dStroke GetDrawerStroke() const
get the current stroke
Definition: drawer2d.h:548
void DrawCharStrokeCb(wxChar c)
Wrapper for DrawCharStroke.
Definition: drawer2d.h:796
int m_height
device size height
Definition: drawer2d.h:1151
bool m_disableDrawing
all drawing is disabled when this is true
Definition: drawer2d.h:1208
int GetMapHeight() const
get mapping to device height
Definition: drawer2d.h:401
int GetWidth() const
get buffer/device width
Definition: drawer2d.h:392
a2dBooleanClip
Used for defining how a ClippingRegion defined as a polygon is combined with.
Definition: drawer2d.h:54
wxRect m_clipboxdev
current clipping area in device coordinates
Definition: drawer2d.h:1199
virtual void DrawCharFreetype(wxChar c)
Draw a freetype character.
Definition: drawer2d.h:966
general modules header files all together.
a2dCriticalPointList m_CRlist
critical point list for polygon
Definition: drawer2d.h:1166
a2dFont GetFont() const
get font used for drawing text
Definition: drawer2d.h:563
Line calculations.
Definition: liner.h:36
bool m_printingMode
can be used to modify drawing features when used as context for printing
Definition: drawer2d.h:1224
bool m_virtualarea_set
is the virtual area set already (used during startup)
Definition: drawer2d.h:1142
int m_beginDraw_endDraw
counter for BeginDraw EndDraw calls
Definition: drawer2d.h:1202
double m_virt_minX
virtual coordinates box its miminum X
Definition: drawer2d.h:1030
void DrawImage(const wxImage &image, double x=0, double y=0, wxUint8 Opacity=255)
Draw wxImage in world coordinates.
Definition: drawer2d.h:649
void SetPrintMode(bool onOff)
to modify drawing feature when used as context for printing
Definition: drawer2d.h:696
double WorldToDeviceXRelNoRnd(double x) const
convert x relative from world to device coordinates (result not rounded to integer) ...
Definition: drawer2d.h:470
int m_width
device size width
Definition: drawer2d.h:1148
Contains image with RGBA per pixel.
double DeviceToWorldX(double x) const
convert x from device to world coordinates
Definition: drawer2d.h:437
unsigned char m_colour1greenFill
active fill colours
Definition: drawer2d.h:1119
bool m_pendingSig_changedZoom
When display refresh is on hold, this triggers a delayed zoom signal, when released.
Definition: drawer2d.h:1050
virtual void DeviceDrawAnnotation(const wxString &text, wxCoord x, wxCoord y, const wxFont &font)
text drawn in device coordinates
Definition: drawer2d.h:672
void StartRefreshDisplayDisable()
when called a mapping change will result not result in a refresh of the m_display.
Definition: drawer2d.h:383
unsigned char m_colour1redStroke
active stroke colours
Definition: drawer2d.h:1110
bool m_mouseevents
enable/ disable mouse events handling by canvas
Definition: drawer2d.h:997
int m_mapWidth
width for mapping in device coordinates
Definition: drawer2d.h:1160
virtual wxDC * GetRenderDC() const
get the DC that is used for rendering
Definition: drawer2d.h:226
wxWindow * m_display
view its window.
Definition: drawer2d.h:1205
wxUint16 GetSmallTextThreshold() const
See SetSmallTextThreshold.
Definition: drawer2d.h:579
a2dFill GetDrawerFill() const
get the current fill
Definition: drawer2d.h:557
wxUint8 m_FillOpacityCol1
active fill alpha
Definition: drawer2d.h:1105
bool m_forceNormalizedFont
up or down
Definition: drawer2d.h:1045
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
const a2dAffineMatrix & GetTransform() const
get the user-to-world transform matrix.
Definition: drawer2d.h:500
bool GetRefreshDisplayDisable() const
see StartRefreshDisplayDisable()
Definition: drawer2d.h:389
affine matrix class
wxRect & GetClippingBoxDev()
what is the current clipping region in device coordinates
Definition: drawer2d.h:759
double WorldToDeviceYRelNoRnd(double y) const
convert y relative from world to device coordinates (result not rounded to integer) ...
Definition: drawer2d.h:475
wxUint16 GetPolygonFillThreshold() const
get threshold at which polygon is drawn filled or only outline
Definition: drawer2d.h:223
Vector Path.
Definition: polyver.h:1211
void SetSmallTextThreshold(wxUint16 pixels)
Definition: drawer2d.h:576
int m_mapY
Y mapping position in device coordinates.
Definition: drawer2d.h:1157
a2dFill m_currentfill
used while rendering
Definition: drawer2d.h:1003
bool m_frozen
buffer updating activity possible or not
Definition: drawer2d.h:994
const a2dAffineMatrix & GetMappingMatrix()
get the world-to-device (aka mapping) matrix
Definition: drawer2d.h:478
void DrawCharDcCb(wxChar c)
Wrapper for DrawCharDc.
Definition: drawer2d.h:804
wxUint8 m_OpacityFactor
opacity will be the one set, derived by this
Definition: drawer2d.h:1211
int GetMapX() const
X mapping position in device coordinates.
Definition: drawer2d.h:404
double DeviceToWorldXRel(double x) const
convert x relative from device to world coordinates
Definition: drawer2d.h:444
const a2dAffineMatrix & GetUserToDeviceTransform() const
get matrix which transforms directly from user coordinates to device
Definition: drawer2d.h:503
wxUint8 m_FillOpacityCol2
active fill alpha
Definition: drawer2d.h:1107
basic 2 point line class for intersection and contouring routines.
double m_splineaberration
accuracy of spline
Definition: drawer2d.h:1178
bool GetVirtualAreaSet() const
if the virtual area has been set already return true else false.
Definition: drawer2d.h:374
a2dFill m_fixFillRestore
used to restore an overruled fix style
Definition: drawer2d.h:1021
drawer2d.h Source File -- Sun Oct 12 2014 17:04:16 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation