Platform/GFX/Moz2D: Difference between revisions

Jump to navigation Jump to search
m
Line 89: Line 89:
=== Draw targets ===
=== Draw targets ===


<span style="background:yellow">TBD (currently just note form)</span>
<div style="background:#ffd">
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).


DrawTarget:
Includes methods such as the following:


* FillRect
* <code>FillRect</code>
* Fill
* <code>Fill</code>
* <code>StrokeRect</code>
* <code>StrokeLine</code>
* <code>Stroke</code>
* &hellip;
* &hellip;
* PushClip (Stateful)
 
* PushClipRect (Stateful)
The following methods are stateful:
* PopClip (Stateful)
 
* SetTransform (Stateful)
* <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
# &lt;shape&gt; (Rect / Path) &mdash; 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:


PathBuilder:
* <code>MoveTo</code>
* <code>LineTo</code>
* &hellip;


* MoveTo
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!
* LineTo
* &hellip;
* Finish: Path – cannot re-use a PathBuilder after calling Finish


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)
Draw commands
* Shape (Rect / Path)
* Pattern
</div>
</div>


Confirmed users
166

edits

Navigation menu