1 /* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup Drawing 18 * @{ 19 * 20 * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. 21 * 22 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 23 * 24 * @since 12 25 * @version 1.0 26 */ 27 28 /** 29 * @file drawing_image.h 30 * 31 * @brief Declares functions related to the <b>image</b> object in the drawing module. 32 * 33 * @kit ArkGraphics2D 34 * @library libnative_drawing.so 35 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 36 * @since 12 37 * @version 1.0 38 */ 39 40 #ifndef C_INCLUDE_DRAWING_IMAGE_H 41 #define C_INCLUDE_DRAWING_IMAGE_H 42 43 #include "drawing_types.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /** 50 * @brief Creates an <b>OH_Drawing_Image</b> object. 51 * 52 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 53 * @return Returns the pointer to the <b>OH_Drawing_Image</b> object created. 54 * @since 12 55 * @version 1.0 56 */ 57 OH_Drawing_Image* OH_Drawing_ImageCreate(void); 58 59 /** 60 * @brief Destroys an <b>OH_Drawing_Image</b> object and reclaims the memory occupied by the object. 61 * 62 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 63 * @param image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 64 * @since 12 65 * @version 1.0 66 */ 67 void OH_Drawing_ImageDestroy(OH_Drawing_Image* image); 68 69 /** 70 * @brief Rebuilds an <b>OH_Drawing_Image</b> object, sharing or copying bitmap pixels. 71 * 72 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 73 * @param image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 74 * @param bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object. 75 * @return Returns true if successed. 76 * @since 12 77 * @version 1.0 78 */ 79 bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image* image, OH_Drawing_Bitmap* bitmap); 80 81 /** 82 * @brief Gets pixel count in each row of image. 83 * 84 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 85 * @param image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 86 * @return Returns the width. 87 * @since 12 88 * @version 1.0 89 */ 90 int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image* image); 91 92 /** 93 * @brief Gets pixel row count of image. 94 * 95 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 96 * @param image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 97 * @return Returns the height. 98 * @since 12 99 * @version 1.0 100 */ 101 int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image* image); 102 103 /** 104 * @brief Gets the image info. 105 * 106 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 107 * @param image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 108 * @param imageInfo Indicates the pointer to an <b>OH_Drawing_Image_Info</b> object. 109 * @since 12 110 * @version 1.0 111 */ 112 void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image* image, OH_Drawing_Image_Info* imageInfo); 113 114 #ifdef __cplusplus 115 } 116 #endif 117 /** @} */ 118 #endif