1 /* 2 * Copyright (c) 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 #ifndef C_INCLUDE_DRAWING_GPU_SURFACE_H 17 #define C_INCLUDE_DRAWING_GPU_SURFACE_H 18 19 /** 20 * @addtogroup Drawing 21 * @{ 22 * 23 * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. 24 * 25 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 26 * 27 * @since 8 28 * @version 1.0 29 */ 30 31 /** 32 * @file drawing_surface.h 33 * 34 * @brief Declares functions related to the <b>OH_Drawing_Surface</b> object in the drawing module. 35 * 36 * @kit ArkGraphics2D 37 * @library libnative_drawing.so 38 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 39 * @since 12 40 * @version 1.0 41 */ 42 43 #include "drawing_types.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /** 50 * @brief Creates an <b>OH_Drawing_Surface</b> object on GPU indicated by context. 51 * 52 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 53 * @param OH_Drawing_GpuContext Indicates the pointer to an <b>OH_Drawing_GpuContext</b> object. 54 * @param bool Indicates whether an allocation should count against a cache budget. 55 * @param OH_Drawing_Image_Info Indicates the image info. 56 * @return Returns the pointer to the <b>OH_Drawing_Surface</b> object created. 57 * @since 12 58 * @version 1.0 59 */ 60 OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext( 61 OH_Drawing_GpuContext*, bool, OH_Drawing_Image_Info); 62 63 /** 64 * @brief Gets the canvas that draws into surface. 65 * 66 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 67 * @param OH_Drawing_Surface Indicates the pointer to an <b>OH_Drawing_Surface</b> object. 68 * @return Returns the pointer to the <b>OH_Drawing_Canvas</b> object. The returned pointer does not need to be managed 69 * by the caller. 70 * @since 12 71 * @version 1.0 72 */ 73 OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas(OH_Drawing_Surface*); 74 75 /** 76 * @brief Destroys an <b>OH_Drawing_Surface</b> object and reclaims the memory occupied by the object. 77 * 78 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 79 * @param OH_Drawing_Surface Indicates the pointer to an <b>OH_Drawing_Surface</b> object. 80 * @since 12 81 * @version 1.0 82 */ 83 void OH_Drawing_SurfaceDestroy(OH_Drawing_Surface*); 84 85 #ifdef __cplusplus 86 } 87 #endif 88 /** @} */ 89 #endif