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
}
21 \wxheading{Include files
}
25 \latexignore{\rtfignore{\wxheading{Members
}}}
27 \membersection{wxGraphicsContext::Create
}\label{wxgraphicscontextcreate
}
29 \func{wxGraphicsContext*
}{Create
}{\param{const wxWindowDC\&
}{dc
}}
31 Creates a wxGraphicsContext from a wxWindowDC (eg a wxPaintDC).
33 \func{wxGraphicsContext*
}{Create
}{\param{wxWindow*
}{window
}}
35 Creates a wxGraphicsContext from a wxWindow.
39 \helpref{wxGraphicsRenderer:: CreateContext
}{wxgraphicsrenderercreatecontext
}
41 \membersection{wxGraphicsContext::CreateFromNative
}\label{wxgraphicscontextcreatefromnative
}
43 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
44 cairo
\_t pointer for cairo.
46 \func{wxGraphicsContext*
}{CreateFromNative
}{\param{void *
}{context
}}
48 Creates a wxGraphicsContext from a native window.
52 \helpref{wxGraphicsRenderer:: CreateContextFromNativeContext
}{wxgraphicsrenderercreatecontextfromnativecontext
}
54 \membersection{wxGraphicsContext::CreateFromNativeWindow
}\label{wxgraphicscontextcreatefromnativewindow
}
56 \func{wxGraphicsContext*
}{CreateFromNativeWindow
}{\param{void *
}{window
}}
60 \helpref{wxGraphicsRenderer:: CreateContextFromNativeWindow
}{wxgraphicsrenderercreatecontextfromnativewindow
}
62 \membersection{wxGraphicsContext::CreatePen
}\label{wxgraphicscontextcreatepen
}
64 \constfunc{wxGraphicsPen
}{CreatePen
}{\param{const wxPen\&
}{pen
}}
66 Creates a native pen from a wxPen.
68 \membersection{wxGraphicsContext::CreateBrush
}\label{wxgraphicscontextcreatebrush
}
70 \constfunc{wxGraphicsBrush
}{CreateBrush
}{\param{const wxBrush\&
}{brush
}}
72 Creates a native brush from a wxBrush.
74 \membersection{wxGraphicsContext::CreateRadialGradientBrush
}\label{wxgraphicscontextcreateradialgradientbrush
}
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
}}
79 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
81 \membersection{wxGraphicsContext::CreateLinearGradientBrush
}\label{wxgraphicscontextcreatelineargradientbrush
}
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
}}
86 Creates a native brush, having a linear gradient, starting at (x1,y1) with
color c1 to (x2,y2) with
color c2
88 \membersection{wxGraphicsContext::CreateFont
}\label{wxgraphicscontextcreatefont
}
90 \constfunc{wxGraphicsFont
}{CreateFont
}{\param{const wxFont\&
}{font
},
\param{const wxColour\&
}{col = *wxBLACK
}}
92 Creates a native graphics font from a wxFont and a text colour.
94 \membersection{wxGraphicsContext::CreateMatrix
}\label{wxgraphicscontextcreatematrix
}
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}}
99 Creates a native affine transformation matrix from the passed in values. The defaults result in an identity matrix.
101 \membersection{wxGraphicsContext::CreatePath
}\label{wxgraphicscontextcreatepath
}
103 \constfunc{wxGraphicsPath
}{CreatePath
}{\void}
105 Creates a native graphics path which is initially empty.
107 \membersection{wxGraphicsContext::Clip
}\label{wxgraphicscontextclip
}
109 \func{void
}{Clip
}{\param{const wxRegion\&
}{region
}}
111 Clips drawings to the region, combined to current clipping region
113 \func{void
}{Clip
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
115 Clips drawings to the rectangle.
117 \membersection{wxGraphicsContext::ResetClip
}\label{wxgraphicscontextresetclip
}
119 \func{void
}{ResetClip
}{\void}
121 Resets the clipping to original shape.
123 \membersection{wxGraphicsContext::DrawBitmap
}\label{wxgraphicscontextdrawbitmap
}
125 \func{void
}{DrawBitmap
}{\param{const wxBitmap\&
}{bmp
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
127 Draws the bitmap. In case of a mono bitmap, this is treated as a mask and the current brushed is used for filling.
129 \membersection{wxGraphicsContext::DrawEllipse
}\label{wxgraphicscontextdrawellipse
}
131 \func{void
}{DrawEllipse
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
135 \membersection{wxGraphicsContext::DrawIcon
}\label{wxgraphicscontextdrawicon
}
137 \func{void
}{DrawIcon
}{\param{const wxIcon\&
}{icon
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
142 \membersection{wxGraphicsContext::DrawLines
}\label{wxgraphicscontextdrawlines
}
144 \func{void
}{DrawLines
}{\param{size
\_t }{n
},
\param{const wxPoint2DDouble*
}{points
},
\param{int
}{fillStyle = wxODDEVEN
\_RULE}}
149 \membersection{wxGraphicsContext::DrawPath
}\label{wxgraphicscontextdrawpath
}
151 \func{void
}{DrawPath
}{\param{const wxGraphicsPath\&
}{path
},
\param{int
}{fillStyle = wxODDEVEN
\_RULE}}
153 Draws the path by first filling and then stroking.
156 \membersection{wxGraphicsContext::DrawRectangle
}\label{wxgraphicscontextdrawrectangle
}
158 \func{void
}{DrawRectangle
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
}}
163 \membersection{wxGraphicsContext::DrawRoundedRectangle
}\label{wxgraphicscontextdrawroundedrectangle
}
165 \func{void
}{DrawRoundedRectangle
}{\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{w
},
\param{wxDouble
}{h
},
\param{wxDouble
}{radius
}}
167 Draws a rounded rectangle.
169 \membersection{wxGraphicsContext::DrawText
}\label{wxgraphicscontextdrawtext
}
171 \func{void
}{DrawText
}{\param{const wxString\&
}{str
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
},
\param{wxDouble
}{angle
}}
173 \func{void
}{DrawText
}{\param{const wxString\&
}{str
},
\param{wxDouble
}{x
},
\param{wxDouble
}{y
}}
175 Draws a text at the defined position, at the given angle.
177 \membersection{wxGraphicsContext::FillPath
}\label{wxgraphicscontextfillpath
}
179 \func{void
}{FillPath
}{\param{const wxGraphicsPath\&
}{path
},
\param{int
}{fillStyle = wxODDEVEN
\_RULE}}
181 Fills the path with the current brush.
183 \membersection{wxGraphicsContext::StrokePath
}\label{wxgraphicscontextstrokepath
}
185 \func{void
}{StrokePath
}{\param{const wxGraphicsPath\&
}{path
}}
187 Strokes along a path with the current pen.
190 \membersection{wxGraphicsContext::GetNativeContext
}\label{wxgraphicscontextgetnativecontext
}
192 \func{void *
}{GetNativeContext
}{\void}
194 Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo
\_t pointer for cairo).
196 \membersection{wxGraphicsContext::GetPartialTextExtents
}\label{wxgraphicscontextgetpartialtextextents
}
198 \constfunc{void
}{GetPartialTextExtents
}{\param{const wxString\&
}{text
},
\param{wxArrayDouble\&
}{widths
}}
200 Fills the
{\it widths
} array with the widths from the beginning of
201 {\it text
} to the corresponding character of
{\it text
}.
203 \membersection{wxGraphicsContext::GetTextExtent
}\label{wxgraphicscontextgettextextent
}
205 \constfunc{void
}{GetTextExtent
}{\param{const wxString\&
}{text
},
\param{wxDouble*
}{width
},
\param{wxDouble*
}{height
},
\param{wxDouble*
}{descent
},
206 \param{wxDouble*
}{externalLeading
}}
208 Gets 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
210 the total width and height respectively,
{\it descent
} is the
211 dimension from the baseline of the font to the bottom of the
212 descender, and
{\it externalLeading
} is any extra vertical space added
213 to the font by the font designer (usually is zero).
215 \membersection{wxGraphicsContext::Rotate
}\label{wxgraphicscontextrotate
}
217 \func{void
}{Rotate
}{\param{wxDouble
}{angle
}}
219 Rotates the current transformation matrix (radians),
221 \membersection{wxGraphicsContext::Scale
}\label{wxgraphicscontextscale
}
223 \func{void
}{Scale
}{\param{wxDouble
}{xScale
},
\param{wxDouble
}{yScale
}}
225 Scales the current transformation matrix.
227 \membersection{wxGraphicsContext::Translate
}\label{wxgraphicscontexttranslate
}
229 \func{void
}{Translate
}{\param{wxDouble
}{dx
},
\param{wxDouble
}{dy
}}
231 Translates the current transformation matrix.
233 \membersection{wxGraphicsContext::GetTransform
}\label{wxgraphicscontextgettransform
}
235 \constfunc{wxGraphicsMatrix
}{GetTransform
}{\void}
237 Gets the current transformation matrix of this context.
239 \membersection{wxGraphicsContext::SetTransform
}\label{wxgraphicscontextsettransform
}
241 \func{void
}{SetTransform
}{\param{const wxGraphicsMatrix\&
}{matrix
}}
243 Sets the current transformation matrix of this context
245 \membersection{wxGraphicsContext::ConcatTransform
}\label{wxgraphicscontextconcattransform
}
247 \func{void
}{ConcatTransform
}{\param{const wxGraphicsMatrix\&
}{matrix
}}
249 Concatenates the passed in transform with the current transform of this context
251 \membersection{wxGraphicsContext::SetBrush
}\label{wxgraphicscontextsetbrush
}
253 \func{void
}{SetBrush
}{\param{const wxBrush\&
}{brush
}}
255 \func{void
}{SetBrush
}{\param{const wxGraphicsBrush\&
}{brush
}}
257 Sets the brush for filling paths.
259 \membersection{wxGraphicsContext::SetFont
}\label{wxgraphicscontextsetfont
}
261 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
},
\param{const wxColour\&
}{colour
}}
264 \func{void
}{SetFont
}{\param{const wxGraphicsFont\&
}{font
}}
266 Sets the font for drawing text.
269 \membersection{wxGraphicsContext::SetPen
}\label{wxgraphicscontextsetpen
}
271 \func{void
}{SetPen
}{\param{const wxGraphicsPen\&
}{pen
}}
273 \func{void
}{SetPen
}{\param{const wxPen\&
}{pen
}}
275 Sets the pen used for stroking.
277 \membersection{wxGraphicsContext::StrokeLine
}\label{wxgraphicscontextstrokeline
}
279 \func{void
}{StrokeLine
}{\param{wxDouble
}{x1
},
\param{wxDouble
}{y1
},
\param{wxDouble
}{x2
},
\param{wxDouble
}{y2
}}
281 Strokes a single line.
283 \membersection{wxGraphicsContext::StrokeLines
}\label{wxgraphicscontextstrokelines
}
285 \func{void
}{StrokeLines
}{\param{size
\_t }{n
},
\param{const wxPoint2DDouble*
}{beginPoints
},
\param{const wxPoint2DDouble*
}{endPoints
}}
287 \func{void
}{StrokeLines
}{\param{size
\_t }{n
},
\param{const wxPoint2DDouble*
}{points
}}
289 Stroke disconnected lines from begin to end points, fastest method available for this purpose.