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: 04. Dec 2024
25 * $Revision: V.1.13.0
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#ifdef __cplusplus
37extern "C" {
38#endif
39
40/*============================ MACROS ========================================*/
41#if __GLCD_CFG_COLOUR_DEPTH__ == 8
42# define COLOUR_INT uint8_t
43#elif __GLCD_CFG_COLOUR_DEPTH__ == 16
44# define COLOUR_INT uint16_t
45#elif __GLCD_CFG_COLOUR_DEPTH__ == 32
46# define COLOUR_INT uint32_t
47#else
48# error Unsupported colour depth!
49#endif
50
51
52/*============================ MACROFIED FUNCTIONS ===========================*/
53
54
55
56#define __draw_round_corner_box2( __target_tile_ptr, \
57 __region_ptr, \
58 __colour, \
59 __opacity, \
60 __is_new_frame, \
61 __circle_mask_ptr) \
62 __draw_round_corner_box( \
63 (__target_tile_ptr), \
64 (__region_ptr), \
65 (__colour), \
66 (__opacity), \
67 ((const arm_2d_tile_t *)__circle_mask_ptr))
68
69#define __draw_round_corner_box1( __target_tile_ptr, \
70 __region_ptr, \
71 __colour, \
72 __opacity, \
73 __is_new_frame) \
74 __draw_round_corner_box2( \
75 (__target_tile_ptr), \
76 (__region_ptr), \
77 (__colour), \
78 (__opacity), \
79 (__is_new_frame), \
80 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
81
82#define __draw_round_corner_box0( __target_tile_ptr, \
83 __region_ptr, \
84 __colour, \
85 __opacity) \
86 __draw_round_corner_box2( \
87 (__target_tile_ptr), \
88 (__region_ptr), \
89 (__colour), \
90 (__opacity), \
91 (true), \
92 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
93
94#define draw_round_corner_box( __target_tile_ptr, \
95 __region_ptr, \
96 __colour, \
97 __opacity, \
98 ...) \
99 ARM_CONNECT2( __draw_round_corner_box, \
100 __ARM_VA_NUM_ARGS(__VA_ARGS__))( \
101 (__target_tile_ptr), \
102 (__region_ptr), \
103 (__colour), \
104 (__opacity), ##__VA_ARGS__)
105
106#define __draw_round_corner_image2( __source_tile_ptr, \
107 __target_tile_ptr, \
108 __region_ptr, \
109 __is_new_frame, \
110 __opacity, \
111 __circle_mask_addr) \
112 __draw_round_corner_image( \
113 (__source_tile_ptr), \
114 (__target_tile_ptr), \
115 (__region_ptr), \
116 (__is_new_frame), \
117 (__opacity), \
118 ((const arm_2d_tile_t *)(__circle_mask_addr)))
119
120#define __draw_round_corner_image1( __source_tile_ptr, \
121 __target_tile_ptr, \
122 __region_ptr, \
123 __is_new_frame, \
124 __opacity) \
125 __draw_round_corner_image( \
126 (__source_tile_ptr), \
127 (__target_tile_ptr), \
128 (__region_ptr), \
129 (__is_new_frame), \
130 (__opacity), \
131 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
132
133#define __draw_round_corner_image0( __source_tile_ptr, \
134 __target_tile_ptr, \
135 __region_ptr, \
136 __is_new_frame) \
137 __draw_round_corner_image( \
138 (__source_tile_ptr), \
139 (__target_tile_ptr), \
140 (__region_ptr), \
141 (__is_new_frame), \
142 0xFF, \
143 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
144
145#define draw_round_corner_image(__source_tile_ptr, \
146 __target_tile_ptr, \
147 __region_ptr, \
148 __is_new_frame, \
149 ...) \
150 ARM_CONNECT2( __draw_round_corner_image, \
151 __ARM_VA_NUM_ARGS(__VA_ARGS__))( \
152 (__source_tile_ptr), \
153 (__target_tile_ptr), \
154 (__region_ptr), \
155 (__is_new_frame),##__VA_ARGS__)
156
157#define draw_round_corner_border(__target_tile_ptr, \
158 __target_region_ptr, \
159 __colour, \
160 ...) \
161 __draw_round_corner_border( (__target_tile_ptr), \
162 (__target_region_ptr), \
163 (__colour), \
164 __VA_ARGS__, \
165 &c_tileCircleMask)
166
167#define draw_round_corner_border_with_circle_mask(__target_tile_ptr, \
168 __target_region_ptr, \
169 __colour, \
170 __circle_mask_ptr, \
171 ...) \
172 __draw_round_corner_border( \
173 (__target_tile_ptr), \
174 (__target_region_ptr), \
175 (__colour), \
176 __VA_ARGS__, \
177 (const arm_2d_tile_t *)(__circle_mask_ptr))
178
179/*============================ TYPES =========================================*/
180
181typedef struct {
182 uint8_t chLeft;
183 uint8_t chTop;
184 uint8_t chRight;
185 uint8_t chBottom;
187
188typedef struct {
189 uint8_t chTopLeft;
190 uint8_t chTopRight;
191 uint8_t chBottomLeft;
192 uint8_t chBottomRight;
194
195/*============================ GLOBAL VARIABLES ==============================*/
196
197extern
198const arm_2d_tile_t c_tileWhiteDotMask;
199
200extern
201const arm_2d_tile_t c_tileWhiteDotMask2;
202
203extern
204const arm_2d_tile_t c_tileCircleMask;
205
206extern
207const arm_2d_tile_t c_tileCircleMask2;
208/*============================ PROTOTYPES ====================================*/
209
210extern
211ARM_NONNULL(1)
212void __draw_round_corner_box( const arm_2d_tile_t *ptTarget,
213 const arm_2d_region_t *ptRegion,
214 COLOUR_INT tColour,
215 uint8_t chOpacity,
216 const arm_2d_tile_t *ptCircleMask);
217
218extern
219ARM_NONNULL(1)
220void __draw_round_corner_image( const arm_2d_tile_t *ptSource,
221 const arm_2d_tile_t *ptTarget,
222 const arm_2d_region_t *ptRegion,
223 bool bIsNewFrame,
224 uint8_t chOpacity,
225 const arm_2d_tile_t *ptCircleMask);
226
227extern
228ARM_NONNULL(1)
229void __draw_round_corner_border(const arm_2d_tile_t *ptTarget,
230 const arm_2d_region_t *ptRegion,
231 COLOUR_INT tColour,
233 arm_2d_corner_opacity_t CornerOpacity,
234 const arm_2d_tile_t *ptCircleMask);
235
236extern
237ARM_NONNULL(1)
238void draw_glass_bar(const arm_2d_tile_t *ptTarget,
239 const arm_2d_region_t *ptRegion,
240 uint8_t chOpacity,
241 bool bIsReflectionOnTop);
242
243#ifdef __cplusplus
244}
245#endif
246
247#endif