Main Page   Class Hierarchy   Compound List   File List   Compound Members  

wxDoubleDCBase Class Reference

This class is a "sort of DC", and can be used in the same manner as. More...

#include <doubledc.h>

Inheritance diagram for wxDoubleDCBase:

DrawDriver List of all members.

Public Methods

 wxDoubleDCBase ()
 constructor

virtual ~wxDoubleDCBase ()
 destructor

wxDC * SetDC (wxDC *newdc)
 this function tells the class what wxDC derived DC should be used for output

wxDC * GetDC ()
 gives the current DC in use, NULL if not set.

double GetScaleFactorX ()
 current X scale factor for virtual to window coordinates

double GetScaleFactorY ()
 current Y scale factor for virtual to window coordinates

int GetClipCode (double, double)
 return clipcode for a point, clipped against the virtual window

bool Clipping (double &, double &)
 return if point is clipped against the virtual window

bool Clipping (double &, double &, double &, double &)
 return if both points are clipped against the virtual window

wxTransformMatrix GetInverseMappingMatrix ()
 matrix for calculating the virtual coordinate given a screen coordinate

wxTransformMatrix GetMappingMatrix ()
 matrix for calculating the screen coordinate given a virtual coordinate

void SetMapping (int dwxi, int dwyi, double vx1, double vy1, double vx2, double vy2, bool border)
 given the virtual size to be displayed,

void DrawLine (double x1, double y1, double x2, double y2)
 Draws a line from the first point to the second. The current pen is used for drawing the line.

void DrawLine (const wxPoint2DDouble &pt1, const wxPoint2DDouble &pt2)
 Draws a line from the first point to the second. The current pen is used for drawing the line.

void DrawCheckMark (double x, double y, double width, double height)
 Draws a check mark inside the given rectangle.

void DrawLines (int n, wxPoint2DDouble points[], double xoffset=0, double yoffset=0)
void DrawLines (const wxList *list, double xoffset=0, double yoffset=0)
 Draws lines using an array of points of size n,.

void DrawPolygon (int n, wxPoint2DDouble points[], double xoffset=0, double yoffset=0, int fillStyle=wxODDEVEN_RULE)
 Draws a filled polygon using an array of points of size n,.

void DrawRectangle (double x, double y, double width, double height)
void DrawRoundedRectangle (double x, double y, double width, double height, double radius)
 Draws a rectangle with the given bottom left corner, and with the given size.

void DrawCircle (double x, double y, double radius)
 draw a circle

void DrawEllipse (double x, double y, double width, double height)
 draw an ellipse

void DrawRotatedText (const wxString &text, double x, double y, double angle)
 Draws the text rotated by angle degrees.

virtual void Clear ()
 clear the window using the current background color

virtual void SetFont (const wxFont &font, double size)
 set the font to be used for text drawing, the size is in world coordinates

void SetClippingRegionWin (wxCoord minx, wxCoord miny, wxCoord maxx, wxCoord maxy)
 set clipping region using x y values of windows coordinates

void SetClippingRegion (double minx, double miny, double maxx, double maxy)
 set clipping region using x y values of virtual window coordinates

void DestroyClippingRegion ()
 set clipping region off

void ClearClippingRegion ()
 clear the clippingregion using the current background color

void ExtendClippingRegion (double x, double y)
 extend clipping region by this point

virtual void GetClippingBox (double &x, double &y, double &w, double &h) const
 what is the current clipping region

virtual void GetVirtualSize (double &x, double &y, double &w, double &h) const
 return a virtual coordinates being the visual size of the client window

double DeviceToLogicalX (double x) const
 convert from window to virtual coordinates

double DeviceToLogicalY (double y) const
 convert from window to virtual coordinates

double DeviceToLogicalXRel (double x) const
 convert from window to virtual coordinates relatif

double DeviceToLogicalYRel (double y) const
 convert from window to virtual coordinates relatif

double LogicalToDeviceX (double x) const
 convert from virtual to window coordinates

double LogicalToDeviceY (double y) const
 convert from virtual to window coordinates

