Class: Sketchup::ImageRep
| Relationships | |
| Inherits: | Object | 
Overview
References an image representation object.
Class Method Summary
- 
    
      .new  ⇒ Sketchup::ImageRep 
    
    constructor
    The #initializemethod creates a new image object.
Instance Method Summary
- 
    
      #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. 
- 
    
      #load_file(filepath)  
    
    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)  
    
    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 #set_data method discards any existing data and sets new pixel data for the 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
    
      .new  ⇒ ImageRep 
      .new(filepath)  ⇒ ImageRep 
    
  
ImageRep 
      .new(filepath)  ⇒ 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>?
The #colors method returns an array of Color for each pixel in the image.
#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.
    #height  ⇒ Integer 
  
The #height method returns the height of an image.
#load_file(filepath)
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)
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)  ⇒ 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 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.