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