• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
17  * @addtogroup image
18  * @{
19  *
20  * @brief Provides APIs for obtaining effect filter and information.
21  *
22  * @syscap SystemCapability.Multimedia.Image.Core
23  * @since 12
24  */
25 
26 /**
27  * @file effect_types.h
28  *
29  * @brief Declares the data types for effect filter.
30  *
31  * @kit ArkGraphics2D
32  * @library libnative_effect.so
33  * @syscap SystemCapability.Multimedia.Image.Core
34  * @since 12
35  */
36 
37 #ifndef C_INCLUDE_EFFECT_TYPES_H
38 #define C_INCLUDE_EFFECT_TYPES_H
39 
40 #include <stdint.h>
41 #include <stddef.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Defines a effect filter.
49  *
50  * @since 12
51  * @version 1.0
52  */
53 typedef struct OH_Filter OH_Filter;
54 
55 /**
56  * @brief Defines a pixelmap.
57  *
58  * @since 12
59  * @version 1.0
60  */
61 typedef struct OH_PixelmapNative OH_PixelmapNative;
62 
63 /**
64  * @brief Defines a matrix for create effect filter.
65  *
66  * @since 12
67  * @version 1.0
68  */
69 struct OH_Filter_ColorMatrix {
70     /** val mast be 5*4 */
71     float val[20];
72 };
73 
74 /**
75  * @brief Defines a effect filter error code.
76  *
77  * @since 12
78  * @version 1.0
79  */
80 typedef enum {
81     /** success */
82     EFFECT_SUCCESS = 0,
83     /** invalid parameter */
84     EFFECT_BAD_PARAMETER = 401,
85     /** unsupported operations */
86     EFFECT_UNSUPPORTED_OPERATION = 7600201,
87     /** unknown error */
88     EFFECT_UNKNOWN_ERROR = 7600901,
89 } EffectErrorCode;
90 
91 /**
92  * @brief Defines a effect filter tile mode.
93  *
94  * @since 14
95  */
96 typedef enum {
97     /** Replicate the edge color if the shader draws outside of its original bounds */
98     CLAMP = 0,
99     /** Repeat the shader's image horizontally and vertically */
100     REPEAT,
101     /** Repeat the shader's image horizontally and vertically,
102      *  alternating mirror images so that adjacent images always seam
103      */
104     MIRROR,
105     /** Only draw within the original domain, return transparent-black everywhere else */
106     DECAL,
107 } EffectTileMode;
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 /** @} */
113 #endif