Arm-2D  
2D Image Processing Library for Cortex-M Processors
arm_2d_tile.h
1/*
2 * Copyright (C) 2010-2022 Arm Limited or its affiliates. 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: arm_2d_tile.h
22 * Description: Public header file to contain the basic tile operations
23 *
24 * $Date: 09. Aug 2022
25 * $Revision: V.1.0.3
26 *
27 * Target Processor: Cortex-M cores
28 * -------------------------------------------------------------------- */
29
30#ifndef __ARM_2D_TILE_H__
31#define __ARM_2D_TILE_H__
32
33/*============================ INCLUDES ======================================*/
34#include "arm_2d_types.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40
41
42/*============================ MACROS ========================================*/
43
44/*!
45 * \addtogroup Deprecated
46 * @{
47 */
48#define arm_2d_c8bit_tile_copy_with_colour_masking \
49 arm_2d_c8bit_tile_copy_with_colour_keying
50
51#define arm_2d_rgb16_tile_copy_with_colour_masking \
52 arm_2d_rgb16_tile_copy_with_colour_keying
53
54#define arm_2d_rgb32_tile_copy_with_colour_masking \
55 arm_2d_rgb32_tile_copy_with_colour_keying
56/*! @} */
57
58/*!
59 * \addtogroup Tile 2 Tile Operations
60 * @{
61 */
62/*============================ MACROFIED FUNCTIONS ===========================*/
63
64#define arm_2d_c8bit_tile_copy( __SRC_ADDR, /* source tile address */ \
65 __DES_ADDR, /* target tile address */ \
66 __DES_REGION_ADDR, /* target region address*/\
67 __MODE) /* mode */ \
68 arm_2dp_c8bit_tile_copy(NULL, \
69 (__SRC_ADDR), \
70 (__DES_ADDR), \
71 (__DES_REGION_ADDR), \
72 (__MODE))
73
74#define arm_2d_rgb16_tile_copy( __SRC_ADDR, /* source tile address */ \
75 __DES_ADDR, /* target tile address */ \
76 __DES_REGION_ADDR, /* target region address*/\
77 __MODE) /* mode */ \
78 arm_2dp_rgb16_tile_copy(NULL, \
79 (__SRC_ADDR), \
80 (__DES_ADDR), \
81 (__DES_REGION_ADDR), \
82 (__MODE))
83
84#define arm_2d_rgb32_tile_copy( __SRC_ADDR, /* source tile address */ \
85 __DES_ADDR, /* target tile address */ \
86 __DES_REGION_ADDR, /* target region address*/\
87 __MODE) /* mode */ \
88 arm_2dp_rgb32_tile_copy(NULL, \
89 (__SRC_ADDR), \
90 (__DES_ADDR), \
91 (__DES_REGION_ADDR), \
92 (__MODE))
93
94#define arm_2d_c8bit_tile_copy_only( \
95 __SRC_ADDR, /* source tile address */ \
96 __DES_ADDR, /* target tile address */ \
97 __DES_REGION_ADDR) /* target region address*/\
98 arm_2dp_c8bit_tile_copy_only(NULL, \
99 (__SRC_ADDR), \
100 (__DES_ADDR), \
101 (__DES_REGION_ADDR))
102
103#define arm_2d_rgb16_tile_copy_only( \
104 __SRC_ADDR, /* source tile address */ \
105 __DES_ADDR, /* target tile address */ \
106 __DES_REGION_ADDR) /* target region address*/\
107 arm_2dp_rgb16_tile_copy_only(NULL, \
108 (__SRC_ADDR), \
109 (__DES_ADDR), \
110 (__DES_REGION_ADDR))
111
112#define arm_2d_rgb32_tile_copy_only( \
113 __SRC_ADDR, /* source tile address */ \
114 __DES_ADDR, /* target tile address */ \
115 __DES_REGION_ADDR) /* target region address*/\
116 arm_2dp_rgb32_tile_copy_only(NULL, \
117 (__SRC_ADDR), \
118 (__DES_ADDR), \
119 (__DES_REGION_ADDR))
120
121#define arm_2d_c8bit_tile_copy_with_x_mirror( \
122 __SRC_ADDR, /* source tile address */ \
123 __DES_ADDR, /* target tile address */ \
124 __DES_REGION_ADDR) /* target region address*/\
125 arm_2dp_c8bit_tile_copy_with_x_mirror( \
126 NULL, \
127 (__SRC_ADDR), \
128 (__DES_ADDR), \
129 (__DES_REGION_ADDR))
130
131#define arm_2d_rgb16_tile_copy_with_x_mirror( \
132 __SRC_ADDR, /* source tile address */ \
133 __DES_ADDR, /* target tile address */ \
134 __DES_REGION_ADDR) /* target region address*/\
135 arm_2dp_rgb16_tile_copy_with_x_mirror( \
136 NULL, \
137 (__SRC_ADDR), \
138 (__DES_ADDR), \
139 (__DES_REGION_ADDR))
140
141#define arm_2d_rgb32_tile_copy_with_x_mirror( \
142 __SRC_ADDR, /* source tile address */ \
143 __DES_ADDR, /* target tile address */ \
144 __DES_REGION_ADDR) /* target region address*/\
145 arm_2dp_rgb32_tile_copy_with_x_mirror( \
146 NULL, \
147 (__SRC_ADDR), \
148 (__DES_ADDR), \
149 (__DES_REGION_ADDR))
150
151#define arm_2d_c8bit_tile_copy_with_y_mirror( \
152 __SRC_ADDR, /* source tile address */ \
153 __DES_ADDR, /* target tile address */ \
154 __DES_REGION_ADDR) /* target region address*/\
155 arm_2dp_c8bit_tile_copy_with_y_mirror( \
156 NULL, \
157 (__SRC_ADDR), \
158 (__DES_ADDR), \
159 (__DES_REGION_ADDR))
160
161#define arm_2d_rgb16_tile_copy_with_y_mirror( \
162 __SRC_ADDR, /* source tile address */ \
163 __DES_ADDR, /* target tile address */ \
164 __DES_REGION_ADDR) /* target region address*/\
165 arm_2dp_rgb16_tile_copy_with_y_mirror( \
166 NULL, \
167 (__SRC_ADDR), \
168 (__DES_ADDR), \
169 (__DES_REGION_ADDR))
170
171#define arm_2d_rgb32_tile_copy_with_y_mirror( \
172 __SRC_ADDR, /* source tile address */ \
173 __DES_ADDR, /* target tile address */ \
174 __DES_REGION_ADDR) /* target region address*/\
175 arm_2dp_rgb32_tile_copy_with_y_mirror( \
176 NULL, \
177 (__SRC_ADDR), \
178 (__DES_ADDR), \
179 (__DES_REGION_ADDR))
180
181#define arm_2d_c8bit_tile_copy_with_xy_mirror( \
182 __SRC_ADDR, /* source tile address */ \
183 __DES_ADDR, /* target tile address */ \
184 __DES_REGION_ADDR) /* target region address*/\
185 arm_2dp_c8bit_tile_copy_with_xy_mirror( \
186 NULL, \
187 (__SRC_ADDR), \
188 (__DES_ADDR), \
189 (__DES_REGION_ADDR))
190
191#define arm_2d_rgb16_tile_copy_with_xy_mirror( \
192 __SRC_ADDR, /* source tile address */ \
193 __DES_ADDR, /* target tile address */ \
194 __DES_REGION_ADDR) /* target region address*/\
195 arm_2dp_rgb16_tile_copy_with_xy_mirror( \
196 NULL, \
197 (__SRC_ADDR), \
198 (__DES_ADDR), \
199 (__DES_REGION_ADDR))
200
201#define arm_2d_rgb32_tile_copy_with_xy_mirror( \
202 __SRC_ADDR, /* source tile address */ \
203 __DES_ADDR, /* target tile address */ \
204 __DES_REGION_ADDR) /* target region address*/\
205 arm_2dp_rgb32_tile_copy_with_xy_mirror( \
206 NULL, \
207 (__SRC_ADDR), \
208 (__DES_ADDR), \
209 (__DES_REGION_ADDR))
210
211#define arm_2d_c8bit_tile_fill_only( \
212 __SRC_ADDR, /* source tile address */ \
213 __DES_ADDR, /* target tile address */ \
214 __DES_REGION_ADDR) /* target region address*/\
215 arm_2dp_c8bit_tile_fill_only(NULL, \
216 (__SRC_ADDR), \
217 (__DES_ADDR), \
218 (__DES_REGION_ADDR))
219
220#define arm_2d_rgb16_tile_fill_only( \
221 __SRC_ADDR, /* source tile address */ \
222 __DES_ADDR, /* target tile address */ \
223 __DES_REGION_ADDR) /* target region address*/\
224 arm_2dp_rgb16_tile_fill_only(NULL, \
225 (__SRC_ADDR), \
226 (__DES_ADDR), \
227 (__DES_REGION_ADDR))
228
229#define arm_2d_rgb32_tile_fill_only( \
230 __SRC_ADDR, /* source tile address */ \
231 __DES_ADDR, /* target tile address */ \
232 __DES_REGION_ADDR) /* target region address*/\
233 arm_2dp_rgb32_tile_fill_only(NULL, \
234 (__SRC_ADDR), \
235 (__DES_ADDR), \
236 (__DES_REGION_ADDR))
237
238#define arm_2d_c8bit_tile_fill_with_x_mirror( \
239 __SRC_ADDR, /* source tile address */ \
240 __DES_ADDR, /* target tile address */ \
241 __DES_REGION_ADDR) /* target region address*/\
242 arm_2dp_c8bit_tile_fill_with_x_mirror( \
243 NULL, \
244 (__SRC_ADDR), \
245 (__DES_ADDR), \
246 (__DES_REGION_ADDR))
247
248#define arm_2d_rgb16_tile_fill_with_x_mirror( \
249 __SRC_ADDR, /* source tile address */ \
250 __DES_ADDR, /* target tile address */ \
251 __DES_REGION_ADDR) /* target region address*/\
252 arm_2dp_rgb16_tile_fill_with_x_mirror( \
253 NULL, \
254 (__SRC_ADDR), \
255 (__DES_ADDR), \
256 (__DES_REGION_ADDR))
257
258#define arm_2d_rgb32_tile_fill_with_x_mirror( \
259 __SRC_ADDR, /* source tile address */ \
260 __DES_ADDR, /* target tile address */ \
261 __DES_REGION_ADDR) /* target region address*/\
262 arm_2dp_rgb32_tile_fill_with_x_mirror( \
263 NULL, \
264 (__SRC_ADDR), \
265 (__DES_ADDR), \
266 (__DES_REGION_ADDR))
267
268#define arm_2d_c8bit_tile_fill_with_y_mirror( \
269 __SRC_ADDR, /* source tile address */ \
270 __DES_ADDR, /* target tile address */ \
271 __DES_REGION_ADDR) /* target region address*/\
272 arm_2dp_c8bit_tile_fill_with_y_mirror( \
273 NULL, \
274 (__SRC_ADDR), \
275 (__DES_ADDR), \
276 (__DES_REGION_ADDR))
277
278#define arm_2d_rgb16_tile_fill_with_y_mirror( \
279 __SRC_ADDR, /* source tile address */ \
280 __DES_ADDR, /* target tile address */ \
281 __DES_REGION_ADDR) /* target region address*/\
282 arm_2dp_rgb16_tile_fill_with_y_mirror( \
283 NULL, \
284 (__SRC_ADDR), \
285 (__DES_ADDR), \
286 (__DES_REGION_ADDR))
287
288#define arm_2d_rgb32_tile_fill_with_y_mirror( \
289 __SRC_ADDR, /* source tile address */ \
290 __DES_ADDR, /* target tile address */ \
291 __DES_REGION_ADDR) /* target region address*/\
292 arm_2dp_rgb32_tile_fill_with_y_mirror( \
293 NULL, \
294 (__SRC_ADDR), \
295 (__DES_ADDR), \
296 (__DES_REGION_ADDR))
297
298#define arm_2d_c8bit_tile_fill_with_xy_mirror( \
299 __SRC_ADDR, /* source tile address */ \
300 __DES_ADDR, /* target tile address */ \
301 __DES_REGION_ADDR) /* target region address*/\
302 arm_2dp_c8bit_tile_fill_with_xy_mirror( \
303 NULL, \
304 (__SRC_ADDR), \
305 (__DES_ADDR), \
306 (__DES_REGION_ADDR))
307
308#define arm_2d_rgb16_tile_fill_with_xy_mirror( \
309 __SRC_ADDR, /* source tile address */ \
310 __DES_ADDR, /* target tile address */ \
311 __DES_REGION_ADDR) /* target region address*/\
312 arm_2dp_rgb16_tile_fill_with_xy_mirror( \
313 NULL, \
314 (__SRC_ADDR), \
315 (__DES_ADDR), \
316 (__DES_REGION_ADDR))
317
318#define arm_2d_rgb32_tile_fill_with_xy_mirror( \
319 __SRC_ADDR, /* source tile address */ \
320 __DES_ADDR, /* target tile address */ \
321 __DES_REGION_ADDR) /* target region address*/\
322 arm_2dp_rgb32_tile_fill_with_xy_mirror( \
323 NULL, \
324 (__SRC_ADDR), \
325 (__DES_ADDR), \
326 (__DES_REGION_ADDR))
327
328#define arm_2d_c8bit_tile_copy_with_colour_keying( \
329 __SRC_ADDR, /* source tile address */ \
330 __DES_ADDR, /* target tile address */ \
331 __DES_REGION_ADDR, /* target region address*/\
332 __MSK_COLOUR, /* mask(key) colour */ \
333 __MODE) /* mode */ \
334 arm_2dp_c8bit_tile_copy_with_colour_keying( \
335 NULL, \
336 (__SRC_ADDR), \
337 (__DES_ADDR), \
338 (__DES_REGION_ADDR), \
339 (__MSK_COLOUR), \
340 (__MODE))
341
342
343#define arm_2d_rgb16_tile_copy_with_colour_keying( \
344 __SRC_ADDR, /* source tile address */ \
345 __DES_ADDR, /* target tile address */ \
346 __DES_REGION_ADDR, /* target region address*/\
347 __MSK_COLOUR, /* mask(key) colour */ \
348 __MODE) /* mode */ \
349 arm_2dp_rgb16_tile_copy_with_colour_keying( \
350 NULL, \
351 (__SRC_ADDR), \
352 (__DES_ADDR), \
353 (__DES_REGION_ADDR), \
354 (__MSK_COLOUR), \
355 (__MODE))
356
357#define arm_2d_rgb32_tile_copy_with_colour_keying( \
358 __SRC_ADDR, /* source tile address */ \
359 __DES_ADDR, /* target tile address */ \
360 __DES_REGION_ADDR, /* target region address*/\
361 __MSK_COLOUR, /* mask(key) colour */ \
362 __MODE) /* mode */ \
363 arm_2dp_rgb32_tile_copy_with_colour_keying( \
364 NULL, \
365 (__SRC_ADDR), \
366 (__DES_ADDR), \
367 (__DES_REGION_ADDR), \
368 (__MSK_COLOUR), \
369 (__MODE))
370
371
372/*
373 calculate the start address
374 HOW IT WORKS:
375
376 Base Address
377 +------------------------------------------------------------------------+
378 | |
379 |<------------------------------- iWidth ------------------------------->|
380 | |
381 | |
382 | Start Address = Base Address + iX + iY * iWidth |
383 | (iX,iY) |
384 |<-------- iX --------->+------------------------------+ |
385 | | | |
386 | | Valid Region | |
387 | | | |
388 | +------------------------------+ |
389 ... ...
390 | |
391 +------------------------------------------------------------------------+
392 */
393
394#define __arm_2d_get_address_and_region_from_tile( __TILE_PTR, \
395 __VALID_REGION_NAME, \
396 __LOCATION_OFFSET_PTR, \
397 __TYPE, \
398 __BUF_PTR_NAME) \
399 arm_2d_region_t __VALID_REGION_NAME; \
400 assert(NULL != (__TILE_PTR)); \
401 __TYPE *(__BUF_PTR_NAME) = NULL; \
402 \
403 (__TILE_PTR) = arm_2d_tile_get_root((__TILE_PTR), \
404 &__VALID_REGION_NAME, \
405 __LOCATION_OFFSET_PTR); \
406 \
407 if (NULL != (__TILE_PTR)) { \
408 (__BUF_PTR_NAME) = ((__TYPE *)((__TILE_PTR)->pchBuffer)) \
409 + (__TILE_PTR)->tRegion.tSize.iWidth * \
410 __VALID_REGION_NAME.tLocation.iY \
411 + __VALID_REGION_NAME.tLocation.iX; \
412 }
413
414
415#define arm_2d_get_address_and_region_from_tile(__TILE_PTR, \
416 __VALID_REGION_NAME, \
417 __LOCATION_OFFSET_PTR, \
418 __TYPE, \
419 __BUF_PTR_NAME) \
420 __arm_2d_get_address_and_region_from_tile( __TILE_PTR, \
421 __VALID_REGION_NAME, \
422 __LOCATION_OFFSET_PTR, \
423 __TYPE, \
424 __BUF_PTR_NAME)
425
426
427#define __arm_2d_get_address_and_region_from_tile_with_mirroring( \
428 __TILE_PTR, \
429 __VALID_REGION_NAME, \
430 __LOCATION_OFFSET_PTR, \
431 __TYPE, \
432 __BUF_PTR_NAME, \
433 __MODE) \
434 arm_2d_region_t __VALID_REGION_NAME; \
435 assert(NULL != (__TILE_PTR)); \
436 __TYPE *(__BUF_PTR_NAME) = NULL; \
437 \
438 (__TILE_PTR) = arm_2d_tile_get_root((__TILE_PTR), \
439 &__VALID_REGION_NAME, \
440 __LOCATION_OFFSET_PTR); \
441 \
442 if (NULL != (__TILE_PTR)) { \
443 arm_2d_location_t tOffset = __VALID_REGION_NAME.tLocation; \
444 if ((__MODE) & ARM_2D_CP_MODE_X_MIRROR) { \
445 tOffset.iX = 0; \
446 } \
447 if ((__MODE) & ARM_2D_CP_MODE_Y_MIRROR) { \
448 tOffset.iY = 0; \
449 } \
450 (__BUF_PTR_NAME) = ((__TYPE *)((__TILE_PTR)->pchBuffer)) \
451 + (__TILE_PTR)->tRegion.tSize.iWidth * tOffset.iY \
452 + tOffset.iX; \
453 }
454
455
456#define arm_2d_get_address_and_region_from_tile_with_mirroring( \
457 __TILE_PTR, \
458 __VALID_REGION_NAME, \
459 __LOCATION_OFFSET_PTR, \
460 __TYPE, \
461 __BUF_PTR_NAME, \
462 __MODE) \
463 __arm_2d_get_address_and_region_from_tile_with_mirroring( \
464 __TILE_PTR, \
465 __VALID_REGION_NAME, \
466 __LOCATION_OFFSET_PTR, \
467 __TYPE, \
468 __BUF_PTR_NAME, \
469 (__MODE))
470
471/*============================ TYPES =========================================*/
472
474
475/*! \note arm_2d_op_cp_cl_key_t inherits from arm_2d_op_src_t explicitly
476 */
477typedef struct arm_2d_op_cp_cl_key_t {
478 inherit(arm_2d_op_core_t); //!< base
479 struct {
480 const arm_2d_tile_t *ptTile; //!< target tile
481 const arm_2d_region_t *ptRegion; //!< target region
482 } Target;
483 struct {
484 const arm_2d_tile_t *ptTile; //!< source tile
485 }Source;
486 uint32_t wMode; //!< copy mode
487 union {
488 uint8_t chColour; //!< 8bit colour
489 uint16_t hwColour; //!< 16bit colour
490 uint32_t wColour; //!< 32bit colour
491 };
493
494/*============================ GLOBAL VARIABLES ==============================*/
495/*============================ PROTOTYPES ====================================*/
496
497
498/*----------------------------------------------------------------------------*
499 * Tile Operations *
500 *----------------------------------------------------------------------------*/
501
502/*!
503 * \brief check whether a given tile is root or not
504 * \param[in] ptTile the target tile
505 * \retval true the target tile is a root tile
506 * \retval false the target tile is a child tile
507 */
508ARM_NONNULL(1)
509__STATIC_INLINE bool arm_2d_is_root_tile(const arm_2d_tile_t *ptTile)
510{
511 return ptTile->tInfo.bIsRoot;
512}
513
514
515/*!
516 * \brief intersect two regions and find the overlapped region
517 * \param[in] ptRegionIn0 the input region 0
518 * \param[in] ptRegionIn1 the input region 1
519 * \param[out] ptRegionOut the overlapped region
520 * \retval false the two regions do not overlap
521 * \retval true the two regions overlap
522 *
523 * \code
524
525 HOW IT WORKS:
526
527 Input Region 0
528 +------------------------------------------------------+
529 | |
530 | |
531 | |
532 | +------------------------------+---------+
533 | | |/////////|
534 | | Output Region |/////////|
535 | | |/////////|
536 +-----------------------+------------------------------+/////////|
537 |////////////////////////////////////////|
538 |////////////////////////////////////////|
539 +----------------------------------------+
540 Input Region 1
541 * \endcode
542 */
543extern
544ARM_NONNULL(1,2)
546 const arm_2d_region_t *ptRegionIn1,
547 arm_2d_region_t *ptRegionOut);
548
549/*!
550 * \brief check whether a point is inside a given region
551 * \param[in] ptRegion the target region
552 * \param[in] ptPoint the target point
553 * \retval true the point is inside the target region
554 * \retval false the point is outside the target region
555 */
556extern
557ARM_NONNULL(1,2)
559 const arm_2d_location_t *ptPoint);
560
561/*!
562 * \brief get the root tile and the valid region for a given tile
563 * \param[in] ptTile the target tile
564 * \param[out] ptValidRegion the valid region inside the root tile
565 * \param[out] ptOffset the offsite of the root tile as if the root tile is inside the target tile
566 * \return const arm_2d_tile_t* the root tile
567 *
568 * \code
569 HOW IT WORKS:
570
571 Root Tile (Output Tile)
572 +------------------------------------------------------------------------+
573 | ... ... |
574 | |
575 | Child Tile of Parent Tile |
576 | +------------------------------------+ |
577 | | Child Tile of Parent Tile | |
578 | | +------------------------------+---------+ |
579 | | | |/////////| |
580 | | | Valid Region |/////////| |
581 | | | |/////////| |
582 | +-----+------------------------------+/////////| |
583 | |////////////////////////////////////////| |
584 | |////////////////////////////////////////| |
585 | +----------------------------------------+ |
586 | |
587 +------------------------------------------------------------------------+
588 \endcode
589 */
590extern
591ARM_NONNULL(1,2)
593 arm_2d_region_t *ptValidRegion,
594 arm_2d_location_t *ptOffset);
595
596/*!
597 * \brief generate a child tile from the target tile with a given region
598 * \param[in] ptTargetTile the target tile
599 * \param[in] ptRegion the target region
600 * \param[out] ptOutput the child tile
601 * \param[in] bClipRegion whether clip the region for the child tile
602 * \note We highly recommend that please DO NOT clip the child tile if
603 * you don't know what you are doing.
604 * \retval non-NULL the child tile
605 * \retval NULL the given region is outside the target tile
606 *
607 * \note If you want to use the child tile generated by
608 * arm_2d_tile_generate_child() as a source tile / mask, please set the
609 * bDerivedResource to true manually, otherwise all mirror related
610 * operation will NOT work correctly.
611 *
612 * \code
613 HOW IT WORKS:
614
615 Parent Tile (NOT necessarily a ROOT tile )
616 +------------------------------------------------------+
617 | |
618 | |
619 | Target Region |
620 | +------------------------------+---------+
621 | | |/////////|
622 | | New Child Tile (Output) |/////////|
623 | | |/////////|
624 +-----------------------+------------------------------+/////////|
625 |////////////////////////////////////////|
626 |////////////////////////////////////////|
627 +----------------------------------------+
628 \endcode
629 */
630extern
631ARM_NONNULL(1,2,3)
633 const arm_2d_tile_t *ptTargetTile,
634 const arm_2d_region_t *ptRegion,
635 arm_2d_tile_t *ptOutput,
636 bool bClipRegion);
637
638/*!
639 * \brief compare the widths of two tiles
640 * \param[in] ptTarget the target tile
641 * \param[in] ptReference the reference tile
642 * \return arm_2d_cmp_t the comparision result
643 */
644extern
645ARM_NONNULL(1,2)
647 const arm_2d_tile_t *ptReference);
648/*!
649 * \brief compare the heights of two tiles
650 * \param[in] ptTarget the target tile
651 * \param[in] ptReference the reference tile
652 * \return arm_2d_cmp_t the comparision result
653 */
654extern
655ARM_NONNULL(1,2)
657 const arm_2d_tile_t *ptReference);
658
659/*!
660 * \brief compare the shape (both widths and heights) of two tiles
661 * \param[in] ptTarget the target tile
662 * \param[in] ptReference the reference tile
663 * \return arm_2d_cmp_t the comparision result
664 */
665extern
666ARM_NONNULL(1,2)
668 const arm_2d_tile_t *ptReference);
669
670/*!
671 * \brief get the absolute location of a given tile
672 * \param[in] ptTile the target tile
673 * \param[out] ptLocation the absolute location in the root tile
674 * \return const arm_2d_tile_t * the root tile
675 */
676extern
677ARM_NONNULL(1,2)
679 const arm_2d_tile_t *ptTile,
680 arm_2d_location_t *ptLocation);
681
682/*!
683 * \brief calculate the region differences between two tiles
684 * \param[in] ptTarget the target tile
685 * \param[in] ptReference the reference tile
686 * \param[out] ptBuffer the difference stored in a region
687 * \return arm_2d_region_t * the ptBuffer passed to this function
688 */
689extern
690ARM_NONNULL(1,2,3)
692 const arm_2d_tile_t *ptReference,
693 arm_2d_region_t *ptBuffer);
694/*----------------------------------------------------------------------------*
695 * Copy/Fill tile to destination with Mirroring *
696 *----------------------------------------------------------------------------*/
697
698/*!
699 * \brief tile copy modes
700 */
702 ARM_2D_CP_MODE_COPY = 0,
703 ARM_2D_CP_MODE_FILL = _BV(0),
704 ARM_2D_CP_MODE_Y_MIRROR = _BV(2),
705 ARM_2D_CP_MODE_X_MIRROR = _BV(3),
706 ARM_2D_CP_MODE_XY_MIRROR = ARM_2D_CP_MODE_X_MIRROR |
707 ARM_2D_CP_MODE_Y_MIRROR,
708};
709
710/*!
711 * \brief tile copy with specified mode
712 * \param[in] ptOP the control block, NULL means using the default control block
713 * \param[in] ptSource the source tile
714 * \param[in] ptTarget the target tile
715 * \param[in] ptRegion the target region, NULL means using the region of the
716 * target tile.
717 * \param[in] wMode the copy mode
718 * \return arm_fsm_rt_t the operation result
719 */
720extern
721ARM_NONNULL(2,3)
723 const arm_2d_tile_t *ptSource,
724 const arm_2d_tile_t *ptTarget,
725 const arm_2d_region_t *ptRegion,
726 uint32_t wMode);
727
728/*!
729 * \brief tile copy with specified mode
730 * \param[in] ptOP the control block, NULL means using the default control block
731 * \param[in] ptSource the source tile
732 * \param[in] ptTarget the target tile
733 * \param[in] ptRegion the target region, NULL means using the region of the
734 * target tile.
735 * \param[in] wMode the copy mode
736 * \return arm_fsm_rt_t the operation result
737 */
738extern
739ARM_NONNULL(2,3)
741 const arm_2d_tile_t *ptSource,
742 const arm_2d_tile_t *ptTarget,
743 const arm_2d_region_t *ptRegion,
744 uint32_t wMode);
745
746/*!
747 * \brief tile copy with specified mode
748 * \param[in] ptOP the control block, NULL means using the default control block
749 * \param[in] ptSource the source tile
750 * \param[in] ptTarget the target tile
751 * \param[in] ptRegion the target region, NULL means using the region of the
752 * target tile.
753 * \param[in] wMode the copy mode
754 * \return arm_fsm_rt_t the operation result
755 */
756extern
757ARM_NONNULL(2,3)
759 const arm_2d_tile_t *ptSource,
760 const arm_2d_tile_t *ptTarget,
761 const arm_2d_region_t *ptRegion,
762 uint32_t wMode);
763
764/*----------------------------------------------------------------------------*
765 * Copy Only *
766 *----------------------------------------------------------------------------*/
767/*!
768 * \brief tile copy only
769 * \param[in] ptOP the control block, NULL means using the default control block
770 * \param[in] ptSource the source tile
771 * \param[in] ptTarget the target tile
772 * \param[in] ptRegion the target region, NULL means using the region of the
773 * target tile.
774 * \return arm_fsm_rt_t the operation result
775 */
776extern
777ARM_NONNULL(2,3)
779 const arm_2d_tile_t *ptSource,
780 const arm_2d_tile_t *ptTarget,
781 const arm_2d_region_t *ptRegion);
782
783/*!
784 * \brief tile copy only
785 * \param[in] ptOP the control block, NULL means using the default control block
786 * \param[in] ptSource the source tile
787 * \param[in] ptTarget the target tile
788 * \param[in] ptRegion the target region, NULL means using the region of the
789 * target tile.
790 * \return arm_fsm_rt_t the operation result
791 */
792extern
793ARM_NONNULL(2,3)
795 const arm_2d_tile_t *ptSource,
796 const arm_2d_tile_t *ptTarget,
797 const arm_2d_region_t *ptRegion);
798
799/*!
800 * \brief tile copy only
801 * \param[in] ptOP the control block, NULL means using the default control block
802 * \param[in] ptSource the source tile
803 * \param[in] ptTarget the target tile
804 * \param[in] ptRegion the target region, NULL means using the region of the
805 * target tile.
806 * \return arm_fsm_rt_t the operation result
807 */
808extern
809ARM_NONNULL(2,3)
811 const arm_2d_tile_t *ptSource,
812 const arm_2d_tile_t *ptTarget,
813 const arm_2d_region_t *ptRegion);
814
815/*----------------------------------------------------------------------------*
816 * Copy with X mirroring *
817 *----------------------------------------------------------------------------*/
818/*!
819 * \brief tile copy with x-mirroring
820 * \param[in] ptOP the control block, NULL means using the default control block
821 * \param[in] ptSource the source tile
822 * \param[in] ptTarget the target tile
823 * \param[in] ptRegion the target region, NULL means using the region of the
824 * target tile.
825 * \return arm_fsm_rt_t the operation result
826 */
827extern
828ARM_NONNULL(2,3)
830 arm_2d_op_cp_t *ptOP,
831 const arm_2d_tile_t *ptSource,
832 const arm_2d_tile_t *ptTarget,
833 const arm_2d_region_t *ptRegion);
834
835/*!
836 * \brief tile copy with x-mirroring
837 * \param[in] ptOP the control block, NULL means using the default control block
838 * \param[in] ptSource the source tile
839 * \param[in] ptTarget the target tile
840 * \param[in] ptRegion the target region, NULL means using the region of the
841 * target tile.
842 * \return arm_fsm_rt_t the operation result
843 */
844extern
845ARM_NONNULL(2,3)
847 arm_2d_op_cp_t *ptOP,
848 const arm_2d_tile_t *ptSource,
849 const arm_2d_tile_t *ptTarget,
850 const arm_2d_region_t *ptRegion);
851
852/*!
853 * \brief tile copy with x-mirroring
854 * \param[in] ptOP the control block, NULL means using the default control block
855 * \param[in] ptSource the source tile
856 * \param[in] ptTarget the target tile
857 * \param[in] ptRegion the target region, NULL means using the region of the
858 * target tile.
859 * \return arm_fsm_rt_t the operation result
860 */
861extern
862ARM_NONNULL(2,3)
864 arm_2d_op_cp_t *ptOP,
865 const arm_2d_tile_t *ptSource,
866 const arm_2d_tile_t *ptTarget,
867 const arm_2d_region_t *ptRegion);
868
869/*----------------------------------------------------------------------------*
870 * Copy with Y mirroring *
871 *----------------------------------------------------------------------------*/
872
873/*!
874 * \brief tile copy with y-mirroring
875 * \param[in] ptOP the control block, NULL means using the default control block
876 * \param[in] ptSource the source tile
877 * \param[in] ptTarget the target tile
878 * \param[in] ptRegion the target region, NULL means using the region of the
879 * target tile.
880 * \return arm_fsm_rt_t the operation result
881 */
882extern
883ARM_NONNULL(2,3)
885 arm_2d_op_cp_t *ptOP,
886 const arm_2d_tile_t *ptSource,
887 const arm_2d_tile_t *ptTarget,
888 const arm_2d_region_t *ptRegion);
889
890/*!
891 * \brief tile copy with y-mirroring
892 * \param[in] ptOP the control block, NULL means using the default control block
893 * \param[in] ptSource the source tile
894 * \param[in] ptTarget the target tile
895 * \param[in] ptRegion the target region, NULL means using the region of the
896 * target tile.
897 * \return arm_fsm_rt_t the operation result
898 */
899extern
900ARM_NONNULL(2,3)
902 arm_2d_op_cp_t *ptOP,
903 const arm_2d_tile_t *ptSource,
904 const arm_2d_tile_t *ptTarget,
905 const arm_2d_region_t *ptRegion);
906
907/*!
908 * \brief tile copy with y-mirroring
909 * \param[in] ptOP the control block, NULL means using the default control block
910 * \param[in] ptSource the source tile
911 * \param[in] ptTarget the target tile
912 * \param[in] ptRegion the target region, NULL means using the region of the
913 * target tile.
914 * \return arm_fsm_rt_t the operation result
915 */
916extern
917ARM_NONNULL(2,3)
919 arm_2d_op_cp_t *ptOP,
920 const arm_2d_tile_t *ptSource,
921 const arm_2d_tile_t *ptTarget,
922 const arm_2d_region_t *ptRegion);
923
924/*----------------------------------------------------------------------------*
925 * Copy with XY mirroring *
926 *----------------------------------------------------------------------------*/
927
928/*!
929 * \brief tile copy with xy-mirroring
930 * \param[in] ptOP the control block, NULL means using the default control block
931 * \param[in] ptSource the source tile
932 * \param[in] ptTarget the target tile
933 * \param[in] ptRegion the target region, NULL means using the region of the
934 * target tile.
935 * \return arm_fsm_rt_t the operation result
936 */
937extern
938ARM_NONNULL(2,3)
940 arm_2d_op_cp_t *ptOP,
941 const arm_2d_tile_t *ptSource,
942 const arm_2d_tile_t *ptTarget,
943 const arm_2d_region_t *ptRegion);
944
945/*!
946 * \brief tile copy with xy-mirroring
947 * \param[in] ptOP the control block, NULL means using the default control block
948 * \param[in] ptSource the source tile
949 * \param[in] ptTarget the target tile
950 * \param[in] ptRegion the target region, NULL means using the region of the
951 * target tile.
952 * \return arm_fsm_rt_t the operation result
953 */
954extern
955ARM_NONNULL(2,3)
957 arm_2d_op_cp_t *ptOP,
958 const arm_2d_tile_t *ptSource,
959 const arm_2d_tile_t *ptTarget,
960 const arm_2d_region_t *ptRegion);
961
962/*!
963 * \brief tile copy with xy-mirroring
964 * \param[in] ptOP the control block, NULL means using the default control block
965 * \param[in] ptSource the source tile
966 * \param[in] ptTarget the target tile
967 * \param[in] ptRegion the target region, NULL means using the region of the
968 * target tile.
969 * \return arm_fsm_rt_t the operation result
970 */
971extern
972ARM_NONNULL(2,3)
974 arm_2d_op_cp_t *ptOP,
975 const arm_2d_tile_t *ptSource,
976 const arm_2d_tile_t *ptTarget,
977 const arm_2d_region_t *ptRegion);
978
979/*----------------------------------------------------------------------------*
980 * Fill Only *
981 *----------------------------------------------------------------------------*/
982
983/*!
984 * \brief Tiling only
985 * \param[in] ptOP the control block, NULL means using the default control block
986 * \param[in] ptSource the source tile
987 * \param[in] ptTarget the target tile
988 * \param[in] ptRegion the target region, NULL means using the region of the
989 * target tile.
990 * \return arm_fsm_rt_t the operation result
991 */
992extern
993ARM_NONNULL(2,3)
995 const arm_2d_tile_t *ptSource,
996 const arm_2d_tile_t *ptTarget,
997 const arm_2d_region_t *ptRegion);
998
999/*!
1000 * \brief Tiling only
1001 * \param[in] ptOP the control block, NULL means using the default control block
1002 * \param[in] ptSource the source tile
1003 * \param[in] ptTarget the target tile
1004 * \param[in] ptRegion the target region, NULL means using the region of the
1005 * target tile.
1006 * \return arm_fsm_rt_t the operation result
1007 */
1008extern
1009ARM_NONNULL(2,3)
1011 const arm_2d_tile_t *ptSource,
1012 const arm_2d_tile_t *ptTarget,
1013 const arm_2d_region_t *ptRegion);
1014
1015/*!
1016 * \brief Tiling only
1017 * \param[in] ptOP the control block, NULL means using the default control block
1018 * \param[in] ptSource the source tile
1019 * \param[in] ptTarget the target tile
1020 * \param[in] ptRegion the target region, NULL means using the region of the
1021 * target tile.
1022 * \return arm_fsm_rt_t the operation result
1023 */
1024extern
1025ARM_NONNULL(2,3)
1027 const arm_2d_tile_t *ptSource,
1028 const arm_2d_tile_t *ptTarget,
1029 const arm_2d_region_t *ptRegion);
1030
1031/*----------------------------------------------------------------------------*
1032 * Fill with X mirroring *
1033 *----------------------------------------------------------------------------*/
1034
1035/*!
1036 * \brief Tiling with x-mirroring
1037 * \param[in] ptOP the control block, NULL means using the default control block
1038 * \param[in] ptSource the source tile
1039 * \param[in] ptTarget the target tile
1040 * \param[in] ptRegion the target region, NULL means using the region of the
1041 * target tile.
1042 * \return arm_fsm_rt_t the operation result
1043 */
1044extern
1045ARM_NONNULL(2,3)
1047 arm_2d_op_cp_t *ptOP,
1048 const arm_2d_tile_t *ptSource,
1049 const arm_2d_tile_t *ptTarget,
1050 const arm_2d_region_t *ptRegion);
1051
1052/*!
1053 * \brief Tiling with x-mirroring
1054 * \param[in] ptOP the control block, NULL means using the default control block
1055 * \param[in] ptSource the source tile
1056 * \param[in] ptTarget the target tile
1057 * \param[in] ptRegion the target region, NULL means using the region of the
1058 * target tile.
1059 * \return arm_fsm_rt_t the operation result
1060 */
1061extern
1062ARM_NONNULL(2,3)
1064 arm_2d_op_cp_t *ptOP,
1065 const arm_2d_tile_t *ptSource,
1066 const arm_2d_tile_t *ptTarget,
1067 const arm_2d_region_t *ptRegion);
1068
1069/*!
1070 * \brief Tiling with x-mirroring
1071 * \param[in] ptOP the control block, NULL means using the default control block
1072 * \param[in] ptSource the source tile
1073 * \param[in] ptTarget the target tile
1074 * \param[in] ptRegion the target region, NULL means using the region of the
1075 * target tile.
1076 * \return arm_fsm_rt_t the operation result
1077 */
1078extern
1079ARM_NONNULL(2,3)
1081 arm_2d_op_cp_t *ptOP,
1082 const arm_2d_tile_t *ptSource,
1083 const arm_2d_tile_t *ptTarget,
1084 const arm_2d_region_t *ptRegion);
1085
1086/*----------------------------------------------------------------------------*
1087 * Fill with Y mirroring *
1088 *----------------------------------------------------------------------------*/
1089
1090/*!
1091 * \brief Tiling with y-mirroring
1092 * \param[in] ptOP the control block, NULL means using the default control block
1093 * \param[in] ptSource the source tile
1094 * \param[in] ptTarget the target tile
1095 * \param[in] ptRegion the target region, NULL means using the region of the
1096 * target tile.
1097 * \return arm_fsm_rt_t the operation result
1098 */
1099extern
1100ARM_NONNULL(2,3)
1102 arm_2d_op_cp_t *ptOP,
1103 const arm_2d_tile_t *ptSource,
1104 const arm_2d_tile_t *ptTarget,
1105 const arm_2d_region_t *ptRegion);
1106
1107/*!
1108 * \brief Tiling with y-mirroring
1109 * \param[in] ptOP the control block, NULL means using the default control block
1110 * \param[in] ptSource the source tile
1111 * \param[in] ptTarget the target tile
1112 * \param[in] ptRegion the target region, NULL means using the region of the
1113 * target tile.
1114 * \return arm_fsm_rt_t the operation result
1115 */
1116extern
1117ARM_NONNULL(2,3)
1119 arm_2d_op_cp_t *ptOP,
1120 const arm_2d_tile_t *ptSource,
1121 const arm_2d_tile_t *ptTarget,
1122 const arm_2d_region_t *ptRegion);
1123
1124/*!
1125 * \brief Tiling with y-mirroring
1126 * \param[in] ptOP the control block, NULL means using the default control block
1127 * \param[in] ptSource the source tile
1128 * \param[in] ptTarget the target tile
1129 * \param[in] ptRegion the target region, NULL means using the region of the
1130 * target tile.
1131 * \return arm_fsm_rt_t the operation result
1132 */
1133extern
1134ARM_NONNULL(2,3)
1136 arm_2d_op_cp_t *ptOP,
1137 const arm_2d_tile_t *ptSource,
1138 const arm_2d_tile_t *ptTarget,
1139 const arm_2d_region_t *ptRegion);
1140
1141/*----------------------------------------------------------------------------*
1142 * Fill with XY mirroring *
1143 *----------------------------------------------------------------------------*/
1144
1145/*!
1146 * \brief Tiling with xy-mirroring
1147 * \param[in] ptOP the control block, NULL means using the default control block
1148 * \param[in] ptSource the source tile
1149 * \param[in] ptTarget the target tile
1150 * \param[in] ptRegion the target region, NULL means using the region of the
1151 * target tile.
1152 * \return arm_fsm_rt_t the operation result
1153 */
1154extern
1155ARM_NONNULL(2,3)
1157 arm_2d_op_cp_t *ptOP,
1158 const arm_2d_tile_t *ptSource,
1159 const arm_2d_tile_t *ptTarget,
1160 const arm_2d_region_t *ptRegion);
1161
1162/*!
1163 * \brief Tiling with xy-mirroring
1164 * \param[in] ptOP the control block, NULL means using the default control block
1165 * \param[in] ptSource the source tile
1166 * \param[in] ptTarget the target tile
1167 * \param[in] ptRegion the target region, NULL means using the region of the
1168 * target tile.
1169 * \return arm_fsm_rt_t the operation result
1170 */
1171extern
1172ARM_NONNULL(2,3)
1174 arm_2d_op_cp_t *ptOP,
1175 const arm_2d_tile_t *ptSource,
1176 const arm_2d_tile_t *ptTarget,
1177 const arm_2d_region_t *ptRegion);
1178
1179/*!
1180 * \brief Tiling with xy-mirroring
1181 * \param[in] ptOP the control block, NULL means using the default control block
1182 * \param[in] ptSource the source tile
1183 * \param[in] ptTarget the target tile
1184 * \param[in] ptRegion the target region, NULL means using the region of the
1185 * target tile.
1186 * \return arm_fsm_rt_t the operation result
1187 */
1188extern
1189ARM_NONNULL(2,3)
1191 arm_2d_op_cp_t *ptOP,
1192 const arm_2d_tile_t *ptSource,
1193 const arm_2d_tile_t *ptTarget,
1194 const arm_2d_region_t *ptRegion);
1195
1196/*----------------------------------------------------------------------------*
1197 * Copy/Fill tile to destination with colour-keying and mirroring *
1198 *----------------------------------------------------------------------------*/
1199
1200/*!
1201 * \brief tile copy with colour-keying and specified mode
1202 * \param[in] ptOP the control block, NULL means using the default control block
1203 * \param[in] ptSource the source tile
1204 * \param[in] ptTarget the target tile
1205 * \param[in] ptRegion the target region, NULL means using the region of the
1206 * target tile.
1207 * \param[in] chMaskColour the key colour in any 8bit colour format
1208 * \param[in] wMode the copy mode
1209 * \return arm_fsm_rt_t the operation result
1210 */
1211extern
1212ARM_NONNULL(2,3)
1215 const arm_2d_tile_t *ptSource,
1216 const arm_2d_tile_t *ptTarget,
1217 const arm_2d_region_t *ptRegion,
1218 uint8_t chMaskColour,
1219 uint32_t wMode);
1220
1221/*!
1222 * \brief tile copy with colour-keying and specified mode
1223 * \param[in] ptOP the control block, NULL means using the default control block
1224 * \param[in] ptSource the source tile
1225 * \param[in] ptTarget the target tile
1226 * \param[in] ptRegion the target region, NULL means using the region of the
1227 * target tile.
1228 * \param[in] hwMaskColour the key colour in any 16bit colour format
1229 * \param[in] wMode the copy mode
1230 * \return arm_fsm_rt_t the operation result
1231 *
1232 * \note alpha channel is not handled, i.e. rgba5551
1233 */
1234extern
1235ARM_NONNULL(2,3)
1238 const arm_2d_tile_t *ptSource,
1239 const arm_2d_tile_t *ptTarget,
1240 const arm_2d_region_t *ptRegion,
1241 uint16_t hwMaskColour,
1242 uint32_t wMode);
1243
1244
1245/*!
1246 * \brief tile copy with colour-keying and specified mode
1247 * \param[in] ptOP the control block, NULL means using the default control block
1248 * \param[in] ptSource the source tile
1249 * \param[in] ptTarget the target tile
1250 * \param[in] ptRegion the target region, NULL means using the region of the
1251 * target tile.
1252 * \param[in] wMaskColour the key colour in any 32bit colour format
1253 * \param[in] wMode the copy mode
1254 * \return arm_fsm_rt_t the operation result
1255 *
1256 * \note alpha channel is not handled
1257 */
1258extern
1259ARM_NONNULL(2,3)
1262 const arm_2d_tile_t *ptSource,
1263 const arm_2d_tile_t *ptTarget,
1264 const arm_2d_region_t *ptRegion,
1265 uint32_t wMaskColour,
1266 uint32_t wMode);
1267
1268/*! @} */
1269
1270#ifdef __cplusplus
1271}
1272#endif
1273
1274#endif