- All Implemented Interfaces:
AutoCloseable
A recording surface is a surface that records all drawing operations at the
highest level of the surface backend interface, (that is, the level of
paint
, mask
, stroke
, fill
, and
showTextGlyphs
). The recording surface can then be "replayed" against
any target surface by using it as a source surface.
If you want to replay a surface so that the results in target will be identical to the results that would have been obtained if the original operations applied to the recording surface had instead been applied to the target surface, you can use code like this:
Context cr = Context.create(target); cr.setSourceSurface(recordingSurface, 0.0, 0.0); cr.paint();A recording surface is logically unbounded, i.e. it has no implicit constraint on the size of the drawing surface. However, in practice this is rarely useful as you wish to replay against a particular target surface with known bounds. For this case, it is more efficient to specify the target extents to the recording surface upon creation.
The recording phase of the recording surface is careful to snapshot all necessary objects (paths, patterns, etc.), in order to achieve accurate replay.
- See Also:
-
Constructor Summary
ConstructorDescriptionRecordingSurface
(MemorySegment address) Constructor used internally to instantiate a java RecordingSurface object for a nativecairo_surface_t
instance -
Method Summary
Modifier and TypeMethodDescriptionstatic RecordingSurface
Creates a recording-surface which can be used to record all drawing operations at the highest level (that is, the level ofpaint
,mask
,stroke
,fill
, andshowTextGlyphs
).void
getExtents
(Rectangle extents) Get the extents of the recording-surface.Measures the extents of the operations stored within the recording-surface.Methods inherited from class org.freedesktop.cairo.Surface
close, copyPage, createForRectangle, createSimilar, createSimilarImage, destroy, finish, flush, getContent, getDevice, getDeviceOffset, getDeviceScale, getFallbackResolution, getFontOptions, getMimeData, getSurfaceType, getType, getUserData, hasShowTextGlyphs, mapToImage, markDirty, markDirtyRectangle, setDeviceOffset, setDeviceScale, setFallbackResolution, setMimeData, setUserData, showPage, status, supportsMimeType, unmapImage
-
Constructor Details
-
RecordingSurface
Constructor used internally to instantiate a java RecordingSurface object for a nativecairo_surface_t
instance- Parameters:
address
- the memory address of the nativecairo_surface_t
instance
-
-
Method Details
-
create
Creates a recording-surface which can be used to record all drawing operations at the highest level (that is, the level ofpaint
,mask
,stroke
,fill
, andshowTextGlyphs
). The recording surface can then be "replayed" against any target surface by using it as a source to drawing operations.The recording phase of the recording surface is careful to snapshot all necessary objects (paths, patterns, etc.), in order to achieve accurate replay.
- Parameters:
content
- the content of the recording surfaceextents
- the extents to record in pixels, can benull
to record unbounded operations.- Returns:
- the newly created surface
- Since:
- 1.10
-
inkExtents
Measures the extents of the operations stored within the recording-surface. This is useful to compute the required size of an image surface (or equivalent) into which to replay the full sequence of drawing operations.- Returns:
- a rectangle with the x- and y-coordinates of the top-left, the width and the height of the ink bounding box
- Since:
- 1.10
-
getExtents
Get the extents of the recording-surface.- Parameters:
extents
- the Rectangle to be assigned the extents- Throws:
IllegalStateException
- if the surface is not bounded, or in an error state- Since:
- 1.12
-