cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

region.h (5335B)


      1/**
      2 * Copyright © 2014 Thincast Technologies GmbH
      3 * Copyright © 2014 Hardening <contact@hardening-consulting.com>
      4 *
      5 * Permission to use, copy, modify, distribute, and sell this software and
      6 * its documentation for any purpose is hereby granted without fee, provided
      7 * that the above copyright notice appear in all copies and that both that
      8 * copyright notice and this permission notice appear in supporting
      9 * documentation, and that the name of the copyright holders not be used in
     10 * advertising or publicity pertaining to distribution of the software
     11 * without specific, written prior permission.  The copyright holders make
     12 * no representations about the suitability of this software for any
     13 * purpose.  It is provided "as is" without express or implied warranty.
     14 *
     15 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
     16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
     17 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
     18 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
     19 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
     20 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
     21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     22 */
     23
     24#ifndef FREERDP_CODEC_REGION_H
     25#define FREERDP_CODEC_REGION_H
     26
     27#include <freerdp/api.h>
     28#include <freerdp/types.h>
     29
     30#ifdef __cplusplus
     31extern "C"
     32{
     33#endif
     34
     35	struct _REGION16_DATA;
     36	typedef struct _REGION16_DATA REGION16_DATA;
     37
     38	/**
     39	 * @brief
     40	 */
     41	struct _REGION16
     42	{
     43		RECTANGLE_16 extents;
     44		REGION16_DATA* data;
     45	};
     46	typedef struct _REGION16 REGION16;
     47
     48	/** computes if two rectangles are equal
     49	 * @param r1 first rectangle
     50	 * @param r2 second rectangle
     51	 * @return if the two rectangles are equal
     52	 */
     53	FREERDP_API BOOL rectangles_equal(const RECTANGLE_16* r1, const RECTANGLE_16* r2);
     54
     55	/** computes if two rectangles intersect
     56	 * @param r1 first rectangle
     57	 * @param r2 second rectangle
     58	 * @return if the two rectangles intersect
     59	 */
     60	FREERDP_API BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2);
     61
     62	/** computes the intersection of two rectangles
     63	 * @param r1 first rectangle
     64	 * @param r2 second rectangle
     65	 * @param dst resulting intersection
     66	 * @return if the two rectangles intersect
     67	 */
     68	FREERDP_API BOOL rectangles_intersection(const RECTANGLE_16* r1, const RECTANGLE_16* r2,
     69	                                         RECTANGLE_16* dst);
     70
     71	/** initialize a region16
     72	 * @param region the region to initialise
     73	 */
     74	FREERDP_API void region16_init(REGION16* region);
     75
     76	/** @return the number of rectangles of this region16 */
     77	FREERDP_API int region16_n_rects(const REGION16* region);
     78
     79	/** returns a pointer to rectangles and the number of rectangles in this region.
     80	 * nbRects can be set to NULL if not interested in the number of rectangles.
     81	 * @param region the input region
     82	 * @param nbRects if non-NULL returns the number of rectangles
     83	 * @return a pointer on the rectangles
     84	 */
     85	FREERDP_API const RECTANGLE_16* region16_rects(const REGION16* region, UINT32* nbRects);
     86
     87	/** @return the extents rectangle of this region */
     88	FREERDP_API const RECTANGLE_16* region16_extents(const REGION16* region);
     89
     90	/** returns if the rectangle is empty
     91	 * @param rect
     92	 * @return if the rectangle is empty
     93	 */
     94	FREERDP_API BOOL rectangle_is_empty(const RECTANGLE_16* rect);
     95
     96	/** returns if the region is empty
     97	 * @param region
     98	 * @return if the region is empty
     99	 */
    100	FREERDP_API BOOL region16_is_empty(const REGION16* region);
    101
    102	/** clears the region, the region is resetted to a (0,0,0,0) region
    103	 * @param region
    104	 */
    105	FREERDP_API void region16_clear(REGION16* region);
    106
    107	/** dumps the region on stderr
    108	 * @param region the region to dump
    109	 */
    110	FREERDP_API void region16_print(const REGION16* region);
    111
    112	/** copies the region to another region
    113	 * @param dst destination region
    114	 * @param src source region
    115	 * @return if the operation was successful (false meaning out-of-memory)
    116	 */
    117	FREERDP_API BOOL region16_copy(REGION16* dst, const REGION16* src);
    118
    119	/** adds a rectangle in src and stores the resulting region in dst
    120	 * @param dst destination region
    121	 * @param src source region
    122	 * @param rect the rectangle to add
    123	 * @return if the operation was successful (false meaning out-of-memory)
    124	 */
    125	FREERDP_API BOOL region16_union_rect(REGION16* dst, const REGION16* src,
    126	                                     const RECTANGLE_16* rect);
    127
    128	/** returns if a rectangle intersects the region
    129	 * @param src the region
    130	 * @param arg2 the rectangle
    131	 * @return if region and rectangle intersect
    132	 */
    133	FREERDP_API BOOL region16_intersects_rect(const REGION16* src, const RECTANGLE_16* arg2);
    134
    135	/** computes the intersection between a region and a rectangle
    136	 * @param dst destination region
    137	 * @param src the source region
    138	 * @param arg2 the rectangle that intersects
    139	 * @return if the operation was successful (false meaning out-of-memory)
    140	 */
    141	FREERDP_API BOOL region16_intersect_rect(REGION16* dst, const REGION16* src,
    142	                                         const RECTANGLE_16* arg2);
    143
    144	/** release internal data associated with this region
    145	 * @param region the region to release
    146	 */
    147	FREERDP_API void region16_uninit(REGION16* region);
    148
    149#ifdef __cplusplus
    150}
    151#endif
    152
    153#endif /* FREERDP_CODEC_REGION_H */