class Cairo::Script
- Cairo::Script
- Cairo::Device
- Reference
- Object
Overview
The script surface provides the ability to render to a native script that matches the cairo drawing model. The scripts can be replayed using tools under the util/cairo-script directory, or with cairo-perf-trace.
Defined in:
cairo/script.crConstructors
-
.new(write_func : LibCairo::WriteFuncT, closure : Pointer(Void))
Creates a output device for emitting the script, used when creating the individual surfaces.
-
.new(filename : String)
Creates a output device for emitting the script, used when creating the individual surfaces.
Instance Method Summary
-
#create_script_surface(content : Content, width : Float64, height : Float64) : Surface
Create a new surface that will emit its rendering through script.
-
#create_script_surface_for_target(target : Surface) : Surface
Create a pxoy surface that will render to target and record the operations to device.
-
#from_recording_surface(recording_surface : Surface) : Status
Converts the record operations in recording_surface into a script.
-
#mode : ScriptMode
Queries the script for its current output mode.
-
#mode=(mode : ScriptMode)
Change the output mode of the script.
-
#write_comment(comment : String, len : Int32 = -1)
Emit a string verbatim into the script.
Instance methods inherited from class Cairo::Device
acquire : Status
acquire,
finalize
finalize,
finish
finish,
flush
flush,
observer_elapsed : Float64
observer_elapsed,
observer_fill_elapsed : Float64
observer_fill_elapsed,
observer_glyphs_elapsed : Float64
observer_glyphs_elapsed,
observer_mask_elapsed : Float64
observer_mask_elapsed,
observer_paint_elapsed : Float64
observer_paint_elapsed,
observer_print(write_func : LibCairo::WriteFuncT, closure : Pointer(Void)) : Status
observer_print,
observer_stroke_elapsed : Float64
observer_stroke_elapsed,
reference : Device
reference,
reference_count : UInt32
reference_count,
release
release,
set_user_data(key : UserDataKey, user_data : Pointer(Void), destroy : LibCairo::DestroyFuncT) : Status
set_user_data,
status : Status
status,
to_unsafe : LibCairo::PDeviceT
to_unsafe,
type : DeviceType
type,
user_data(key : UserDataKey) : Pointer(Void)
user_data
Constructor methods inherited from class Cairo::Device
new(device : LibCairo::PDeviceT)
new
Constructor Detail
Creates a output device for emitting the script, used when creating the individual surfaces.
###Parameters
- write_func callback function passed the bytes written to the script
- closure user data to be passed to the callback
###Returns
The newly created device. The caller owns the surface and
should call Script#finalze
when done with it.
This function always returns a valid pointer,
but it will return a pointer to a nil
device if an error such
as out of memory occurs. You can use Context#status
to check for this.
Creates a output device for emitting the script, used when creating the individual surfaces.
###Parameters
- filename the name (path) of the file to write the script to
###Returns
The newly created Script-Surface. The caller owns the surface
and should call Script#finalize
when done with it.
This function always returns a valid pointer,
but it will return a pointer to a nil
device if an error such
as out of memory occurs. You can use Context#status
to check for this.
Instance Method Detail
Create a new surface that will emit its rendering through script.
###Parameters
- content the content of the surface
- width width in pixels
- height height in pixels
###Returns
A pointer to the newly created Surface
. The caller owns the surface and
should call Surface#finalize
when done with it.
This function always returns a valid pointer, but it will return a pointer
to a nil
surface if an error such as out of memory occurs.
You can use Surface#status
to check for this.
Create a pxoy surface that will render to target and record the operations to device.
###Parameters
- target a target surface to wrap
###Returns
A pointer to the newly created Surface
. The caller owns the surface and
should call Surface#finalize
when done with it.
This function always returns a valid pointer, but it will return a pointer
to a nil
surface if an error such as out of memory occurs.
You can use Surface#status
to check for this.
Converts the record operations in recording_surface into a script.
###Parameters
- script the script (output device)
- recording_surface the recording surface to replay
###Returns
Status::Success
on successful completion or an error code.
Queries the script for its current output mode.
###Returns The current output mode of the script.
Change the output mode of the script.
###Parameters
- mode the new mode
Emit a string verbatim into the script.
###Parameters
- comment the string to emit
- len the length of the sting to write, or -1 to use
comment.size