SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
image_rep.h
Go to the documentation of this file.
1 // Copyright 2016 Trimble Navigation Ltd. All Rights Reserved.
2 #ifndef SKETCHUP_MODEL_IMAGE_REP_H_
3 #define SKETCHUP_MODEL_IMAGE_REP_H_
4 
5 #include <SketchUpAPI/color.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
26 struct SUColorOrder {
27  // Indicates the position of the red byte within a single pixel's data.
28  short red_index;
29  // Indicates the position of the green byte within a single pixel's data.
30  short green_index;
31  // Indicates the position of the blue byte within a single pixel's data.
32  short blue_index;
33  // Indicates the position of the alpha byte within a single pixel's data.
34  short alpha_index;
35 };
36 
44 SU_EXPORT struct SUColorOrder SUGetColorOrder();
45 
63 SU_RESULT SUImageRepCreate(SUImageRepRef* image);
64 
75 SU_RESULT SUImageRepRelease(SUImageRepRef* image);
76 
87 SU_RESULT SUImageRepCopy(SUImageRepRef image, SUImageRepRef copy_image);
88 
108 SU_RESULT SUImageRepSetData(SUImageRepRef image, size_t width, size_t height,
109  size_t bits_per_pixel, size_t row_padding,
110  const SUByte pixel_data[]);
111 
125 SU_RESULT SUImageRepLoadFile(SUImageRepRef image, const char* file_path);
126 
141 SU_RESULT SUImageRepSaveToFile(SUImageRepRef image, const char* file_path);
142 
155 SU_RESULT SUImageRepGetPixelDimensions(SUImageRepRef image, size_t* width,
156  size_t* height);
157 
169 SU_RESULT SUImageRepGetRowPadding(SUImageRepRef image, size_t* row_padding);
170 
184 SU_RESULT SUImageRepResize(SUImageRepRef image, size_t width, size_t height);
185 
197 
214 SU_RESULT SUImageRepGetDataSize(SUImageRepRef image, size_t* data_size,
215  size_t* bits_per_pixel);
216 
233 SU_RESULT SUImageRepGetData(SUImageRepRef image, size_t data_size,
234  SUByte pixel_data[]);
235 
248 SU_RESULT SUImageRepGetDataAsColors(SUImageRepRef image, SUColor color_data[]);
249 
266 SU_RESULT SUImageRepGetColorAtUV(SUImageRepRef image, double u, double v,
267  bool bilinear, SUColor* color);
268 
269 #ifdef __cplusplus
270 } // extern "C"
271 #endif
272 
273 #endif // SKETCHUP_MODEL_IMAGE_REP_H_