scriptup 2024.0.5 → 2024.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/ext/attribute_dictionaries.c +1 -1
  3. data/ext/color.c +3 -3
  4. data/ext/component_definition.c +2 -2
  5. data/ext/definition_list.c +1 -1
  6. data/ext/entity.c +4 -3
  7. data/ext/material.c +4 -7
  8. data/ext/utils.h +4 -4
  9. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
  10. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
  11. data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
  12. data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
  13. data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
  14. data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
  15. data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
  16. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
  17. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
  18. data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
  19. data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +117 -0
  20. data/sketchup-sdk-win/headers/LayOutAPI/common.h +22 -0
  21. data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +78 -0
  22. data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +36 -0
  23. data/sketchup-sdk-win/headers/LayOutAPI/layout.h +49 -0
  24. data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +468 -0
  25. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +569 -0
  26. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +79 -0
  27. data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +107 -0
  28. data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +42 -0
  29. data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +120 -0
  30. data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +864 -0
  31. data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +59 -0
  32. data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +78 -0
  33. data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +330 -0
  34. data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +49 -0
  35. data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +114 -0
  36. data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +397 -0
  37. data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +251 -0
  38. data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +243 -0
  39. data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +146 -0
  40. data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +109 -0
  41. data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +332 -0
  42. data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +207 -0
  43. data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +117 -0
  44. data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +69 -0
  45. data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +456 -0
  46. data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +261 -0
  47. data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +372 -0
  48. data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +81 -0
  49. data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +464 -0
  50. data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +240 -0
  51. data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +120 -0
  52. data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +624 -0
  53. data/sketchup-sdk-win/headers/LayOutAPI/model/skpfilereference.h +94 -0
  54. data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +1080 -0
  55. data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +470 -0
  56. data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +156 -0
  57. metadata +50 -2
