1 /* 2 * Copyright (c) 2024-2025 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 8 25 * @version 1.0 26 */ 27 28 /** 29 * @file drawing_gpu_context.h 30 * 31 * @brief Declares functions related to the <b>OH_Drawing_GpuContext</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_GPU_CONTEXT_H 41 #define C_INCLUDE_DRAWING_GPU_CONTEXT_H 42 43 #include "drawing_types.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /** 50 * @brief Defines the options about GPU context. 51 * 52 * @since 12 53 * @version 1.0 54 * @deprecated since 18 55 */ 56 typedef struct { 57 /** If true this allows path mask textures to be cached */ 58 bool allowPathMaskCaching; 59 } OH_Drawing_GpuContextOptions; 60 61 /** 62 * @brief Creates an <b>OH_Drawing_GpuContext</b> object, whose GPU backend context is GL. 63 * 64 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 65 * @param gpuContextOptions Indicates the GPU context options. 66 * @return Returns the pointer to the <b>OH_Drawing_GpuContext</b> object created. 67 * @since 12 68 * @version 1.0 69 * @deprecated since 18 70 * @useinstead OH_Drawing_GpuContextCreate 71 */ 72 OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL(OH_Drawing_GpuContextOptions gpuContextOptions); 73 74 /** 75 * @brief Creates an <b>OH_Drawing_GpuContext</b> object, whose GPU backend context depends on device. 76 * 77 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 78 * @return Returns the pointer to the <b>OH_Drawing_GpuContext</b> object created. 79 * @since 16 80 * @version 1.0 81 */ 82 OH_Drawing_GpuContext* OH_Drawing_GpuContextCreate(void); 83 84 /** 85 * @brief Destroys an <b>OH_Drawing_GpuContext</b> object and reclaims the memory occupied by the object. 86 * 87 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 88 * @param gpuContext Indicates the pointer to an <b>OH_Drawing_GpuContext</b> object. 89 * @since 12 90 * @version 1.0 91 */ 92 void OH_Drawing_GpuContextDestroy(OH_Drawing_GpuContext* gpuContext); 93 94 #ifdef __cplusplus 95 } 96 #endif 97 /** @} */ 98 #endif