Arm-2D  
2D Image Processing Library for Cortex-M Processors
 
Loading...
Searching...
No Matches
arm_2d_helper_shape.h
1/*
2 * Copyright (c) 2009-2021 Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* ----------------------------------------------------------------------
20 * Project: Arm-2D Library
21 * Title: #include "arm_2d_helper_shape.h"
22 * Description: the helper service header file for drawing simple shapes
23 *
24 * $Date: 9. July 2025
25 * $Revision: V.1.13.1
26 *
27 * Target Processor: Cortex-M cores
28 * -------------------------------------------------------------------- */
29
30#ifndef __ARM_2D_HELPER_SHAPE_H__
31#define __ARM_2D_HELPER_SHAPE_H__
32
33/*============================ INCLUDES ======================================*/
34#include "arm_2d.h"
35
36#if defined(RTE_Acceleration_Arm_2D_Alpha_Blending)
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/*============================ MACROS ========================================*/
43#if __GLCD_CFG_COLOUR_DEPTH__ == 8
44# define COLOUR_INT uint8_t
45#elif __GLCD_CFG_COLOUR_DEPTH__ == 16
46# define COLOUR_INT uint16_t
47#elif __GLCD_CFG_COLOUR_DEPTH__ == 32
48# define COLOUR_INT uint32_t
49#else
50# error Unsupported colour depth!
51#endif
52
53
54/*============================ MACROFIED FUNCTIONS ===========================*/
55
56
57
58#define __draw_round_corner_box2( __target_tile_ptr, \
59 __region_ptr, \
60 __colour, \
61 __opacity, \
62 __is_new_frame, \
63 __circle_mask_ptr) \
64 __draw_round_corner_box( \
65 (__target_tile_ptr), \
66 (__region_ptr), \
67 (__colour), \
68 (__opacity), \
69 ((const arm_2d_tile_t *)__circle_mask_ptr))
70
71#define __draw_round_corner_box1( __target_tile_ptr, \
72 __region_ptr, \
73 __colour, \
74 __opacity, \
75 __is_new_frame) \
76 __draw_round_corner_box2( \
77 (__target_tile_ptr), \
78 (__region_ptr), \
79 (__colour), \
80 (__opacity), \
81 (__is_new_frame), \
82 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
83
84#define __draw_round_corner_box0( __target_tile_ptr, \
85 __region_ptr, \
86 __colour, \
87 __opacity) \
88 __draw_round_corner_box2( \
89 (__target_tile_ptr), \
90 (__region_ptr), \
91 (__colour), \
92 (__opacity), \
93 (true), \
94 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
95
96#define draw_round_corner_box( __target_tile_ptr, \
97 __region_ptr, \
98 __colour, \
99 __opacity, \
100 ...) \
101 ARM_CONNECT2( __draw_round_corner_box, \
102 __ARM_VA_NUM_ARGS(__VA_ARGS__))( \
103 (__target_tile_ptr), \
104 (__region_ptr), \
105 (__colour), \
106 (__opacity), ##__VA_ARGS__)
107
108#define __draw_round_corner_image2( __source_tile_ptr, \
109 __target_tile_ptr, \
110 __region_ptr, \
111 __is_new_frame, \
112 __opacity, \
113 __circle_mask_addr) \
114 __draw_round_corner_image( \
115 (__source_tile_ptr), \
116 (__target_tile_ptr), \
117 (__region_ptr), \
118 (__is_new_frame), \
119 (__opacity), \
120 ((const arm_2d_tile_t *)(__circle_mask_addr)))
121
122#define __draw_round_corner_image1( __source_tile_ptr, \
123 __target_tile_ptr, \
124 __region_ptr, \
125 __is_new_frame, \
126 __opacity) \
127 __draw_round_corner_image( \
128 (__source_tile_ptr), \
129 (__target_tile_ptr), \
130 (__region_ptr), \
131 (__is_new_frame), \
132 (__opacity), \
133 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
134
135#define __draw_round_corner_image0( __source_tile_ptr, \
136 __target_tile_ptr, \
137 __region_ptr, \
138 __is_new_frame) \
139 __draw_round_corner_image( \
140 (__source_tile_ptr), \
141 (__target_tile_ptr), \
142 (__region_ptr), \
143 (__is_new_frame), \
144 0xFF, \
145 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
146
147#define draw_round_corner_image(__source_tile_ptr, \
148 __target_tile_ptr, \
149 __region_ptr, \
150 __is_new_frame, \
151 ...) \
152 ARM_CONNECT2( __draw_round_corner_image, \
153 __ARM_VA_NUM_ARGS(__VA_ARGS__))( \
154 (__source_tile_ptr), \
155 (__target_tile_ptr), \
156 (__region_ptr), \
157 (__is_new_frame),##__VA_ARGS__)
158
159#define draw_round_corner_border(__target_tile_ptr, \
160 __target_region_ptr, \
161 __colour, \
162 ...) \
163 __draw_round_corner_border( (__target_tile_ptr), \
164 (__target_region_ptr), \
165 (__colour), \
166 __VA_ARGS__, \
167 &c_tileCircleMask)
168
169#define draw_round_corner_border_with_circle_mask(__target_tile_ptr, \
170 __target_region_ptr, \
171 __colour, \
172 __circle_mask_ptr, \
173 ...) \
174 __draw_round_corner_border( \
175 (__target_tile_ptr), \
176 (__target_region_ptr), \
177 (__colour), \
178 __VA_ARGS__, \
179 (const arm_2d_tile_t *)(__circle_mask_ptr))
180
181/*============================ TYPES =========================================*/
182
183typedef struct {
184 uint8_t chLeft;
185 uint8_t chTop;
186 uint8_t chRight;
187 uint8_t chBottom;
188} arm_2d_border_opacity_t;
189
190typedef struct {
191 uint8_t chTopLeft;
192 uint8_t chTopRight;
193 uint8_t chBottomLeft;
194 uint8_t chBottomRight;
195} arm_2d_corner_opacity_t;
196
197/*============================ GLOBAL VARIABLES ==============================*/
198
199extern
200const arm_2d_tile_t c_tileWhiteDotMask;
201
202extern
203const arm_2d_tile_t c_tileWhiteDotMask2;
204
205extern
206const arm_2d_tile_t c_tileCircleMask;
207
208extern
209const arm_2d_tile_t c_tileCircleMask2;
210/*============================ PROTOTYPES ====================================*/
211
212extern
213ARM_NONNULL(1)
214void __draw_round_corner_box( const arm_2d_tile_t *ptTarget,
215 const arm_2d_region_t *ptRegion,
216 COLOUR_INT tColour,
217 uint8_t chOpacity,
218 const arm_2d_tile_t *ptCircleMask);
219
220extern
221ARM_NONNULL(1)
222void __draw_round_corner_image( const arm_2d_tile_t *ptSource,
223 const arm_2d_tile_t *ptTarget,
224 const arm_2d_region_t *ptRegion,
225 bool bIsNewFrame,
226 uint8_t chOpacity,
227 const arm_2d_tile_t *ptCircleMask);
228
229extern
230ARM_NONNULL(1)
231void __draw_round_corner_border(const arm_2d_tile_t *ptTarget,
232 const arm_2d_region_t *ptRegion,
233 COLOUR_INT tColour,
234 arm_2d_border_opacity_t Opacity,
235 arm_2d_corner_opacity_t CornerOpacity,
236 const arm_2d_tile_t *ptCircleMask);
237
238extern
239ARM_NONNULL(1)
240void draw_glass_bar(const arm_2d_tile_t *ptTarget,
241 const arm_2d_region_t *ptRegion,
242 uint8_t chOpacity,
243 bool bIsReflectionOnTop);
244
245#ifdef __cplusplus
246}
247#endif
248
249#endif
250
251#endif