double LogicalToDeviceXRel (double x) const
 convert from virtual to window coordinates relatif

double LogicalToDeviceYRel (double y) const
 convert from virtual to window coordinates relatif

virtual void SetTextForeground (const wxColour &colour)
virtual void SetTextBackground (const wxColour &colour)
int GetLogicalFunction () const
 Sets the current logical function for the device context.

virtual void SetLogicalFunction (int function)
 setlogical function

virtual void CalcBoundingBox (double x, double y)
void ResetBoundingBox ()
double MinX () const
 Get the final bounding box its MinX.

double MaxX () const
 Get the final bounding box its MaxX.

double MinY () const
 Get the final bounding box its MinY.

double MaxY () const
 Get the final bounding box its MaxY.

void GetTextExtent (const wxString &string, long *x, long *y, long *descent=NULL, long *externalLeading=NULL, wxFont *theFont=NULL) const
 for compatibility with the old code when double was long everywhere


Public Attributes

double m_virt_minX
 virtual coordinates box

double m_virt_minY
 virtual coordinates box

double m_virt_maxX
 virtual coordinates box

double m_virt_maxY
 virtual coordinates box


Protected Attributes

bool m_colour:1
 holds this

bool m_ok:1
 holds this

bool m_clipping:1
 is clippingbox set

bool m_isInteractive:1
 holds this

bool m_isBBoxValid:1
 is the boundingbox valid

bool m_isVirtualValid:1
 holds this

double m_minX
 bounding box

double m_minY
 bounding box

double m_maxX
 bounding box

double m_maxY
 bounding box

double m_clipX1
 clipping box

double m_clipY1
 clipping box

double m_clipX2
 clipping box

double m_clipY2
 clipping box

int m_logicalFunction
 holds this

int m_backgroundMode
 holds this

int m_mappingMode
 holds this

double m_fontsize
 holds the text height in world coordinates

wxPen m_pen
 holds this

wxBrush m_brush
 holds this

wxBrush m_backgroundBrush
 holds this

wxColour m_textForegroundColour
 holds this

wxColour m_textBackgroundColour
 holds this

wxFont m_font
 holds this, the height of the text is in m_fontsize

wxPalette m_palette
 holds this

wxTransformMatrix m_mapping_matrix
 holds the matrix for mapping from virtual to screen coordinates

wxTransformMatrix m_inverse_mapping
 holds the inverse of the mapping matrix

double m_scalefactor_x
 holds the scalefactor for the window in x

double m_scalefactor_y
 holds the scalefactor for the window in y

wxDC * m_dc
 the base DC that is used by all drawing function to draw on a device.

wxPoint * m_todraw

Detailed Description

This class is a "sort of DC", and can be used in the same manner as.

normal DC's. Everything you draw using this class will be converted from world to windows coordinates. All coordinates are in double's. The class needs a real wxDC derived DC in order to draw something. Only one instance of this class is normal sufficient, since it can work with any wxDC by just setting the new DC for the class. The world coordinates are set using the SetMapping function.

Note:
It is important not to forget to reset the DC (when the given DC was a temporary variable)
Example:
Do reset the DC!
 { wxClientDC a_dc;
   wxDoubleDCBase a_doubledc;
   a_doubledc.SetDC(&a_dc);
   a_doubledc.Draw------Something();
   a_doubledc.SetDC(0);
 }
See also:
wxClientDC , wxPaintDC , wxDC


Member Function Documentation

virtual void wxDoubleDCBase::CalcBoundingBox double    x,
double    y
[inline, virtual]
 

bounding box calculation which is updated with evrything drawn sofar

Note:
It can be reset in between

void wxDoubleDCBase::DrawLines const wxList *    list,
double    xoffset = 0,
double    yoffset = 0
 

Draws lines using an array of points of size n,.

or list of pointers to points, adding the optional offset coordinate. The current pen is used for drawing the lines. The programmer is responsible for deleting the list of points.

void wxDoubleDCBase::DrawLines int    n,
wxPoint2DDouble    points[],
double    xoffset = 0,
double    yoffset = 0
 

