SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Public Member Functions
CW::ImageRep Class Reference

Public Member Functions

 ImageRep ()
 
 ImageRep (SUImageRepRef image_rep, bool attached=true)
 
 ImageRep (const ImageRep &other)
 
 ~ImageRep ()
 
ImageRepoperator= (const ImageRep &other)
 
bool operator! () const
 
SUImageRepRef ref () const
 
 operator SUImageRepRef () const
 
 operator SUImageRepRef * ()
 
ImageRep copy () const
 
void set_data (size_t width, size_t height, size_t bits_per_pixel, size_t row_padding, std::vector< SUByte > pixel_data)
 
void load_file (const std::string file_path)
 
SUResult save_to_file (const std::string file_path) const
 
size_t width () const
 
size_t height () const
 
size_t row_padding () const
 
void resize (size_t width, size_t height)
 
void convert_to_32bits ()
 
size_t data_size () const
 
size_t bits_per_pixel () const
 
std::vector< SUByte > pixel_data () const
 

Detailed Description

Definition at line 46 of file ImageRep.hpp.

Constructor & Destructor Documentation

CW::ImageRep::ImageRep ( )

Constructor for null ImageRep value

Definition at line 54 of file ImageRep.cpp.

CW::ImageRep::ImageRep ( SUImageRepRef  image_rep,
bool  attached = true 
)

Construct ImageRep from existing ImageRep object

Definition at line 59 of file ImageRep.cpp.

CW::ImageRep::ImageRep ( const ImageRep other)

Copy constructor

Definition at line 65 of file ImageRep.cpp.

CW::ImageRep::~ImageRep ( )

Destructor

Definition at line 70 of file ImageRep.cpp.

Member Function Documentation

size_t CW::ImageRep::bits_per_pixel ( ) const

Returns the number of bits per pixel in the image.

Definition at line 238 of file ImageRep.cpp.

void CW::ImageRep::convert_to_32bits ( )

Converts the image to 32 bits per pixel.

Definition at line 214 of file ImageRep.cpp.

ImageRep CW::ImageRep::copy ( ) const

Returns a duplicate ImgaeRep object

Definition at line 109 of file ImageRep.cpp.

size_t CW::ImageRep::data_size ( ) const

Returns the total size and bits-per-pixel value of an image. This function is useful to determine the size of the buffer necessary to be passed into SUImageRepGetData. The returned data can be used along with the returned bits-per-pixel value and the image dimensions to compute RGBA values at individual pixels of the image.

Definition at line 226 of file ImageRep.cpp.

size_t CW::ImageRep::height ( ) const

Returns the width of the image in pixels.

Definition at line 179 of file ImageRep.cpp.

void CW::ImageRep::load_file ( const std::string  file_path)

Loads an image from a file path.

Parameters
file_path- string path to the file.

Definition at line 139 of file ImageRep.cpp.

bool CW::ImageRep::operator! ( ) const

Returns whether this is a valid object.

Definition at line 89 of file ImageRep.cpp.

ImageRep & CW::ImageRep::operator= ( const ImageRep other)

Copy assignment operator

Definition at line 78 of file ImageRep.cpp.

std::vector< SUByte > CW::ImageRep::pixel_data ( ) const

Returns the pixel data for an image.

Definition at line 250 of file ImageRep.cpp.

void CW::ImageRep::resize ( size_t  width,
size_t  height 
)

Resizes the width and height of the ImageRep

Definition at line 202 of file ImageRep.cpp.

size_t CW::ImageRep::row_padding ( ) const

Returns the row padding in pixels.

Definition at line 191 of file ImageRep.cpp.

SUResult CW::ImageRep::save_to_file ( const std::string  file_path) const

Saves the image to a file location.

Definition at line 151 of file ImageRep.cpp.

void CW::ImageRep::set_data ( size_t  width,
size_t  height,
size_t  bits_per_pixel,
size_t  row_padding,
std::vector< SUByte >  pixel_data 
)

Sets the image data for the given image. Makes a copy of the data rather than taking ownership.

Definition at line 122 of file ImageRep.cpp.

size_t CW::ImageRep::width ( ) const

Returns the width of the image in pixels.

Definition at line 167 of file ImageRep.cpp.


The documentation for this class was generated from the following files: