SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
|
Public Member Functions | |
Texture () | |
Texture (SUTextureRef texture, bool attached=true) | |
Texture (const std::string file_path, double s_scale=1.0, double t_scale=1.0) | |
Texture (size_t width, size_t height, size_t bits_per_pixel, const SUByte pixel_data[]) | |
Texture (ImageRep &image) | |
Texture (const Texture &other) | |
~Texture () | |
Texture & | operator= (const Texture &other) |
SUTextureRef | ref () const |
operator SUTextureRef () const | |
operator SUTextureRef * () | |
Texture | copy () const |
bool | alpha_used () const |
ImageRep | image_rep () const |
String | file_name () const |
void | file_name (const String &string) const |
size_t | width () const |
size_t | height () const |
double | s_scale () const |
double | t_scale () const |
SUResult | save (const std::string &file_path) const |
![]() | |
Entity () | |
Constructor representing a null objject. | |
Entity (SUEntityRef entity, bool attached=true) | |
Creates a new Entity object. More... | |
Entity (const Entity &other, SUEntityRef entity_ref=SU_INVALID) | |
Copy constructor with an optional parameter for the entity reference. More... | |
~Entity () | |
Destructor. More... | |
Entity & | operator= (const Entity &other) |
Copy assignment operator. | |
operator SUEntityRef () const | |
operator SUEntityRef * () | |
SUEntityRef | ref () const |
bool | attached () const |
Returns true if the entity is attached to another object. | |
void | attached (bool attach) |
Method lets the object know that it has been attached to a model. This is important as it will let the object know that it does not need to "release" the object. More... | |
std::vector< AttributeDictionary > | attribute_dictionaries () const |
Returns the AttributeDictionaries collection attached to the entity. More... | |
AttributeDictionary | attribute_dictionary (const std::string &name) const |
Returns an attribute dictionary object with a given name that is attached to an Entity. More... | |
bool | add_dictionary (AttributeDictionary &dict) |
Adds the AttributeDictionary to the Entity. More... | |
bool | copy_attributes_from (const Entity &entity) |
Copies attributes from another Entity object to this one. More... | |
bool | is_valid () const |
Checks if the entity is valid. More... | |
bool | operator! () const |
Returns true if this entity is not valid. Alias of !is_valid(). | |
int32_t | entityID () const |
Retrieve a unique ID assigned to an entity. More... | |
TypedValue | get_attribute (const std::string &dict_name, const std::string &key, const TypedValue &default_value=TypedValue()) const |
Retrieves the value of an attribute in the entity's attribute dictionary. More... | |
TypedValue | get_attribute (const AttributeDictionary &dict, const std::string &key, const TypedValue &default_value=TypedValue()) const |
Retrieves the value of an attribute in the entity's attribute dictionary. More... | |
bool | set_attribute (const std::string &dict_name, const std::string &key, const TypedValue &value) |
Sets the value of an attribute in the given AttributeDictionary object. More... | |
bool | set_attribute (AttributeDictionary &dict, const std::string &key, const TypedValue &value) |
Sets the value of an attribute in the given AttributeDictionary object. More... | |
enum SURefType | entity_type () const |
Returns the type of the entity. See enum SURefType. | |
Model | model () const |
Entities | parent () const |
int64_t | persistent_id () const |
Additional Inherited Members | |
![]() | |
SUEntityRef | m_entity |
The C SUEntityRef that this class wraps. | |
bool | m_attached |
Indicates whether the Entity has been attached to a model. | |
Definition at line 46 of file Texture.hpp.
CW::Texture::Texture | ( | ) |
Constructor for null Texture value
Definition at line 69 of file Texture.cpp.
CW::Texture::Texture | ( | SUTextureRef | texture, |
bool | attached = true |
||
) |
Construct Texture from existing texture object
Definition at line 74 of file Texture.cpp.
CW::Texture::Texture | ( | const std::string | file_path, |
double | s_scale = 1.0 , |
||
double | t_scale = 1.0 |
||
) |
Creates a new texture object from an image file specified by a path.
file_path | - The file path of the source image file. Assumed to be UTF-8 encoded |
s_scale | - The scale factor for s coordinate value. |
t_scale | - The scale factor for t coordinate value. |
Definition at line 84 of file Texture.cpp.
CW::Texture::Texture | ( | size_t | width, |
size_t | height, | ||
size_t | bits_per_pixel, | ||
const SUByte | pixel_data[] | ||
) |
Creates a new texture object with the specified image data. This function is due to be depreciated - use Texture(ImageRep& image) instead from SU 2017, API 5.0 onwards.
width | - the width in pixels of the texture data |
height | - the height in pixels of the texture data |
bits_per_pixel | - the number of bits per pixel of the image data |
pixel_data[] | - the source of the pixel data |
CW::Texture::Texture | ( | ImageRep & | image | ) |
Creates a new texture object from an image representation object.
Definition at line 89 of file Texture.cpp.
CW::Texture::Texture | ( | const Texture & | other | ) |
Copy constructor
Definition at line 79 of file Texture.cpp.
CW::Texture::~Texture | ( | ) |
Destructor
Definition at line 94 of file Texture.cpp.
bool CW::Texture::alpha_used | ( | ) | const |
Returns whether the alpha channel is used by the texture image.
Definition at line 139 of file Texture.cpp.
Texture CW::Texture::copy | ( | ) | const |
Returns a copy of the texture object - note that a Texture object can only be assigned to one Material object. So this method is useful for copying Textures to new Material objects.
Definition at line 116 of file Texture.cpp.
String CW::Texture::file_name | ( | ) | const |
Returns the file name of the texture
Definition at line 163 of file Texture.cpp.
void CW::Texture::file_name | ( | const String & | string | ) | const |
Sets theimage file name associated with the texture object. If the input texture was constructed using SUTextureCreateFromFile the name will already be set, so calling this function will override the texture's file name string.
Definition at line 172 of file Texture.cpp.
size_t CW::Texture::height | ( | ) | const |
Returns the height of the texture in pixels.
Definition at line 193 of file Texture.cpp.
ImageRep CW::Texture::image_rep | ( | ) | const |
Returns the ImageRep object of the texture.
Definition at line 150 of file Texture.cpp.
Copy assignment operator
Definition at line 98 of file Texture.cpp.
double CW::Texture::s_scale | ( | ) | const |
Returns the s_scale of the texture. The s_scale and t_scale values are useful when a face doesn't have a material applied directly, but instead inherit from a parent group or component instance. Then you want use these values to multiply the result of SUMeshHelperGetFrontSTQCoords or SUUVHelperGetFrontUVQ. If the material is applied directly then this would not be needed.
Definition at line 207 of file Texture.cpp.
SUResult CW::Texture::save | ( | const std::string & | file_path | ) | const |
Writes a texture object as an image to disk.
Definition at line 235 of file Texture.cpp.
double CW::Texture::t_scale | ( | ) | const |
Returns the t_scale of the texture. The s_scale and t_scale values are useful when a face doesn't have a material applied directly, but instead inherit from a parent group or component instance. Then you want use these values to multiply the result of SUMeshHelperGetFrontSTQCoords or SUUVHelperGetFrontUVQ. If the material is applied directly then this would not be needed.
Definition at line 221 of file Texture.cpp.
size_t CW::Texture::width | ( | ) | const |
Returns the width of the texture in pixels.
Definition at line 179 of file Texture.cpp.