LayOut C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Enumerations | Functions
imagerep.h File Reference
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
#include <SketchUpAPI/color.h>

Go to the source code of this file.

Enumerations

enum  LOImageRepOutputFormat { LOImageRepOutputFormat_PNG = 0, LOImageRepOutputFormat_JPG, LONumImageRepOutputFormats }
 Represents the file formats that an image representation can be saved as when saving to a file. More...
 

Functions

LO_RESULT LOImageRepGetPixelDimensions (LOImageRepRef imagerep, size_t *width, size_t *height)
 Gets the dimensions in pixels of an image representation. More...
 
LO_RESULT LOImageRepGetDPI (LOImageRepRef imagerep, double *x_dpi, double *y_dpi)
 Gets the DPI of an image representation. More...
 
LO_RESULT LOImageRepGetDataSize (LOImageRepRef imagerep, size_t *data_size, size_t *bits_per_pixel)
 Returns the total size and bits-per-pixel value of an image representation. This function is useful to determine the size of the buffer necessary to be passed into LOImageRepGetData. 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. More...
 
LO_RESULT LOImageRepGetData (LOImageRepRef imagerep, size_t data_size, SUByte pixel_data[])
 Returns the pixel data for an image representation. The given array must be large enough to hold the image representation's data. This size can be obtained by calling LOImageRepGetDataSize. More...
 
LO_RESULT LOImageRepSaveAs (LOImageRepRef imagerep, const char *filename, LOImageRepOutputFormat format)
 Saves the image representation to the file at the indicated path. More...
 

Enumeration Type Documentation

Represents the file formats that an image representation can be saved as when saving to a file.

Enumerator
LOImageRepOutputFormat_PNG 

PNG file format.

LOImageRepOutputFormat_JPG 

JPG file format.

LONumImageRepOutputFormats 

Function Documentation

LO_RESULT LOImageRepGetData ( LOImageRepRef  imagerep,
size_t  data_size,
SUByte  pixel_data[] 
)

Returns the pixel data for an image representation. The given array must be large enough to hold the image representation's data. This size can be obtained by calling LOImageRepGetDataSize.

Parameters
[in]imagerepThe image representation object.
[in]data_sizeThe size of the byte array.
[out]pixel_dataThe image data retrieved.
Returns
LO_RESULT LOImageRepGetDataSize ( LOImageRepRef  imagerep,
size_t *  data_size,
size_t *  bits_per_pixel 
)

Returns the total size and bits-per-pixel value of an image representation. This function is useful to determine the size of the buffer necessary to be passed into LOImageRepGetData. 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.

Parameters
[in]imagerepThe image representation object.
[out]data_sizeThe total size of the image data in bytes.
[out]bits_per_pixelThe number of bits per pixel of the image data.
Returns
LO_RESULT LOImageRepGetDPI ( LOImageRepRef  imagerep,
double *  x_dpi,
double *  y_dpi 
)

Gets the DPI of an image representation.

Since
LayOut 2018, API 3.0
Parameters
[in]imagerepThe image representation object.
[out]x_dpiThe DPI in horizontal direction.
[out]y_dpiThe DPI in vertical direction.
Returns
LO_RESULT LOImageRepGetPixelDimensions ( LOImageRepRef  imagerep,
size_t *  width,
size_t *  height 
)

Gets the dimensions in pixels of an image representation.

Parameters
[in]imagerepThe image representation object.
[out]widthThe width of the image.
[out]heightThe height of the image.
Returns
LO_RESULT LOImageRepSaveAs ( LOImageRepRef  imagerep,
const char *  filename,
LOImageRepOutputFormat  format 
)

Saves the image representation to the file at the indicated path.

Parameters
[in]imagerepThe image representation object.
[in]filenameThe file path to where the image should go on disk.
[in]formatWhat format to save the image as.
Returns