Class: Quartz::ImageSource
- Inherits:
-
Object
- Object
- Quartz::ImageSource
- Defined in:
- lib/rubyquartz/image_source.rb,
ext/image_source.c
Class Method Summary collapse
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(options) ⇒ ImageSource
constructor
A new instance of ImageSource.
- #size ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(options) ⇒ ImageSource
Returns a new instance of ImageSource.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rubyquartz/image_source.rb', line 29 def initialize() path = [:path] if path _initialize_with_path(path) return end if data = [:data] _initialize_with_data(data) return end # TODO: Add various other creation types raise "Cannot determine how to create image from given options" end |
Class Method Details
.name_for_type_identifier(type_value) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'ext/image_source.c', line 94 static VALUE image_source_name_for_type_identifier(VALUE self, VALUE type_value) { CFStringRef type = _copy_string_for_str(type_value); CFStringRef name = UTTypeCopyDescription(type); CFRelease(type); if (!name) rb_raise(rb_eException, "No name available for type"); VALUE result = _value_for_string(name); CFRelease(name); return result; } |
.type_identifiers ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'ext/image_source.c', line 77 static VALUE image_source_get_type_identifiers(VALUE self) { CFArrayRef typeIdentifiers = CGImageSourceCopyTypeIdentifiers(); CFIndex typeIdentifierIndex = CFArrayGetCount(typeIdentifiers); VALUE strings = rb_ary_new(); while (typeIdentifierIndex--) { CFStringRef typeIdentifier = CFArrayGetValueAtIndex(typeIdentifiers, typeIdentifierIndex); VALUE str = _value_for_string(typeIdentifier); rb_ary_unshift(strings, str); } CFRelease(typeIdentifiers); return strings; } |
Instance Method Details
#[](index) ⇒ Object
46 47 48 |
# File 'lib/rubyquartz/image_source.rb', line 46 def[](index) Image.new(:image_source => self, :index => index) end |
#size ⇒ Object
113 114 115 116 |
# File 'ext/image_source.c', line 113 static VALUE image_source_get_count(VALUE self) { return INT2NUM(CGImageSourceGetCount(image_source_get(self))); } |
#type ⇒ Object
108 109 110 111 |
# File 'ext/image_source.c', line 108 static VALUE image_source_get_type(VALUE self) { return _value_for_string(CGImageSourceGetType(image_source_get(self))); } |