Class: TinyGLTF::Image
- Inherits:
-
Object
- Object
- TinyGLTF::Image
- Includes:
- Base
- Defined in:
- lib/tiny_gltf.rb,
ext/tiny_gltf/rb_tiny_gltf_init.c
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
- #buffer_view ⇒ Object
-
#initialize(model = nil, name: nil, width: nil, height: nil, components: nil, buffer_view_index: nil, mime_type: nil, uri: nil, extras: nil, extensions: nil) ⇒ Image
constructor
A new instance of Image.
-
#size ⇒ Object
Returns the size of the image data in bytes.
-
#to_ptr ⇒ Object
Returns a Fiddle::Pointer representing the start of the image data in memory.
-
#to_s ⇒ Object
Returns a string containing the raw image data.
-
#uri ⇒ Object
Returns the URI from which this data was retrieved, if available.
- #uri= ⇒ Object
Methods included from Base
included, #inspect, #to_h, #to_json
Constructor Details
#initialize(model = nil, name: nil, width: nil, height: nil, components: nil, buffer_view_index: nil, mime_type: nil, uri: nil, extras: nil, extensions: nil) ⇒ Image
Returns a new instance of Image.
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/tiny_gltf.rb', line 306 def initialize(model = nil, name: nil, width: nil, height: nil, components: nil, buffer_view_index: nil, mime_type: nil, uri: nil, extras: nil, extensions: nil) @model = model @name = name @width = width @height = height @components = components @buffer_view_index = buffer_view_index @mime_type = mime_type @extras = extras @extensions = extensions self.uri = uri if uri end |
Instance Method Details
#buffer_view ⇒ Object
328 329 330 |
# File 'lib/tiny_gltf.rb', line 328 def buffer_view buffer_view_index && model.buffer_views[buffer_view_index] end |
#size ⇒ Object
Returns the size of the image data in bytes.
#to_ptr ⇒ Object
Returns a Fiddle::Pointer representing the start of the image data in memory. For performance, try to use this rather than #to_s.
#to_s ⇒ Object
Returns a string containing the raw image data. For better performance, prefer #to_ptr where possible.
#uri ⇒ Object
Returns the URI from which this data was retrieved, if available. Returns
nil
if a URI was not used.