java.lang.Object
io.github.jwharm.cairobindings.Proxy
org.freedesktop.cairo.Surface
org.freedesktop.cairo.SurfaceObserver
- All Implemented Interfaces:
AutoCloseable
A surface that exists solely to watch what another surface is doing.
- See Also:
-
Constructor Summary
ConstructorDescriptionSurfaceObserver
(MemorySegment address) Constructor used internally to instantiate a java SurfaceObserver object for a nativecairo_surface_t
instance -
Method Summary
Modifier and TypeMethodDescriptionAdds a callback for fill operations on the observed surface.Adds a callback for finish operations on the observed surface.Adds a callback for flush operations on the observed surface.Adds a callback for glyph operations on the observed surface.Adds a callback for mask operations on the observed surface.Adds a callback for paint operations on the observed surface.Adds a callback for stroke operations on the observed surface.static SurfaceObserver
create
(Surface target, SurfaceObserverMode mode) Create a new surface that exists solely to watch another is doing.double
elapsed()
Returns the total observation time.void
Prints the observer log using the given callback.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
-
SurfaceObserver
Constructor used internally to instantiate a java SurfaceObserver object for a nativecairo_surface_t
instance- Parameters:
address
- the memory address of the nativecairo_surface_t
instance
-
-
Method Details
-
create
Create a new surface that exists solely to watch another is doing. In the process it will log operations and times, which are fast, which are slow, which are frequent, etc.The mode parameter can be set to either
SurfaceObserverMode.NORMAL
orSurfaceObserverMode.RECORD_OPERATIONS
, to control whether or not the internal observer should record operations.- Parameters:
target
- an existing surface for which the observer will watchmode
- sets the mode of operation (normal vs. record)- Returns:
- the newly allocated surface
- Since:
- 1.12
-
addFillCallback
Adds a callback for fill operations on the observed surface.- Parameters:
func
- callback function for fill operations- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
addFinishCallback
Adds a callback for finish operations on the observed surface.- Parameters:
func
- callback function for the finish operation- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
addFlushCallback
Adds a callback for flush operations on the observed surface.- Parameters:
func
- callback for flush operations- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
addGlyphsCallback
Adds a callback for glyph operations on the observed surface.- Parameters:
func
- callback function for glyph operations- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
addMaskCallback
Adds a callback for mask operations on the observed surface.- Parameters:
func
- callback function for mask operations- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
addPaintCallback
Adds a callback for paint operations on the observed surface.- Parameters:
func
- callback function for paint operations- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
addStrokeCallback
Adds a callback for stroke operations on the observed surface.- Parameters:
func
- callback function for stroke operations- Returns:
- this SurfaceObserver
- Since:
- 1.12
-
elapsed
public double elapsed()Returns the total observation time.- Returns:
- the elapsed time, in nanoseconds
- Since:
- 1.12
-
print
Prints the observer log using the given callback.- Parameters:
writeFunc
- callback for writing on a stream- Since:
- 1.12
-