LayOut C API

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends 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

enum LOImageRepOutputFormat

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] | imagerep | The image representation object.
  [in] | data_size | The size of the byte array.
  [out] | pixel_data | The image data retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if imagerep is an invalid object
  - SU_ERROR_NULL_POINTER_OUTPUT if pixel_data is NULL
  - SU_ERROR_INSUFFICIENT_SIZE if data_size is insufficient for the image data

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] | imagerep | The image representation 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.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if imagerep is an invalid object
  - SU_ERROR_NULL_POINTER_OUTPUT if data_size or bits_per_pixel is NULL

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] | imagerep | The image representation object.
  [out] | x_dpi | The DPI in horizontal direction.
  [out] | y_dpi | The DPI in vertical direction.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if imagerep does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if x_dpi is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if y_dpi is NULL

LO_RESULT LOImageRepGetPixelDimensions | ( | LOImageRepRef | imagerep,
|  | size_t * | width,
|  | size_t * | height
| ) |  |

Gets the dimensions in pixels of an image representation.

Parameters

  [in] | imagerep | The image representation object.
  [out] | width | The width of the image.
  [out] | height | The height of the image.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if imagerep does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if width is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if height is NULL

LO_RESULT LOImageRepSaveAs | ( | LOImageRepRef | imagerep,
|  | const char * | filename,
|  | LOImageRepOutputFormat | format
| ) |  |

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

Parameters

  [in] | imagerep | The image representation object.
  [in] | filename | The file path to where the image should go on disk.
  [in] | format | What format to save the image as.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if imagerep is invalid
  - SU_ERROR_NULL_POINTER_INPUT if filename is NULL
  - SU_ERROR_SERIALIZATION if there was an error writing the image file