Blame include/freerdp/codec/region.h

Packit 1fb8d4
/**
Packit 1fb8d4
 * Copyright © 2014 Thincast Technologies GmbH
Packit 1fb8d4
 * Copyright © 2014 Hardening <contact@hardening-consulting.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Permission to use, copy, modify, distribute, and sell this software and
Packit 1fb8d4
 * its documentation for any purpose is hereby granted without fee, provided
Packit 1fb8d4
 * that the above copyright notice appear in all copies and that both that
Packit 1fb8d4
 * copyright notice and this permission notice appear in supporting
Packit 1fb8d4
 * documentation, and that the name of the copyright holders not be used in
Packit 1fb8d4
 * advertising or publicity pertaining to distribution of the software
Packit 1fb8d4
 * without specific, written prior permission.  The copyright holders make
Packit 1fb8d4
 * no representations about the suitability of this software for any
Packit 1fb8d4
 * purpose.  It is provided "as is" without express or implied warranty.
Packit 1fb8d4
 *
Packit 1fb8d4
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
Packit 1fb8d4
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
Packit 1fb8d4
 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
Packit 1fb8d4
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
Packit 1fb8d4
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
Packit 1fb8d4
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
Packit 1fb8d4
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef FREERDP_CODEC_REGION_H
Packit 1fb8d4
#define FREERDP_CODEC_REGION_H
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/api.h>
Packit 1fb8d4
#include <freerdp/types.h>
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
extern "C" {
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
struct _REGION16_DATA;
Packit 1fb8d4
typedef struct _REGION16_DATA REGION16_DATA;
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * @brief
Packit 1fb8d4
 */
Packit 1fb8d4
struct _REGION16
Packit 1fb8d4
{
Packit 1fb8d4
	RECTANGLE_16 extents;
Packit 1fb8d4
	REGION16_DATA* data;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _REGION16 REGION16;
Packit 1fb8d4
Packit 1fb8d4
/** computes if two rectangles are equal
Packit 1fb8d4
 * @param r1 first rectangle
Packit 1fb8d4
 * @param r2 second rectangle
Packit 1fb8d4
 * @return if the two rectangles are equal
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL rectangles_equal(const RECTANGLE_16* r1,
Packit 1fb8d4
                                  const RECTANGLE_16* r2);
Packit 1fb8d4
Packit 1fb8d4
/** computes if two rectangles intersect
Packit 1fb8d4
 * @param r1 first rectangle
Packit 1fb8d4
 * @param r2 second rectangle
Packit 1fb8d4
 * @return if the two rectangles intersect
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL rectangles_intersects(const RECTANGLE_16* r1,
Packit 1fb8d4
                                       const RECTANGLE_16* r2);
Packit 1fb8d4
Packit 1fb8d4
/** computes the intersection of two rectangles
Packit 1fb8d4
 * @param r1 first rectangle
Packit 1fb8d4
 * @param r2 second rectangle
Packit 1fb8d4
 * @param dst resulting intersection
Packit 1fb8d4
 * @return if the two rectangles intersect
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL rectangles_intersection(const RECTANGLE_16* r1,
Packit 1fb8d4
        const RECTANGLE_16* r2, RECTANGLE_16* dst);
Packit 1fb8d4
Packit 1fb8d4
/** initialize a region16
Packit 1fb8d4
 * @param region the region to initialise
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API void region16_init(REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
/** @return the number of rectangles of this region16 */
Packit 1fb8d4
FREERDP_API int region16_n_rects(const REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
/** returns a pointer to rectangles and the number of rectangles in this region.
Packit 1fb8d4
 * nbRects can be set to NULL if not interested in the number of rectangles.
Packit 1fb8d4
 * @param region the input region
Packit 1fb8d4
 * @param nbRects if non-NULL returns the number of rectangles
Packit 1fb8d4
 * @return a pointer on the rectangles
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API const RECTANGLE_16* region16_rects(const REGION16* region,
Packit 1fb8d4
        UINT32* nbRects);
Packit 1fb8d4
Packit 1fb8d4
/** @return the extents rectangle of this region */
Packit 1fb8d4
FREERDP_API const RECTANGLE_16* region16_extents(const REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
/** returns if the rectangle is empty
Packit 1fb8d4
 * @param rect
Packit 1fb8d4
 * @return if the rectangle is empty
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL rectangle_is_empty(const RECTANGLE_16* rect);
Packit 1fb8d4
Packit 1fb8d4
/** returns if the region is empty
Packit 1fb8d4
 * @param region
Packit 1fb8d4
 * @return if the region is empty
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL region16_is_empty(const REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
/** clears the region, the region is resetted to a (0,0,0,0) region
Packit 1fb8d4
 * @param region
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API void region16_clear(REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
/** dumps the region on stderr
Packit 1fb8d4
 * @param region the region to dump
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API void region16_print(const REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
/** copies the region to another region
Packit 1fb8d4
 * @param dst destination region
Packit 1fb8d4
 * @param src source region
Packit 1fb8d4
 * @return if the operation was successful (false meaning out-of-memory)
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL region16_copy(REGION16* dst, const REGION16* src);
Packit 1fb8d4
Packit 1fb8d4
/** adds a rectangle in src and stores the resulting region in dst
Packit 1fb8d4
 * @param dst destination region
Packit 1fb8d4
 * @param src source region
Packit 1fb8d4
 * @param rect the rectangle to add
Packit 1fb8d4
 * @return if the operation was successful (false meaning out-of-memory)
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL region16_union_rect(REGION16* dst, const REGION16* src,
Packit 1fb8d4
                                     const RECTANGLE_16* rect);
Packit 1fb8d4
Packit 1fb8d4
/** returns if a rectangle intersects the region
Packit 1fb8d4
 * @param src the region
Packit 1fb8d4
 * @param arg2 the rectangle
Packit 1fb8d4
 * @return if region and rectangle intersect
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL region16_intersects_rect(const REGION16* src,
Packit 1fb8d4
        const RECTANGLE_16* arg2);
Packit 1fb8d4
Packit 1fb8d4
/** computes the intersection between a region and a rectangle
Packit 1fb8d4
 * @param dst destination region
Packit 1fb8d4
 * @param src the source region
Packit 1fb8d4
 * @param arg2 the rectangle that intersects
Packit 1fb8d4
 * @return if the operation was successful (false meaning out-of-memory)
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API BOOL region16_intersect_rect(REGION16* dst, const REGION16* src,
Packit 1fb8d4
        const RECTANGLE_16* arg2);
Packit 1fb8d4
Packit 1fb8d4
/** release internal data associated with this region
Packit 1fb8d4
 * @param region the region to release
Packit 1fb8d4
 */
Packit 1fb8d4
FREERDP_API void region16_uninit(REGION16* region);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif /* FREERDP_CODEC_REGION_H */