ohos_image_kit_sys/native_image/image_source/image_source_ffi.rs
1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6use crate::native_image::common::*;
7#[cfg(feature = "api-13")]
8use crate::native_image::picture::{Image_AuxiliaryPictureType, OH_PictureNative};
9use ohos_rawfile_sys::RawFileDescriptor;
10pub use ohos_sys_opaque_types::OH_ImageSourceNative;
11use ohos_sys_opaque_types::OH_PixelmapNative;
12
13/// Defines image source infomation
14/// [`OH_ImageSourceInfo_Create`].
15///
16///
17/// Available since API-level: 12
18#[cfg(feature = "api-12")]
19#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
20#[repr(C)]
21pub struct OH_ImageSource_Info {
22 _unused: [u8; 0],
23}
24/// Defines decoding options for picture
25/// [`OH_DecodingOptionsForPicture_Create`].
26///
27///
28/// Available since API-level: 13
29#[cfg(feature = "api-13")]
30#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
31#[repr(C)]
32pub struct OH_DecodingOptionsForPicture {
33 _unused: [u8; 0],
34}
35#[cfg(feature = "api-12")]
36#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
37impl IMAGE_DYNAMIC_RANGE {
38 pub const IMAGE_DYNAMIC_RANGE_AUTO: IMAGE_DYNAMIC_RANGE = IMAGE_DYNAMIC_RANGE(0);
39 pub const IMAGE_DYNAMIC_RANGE_SDR: IMAGE_DYNAMIC_RANGE = IMAGE_DYNAMIC_RANGE(1);
40 pub const IMAGE_DYNAMIC_RANGE_HDR: IMAGE_DYNAMIC_RANGE = IMAGE_DYNAMIC_RANGE(2);
41}
42#[repr(transparent)]
43/// Enumerates decoding dynamic range..
44///
45///
46/// Available since API-level: 12
47#[cfg(feature = "api-12")]
48#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
49#[derive(Debug, Clone, Hash, PartialEq, Eq)]
50pub struct IMAGE_DYNAMIC_RANGE(pub ::core::ffi::c_uint);
51#[cfg(feature = "api-15")]
52#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
53impl IMAGE_ALLOCATOR_TYPE {
54 pub const IMAGE_ALLOCATOR_TYPE_AUTO: IMAGE_ALLOCATOR_TYPE = IMAGE_ALLOCATOR_TYPE(0);
55 pub const IMAGE_ALLOCATOR_TYPE_DMA: IMAGE_ALLOCATOR_TYPE = IMAGE_ALLOCATOR_TYPE(1);
56 pub const IMAGE_ALLOCATOR_TYPE_SHARE_MEMORY: IMAGE_ALLOCATOR_TYPE = IMAGE_ALLOCATOR_TYPE(2);
57}
58#[repr(transparent)]
59/// Type of allocator used to allocate memory of a PixelMap..
60///
61///
62/// Available since API-level: 15
63#[cfg(feature = "api-15")]
64#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
65#[derive(Debug, Clone, Hash, PartialEq, Eq)]
66pub struct IMAGE_ALLOCATOR_TYPE(pub ::core::ffi::c_uint);
67#[cfg(feature = "api-18")]
68#[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
69impl Image_CropAndScaleStrategy {
70 /// Scale first, then crop.
71 pub const SCALE_FIRST: Image_CropAndScaleStrategy = Image_CropAndScaleStrategy(1);
72 /// Crop first, then scale.
73 pub const CROP_FIRST: Image_CropAndScaleStrategy = Image_CropAndScaleStrategy(2);
74}
75#[repr(transparent)]
76/// The strategy for executing the two operations when both desiredSize and desiredRegion
77/// are specified.
78///
79///
80/// Available since API-level: 18
81#[cfg(feature = "api-18")]
82#[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
83#[derive(Debug, Clone, Hash, PartialEq, Eq)]
84pub struct Image_CropAndScaleStrategy(pub ::core::ffi::c_uint);
85/// Defines the options for decoding the image source.
86/// It is used in [`OH_ImageSourceNative_CreatePixelmap`].
87///
88///
89/// Available since API-level: 12
90#[cfg(feature = "api-12")]
91#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
92#[repr(C)]
93pub struct OH_DecodingOptions {
94 _unused: [u8; 0],
95}
96extern "C" {
97 /// Create a pointer for OH_ImageSource_Info struct.
98 ///
99 /// # Arguments
100 ///
101 /// * `info` - The OH_ImageSource_Info pointer will be operated.
102 ///
103 /// # Returns
104 ///
105 /// * Returns [`Image_ErrorCode`]
106 ///
107 /// Available since API-level: 12
108 #[cfg(feature = "api-12")]
109 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
110 pub fn OH_ImageSourceInfo_Create(info: *mut *mut OH_ImageSource_Info) -> ImageResult;
111 /// Get width number for OH_ImageSource_Info struct.
112 ///
113 /// # Arguments
114 ///
115 /// * `info` - The OH_ImageSource_Info pointer will be operated.
116 ///
117 /// * `width` - the number of image width.
118 ///
119 /// # Returns
120 ///
121 /// * Returns [`Image_ErrorCode`]
122 ///
123 /// Available since API-level: 12
124 #[cfg(feature = "api-12")]
125 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
126 pub fn OH_ImageSourceInfo_GetWidth(
127 info: *mut OH_ImageSource_Info,
128 width: *mut u32,
129 ) -> ImageResult;
130 /// Get height number for OH_ImageSource_Info struct.
131 ///
132 /// # Arguments
133 ///
134 /// * `info` - The OH_ImageSource_Info pointer will be operated.
135 ///
136 /// * `height` - the number of image height.
137 ///
138 /// # Returns
139 ///
140 /// * Returns [`Image_ErrorCode`]
141 ///
142 /// Available since API-level: 12
143 #[cfg(feature = "api-12")]
144 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
145 pub fn OH_ImageSourceInfo_GetHeight(
146 info: *mut OH_ImageSource_Info,
147 height: *mut u32,
148 ) -> ImageResult;
149 /// Get isHdr for OH_ImageSource_Info struct.
150 ///
151 /// # Arguments
152 ///
153 /// * `info` - The OH_ImageSource_Info pointer will be operated. Pointer connot be null.
154 ///
155 /// * `isHdr` - Whether the image has a high dynamic range.
156 ///
157 /// # Returns
158 ///
159 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - The operation is successful.
160 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed.
161 ///
162 /// Available since API-level: 12
163 #[cfg(feature = "api-12")]
164 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
165 pub fn OH_ImageSourceInfo_GetDynamicRange(
166 info: *mut OH_ImageSource_Info,
167 isHdr: *mut bool,
168 ) -> ImageResult;
169 /// Obtains the MIME type of an image source.
170 ///
171 /// # Arguments
172 ///
173 /// * `info` - Pointer to the OH_ImageSource_Info struct.
174 ///
175 /// * `mimetype` - Pointer to the MIME type of the image source.
176 ///
177 /// # Returns
178 ///
179 /// * Returns one of the following result codes:
180 /// [`IMAGE_SUCCESS`] if the execution is successful.
181 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if info or mimetype is a null pointer.
182 ///
183 /// Available since API-level: 20
184 #[cfg(feature = "api-20")]
185 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
186 pub fn OH_ImageSourceInfo_GetMimeType(
187 info: *mut OH_ImageSource_Info,
188 mimetype: *mut Image_MimeType,
189 ) -> ImageResult;
190 /// delete OH_ImageSource_Info pointer.
191 ///
192 /// # Arguments
193 ///
194 /// * `info` - The OH_ImageSource_Info pointer will be operated.
195 ///
196 /// # Returns
197 ///
198 /// * Returns [`Image_ErrorCode`]
199 ///
200 /// Available since API-level: 12
201 #[cfg(feature = "api-12")]
202 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
203 pub fn OH_ImageSourceInfo_Release(info: *mut OH_ImageSource_Info) -> ImageResult;
204 /// Create a pointer for OH_DecodingOptions struct.
205 ///
206 /// # Arguments
207 ///
208 /// * `options` - The OH_DecodingOptions pointer will be operated.
209 ///
210 /// # Returns
211 ///
212 /// * Returns [`Image_ErrorCode`]
213 ///
214 /// Available since API-level: 12
215 #[cfg(feature = "api-12")]
216 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
217 pub fn OH_DecodingOptions_Create(options: *mut *mut OH_DecodingOptions) -> ImageResult;
218 /// Get pixelFormat number for OH_DecodingOptions struct.
219 ///
220 /// # Arguments
221 ///
222 /// * `options` - The OH_DecodingOptions pointer will be operated.
223 ///
224 /// * `pixelFormat` - the number of image pixelFormat.
225 ///
226 /// # Returns
227 ///
228 /// * Returns [`Image_ErrorCode`]
229 ///
230 /// Available since API-level: 12
231 #[cfg(feature = "api-12")]
232 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
233 pub fn OH_DecodingOptions_GetPixelFormat(
234 options: *mut OH_DecodingOptions,
235 pixelFormat: *mut i32,
236 ) -> ImageResult;
237 /// Set pixelFormat number for OH_DecodingOptions struct.
238 ///
239 /// # Arguments
240 ///
241 /// * `options` - The OH_DecodingOptions pointer will be operated.
242 ///
243 /// * `pixelFormat` - the number of image pixelFormat.
244 ///
245 /// # Returns
246 ///
247 /// * Returns [`Image_ErrorCode`]
248 ///
249 /// Available since API-level: 12
250 #[cfg(feature = "api-12")]
251 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
252 pub fn OH_DecodingOptions_SetPixelFormat(
253 options: *mut OH_DecodingOptions,
254 pixelFormat: i32,
255 ) -> ImageResult;
256 /// Get index number for OH_DecodingOptions struct.
257 ///
258 /// # Arguments
259 ///
260 /// * `options` - The OH_DecodingOptions pointer will be operated.
261 ///
262 /// * `index` - the number of image index.
263 ///
264 /// # Returns
265 ///
266 /// * Returns [`Image_ErrorCode`]
267 ///
268 /// Available since API-level: 12
269 #[cfg(feature = "api-12")]
270 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
271 pub fn OH_DecodingOptions_GetIndex(
272 options: *mut OH_DecodingOptions,
273 index: *mut u32,
274 ) -> ImageResult;
275 /// Set index number for OH_DecodingOptions struct.
276 ///
277 /// # Arguments
278 ///
279 /// * `options` - The OH_DecodingOptions pointer will be operated.
280 ///
281 /// * `index` - the number of image index.
282 ///
283 /// # Returns
284 ///
285 /// * Returns [`Image_ErrorCode`]
286 ///
287 /// Available since API-level: 12
288 #[cfg(feature = "api-12")]
289 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
290 pub fn OH_DecodingOptions_SetIndex(options: *mut OH_DecodingOptions, index: u32)
291 -> ImageResult;
292 /// Get rotate number for OH_DecodingOptions struct.
293 ///
294 /// # Arguments
295 ///
296 /// * `options` - The OH_DecodingOptions pointer will be operated.
297 ///
298 /// * `rotate` - the number of image rotate.
299 ///
300 /// # Returns
301 ///
302 /// * Returns [`Image_ErrorCode`]
303 ///
304 /// Available since API-level: 12
305 #[cfg(feature = "api-12")]
306 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
307 pub fn OH_DecodingOptions_GetRotate(
308 options: *mut OH_DecodingOptions,
309 rotate: *mut f32,
310 ) -> ImageResult;
311 /// Set rotate number for OH_DecodingOptions struct.
312 ///
313 /// # Arguments
314 ///
315 /// * `options` - The OH_DecodingOptions pointer will be operated.
316 ///
317 /// * `rotate` - the number of image rotate.
318 ///
319 /// # Returns
320 ///
321 /// * Returns [`Image_ErrorCode`]
322 ///
323 /// Available since API-level: 12
324 #[cfg(feature = "api-12")]
325 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
326 pub fn OH_DecodingOptions_SetRotate(
327 options: *mut OH_DecodingOptions,
328 rotate: f32,
329 ) -> ImageResult;
330 /// Get desiredSize number for OH_DecodingOptions struct.
331 ///
332 /// # Arguments
333 ///
334 /// * `options` - The OH_DecodingOptions pointer will be operated.
335 ///
336 /// * `desiredSize` - the number of image desiredSize.
337 ///
338 /// # Returns
339 ///
340 /// * Returns [`Image_ErrorCode`]
341 ///
342 /// Available since API-level: 12
343 #[cfg(feature = "api-12")]
344 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
345 pub fn OH_DecodingOptions_GetDesiredSize(
346 options: *mut OH_DecodingOptions,
347 desiredSize: *mut Image_Size,
348 ) -> ImageResult;
349 /// Set desiredSize number for OH_DecodingOptions struct.
350 ///
351 /// # Arguments
352 ///
353 /// * `options` - The OH_DecodingOptions pointer will be operated.
354 ///
355 /// * `desiredSize` - the number of image desiredSize.
356 ///
357 /// # Returns
358 ///
359 /// * Returns [`Image_ErrorCode`]
360 ///
361 /// Available since API-level: 12
362 #[cfg(feature = "api-12")]
363 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
364 pub fn OH_DecodingOptions_SetDesiredSize(
365 options: *mut OH_DecodingOptions,
366 desiredSize: *mut Image_Size,
367 ) -> ImageResult;
368 /// Set desiredRegion number for OH_DecodingOptions struct.
369 ///
370 /// # Arguments
371 ///
372 /// * `options` - The OH_DecodingOptions pointer will be operated.
373 ///
374 /// * `desiredRegion` - the number of image desiredRegion.
375 ///
376 /// # Returns
377 ///
378 /// * Returns [`Image_ErrorCode`]
379 ///
380 /// Available since API-level: 12
381 #[cfg(feature = "api-12")]
382 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
383 pub fn OH_DecodingOptions_GetDesiredRegion(
384 options: *mut OH_DecodingOptions,
385 desiredRegion: *mut Image_Region,
386 ) -> ImageResult;
387 /// Set desiredRegion number for OH_DecodingOptions struct.
388 ///
389 /// # Arguments
390 ///
391 /// * `options` - The OH_DecodingOptions pointer will be operated.
392 ///
393 /// * `desiredRegion` - the number of image desiredRegion.
394 ///
395 /// # Returns
396 ///
397 /// * Returns [`Image_ErrorCode`]
398 ///
399 /// Available since API-level: 12
400 #[cfg(feature = "api-12")]
401 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
402 pub fn OH_DecodingOptions_SetDesiredRegion(
403 options: *mut OH_DecodingOptions,
404 desiredRegion: *mut Image_Region,
405 ) -> ImageResult;
406 /// Set desiredDynamicRange number for OH_DecodingOptions struct.
407 ///
408 /// # Arguments
409 ///
410 /// * `options` - The OH_DecodingOptions pointer will be operated. Pointer connot be null.
411 ///
412 /// * `desiredDynamicRange` - the number of desired dynamic range [`IMAGE_DYNAMIC_RANGE`]. Pointer connot be null.
413 ///
414 /// # Returns
415 ///
416 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - The operation is successful.
417 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed.
418 ///
419 /// Available since API-level: 12
420 #[cfg(feature = "api-12")]
421 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
422 pub fn OH_DecodingOptions_GetDesiredDynamicRange(
423 options: *mut OH_DecodingOptions,
424 desiredDynamicRange: *mut i32,
425 ) -> ImageResult;
426 /// Sets a cropping and scaling strategy for decoding options.
427 ///
428 /// # Arguments
429 ///
430 /// * `options` - Pointer to the decoding options.
431 ///
432 /// * `cropAndScaleStrategy` - Strategy for executing the cropping and scaling operations when both desiredSize and
433 /// desiredRegion are specified.
434 ///
435 /// # Returns
436 ///
437 /// * Returns one of the following result codes:
438 /// [`IMAGE_SUCCESS`]: The execution is successful.
439 /// [`IMAGE_BAD_PARAMETER`]: options is a null pointer or cropAndScaleStrategy is not in the range of
440 /// Image_CropAndScaleStrategy.
441 ///
442 /// Available since API-level: 18
443 #[cfg(feature = "api-18")]
444 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
445 pub fn OH_DecodingOptions_SetCropAndScaleStrategy(
446 options: *mut OH_DecodingOptions,
447 cropAndScaleStrategy: i32,
448 ) -> ImageResult;
449 /// Obtains the cropping and scaling strategy of decoding options.
450 ///
451 /// # Arguments
452 ///
453 /// * `options` - Pointer to the decoding options.
454 ///
455 /// * `cropAndScaleStrategy` - Pointer to the strategy for executing the cropping and scaling operations when both
456 /// desiredSize and desiredRegion are specified.
457 ///
458 /// # Returns
459 ///
460 /// * Returns one of the following result codes:
461 /// [`IMAGE_SUCCESS`]: The execution is successful.
462 /// [`IMAGE_BAD_PARAMETER`]: options or cropAndScaleStrategy is a null pointer.
463 ///
464 /// Available since API-level: 18
465 #[cfg(feature = "api-18")]
466 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
467 pub fn OH_DecodingOptions_GetCropAndScaleStrategy(
468 options: *mut OH_DecodingOptions,
469 cropAndScaleStrategy: *mut i32,
470 ) -> ImageResult;
471 /// Set desiredDynamicRange number for OH_DecodingOptions struct.
472 ///
473 /// # Arguments
474 ///
475 /// * `options` - The OH_DecodingOptions pointer will be operated. Pointer connot be null.
476 ///
477 /// * `desiredDynamicRange` - the number of desired dynamic range [`IMAGE_DYNAMIC_RANGE`].
478 ///
479 /// # Returns
480 ///
481 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - The operation is successful.
482 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed.
483 ///
484 /// Available since API-level: 12
485 #[cfg(feature = "api-12")]
486 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
487 pub fn OH_DecodingOptions_SetDesiredDynamicRange(
488 options: *mut OH_DecodingOptions,
489 desiredDynamicRange: i32,
490 ) -> ImageResult;
491 /// Obtains the color space set in the decoding options.
492 ///
493 /// # Arguments
494 ///
495 /// * `options` - Pointer to the decoding options.
496 ///
497 /// * `colorSpace` - Pointer to the color space.
498 ///
499 /// # Returns
500 ///
501 /// * Returns one of the following result codes:
502 /// [`IMAGE_SUCCESS`] if the execution is successful.
503 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if options or colorSpace is null pointer.
504 ///
505 /// Available since API-level: 20
506 #[cfg(feature = "api-20")]
507 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
508 pub fn OH_DecodingOptions_GetDesiredColorSpace(
509 options: *mut OH_DecodingOptions,
510 colorSpace: *mut i32,
511 ) -> ImageResult;
512 /// Sets the desired color space for the decoding options.
513 ///
514 /// # Arguments
515 ///
516 /// * `options` - Pointer to the decoding options.
517 ///
518 /// * `colorSpace` - Desired color space.
519 ///
520 /// # Returns
521 ///
522 /// * Returns one of the following result codes:
523 /// [`IMAGE_SUCCESS`] if the execution is successful.
524 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if options is a null pointer or colorSpace is not supported.
525 ///
526 /// Available since API-level: 20
527 #[cfg(feature = "api-20")]
528 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
529 pub fn OH_DecodingOptions_SetDesiredColorSpace(
530 options: *mut OH_DecodingOptions,
531 colorSpace: i32,
532 ) -> ImageResult;
533 /// Sets the crop region for the decoding options.
534 ///
535 /// # Arguments
536 ///
537 /// * `options` - Pointer to the decoding options.
538 ///
539 /// * `cropRegion` - The target region will be cropped from the image.
540 ///
541 /// # Returns
542 ///
543 /// * Returns one of the following result codes:
544 /// [`IMAGE_SUCCESS`] if the execution is successful.
545 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if options or cropRegion is null pointer.
546 ///
547 /// Available since API-level: 19
548 #[cfg(feature = "api-19")]
549 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
550 pub fn OH_DecodingOptions_SetCropRegion(
551 options: *mut OH_DecodingOptions,
552 cropRegion: *mut Image_Region,
553 ) -> ImageResult;
554 /// Gets the crop region for the decoding options.
555 ///
556 /// # Arguments
557 ///
558 /// * `options` - Pointer to the decoding options.
559 ///
560 /// * `cropRegion` - The target region will be cropped from the image.
561 ///
562 /// # Returns
563 ///
564 /// * Returns one of the following result codes:
565 /// [`IMAGE_SUCCESS`] if the execution is successful.
566 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if options or cropRegion is null pointer.
567 ///
568 /// Available since API-level: 19
569 #[cfg(feature = "api-19")]
570 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
571 pub fn OH_DecodingOptions_GetCropRegion(
572 options: *mut OH_DecodingOptions,
573 cropRegion: *mut Image_Region,
574 ) -> ImageResult;
575 /// delete OH_DecodingOptions pointer.
576 ///
577 /// # Arguments
578 ///
579 /// * `options` - The OH_DecodingOptions pointer will be operated.
580 ///
581 /// # Returns
582 ///
583 /// * Returns [`Image_ErrorCode`]
584 ///
585 /// Available since API-level: 12
586 #[cfg(feature = "api-12")]
587 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
588 pub fn OH_DecodingOptions_Release(options: *mut OH_DecodingOptions) -> ImageResult;
589 /// Creates an ImageSource pointer.
590 ///
591 /// # Arguments
592 ///
593 /// * `uri` - Indicates a pointer to the image source URI. Only a file URI or Base64 URI is accepted.
594 ///
595 /// * `uriSize` - Indicates the length of the image source URI.
596 ///
597 /// * `res` - Indicates a pointer to the <b>ImageSource</b> object created at the C++ native layer.
598 ///
599 /// # Returns
600 ///
601 /// * Returns [`Image_ErrorCode`]
602 ///
603 /// Available since API-level: 12
604 #[cfg(feature = "api-12")]
605 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
606 pub fn OH_ImageSourceNative_CreateFromUri(
607 uri: *mut ::core::ffi::c_char,
608 uriSize: usize,
609 res: *mut *mut OH_ImageSourceNative,
610 ) -> ImageResult;
611 /// Creates an void pointer
612 ///
613 /// # Arguments
614 ///
615 /// * `fd` - Indicates the image source file descriptor.
616 ///
617 /// * `res` - Indicates a void pointer to the <b>ImageSource</b> object created at the C++ native layer.
618 ///
619 /// # Returns
620 ///
621 /// * Returns [`Image_ErrorCode`]
622 ///
623 /// Available since API-level: 12
624 #[cfg(feature = "api-12")]
625 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
626 pub fn OH_ImageSourceNative_CreateFromFd(
627 fd: i32,
628 res: *mut *mut OH_ImageSourceNative,
629 ) -> ImageResult;
630 /// Creates an void pointer
631 ///
632 /// # Arguments
633 ///
634 /// * `data` - Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted.
635 ///
636 /// * `dataSize` - Indicates the size of the image source data.
637 ///
638 /// * `res` - Indicates a void pointer to the <b>ImageSource</b> object created at the C++ native layer.
639 ///
640 /// # Returns
641 ///
642 /// * Returns [`Image_ErrorCode`]
643 ///
644 /// Available since API-level: 12
645 #[cfg(feature = "api-12")]
646 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
647 pub fn OH_ImageSourceNative_CreateFromData(
648 data: *mut u8,
649 dataSize: usize,
650 res: *mut *mut OH_ImageSourceNative,
651 ) -> ImageResult;
652 /// Create an image source from data buffer. The data buffer is directly accessed by the image source
653 /// object, and therefore the data buffer must remain accessible within the lifecycle of the image source object.
654 ///
655 /// # Arguments
656 ///
657 /// * `data` - Pointer to the data buffer.
658 ///
659 /// * `datalength` - Length of the data buffer.
660 ///
661 /// * `imageSource` - Double pointer to the image source.
662 ///
663 /// # Returns
664 ///
665 /// * Result code.
666 /// [`IMAGE_SUCCESS`] if the execution is successful.
667 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if data or imageSource is a null pointer or if datalength is 0.
668 ///
669 /// Available since API-level: 20
670 #[cfg(feature = "api-20")]
671 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
672 pub fn OH_ImageSourceNative_CreateFromDataWithUserBuffer(
673 data: *mut u8,
674 datalength: usize,
675 imageSource: *mut *mut OH_ImageSourceNative,
676 ) -> ImageResult;
677 /// Creates an void pointer
678 ///
679 /// # Arguments
680 ///
681 /// * `rawFile` - Indicates the raw file's file descriptor.
682 ///
683 /// * `res` - Indicates a void pointer to the <b>ImageSource</b> object created at the C++ native layer.
684 ///
685 /// # Returns
686 ///
687 /// * Returns [`Image_ErrorCode`]
688 ///
689 /// Available since API-level: 12
690 #[cfg(feature = "api-12")]
691 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
692 pub fn OH_ImageSourceNative_CreateFromRawFile(
693 rawFile: *mut RawFileDescriptor,
694 res: *mut *mut OH_ImageSourceNative,
695 ) -> ImageResult;
696 /// Decodes an void pointer
697 /// based on the specified [`OH_DecodingOptions`] struct.
698 ///
699 /// # Arguments
700 ///
701 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
702 ///
703 /// * `options` - Indicates a pointer to the options for decoding the image source.
704 /// For details, see [`OH_DecodingOptions`].
705 ///
706 /// * `pixelmap` - Indicates a void pointer to the <b>Pixelmap</b> object obtained at the C++ native layer.
707 ///
708 /// # Returns
709 ///
710 /// * Returns [`Image_ErrorCode`]
711 ///
712 /// Available since API-level: 12
713 #[cfg(feature = "api-12")]
714 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
715 pub fn OH_ImageSourceNative_CreatePixelmap(
716 source: *mut OH_ImageSourceNative,
717 options: *mut OH_DecodingOptions,
718 pixelmap: *mut *mut OH_PixelmapNative,
719 ) -> ImageResult;
720 /// Creates a PixelMap based on decoding parameters [`OH_DecodingOptions`], the memory type used by the
721 /// PixelMap can be specified by allocatorType [`IMAGE_ALLOCATOR_TYPE`]. By default, the system selects the memory
722 /// type based on the image type, image size, platform capability, etc. When processing the PixelMap returned by this
723 /// interface, please always consider the impact of stride.
724 ///
725 /// # Arguments
726 ///
727 /// * `source` - Image Source.
728 ///
729 /// * `options` - Decoding parameters, such as the size, pixel format, and color space of the pixelMap.
730 /// For details, see [`OH_DecodingOptions`].
731 ///
732 /// * `allocator` - Indicate which memory type will be used by the returned PixelMap.
733 ///
734 /// * `pixelmap` - Decoded <b>Pixelmap</b> object.
735 ///
736 /// # Returns
737 ///
738 /// * Error code.
739 /// [`IMAGE_SUCCESS`] if the execution is successful.
740 /// [`IMAGE_BAD_PARAMETER`] source is nullptr, or picture is nullptr.
741 /// [`IMAGE_BAD_SOURCE`] data source exception.
742 /// [`IMAGE_SOURCE_UNSUPPORTED_MIME_TYPE`] unsupported mime type.
743 /// [`IMAGE_SOURCE_TOO_LARGE`] image to large.
744 /// [`IMAGE_SOURCE_UNSUPPORTED_ALLOCATOR_TYPE`] unsupported allocator type,
745 /// e.g., use share memory to decode a HDR image as only DMA supported hdr metadata.
746 /// [`IMAGE_SOURCE_UNSUPPORTED_OPTIONS`] unsupported options,
747 /// e.g, cannot convert image into desired pixel format.
748 /// [`IMAGE_DECODE_FAILED`] decode failed.
749 /// [`IMAGE_SOURCE_ALLOC_FAILED`] memory allocation failed.
750 ///
751 /// Available since API-level: 15
752 #[cfg(feature = "api-15")]
753 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
754 pub fn OH_ImageSourceNative_CreatePixelmapUsingAllocator(
755 source: *mut OH_ImageSourceNative,
756 options: *mut OH_DecodingOptions,
757 allocator: IMAGE_ALLOCATOR_TYPE,
758 pixelmap: *mut *mut OH_PixelmapNative,
759 ) -> ImageResult;
760 /// Decodes an void pointer
761 /// the <b>Pixelmap</b> objects at the C++ native layer
762 /// based on the specified [`OH_DecodingOptions`] struct.
763 ///
764 /// # Arguments
765 ///
766 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
767 ///
768 /// * `options` - Indicates a pointer to the options for decoding the image source.
769 /// For details, see [`OH_DecodingOptions`].
770 ///
771 /// * `resVecPixMap` - Indicates a pointer array to the <b>Pixelmap</b> objects obtained at the C++ native layer.
772 /// It cannot be a null pointer.
773 ///
774 /// * `size` - Indicates a size of resVecPixMap. User can get size from [`OH_ImageSourceNative_GetFrameCount`].
775 ///
776 /// # Returns
777 ///
778 /// * Returns [`Image_ErrorCode`]
779 ///
780 /// Available since API-level: 12
781 #[cfg(feature = "api-12")]
782 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
783 pub fn OH_ImageSourceNative_CreatePixelmapList(
784 source: *mut OH_ImageSourceNative,
785 options: *mut OH_DecodingOptions,
786 resVecPixMap: *mut *mut OH_PixelmapNative,
787 size: usize,
788 ) -> ImageResult;
789 /// Create Picture pointer from ImageSource
790 /// based on the specified [`OH_DecodingOptionsForPicture`] struct.
791 ///
792 /// # Arguments
793 ///
794 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
795 ///
796 /// * `options` - Indicates a pointer to the options for decoding the image source.
797 /// For details, see [`OH_DecodingOptionsForPicture`].
798 ///
799 /// * `picture` - Indicates a void pointer to the <b>Picture</b> object obtained at the C++ native layer.
800 ///
801 /// # Returns
802 ///
803 /// * Image functions result code.
804 /// [`IMAGE_SUCCESS`] if the execution is successful.
805 /// [`IMAGE_BAD_PARAMETER`] source is nullptr, or picture is nullptr.
806 /// [`IMAGE_DECODE_FAILED`] decode failed.
807 ///
808 /// Available since API-level: 13
809 #[cfg(feature = "api-13")]
810 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
811 pub fn OH_ImageSourceNative_CreatePicture(
812 source: *mut OH_ImageSourceNative,
813 options: *mut OH_DecodingOptionsForPicture,
814 picture: *mut *mut OH_PictureNative,
815 ) -> ImageResult;
816 /// Decodes an image at the specified index into a Picture object.
817 ///
818 /// # Arguments
819 ///
820 /// * `source` - Pointer to the image source.
821 ///
822 /// * `index` - Image index.
823 ///
824 /// * `picture` - Double pointer to the Picture object obtained after decoding.
825 ///
826 /// # Returns
827 ///
828 /// * Result code.
829 /// [`IMAGE_SUCCESS`]: The execution is successful.
830 /// [`IMAGE_BAD_SOURCE`]: The data source is abnormal.
831 /// [`IMAGE_SOURCE_UNSUPPORTED_MIMETYPE`]: The image format is unsupported.
832 /// [`IMAGE_SOURCE_TOO_LARGE`]: The image is too large.
833 /// [`IMAGE_SOURCE_UNSUPPORTED_OPTIONS`]: The operation is not supported, for example, invalid index.
834 /// [`IMAGE_DECODE_FAILED`]: Decoding fails.
835 ///
836 /// Available since API-level: 20
837 #[cfg(feature = "api-20")]
838 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
839 pub fn OH_ImageSourceNative_CreatePictureAtIndex(
840 source: *mut OH_ImageSourceNative,
841 index: u32,
842 picture: *mut *mut OH_PictureNative,
843 ) -> ImageResult;
844 /// Obtains the delay time list from some <b>ImageSource</b> objects (such as GIF image sources).
845 ///
846 /// # Arguments
847 ///
848 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
849 ///
850 /// * `delayTimeList` - Indicates a pointer to the delay time list obtained. It cannot be a null pointer.
851 ///
852 /// * `size` - Indicates a size of delayTimeList. User can get size from [`OH_ImageSourceNative_GetFrameCount`].
853 ///
854 /// # Returns
855 ///
856 /// * Returns [`Image_ErrorCode`]
857 ///
858 /// Available since API-level: 12
859 #[cfg(feature = "api-12")]
860 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
861 pub fn OH_ImageSourceNative_GetDelayTimeList(
862 source: *mut OH_ImageSourceNative,
863 delayTimeList: *mut i32,
864 size: usize,
865 ) -> ImageResult;
866 /// Obtains image source information from an <b>ImageSource</b> object by index.
867 ///
868 /// # Arguments
869 ///
870 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
871 ///
872 /// * `index` - Indicates the index of the frame.
873 ///
874 /// * `info` - Indicates a pointer to the image source information obtained.
875 /// For details, see [`OH_ImageSource_Info`].
876 ///
877 /// # Returns
878 ///
879 /// * Returns [`Image_ErrorCode`]
880 ///
881 /// Available since API-level: 12
882 #[cfg(feature = "api-12")]
883 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
884 pub fn OH_ImageSourceNative_GetImageInfo(
885 source: *mut OH_ImageSourceNative,
886 index: i32,
887 info: *mut OH_ImageSource_Info,
888 ) -> ImageResult;
889 /// Obtains the value of an image property from an <b>ImageSource</b> object.
890 ///
891 /// # Arguments
892 ///
893 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
894 ///
895 /// * `key` - Indicates a pointer to the property. For details, see [`Image_String`]., key is an exif constant.
896 /// Release after use ImageSource, see [`OH_ImageSourceNative_Release`].
897 ///
898 /// * `value` - Indicates a pointer to the value obtained.The user can pass in a null pointer and zero size,
899 /// we will allocate memory, but user must free memory after use.
900 ///
901 /// # Returns
902 ///
903 /// * Returns [`Image_ErrorCode`]
904 ///
905 /// Available since API-level: 12
906 #[cfg(feature = "api-12")]
907 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
908 pub fn OH_ImageSourceNative_GetImageProperty(
909 source: *mut OH_ImageSourceNative,
910 key: *mut Image_String,
911 value: *mut Image_String,
912 ) -> ImageResult;
913 /// Obtains the value of an image property from an <b>ImageSource</b> object. The output value.data is null-terminated.
914 ///
915 /// # Arguments
916 ///
917 /// * `source` - Pointer to ImageSource.
918 ///
919 /// * `key` - Pointer to the property key.
920 ///
921 /// * `value` - Pointer to the property value. Output Parameter.
922 ///
923 /// # Returns
924 ///
925 /// * Returns One of the following result codes:
926 /// [`IMAGE_SUCCESS`] if the execution is successful.
927 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if source, key or value is nullptr.
928 ///
929 /// Available since API-level: 19
930 #[cfg(feature = "api-19")]
931 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
932 pub fn OH_ImageSourceNative_GetImagePropertyWithNull(
933 source: *mut OH_ImageSourceNative,
934 key: *mut Image_String,
935 value: *mut Image_String,
936 ) -> ImageResult;
937 /// Modifies the value of an image property of an <b>ImageSource</b> object.
938 /// # Arguments
939 ///
940 /// * `source` - Indicates a void pointer(from ImageSource pointer convert).
941 ///
942 /// * `key` - Indicates a pointer to the property. For details, see [`Image_String`]., key is an exif constant.
943 /// Release after use ImageSource, see [`OH_ImageSourceNative_Release`].
944 ///
945 /// * `value` - Indicates a pointer to the new value of the property.
946 ///
947 /// # Returns
948 ///
949 /// * Returns [`Image_ErrorCode`]
950 ///
951 /// Available since API-level: 12
952 #[cfg(feature = "api-12")]
953 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
954 pub fn OH_ImageSourceNative_ModifyImageProperty(
955 source: *mut OH_ImageSourceNative,
956 key: *mut Image_String,
957 value: *mut Image_String,
958 ) -> ImageResult;
959 /// Obtains the number of frames from an <b>ImageSource</b> object.
960 ///
961 /// # Arguments
962 ///
963 /// * `source` - Indicates a pointer to the [`OH_ImageSource`] object at the C++ native layer.
964 ///
965 /// * `frameCount` - The number of image frameCount.
966 ///
967 /// # Returns
968 ///
969 /// * Returns [`Image_ErrorCode`]
970 ///
971 /// Available since API-level: 12
972 #[cfg(feature = "api-12")]
973 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
974 pub fn OH_ImageSourceNative_GetFrameCount(
975 source: *mut OH_ImageSourceNative,
976 frameCount: *mut u32,
977 ) -> ImageResult;
978 /// Releases an <b>ImageSourc</b> object.
979 ///
980 /// # Arguments
981 ///
982 /// * `source` - Indicates a ImageSource pointer.
983 ///
984 /// # Returns
985 ///
986 /// * Returns [`Image_ErrorCode`]
987 ///
988 /// Available since API-level: 12
989 #[cfg(feature = "api-12")]
990 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
991 pub fn OH_ImageSourceNative_Release(source: *mut OH_ImageSourceNative) -> ImageResult;
992 /// Create a pointer for OH_DecodingOptionsForPicture struct.
993 ///
994 /// # Arguments
995 ///
996 /// * `options` - The OH_DecodingOptionsForPicture pointer will be operated.
997 ///
998 /// # Returns
999 ///
1000 /// * Image functions result code.
1001 /// [`IMAGE_SUCCESS`] if the execution is successful.
1002 /// [`IMAGE_BAD_PARAMETER`] options is nullptr.
1003 ///
1004 /// Available since API-level: 13
1005 #[cfg(feature = "api-13")]
1006 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1007 pub fn OH_DecodingOptionsForPicture_Create(
1008 options: *mut *mut OH_DecodingOptionsForPicture,
1009 ) -> ImageResult;
1010 /// Obtains the desired auxiliary pictures of decoding options.
1011 ///
1012 /// # Arguments
1013 ///
1014 /// * `options` - The OH_DecodingOptionsForPicture pointer will be operated.
1015 ///
1016 /// * `desiredAuxiliaryPictures` - The desired auxiliary pictures in DecodingOptionsForPicture.
1017 ///
1018 /// * `length` - The length of desired auxiliary pictures.
1019 ///
1020 /// # Returns
1021 ///
1022 /// * Image functions result code.
1023 /// [`IMAGE_SUCCESS`] if the execution is successful.
1024 /// [`IMAGE_BAD_PARAMETER`] options is nullptr, desiredAuxiliaryPictures is nullptr,
1025 /// or length is invalid.
1026 ///
1027 /// Available since API-level: 13
1028 #[cfg(feature = "api-13")]
1029 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1030 pub fn OH_DecodingOptionsForPicture_GetDesiredAuxiliaryPictures(
1031 options: *mut OH_DecodingOptionsForPicture,
1032 desiredAuxiliaryPictures: *mut *mut Image_AuxiliaryPictureType,
1033 length: *mut usize,
1034 ) -> ImageResult;
1035 /// Set decoding options desired auxiliary pictures.
1036 ///
1037 /// # Arguments
1038 ///
1039 /// * `options` - The OH_DecodingOptionsForPicture pointer will be operated.
1040 ///
1041 /// * `desiredAuxiliaryPictures` - The desired auxiliary pictures will be set.
1042 ///
1043 /// * `length` - The length of desired auxiliary pictures.
1044 ///
1045 /// # Returns
1046 ///
1047 /// * Image functions result code.
1048 /// [`IMAGE_SUCCESS`] if the execution is successful.
1049 /// [`IMAGE_BAD_PARAMETER`] options is nullptr, desiredAuxiliaryPictures is nullptr,
1050 /// or length is invalid.
1051 ///
1052 /// Available since API-level: 13
1053 #[cfg(feature = "api-13")]
1054 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1055 pub fn OH_DecodingOptionsForPicture_SetDesiredAuxiliaryPictures(
1056 options: *mut OH_DecodingOptionsForPicture,
1057 desiredAuxiliaryPictures: *mut Image_AuxiliaryPictureType,
1058 length: usize,
1059 ) -> ImageResult;
1060 /// Releases an <b>DecodingOptionsForPicture</b> object.
1061 ///
1062 /// # Arguments
1063 ///
1064 /// * `options` - Indicates a DecodingOptionsForPicture pointer.
1065 ///
1066 /// # Returns
1067 ///
1068 /// * Image functions result code.
1069 /// [`IMAGE_SUCCESS`] if the execution is successful.
1070 /// [`IMAGE_BAD_PARAMETER`] options is nullptr.
1071 ///
1072 /// Available since API-level: 13
1073 #[cfg(feature = "api-13")]
1074 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1075 pub fn OH_DecodingOptionsForPicture_Release(
1076 options: *mut OH_DecodingOptionsForPicture,
1077 ) -> ImageResult;
1078 /// Obtains the supported image formats that can be decoded.
1079 ///
1080 /// # Arguments
1081 ///
1082 /// * `supportedFormats` - Double pointer to an array of the supported image formats.
1083 ///
1084 /// * `length` - Pointer to the length of the array.
1085 ///
1086 /// # Returns
1087 ///
1088 /// * One of the following result codes:
1089 /// [`IMAGE_SUCCESS`] if the execution is successful.
1090 /// [`IMAGE_SOURCE_INVALID_PARAMETER`] if <b>supportedFormats</b> or <b>length</b> is empty.
1091 ///
1092 /// Available since API-level: 20
1093 #[cfg(feature = "api-20")]
1094 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
1095 pub fn OH_ImageSourceNative_GetSupportedFormats(
1096 supportedFormats: *mut *mut Image_MimeType,
1097 length: *mut usize,
1098 ) -> ImageResult;
1099}