| 1 |
|
| 2 |
@c %start of fragment |
| 3 |
|
| 4 |
@node Recording Surfaces |
| 5 |
@chapter Recording Surfaces |
| 6 |
Records all drawing operations |
| 7 |
|
| 8 |
@section Overview |
| 9 |
A recording surface is a surface that records all drawing operations at |
| 10 |
the highest level of the surface backend interface, (that is, the level |
| 11 |
of paint, mask, stroke, fill, and show_text_glyphs). The recording |
| 12 |
surface can then be "replayed" against any target surface by using it as |
| 13 |
a source surface. |
| 14 |
|
| 15 |
If you want to replay a surface so that the results in target will be |
| 16 |
identical to the results that would have been obtained if the original |
| 17 |
operations applied to the recording surface had instead been applied to |
| 18 |
the target surface, you can use code like this: |
| 19 |
|
| 20 |
@example |
| 21 |
|
| 22 |
cairo_t *cr; |
| 23 |
|
| 24 |
cr = cairo_create (target); |
| 25 |
cairo_set_source_surface (cr, recording_surface, 0.0, 0.0); |
| 26 |
cairo_paint (cr); |
| 27 |
cairo_destroy (cr); |
| 28 |
@end example |
| 29 |
|
| 30 |
A recording surface is logically unbounded, i.e. it has no implicit |
| 31 |
constraint on the size of the drawing surface. However, in practice this |
| 32 |
is rarely useful as you wish to replay against a particular target |
| 33 |
surface with known bounds. For this case, it is more efficient to |
| 34 |
specify the target extents to the recording surface upon creation. |
| 35 |
|
| 36 |
The recording phase of the recording surface is careful to snapshot all |
| 37 |
necessary objects (paths, patterns, etc.), in order to achieve accurate |
| 38 |
replay. The efficiency of the recording surface could be improved by |
| 39 |
improving the implementation of snapshot for the various objects. For |
| 40 |
example, it would be nice to have a copy-on-write implementation for |
| 41 |
_cairo_surface_snapshot. |
| 42 |
|
| 43 |
@section Usage |
| 44 |
@include defuns-cairo-recording.xml.texi |
| 45 |
|
| 46 |
@c %end of fragment |