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: 17. June 2022
25 * $Revision: V.1.0.2
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 {
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 * \code
608 HOW IT WORKS:
609
610 Parent Tile (NOT necessarily a ROOT tile )
611 +------------------------------------------------------+
612 | |
613 | |
614 | Target Region |
615 | +------------------------------+---------+
616 | | |/////////|
617 | | New Child Tile (Output) |/////////|
618 | | |/////////|
619 +-----------------------+------------------------------+/////////|
620 |////////////////////////////////////////|
621 |////////////////////////////////////////|
622 +----------------------------------------+
623 \endcode
624 */
625extern
626ARM_NONNULL(1,2,3)
628 const arm_2d_tile_t *ptTargetTile,
629 const arm_2d_region_t *ptRegion,
630 arm_2d_tile_t *ptOutput,
631 bool bClipRegion);
632
633/*!
634 * \brief compare the widths of two tiles
635 * \param[in] ptTarget the target tile
636 * \param[in] ptReference the reference tile
637 * \return arm_2d_cmp_t the comparision result
638 */
639extern
640ARM_NONNULL(1,2)
641arm_2d_cmp_t arm_2d_tile_width_compare( const arm_2d_tile_t *ptTarget,
642 const arm_2d_tile_t *ptReference);
643/*!
644 * \brief compare the heights of two tiles
645 * \param[in] ptTarget the target tile
646 * \param[in] ptReference the reference tile
647 * \return arm_2d_cmp_t the comparision result
648 */
649extern
650ARM_NONNULL(1,2)
651arm_2d_cmp_t arm_2d_tile_height_compare(const arm_2d_tile_t *ptTarget,
652 const arm_2d_tile_t *ptReference);
653
654/*!
655 * \brief compare the shape (both widths and heights) of two tiles
656 * \param[in] ptTarget the target tile
657 * \param[in] ptReference the reference tile
658 * \return arm_2d_cmp_t the comparision result
659 */
660extern
661ARM_NONNULL(1,2)
662arm_2d_cmp_t arm_2d_tile_shape_compare( const arm_2d_tile_t *ptTarget,
663 const arm_2d_tile_t *ptReference);
664
665/*!
666 * \brief get the absolute location of a given tile
667 * \param[in] ptTile the target tile
668 * \param[out] ptLocation the absolute location in the root tile
669 * \return const arm_2d_tile_t * the root tile
670 */
671extern
672ARM_NONNULL(1,2)
674 const arm_2d_tile_t *ptTile,
675 arm_2d_location_t *ptLocation);
676
677/*!
678 * \brief calculate the region differences between two tiles
679 * \param[in] ptTarget the target tile
680 * \param[in] ptReference the reference tile
681 * \param[out] ptBuffer the difference stored in a region
682 * \return arm_2d_region_t * the ptBuffer passed to this function
683 */
684extern
685ARM_NONNULL(1,2,3)
687 const arm_2d_tile_t *ptReference,
688 arm_2d_region_t *ptBuffer);
689/*----------------------------------------------------------------------------*
690 * Copy/Fill tile to destination with Mirroring *
691 *----------------------------------------------------------------------------*/
692
693/*!
694 * \brief tile copy modes
695 */
697 ARM_2D_CP_MODE_COPY = 0,
698 ARM_2D_CP_MODE_FILL = _BV(0),
699 ARM_2D_CP_MODE_Y_MIRROR = _BV(2),
700 ARM_2D_CP_MODE_X_MIRROR = _BV(3),
701 ARM_2D_CP_MODE_XY_MIRROR = ARM_2D_CP_MODE_X_MIRROR |
702 ARM_2D_CP_MODE_Y_MIRROR,
703};
704
705/*!
706 * \brief tile copy with specified mode
707 * \param[in] ptOP the control block, NULL means using the default control block
708 * \param[in] ptSource the source tile
709 * \param[in] ptTarget the target tile
710 * \param[in] ptRegion the target region, NULL means using the region of the
711 * target tile.
712 * \param[in] wMode the copy mode
713 * \return arm_fsm_rt_t the operation result
714 */
715extern
716ARM_NONNULL(2,3)
718 const arm_2d_tile_t *ptSource,
719 const arm_2d_tile_t *ptTarget,
720 const arm_2d_region_t *ptRegion,
721 uint32_t wMode);
722
723/*!
724 * \brief tile copy with specified mode
725 * \param[in] ptOP the control block, NULL means using the default control block
726 * \param[in] ptSource the source tile
727 * \param[in] ptTarget the target tile
728 * \param[in] ptRegion the target region, NULL means using the region of the
729 * target tile.
730 * \param[in] wMode the copy mode
731 * \return arm_fsm_rt_t the operation result
732 */
733extern
734ARM_NONNULL(2,3)
736 const arm_2d_tile_t *ptSource,
737 const arm_2d_tile_t *ptTarget,
738 const arm_2d_region_t *ptRegion,
739 uint32_t wMode);
740
741/*!
742 * \brief tile copy with specified mode
743 * \param[in] ptOP the control block, NULL means using the default control block
744 * \param[in] ptSource the source tile
745 * \param[in] ptTarget the target tile
746 * \param[in] ptRegion the target region, NULL means using the region of the
747 * target tile.
748 * \param[in] wMode the copy mode
749 * \return arm_fsm_rt_t the operation result
750 */
751extern
752ARM_NONNULL(2,3)
754 const arm_2d_tile_t *ptSource,
755 const arm_2d_tile_t *ptTarget,
756 const arm_2d_region_t *ptRegion,
757 uint32_t wMode);
758
759/*----------------------------------------------------------------------------*
760 * Copy Only *
761 *----------------------------------------------------------------------------*/
762/*!
763 * \brief tile copy only
764 * \param[in] ptOP the control block, NULL means using the default control block
765 * \param[in] ptSource the source tile
766 * \param[in] ptTarget the target tile
767 * \param[in] ptRegion the target region, NULL means using the region of the
768 * target tile.
769 * \return arm_fsm_rt_t the operation result
770 */
771extern
772ARM_NONNULL(2,3)
774 const arm_2d_tile_t *ptSource,
775 const arm_2d_tile_t *ptTarget,
776 const arm_2d_region_t *ptRegion);
777
778/*!
779 * \brief tile copy only
780 * \param[in] ptOP the control block, NULL means using the default control block
781 * \param[in] ptSource the source tile
782 * \param[in] ptTarget the target tile
783 * \param[in] ptRegion the target region, NULL means using the region of the
784 * target tile.
785 * \return arm_fsm_rt_t the operation result
786 */
787extern
788ARM_NONNULL(2,3)
790 const arm_2d_tile_t *ptSource,
791 const arm_2d_tile_t *ptTarget,
792 const arm_2d_region_t *ptRegion);
793
794/*!
795 * \brief tile copy only
796 * \param[in] ptOP the control block, NULL means using the default control block
797 * \param[in] ptSource the source tile
798 * \param[in] ptTarget the target tile
799 * \param[in] ptRegion the target region, NULL means using the region of the
800 * target tile.
801 * \return arm_fsm_rt_t the operation result
802 */
803extern
804ARM_NONNULL(2,3)
806 const arm_2d_tile_t *ptSource,
807 const arm_2d_tile_t *ptTarget,
808 const arm_2d_region_t *ptRegion);
809
810/*----------------------------------------------------------------------------*
811 * Copy with X mirroring *
812 *----------------------------------------------------------------------------*/
813/*!
814 * \brief tile copy with x-mirroring
815 * \param[in] ptOP the control block, NULL means using the default control block
816 * \param[in] ptSource the source tile
817 * \param[in] ptTarget the target tile
818 * \param[in] ptRegion the target region, NULL means using the region of the
819 * target tile.
820 * \return arm_fsm_rt_t the operation result
821 */
822extern
823ARM_NONNULL(2,3)
825 arm_2d_op_cp_t *ptOP,
826 const arm_2d_tile_t *ptSource,
827 const arm_2d_tile_t *ptTarget,
828 const arm_2d_region_t *ptRegion);
829
830/*!
831 * \brief tile copy with x-mirroring
832 * \param[in] ptOP the control block, NULL means using the default control block
833 * \param[in] ptSource the source tile
834 * \param[in] ptTarget the target tile
835 * \param[in] ptRegion the target region, NULL means using the region of the
836 * target tile.
837 * \return arm_fsm_rt_t the operation result
838 */
839extern
840ARM_NONNULL(2,3)
842 arm_2d_op_cp_t *ptOP,
843 const arm_2d_tile_t *ptSource,
844 const arm_2d_tile_t *ptTarget,
845 const arm_2d_region_t *ptRegion);
846
847/*!
848 * \brief tile copy with x-mirroring
849 * \param[in] ptOP the control block, NULL means using the default control block
850 * \param[in] ptSource the source tile
851 * \param[in] ptTarget the target tile
852 * \param[in] ptRegion the target region, NULL means using the region of the
853 * target tile.
854 * \return arm_fsm_rt_t the operation result
855 */
856extern
857ARM_NONNULL(2,3)
859 arm_2d_op_cp_t *ptOP,
860 const arm_2d_tile_t *ptSource,
861 const arm_2d_tile_t *ptTarget,
862 const arm_2d_region_t *ptRegion);
863
864/*----------------------------------------------------------------------------*
865 * Copy with Y mirroring *
866 *----------------------------------------------------------------------------*/
867
868/*!
869 * \brief tile copy with y-mirroring
870 * \param[in] ptOP the control block, NULL means using the default control block
871 * \param[in] ptSource the source tile
872 * \param[in] ptTarget the target tile
873 * \param[in] ptRegion the target region, NULL means using the region of the
874 * target tile.
875 * \return arm_fsm_rt_t the operation result
876 */
877extern
878ARM_NONNULL(2,3)
880 arm_2d_op_cp_t *ptOP,
881 const arm_2d_tile_t *ptSource,
882 const arm_2d_tile_t *ptTarget,
883 const arm_2d_region_t *ptRegion);
884
885/*!
886 * \brief tile copy with y-mirroring
887 * \param[in] ptOP the control block, NULL means using the default control block
888 * \param[in] ptSource the source tile
889 * \param[in] ptTarget the target tile
890 * \param[in] ptRegion the target region, NULL means using the region of the
891 * target tile.
892 * \return arm_fsm_rt_t the operation result
893 */
894extern
895ARM_NONNULL(2,3)
897 arm_2d_op_cp_t *ptOP,
898 const arm_2d_tile_t *ptSource,
899 const arm_2d_tile_t *ptTarget,
900 const arm_2d_region_t *ptRegion);
901
902/*!
903 * \brief tile copy with y-mirroring
904 * \param[in] ptOP the control block, NULL means using the default control block
905 * \param[in] ptSource the source tile
906 * \param[in] ptTarget the target tile
907 * \param[in] ptRegion the target region, NULL means using the region of the
908 * target tile.
909 * \return arm_fsm_rt_t the operation result
910 */
911extern
912ARM_NONNULL(2,3)
914 arm_2d_op_cp_t *ptOP,
915 const arm_2d_tile_t *ptSource,
916 const arm_2d_tile_t *ptTarget,
917 const arm_2d_region_t *ptRegion);
918
919/*----------------------------------------------------------------------------*
920 * Copy with XY mirroring *
921 *----------------------------------------------------------------------------*/
922
923/*!
924 * \brief tile copy with xy-mirroring
925 * \param[in] ptOP the control block, NULL means using the default control block
926 * \param[in] ptSource the source tile
927 * \param[in] ptTarget the target tile
928 * \param[in] ptRegion the target region, NULL means using the region of the
929 * target tile.
930 * \return arm_fsm_rt_t the operation result
931 */
932extern
933ARM_NONNULL(2,3)
935 arm_2d_op_cp_t *ptOP,
936 const arm_2d_tile_t *ptSource,
937 const arm_2d_tile_t *ptTarget,
938 const arm_2d_region_t *ptRegion);
939
940/*!
941 * \brief tile copy with xy-mirroring
942 * \param[in] ptOP the control block, NULL means using the default control block
943 * \param[in] ptSource the source tile
944 * \param[in] ptTarget the target tile
945 * \param[in] ptRegion the target region, NULL means using the region of the
946 * target tile.
947 * \return arm_fsm_rt_t the operation result
948 */
949extern
950ARM_NONNULL(2,3)
952 arm_2d_op_cp_t *ptOP,
953 const arm_2d_tile_t *ptSource,
954 const arm_2d_tile_t *ptTarget,
955 const arm_2d_region_t *ptRegion);
956
957/*!
958 * \brief tile copy with xy-mirroring
959 * \param[in] ptOP the control block, NULL means using the default control block
960 * \param[in] ptSource the source tile
961 * \param[in] ptTarget the target tile
962 * \param[in] ptRegion the target region, NULL means using the region of the
963 * target tile.
964 * \return arm_fsm_rt_t the operation result
965 */
966extern
967ARM_NONNULL(2,3)
969 arm_2d_op_cp_t *ptOP,
970 const arm_2d_tile_t *ptSource,
971 const arm_2d_tile_t *ptTarget,
972 const arm_2d_region_t *ptRegion);
973
974/*----------------------------------------------------------------------------*
975 * Fill Only *
976 *----------------------------------------------------------------------------*/
977
978/*!
979 * \brief Tiling only
980 * \param[in] ptOP the control block, NULL means using the default control block
981 * \param[in] ptSource the source tile
982 * \param[in] ptTarget the target tile
983 * \param[in] ptRegion the target region, NULL means using the region of the
984 * target tile.
985 * \return arm_fsm_rt_t the operation result
986 */
987extern
988ARM_NONNULL(2,3)
990 const arm_2d_tile_t *ptSource,
991 const arm_2d_tile_t *ptTarget,
992 const arm_2d_region_t *ptRegion);
993
994/*!
995 * \brief Tiling only
996 * \param[in] ptOP the control block, NULL means using the default control block
997 * \param[in] ptSource the source tile
998 * \param[in] ptTarget the target tile
999 * \param[in] ptRegion the target region, NULL means using the region of the
1000 * target tile.
1001 * \return arm_fsm_rt_t the operation result
1002 */
1003extern
1004ARM_NONNULL(2,3)
1006 const arm_2d_tile_t *ptSource,
1007 const arm_2d_tile_t *ptTarget,
1008 const arm_2d_region_t *ptRegion);
1009
1010/*!
1011 * \brief Tiling only
1012 * \param[in] ptOP the control block, NULL means using the default control block
1013 * \param[in] ptSource the source tile
1014 * \param[in] ptTarget the target tile
1015 * \param[in] ptRegion the target region, NULL means using the region of the
1016 * target tile.
1017 * \return arm_fsm_rt_t the operation result
1018 */
1019extern
1020ARM_NONNULL(2,3)
1022 const arm_2d_tile_t *ptSource,
1023 const arm_2d_tile_t *ptTarget,
1024 const arm_2d_region_t *ptRegion);
1025
1026/*----------------------------------------------------------------------------*
1027 * Fill with X mirroring *
1028 *----------------------------------------------------------------------------*/
1029
1030/*!
1031 * \brief Tiling with x-mirroring
1032 * \param[in] ptOP the control block, NULL means using the default control block
1033 * \param[in] ptSource the source tile
1034 * \param[in] ptTarget the target tile
1035 * \param[in] ptRegion the target region, NULL means using the region of the
1036 * target tile.
1037 * \return arm_fsm_rt_t the operation result
1038 */
1039extern
1040ARM_NONNULL(2,3)
1042 arm_2d_op_cp_t *ptOP,
1043 const arm_2d_tile_t *ptSource,
1044 const arm_2d_tile_t *ptTarget,
1045 const arm_2d_region_t *ptRegion);
1046
1047/*!
1048 * \brief Tiling with x-mirroring
1049 * \param[in] ptOP the control block, NULL means using the default control block
1050 * \param[in] ptSource the source tile
1051 * \param[in] ptTarget the target tile
1052 * \param[in] ptRegion the target region, NULL means using the region of the
1053 * target tile.
1054 * \return arm_fsm_rt_t the operation result
1055 */
1056extern
1057ARM_NONNULL(2,3)
1059 arm_2d_op_cp_t *ptOP,
1060 const arm_2d_tile_t *ptSource,
1061 const arm_2d_tile_t *ptTarget,
1062 const arm_2d_region_t *ptRegion);
1063
1064/*!
1065 * \brief Tiling with x-mirroring
1066 * \param[in] ptOP the control block, NULL means using the default control block
1067 * \param[in] ptSource the source tile
1068 * \param[in] ptTarget the target tile
1069 * \param[in] ptRegion the target region, NULL means using the region of the
1070 * target tile.
1071 * \return arm_fsm_rt_t the operation result
1072 */
1073extern
1074ARM_NONNULL(2,3)
1076 arm_2d_op_cp_t *ptOP,
1077 const arm_2d_tile_t *ptSource,
1078 const arm_2d_tile_t *ptTarget,
1079 const arm_2d_region_t *ptRegion);
1080
1081/*----------------------------------------------------------------------------*
1082 * Fill with Y mirroring *
1083 *----------------------------------------------------------------------------*/
1084
1085/*!
1086 * \brief Tiling with y-mirroring
1087 * \param[in] ptOP the control block, NULL means using the default control block
1088 * \param[in] ptSource the source tile
1089 * \param[in] ptTarget the target tile
1090 * \param[in] ptRegion the target region, NULL means using the region of the
1091 * target tile.
1092 * \return arm_fsm_rt_t the operation result
1093 */
1094extern
1095ARM_NONNULL(2,3)
1097 arm_2d_op_cp_t *ptOP,
1098 const arm_2d_tile_t *ptSource,
1099 const arm_2d_tile_t *ptTarget,
1100 const arm_2d_region_t *ptRegion);
1101
1102/*!
1103 * \brief Tiling with y-mirroring
1104 * \param[in] ptOP the control block, NULL means using the default control block
1105 * \param[in] ptSource the source tile
1106 * \param[in] ptTarget the target tile
1107 * \param[in] ptRegion the target region, NULL means using the region of the
1108 * target tile.
1109 * \return arm_fsm_rt_t the operation result
1110 */
1111extern
1112ARM_NONNULL(2,3)
1114 arm_2d_op_cp_t *ptOP,
1115 const arm_2d_tile_t *ptSource,
1116 const arm_2d_tile_t *ptTarget,
1117 const arm_2d_region_t *ptRegion);
1118
1119/*!
1120 * \brief Tiling with y-mirroring
1121 * \param[in] ptOP the control block, NULL means using the default control block
1122 * \param[in] ptSource the source tile
1123 * \param[in] ptTarget the target tile
1124 * \param[in] ptRegion the target region, NULL means using the region of the
1125 * target tile.
1126 * \return arm_fsm_rt_t the operation result
1127 */
1128extern
1129ARM_NONNULL(2,3)
1131 arm_2d_op_cp_t *ptOP,
1132 const arm_2d_tile_t *ptSource,
1133 const arm_2d_tile_t *ptTarget,
1134 const arm_2d_region_t *ptRegion);
1135
1136/*----------------------------------------------------------------------------*
1137 * Fill with XY mirroring *
1138 *----------------------------------------------------------------------------*/
1139
1140/*!
1141 * \brief Tiling with xy-mirroring
1142 * \param[in] ptOP the control block, NULL means using the default control block
1143 * \param[in] ptSource the source tile
1144 * \param[in] ptTarget the target tile
1145 * \param[in] ptRegion the target region, NULL means using the region of the
1146 * target tile.
1147 * \return arm_fsm_rt_t the operation result
1148 */
1149extern
1150ARM_NONNULL(2,3)
1152 arm_2d_op_cp_t *ptOP,
1153 const arm_2d_tile_t *ptSource,
1154 const arm_2d_tile_t *ptTarget,
1155 const arm_2d_region_t *ptRegion);
1156
1157/*!
1158 * \brief Tiling with xy-mirroring
1159 * \param[in] ptOP the control block, NULL means using the default control block
1160 * \param[in] ptSource the source tile
1161 * \param[in] ptTarget the target tile
1162 * \param[in] ptRegion the target region, NULL means using the region of the
1163 * target tile.
1164 * \return arm_fsm_rt_t the operation result
1165 */
1166extern
1167ARM_NONNULL(2,3)
1169 arm_2d_op_cp_t *ptOP,
1170 const arm_2d_tile_t *ptSource,
1171 const arm_2d_tile_t *ptTarget,
1172 const arm_2d_region_t *ptRegion);
1173
1174/*!
1175 * \brief Tiling with xy-mirroring
1176 * \param[in] ptOP the control block, NULL means using the default control block
1177 * \param[in] ptSource the source tile
1178 * \param[in] ptTarget the target tile
1179 * \param[in] ptRegion the target region, NULL means using the region of the
1180 * target tile.
1181 * \return arm_fsm_rt_t the operation result
1182 */
1183extern
1184ARM_NONNULL(2,3)
1186 arm_2d_op_cp_t *ptOP,
1187 const arm_2d_tile_t *ptSource,
1188 const arm_2d_tile_t *ptTarget,
1189 const arm_2d_region_t *ptRegion);
1190
1191/*----------------------------------------------------------------------------*
1192 * Copy/Fill tile to destination with colour-keying and mirroring *
1193 *----------------------------------------------------------------------------*/
1194
1195/*!
1196 * \brief tile copy with colour-keying and specified mode
1197 * \param[in] ptOP the control block, NULL means using the default control block
1198 * \param[in] ptSource the source tile
1199 * \param[in] ptTarget the target tile
1200 * \param[in] ptRegion the target region, NULL means using the region of the
1201 * target tile.
1202 * \param[in] chMaskColour the key colour in any 8bit colour format
1203 * \param[in] wMode the copy mode
1204 * \return arm_fsm_rt_t the operation result
1205 */
1206extern
1207ARM_NONNULL(2,3)
1210 const arm_2d_tile_t *ptSource,
1211 const arm_2d_tile_t *ptTarget,
1212 const arm_2d_region_t *ptRegion,
1213 uint8_t chMaskColour,
1214 uint32_t wMode);
1215
1216/*!
1217 * \brief tile copy with colour-keying and specified mode
1218 * \param[in] ptOP the control block, NULL means using the default control block
1219 * \param[in] ptSource the source tile
1220 * \param[in] ptTarget the target tile
1221 * \param[in] ptRegion the target region, NULL means using the region of the
1222 * target tile.
1223 * \param[in] hwMaskColour the key colour in any 16bit colour format
1224 * \param[in] wMode the copy mode
1225 * \return arm_fsm_rt_t the operation result
1226 *
1227 * \note alpha channel is not handled, i.e. rgba5551
1228 */
1229extern
1230ARM_NONNULL(2,3)
1233 const arm_2d_tile_t *ptSource,
1234 const arm_2d_tile_t *ptTarget,
1235 const arm_2d_region_t *ptRegion,
1236 uint16_t hwMaskColour,
1237 uint32_t wMode);
1238
1239
1240/*!
1241 * \brief tile copy with colour-keying and specified mode
1242 * \param[in] ptOP the control block, NULL means using the default control block
1243 * \param[in] ptSource the source tile
1244 * \param[in] ptTarget the target tile
1245 * \param[in] ptRegion the target region, NULL means using the region of the
1246 * target tile.
1247 * \param[in] wMaskColour the key colour in any 32bit colour format
1248 * \param[in] wMode the copy mode
1249 * \return arm_fsm_rt_t the operation result
1250 *
1251 * \note alpha channel is not handled
1252 */
1253extern
1254ARM_NONNULL(2,3)
1257 const arm_2d_tile_t *ptSource,
1258 const arm_2d_tile_t *ptTarget,
1259 const arm_2d_region_t *ptRegion,
1260 uint32_t wMaskColour,
1261 uint32_t wMode);
1262
1263/*! @} */
1264
1265#ifdef __cplusplus
1266}
1267#endif
1268
1269#endif