SketchUp SDK
|
#include <stddef.h>
#include <slapi/color.h>
#include <slapi/unicodestring.h>
#include <slapi/model/defs.h>
Go to the source code of this file.
Functions | |
SU_EXPORT SUEntityRef | SUTextureToEntity (SUTextureRef texture) |
Converts from an SUTextureRef to an SUEntityRef. This is essentially an upcast operation. More... | |
SU_EXPORT SUTextureRef | SUTextureFromEntity (SUEntityRef entity) |
Converts from an SUEntityRef to an SUTextureRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUTextureRef. More... | |
SU_RESULT | SUTextureCreateFromImageData (SUTextureRef *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. If the texture object is not subsequently associated with a parent object (e.g. material), then the texture object must be deallocated with SUTextureRelease. More... | |
SU_RESULT | SUTextureCreateFromFile (SUTextureRef *texture, const char *file_path, double s_scale, double t_scale) |
Creates a new texture object from an image file specified by a path. If the texture object is not subsequently associated with a parent object (e.g. material), then the texture object must be deallocated with SUTextureRelease. More... | |
SU_RESULT | SUTextureRelease (SUTextureRef *texture) |
Deallocates a texture object and its resources. If the texture object is associated with a parent object (e.g. material) the parent object handles the deallocation of the resources of the texture object and the texture object must not be explicitly deallocated. More... | |
SU_RESULT | SUTextureGetDimensions (SUTextureRef texture, size_t *width, size_t *height, double *s_scale, double *t_scale) |
Retrieves the pixel width and height and scale factors of the texture. More... | |
SU_RESULT | SUTextureGetImageDataSize (SUTextureRef texture, size_t *data_size, size_t *bits_per_pixel) |
Returns the total size and bits-per-pixel value of a texture's image data. This function is useful to determine the size of the buffer necessary to be passed into SUTextureGetImageData. The returned data can be used along with the returned bits-per-pixel value and the texture dimensions to compute RGBA values at individual pixels of the texture image. More... | |
SU_RESULT | SUTextureGetImageData (SUTextureRef texture, size_t data_size, SUByte pixel_data[]) |
Returns the texture's image data. The given array must be large enough to hold the texture's image data. This size can be obtained by calling SUTextureGetImageDataSize. More... | |
SU_RESULT | SUTextureWriteToFile (SUTextureRef texture, const char *file_path) |
Writes a texture object as an image to disk. More... | |
SU_RESULT | SUTextureGetFileName (SUTextureRef texture, SUStringRef *file_name) |
Retrieves the image file name of a texture object. More... | |
SU_RESULT | SUTextureGetUseAlphaChannel (SUTextureRef texture, bool *alpha_channel_used) |
Retrieves the value of the flag that indicates whether a texture object uses the alpha channel. More... | |
SU_RESULT SUTextureCreateFromFile | ( | SUTextureRef * | texture, |
const char * | file_path, | ||
double | s_scale, | ||
double | t_scale | ||
) |
Creates a new texture object from an image file specified by a path. If the texture object is not subsequently associated with a parent object (e.g. material), then the texture object must be deallocated with SUTextureRelease.
[out] | texture | The texture object created. |
[in] | file_path | The file path of the source image file. Assumed to be UTF-8 encoded. |
[in] | s_scale | The scale factor for s coordinate value. |
[in] | t_scale | The scale factor for t coordinate value. |
SU_RESULT SUTextureCreateFromImageData | ( | SUTextureRef * | 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. If the texture object is not subsequently associated with a parent object (e.g. material), then the texture object must be deallocated with SUTextureRelease.
[out] | texture | The texture object created. |
[in] | width | The width in pixels of the texture data. |
[in] | height | The height in pixels of the texture data. |
[in] | bits_per_pixel | The number of bits per pixel of the image data. |
[in] | pixel_data | The source of the pixel data. |
SU_EXPORT SUTextureRef SUTextureFromEntity | ( | SUEntityRef | entity | ) |
Converts from an SUEntityRef to an SUTextureRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUTextureRef.
[in] | entity | The entity reference. |
SU_RESULT SUTextureGetDimensions | ( | SUTextureRef | texture, |
size_t * | width, | ||
size_t * | height, | ||
double * | s_scale, | ||
double * | t_scale | ||
) |
Retrieves the pixel width and height and scale factors of the texture.
[in] | texture | The texture object whose dimensions are retrieved. |
[out] | width | The width dimension retrieved. |
[out] | height | The height dimension retrieved. |
[out] | s_scale | The scale factor for s retrieved. |
[out] | t_scale | The scale factor for t retrieved. |
SU_RESULT SUTextureGetFileName | ( | SUTextureRef | texture, |
SUStringRef * | file_name | ||
) |
Retrieves the image file name of a texture object.
[in] | texture | The texture object. |
[out] | file_name | The file name retrieved. |
SU_RESULT SUTextureGetImageData | ( | SUTextureRef | texture, |
size_t | data_size, | ||
SUByte | pixel_data[] | ||
) |
Returns the texture's image data. The given array must be large enough to hold the texture's image data. This size can be obtained by calling SUTextureGetImageDataSize.
[in] | texture | The texture object. |
[in] | data_size | The size of the byte array. |
[out] | pixel_data | The image data retrieved. |
SU_RESULT SUTextureGetImageDataSize | ( | SUTextureRef | texture, |
size_t * | data_size, | ||
size_t * | bits_per_pixel | ||
) |
Returns the total size and bits-per-pixel value of a texture's image data. This function is useful to determine the size of the buffer necessary to be passed into SUTextureGetImageData. The returned data can be used along with the returned bits-per-pixel value and the texture dimensions to compute RGBA values at individual pixels of the texture image.
[in] | texture | The texture object. |
[out] | data_size | The total size of the image data in bytes. |
[out] | bits_per_pixel | The number of bits per pixel of the image data. |
SU_RESULT SUTextureGetUseAlphaChannel | ( | SUTextureRef | texture, |
bool * | alpha_channel_used | ||
) |
Retrieves the value of the flag that indicates whether a texture object uses the alpha channel.
[in] | texture | The texture object. |
[out] | alpha_channel_used | The destination of the retrieved value. |
SU_RESULT SUTextureRelease | ( | SUTextureRef * | texture | ) |
Deallocates a texture object and its resources. If the texture object is associated with a parent object (e.g. material) the parent object handles the deallocation of the resources of the texture object and the texture object must not be explicitly deallocated.
[in] | texture | The texture object to deallocate. |
SU_EXPORT SUEntityRef SUTextureToEntity | ( | SUTextureRef | texture | ) |
Converts from an SUTextureRef to an SUEntityRef. This is essentially an upcast operation.
[in] | texture | The texture reference. |
SU_RESULT SUTextureWriteToFile | ( | SUTextureRef | texture, |
const char * | file_path | ||
) |
Writes a texture object as an image to disk.
[in] | texture | The texture object. |
[in] | file_path | The file path destination of the texture image. Assumed to be UTF-8 encoded. |