summaryrefslogtreecommitdiffstats
path: root/rfb/rfbregion.h
blob: 53da667487f4dc5929e382be89cd903c4b125e7f (plain)
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
#ifndef SRAREGION_H
#define SRAREGION_H

/* -=- SRA - Simple Region Algorithm
 * A simple rectangular region implementation.
 * Copyright (c) 2001 James "Wez" Weatherall, Johannes E. Schindelin
 */

/* -=- sraRect */

typedef struct _rect {
	int x1;
	int y1;
	int x2;
	int y2;
} sraRect;

typedef struct sraRegion sraRegion;

/* -=- Region manipulation functions */

extern sraRegion *sraRgnCreate();
extern sraRegion *sraRgnCreateRect(int x1, int y1, int x2, int y2);
extern sraRegion *sraRgnCreateRgn(const sraRegion *src);

extern void sraRgnDestroy(sraRegion *rgn);
extern void sraRgnMakeEmpty(sraRegion *rgn);
extern rfbBool sraRgnAnd(sraRegion *dst, const sraRegion *src);
extern void sraRgnOr(sraRegion *dst, const sraRegion *src);
extern rfbBool sraRgnSubtract(sraRegion *dst, const sraRegion *src);

extern void sraRgnOffset(sraRegion *dst, int dx, int dy);

extern rfbBool sraRgnPopRect(sraRegion *region, sraRect *rect,
			  unsigned long flags);

extern unsigned long sraRgnCountRects(const sraRegion *rgn);
extern rfbBool sraRgnEmpty(const sraRegion *rgn);

extern sraRegion *sraRgnBBox(const sraRegion *src);

/* -=- rectangle iterator */

typedef struct sraRectangleIterator {
  rfbBool reverseX,reverseY;
  int ptrSize,ptrPos;
  struct sraSpan** sPtrs;
} sraRectangleIterator;

extern sraRectangleIterator *sraRgnGetIterator(sraRegion *s);
extern sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfbBool reverseY);
extern rfbBool sraRgnIteratorNext(sraRectangleIterator *i,sraRect *r);
extern void sraRgnReleaseIterator(sraRectangleIterator *i);

void sraRgnPrint(const sraRegion *s);

/* -=- Rectangle clipper (for speed) */

extern rfbBool sraClipRect(int *x, int *y, int *w, int *h,
			int cx, int cy, int cw, int ch);

extern rfbBool sraClipRect2(int *x, int *y, int *x2, int *y2,
			int cx, int cy, int cx2, int cy2);

#endif
OpenPOWER on IntegriCloud