ohos_image_kit_sys/native_image/pixelmap/pixelmap_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::*;
7use ohos_sys_opaque_types::{
8 napi_env, napi_value, OH_NativeBuffer, OH_NativeColorSpaceManager, OH_PixelmapNative,
9};
10
11#[cfg(feature = "api-12")]
12#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
13impl PIXELMAP_ALPHA_TYPE {
14 pub const PIXELMAP_ALPHA_TYPE_UNKNOWN: PIXELMAP_ALPHA_TYPE = PIXELMAP_ALPHA_TYPE(0);
15 pub const PIXELMAP_ALPHA_TYPE_OPAQUE: PIXELMAP_ALPHA_TYPE = PIXELMAP_ALPHA_TYPE(1);
16 pub const PIXELMAP_ALPHA_TYPE_PREMULTIPLIED: PIXELMAP_ALPHA_TYPE = PIXELMAP_ALPHA_TYPE(2);
17 pub const PIXELMAP_ALPHA_TYPE_UNPREMULTIPLIED: PIXELMAP_ALPHA_TYPE = PIXELMAP_ALPHA_TYPE(3);
18}
19#[repr(transparent)]
20/// Define a pixelmap alpha type.
21///
22///
23/// Available since API-level: 12
24#[cfg(feature = "api-12")]
25#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
26#[derive(Debug, Clone, Hash, PartialEq, Eq)]
27pub struct PIXELMAP_ALPHA_TYPE(pub ::core::ffi::c_uint);
28impl PIXEL_FORMAT {
29 pub const PIXEL_FORMAT_UNKNOWN: PIXEL_FORMAT = PIXEL_FORMAT(0);
30 pub const PIXEL_FORMAT_RGB_565: PIXEL_FORMAT = PIXEL_FORMAT(2);
31 pub const PIXEL_FORMAT_RGBA_8888: PIXEL_FORMAT = PIXEL_FORMAT(3);
32 pub const PIXEL_FORMAT_BGRA_8888: PIXEL_FORMAT = PIXEL_FORMAT(4);
33 pub const PIXEL_FORMAT_RGB_888: PIXEL_FORMAT = PIXEL_FORMAT(5);
34 pub const PIXEL_FORMAT_ALPHA_8: PIXEL_FORMAT = PIXEL_FORMAT(6);
35 pub const PIXEL_FORMAT_RGBA_F16: PIXEL_FORMAT = PIXEL_FORMAT(7);
36 pub const PIXEL_FORMAT_NV21: PIXEL_FORMAT = PIXEL_FORMAT(8);
37 pub const PIXEL_FORMAT_NV12: PIXEL_FORMAT = PIXEL_FORMAT(9);
38 pub const PIXEL_FORMAT_RGBA_1010102: PIXEL_FORMAT = PIXEL_FORMAT(10);
39 pub const PIXEL_FORMAT_YCBCR_P010: PIXEL_FORMAT = PIXEL_FORMAT(11);
40 pub const PIXEL_FORMAT_YCRCB_P010: PIXEL_FORMAT = PIXEL_FORMAT(12);
41}
42#[repr(transparent)]
43#[derive(Debug, Clone, Hash, PartialEq, Eq)]
44pub struct PIXEL_FORMAT(pub ::core::ffi::c_uint);
45#[cfg(feature = "api-12")]
46#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
47impl OH_PixelmapNative_AntiAliasingLevel {
48 /// Nearest-neighbor interpolation algorithm
49 pub const OH_PixelmapNative_AntiAliasing_NONE: OH_PixelmapNative_AntiAliasingLevel =
50 OH_PixelmapNative_AntiAliasingLevel(0);
51 /// Bilinear interpolation algorithm
52 pub const OH_PixelmapNative_AntiAliasing_LOW: OH_PixelmapNative_AntiAliasingLevel =
53 OH_PixelmapNative_AntiAliasingLevel(1);
54 /// Bilinear interpolation algorithm with mipmap linear filtering
55 pub const OH_PixelmapNative_AntiAliasing_MEDIUM: OH_PixelmapNative_AntiAliasingLevel =
56 OH_PixelmapNative_AntiAliasingLevel(2);
57 /// Cubic interpolation algorithm
58 pub const OH_PixelmapNative_AntiAliasing_HIGH: OH_PixelmapNative_AntiAliasingLevel =
59 OH_PixelmapNative_AntiAliasingLevel(3);
60}
61#[repr(transparent)]
62/// Defines the anti-aliasing level.
63///
64///
65/// Available since API-level: 12
66#[cfg(feature = "api-12")]
67#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
68#[derive(Debug, Clone, Hash, PartialEq, Eq)]
69pub struct OH_PixelmapNative_AntiAliasingLevel(pub ::core::ffi::c_uint);
70#[cfg(feature = "api-12")]
71#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
72impl OH_Pixelmap_HdrMetadataKey {
73 /// Indicate the types of metadata that image needs to use.
74 pub const HDR_METADATA_TYPE: OH_Pixelmap_HdrMetadataKey = OH_Pixelmap_HdrMetadataKey(0);
75 /// Static metadata key.
76 pub const HDR_STATIC_METADATA: OH_Pixelmap_HdrMetadataKey = OH_Pixelmap_HdrMetadataKey(1);
77 /// Dynamic metadata key.
78 pub const HDR_DYNAMIC_METADATA: OH_Pixelmap_HdrMetadataKey = OH_Pixelmap_HdrMetadataKey(2);
79 /// Gainmap metadata key.
80 pub const HDR_GAINMAP_METADATA: OH_Pixelmap_HdrMetadataKey = OH_Pixelmap_HdrMetadataKey(3);
81}
82#[repr(transparent)]
83/// Enumerates the HDR metadata types that need to be stored in Pixelmap.
84///
85///
86/// Available since API-level: 12
87#[cfg(feature = "api-12")]
88#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
89#[derive(Debug, Clone, Hash, PartialEq, Eq)]
90pub struct OH_Pixelmap_HdrMetadataKey(pub ::core::ffi::c_uint);
91#[cfg(feature = "api-12")]
92#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
93impl OH_Pixelmap_HdrMetadataType {
94 /// No metadata.
95 pub const HDR_METADATA_TYPE_NONE: OH_Pixelmap_HdrMetadataType = OH_Pixelmap_HdrMetadataType(0);
96 /// Indicates that metadata will be used for the base image.
97 pub const HDR_METADATA_TYPE_BASE: OH_Pixelmap_HdrMetadataType = OH_Pixelmap_HdrMetadataType(1);
98 /// Indicates that metadata will be used for the gainmap image.
99 pub const HDR_METADATA_TYPE_GAINMAP: OH_Pixelmap_HdrMetadataType =
100 OH_Pixelmap_HdrMetadataType(2);
101 /// Indicates that metadata will be used for the alternate image.
102 pub const HDR_METADATA_TYPE_ALTERNATE: OH_Pixelmap_HdrMetadataType =
103 OH_Pixelmap_HdrMetadataType(3);
104}
105#[repr(transparent)]
106/// Value for HDR_METADATA_TYPE.
107///
108///
109/// Available since API-level: 12
110#[cfg(feature = "api-12")]
111#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
112#[derive(Debug, Clone, Hash, PartialEq, Eq)]
113pub struct OH_Pixelmap_HdrMetadataType(pub ::core::ffi::c_uint);
114/// Value for HDR_STATIC_METADATA.
115///
116///
117/// Available since API-level: 12
118#[cfg(feature = "api-12")]
119#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
120#[repr(C)]
121#[derive(Debug)]
122pub struct OH_Pixelmap_HdrStaticMetadata {
123 /// The X-coordinate of the primary colors. The length of the array is three. Store in the order of r, g, b.
124 pub displayPrimariesX: [f32; 3usize],
125 /// The Y-coordinate of the primary colors. The length of the array is three. Store in the order of r, g, b.
126 pub displayPrimariesY: [f32; 3usize],
127 /// The X-coordinate of the white point value.
128 pub whitePointX: f32,
129 /// The Y-coordinate of the white point value.
130 pub whitePointY: f32,
131 /// Max luminance.
132 pub maxLuminance: f32,
133 /// Min luminance.
134 pub minLuminance: f32,
135 /// Maximum brightness of displayed content.
136 pub maxContentLightLevel: f32,
137 /// Maximum average brightness of displayed content.
138 pub maxFrameAverageLightLevel: f32,
139}
140/// Value for HDR_DYNAMIC_METADATA.
141///
142///
143/// Available since API-level: 12
144#[cfg(feature = "api-12")]
145#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
146#[repr(C)]
147#[derive(Debug)]
148pub struct OH_Pixelmap_HdrDynamicMetadata {
149 /// The value of dynamic metadata.
150 pub data: *mut u8,
151 /// The length of dynamic metadata.
152 pub length: u32,
153}
154/// Value for HDR_GAINMAP_METADATA.
155///
156///
157/// Available since API-level: 12
158#[cfg(feature = "api-12")]
159#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
160#[repr(C)]
161#[derive(Debug)]
162pub struct OH_Pixelmap_HdrGainmapMetadata {
163 /// The version used by the writer.
164 pub writerVersion: u16,
165 /// The minimum version a parser needs to understand.
166 pub miniVersion: u16,
167 /// The number of gain map channels, with a value of 1 or 3.
168 pub gainmapChannelNum: u8,
169 /// Indicate whether to use the color space of the base image.
170 pub useBaseColorFlag: bool,
171 /// The baseline hdr headroom.
172 pub baseHeadroom: f32,
173 /// The alternate hdr headroom.
174 pub alternateHeadroom: f32,
175 /// The per-component max gain map values.
176 pub gainmapMax: [f32; 3usize],
177 /// The per-component min gain map values.
178 pub gainmapMin: [f32; 3usize],
179 /// The per-component gamma values.
180 pub gamma: [f32; 3usize],
181 /// The per-component baseline offset.
182 pub baselineOffset: [f32; 3usize],
183 /// The per-component alternate offset.
184 pub alternateOffset: [f32; 3usize],
185}
186/// Value for HDR_METADATA_KEY. Corresponding relationship with HDR_METADATA_KEY.
187///
188///
189/// Available since API-level: 12
190#[cfg(feature = "api-12")]
191#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
192#[repr(C)]
193#[derive(Debug)]
194pub struct OH_Pixelmap_HdrMetadataValue {
195 /// The value corresponding to the HDR_METADATA_TYPE key
196 pub type_: OH_Pixelmap_HdrMetadataType,
197 /// The value corresponding to the HDR_STATIC_METADATA key
198 pub staticMetadata: OH_Pixelmap_HdrStaticMetadata,
199 /// The value corresponding to the HDR_DYNAMIC_METADATA key
200 pub dynamicMetadata: OH_Pixelmap_HdrDynamicMetadata,
201 /// The value corresponding to the HDR_GAINMAP_METADATA key
202 pub gainmapMetadata: OH_Pixelmap_HdrGainmapMetadata,
203}
204/// Defines the options used for creating a pixel map.
205///
206///
207/// Available since API-level: 12
208#[cfg(feature = "api-12")]
209#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
210#[repr(C)]
211pub struct OH_Pixelmap_InitializationOptions {
212 _unused: [u8; 0],
213}
214/// Defines the pixel map information.
215///
216///
217/// Available since API-level: 12
218#[cfg(feature = "api-12")]
219#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
220#[repr(C)]
221pub struct OH_Pixelmap_ImageInfo {
222 _unused: [u8; 0],
223}
224extern "C" {
225 /// Create a for InitializationOtions struct.
226 ///
227 /// # Arguments
228 ///
229 /// * `options` - The InitializationOtions pointer will be operated.
230 ///
231 /// # Returns
232 ///
233 /// * Returns [`Image_ErrorCode`]
234 ///
235 /// Available since API-level: 12
236 #[cfg(feature = "api-12")]
237 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
238 pub fn OH_PixelmapInitializationOptions_Create(
239 options: *mut *mut OH_Pixelmap_InitializationOptions,
240 ) -> ImageResult;
241 /// Get width number for InitializationOtions struct.
242 ///
243 /// # Arguments
244 ///
245 /// * `options` - The InitializationOtions pointer will be operated.
246 ///
247 /// * `width` - the number of image width.
248 ///
249 /// # Returns
250 ///
251 /// * Returns [`Image_ErrorCode`]
252 ///
253 /// Available since API-level: 12
254 #[cfg(feature = "api-12")]
255 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
256 pub fn OH_PixelmapInitializationOptions_GetWidth(
257 options: *mut OH_Pixelmap_InitializationOptions,
258 width: *mut u32,
259 ) -> ImageResult;
260 /// Set width number for InitializationOtions struct.
261 ///
262 /// # Arguments
263 ///
264 /// * `options` - The InitializationOtions pointer will be operated.
265 ///
266 /// * `width` - the number of image width.
267 ///
268 /// # Returns
269 ///
270 /// * Returns [`Image_ErrorCode`]
271 ///
272 /// Available since API-level: 12
273 #[cfg(feature = "api-12")]
274 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
275 pub fn OH_PixelmapInitializationOptions_SetWidth(
276 options: *mut OH_Pixelmap_InitializationOptions,
277 width: u32,
278 ) -> ImageResult;
279 /// Get height number for InitializationOtions struct.
280 ///
281 /// # Arguments
282 ///
283 /// * `options` - The InitializationOtions pointer will be operated.
284 ///
285 /// * `height` - the number of image height.
286 ///
287 /// # Returns
288 ///
289 /// * Returns [`Image_ErrorCode`]
290 ///
291 /// Available since API-level: 12
292 #[cfg(feature = "api-12")]
293 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
294 pub fn OH_PixelmapInitializationOptions_GetHeight(
295 options: *mut OH_Pixelmap_InitializationOptions,
296 height: *mut u32,
297 ) -> ImageResult;
298 /// Set height number for InitializationOtions struct.
299 ///
300 /// # Arguments
301 ///
302 /// * `options` - The InitializationOtions pointer will be operated.
303 ///
304 /// * `height` - the number of image height.
305 ///
306 /// # Returns
307 ///
308 /// * Returns [`Image_ErrorCode`]
309 ///
310 /// Available since API-level: 12
311 #[cfg(feature = "api-12")]
312 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
313 pub fn OH_PixelmapInitializationOptions_SetHeight(
314 options: *mut OH_Pixelmap_InitializationOptions,
315 height: u32,
316 ) -> ImageResult;
317 /// Get pixelFormat number for InitializationOtions struct.
318 ///
319 /// # Arguments
320 ///
321 /// * `options` - The InitializationOtions pointer will be operated.
322 ///
323 /// * `pixelFormat` - the number of image pixelFormat.
324 ///
325 /// # Returns
326 ///
327 /// * Returns [`Image_ErrorCode`]
328 ///
329 /// Available since API-level: 12
330 #[cfg(feature = "api-12")]
331 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
332 pub fn OH_PixelmapInitializationOptions_GetPixelFormat(
333 options: *mut OH_Pixelmap_InitializationOptions,
334 pixelFormat: *mut i32,
335 ) -> ImageResult;
336 /// Set pixelFormat number for InitializationOtions struct.
337 ///
338 /// # Arguments
339 ///
340 /// * `options` - The InitializationOtions pointer will be operated.
341 ///
342 /// * `pixelFormat` - the number of image pixelFormat.
343 ///
344 /// # Returns
345 ///
346 /// * Returns [`Image_ErrorCode`]
347 ///
348 /// Available since API-level: 12
349 #[cfg(feature = "api-12")]
350 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
351 pub fn OH_PixelmapInitializationOptions_SetPixelFormat(
352 options: *mut OH_Pixelmap_InitializationOptions,
353 pixelFormat: i32,
354 ) -> ImageResult;
355 /// Get pixelFormat number for InitializationOtions struct.
356 ///
357 /// # Arguments
358 ///
359 /// * `options` - The InitializationOtions pointer will be operated.
360 ///
361 /// * `srcpixelFormat` - the number of image srcpixelFormat.
362 ///
363 /// # Returns
364 ///
365 /// * Returns [`Image_ErrorCode`]
366 ///
367 /// Available since API-level: 12
368 #[cfg(feature = "api-12")]
369 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
370 pub fn OH_PixelmapInitializationOptions_GetSrcPixelFormat(
371 options: *mut OH_Pixelmap_InitializationOptions,
372 srcpixelFormat: *mut i32,
373 ) -> ImageResult;
374 /// Set pixelFormat number for InitializationOtions struct.
375 ///
376 /// # Arguments
377 ///
378 /// * `options` - The InitializationOtions pointer will be operated.
379 ///
380 /// * `srcpixelFormat` - the number of image srcpixelFormat.
381 ///
382 /// # Returns
383 ///
384 /// * Returns [`Image_ErrorCode`]
385 ///
386 /// Available since API-level: 12
387 #[cfg(feature = "api-12")]
388 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
389 pub fn OH_PixelmapInitializationOptions_SetSrcPixelFormat(
390 options: *mut OH_Pixelmap_InitializationOptions,
391 srcpixelFormat: i32,
392 ) -> ImageResult;
393 /// Get rowStride for InitializationOptions struct.
394 ///
395 /// # Arguments
396 ///
397 /// * `options` - The InitializationOptions pointer will be operated.
398 ///
399 /// * `rowStride` - the rowStride of image buffer.
400 ///
401 /// # Returns
402 ///
403 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
404 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if rowStride is null.
405 /// returns [`Image_ErrorCode`] IMAGE_UNKNOWN_ERROR - inner unknown error, maybe options is released.
406 ///
407 /// Available since API-level: 12
408 #[cfg(feature = "api-12")]
409 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
410 pub fn OH_PixelmapInitializationOptions_GetRowStride(
411 options: *mut OH_Pixelmap_InitializationOptions,
412 rowStride: *mut i32,
413 ) -> ImageResult;
414 /// Set rowStride number for InitializationOptions struct.
415 ///
416 /// # Arguments
417 ///
418 /// * `options` - The InitializationOptions pointer will be operated.
419 ///
420 /// * `rowStride` - the rowStride of image buffer.
421 ///
422 /// # Returns
423 ///
424 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
425 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if rowStride does not match width.
426 /// returns [`Image_ErrorCode`] IMAGE_UNKNOWN_ERROR - inner unknown error, maybe options is released.
427 ///
428 /// Available since API-level: 12
429 #[cfg(feature = "api-12")]
430 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
431 pub fn OH_PixelmapInitializationOptions_SetRowStride(
432 options: *mut OH_Pixelmap_InitializationOptions,
433 rowStride: i32,
434 ) -> ImageResult;
435 /// Get alphaType number for InitializationOtions struct.
436 ///
437 /// # Arguments
438 ///
439 /// * `options` - The InitializationOtions pointer will be operated.
440 ///
441 /// * `alphaType` - the number of image alphaType.
442 ///
443 /// # Returns
444 ///
445 /// * Returns [`Image_ErrorCode`]
446 ///
447 /// Available since API-level: 12
448 #[cfg(feature = "api-12")]
449 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
450 pub fn OH_PixelmapInitializationOptions_GetAlphaType(
451 options: *mut OH_Pixelmap_InitializationOptions,
452 alphaType: *mut i32,
453 ) -> ImageResult;
454 /// Set alphaType number for InitializationOtions struct.
455 ///
456 /// # Arguments
457 ///
458 /// * `options` - The InitializationOtions pointer will be operated.
459 ///
460 /// * `alphaType` - the number of image alphaType.
461 ///
462 /// # Returns
463 ///
464 /// * Returns [`Image_ErrorCode`]
465 ///
466 /// Available since API-level: 12
467 #[cfg(feature = "api-12")]
468 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
469 pub fn OH_PixelmapInitializationOptions_SetAlphaType(
470 options: *mut OH_Pixelmap_InitializationOptions,
471 alphaType: i32,
472 ) -> ImageResult;
473 /// Get editable for InitializationOptions struct.
474 ///
475 /// # Arguments
476 ///
477 /// * `options` - The InitializationOptions pointer will be operated.
478 ///
479 /// * `editable` - The boolean value representing the editable status.
480 ///
481 /// # Returns
482 ///
483 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
484 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if options or editable is invalid.
485 ///
486 /// Available since API-level: 18
487 #[cfg(feature = "api-18")]
488 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
489 pub fn OH_PixelmapInitializationOptions_GetEditable(
490 options: *mut OH_Pixelmap_InitializationOptions,
491 editable: *mut bool,
492 ) -> ImageResult;
493 /// Set editable for InitializationOptions struct.
494 ///
495 /// # Arguments
496 ///
497 /// * `options` - The InitializationOptions pointer will be operated.
498 ///
499 /// * `editable` - The boolean value representing the editable status.
500 ///
501 /// # Returns
502 ///
503 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
504 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if options is invalid.
505 ///
506 /// Available since API-level: 18
507 #[cfg(feature = "api-18")]
508 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
509 pub fn OH_PixelmapInitializationOptions_SetEditable(
510 options: *mut OH_Pixelmap_InitializationOptions,
511 editable: bool,
512 ) -> ImageResult;
513 /// delete InitializationOtions pointer.
514 ///
515 /// # Arguments
516 ///
517 /// * `options` - The InitializationOtions pointer will be operated.
518 ///
519 /// # Returns
520 ///
521 /// * Returns [`Image_ErrorCode`]
522 ///
523 /// Available since API-level: 12
524 #[cfg(feature = "api-12")]
525 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
526 pub fn OH_PixelmapInitializationOptions_Release(
527 options: *mut OH_Pixelmap_InitializationOptions,
528 ) -> ImageResult;
529 /// Create imageinfo struct .
530 ///
531 /// # Arguments
532 ///
533 /// * `info` - The imageinfo pointer will be operated.
534 ///
535 /// # Returns
536 ///
537 /// * Returns [`Image_ErrorCode`]
538 ///
539 /// Available since API-level: 12
540 #[cfg(feature = "api-12")]
541 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
542 pub fn OH_PixelmapImageInfo_Create(info: *mut *mut OH_Pixelmap_ImageInfo) -> ImageResult;
543 /// Get width number for imageinfo struct.
544 ///
545 /// # Arguments
546 ///
547 /// * `info` - The imageinfo pointer will be operated.
548 ///
549 /// * `width` - The number of imageinfo width.
550 ///
551 /// # Returns
552 ///
553 /// * Returns [`Image_ErrorCode`]
554 ///
555 /// Available since API-level: 12
556 #[cfg(feature = "api-12")]
557 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
558 pub fn OH_PixelmapImageInfo_GetWidth(
559 info: *mut OH_Pixelmap_ImageInfo,
560 width: *mut u32,
561 ) -> ImageResult;
562 /// Get height number for imageinfo struct.
563 ///
564 /// # Arguments
565 ///
566 /// * `info` - The imageinfo pointer will be operated.
567 ///
568 /// * `height` - The number of imageinfo height.
569 ///
570 /// # Returns
571 ///
572 /// * Returns [`Image_ErrorCode`]
573 ///
574 /// Available since API-level: 12
575 #[cfg(feature = "api-12")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
577 pub fn OH_PixelmapImageInfo_GetHeight(
578 info: *mut OH_Pixelmap_ImageInfo,
579 height: *mut u32,
580 ) -> ImageResult;
581 /// Get alphaMode number for imageinfo struct.
582 ///
583 /// # Arguments
584 ///
585 /// * `info` - The imageinfo pointer will be operated.
586 ///
587 /// * `alphaMode` - The number of imageinfo alphaMode.
588 ///
589 /// # Returns
590 ///
591 /// * Image functions result code.
592 /// [`IMAGE_SUCCESS`] if the execution is successful.
593 /// [`IMAGE_BAD_PARAMETER`] info is nullptr, or alphaMode is nullptr.
594 ///
595 /// Available since API-level: 20
596 #[cfg(feature = "api-20")]
597 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
598 pub fn OH_PixelmapImageInfo_GetAlphaMode(
599 info: *mut OH_Pixelmap_ImageInfo,
600 alphaMode: *mut i32,
601 ) -> ImageResult;
602 /// Get rowStride number for imageinfo struct.
603 ///
604 /// # Arguments
605 ///
606 /// * `info` - The imageinfo pointer will be operated.
607 ///
608 /// * `rowStride` - The number of imageinfo rowStride.
609 ///
610 /// # Returns
611 ///
612 /// * Returns [`Image_ErrorCode`]
613 ///
614 /// Available since API-level: 12
615 #[cfg(feature = "api-12")]
616 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
617 pub fn OH_PixelmapImageInfo_GetRowStride(
618 info: *mut OH_Pixelmap_ImageInfo,
619 rowStride: *mut u32,
620 ) -> ImageResult;
621 /// Get pixelFormat number for imageinfo struct.
622 ///
623 /// # Arguments
624 ///
625 /// * `info` - The imageinfo pointer will be operated.
626 ///
627 /// * `pixelFormat` - The number of imageinfo pixelFormat.
628 ///
629 /// # Returns
630 ///
631 /// * Returns [`Image_ErrorCode`]
632 ///
633 /// Available since API-level: 12
634 #[cfg(feature = "api-12")]
635 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
636 pub fn OH_PixelmapImageInfo_GetPixelFormat(
637 info: *mut OH_Pixelmap_ImageInfo,
638 pixelFormat: *mut i32,
639 ) -> ImageResult;
640 /// Get alphaType number for imageinfo struct.
641 ///
642 /// # Arguments
643 ///
644 /// * `info` - The imageinfo pointer will be operated.
645 ///
646 /// * `alphaType` - The number of imageinfo alphaType.
647 ///
648 /// # Returns
649 ///
650 /// * Returns [`Image_ErrorCode`]
651 ///
652 /// Available since API-level: 12
653 #[cfg(feature = "api-12")]
654 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
655 pub fn OH_PixelmapImageInfo_GetAlphaType(
656 info: *mut OH_Pixelmap_ImageInfo,
657 alphaType: *mut i32,
658 ) -> ImageResult;
659 /// Get isHdr boolean for imageinfo struct.
660 ///
661 /// # Arguments
662 ///
663 /// * `info` - The imageinfo pointer will be operated. Pointer connot be null.
664 ///
665 /// * `isHdr` - Whether the image has a high dynamic range.
666 ///
667 /// # Returns
668 ///
669 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - The operation is successful.
670 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed.
671 ///
672 /// Available since API-level: 12
673 #[cfg(feature = "api-12")]
674 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
675 pub fn OH_PixelmapImageInfo_GetDynamicRange(
676 info: *mut OH_Pixelmap_ImageInfo,
677 isHdr: *mut bool,
678 ) -> ImageResult;
679 /// Delete imageinfo struct pointer.
680 ///
681 /// # Arguments
682 ///
683 /// * `info` - The imageinfo pointer will be operated.
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_PixelmapImageInfo_Release(info: *mut OH_Pixelmap_ImageInfo) -> ImageResult;
693 /// Creates a <b>PixelMap</b> object.
694 ///
695 /// # Arguments
696 ///
697 /// * `data` - Color buffer in BGRA_8888 format.
698 ///
699 /// * `dataLength` - Color buffer size in BGRA_8888 format.
700 ///
701 /// * `options` - IPixel properties, including the alpha type, size, pixel format, and editable.
702 ///
703 /// * `pixelmap` - Pixelmap pointer for created.
704 ///
705 /// # Returns
706 ///
707 /// * Returns [`Image_ErrorCode`]
708 ///
709 /// Available since API-level: 12
710 #[cfg(feature = "api-12")]
711 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
712 pub fn OH_PixelmapNative_CreatePixelmap(
713 data: *mut u8,
714 dataLength: usize,
715 options: *mut OH_Pixelmap_InitializationOptions,
716 pixelmap: *mut *mut OH_PixelmapNative,
717 ) -> ImageResult;
718 /// Creates a pixelmap based on options [`OH_Pixelmap_InitializationOptions`], the memory type used by the
719 /// pixelmap can be specified by allocatorType [`IMAGE_ALLOCATOR_MODE`]. By default, the system selects the memory
720 /// type based on the image type, image size, platform capability, etc. When processing the pixelmap returned by this
721 /// interface, please always consider the impact of stride.
722 ///
723 /// # Arguments
724 ///
725 /// * `data` - Input color buffer in BGRA_8888 format by default.
726 ///
727 /// * `dataLength` - Length of input buffer in bytes.
728 ///
729 /// * `options` - Pixelmap initialization properties including size, pixel format, alpha type, and editable flags.
730 ///
731 /// * `allocator` - Indicate which memory type will be used by the returned pixelmap.
732 ///
733 /// * `pixelmap` - Output parameter receiving the created pixelmap object pointer.
734 ///
735 /// # Returns
736 ///
737 /// * Function result code:
738 /// [`IMAGE_SUCCESS`] If the operation is successful.
739 /// [`IMAGE_BAD_PARAMETER`] If the param is nullptr or invalid.
740 /// [`IMAGE_TOO_LARGE`] too large data or image.
741 /// [`IMAGE_UNSUPPORTED_OPERATION`] unsupported operations.
742 /// [`IMAGE_DMA_OPERATION_FAILED`] DMA operation failed.
743 /// [`IMAGE_ALLOCATOR_MODE_UNSUPPORTED`] unsupported allocator mode, e.g.,
744 /// use share memory to create a HDR image as only DMA supported hdr metadata.
745 ///
746 /// Available since API-level: 20
747 #[cfg(feature = "api-20")]
748 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
749 pub fn OH_PixelmapNative_CreatePixelmapUsingAllocator(
750 data: *mut u8,
751 dataLength: usize,
752 options: *mut OH_Pixelmap_InitializationOptions,
753 allocator: IMAGE_ALLOCATOR_MODE,
754 pixelmap: *mut *mut OH_PixelmapNative,
755 ) -> ImageResult;
756 /// Convert a native <b>PixelMap</b> object to <b>PixelMap</b> napi object.
757 ///
758 /// # Arguments
759 ///
760 /// * `env` - Indicates the NAPI environment pointer.
761 ///
762 /// * `pixelmapNative` - Indicates a pointer to the <b>PixelMap</b> object created at the native layer.
763 ///
764 /// * `pixelmapNapi` - the <b>PixelMap</b> pointer will be converted.
765 ///
766 /// # Returns
767 ///
768 /// * Image functions result code.
769 /// [`IMAGE_SUCCESS`] if the execution is successful.
770 /// [`IMAGE_BAD_PARAMETER`] pixelmapNative is nullptr
771 ///
772 /// Available since API-level: 12
773 #[cfg(feature = "api-12")]
774 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
775 pub fn OH_PixelmapNative_ConvertPixelmapNativeToNapi(
776 env: napi_env,
777 pixelmapNative: *mut OH_PixelmapNative,
778 pixelmapNapi: *mut napi_value,
779 ) -> ImageResult;
780 /// Convert a <b>PixelMap</b> napi object to native <b>PixelMap</b> object.
781 ///
782 /// # Arguments
783 ///
784 /// * `env` - Indicates the NAPI environment pointer.
785 ///
786 /// * `pixelmapNapi` - Indicates napi <b>PixelMap</b> object.
787 ///
788 /// * `pixelmapNative` - Indicates native <b>PixelMap</b> pointer to created.
789 ///
790 /// # Returns
791 ///
792 /// * Image functions result code.
793 /// [`IMAGE_SUCCESS`] if the execution is successful.
794 /// [`IMAGE_BAD_PARAMETER`] pixelmapNative is nullptr, or pixelmapNapi is not a PixelMap
795 ///
796 /// Available since API-level: 12
797 #[cfg(feature = "api-12")]
798 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
799 pub fn OH_PixelmapNative_ConvertPixelmapNativeFromNapi(
800 env: napi_env,
801 pixelmapNapi: napi_value,
802 pixelmapNative: *mut *mut OH_PixelmapNative,
803 ) -> ImageResult;
804 /// Reads data of this pixel map to an Buffer. If this pixel map is created in the BGRA_8888 format,
805 /// the data read is the same as the original data.
806 ///
807 /// # Arguments
808 ///
809 /// * `pixelmap` - The Pixelmap pointer will be operated.
810 ///
811 /// * `destination` - Buffer to which the image pixel map data will be written.
812 ///
813 /// * `bufferSize` - Buffer size to which the image pixel map data will be written.
814 ///
815 /// # Returns
816 ///
817 /// * Returns [`Image_ErrorCode`]
818 ///
819 /// Available since API-level: 12
820 #[cfg(feature = "api-12")]
821 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
822 pub fn OH_PixelmapNative_ReadPixels(
823 pixelmap: *mut OH_PixelmapNative,
824 destination: *mut u8,
825 bufferSize: *mut usize,
826 ) -> ImageResult;
827 /// Reads image data in an Buffer and writes the data to a Pixelmap object.
828 ///
829 /// # Arguments
830 ///
831 /// * `pixelmap` - The Pixelmap pointer will be operated.
832 ///
833 /// * `source` - Buffer from which the image data will be read.
834 ///
835 /// * `bufferSize` - Buffer size from which the image data will be read.
836 ///
837 /// # Returns
838 ///
839 /// * Returns [`Image_ErrorCode`]
840 ///
841 /// Available since API-level: 12
842 #[cfg(feature = "api-12")]
843 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
844 pub fn OH_PixelmapNative_WritePixels(
845 pixelmap: *mut OH_PixelmapNative,
846 source: *mut u8,
847 bufferSize: usize,
848 ) -> ImageResult;
849 /// Get argb pixel buffer from pixelmap.
850 ///
851 /// # Arguments
852 ///
853 /// * `pixelmap` - The Pixelmap pointer to be operated.
854 ///
855 /// * `destination` - Buffer to which the image pixel map data will be written.
856 ///
857 /// * `bufferSize` - Buffer size to which the image pixel map data will be written.
858 ///
859 /// # Returns
860 ///
861 /// * Function result code:
862 /// [`IMAGE_SUCCESS`] If the operation is successful.
863 /// [`IMAGE_BAD_PARAMETER`] If invalid parameter, destination and bufferSize are incorrect.
864 /// [`IMAGE_UNSUPPORTED_CONVERSION`] If format does not support conversion to argb or conversion failed.
865 /// [`IMAGE_ALLOC_FAILED`] If device has no memory.
866 /// [`IMAGE_COPY_FAILED`] If memory copy failed.
867 /// [`OH_PixelmapNative`]
868 /// Available since API-level: 13
869 #[cfg(feature = "api-13")]
870 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
871 pub fn OH_PixelmapNative_GetArgbPixels(
872 pixelmap: *mut OH_PixelmapNative,
873 destination: *mut u8,
874 bufferSize: *mut usize,
875 ) -> ImageResult;
876 /// Convert [`OH_PixelmapNative`] to standard dynamic range.
877 ///
878 /// # Arguments
879 ///
880 /// * `pixelmap` - The Pixelmap pointer will be operated. Pointer connot be null.
881 ///
882 /// # Returns
883 ///
884 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - The operation is successful.
885 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed.
886 /// returns [`Image_ErrorCode`] IMAGE_UNSUPPORTED_OPERATION - Unsupported operation.Pixelmap can't be converted.
887 ///
888 /// Available since API-level: 12
889 #[cfg(feature = "api-12")]
890 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
891 pub fn OH_PixelmapNative_ToSdr(pixelmap: *mut OH_PixelmapNative) -> ImageResult;
892 /// Obtains pixel map information of this image.
893 ///
894 /// # Arguments
895 ///
896 /// * `pixelmap` - The Pixelmap pointer will be operated.
897 ///
898 /// * `imageInfo` - Indicates the pointer to the image information.
899 ///
900 /// # Returns
901 ///
902 /// * Returns [`Image_ErrorCode`]
903 ///
904 /// Available since API-level: 12
905 #[cfg(feature = "api-12")]
906 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
907 pub fn OH_PixelmapNative_GetImageInfo(
908 pixelmap: *mut OH_PixelmapNative,
909 imageInfo: *mut OH_Pixelmap_ImageInfo,
910 ) -> ImageResult;
911 /// Sets an opacity rate for this image pixel map.
912 ///
913 /// # Arguments
914 ///
915 /// * `pixelmap` - The Pixelmap pointer will be operated.
916 ///
917 /// * `rate` - Opacity rate to set. The value ranges from 0 to 1.
918 ///
919 /// # Returns
920 ///
921 /// * Returns [`Image_ErrorCode`]
922 ///
923 /// Available since API-level: 12
924 #[cfg(feature = "api-12")]
925 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
926 pub fn OH_PixelmapNative_Opacity(pixelmap: *mut OH_PixelmapNative, rate: f32) -> ImageResult;
927 /// Scales this image based on the input width and height.
928 ///
929 /// # Arguments
930 ///
931 /// * `pixelmap` - The Pixelmap pointer will be operated.
932 ///
933 /// * `scaleX` - Scaling ratio of the width.
934 ///
935 /// * `scaleY` - Scaling ratio of the height.
936 ///
937 /// # Returns
938 ///
939 /// * Returns [`Image_ErrorCode`]
940 ///
941 /// Available since API-level: 12
942 #[cfg(feature = "api-12")]
943 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
944 pub fn OH_PixelmapNative_Scale(
945 pixelmap: *mut OH_PixelmapNative,
946 scaleX: f32,
947 scaleY: f32,
948 ) -> ImageResult;
949 /// Scales this image based on the input width and height with anti-aliasing.
950 ///
951 /// # Arguments
952 ///
953 /// * `pixelmap` - The Pixelmap pointer will be operated.
954 ///
955 /// * `scaleX` - Scaling ratio of the width.
956 ///
957 /// * `scaleY` - Scaling ratio of the height.
958 ///
959 /// * `level` - The anti-aliasing algorithm to be used.
960 ///
961 /// # Returns
962 ///
963 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
964 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if invalid parameter, x and y are incorrect.
965 /// returns [`Image_ErrorCode`] IMAGE_TOO_LARGE - if image is too large.
966 /// returns [`Image_ErrorCode`] IMAGE_ALLOC_FAILED - if device has no memory.
967 /// returns [`Image_ErrorCode`] IMAGE_UNKNOWN_ERROR - inner unknown error, maybe source pixelmap is released.
968 /// [`OH_PixelmapNative`]
969 /// Available since API-level: 12
970 #[cfg(feature = "api-12")]
971 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
972 pub fn OH_PixelmapNative_ScaleWithAntiAliasing(
973 pixelmap: *mut OH_PixelmapNative,
974 scaleX: f32,
975 scaleY: f32,
976 level: OH_PixelmapNative_AntiAliasingLevel,
977 ) -> ImageResult;
978 /// Create a scaled pixelmap based on the source pixelmap and the input width and height.
979 ///
980 /// # Arguments
981 ///
982 /// * `srcPixelmap` - The source native pixelmap.
983 ///
984 /// * `dstPixelmap` - The destination native pixelmap for create.
985 ///
986 /// * `scaleX` - Scaling ratio of the width.
987 ///
988 /// * `scaleY` - Scaling ratio of the height.
989 ///
990 /// # Returns
991 ///
992 /// * Function result code:
993 /// [`IMAGE_SUCCESS`] If the execution is successful.
994 /// [`IMAGE_BAD_PARAMETER`] If the param is nullptr or invalid.
995 /// [`OH_PixelmapNative`]
996 /// Available since API-level: 18
997 #[cfg(feature = "api-18")]
998 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
999 pub fn OH_PixelmapNative_CreateScaledPixelMap(
1000 srcPixelmap: *mut OH_PixelmapNative,
1001 dstPixelmap: *mut *mut OH_PixelmapNative,
1002 scaleX: f32,
1003 scaleY: f32,
1004 ) -> ImageResult;
1005 /// Create a scaled pixelmap based on the source pixelmap and the input width and height with anti-aliasing.
1006 ///
1007 /// # Arguments
1008 ///
1009 /// * `srcPixelmap` - The source native pixelmap.
1010 ///
1011 /// * `dstPixelmap` - The destination native pixelmap for create.
1012 ///
1013 /// * `scaleX` - Scaling ratio of the width.
1014 ///
1015 /// * `scaleY` - Scaling ratio of the height.
1016 ///
1017 /// * `level` - The anti-aliasing algorithm to be used.
1018 ///
1019 /// # Returns
1020 ///
1021 /// * Function result code:
1022 /// [`IMAGE_SUCCESS`] If the execution is successful.
1023 /// [`IMAGE_BAD_PARAMETER`] If the param is nullptr or invalid.
1024 /// [`IMAGE_TOO_LARGE`] If image is too large.
1025 /// [`IMAGE_ALLOC_FAILED`] If device has no memory.
1026 /// [`OH_PixelmapNative`]
1027 /// Available since API-level: 18
1028 #[cfg(feature = "api-18")]
1029 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1030 pub fn OH_PixelmapNative_CreateScaledPixelMapWithAntiAliasing(
1031 srcPixelmap: *mut OH_PixelmapNative,
1032 dstPixelmap: *mut *mut OH_PixelmapNative,
1033 scaleX: f32,
1034 scaleY: f32,
1035 level: OH_PixelmapNative_AntiAliasingLevel,
1036 ) -> ImageResult;
1037 /// Translates this image based on the input coordinates.
1038 ///
1039 /// # Arguments
1040 ///
1041 /// * `pixelmap` - The Pixelmap pointer will be operated.
1042 ///
1043 /// * `x` - The distance to be translate in the X direction.
1044 ///
1045 /// * `y` - The distance to be translate in the Y direction.
1046 ///
1047 /// # Returns
1048 ///
1049 /// * Returns [`Image_ErrorCode`]
1050 ///
1051 /// Available since API-level: 12
1052 #[cfg(feature = "api-12")]
1053 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1054 pub fn OH_PixelmapNative_Translate(
1055 pixelmap: *mut OH_PixelmapNative,
1056 x: f32,
1057 y: f32,
1058 ) -> ImageResult;
1059 /// Rotates this image based on the input angle.
1060 ///
1061 /// # Arguments
1062 ///
1063 /// * `pixelmap` - The Pixelmap pointer will be operated.
1064 ///
1065 /// * `angle` - Angle to rotate.
1066 ///
1067 /// # Returns
1068 ///
1069 /// * Returns [`Image_ErrorCode`]
1070 ///
1071 /// Available since API-level: 12
1072 #[cfg(feature = "api-12")]
1073 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1074 pub fn OH_PixelmapNative_Rotate(pixelmap: *mut OH_PixelmapNative, angle: f32) -> ImageResult;
1075 /// Flips this image horizontally or vertically, or both.
1076 ///
1077 /// # Arguments
1078 ///
1079 /// * `pixelmap` - The Pixelmap pointer will be operated.
1080 ///
1081 /// * `shouldFilpHorizontally` - Whether to flip the image horizontally.
1082 ///
1083 /// * `shouldFilpVertically` - Whether to flip the image vertically.
1084 ///
1085 /// # Returns
1086 ///
1087 /// * Returns [`Image_ErrorCode`]
1088 ///
1089 /// Available since API-level: 12
1090 #[cfg(feature = "api-12")]
1091 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1092 pub fn OH_PixelmapNative_Flip(
1093 pixelmap: *mut OH_PixelmapNative,
1094 shouldFilpHorizontally: bool,
1095 shouldFilpVertically: bool,
1096 ) -> ImageResult;
1097 /// Crops this image based on the input size.
1098 ///
1099 /// # Arguments
1100 ///
1101 /// * `pixelmap` - The Pixelmap pointer will be operated.
1102 ///
1103 /// * `region` - Area size, read according to area.
1104 ///
1105 /// # Returns
1106 ///
1107 /// * Returns [`Image_ErrorCode`]
1108 ///
1109 /// Available since API-level: 12
1110 #[cfg(feature = "api-12")]
1111 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1112 pub fn OH_PixelmapNative_Crop(
1113 pixelmap: *mut OH_PixelmapNative,
1114 region: *mut Image_Region,
1115 ) -> ImageResult;
1116 /// Releases an <b>OH_Pixelmap</b> object.
1117 ///
1118 /// # Arguments
1119 ///
1120 /// * `pixelmap` - The Pixelmap pointer will be operated.
1121 ///
1122 /// # Returns
1123 ///
1124 /// * Returns [`Image_ErrorCode`]
1125 ///
1126 /// Available since API-level: 12
1127 #[cfg(feature = "api-12")]
1128 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1129 pub fn OH_PixelmapNative_Release(pixelmap: *mut OH_PixelmapNative) -> ImageResult;
1130 /// Destroys an <b>OH_PixelmapNative</b> object and deallocates its resources.
1131 ///
1132 /// # Arguments
1133 ///
1134 /// * `pixelmap` - A pointer to the OH_PixelmapNative pointer to destroy.
1135 ///
1136 /// # Returns
1137 ///
1138 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
1139 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if pixelmap is null or *pixelmap is null.
1140 ///
1141 /// Available since API-level: 18
1142 #[cfg(feature = "api-18")]
1143 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1144 pub fn OH_PixelmapNative_Destroy(pixelmap: *mut *mut OH_PixelmapNative) -> ImageResult;
1145 /// Converting images to alpha format
1146 ///
1147 /// # Arguments
1148 ///
1149 /// * `srcpixelmap` - The source pixel map pointer will be operated.
1150 ///
1151 /// * `dstpixelmap` - The destination pixel map pointer will be operated.
1152 ///
1153 /// * `isPremul` - Whether it is pre-multiplied, true for prediction, false for non-pre-multiplied.
1154 ///
1155 /// # Returns
1156 ///
1157 /// * Returns [`Image_ErrorCode`]
1158 ///
1159 /// Available since API-level: 12
1160 #[cfg(feature = "api-12")]
1161 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1162 pub fn OH_PixelmapNative_ConvertAlphaFormat(
1163 srcpixelmap: *mut OH_PixelmapNative,
1164 dstpixelmap: *mut OH_PixelmapNative,
1165 isPremul: bool,
1166 ) -> ImageResult;
1167 /// Create a empty <b>PixelMap</b> object.
1168 ///
1169 /// # Arguments
1170 ///
1171 /// * `options` - IPixel properties, including the alpha type, size, pixel format, and editable.
1172 ///
1173 /// * `pixelmap` - Pixelmap pointer for created.
1174 ///
1175 /// # Returns
1176 ///
1177 /// * Returns [`Image_ErrorCode`]
1178 ///
1179 /// Available since API-level: 12
1180 #[cfg(feature = "api-12")]
1181 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1182 pub fn OH_PixelmapNative_CreateEmptyPixelmap(
1183 options: *mut OH_Pixelmap_InitializationOptions,
1184 pixelmap: *mut *mut OH_PixelmapNative,
1185 ) -> ImageResult;
1186 /// Creates a empty pixelmap based on options [`OH_Pixelmap_InitializationOptions`], the memory type used
1187 /// by the pixelmap can be specified by allocatorType [`IMAGE_ALLOCATOR_MODE`]. By default,
1188 /// the system selects the memory type based on the image type, image size, platform capability, etc. When processing
1189 /// the pixelmap returned by this interface, please always consider the impact of stride.
1190 ///
1191 /// # Arguments
1192 ///
1193 /// * `options` - Pixelmap initialization properties including size, pixel format, alpha type, and editable flags.
1194 ///
1195 /// * `allocator` - Indicate which memory type will be used by the returned pixelmap.
1196 ///
1197 /// * `pixelmap` - Output parameter receiving the created pixelmap object pointer.
1198 ///
1199 /// # Returns
1200 ///
1201 /// * Function result code:
1202 /// [`IMAGE_SUCCESS`] If the operation is successful.
1203 /// [`IMAGE_BAD_PARAMETER`] If the param is nullptr or invalid.
1204 /// [`IMAGE_TOO_LARGE`] too large data or image.
1205 /// [`IMAGE_UNSUPPORTED_OPERATION`] unsupported operations.
1206 /// [`IMAGE_ALLOCATOR_MODE_UNSUPPORTED`] unsupported allocator mode, e.g., use
1207 /// share memory to create a HDR image as only DMA supported hdr metadata.
1208 ///
1209 /// Available since API-level: 20
1210 #[cfg(feature = "api-20")]
1211 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
1212 pub fn OH_PixelmapNative_CreateEmptyPixelmapUsingAllocator(
1213 options: *mut OH_Pixelmap_InitializationOptions,
1214 allocator: IMAGE_ALLOCATOR_MODE,
1215 pixelmap: *mut *mut OH_PixelmapNative,
1216 ) -> ImageResult;
1217 /// Get metadata.
1218 ///
1219 /// # Arguments
1220 ///
1221 /// * `pixelmap` - The Pixelmap pointer to be operated.
1222 ///
1223 /// * `key` - Type of metadata.
1224 ///
1225 /// * `value` - Value of metadata.
1226 ///
1227 /// # Returns
1228 ///
1229 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
1230 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if invalid parameter, key and value are incorrect.
1231 /// returns [`Image_ErrorCode`] IMAGE_DMA_NOT_EXIST - if DMA memory does not exist.
1232 /// returns [`Image_ErrorCode`] IMAGE_COPY_FAILED - if memory copy failed.
1233 /// [`OH_PixelmapNative`]
1234 /// Available since API-level: 12
1235 #[cfg(feature = "api-12")]
1236 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1237 pub fn OH_PixelmapNative_GetMetadata(
1238 pixelmap: *mut OH_PixelmapNative,
1239 key: OH_Pixelmap_HdrMetadataKey,
1240 value: *mut *mut OH_Pixelmap_HdrMetadataValue,
1241 ) -> ImageResult;
1242 /// Set metadata.
1243 ///
1244 /// # Arguments
1245 ///
1246 /// * `pixelmap` - The Pixelmap pointer to be operated.
1247 ///
1248 /// * `key` - Type of metadata.
1249 ///
1250 /// * `value` - Value of metadata.
1251 ///
1252 /// # Returns
1253 ///
1254 /// * Returns [`Image_ErrorCode`] IMAGE_SUCCESS - if the operation is successful.
1255 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if invalid parameter, key and value are incorrect.
1256 /// returns [`Image_ErrorCode`] IMAGE_DMA_NOT_EXIST - if DMA memory does not exist.
1257 /// returns [`Image_ErrorCode`] IMAGE_COPY_FAILED - if memory copy failed.
1258 /// [`OH_PixelmapNative`]
1259 /// Available since API-level: 12
1260 #[cfg(feature = "api-12")]
1261 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1262 pub fn OH_PixelmapNative_SetMetadata(
1263 pixelmap: *mut OH_PixelmapNative,
1264 key: OH_Pixelmap_HdrMetadataKey,
1265 value: *mut OH_Pixelmap_HdrMetadataValue,
1266 ) -> ImageResult;
1267 /// Get the native buffer from the PixelMap.
1268 ///
1269 /// # Arguments
1270 ///
1271 /// * `pixelmap` - The PixelMap to get the native buffer from.
1272 ///
1273 /// * `nativeBuffer` - The native buffer to retrieve.
1274 ///
1275 /// # Returns
1276 ///
1277 /// * Returns [`Image_ErrorCode`] IMAGE_RESULT_SUCCESS - if the operation is successful.
1278 /// returns [`Image_ErrorCode`] IMAGE_BAD_PARAMETER - if invalid parameter, pixelmap or nativeBuffer is null.
1279 /// returns [`Image_ErrorCode`] IMAGE_DMA_NOT_EXIST - if DMA memory dose not exist.
1280 /// returns [`Image_ErrorCode`] IMAGE_DMA_OPERATION_FAILED - if operations related to DMA memory has failed.
1281 /// [`OH_PixelmapNative`]
1282 /// Available since API-level: 12
1283 #[cfg(feature = "api-12")]
1284 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1285 pub fn OH_PixelmapNative_GetNativeBuffer(
1286 pixelmap: *mut OH_PixelmapNative,
1287 nativeBuffer: *mut *mut OH_NativeBuffer,
1288 ) -> ImageResult;
1289 /// Get the native colorspace from the PixelMap.
1290 ///
1291 /// # Arguments
1292 ///
1293 /// * `pixelmap` - The native pixelmap to get the native colorspace from.
1294 ///
1295 /// * `colorSpaceNative` - The native colorspace to retrieve.
1296 ///
1297 /// # Returns
1298 ///
1299 /// * Function result code:
1300 /// [`IMAGE_SUCCESS`] If the execution is successful.
1301 /// [`IMAGE_BAD_PARAMETER`] The param of pixelmap or colorSpaceNative is nullptr or invalid.
1302 /// [`OH_PixelmapNative`]
1303 /// Available since API-level: 13
1304 #[cfg(feature = "api-13")]
1305 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1306 pub fn OH_PixelmapNative_GetColorSpaceNative(
1307 pixelmap: *mut OH_PixelmapNative,
1308 colorSpaceNative: *mut *mut OH_NativeColorSpaceManager,
1309 ) -> ImageResult;
1310 /// Set the native colorspace for the PixelMap.
1311 ///
1312 /// # Arguments
1313 ///
1314 /// * `pixelmap` - The native pixelmap to set the native colorspace for.
1315 ///
1316 /// * `colorSpaceNative` - The native colorspace to set.
1317 ///
1318 /// # Returns
1319 ///
1320 /// * Function result code:
1321 /// [`IMAGE_SUCCESS`] If the execution is successful.
1322 /// [`IMAGE_BAD_PARAMETER`] The param of pixelmap or colorSpaceNative is nullptr or invalid.
1323 /// [`OH_PixelmapNative`]
1324 /// Available since API-level: 13
1325 #[cfg(feature = "api-13")]
1326 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1327 pub fn OH_PixelmapNative_SetColorSpaceNative(
1328 pixelmap: *mut OH_PixelmapNative,
1329 colorSpaceNative: *mut OH_NativeColorSpaceManager,
1330 ) -> ImageResult;
1331 /// Set pixelmap memory name.
1332 ///
1333 /// # Arguments
1334 ///
1335 /// * `pixelmap` - The Pixelmap pointer to be operated.
1336 ///
1337 /// * `name` - The pointer of name that needs to be set.
1338 ///
1339 /// * `size` - The size of name size that needs to be set.
1340 ///
1341 /// # Returns
1342 ///
1343 /// * Function result code:
1344 /// [`IMAGE_SUCCESS`] If the operation is successful.
1345 /// [`IMAGE_BAD_PARAMETER`] If invalid parameter, name and size are incorrect.
1346 /// [`IMAGE_UNSUPPORTED_MEMORY_FORMAT`] If memory format is unsupported.
1347 /// [`OH_PixelmapNative`]
1348 /// Available since API-level: 13
1349 #[cfg(feature = "api-13")]
1350 #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
1351 pub fn OH_PixelmapNative_SetMemoryName(
1352 pixelmap: *mut OH_PixelmapNative,
1353 name: *mut ::core::ffi::c_char,
1354 size: *mut usize,
1355 ) -> ImageResult;
1356 /// Get the total number of bytes occupied by all pixels in the Pixelmap, without any padding.
1357 ///
1358 /// # Arguments
1359 ///
1360 /// * `pixelmap` - The Pixelmap pointer to be operated.
1361 ///
1362 /// * `byteCount` - The total number of bytes to be retrieved.
1363 ///
1364 /// # Returns
1365 ///
1366 /// * Function result code:
1367 /// [`IMAGE_SUCCESS`] If the operation is successful.
1368 /// [`IMAGE_BAD_PARAMETER`] If invalid parameter, pixelmap or byteCount are invalid.
1369 /// [`OH_PixelmapNative`]
1370 /// Available since API-level: 18
1371 #[cfg(feature = "api-18")]
1372 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1373 pub fn OH_PixelmapNative_GetByteCount(
1374 pixelmap: *mut OH_PixelmapNative,
1375 byteCount: *mut u32,
1376 ) -> ImageResult;
1377 /// Get the size of the allocated memory used to store this pixelmap's pixels.
1378 ///
1379 /// # Arguments
1380 ///
1381 /// * `pixelmap` - The Pixelmap pointer to be operated.
1382 ///
1383 /// * `allocationByteCount` - The size of the allocated memory.
1384 ///
1385 /// # Returns
1386 ///
1387 /// * Function result code:
1388 /// [`IMAGE_SUCCESS`] If the operation is successful.
1389 /// [`IMAGE_BAD_PARAMETER`] If invalid parameter, pixelmap or allocationByteCount are invalid.
1390 /// [`OH_PixelmapNative`]
1391 /// Available since API-level: 18
1392 #[cfg(feature = "api-18")]
1393 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1394 pub fn OH_PixelmapNative_GetAllocationByteCount(
1395 pixelmap: *mut OH_PixelmapNative,
1396 allocationByteCount: *mut u32,
1397 ) -> ImageResult;
1398 /// Obtains the memory address of a PixelMap and locks the memory.
1399 /// When the memory is locked, any operation that modifies or releases the PixelMap will fail and return
1400 /// [`IMAGE_BAD_PARAMETER`].
1401 ///
1402 /// # Arguments
1403 ///
1404 /// * `pixelmap` - The PixelMap pointer to be operated.
1405 ///
1406 /// * `addr` - The double pointer to the memory address of the PixelMap.
1407 ///
1408 /// # Returns
1409 ///
1410 /// * Function result code:
1411 /// [`IMAGE_SUCCESS`] If the operation is successful.
1412 /// [`IMAGE_BAD_PARAMETER`] If invalid parameter, pixelmap or addr are invalid.
1413 /// [`IMAGE_LOCK_UNLOCK_FAILED`] If memory failed to be locked.
1414 /// [`OH_PixelmapNative`]
1415 /// Available since API-level: 15
1416 #[cfg(feature = "api-15")]
1417 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
1418 pub fn OH_PixelmapNative_AccessPixels(
1419 pixelmap: *mut OH_PixelmapNative,
1420 addr: *mut *mut ::core::ffi::c_void,
1421 ) -> ImageResult;
1422 /// Unlocks the memory of the PixelMap data.
1423 /// This function is used with [`OH_PixelmapNative_AccessPixels`] in pairs.
1424 ///
1425 /// # Arguments
1426 ///
1427 /// * `pixelmap` - The PixelMap pointer to be operated.
1428 ///
1429 /// # Returns
1430 ///
1431 /// * Function result code:
1432 /// [`IMAGE_SUCCESS`] If the operation is successful.
1433 /// [`IMAGE_BAD_PARAMETER`] If invalid parameter, pixelmap is invalid.
1434 /// [`IMAGE_LOCK_UNLOCK_FAILED`] If memory failed to be unlocked.
1435 /// [`OH_PixelmapNative`]
1436 /// Available since API-level: 15
1437 #[cfg(feature = "api-15")]
1438 #[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
1439 pub fn OH_PixelmapNative_UnaccessPixels(pixelmap: *mut OH_PixelmapNative) -> ImageResult;
1440}