Draws lines using an array of points of size n, or list of pointers to points, adding the optional offset coordinate. The current pen is used for drawing the lines.

void wxDoubleDCBase::DrawPolygon int    n,
wxPoint2DDouble    points[],
double    xoffset = 0,
double    yoffset = 0,
int    fillStyle = wxODDEVEN_RULE
 

Draws a filled polygon using an array of points of size n,.

or list of pointers to points, adding the optional offset coordinate. The last argument specifies the fill rule: wxODDEVEN_RULE (the default) or wxWINDING_RULE. The current pen is used for drawing the outline, and the current brush for filling the shape. Using a transparent brush suppresses filling. The programmer is responsible for deleting the list of points. Note that wxWindows automatically closes the first and last points.

void wxDoubleDCBase::DrawRectangle double    x,
double    y,
double    width,
double    height
 

Draws a rectangle with the given bottom left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape

void wxDoubleDCBase::DrawRoundedRectangle double    x,
double    y,
double    width,
double    height,
double    radius
 

Draws a rectangle with the given bottom left corner, and with the given size.

The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape.

If radius is positive, the value is assumed to be the radius of the rounded corner. If radius is negative, the absolute value is assumed to be the proportion of the smallest dimension of the rectangle. This means that the corner can be a sensible size relative to the size of the rectangle, and also avoids the strange effects X produces when the corners are too big for the rectangle.

int wxDoubleDCBase::GetLogicalFunction   const [inline]
 

Sets the current logical function for the device context.

This determines how a source pixel (from a pen or brush colour, or source device context if using wxDC::Blit) combines with a destination pixel in the current device context.

The possible values and their meaning in terms of source and destination pixel values are as follows:

  • wxAND src AND dst
  • AND_INVERT (NOT src) AND dst
  • AND_REVERSE src AND (NOT dst)
  • CLEAR 0
  • COPY src
  • EQUIV (NOT src) XOR dst
  • INVERT NOT dst
  • NAND (NOT src) OR (NOT dst)
  • NOR (NOT src) AND (NOT dst)
  • NO_OP dst
  • OR src OR dst
  • OR_INVERT (NOT src) OR dst
  • OR_REVERSE src OR (NOT dst)
  • SET 1
  • SRC_INVERT NOT src
  • XOR src XOR dst
The default is wxCOPY, which simply draws with the current colour. The others combine the current colour and the background using a logical operation. wxINVERT is commonly used for drawing rubber bands or moving outlines, since drawing twice reverts to the original colour.

void wxDoubleDCBase::ResetBoundingBox   [inline]
 

reset the boundingbox of things drawn sofar

Note:
see CalcBoundingBox

void wxDoubleDCBase::SetMapping int    dwxi,
int    dwyi,
double    vx1,
double    vy1,
double    vx2,
double    vy2,
bool    border
 

given the virtual size to be displayed,

the mappingmatrix will be calculated in such a manner that it fits (same ratio in width and height) to the window size. The window size is normally used to intitialize the mapping, but for printing you would set the size of the paper etc. The virtual size is just an indication, it will be ajusted to fit in the dwxi and dwyi ratio

virtual void wxDoubleDCBase::SetTextBackground const wxColour &    colour [virtual]
 

Sets the current text foreground colour for the DC. In case of stipple filled primitives using a bitmap and a mask. The TextBackground color is used for the transparent parts

virtual void wxDoubleDCBase::SetTextForeground const wxColour &    colour [virtual]
 

Sets the current text background colour for the DC. In case of stipple filled primitives using a bitmap and a mask. The TextForeground color is used for the non transparent parts


Member Data Documentation

wxPoint* wxDoubleDCBase::m_todraw [protected]
 

temporary storage of polygons converted to windows coordinates

Note:
meant for speeding up things, NOT used yet


The documentation for this class was generated from the following file: wxDoubleDCBase class Reference -- Thu Nov 28 21:24:57 2002 -- 28 Nov 2002 -- 1.2.18 -- -- . -- Main Page