@img/sharp-libvips-dev 0.0.1 → 0.0.3
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.
- package/README.md +3 -3
- package/cplusplus/VConnection.cpp +54 -54
- package/cplusplus/VError.cpp +20 -18
- package/cplusplus/VImage.cpp +636 -589
- package/cplusplus/VInterpolate.cpp +22 -22
- package/cplusplus/VRegion.cpp +4 -4
- package/cplusplus/vips-operators.cpp +2326 -2301
- package/include/aom/aom_codec.h +10 -6
- package/include/aom/aom_decoder.h +1 -1
- package/include/aom/aom_encoder.h +9 -2
- package/include/aom/aomcx.h +72 -3
- package/include/cairo/cairo-ft.h +1 -1
- package/include/cairo/cairo-gobject.h +8 -0
- package/include/cairo/cairo-svg.h +3 -3
- package/include/cairo/cairo-version.h +2 -2
- package/include/cairo/cairo.h +91 -24
- package/include/glib-2.0/glib/gmacros.h +1 -1
- package/include/glib-2.0/glib/gtestutils.h +1 -1
- package/include/glib-2.0/gobject/gtype.h +7 -7
- package/include/harfbuzz/hb-version.h +2 -2
- package/include/hwy/aligned_allocator.h +211 -0
- package/include/hwy/base.h +1517 -0
- package/include/hwy/cache_control.h +108 -0
- package/include/hwy/detect_compiler_arch.h +281 -0
- package/include/hwy/detect_targets.h +644 -0
- package/include/hwy/foreach_target.h +340 -0
- package/include/hwy/highway.h +435 -0
- package/include/hwy/highway_export.h +74 -0
- package/include/hwy/nanobenchmark.h +171 -0
- package/include/hwy/ops/arm_neon-inl.h +8913 -0
- package/include/hwy/ops/arm_sve-inl.h +5105 -0
- package/include/hwy/ops/emu128-inl.h +2811 -0
- package/include/hwy/ops/generic_ops-inl.h +4745 -0
- package/include/hwy/ops/ppc_vsx-inl.h +5716 -0
- package/include/hwy/ops/rvv-inl.h +5070 -0
- package/include/hwy/ops/scalar-inl.h +1995 -0
- package/include/hwy/ops/set_macros-inl.h +578 -0
- package/include/hwy/ops/shared-inl.h +539 -0
- package/include/hwy/ops/tuple-inl.h +125 -0
- package/include/hwy/ops/wasm_128-inl.h +5917 -0
- package/include/hwy/ops/x86_128-inl.h +11173 -0
- package/include/hwy/ops/x86_256-inl.h +7529 -0
- package/include/hwy/ops/x86_512-inl.h +6849 -0
- package/include/hwy/per_target.h +44 -0
- package/include/hwy/print-inl.h +62 -0
- package/include/hwy/print.h +75 -0
- package/include/hwy/robust_statistics.h +148 -0
- package/include/hwy/targets.h +338 -0
- package/include/hwy/timer-inl.h +200 -0
- package/include/hwy/timer.h +55 -0
- package/include/jconfig.h +2 -2
- package/include/jpeglib.h +3 -2
- package/include/libheif/heif.h +461 -384
- package/include/libheif/heif_cxx.h +4 -1
- package/include/libheif/heif_plugin.h +1 -1
- package/include/libheif/heif_properties.h +138 -0
- package/include/libheif/heif_regions.h +866 -0
- package/include/libheif/heif_version.h +3 -3
- package/include/libpng16/pnglibconf.h +1 -1
- package/include/pnglibconf.h +1 -1
- package/include/vips/VConnection8.h +43 -49
- package/include/vips/VError8.h +27 -24
- package/include/vips/VImage8.h +4861 -4597
- package/include/vips/VInterpolate8.h +24 -27
- package/include/vips/VRegion8.h +32 -33
- package/include/vips/arithmetic.h +169 -169
- package/include/vips/basic.h +33 -33
- package/include/vips/buf.h +56 -54
- package/include/vips/colour.h +95 -95
- package/include/vips/connection.h +190 -193
- package/include/vips/conversion.h +91 -91
- package/include/vips/convolution.h +36 -30
- package/include/vips/create.h +63 -63
- package/include/vips/dbuf.h +35 -37
- package/include/vips/debug.h +65 -33
- package/include/vips/draw.h +41 -41
- package/include/vips/enumtypes.h +54 -51
- package/include/vips/error.h +63 -63
- package/include/vips/foreign.h +263 -223
- package/include/vips/format.h +48 -48
- package/include/vips/freqfilt.h +22 -22
- package/include/vips/gate.h +55 -47
- package/include/vips/generate.h +34 -34
- package/include/vips/header.h +111 -101
- package/include/vips/histogram.h +28 -28
- package/include/vips/image.h +213 -213
- package/include/vips/interpolate.h +40 -41
- package/include/vips/memory.h +61 -52
- package/include/vips/morphology.h +24 -24
- package/include/vips/mosaicing.h +32 -33
- package/include/vips/object.h +371 -357
- package/include/vips/operation.h +68 -67
- package/include/vips/private.h +76 -76
- package/include/vips/rect.h +26 -26
- package/include/vips/region.h +92 -92
- package/include/vips/resample.h +38 -38
- package/include/vips/sbuf.h +53 -54
- package/include/vips/semaphore.h +24 -24
- package/include/vips/thread.h +30 -27
- package/include/vips/threadpool.h +48 -49
- package/include/vips/transform.h +39 -39
- package/include/vips/type.h +90 -85
- package/include/vips/util.h +274 -229
- package/include/vips/vector.h +24 -144
- package/include/vips/version.h +9 -9
- package/include/vips/vips.h +41 -40
- package/include/zlib.h +23 -19
- package/package.json +1 -1
- package/versions.json +9 -9
|
@@ -0,0 +1,866 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2023 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
* Copyright (c) 2023 Brad Hards <bradh@frogmouth.net>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of libheif.
|
|
7
|
+
*
|
|
8
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
10
|
+
* published by the Free Software Foundation, either version 3 of
|
|
11
|
+
* the License, or (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* libheif is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef LIBHEIF_HEIF_REGIONS_H
|
|
23
|
+
#define LIBHEIF_HEIF_REGIONS_H
|
|
24
|
+
|
|
25
|
+
#include "libheif/heif.h"
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// --- region items and annotations
|
|
32
|
+
|
|
33
|
+
// See ISO/IEC 23008-12:2022 Section 6.10 "Region items and region annotations"
|
|
34
|
+
|
|
35
|
+
struct heif_region_item;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Region type.
|
|
39
|
+
*
|
|
40
|
+
* Each region item will contain zero or more regions, which may have different geometry or
|
|
41
|
+
* mask representations.
|
|
42
|
+
*/
|
|
43
|
+
enum heif_region_type
|
|
44
|
+
{
|
|
45
|
+
/**
|
|
46
|
+
* Point gemetry.
|
|
47
|
+
*
|
|
48
|
+
* The region is represented by a single point.
|
|
49
|
+
*/
|
|
50
|
+
heif_region_type_point = 0,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Rectangle geometry.
|
|
54
|
+
*
|
|
55
|
+
* The region is represented by a top left position, and a size defined
|
|
56
|
+
* by a width and height. All of the interior points and the edge are
|
|
57
|
+
* part of the region.
|
|
58
|
+
*/
|
|
59
|
+
heif_region_type_rectangle = 1,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Ellipse geometry.
|
|
63
|
+
*
|
|
64
|
+
* The region is represented by a centre point, and radii in the X and
|
|
65
|
+
* Y directions. All of the interior points and the edge are part of the
|
|
66
|
+
* region.
|
|
67
|
+
*/
|
|
68
|
+
heif_region_type_ellipse = 2,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Polygon geometry.
|
|
72
|
+
*
|
|
73
|
+
* The region is represented by a sequence of points, which is considered
|
|
74
|
+
* implicitly closed. All of the interior points and the edge are part
|
|
75
|
+
* of the region.
|
|
76
|
+
*/
|
|
77
|
+
heif_region_type_polygon = 3,
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Reference mask.
|
|
81
|
+
*
|
|
82
|
+
* The region geometry is described by the pixels in another image item,
|
|
83
|
+
* which has a item reference of type `mask` from the region item to the
|
|
84
|
+
* image item containing the mask.
|
|
85
|
+
*
|
|
86
|
+
* The image item containing the mask is one of:
|
|
87
|
+
*
|
|
88
|
+
* - a mask item (see ISO/IEC 23008-12:2022 Section 6.10.2), or a derived
|
|
89
|
+
* image from a mask item
|
|
90
|
+
*
|
|
91
|
+
* - an image item in monochrome format (4:0:0 chroma)
|
|
92
|
+
*
|
|
93
|
+
* - an image item in colour format with luma and chroma planes (e.g. 4:2:0)
|
|
94
|
+
*
|
|
95
|
+
* If the pixel value is equal to the minimum sample value (e.g. 0 for unsigned
|
|
96
|
+
* integer), the pixel is not part of the region. If the pixel value is equal
|
|
97
|
+
* to the maximum sample value (e.g. 255 for 8 bit unsigned integer), the pixel
|
|
98
|
+
* is part of the region. If the pixel value is between the minimum sample value
|
|
99
|
+
* and maximum sample value, the pixel value represents an (application defined)
|
|
100
|
+
* probability that the pixel is part of the region, where higher pixel values
|
|
101
|
+
* correspond to higher probability values.
|
|
102
|
+
*/
|
|
103
|
+
heif_region_type_referenced_mask = 4,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Inline mask.
|
|
107
|
+
*
|
|
108
|
+
* The region geometry is described by a sequence of bits stored in inline
|
|
109
|
+
* in the region, one bit per pixel. If the bit value is `1`, the pixel is
|
|
110
|
+
* part of the region. If the bit value is `0`, the pixel is not part of the
|
|
111
|
+
* region.
|
|
112
|
+
*/
|
|
113
|
+
heif_region_type_inline_mask = 5,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Polyline geometry.
|
|
117
|
+
*
|
|
118
|
+
* The region is represented by a sequence of points, which are not
|
|
119
|
+
* considered to form a closed surface. Only the edge is part of the region.
|
|
120
|
+
*/
|
|
121
|
+
heif_region_type_polyline = 6
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
struct heif_region;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get the number of region items that are attached to an image.
|
|
128
|
+
*
|
|
129
|
+
* @param image_handle the image handle for the image to query.
|
|
130
|
+
* @return the number of region items, which can be zero.
|
|
131
|
+
*/
|
|
132
|
+
LIBHEIF_API
|
|
133
|
+
int heif_image_handle_get_number_of_region_items(const struct heif_image_handle* image_handle);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get the region item identifiers for the region items attached to an image.
|
|
137
|
+
*
|
|
138
|
+
* Possible usage (in C++):
|
|
139
|
+
* @code
|
|
140
|
+
* int numRegionItems = heif_image_handle_get_number_of_region_items(handle);
|
|
141
|
+
* if (numRegionItems > 0) {
|
|
142
|
+
* std::vector<heif_item_id> region_item_ids(numRegionItems);
|
|
143
|
+
* heif_image_handle_get_list_of_region_item_ids(handle, region_item_ids.data(), numRegionItems);
|
|
144
|
+
* // use region item ids
|
|
145
|
+
* }
|
|
146
|
+
* @endcode
|
|
147
|
+
*
|
|
148
|
+
* @param image_handle the image handle for the parent image to query
|
|
149
|
+
* @param region_item_ids_array array to put the item identifiers into
|
|
150
|
+
* @param max_count the maximum number of region identifiers
|
|
151
|
+
* @return the number of region item identifiers that were returned.
|
|
152
|
+
*/
|
|
153
|
+
LIBHEIF_API
|
|
154
|
+
int heif_image_handle_get_list_of_region_item_ids(const struct heif_image_handle* image_handle,
|
|
155
|
+
heif_item_id* region_item_ids_array,
|
|
156
|
+
int max_count);
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get the region item.
|
|
160
|
+
*
|
|
161
|
+
* Caller is responsible for release of the output heif_region_item with heif_region_item_release().
|
|
162
|
+
*
|
|
163
|
+
* @param context the context to get the region item from, usually from a file operation
|
|
164
|
+
* @param region_item_id the identifier for the region item
|
|
165
|
+
* @param out pointer to pointer to the resulting region item
|
|
166
|
+
* @return heif_error_ok on success, or an error value indicating the problem
|
|
167
|
+
*/
|
|
168
|
+
LIBHEIF_API
|
|
169
|
+
struct heif_error heif_context_get_region_item(const struct heif_context* context,
|
|
170
|
+
heif_item_id region_item_id,
|
|
171
|
+
struct heif_region_item** out);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Get the item identifier for a region item.
|
|
175
|
+
*
|
|
176
|
+
* @param region_item the region item to query
|
|
177
|
+
* @return the region item identifier (or -1 if the region_item is null)
|
|
178
|
+
*/
|
|
179
|
+
LIBHEIF_API
|
|
180
|
+
heif_item_id heif_region_item_get_id(struct heif_region_item* region_item);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Release a region item.
|
|
184
|
+
*
|
|
185
|
+
* This should be called on items from heif_context_get_region_item().
|
|
186
|
+
*
|
|
187
|
+
* @param region_item the item to release.
|
|
188
|
+
*/
|
|
189
|
+
LIBHEIF_API
|
|
190
|
+
void heif_region_item_release(struct heif_region_item* region_item);
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get the reference size for a region item.
|
|
194
|
+
*
|
|
195
|
+
* The reference size specifies the coordinate space used for the region items.
|
|
196
|
+
* When the reference size does not match the image size, the regions need to be
|
|
197
|
+
* scaled to correspond.
|
|
198
|
+
*
|
|
199
|
+
* @param out_width the return value for the reference width (before any transformation)
|
|
200
|
+
* @param out_height the return value for the reference height (before any transformation)
|
|
201
|
+
*/
|
|
202
|
+
LIBHEIF_API
|
|
203
|
+
void heif_region_item_get_reference_size(struct heif_region_item*, uint32_t* out_width, uint32_t* out_height);
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Get the number of regions within a region item.
|
|
207
|
+
*
|
|
208
|
+
* @param region_item the region item to query.
|
|
209
|
+
* @return the number of regions
|
|
210
|
+
*/
|
|
211
|
+
LIBHEIF_API
|
|
212
|
+
int heif_region_item_get_number_of_regions(const struct heif_region_item* region_item);
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Get the regions that are part of a region item.
|
|
216
|
+
*
|
|
217
|
+
* Caller is responsible for releasing the returned `heif_region` objects, using heif_region_release()
|
|
218
|
+
* on each region, or heif_region_release_many() on the returned array.
|
|
219
|
+
*
|
|
220
|
+
* Possible usage (in C++):
|
|
221
|
+
* @code
|
|
222
|
+
* int num_regions = heif_image_handle_get_number_of_regions(region_item);
|
|
223
|
+
* if (num_regions > 0) {
|
|
224
|
+
* std::vector<heif_region*> regions(num_regions);
|
|
225
|
+
* int n = heif_region_item_get_list_of_regions(region_item, regions.data(), (int)regions.size());
|
|
226
|
+
* // use regions
|
|
227
|
+
* heif_region_release_many(regions.data(), n);
|
|
228
|
+
* }
|
|
229
|
+
* @endcode
|
|
230
|
+
*
|
|
231
|
+
* @param region_item the region_item to query
|
|
232
|
+
* @param out_regions_array array to put the region pointers into
|
|
233
|
+
* @param max_count the maximum number of regions, which needs to correspond to the size of the out_regions_array
|
|
234
|
+
* @return the number of regions that were returned.
|
|
235
|
+
*/
|
|
236
|
+
LIBHEIF_API
|
|
237
|
+
int heif_region_item_get_list_of_regions(const struct heif_region_item* region_item,
|
|
238
|
+
struct heif_region** out_regions_array,
|
|
239
|
+
int max_count);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Release a region.
|
|
243
|
+
*
|
|
244
|
+
* This should be called on regions from heif_region_item_get_list_of_regions().
|
|
245
|
+
*
|
|
246
|
+
* @param region the region to release.
|
|
247
|
+
*
|
|
248
|
+
* \sa heif_region_release_many() to release the whole list
|
|
249
|
+
*/
|
|
250
|
+
LIBHEIF_API
|
|
251
|
+
void heif_region_release(const struct heif_region* region);
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Release a list of regions.
|
|
255
|
+
*
|
|
256
|
+
* This should be called on the list of regions from heif_region_item_get_list_of_regions().
|
|
257
|
+
*
|
|
258
|
+
* @param regions_array the regions to release.
|
|
259
|
+
* @param num_items the number of items in the array
|
|
260
|
+
*
|
|
261
|
+
* \sa heif_region_release() to release a single region
|
|
262
|
+
*/
|
|
263
|
+
LIBHEIF_API
|
|
264
|
+
void heif_region_release_many(const struct heif_region* const* regions_array, int num_items);
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Get the region type for a specified region.
|
|
268
|
+
*
|
|
269
|
+
* @param region the region to query
|
|
270
|
+
* @return the corresponding region type as an enumeration value
|
|
271
|
+
*/
|
|
272
|
+
LIBHEIF_API
|
|
273
|
+
enum heif_region_type heif_region_get_type(const struct heif_region* region);
|
|
274
|
+
|
|
275
|
+
// When querying the region geometry, there is a version without and a version with "_transformed" suffix.
|
|
276
|
+
// The version without returns the coordinates in the reference coordinate space.
|
|
277
|
+
// The version with "_transformed" suffix give the coordinates in pixels after all transformative properties have been applied.
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Get the values for a point region.
|
|
281
|
+
*
|
|
282
|
+
* This returns the coordinates in the reference coordinate space (from the parent region item).
|
|
283
|
+
*
|
|
284
|
+
* @param region the region to query, which must be of type #heif_region_type_point.
|
|
285
|
+
* @param out_x the X coordinate, where 0 is the left-most column.
|
|
286
|
+
* @param out_y the Y coordinate, where 0 is the top-most row.
|
|
287
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
288
|
+
*
|
|
289
|
+
* \sa heif_region_get_point_transformed() for a version in pixels after all transformative properties have been applied.
|
|
290
|
+
*/
|
|
291
|
+
LIBHEIF_API
|
|
292
|
+
struct heif_error heif_region_get_point(const struct heif_region* region, int32_t* out_x, int32_t* out_y);
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Get the transformed values for a point region.
|
|
296
|
+
*
|
|
297
|
+
* This returns the coordinates in pixels after all transformative properties have been applied.
|
|
298
|
+
*
|
|
299
|
+
* @param region the region to query, which must be of type #heif_region_type_point.
|
|
300
|
+
* @param image_id the identifier for the image to transform / scale the region to
|
|
301
|
+
* @param out_x the X coordinate, where 0 is the left-most column.
|
|
302
|
+
* @param out_y the Y coordinate, where 0 is the top-most row.
|
|
303
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
304
|
+
*
|
|
305
|
+
* \sa heif_region_get_point() for a version that returns the values in the reference coordinate space.
|
|
306
|
+
*/
|
|
307
|
+
LIBHEIF_API
|
|
308
|
+
struct heif_error heif_region_get_point_transformed(const struct heif_region* region, heif_item_id image_id, double* out_x, double* out_y);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Get the values for a rectangle region.
|
|
312
|
+
*
|
|
313
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
314
|
+
* The rectangle is represented by a top left corner position, and a size defined
|
|
315
|
+
* by a width and height. All of the interior points and the edge are
|
|
316
|
+
* part of the region.
|
|
317
|
+
*
|
|
318
|
+
* @param region the region to query, which must be of type #heif_region_type_rectangle.
|
|
319
|
+
* @param out_x the X coordinate for the top left corner, where 0 is the left-most column.
|
|
320
|
+
* @param out_y the Y coordinate for the top left corner, where 0 is the top-most row.
|
|
321
|
+
* @param out_width the width of the rectangle
|
|
322
|
+
* @param out_height the height of the rectangle
|
|
323
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
324
|
+
*
|
|
325
|
+
* \sa heif_region_get_rectangle_transformed() for a version in pixels after all transformative properties have been applied.
|
|
326
|
+
*/
|
|
327
|
+
LIBHEIF_API
|
|
328
|
+
struct heif_error heif_region_get_rectangle(const struct heif_region* region,
|
|
329
|
+
int32_t* out_x, int32_t* out_y,
|
|
330
|
+
uint32_t* out_width, uint32_t* out_height);
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Get the transformed values for a rectangle region.
|
|
334
|
+
*
|
|
335
|
+
* This returns the coordinates in pixels after all transformative properties have been applied.
|
|
336
|
+
* The rectangle is represented by a top left corner position, and a size defined
|
|
337
|
+
* by a width and height. All of the interior points and the edge are
|
|
338
|
+
* part of the region.
|
|
339
|
+
*
|
|
340
|
+
* @param region the region to query, which must be of type #heif_region_type_rectangle.
|
|
341
|
+
* @param image_id the identifier for the image to transform / scale the region to
|
|
342
|
+
* @param out_x the X coordinate for the top left corner, where 0 is the left-most column.
|
|
343
|
+
* @param out_y the Y coordinate for the top left corner, where 0 is the top-most row.
|
|
344
|
+
* @param out_width the width of the rectangle
|
|
345
|
+
* @param out_height the height of the rectangle
|
|
346
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
347
|
+
*
|
|
348
|
+
* \sa heif_region_get_rectangle() for a version that returns the values in the reference coordinate space.
|
|
349
|
+
*/
|
|
350
|
+
LIBHEIF_API
|
|
351
|
+
struct heif_error heif_region_get_rectangle_transformed(const struct heif_region* region,
|
|
352
|
+
heif_item_id image_id,
|
|
353
|
+
double* out_x, double* out_y,
|
|
354
|
+
double* out_width, double* out_height);
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Get the values for an ellipse region.
|
|
358
|
+
*
|
|
359
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
360
|
+
* The ellipse is represented by a centre position, and a size defined
|
|
361
|
+
* by radii in the X and Y directions. All of the interior points and the edge are
|
|
362
|
+
* part of the region.
|
|
363
|
+
*
|
|
364
|
+
* @param region the region to query, which must be of type #heif_region_type_ellipse.
|
|
365
|
+
* @param out_x the X coordinate for the centre point, where 0 is the left-most column.
|
|
366
|
+
* @param out_y the Y coordinate for the centre point, where 0 is the top-most row.
|
|
367
|
+
* @param out_radius_x the radius value in the X direction.
|
|
368
|
+
* @param out_radius_y the radius value in the Y direction
|
|
369
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
370
|
+
*
|
|
371
|
+
* \sa heif_region_get_ellipse_transformed() for a version in pixels after all transformative properties have been applied.
|
|
372
|
+
*/
|
|
373
|
+
LIBHEIF_API
|
|
374
|
+
struct heif_error heif_region_get_ellipse(const struct heif_region* region,
|
|
375
|
+
int32_t* out_x, int32_t* out_y,
|
|
376
|
+
uint32_t* out_radius_x, uint32_t* out_radius_y);
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Get the transformed values for an ellipse region.
|
|
381
|
+
*
|
|
382
|
+
* This returns the coordinates in pixels after all transformative properties have been applied.
|
|
383
|
+
* The ellipse is represented by a centre position, and a size defined
|
|
384
|
+
* by radii in the X and Y directions. All of the interior points and the edge are
|
|
385
|
+
* part of the region.
|
|
386
|
+
*
|
|
387
|
+
* @param region the region to query, which must be of type #heif_region_type_ellipse.
|
|
388
|
+
* @param image_id the identifier for the image to transform / scale the region to
|
|
389
|
+
* @param out_x the X coordinate for the centre point, where 0 is the left-most column.
|
|
390
|
+
* @param out_y the Y coordinate for the centre point, where 0 is the top-most row.
|
|
391
|
+
* @param out_radius_x the radius value in the X direction.
|
|
392
|
+
* @param out_radius_y the radius value in the Y direction
|
|
393
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
394
|
+
*
|
|
395
|
+
* \sa heif_region_get_ellipse() for a version that returns the values in the reference coordinate space.
|
|
396
|
+
*/
|
|
397
|
+
LIBHEIF_API
|
|
398
|
+
struct heif_error heif_region_get_ellipse_transformed(const struct heif_region* region,
|
|
399
|
+
heif_item_id image_id,
|
|
400
|
+
double* out_x, double* out_y,
|
|
401
|
+
double* out_radius_x, double* out_radius_y);
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Get the number of points in a polygon.
|
|
405
|
+
*
|
|
406
|
+
* @param region the region to query, which must be of type #heif_region_type_polygon
|
|
407
|
+
* @return the number of points, or -1 on error.
|
|
408
|
+
*/
|
|
409
|
+
LIBHEIF_API
|
|
410
|
+
int heif_region_get_polygon_num_points(const struct heif_region* region);
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Get the points in a polygon region.
|
|
414
|
+
*
|
|
415
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
416
|
+
*
|
|
417
|
+
* A polygon is a sequence of points that form a closed shape. The first point does
|
|
418
|
+
* not need to be repeated as the last point. All of the interior points and the edge are
|
|
419
|
+
* part of the region.
|
|
420
|
+
* The points are returned as pairs of X,Y coordinates, in the order X<sub>1</sub>,
|
|
421
|
+
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
|
|
422
|
+
*
|
|
423
|
+
* @param region the region to equery, which must be of type #heif_region_type_polygon
|
|
424
|
+
* @param out_pts_array the array to return the points in, which must have twice as many entries as there are points
|
|
425
|
+
* in the polygon.
|
|
426
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
427
|
+
*
|
|
428
|
+
* \sa heif_region_get_polygon_points_transformed() for a version in pixels after all transformative properties have been applied.
|
|
429
|
+
*/
|
|
430
|
+
LIBHEIF_API
|
|
431
|
+
struct heif_error heif_region_get_polygon_points(const struct heif_region* region,
|
|
432
|
+
int32_t* out_pts_array);
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Get the transformed points in a polygon region.
|
|
436
|
+
*
|
|
437
|
+
* This returns the coordinates in pixels after all transformative properties have been applied.
|
|
438
|
+
*
|
|
439
|
+
* A polygon is a sequence of points that form a closed shape. The first point does
|
|
440
|
+
* not need to be repeated as the last point. All of the interior points and the edge are
|
|
441
|
+
* part of the region.
|
|
442
|
+
* The points are returned as pairs of X,Y coordinates, in the order X<sub>1</sub>,
|
|
443
|
+
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
|
|
444
|
+
*
|
|
445
|
+
* @param region the region to equery, which must be of type #heif_region_type_polygon
|
|
446
|
+
* @param image_id the identifier for the image to transform / scale the region to
|
|
447
|
+
* @param out_pts_array the array to return the points in, which must have twice as many entries as there are points
|
|
448
|
+
* in the polygon.
|
|
449
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
450
|
+
*
|
|
451
|
+
* \sa heif_region_get_polygon_points() for a version that returns the values in the reference coordinate space.
|
|
452
|
+
*/
|
|
453
|
+
LIBHEIF_API
|
|
454
|
+
struct heif_error heif_region_get_polygon_points_transformed(const struct heif_region* region,
|
|
455
|
+
heif_item_id image_id,
|
|
456
|
+
double* out_pts_array);
|
|
457
|
+
/**
|
|
458
|
+
* Get the number of points in a polyline.
|
|
459
|
+
*
|
|
460
|
+
* @param region the region to query, which must be of type #heif_region_type_polyline
|
|
461
|
+
* @return the number of points, or -1 on error.
|
|
462
|
+
*/
|
|
463
|
+
LIBHEIF_API
|
|
464
|
+
int heif_region_get_polyline_num_points(const struct heif_region* region);
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Get the points in a polyline region.
|
|
468
|
+
*
|
|
469
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
470
|
+
*
|
|
471
|
+
* A polyline is a sequence of points that does not form a closed shape. Even if the
|
|
472
|
+
* polyline is closed, the only points that are part of the region are those that
|
|
473
|
+
* intersect (even minimally) a one-pixel line drawn along the polyline.
|
|
474
|
+
* The points are provided as pairs of X,Y coordinates, in the order X<sub>1</sub>,
|
|
475
|
+
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
|
|
476
|
+
*
|
|
477
|
+
* Possible usage (in C++):
|
|
478
|
+
* @code
|
|
479
|
+
* int num_polyline_points = heif_region_get_polyline_num_points(region);
|
|
480
|
+
* if (num_polyline_points > 0) {
|
|
481
|
+
* std::vector<int32_t> polyline(num_polyline_points * 2);
|
|
482
|
+
* heif_region_get_polyline_points(region, polyline.data());
|
|
483
|
+
* // do something with points ...
|
|
484
|
+
* }
|
|
485
|
+
* @endcode
|
|
486
|
+
*
|
|
487
|
+
* @param region the region to equery, which must be of type #heif_region_type_polyline
|
|
488
|
+
* @param out_pts_array the array to return the points in, which must have twice as many entries as there are points
|
|
489
|
+
* in the polyline.
|
|
490
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
491
|
+
*
|
|
492
|
+
* \sa heif_region_get_polyline_points_transformed() for a version in pixels after all transformative properties have been applied.
|
|
493
|
+
*/
|
|
494
|
+
LIBHEIF_API
|
|
495
|
+
struct heif_error heif_region_get_polyline_points(const struct heif_region* region,
|
|
496
|
+
int32_t* out_pts_array);
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Get the transformed points in a polyline region.
|
|
500
|
+
*
|
|
501
|
+
* This returns the coordinates in pixels after all transformative properties have been applied.
|
|
502
|
+
*
|
|
503
|
+
* A polyline is a sequence of points that does not form a closed shape. Even if the
|
|
504
|
+
* polyline is closed, the only points that are part of the region are those that
|
|
505
|
+
* intersect (even minimally) a one-pixel line drawn along the polyline.
|
|
506
|
+
* The points are provided as pairs of X,Y coordinates, in the order X<sub>1</sub>,
|
|
507
|
+
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
|
|
508
|
+
*
|
|
509
|
+
* @param region the region to query, which must be of type #heif_region_type_polyline
|
|
510
|
+
* @param image_id the identifier for the image to transform / scale the region to
|
|
511
|
+
* @param out_pts_array the array to return the points in, which must have twice as many entries as there are points
|
|
512
|
+
* in the polyline.
|
|
513
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
514
|
+
*
|
|
515
|
+
* \sa heif_region_get_polyline_points() for a version that returns the values in the reference coordinate space.
|
|
516
|
+
*/
|
|
517
|
+
LIBHEIF_API
|
|
518
|
+
struct heif_error heif_region_get_polyline_points_transformed(const struct heif_region* region,
|
|
519
|
+
heif_item_id image_id,
|
|
520
|
+
double* out_pts_array);
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Get a referenced item mask region.
|
|
524
|
+
*
|
|
525
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
526
|
+
* The mask location is represented by a top left corner position, and a size defined
|
|
527
|
+
* by a width and height. The value of each sample in that mask identifies whether the
|
|
528
|
+
* corresponding pixel is part of the region.
|
|
529
|
+
*
|
|
530
|
+
* The mask is provided as an image in another item. The image item containing the mask
|
|
531
|
+
* is one of:
|
|
532
|
+
*
|
|
533
|
+
* - a mask item (see ISO/IEC 23008-12:2022 Section 6.10.2), or a derived
|
|
534
|
+
* image from a mask item
|
|
535
|
+
*
|
|
536
|
+
* - an image item in monochrome format (4:0:0 chroma)
|
|
537
|
+
*
|
|
538
|
+
* - an image item in colour format with luma and chroma planes (e.g. 4:2:0)
|
|
539
|
+
*
|
|
540
|
+
* If the pixel value is equal to the minimum sample value (e.g. 0 for unsigned
|
|
541
|
+
* integer), the pixel is not part of the region. If the pixel value is equal
|
|
542
|
+
* to the maximum sample value (e.g. 255 for 8 bit unsigned integer), the pixel
|
|
543
|
+
* is part of the region. If the pixel value is between the minimum sample value
|
|
544
|
+
* and maximum sample value, the pixel value represents an (application defined)
|
|
545
|
+
* probability that the pixel is part of the region, where higher pixel values
|
|
546
|
+
* correspond to higher probability values.
|
|
547
|
+
*
|
|
548
|
+
* @param region the region to query, which must be of type #heif_region_type_referenced_mask.
|
|
549
|
+
* @param out_x the X coordinate for the top left corner, where 0 is the left-most column.
|
|
550
|
+
* @param out_y the Y coordinate for the top left corner, where 0 is the top-most row.
|
|
551
|
+
* @param out_width the width of the mask region
|
|
552
|
+
* @param out_height the height of the mask region
|
|
553
|
+
* @param out_mask_item_id the item identifier for the image that provides the mask.
|
|
554
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
555
|
+
*/
|
|
556
|
+
LIBHEIF_API
|
|
557
|
+
struct heif_error heif_region_get_referenced_mask_ID(const struct heif_region* region,
|
|
558
|
+
int32_t* out_x, int32_t* out_y,
|
|
559
|
+
uint32_t* out_width, uint32_t* out_height,
|
|
560
|
+
heif_item_id *out_mask_item_id);
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Get the length of the data in an inline mask region.
|
|
564
|
+
*
|
|
565
|
+
* @param region the region to query, which must be of type #heif_region_type_inline_mask.
|
|
566
|
+
* @return the number of bytes in the mask data, or 0 on error.
|
|
567
|
+
*/
|
|
568
|
+
LIBHEIF_API
|
|
569
|
+
size_t heif_region_get_inline_mask_data_len(const struct heif_region* region);
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Get data for an inline mask region.
|
|
574
|
+
*
|
|
575
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
576
|
+
* The mask location is represented by a top left corner position, and a size defined
|
|
577
|
+
* by a width and height.
|
|
578
|
+
*
|
|
579
|
+
* The mask is held as inline data on the region, one bit per pixel, most significant
|
|
580
|
+
* bit first pixel, no padding. If the bit value is `1`, the corresponding pixel is
|
|
581
|
+
* part of the region. If the bit value is `0`, the corresponding pixel is not part of the
|
|
582
|
+
* region.
|
|
583
|
+
*
|
|
584
|
+
* Possible usage (in C++):
|
|
585
|
+
* @code
|
|
586
|
+
* long unsigned int data_len = heif_region_get_inline_mask_data_len(region);
|
|
587
|
+
* int32_t x, y;
|
|
588
|
+
* uint32_t width, height;
|
|
589
|
+
* std::vector<uint8_t> mask_data(data_len);
|
|
590
|
+
* err = heif_region_get_inline_mask(region, &x, &y, &width, &height, mask_data.data());
|
|
591
|
+
* @endcode
|
|
592
|
+
*
|
|
593
|
+
* @param region the region to query, which must be of type #heif_region_type_inline_mask.
|
|
594
|
+
* @param out_x the X coordinate for the top left corner, where 0 is the left-most column.
|
|
595
|
+
* @param out_y the Y coordinate for the top left corner, where 0 is the top-most row.
|
|
596
|
+
* @param out_width the width of the mask region
|
|
597
|
+
* @param out_height the height of the mask region
|
|
598
|
+
* @param out_mask_data the location to return the mask data
|
|
599
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
600
|
+
*/
|
|
601
|
+
LIBHEIF_API
|
|
602
|
+
struct heif_error heif_region_get_inline_mask_data(const struct heif_region* region,
|
|
603
|
+
int32_t* out_x, int32_t* out_y,
|
|
604
|
+
uint32_t* out_width, uint32_t* out_height,
|
|
605
|
+
uint8_t* out_mask_data);
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Get a mask region image.
|
|
609
|
+
*
|
|
610
|
+
* This returns the values in the reference coordinate space (from the parent region item).
|
|
611
|
+
* The mask location is represented by a top left corner position, and a size defined
|
|
612
|
+
* by a width and height.
|
|
613
|
+
*
|
|
614
|
+
* This function works when the passed region is either a heif_region_type_referenced_mask or
|
|
615
|
+
* a heif_region_type_inline_mask.
|
|
616
|
+
* The returned image is a monochrome image where each pixel represents the (scaled) probability
|
|
617
|
+
* of the pixel being part of the mask.
|
|
618
|
+
*
|
|
619
|
+
* If the region type is an inline mask, which always holds a binary mask, this function
|
|
620
|
+
* converts the binary inline mask to an 8-bit monochrome image with the values '0' and '255'.
|
|
621
|
+
* The pixel value is set to `255` where the pixel is part of the region, and `0` where the
|
|
622
|
+
* pixel is not part of the region.
|
|
623
|
+
*
|
|
624
|
+
* @param region the region to query, which must be of type #heif_region_type_inline_mask.
|
|
625
|
+
* @param out_x the X coordinate for the top left corner, where 0 is the left-most column.
|
|
626
|
+
* @param out_y the Y coordinate for the top left corner, where 0 is the top-most row.
|
|
627
|
+
* @param out_width the width of the mask region
|
|
628
|
+
* @param out_height the height of the mask region
|
|
629
|
+
* @param out_mask_image the returned mask image
|
|
630
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
631
|
+
*
|
|
632
|
+
* \note the caller is responsible for releasing the mask image
|
|
633
|
+
*/
|
|
634
|
+
LIBHEIF_API
|
|
635
|
+
struct heif_error heif_region_get_mask_image(const struct heif_region* region,
|
|
636
|
+
int32_t* out_x, int32_t* out_y,
|
|
637
|
+
uint32_t* out_width, uint32_t* out_height,
|
|
638
|
+
struct heif_image** out_mask_image);
|
|
639
|
+
|
|
640
|
+
// --- adding region items
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Add a region item to an image.
|
|
644
|
+
*
|
|
645
|
+
* The region item is a collection of regions (point, polyline, polygon, rectangle, ellipse or mask)
|
|
646
|
+
* along with a reference size (width and height) that forms the coordinate basis for the regions.
|
|
647
|
+
*
|
|
648
|
+
* The concept is to add the region item, then add one or more regions to the region item.
|
|
649
|
+
*
|
|
650
|
+
* @param image_handle the image to attach the region item to.
|
|
651
|
+
* @param reference_width the width of the reference size.
|
|
652
|
+
* @param reference_height the height of the reference size.
|
|
653
|
+
* @param out_region_item the resulting region item
|
|
654
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
655
|
+
*/
|
|
656
|
+
LIBHEIF_API
|
|
657
|
+
struct heif_error heif_image_handle_add_region_item(struct heif_image_handle* image_handle,
|
|
658
|
+
uint32_t reference_width, uint32_t reference_height,
|
|
659
|
+
struct heif_region_item** out_region_item);
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Add a point region to the region item.
|
|
663
|
+
*
|
|
664
|
+
* @param region_item the region item that holds this point region
|
|
665
|
+
* @param x the x value for the point location
|
|
666
|
+
* @param y the y value for the point location
|
|
667
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
668
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
669
|
+
*
|
|
670
|
+
* @note The `out_region` parameter is optional, and can be set to `NULL` if not needed.
|
|
671
|
+
*/
|
|
672
|
+
LIBHEIF_API
|
|
673
|
+
struct heif_error heif_region_item_add_region_point(struct heif_region_item* region_item,
|
|
674
|
+
int32_t x, int32_t y,
|
|
675
|
+
struct heif_region** out_region);
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Add a rectangle region to the region item.
|
|
679
|
+
*
|
|
680
|
+
* @param region_item the region item that holds this rectangle region
|
|
681
|
+
* @param x the x value for the top-left corner of this rectangle region
|
|
682
|
+
* @param y the y value for the top-left corner of this rectangle region
|
|
683
|
+
* @param width the width of this rectangle region
|
|
684
|
+
* @param height the height of this rectangle region
|
|
685
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
686
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
687
|
+
*
|
|
688
|
+
* @note The `out_region` parameter is optional, and can be set to `NULL` if not needed.
|
|
689
|
+
*/
|
|
690
|
+
LIBHEIF_API
|
|
691
|
+
struct heif_error heif_region_item_add_region_rectangle(struct heif_region_item* region_item,
|
|
692
|
+
int32_t x, int32_t y,
|
|
693
|
+
uint32_t width, uint32_t height,
|
|
694
|
+
struct heif_region** out_region);
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Add a ellipse region to the region item.
|
|
698
|
+
*
|
|
699
|
+
* @param region_item the region item that holds this ellipse region
|
|
700
|
+
* @param x the x value for the centre of this ellipse region
|
|
701
|
+
* @param y the y value for the centre of this ellipse region
|
|
702
|
+
* @param radius_x the radius of the ellipse in the X (horizontal) direction
|
|
703
|
+
* @param radius_y the radius of the ellipse in the Y (vertical) direction
|
|
704
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
705
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
706
|
+
*
|
|
707
|
+
* @note The `out_region` parameter is optional, and can be set to `NULL` if not needed.
|
|
708
|
+
*/
|
|
709
|
+
LIBHEIF_API
|
|
710
|
+
struct heif_error heif_region_item_add_region_ellipse(struct heif_region_item* region_item,
|
|
711
|
+
int32_t x, int32_t y,
|
|
712
|
+
uint32_t radius_x, uint32_t radius_y,
|
|
713
|
+
struct heif_region** out_region);
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Add a polygon region to the region item.
|
|
717
|
+
*
|
|
718
|
+
* A polygon is a sequence of points that form a closed shape. The first point does
|
|
719
|
+
* not need to be repeated as the last point.
|
|
720
|
+
* The points are provided as pairs of X,Y coordinates, in the order X<sub>1</sub>,
|
|
721
|
+
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
|
|
722
|
+
*
|
|
723
|
+
* @param region_item the region item that holds this polygon region
|
|
724
|
+
* @param pts_array the array of points in X,Y order (see above)
|
|
725
|
+
* @param nPoints the number of points
|
|
726
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
727
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
728
|
+
*
|
|
729
|
+
* @note `nPoints` is the number of points, not the number of elements in the array
|
|
730
|
+
* @note The `out_region` parameter is optional, and can be set to `NULL` if not needed.
|
|
731
|
+
*/
|
|
732
|
+
LIBHEIF_API
|
|
733
|
+
struct heif_error heif_region_item_add_region_polygon(struct heif_region_item* region_item,
|
|
734
|
+
const int32_t* pts_array, int nPoints,
|
|
735
|
+
struct heif_region** out_region);
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Add a polyline region to the region item.
|
|
739
|
+
*
|
|
740
|
+
* A polyline is a sequence of points that does not form a closed shape. Even if the
|
|
741
|
+
* polyline is closed, the only points that are part of the region are those that
|
|
742
|
+
* intersect (even minimally) a one-pixel line drawn along the polyline.
|
|
743
|
+
* The points are provided as pairs of X,Y coordinates, in the order X<sub>1</sub>,
|
|
744
|
+
* Y<sub>1</sub>, X<sub>2</sub>, Y<sub>2</sub>, ..., X<sub>n</sub>, Y<sub>n</sub>.
|
|
745
|
+
*
|
|
746
|
+
* @param region_item the region item that holds this polyline region
|
|
747
|
+
* @param pts_array the array of points in X,Y order (see above)
|
|
748
|
+
* @param nPoints the number of points
|
|
749
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
750
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
751
|
+
*
|
|
752
|
+
* @note `nPoints` is the number of points, not the number of elements in the array
|
|
753
|
+
* @note The `out_region` parameter is optional, and can be set to `NULL` if not needed.
|
|
754
|
+
*/
|
|
755
|
+
LIBHEIF_API
|
|
756
|
+
struct heif_error heif_region_item_add_region_polyline(struct heif_region_item* region_item,
|
|
757
|
+
const int32_t* pts_array, int nPoints,
|
|
758
|
+
struct heif_region** out_region);
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Add a referenced mask region to the region item.
|
|
763
|
+
*
|
|
764
|
+
* The region geometry is described by the pixels in another image item,
|
|
765
|
+
* which has a item reference of type `mask` from the region item to the
|
|
766
|
+
* image item containing the mask.
|
|
767
|
+
*
|
|
768
|
+
* The image item containing the mask is one of:
|
|
769
|
+
*
|
|
770
|
+
* - a mask item (see ISO/IEC 23008-12:2022 Section 6.10.2), or a derived
|
|
771
|
+
* image from a mask item
|
|
772
|
+
*
|
|
773
|
+
* - an image item in monochrome format (4:0:0 chroma)
|
|
774
|
+
*
|
|
775
|
+
* - an image item in colour format with luma and chroma planes (e.g. 4:2:0)
|
|
776
|
+
*
|
|
777
|
+
* If the pixel value is equal to the minimum sample value (e.g. 0 for unsigned
|
|
778
|
+
* integer), the pixel is not part of the region. If the pixel value is equal
|
|
779
|
+
* to the maximum sample value (e.g. 255 for 8 bit unsigned integer), the pixel
|
|
780
|
+
* is part of the region. If the pixel value is between the minimum sample value
|
|
781
|
+
* and maximum sample value, the pixel value represents an (application defined)
|
|
782
|
+
* probability that the pixel is part of the region, where higher pixel values
|
|
783
|
+
* correspond to higher probability values.
|
|
784
|
+
*
|
|
785
|
+
* @param region_item the region item that holds this mask region
|
|
786
|
+
* @param x the x value for the top-left corner of this mask region
|
|
787
|
+
* @param y the y value for the top-left corner of this mask region
|
|
788
|
+
* @param width the width of this mask region
|
|
789
|
+
* @param height the height of this mask region
|
|
790
|
+
* @param mask_item_id the item identifier for the mask that is referenced
|
|
791
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
792
|
+
* @return heif_error_ok on success, or an error indicating the problem on failure
|
|
793
|
+
*
|
|
794
|
+
* @note The `out_region` parameter is optional, and can be set to `NULL` if not needed.
|
|
795
|
+
*/
|
|
796
|
+
LIBHEIF_API
|
|
797
|
+
struct heif_error heif_region_item_add_region_referenced_mask(struct heif_region_item* region_item,
|
|
798
|
+
int32_t x, int32_t y,
|
|
799
|
+
uint32_t width, uint32_t height,
|
|
800
|
+
heif_item_id mask_item_id,
|
|
801
|
+
struct heif_region** out_region);
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Add an inline mask region to the region item.
|
|
806
|
+
*
|
|
807
|
+
* The region geometry is described by a top left corner position, and a size defined
|
|
808
|
+
* by a width and height.
|
|
809
|
+
*
|
|
810
|
+
* The mask is held as inline data on the region, one bit per pixel, most significant
|
|
811
|
+
* bit first pixel, no padding. If the bit value is `1`, the corresponding pixel is
|
|
812
|
+
* part of the region. If the bit value is `0`, the corresponding pixel is not part of the
|
|
813
|
+
* region.
|
|
814
|
+
*
|
|
815
|
+
* @param region_item the region item that holds this mask region
|
|
816
|
+
* @param x the x value for the top-left corner of this mask region
|
|
817
|
+
* @param y the y value for the top-left corner of this mask region
|
|
818
|
+
* @param width the width of this mask region
|
|
819
|
+
* @param height the height of this mask region
|
|
820
|
+
* @param mask_data the location to return the mask data
|
|
821
|
+
* @param mask_data_len the length of the mask data, in bytes
|
|
822
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
823
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
824
|
+
*/
|
|
825
|
+
LIBHEIF_API
|
|
826
|
+
struct heif_error heif_region_item_add_region_inline_mask_data(struct heif_region_item* region_item,
|
|
827
|
+
int32_t x, int32_t y,
|
|
828
|
+
uint32_t width, uint32_t height,
|
|
829
|
+
const uint8_t* mask_data,
|
|
830
|
+
size_t mask_data_len,
|
|
831
|
+
struct heif_region** out_region);
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Add an inline mask region image to the region item.
|
|
835
|
+
*
|
|
836
|
+
* The region geometry is described by a top left corner position, and a size defined
|
|
837
|
+
* by a width and height.
|
|
838
|
+
*
|
|
839
|
+
* The mask data is held as inline data on the region, one bit per pixel. The provided
|
|
840
|
+
* image is converted to inline data, where any pixel with a value >= 0x80 becomes part of the
|
|
841
|
+
* mask region. If the image width is less that the specified width, it is expanded
|
|
842
|
+
* to match the width of the region (zero fill on the right). If the image height is
|
|
843
|
+
* less than the specified height, it is expanded to match the height of the region
|
|
844
|
+
* (zero fill on the bottom). If the image width or height is greater than the
|
|
845
|
+
* width or height (correspondingly) of the region, the image is cropped.
|
|
846
|
+
*
|
|
847
|
+
* @param region_item the region item that holds this mask region
|
|
848
|
+
* @param x the x value for the top-left corner of this mask region
|
|
849
|
+
* @param y the y value for the top-left corner of this mask region
|
|
850
|
+
* @param width the width of this mask region
|
|
851
|
+
* @param height the height of this mask region
|
|
852
|
+
* @param image the image to convert to an inline mask
|
|
853
|
+
* @param out_region pointer to pointer to the returned region (optional, see below)
|
|
854
|
+
* @return heif_error_ok on success, or an error value indicating the problem on failure
|
|
855
|
+
*/
|
|
856
|
+
LIBHEIF_API
|
|
857
|
+
struct heif_error heif_region_item_add_region_inline_mask(struct heif_region_item* region_item,
|
|
858
|
+
int32_t x, int32_t y,
|
|
859
|
+
uint32_t width, uint32_t height,
|
|
860
|
+
struct heif_image* image,
|
|
861
|
+
struct heif_region** out_region);
|
|
862
|
+
#ifdef __cplusplus
|
|
863
|
+
}
|
|
864
|
+
#endif
|
|
865
|
+
|
|
866
|
+
#endif
|