@@ -0,0 +1,243 @@
1
+ // Copyright 2015 Trimble Navigation Ltd. All rights reserved.
2
+ // This file is intended for public distribution.
3
+
4
+ #ifndef LAYOUT_MODEL_GROUP_H_
5
+ #define LAYOUT_MODEL_GROUP_H_
6
+
7
+ #include <LayOutAPI/common.h>
8
+ #include <LayOutAPI/model/defs.h>
9
+ #include <LayOutAPI/model/document.h>
10
+
11
+ /**
12
+ @struct LOGroupRef
13
+ @brief References a group entity. A group is a special type of entity that
14
+ does not belong to a layer and contains other entities as children. A
15
+ group's children may include other groups, allowing for a hierarchical
16
+ tree structure of entities. A group must contain at least one child
17
+ and will be automatically collapsed if an operation is performed that
18
+ results in the group being empty.
19
+ */
20
+
21
+ #ifdef __cplusplus
22
+ extern "C" {
23
+ #endif // __cplusplus
24
+
25
+ /**
26
+ @enum LOGroupResizeBehaviorType
27
+ @brief Defines the different types of resize behavior when scale is changed.
28
+ */
29
+ typedef enum {
30
+ LOGroupResizeBehaviorType_None = 0, /// Group is not resized.
31
+ LOGroupResizeBehaviorType_Bounds, /// Entity bounds are resized.
32
+ LOGroupResizeBehaviorType_BoundsAndFonts /// Bounds and fonts are resized.
33
+ } LOGroupResizeBehaviorType;
34
+
35
+ /**
36
+ @brief Creates a new group object, populating it with the entities in the given
37
+ \ref LOEntityListRef. It is possible to create a group from entities
38
+ that are already in a document, as well as from entities that are not
39
+ yet in a document. For entities that are already in a document, they can
40
+ only be grouped if they all belong to shared layers, or all belong to
41
+ non-shared layers on the same page. If the entities are in a document,
42
+ then the new group will be added to the document at the top of the group
43
+ hierarchy.
44
+ @param[out] group The group object.
45
+ @param[in] entity_list The list of entities to add to the group.
46
+ @return
47
+ - \ref SU_ERROR_NONE on success
48
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if group is NULL
49
+ - \ref SU_ERROR_OVERWRITE_VALID if *group already refers to a valid object
50
+ - \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
51
+ - \ref SU_ERROR_GENERIC if entity_list is empty
52
+ - \ref SU_ERROR_GENERIC if entity_list contains entities that belong to
53
+ different documents
54
+ - \ref SU_ERROR_GENERIC if entity_list contains a mix of entities that belong
55
+ to a document and entities that don't belong to a document
56
+ - \ref SU_ERROR_GENERIC if entity_list contains entities on both shared
57
+ and non-shared layers, or on non-shared layers belonging to different pages.
58
+ - \ref SU_ERROR_GENERIC if entity_list contains the same entity more than
59
+ once.
60
+ */
61
+ LO_RESULT LOGroupCreate(LOGroupRef* group, LOEntityListRef entity_list);
62
+
63
+ /**
64
+ @brief Adds a reference to a group object.
65
+ @param[in] group The group object.
66
+ @return
67
+ SU_ERROR_NONE on success
68
+ SU_ERROR_INVALID_INPUT if group does not refer to a valid object
69
+ */
70
+ LO_RESULT LOGroupAddReference(LOGroupRef group);
71
+
72
+ /**
73
+ @brief Releases a group object. The object will be invalidated if
74
+ releasing the last reference.
75
+ @param[in] group The group object.
76
+ @return
77
+ - \ref SU_ERROR_NONE on success
78
+ - \ref SU_ERROR_NULL_POINTER_INPUT if group is NULL
79
+ - \ref SU_ERROR_INVALID_INPUT if *group does not refer to a valid object
80
+ */
81
+ LO_RESULT LOGroupRelease(LOGroupRef* group);
82
+
83
+ /**
84
+ @brief Converts from a \ref LOEntityRef to a \ref LOGroupRef.
85
+ This is essentially a downcast operation so the given \ref LOEntityRef
86
+ must be convertible to a \ref LOGroupRef.
87
+ @param[in] entity The entity object.
88
+ @return
89
+ - The converted \ref LOGroupRef if the downcast operation succeeds
90
+ - If not, the returned reference will be invalid
91
+ */
92
+ LO_EXPORT LOGroupRef LOGroupFromEntity(LOEntityRef entity);
93
+
94
+ /**
95
+ @brief Converts from a \ref LOGroupRef to a \ref LOEntityRef.
96
+ This is essentially an upcast operation.
97
+ @param[in] group The group object.
98
+ @return
99
+ - The converted \ref LOEntityRef if group is a valid object
100
+ - If not, the returned reference will be invalid
101
+ */
102
+ LO_EXPORT LOEntityRef LOGroupToEntity(LOGroupRef group);
103
+
104
+ /**
105
+ @brief Removes all the entities from a group and removes the empty group. The
106
+ entities will become children of the group's parent. *group will be set
107
+ to invalid by this function.
108
+ @param[in] group The group object.
109
+ @return
110
+ - \ref SU_ERROR_NONE on success
111
+ - \ref SU_ERROR_NULL_POINTER_INPUT if group is NULL
112
+ - \ref SU_ERROR_INVALID_INPUT if *group does not refer to a valid object
113
+ - \ref SU_ERROR_ENTITY_LOCKED if group is locked
114
+ */
115
+ LO_RESULT LOGroupUngroup(LOGroupRef* group);
116
+
117
+ /**
118
+ @brief Populates a \ref LOEntityListRef object with all the children of a group.
119
+ @param[in] group The group object.
120
+ @param[in] entity_list The entity list object to populate with the group's
121
+ children.
122
+ @return
123
+ - \ref SU_ERROR_NONE on success
124
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
125
+ - \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
126
+ */
127
+ LO_RESULT LOGroupGetEntities(LOGroupRef group, LOEntityListRef entity_list);
128
+
129
+ /**
130
+ @brief Gets the number of children within a group.
131
+ @param[in] group The group object.
132
+ @param[out] num_entities The number of children in the group.
133
+ @return
134
+ - \ref SU_ERROR_NONE on success
135
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
136
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if num_entities is NULL
137
+ */
138
+ LO_RESULT LOGroupGetNumberOfEntities(LOGroupRef group, size_t* num_entities);
139
+
140
+ /**
141
+ @brief Gets the child at the given index from within a group.
142
+ @param[in] group The group object.
143
+ @param[in] index The index of the child entity to get.
144
+ @param[out] child_entity The child entity object.
145
+ @return
146
+ - \ref SU_ERROR_NONE on success
147
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
148
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if child_entity is NULL
149
+ - \ref SU_ERROR_OVERWRITE_VALID if *child_entity already refers to a valid
150
+ object
151
+ */
152
+ LO_RESULT LOGroupGetEntityAtIndex(LOGroupRef group, size_t index, LOEntityRef* child_entity);
153
+
154
+ /**
155
+ @brief Gets the scale factor set on a group.
156
+ @since LayOut 2018, API 3.0
157
+ @param[in] group The group object.
158
+ @param[out] scale_factor The scale factor of the group.
159
+ @return
160
+ - \ref SU_ERROR_NONE on success
161
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
162
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if scale_context is NULL
163
+ - \ref SU_ERROR_NO_DATA if group does not have a scale factor set.
164
+ */
165
+ LO_RESULT LOGroupGetScaleFactor(LOGroupRef group, double* scale_factor);
166
+
167
+ /**
168
+ @brief Sets the scale factor on a group.
169
+ @since LayOut 2018, API 3.0
170
+ @param[in] group The group object.
171
+ @param[in] scale_factor The scale factor to set.
172
+ @param[in] units The units format to use.
173
+ @param[in] resize_behavior How entities in the group should adjust
174
+ to the new scale.
175
+ @return
176
+ - \ref SU_ERROR_NONE on success
177
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
178
+ - \ref SU_ERROR_UNSUPPORTED if group already effectively has a scale from
179
+ a parent or sub-group.
180
+ - \ref SU_ERROR_LAYER_LOCKED if group is on a locked layer
181
+ - \ref SU_ERROR_ENTITY_LOCKED if group is locked
182
+ */
183
+ LO_RESULT LOGroupSetScaleFactor(
184
+ LOGroupRef group, double scale_factor, LODocumentUnits units,
185
+ LOGroupResizeBehaviorType resize_behavior);
186
+
187
+ /**
188
+ @brief Returns the scale units for a group.
189
+ @since LayOut 2018, API 3.0
190
+ @param[in] group The group object.
191
+ @param[out] units The unit format for the group.
192
+ @param[out] precision The units precision. This is expressed as a value in the
193
+ current units.
194
+ @return
195
+ - \ref SU_ERROR_NONE on success
196
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
197
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if units is NULL
198
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if precision is NULL
199
+ - \ref SU_ERROR_NO_DATA if this specific group does not have a scale factor set.
200
+ */
201
+ LO_RESULT LOGroupGetScaleUnits(LOGroupRef group, LODocumentUnits* units, double* precision);
202
+
203
+ /**
204
+ @brief Sets the units format on a group.
205
+ @since LayOut 2018, API 3.0
206
+ @param[in] group The group object.
207
+ @param[in] units The units format to use.
208
+ @param[in] precision The units precision. This is expressed as a value in the
209
+ specified units. LayOut only allows for a finite set of
210
+ precision values for each units setting, so it will set
211
+ the precision to the closest valid setting for the
212
+ specified units. See the "Units" section of LayOut's
213
+ "Document Setup" dialog for a reference of the available
214
+ precisions for each units setting.
215
+ @return
216
+ - \ref SU_ERROR_NONE on success
217
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
218
+ - \ref SU_ERROR_LAYER_LOCKED if group is on a locked layer
219
+ - \ref SU_ERROR_ENTITY_LOCKED if group is locked
220
+ - \ref SU_ERROR_UNSUPPORTED if group does not have a scale factor set.
221
+ */
222
+ LO_RESULT LOGroupSetScaleUnits(LOGroupRef group, LODocumentUnits units, double precision);
223
+
224
+ /**
225
+ @brief Removes the scale factor of a group.
226
+ @since LayOut 2018, API 3.0
227
+ @param[in] group The group object.
228
+ @param[in] resize_behavior How entities in the group should adjust
229
+ to the new scale.
230
+ @return
231
+ - \ref SU_ERROR_NONE on success
232
+ - \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
233
+ - \ref SU_ERROR_LAYER_LOCKED if group is on a locked layer
234
+ - \ref SU_ERROR_ENTITY_LOCKED if group is locked
235
+ - \ref SU_ERROR_UNSUPPORTED if group does not have a scale factor set.
236
+ */
237
+ LO_RESULT LOGroupRemoveScaleFactor(LOGroupRef group, LOGroupResizeBehaviorType resize_behavior);
238
+
239
+ #ifdef __cplusplus
240
+ } // end extern C
241
+ #endif // __cplusplus
242
+
243
+ #endif // LAYOUT_MODEL_GROUP_H_
@@ -0,0 +1,146 @@
1
+ // Copyright 2015 Trimble Navigation Ltd. All rights reserved.
2
+ // This file is intended for public distribution.
3
+
4
+ #ifndef LAYOUT_MODEL_IMAGE_H_
5
+ #define LAYOUT_MODEL_IMAGE_H_
6
+
7
+ #include <LayOutAPI/common.h>
8
+ #include <LayOutAPI/geometry/geometry.h>
9
+ #include <LayOutAPI/model/defs.h>
10
+
11
+ /**
12
+ @struct LOImageRef
13
+ @brief References a raster image entity.
14
+ */
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif // __cplusplus
19
+
20
+ /**
21
+ @brief Creates a new image object from an image file on disk.
22
+ @param[out] image The image object.
23
+ @param[in] bounds The bounding box for the image.
24
+ @param[in] file_path The file path to the image on disk.
25
+ @return
26
+ - \ref SU_ERROR_NONE on success
27
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if image is NULL
28
+ - \ref SU_ERROR_OVERWRITE_VALID if *image already refers to a valid object
29
+ - \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
30
+ - \ref SU_ERROR_NULL_POINTER_INPUT if file_path is NULL
31
+ - \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
32
+ - \ref SU_ERROR_SERIALIZATION if there was an error reading the image file or
33
+ allocating the memory for the image
34
+ - \ref SU_ERROR_NO_DATA if the image file could not be found
35
+ */
36
+ LO_RESULT LOImageCreateFromFile(
37
+ LOImageRef* image, const LOAxisAlignedRect2D* bounds, const char* file_path);
38
+
39
+ /**
40
+ @brief Adds a reference to an image object.
41
+ @param[in] image The image object.
42
+ @return
43
+ - \ref SU_ERROR_NONE on success
44
+ - \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
45
+ */
46
+ LO_RESULT LOImageAddReference(LOImageRef image);
47
+
48
+ /**
49
+ @brief Releases an image object. The object will be invalidated if
50
+ releasing the last reference.
51
+ @param[in] image The image object.
52
+ @return
53
+ - \ref SU_ERROR_NONE on success
54
+ - \ref SU_ERROR_NULL_POINTER_INPUT if image is NULL
55
+ - \ref SU_ERROR_INVALID_INPUT if *image does not refer to a valid object
56
+ */
57
+ LO_RESULT LOImageRelease(LOImageRef* image);
58
+
59
+ /**
60
+ @brief Converts from a \ref LOEntityRef to a \ref LOImageRef.
61
+ This is essentially a downcast operation so the given \ref LOEntityRef
62
+ must be convertible to a \ref LOImageRef.
63
+ @param[in] entity The entity object.
64
+ @return
65
+ - The converted \ref LOImageRef if the downcast operation succeeds
66
+ - If not, the returned reference will be invalid
67
+ */
68
+ LO_EXPORT LOImageRef LOImageFromEntity(LOEntityRef entity);
69
+
70
+ /**
71
+ @brief Converts from a \ref LOImageRef to a \ref LOEntityRef.
72
+ This is essentially an upcast operation.
73
+ @param[in] image The image object.
74
+ @return
75
+ - The converted \ref LOEntityRef if image is a valid object
76
+ - If not, the returned reference will be invalid
77
+ */
78
+ LO_EXPORT LOEntityRef LOImageToEntity(LOImageRef image);
79
+
80
+ /**
81
+ @brief Gets an image object's image representation.
82
+ @param[in] image The image object.
83
+ @param[out] imagerep The image representation object.
84
+ @return
85
+ - \ref SU_ERROR_NONE on success
86
+ - \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
87
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if imagerep is NULL
88
+ - \ref SU_ERROR_OVERWRITE_VALID if *imagerep already refers to a valid object
89
+ */
90
+ LO_RESULT LOImageGetImageRep(LOImageRef image, LOImageRepRef* imagerep);
91
+
92
+ /**
93
+ @brief Gets an image object's image representation in the document's output resolution.
94
+
95
+ This should be used by exporters to retrieve the image data at the quality set by \ref
96
+ LOPageInfoSetImageOutputResolution.
97
+ @since LayOut 2023.1, API 8.1
98
+ @param[in] image The image object.
99
+ @param[out] imagerep The image representation object.
100
+ @return
101
+ - \ref SU_ERROR_NONE on success
102
+ - \ref SU_ERROR_INVALID_INPUT if \p image does not refer to a valid object
103
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if \p imagerep is NULL
104
+ - \ref SU_ERROR_OVERWRITE_VALID if \p imagerep already refers to a valid object
105
+ */
106
+ LO_RESULT LOImageGetOutputImageRep(LOImageRef image, LOImageRepRef* imagerep);
107
+
108
+ /**
109
+ @brief Returns any clip mask assigned to the image.
110
+ @param[in] image The image object.
111
+ @param[out] clip_mask The clip mask of the image.
112
+ @return
113
+ - \ref SU_ERROR_NONE on success
114
+ - \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
115
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if clip_mask is NULL
116
+ - \ref SU_ERROR_OVERWRITE_VALID if *clip_mask already refers to a valid object
117
+ - \ref SU_ERROR_NO_DATA if the image is not being clipped by a clip mask
118
+ */
119
+ LO_RESULT LOImageGetClipMask(LOImageRef image, LOEntityRef* clip_mask);
120
+
121
+ /**
122
+ @brief Sets the clip mask of the image. A clip mask defines a region
123
+ of the entity that is visible. This allows you to crop with arbitrary
124
+ shapes. This operation will replace any clip mask that is already
125
+ assigned to this image. The entity being used must not be already part
126
+ of a document or group. The clip mask entity must be either a
127
+ rectangle, ellipse or a path.
128
+ @note Starting in LayOut 2020.1, API 5.1, clip_mask may be SU_INVALID, which
129
+ will remove the existing clip mask, if any.
130
+ @since LayOut 2017, API 2.0
131
+ @param[in] image The image object.
132
+ @param[in] clip_mask The new clip mask for the image.
133
+ @return
134
+ - \ref SU_ERROR_NONE on success
135
+ - \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
136
+ - \ref SU_ERROR_INVALID_ARGUMENT if clip_mask is already in a document or group
137
+ - \ref SU_ERROR_UNSUPPORTED if clip_mask is not a rectangle, ellipse, or path
138
+ - \ref SU_ERROR_LAYER_LOCKED if image is on a locked layer
139
+ - \ref SU_ERROR_ENTITY_LOCKED if image is locked
140
+ */
141
+ LO_RESULT LOImageSetClipMask(LOImageRef image, LOEntityRef clip_mask);
142
+
143
+ #ifdef __cplusplus
144
+ } // end extern "C"
145
+ #endif // __cplusplus
146
+ #endif // LAYOUT_MODEL_IMAGE_H_
@@ -0,0 +1,109 @@
1
+ // Copyright 2015 Trimble Navigation Ltd. All rights reserved.
2
+ // This file is intended for public distribution.
3
+
4
+ #ifndef LAYOUT_MODEL_IMAGEREP_H_
5
+ #define LAYOUT_MODEL_IMAGEREP_H_
6
+
7
+ #include <LayOutAPI/common.h>
8
+ #include <LayOutAPI/model/defs.h>
9
+ #include <SketchUpAPI/color.h>
10
+
11
+ /**
12
+ @enum LOImageRepOutputFormat
13
+ @brief Represents the file formats that an image representation can be saved as
14
+ when saving to a file.
15
+ */
16
+ typedef enum {
17
+ LOImageRepOutputFormat_PNG = 0, ///< PNG file format.
18
+ LOImageRepOutputFormat_JPG, ///< JPG file format.
19
+ LONumImageRepOutputFormats
20
+ } LOImageRepOutputFormat;
21
+
22
+ /**
23
+ @struct LOImageRepRef
24
+ @brief References the bitmap representation for a raster image.
25
+ */
26
+
27
+ #ifdef __cplusplus
28
+ extern "C" {
29
+ #endif // __cplusplus
30
+
31
+ /**
32
+ @brief Gets the dimensions in pixels of an image representation.
33
+ @param[in] imagerep The image representation object.
34
+ @param[out] width The width of the image.
35
+ @param[out] height The height of the image.
36
+ @return
37
+ - \ref SU_ERROR_NONE on success
38
+ - \ref SU_ERROR_INVALID_INPUT if imagerep does not refer to a valid object
39
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if width is NULL
40
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if height is NULL
41
+ */
42
+ LO_RESULT LOImageRepGetPixelDimensions(LOImageRepRef imagerep, size_t* width, size_t* height);
43
+
44
+ /**
45
+ @brief Gets the DPI of an image representation.
46
+ @since LayOut 2018, API 3.0
47
+ @param[in] imagerep The image representation object.
48
+ @param[out] x_dpi The DPI in horizontal direction.
49
+ @param[out] y_dpi The DPI in vertical direction.
50
+ @return
51
+ - \ref SU_ERROR_NONE on success
52
+ - \ref SU_ERROR_INVALID_INPUT if imagerep does not refer to a valid object
53
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if x_dpi is NULL
54
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if y_dpi is NULL
55
+ */
56
+ LO_RESULT LOImageRepGetDPI(LOImageRepRef imagerep, double* x_dpi, double* y_dpi);
57
+
58
+ /**
59
+ @brief Returns the total size and bits-per-pixel value of an image
60
+ representation. This function is useful to determine the size of the
61
+ buffer necessary to be passed into \ref LOImageRepGetData. The returned
62
+ data can be used along with the returned bits-per-pixel value and the
63
+ image dimensions to compute RGBA values at individual pixels of the
64
+ image.
65
+ @param[in] imagerep The image representation object.
66
+ @param[out] data_size The total size of the image data in bytes.
67
+ @param[out] bits_per_pixel The number of bits per pixel of the image data.
68
+ @return
69
+ - \ref SU_ERROR_NONE on success
70
+ - \ref SU_ERROR_INVALID_INPUT if imagerep is an invalid object
71
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if data_size or bits_per_pixel is NULL
72
+ */
73
+ LO_RESULT LOImageRepGetDataSize(LOImageRepRef imagerep, size_t* data_size, size_t* bits_per_pixel);
74
+
75
+ /**
76
+ @brief Returns the pixel data for an image representation. The given array
77
+ must be large enough to hold the image representation's data. This size
78
+ can be obtained by calling \ref LOImageRepGetDataSize.
79
+ @param[in] imagerep The image representation object.
80
+ @param[in] data_size The size of the byte array.
81
+ @param[out] pixel_data The image data retrieved.
82
+ @return
83
+ - \ref SU_ERROR_NONE on success
84
+ - \ref SU_ERROR_INVALID_INPUT if imagerep is an invalid object
85
+ - \ref SU_ERROR_NULL_POINTER_OUTPUT if pixel_data is NULL
86
+ - \ref SU_ERROR_INSUFFICIENT_SIZE if data_size is insufficient for the image
87
+ data
88
+ */
89
+ LO_RESULT LOImageRepGetData(LOImageRepRef imagerep, size_t data_size, SUByte pixel_data[]);
90
+
91
+ /**
92
+ @brief Saves the image representation to the file at the indicated path.
93
+ @param[in] imagerep The image representation object.
94
+ @param[in] filename The file path to where the image should go on disk.
95
+ @param[in] format What format to save the image as.
96
+ @return
97
+ - \ref SU_ERROR_NONE on success
98
+ - \ref SU_ERROR_INVALID_INPUT if imagerep is invalid
99
+ - \ref SU_ERROR_NULL_POINTER_INPUT if filename is NULL
100
+ - \ref SU_ERROR_SERIALIZATION if there was an error writing the image file
101
+ */
102
+ LO_RESULT LOImageRepSaveAs(
103
+ LOImageRepRef imagerep, const char* filename, LOImageRepOutputFormat format);
104
+
105
+ #ifdef __cplusplus
106
+ } // end extern "C"
107
+ #endif // __cplusplus
108
+
109
+ #endif // LAYOUT_MODEL_IMAGEREP_H_