1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: graphicsfont.tex
3 %% Purpose: wxGraphicsFont class documentation
4 %% Author: Stefan Csomor
8 %% Copyright: (c) Stefan Csomor
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxGraphicsContext
}}\label{wxgraphicscontext
}
14 A 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
15 instance, or indirectly using the static convenience CreateXXX functions of wxGraphicsContext that always delegate the task to the default renderer.
17 \wxheading{Derived from
}
19 \helpref{wxGraphicsObject
}{wxgraphicsobject
}\\
20 \helpref{wxObject
}{wxobject
}
22 \wxheading{Include files
}
28 \helpref{wxCore
}{librarieslist
}
30 \latexignore{\rtfignore{\wxheading{Members
}}}
32 \membersection{wxGraphicsContext::Create
}\label{wxgraphicscontextcreate
}
34 \func{wxGraphicsContext*
}{Create
}{\param{const wxWindowDC\&
}{dc
}}
36 Creates a wxGraphicsContext from a wxWindowDC (eg a wxPaintDC).
38 \func{wxGraphicsContext*
}{Create
}{\param{wxWindow*
}{window
}}
40 Creates a wxGraphicsContext from a wxWindow.
44 \helpref{wxGraphicsRenderer:: CreateContext
}{wxgraphicsrenderercreatecontext
}
46 \membersection{wxGraphicsContext::CreateFromNative
}\label{wxgraphicscontextcreatefromnative
}
48 Creates a wxGraphicsContext from a native context. This native context must be eg a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus or a
49 cairo
\_t pointer for cairo.
51 \func{wxGraphicsContext*
}{CreateFromNative
}{\param{void *
}{context
}}
53 Creates a wxGraphicsContext from a native window.
57 \helpref{wxGraphicsRenderer:: CreateContextFromNativeContext
}{wxgraphicsrenderercreatecontextfromnativecontext
}
59 \membersection{wxGraphicsContext::CreateFromNativeWindow
}\label{wxgraphicscontextcreatefromnativewindow
}
61 \func{wxGraphicsContext*
}{CreateFromNativeWindow
}{\param{void *
}{window
}}
65 \helpref{wxGraphicsRenderer:: CreateContextFromNativeWindow
}{wxgraphicsrenderercreatecontextfromnativewindow
}
67 \membersection{wxGraphicsContext::CreatePen
}\label{wxgraphicscontextcreatepen
}
69 \constfunc{wxGraphicsPen
}{CreatePen
}{\param{const wxPen\&
}{pen
}}
71 Creates a native pen from a wxPen.
73 \membersection{wxGraphicsContext::CreateBrush
}\label{wxgraphicscontextcreatebrush
}
75 \constfunc{wxGraphicsBrush
}{CreateBrush
}{\param{const wxBrush\&
}{brush
}}
77 Creates a native brush from a wxBrush.
79 \membersection{wxGraphicsContext::CreateRadialGradientBrush
}\label{wxgraphicscontextcreateradialgradientbrush
}
81 \constfunc{wxGraphicsBrush
}{CreateRadialGradientBrush
}{\param{wxDouble
}{xo
},
\param{wxDouble
}{yo
},
\param{wxDouble
}{xc
},
\param{wxDouble
}{yc
},
82 \param{wxDouble
}{radius
},
\param{const wxColour\&
}{oColor
},
\param{const wxColour\&
}{cColor
}}
84 Creates 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
86 \membersection{wxGraphicsContext::CreateLinearGradientBrush
}\label{wxgraphicscontextcreatelineargradientbrush
}
88 \constfunc{wxGraphicsBrush
}{CreateLinearGradientBrush
}{\param{wxDouble
}{x1
},
\param{wxDouble
}{y1
},
\param{wxDouble
}{x2
},
\param{wxDouble
}{y2
},
89 \param{const
}{wxColour\&c1
},
\param{const
}{wxColour\&c2
}}
91 Creates a native brush, having a linear gradient, starting at (x1,y1) with
color c1 to (x2,y2) with
color c2
93 \membersection{wxGraphicsContext::CreateFont
}\label{wxgraphicscontextcreatefont
}
95 \constfunc{wxGraphicsFont
}{CreateFont
}{\param{const wxFont\&
}{font
},
\param{const wxColour\&
}{col = *wxBLACK
}}
97 Creates a native graphics font from a wxFont and a text colour.
99 \membersection{wxGraphicsContext::CreateMatrix
}\label{wxgraphicscontextcreatematrix
}
101 \constfunc{wxGraphicsMatrix
}{CreateMatrix
}{\param{wxDouble
}{a =
1.0},
\param{wxDouble
}{b =
0.0},
\param{wxDouble
}{c =
0.0},
\param{wxDouble
}{d =
1.0},
102 \param{wxDouble
}{tx =
0.0},
\param{wxDouble
}{ty =
0.0}}
104 Creates a native affine transformation matrix from the passed in values. The defaults result in an identity matrix.
106 \membersection{wxGraphicsContext::CreatePath
}\label{wxgraphicscontextcreatepath
}
108 \constfunc{wxGraphicsPath
}{CreatePath
}{\void}
110 Creates a native graphics path which is initially empty.
112 \membersection{wxGraphicsContext::Clip
}\label{wxgraphicscontextclip
}
114 \func{void
}{Clip
}{\param{const wxRegion\&
}{region
}}
116 Clips drawings to the region, combined to current clipping region
118 \func{void
}{Clip
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
120 Clips drawings to the rectangle.
122 \membersection{wxGraphicsContext::ResetClip
}\label{wxgraphicscontextresetclip
}
124 \func{void
}{ResetClip
}{\void}
126 Resets the clipping to original shape.
128 \membersection{wxGraphicsContext::DrawBitmap
}\label{wxgraphicscontextdrawbitmap
}
130 \func{void
}{DrawBitmap
}{\param{const wxBitmap\&
}{bmp
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
132 Draws the bitmap. In case of a mono bitmap, this is treated as a mask and the current brushed is used for filling.
134 \membersection{wxGraphicsContext::DrawEllipse
}\label{wxgraphicscontextdrawellipse
}
136 \func{void
}{DrawEllipse
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
140 \membersection{wxGraphicsContext::DrawIcon
}\label{wxgraphicscontextdrawicon
}
142 \func{void
}{DrawIcon
}{\param{const wxIcon\&
}{icon
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
147 \membersection{wxGraphicsContext::DrawLines
}\label{wxgraphicscontextdrawlines
}
149 \func{void
}{DrawLines
}{\param{size
\_t }{n
},
\param{const wxPoint2DDouble*
}{points
},
\param{int
}{fillStyle = wxODDEVEN
\_RULE}}
154 \membersection{wxGraphicsContext::DrawPath
}\label{wxgraphicscontextdrawpath
}
156 \func{void
}{DrawPath
}{\param{const wxGraphicsPath\&
}{path
},
\param{int
}{fillStyle = wxODDEVEN
\_RULE}}
158 Draws the path by first filling and then stroking.
161 \membersection{wxGraphicsContext::DrawRectangle
}\label{wxgraphicscontextdrawrectangle
}
163 \func{void
}{DrawRectangle
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
168 \membersection{wxGraphicsContext::DrawRoundedRectangle
}\label{wxgraphicscontextdrawroundedrectangle
}
170 \func{void
}{DrawRoundedRectangle
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
},
\param{wxDouble
}{radius
}}
172 Draws a rounded rectangle.
174 \membersection{wxGraphicsContext::DrawText
}\label{wxgraphicscontextdrawtext
}
176 \func{void
}{DrawText
}{\param{const wxString\&
}{str
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{angle
}}
178 \func{void
}{DrawText
}{\param{const wxString\&
}{str
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
}}
180 Draws a text at the defined position, at the given angle.
182 \membersection{wxGraphicsContext::FillPath
}\label{wxgraphicscontextfillpath
}
184 \func{void
}{FillPath
}{\param{const wxGraphicsPath\&
}{path
},
\param{int
}{fillStyle = wxODDEVEN
\_RULE}}
186 Fills the path with the current brush.
188 \membersection{wxGraphicsContext::StrokePath
}\label{wxgraphicscontextstrokepath
}
190 \func{void
}{StrokePath
}{\param{const wxGraphicsPath\&
}{path
}}
192 Strokes along a path with the current pen.
195 \membersection{wxGraphicsContext::GetNativeContext
}\label{wxgraphicscontextgetnativecontext
}
197 \func{void *
}{GetNativeContext
}{\void}
199 Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo
\_t pointer for cairo).
201 \membersection{wxGraphicsContext::GetPartialTextExtents
}\label{wxgraphicscontextgetpartialtextextents
}
203 \constfunc{void
}{GetPartialTextExtents
}{\param{const wxString\&
}{text
},
\param{wxArrayDouble\&
}{widths
}}
205 Fills the
{\it widths
} array with the widths from the beginning of
206 {\it text
} to the corresponding character of
{\it text
}.
208 \membersection{wxGraphicsContext::GetTextExtent
}\label{wxgraphicscontextgettextextent
}
210 \constfunc{void
}{GetTextExtent
}{\param{const wxString\&
}{text
},
\param{wxDouble*
}{width
},
\param{wxDouble*
}{height
},
\param{wxDouble*
}{descent
},
211 \param{wxDouble*
}{externalLeading
}}
213 Gets the dimensions of the string using the currently selected font.
214 \rtfsp{\it string
} is the text string to measure,
{\it w
} and
{\it h
} are
215 the total width and height respectively,
{\it descent
} is the
216 dimension from the baseline of the font to the bottom of the
217 descender, and
{\it externalLeading
} is any extra vertical space added
218 to the font by the font designer (usually is zero).
220 \membersection{wxGraphicsContext::Rotate
}\label{wxgraphicscontextrotate
}
222 \func{void
}{Rotate
}{\param{wxDouble
}{angle
}}
224 Rotates the current transformation matrix (radians),
226 \membersection{wxGraphicsContext::Scale
}\label{wxgraphicscontextscale
}
228 \func{void
}{Scale
}{\param{wxDouble
}{xScale
},
\param{wxDouble
}{yScale
}}
230 Scales the current transformation matrix.
232 \membersection{wxGraphicsContext::Translate
}\label{wxgraphicscontexttranslate
}
234 \func{void
}{Translate
}{\param{wxDouble
}{dx
},
\param{wxDouble
}{dy
}}
236 Translates the current transformation matrix.
238 \membersection{wxGraphicsContext::GetTransform
}\label{wxgraphicscontextgettransform
}
240 \constfunc{wxGraphicsMatrix
}{GetTransform
}{\void}
242 Gets the current transformation matrix of this context.
244 \membersection{wxGraphicsContext::SetTransform
}\label{wxgraphicscontextsettransform
}
246 \func{void
}{SetTransform
}{\param{const wxGraphicsMatrix\&
}{matrix
}}
248 Sets the current transformation matrix of this context
250 \membersection{wxGraphicsContext::ConcatTransform
}\label{wxgraphicscontextconcattransform
}
252 \func{void
}{ConcatTransform
}{\param{const wxGraphicsMatrix\&
}{matrix
}}
254 Concatenates the passed in transform with the current transform of this context
256 \membersection{wxGraphicsContext::SetBrush
}\label{wxgraphicscontextsetbrush
}
258 \func{void
}{SetBrush
}{\param{const wxBrush\&
}{brush
}}
260 \func{void
}{SetBrush
}{\param{const wxGraphicsBrush\&
}{brush
}}
262 Sets the brush for filling paths.
264 \membersection{wxGraphicsContext::SetFont
}\label{wxgraphicscontextsetfont
}
266 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
},
\param{const wxColour\&
}{colour
}}
269 \func{void
}{SetFont
}{\param{const wxGraphicsFont\&
}{font
}}
271 Sets the font for drawing text.
274 \membersection{wxGraphicsContext::SetPen
}\label{wxgraphicscontextsetpen
}
276 \func{void
}{SetPen
}{\param{const wxGraphicsPen\&
}{pen
}}
278 \func{void
}{SetPen
}{\param{const wxPen\&
}{pen
}}
280 Sets the pen used for stroking.
282 \membersection{wxGraphicsContext::StrokeLine
}\label{wxgraphicscontextstrokeline
}
284 \func{void
}{StrokeLine
}{\param{wxDouble
}{x1
},
\param{wxDouble
}{y1
},
\param{wxDouble
}{x2
},
\param{wxDouble
}{y2
}}
286 Strokes a single line.
288 \membersection{wxGraphicsContext::StrokeLines
}\label{wxgraphicscontextstrokelines
}
290 \func{void
}{StrokeLines
}{\param{size
\_t }{n
},
\param{const wxPoint2DDouble*
}{beginPoints
},
\param{const wxPoint2DDouble*
}{endPoints
}}
292 \func{void
}{StrokeLines
}{\param{size
\_t }{n
},
\param{const wxPoint2DDouble*
}{points
}}
294 Stroke disconnected lines from begin to end points, fastest method available for this purpose.