1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2%% Name: graphicsfont.tex 3%% Purpose: wxGraphicsFont class documentation 4%% Author: Stefan Csomor 5%% Modified by: 6%% Created: 08.06.2004 7%% RCS-ID: $Id: graphicscontext.tex 50200 2007-11-23 20:45:59Z VS $ 8%% Copyright: (c) Stefan Csomor 9%% License: wxWindows license 10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 12\section{\class{wxGraphicsContext}}\label{wxgraphicscontext} 13 14A wxGraphicsContext instance is the object that is drawn upon. It is created by a renderer using the CreateContext calls.., this can be either directly using a renderer 15instance, or indirectly using the static convenience CreateXXX functions of wxGraphicsContext that always delegate the task to the default renderer. 16 17\wxheading{Derived from} 18 19\helpref{wxGraphicsObject}{wxgraphicsobject} 20 21\wxheading{Include files} 22 23<wx/graphics.h> 24 25\latexignore{\rtfignore{\wxheading{Members}}} 26 27\membersection{wxGraphicsContext::Create}\label{wxgraphicscontextcreate} 28 29\func{wxGraphicsContext*}{Create}{\param{const wxWindowDC\& }{dc}} 30 31Creates a wxGraphicsContext from a wxWindowDC (eg a wxPaintDC). 32 33\func{wxGraphicsContext*}{Create}{\param{wxWindow* }{window}} 34 35Creates a wxGraphicsContext from a wxWindow. 36 37\wxheading{See also} 38 39\helpref{wxGraphicsRenderer:: CreateContext}{wxgraphicsrenderercreatecontext} 40 41\membersection{wxGraphicsContext::CreateFromNative}\label{wxgraphicscontextcreatefromnative} 42 43Creates a wxGraphicsContext from a native context. This native context must be eg a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus or a 44cairo\_t pointer for cairo. 45 46\func{wxGraphicsContext*}{CreateFromNative}{\param{void * }{context}} 47 48Creates a wxGraphicsContext from a native window. 49 50\wxheading{See also} 51 52\helpref{wxGraphicsRenderer:: CreateContextFromNativeContext}{wxgraphicsrenderercreatecontextfromnativecontext} 53 54\membersection{wxGraphicsContext::CreateFromNativeWindow}\label{wxgraphicscontextcreatefromnativewindow} 55 56\func{wxGraphicsContext*}{CreateFromNativeWindow}{\param{void * }{window}} 57 58\wxheading{See also} 59 60\helpref{wxGraphicsRenderer:: CreateContextFromNativeWindow}{wxgraphicsrenderercreatecontextfromnativewindow} 61 62\membersection{wxGraphicsContext::CreatePen}\label{wxgraphicscontextcreatepen} 63 64\constfunc{wxGraphicsPen}{CreatePen}{\param{const wxPen\& }{pen}} 65 66Creates a native pen from a wxPen. 67 68\membersection{wxGraphicsContext::CreateBrush}\label{wxgraphicscontextcreatebrush} 69 70\constfunc{wxGraphicsBrush}{CreateBrush}{\param{const wxBrush\& }{brush}} 71 72Creates a native brush from a wxBrush. 73 74\membersection{wxGraphicsContext::CreateRadialGradientBrush}\label{wxgraphicscontextcreateradialgradientbrush} 75 76\constfunc{wxGraphicsBrush}{CreateRadialGradientBrush}{\param{wxDouble }{xo}, \param{wxDouble }{yo}, \param{wxDouble }{xc}, \param{wxDouble }{yc}, 77\param{wxDouble }{radius}, \param{const wxColour\& }{oColor}, \param{const wxColour\& }{cColor}} 78 79Creates a native brush, having a radial gradient originating at (xo,yc) with color oColour and ends on a circle around (xc,yc) with radius r and color cColour 80 81\membersection{wxGraphicsContext::CreateLinearGradientBrush}\label{wxgraphicscontextcreatelineargradientbrush} 82 83\constfunc{wxGraphicsBrush}{CreateLinearGradientBrush}{\param{wxDouble }{x1}, \param{wxDouble }{y1}, \param{wxDouble }{x2}, \param{wxDouble }{y2}, 84\param{const }{wxColour\&c1}, \param{const }{wxColour\&c2}} 85 86Creates a native brush, having a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 87 88\membersection{wxGraphicsContext::CreateFont}\label{wxgraphicscontextcreatefont} 89 90\constfunc{wxGraphicsFont}{CreateFont}{\param{const wxFont\& }{font}, \param{const wxColour\& }{col = *wxBLACK}} 91 92Creates a native graphics font from a wxFont and a text colour. 93 94\membersection{wxGraphicsContext::CreateMatrix}\label{wxgraphicscontextcreatematrix} 95 96\constfunc{wxGraphicsMatrix}{CreateMatrix}{\param{wxDouble }{a = 1.0}, \param{wxDouble }{b = 0.0}, \param{wxDouble }{c = 0.0}, \param{wxDouble }{d = 1.0}, 97\param{wxDouble }{tx = 0.0}, \param{wxDouble }{ty = 0.0}} 98 99Creates a native affine transformation matrix from the passed in values. The defaults result in an identity matrix. 100 101\membersection{wxGraphicsContext::CreatePath}\label{wxgraphicscontextcreatepath} 102 103\constfunc{wxGraphicsPath}{CreatePath}{\void} 104 105Creates a native graphics path which is initially empty. 106 107\membersection{wxGraphicsContext::Clip}\label{wxgraphicscontextclip} 108 109\func{void}{Clip}{\param{const wxRegion\& }{region}} 110 111Clips drawings to the region, combined to current clipping region 112 113\func{void}{Clip}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}} 114 115Clips drawings to the rectangle. 116 117\membersection{wxGraphicsContext::ResetClip}\label{wxgraphicscontextresetclip} 118 119\func{void}{ResetClip}{\void} 120 121Resets the clipping to original shape. 122 123\membersection{wxGraphicsContext::DrawBitmap}\label{wxgraphicscontextdrawbitmap} 124 125\func{void}{DrawBitmap}{\param{const wxBitmap\& }{bmp}, \param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}} 126 127Draws the bitmap. In case of a mono bitmap, this is treated as a mask and the current brushed is used for filling. 128 129\membersection{wxGraphicsContext::DrawEllipse}\label{wxgraphicscontextdrawellipse} 130 131\func{void}{DrawEllipse}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}} 132 133Draws an ellipse. 134 135\membersection{wxGraphicsContext::DrawIcon}\label{wxgraphicscontextdrawicon} 136 137\func{void}{DrawIcon}{\param{const wxIcon\& }{icon}, \param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}} 138 139Draws the icon. 140 141 142\membersection{wxGraphicsContext::DrawLines}\label{wxgraphicscontextdrawlines} 143 144\func{void}{DrawLines}{\param{size\_t }{n}, \param{const wxPoint2DDouble* }{points}, \param{int }{fillStyle = wxODDEVEN\_RULE}} 145 146Draws a polygon. 147 148 149\membersection{wxGraphicsContext::DrawPath}\label{wxgraphicscontextdrawpath} 150 151\func{void}{DrawPath}{\param{const wxGraphicsPath\& }{path}, \param{int }{fillStyle = wxODDEVEN\_RULE}} 152 153Draws the path by first filling and then stroking. 154 155 156\membersection{wxGraphicsContext::DrawRectangle}\label{wxgraphicscontextdrawrectangle} 157 158\func{void}{DrawRectangle}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}} 159 160Draws a rectangle. 161 162 163\membersection{wxGraphicsContext::DrawRoundedRectangle}\label{wxgraphicscontextdrawroundedrectangle} 164 165\func{void}{DrawRoundedRectangle}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}, \param{wxDouble }{radius}} 166 167Draws a rounded rectangle. 168 169\membersection{wxGraphicsContext::DrawText}\label{wxgraphicscontextdrawtext} 170 171\func{void}{DrawText}{\param{const wxString\& }{str}, \param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{angle}} 172 173\func{void}{DrawText}{\param{const wxString\& }{str}, \param{wxDouble }{x}, \param{wxDouble }{y}} 174 175Draws a text at the defined position, at the given angle. 176 177\membersection{wxGraphicsContext::FillPath}\label{wxgraphicscontextfillpath} 178 179\func{void}{FillPath}{\param{const wxGraphicsPath\& }{path}, \param{int }{fillStyle = wxODDEVEN\_RULE}} 180 181Fills the path with the current brush. 182 183\membersection{wxGraphicsContext::StrokePath}\label{wxgraphicscontextstrokepath} 184 185\func{void}{StrokePath}{\param{const wxGraphicsPath\& }{path}} 186 187Strokes along a path with the current pen. 188 189 190\membersection{wxGraphicsContext::GetNativeContext}\label{wxgraphicscontextgetnativecontext} 191 192\func{void *}{GetNativeContext}{\void} 193 194Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo\_t pointer for cairo). 195 196\membersection{wxGraphicsContext::GetPartialTextExtents}\label{wxgraphicscontextgetpartialtextextents} 197 198\constfunc{void}{GetPartialTextExtents}{\param{const wxString\& }{text}, \param{wxArrayDouble\& }{widths}} 199 200Fills the {\it widths} array with the widths from the beginning of 201{\it text} to the corresponding character of {\it text}. 202 203\membersection{wxGraphicsContext::GetTextExtent}\label{wxgraphicscontextgettextextent} 204 205\constfunc{void}{GetTextExtent}{\param{const wxString\& }{text}, \param{wxDouble* }{width}, \param{wxDouble* }{height}, \param{wxDouble* }{descent}, 206\param{wxDouble* }{externalLeading}} 207 208Gets the dimensions of the string using the currently selected font. 209\rtfsp{\it string} is the text string to measure, {\it w} and {\it h} are 210the total width and height respectively, {\it descent} is the 211dimension from the baseline of the font to the bottom of the 212descender, and {\it externalLeading} is any extra vertical space added 213to the font by the font designer (usually is zero). 214 215\membersection{wxGraphicsContext::Rotate}\label{wxgraphicscontextrotate} 216 217\func{void}{Rotate}{\param{wxDouble }{angle}} 218 219Rotates the current transformation matrix (radians), 220 221\membersection{wxGraphicsContext::Scale}\label{wxgraphicscontextscale} 222 223\func{void}{Scale}{\param{wxDouble }{xScale}, \param{wxDouble }{yScale}} 224 225Scales the current transformation matrix. 226 227\membersection{wxGraphicsContext::Translate}\label{wxgraphicscontexttranslate} 228 229\func{void}{Translate}{\param{wxDouble }{dx}, \param{wxDouble }{dy}} 230 231Translates the current transformation matrix. 232 233\membersection{wxGraphicsContext::GetTransform}\label{wxgraphicscontextgettransform} 234 235\constfunc{wxGraphicsMatrix}{GetTransform}{\void} 236 237Gets the current transformation matrix of this context. 238 239\membersection{wxGraphicsContext::SetTransform}\label{wxgraphicscontextsettransform} 240 241\func{void}{SetTransform}{\param{const wxGraphicsMatrix\& }{matrix}} 242 243Sets the current transformation matrix of this context 244 245\membersection{wxGraphicsContext::ConcatTransform}\label{wxgraphicscontextconcattransform} 246 247\func{void}{ConcatTransform}{\param{const wxGraphicsMatrix\& }{matrix}} 248 249Concatenates the passed in transform with the current transform of this context 250 251\membersection{wxGraphicsContext::SetBrush}\label{wxgraphicscontextsetbrush} 252 253\func{void}{SetBrush}{\param{const wxBrush\& }{brush}} 254 255\func{void}{SetBrush}{\param{const wxGraphicsBrush\& }{brush}} 256 257Sets the brush for filling paths. 258 259\membersection{wxGraphicsContext::SetFont}\label{wxgraphicscontextsetfont} 260 261\func{void}{SetFont}{\param{const wxFont\& }{font}, \param{const wxColour\& }{colour}} 262 263 264\func{void}{SetFont}{\param{const wxGraphicsFont\& }{font}} 265 266Sets the font for drawing text. 267 268 269\membersection{wxGraphicsContext::SetPen}\label{wxgraphicscontextsetpen} 270 271\func{void}{SetPen}{\param{const wxGraphicsPen\& }{pen}} 272 273\func{void}{SetPen}{\param{const wxPen\& }{pen}} 274 275Sets the pen used for stroking. 276 277\membersection{wxGraphicsContext::StrokeLine}\label{wxgraphicscontextstrokeline} 278 279\func{void}{StrokeLine}{\param{wxDouble }{x1}, \param{wxDouble }{y1}, \param{wxDouble }{x2}, \param{wxDouble }{y2}} 280 281Strokes a single line. 282 283\membersection{wxGraphicsContext::StrokeLines}\label{wxgraphicscontextstrokelines} 284 285\func{void}{StrokeLines}{\param{size\_t }{n}, \param{const wxPoint2DDouble* }{beginPoints}, \param{const wxPoint2DDouble* }{endPoints}} 286 287\func{void}{StrokeLines}{\param{size\_t }{n}, \param{const wxPoint2DDouble* }{points}} 288 289Stroke disconnected lines from begin to end points, fastest method available for this purpose. 290 291