File: region.h

package info (click to toggle)
spice-gtk 0.42-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,792 kB
  • sloc: ansic: 57,963; python: 3,961; cpp: 902; makefile: 545; xml: 159; sh: 134
file content (73 lines) | stat: -rw-r--r-- 2,717 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
   Copyright (C) 2009 Red Hat, Inc.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#ifndef H_SPICE_COMMON_REGION
#define H_SPICE_COMMON_REGION

#include <stdint.h>
#include <spice/macros.h>

#include "draw.h"
#include "pixman_utils.h"

SPICE_BEGIN_DECLS

typedef pixman_region32_t QRegion;

/* the left region is not contained entirely within the right region */
#define REGION_TEST_LEFT_EXCLUSIVE (1 << 0)
/* the right region is not contained entirely within the left region */
#define REGION_TEST_RIGHT_EXCLUSIVE (1 << 1)
/* the regions overlap */
#define REGION_TEST_SHARED (1 << 2)
#define REGION_TEST_ALL \
    (REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED)

void region_init(QRegion *rgn);
void region_clear(QRegion *rgn);
void region_destroy(QRegion *rgn);
void region_clone(QRegion *dest, const QRegion *src);
SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects);
void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects);
void region_extents(const QRegion *rgn, SpiceRect *r);

int region_test(const QRegion *rgn, const QRegion *other_rgn, int query);
int region_is_valid(const QRegion *rgn);
int region_is_empty(const QRegion *rgn);
int region_is_equal(const QRegion *rgn1, const QRegion *rgn2);
int region_intersects(const QRegion *rgn1, const QRegion *rgn2);
int region_bounds_intersects(const QRegion *rgn1, const QRegion *rgn2);
int region_contains(const QRegion *rgn, const QRegion *other);
int region_contains_point(const QRegion *rgn, int32_t x, int32_t y);

void region_or(QRegion *rgn, const QRegion *other_rgn);
void region_and(QRegion *rgn, const QRegion *other_rgn);
void region_xor(QRegion *rgn, const QRegion *other_rgn);
void region_exclude(QRegion *rgn, const QRegion *other_rgn);

void region_add(QRegion *rgn, const SpiceRect *r);
void region_remove(QRegion *rgn, const SpiceRect *r);

void region_offset(QRegion *rgn, int32_t dx, int32_t dy);


void region_dump(const QRegion *rgn, const char *prefix);

SPICE_END_DECLS

#endif