Class: Sketchup::ImageRep
- Inherits:
-
Object
- Object
- Sketchup::ImageRep
Overview
References an image representation object.
Instance Method Summary # collapse
-
#bits_per_pixel ⇒ Integer
The #bits_per_pixel method gets the number of bits per pixel in the image.
-
#color_at_uv(u, v, bilinear = false) ⇒ Sketchup::Color?
The #color_at_uv method returns a color corresponding to the UV texture coordinates.
- #colors ⇒ Array<Sketchup::Color>?
-
#data ⇒ String?
The #data method gets the pixel data for an image in a string of bytes.
-
#height ⇒ Integer
The #height method returns the height of an image.
-
#initialize(*args) ⇒ Sketchup::ImageRep
constructor
The #initialize method creates a new image object.
-
#load_file(filepath) ⇒ Object
The #load_file method loads image data from the specified file.
-
#row_padding ⇒ Integer
The #row_padding method returns the size of the row padding of an image in bytes.
-
#save_file(filepath) ⇒ Object
The #save_file method saves an image data object to an image file specified by a path.
- #set_data(width, height, bits_per_pixel, row_padding, pixel_data) ⇒ Sketchup::ImageRep
-
#size ⇒ Integer
The #size method gets the total size of the image data in bytes.
-
#width ⇒ Integer
The #width method returns the width of an image.
Constructor Details
↑ #initialize ⇒ Sketchup::ImageRep #initialize(filepath) ⇒ Sketchup::ImageRep
The #initialize method creates a new image object. The image object will have no data if a path to the image is not provided.
Instance Method Details
↑ #bits_per_pixel ⇒ Integer
The #bits_per_pixel method gets the number of bits per pixel in the image.
↑ #color_at_uv(u, v, bilinear = false) ⇒ Sketchup::Color?
The #color_at_uv method returns a color corresponding to the UV texture coordinates. 0.0, 0.0 maps to the bottom left and 1.0, 1.0 to the top right of the image.
↑ #colors ⇒ Array<Sketchup::Color>?
↑ #data ⇒ String?
The byte order of the pixels are RGB(A) on macOS and BGR(A) on Windows.
The #data method gets the pixel data for an image in a string of bytes.
↑ #load_file(filepath) ⇒ Object
The #load_file method loads image data from the specified file.
↑ #row_padding ⇒ Integer
The #row_padding method returns the size of the row padding of an image in bytes.
↑ #save_file(filepath) ⇒ Object
The #save_file method saves an image data object to an image file specified by a path.
↑ #set_data(width, height, bits_per_pixel, row_padding, pixel_data) ⇒ Sketchup::ImageRep
The byte order of the pixels are RGB(A) on macOS and BGR(A) on Windows.
The encoding of the pixel_data String parameter should be ASCII-8BIT. Any other encoding could corrupt the binary data. Using `Array#pack(“C*”)` gives correct encoding.
The #set_data method discards any existing data and sets new pixel data for the Sketchup::ImageRep.