Confirmed users
166
edits
m (→Draw targets) |
|||
| Line 89: | Line 89: | ||
=== Draw targets === | === Draw targets === | ||
A draw target performs drawing operations on some backing store (e.g. a D3D texture or other buffer). | A draw target performs drawing operations on some backing store (e.g. a D3D texture or other buffer). | ||
Includes methods such as the following: | |||
* FillRect | * <code>FillRect</code> | ||
* Fill | * <code>Fill</code> | ||
* <code>StrokeRect</code> | |||
* <code>StrokeLine</code> | |||
* <code>Stroke</code> | |||
* … | * … | ||
* PushClip | |||
* PushClipRect | The following methods are stateful: | ||
* PopClip | |||
* SetTransform | * <code>PushClip</code> | ||
* <code>PushClipRect</code> | |||
* <code>PopClip</code> | |||
* <code>SetTransform</code> | |||
Typically the arguments to draw commands take the following order: | Typically the arguments to draw commands take the following order: | ||
# | # <shape> (Rect / Path) — the exceptions are FillGlyph and DrawSurface | ||
# Pattern | # A Pattern object that describes the source for filling/stroking | ||
# A DrawOptions object (alpha, comp-op, anti-aliasing, snapping etc.) | # A DrawOptions object (alpha, comp-op, anti-aliasing, snapping etc.) | ||
# Call-specific draw options | # Call-specific draw options | ||
CreatePathBuilder | To draw paths, we create a <code>PathBuilder</code> for a DrawTarget using <code>CreatePathBuilder</code>. The <code>PathBuilder</code> has methods such as: | ||
* <code>MoveTo</code> | |||
* <code>LineTo</code> | |||
* … | |||
Finally, calling <code>Finish</code> returns a <code>Path</code> that can be used for drawing (e.g. with <code>Fill</code> or <code>Stroke</code>). After calling <code>Finish</code> the <code>PathBuilder</code> cannot be used again! | |||
ColorPattern | <div style="background: #ffc"> | ||
SurfacePattern | TODO: Write this part | ||
LinearGradientPattern | * ColorPattern | ||
RadialGradientPattern | * SurfacePattern | ||
* LinearGradientPattern | |||
* RadialGradientPattern | |||
(These are all not-refcounted, but usually stack-based) | (These are all not-refcounted, but usually stack-based) | ||
</div> | </div> | ||