Class: Vips::Target
- Inherits:
-
Connection
- Object
- GObject::GObject
- Object
- Connection
- Vips::Target
- Defined in:
- lib/vips/target.rb
Overview
A target. For example:
target = Vips::Target.new_to_file('k2.jpg')
image.write_to_target(target, '.jpg')
Direct Known Subclasses
Defined Under Namespace
Modules: TargetLayout Classes: ManagedStruct, Struct
Instance Attribute Summary
Attributes inherited from GObject::GObject
Class Method Summary collapse
-
.new_to_descriptor(descriptor) ⇒ Target
Create a new target to a file descriptor.
-
.new_to_file(filename) ⇒ Target
Create a new target to a file name.
-
.new_to_memory ⇒ Target
Create a new target to an area of memory.
Methods inherited from Connection
Methods inherited from Object
#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect
Methods inherited from GObject::GObject
ffi_managed_struct, #ffi_managed_struct, #ffi_struct, ffi_struct, #initialize
Constructor Details
This class inherits a constructor from GObject::GObject
Class Method Details
.new_to_descriptor(descriptor) ⇒ Target
Create a new target to a file descriptor. File descriptors are small integers, for example 1 is stdout.
Pass targets to Image#write_to_target to write images to them.
49 50 51 52 53 54 |
# File 'lib/vips/target.rb', line 49 def self.new_to_descriptor(descriptor) ptr = Vips.vips_target_new_to_descriptor descriptor raise Vips::Error if ptr.null? Vips::Target.new ptr end |
.new_to_file(filename) ⇒ Target
Create a new target to a file name.
Pass targets to Image#write_to_target to write images to them.
63 64 65 66 67 68 69 |
# File 'lib/vips/target.rb', line 63 def self.new_to_file(filename) raise Vips::Error, "filename is nil" if filename.nil? ptr = Vips.vips_target_new_to_file filename raise Vips::Error if ptr.null? Vips::Target.new ptr end |
.new_to_memory ⇒ Target
Create a new target to an area of memory.
Pass targets to Image#write_to_target to write images to them.
Once the image has been written, use Object#get("blob")
to read out
the data.
80 81 82 83 84 |
# File 'lib/vips/target.rb', line 80 def self.new_to_memory ptr = Vips.vips_target_new_to_memory Vips::Target.new ptr end |