Arm-2D  
2D Image Processing Library for Cortex-M Processors
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#define draw_round_corner_box( __target_tile_ptr, \
55 __region_ptr, \
56 __colour, \
57 __opacity, \
58 __is_new_frame, \
59 ...) \
60 __draw_round_corner_box( \
61 (__target_tile_ptr), \
62 (__region_ptr), \
63 (__colour), \
64 (__opacity), \
65 (__is_new_frame), \
66 (((const arm_2d_tile_t *)&c_tileWhiteDotMask),##__VA_ARGS__))
67
68#define __draw_round_corner_image2( __source_tile_ptr, \
69 __target_tile_ptr, \
70 __region_ptr, \
71 __is_new_frame, \
72 __opacity, \
73 __circle_mask_addr) \
74 __draw_round_corner_image( \
75 (__source_tile_ptr), \
76 (__target_tile_ptr), \
77 (__region_ptr), \
78 (__is_new_frame), \
79 (__opacity), \
80 ((const arm_2d_tile_t *)(__circle_mask_addr)))
81
82#define __draw_round_corner_image1( __source_tile_ptr, \
83 __target_tile_ptr, \
84 __region_ptr, \
85 __is_new_frame, \
86 __opacity) \
87 __draw_round_corner_image( \
88 (__source_tile_ptr), \
89 (__target_tile_ptr), \
90 (__region_ptr), \
91 (__is_new_frame), \
92 (__opacity), \
93 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
94
95#define __draw_round_corner_image0( __source_tile_ptr, \
96 __target_tile_ptr, \
97 __region_ptr, \
98 __is_new_frame) \
99 __draw_round_corner_image( \
100 (__source_tile_ptr), \
101 (__target_tile_ptr), \
102 (__region_ptr), \
103 (__is_new_frame), \
104 0xFF, \
105 ((const arm_2d_tile_t *)&c_tileWhiteDotMask))
106
107#define draw_round_corner_image(__source_tile_ptr, \
108 __target_tile_ptr, \
109 __region_ptr, \
110 __is_new_frame, \
111 ...) \
112 ARM_CONNECT2( __draw_round_corner_image, \
113 __ARM_VA_NUM_ARGS(__VA_ARGS__))( \
114 (__source_tile_ptr), \
115 (__target_tile_ptr), \
116 (__region_ptr), \
117 (__is_new_frame),##__VA_ARGS__)
118
119#define draw_round_corner_border(__target_tile_ptr, \
120 __target_region_ptr, \
121 __colour, \
122 ...) \
123 __draw_round_corner_border( (__target_tile_ptr), \
124 (__target_region_ptr), \
125 (__colour), \
126 __VA_ARGS__, \
127 &c_tileCircleMask)
128
129#define draw_round_corner_border_with_circle_mask(__target_tile_ptr, \
130 __target_region_ptr, \
131 __colour, \
132 __circle_mask_ptr, \
133 ...) \
134 __draw_round_corner_border( \
135 (__target_tile_ptr), \
136 (__target_region_ptr), \
137 (__colour), \
138 __VA_ARGS__, \
139 (const arm_2d_tile_t *)(__circle_mask_ptr))
140
141/*============================ TYPES =========================================*/
142
143typedef struct {
144 uint8_t chLeft;
145 uint8_t chTop;
146 uint8_t chRight;
147 uint8_t chBottom;
149
150typedef struct {
151 uint8_t chTopLeft;
152 uint8_t chTopRight;
153 uint8_t chBottomLeft;
154 uint8_t chBottomRight;
156
157/*============================ GLOBAL VARIABLES ==============================*/
158
159extern
160const arm_2d_tile_t c_tileWhiteDotMask;
161
162extern
163const arm_2d_tile_t c_tileWhiteDotMask2;
164
165extern
166const arm_2d_tile_t c_tileCircleMask;
167
168extern
169const arm_2d_tile_t c_tileCircleMask2;
170/*============================ PROTOTYPES ====================================*/
171
172extern
173ARM_NONNULL(1)
174void __draw_round_corner_box( const arm_2d_tile_t *ptTarget,
175 const arm_2d_region_t *ptRegion,
176 COLOUR_INT tColour,
177 uint8_t chOpacity,
178 bool bIsNewFrame,
179 const arm_2d_tile_t *ptCircleMask);
180
181extern
182ARM_NONNULL(1)
183void __draw_round_corner_image( const arm_2d_tile_t *ptSource,
184 const arm_2d_tile_t *ptTarget,
185 const arm_2d_region_t *ptRegion,
186 bool bIsNewFrame,
187 uint8_t chOpacity,
188 const arm_2d_tile_t *ptCircleMask);
189
190extern
191ARM_NONNULL(1)
192void __draw_round_corner_border(const arm_2d_tile_t *ptTarget,
193 const arm_2d_region_t *ptRegion,
194 COLOUR_INT tColour,
196 arm_2d_corner_opacity_t CornerOpacity,
197 const arm_2d_tile_t *ptCircleMask);
198
199extern
200ARM_NONNULL(1)
201void draw_glass_bar(const arm_2d_tile_t *ptTarget,
202 const arm_2d_region_t *ptRegion,
203 uint8_t chOpacity,
204 bool bIsReflectionOnTop);
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif