FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
gfx_view.c
Go to the documentation of this file.
1
/* VIEW statement */
2
3
#include "
fb_gfx.h
"
4
5
6
/*:::::*/
7
FBCALL
void
fb_GfxView
(
int
x1,
int
y1,
int
x2,
int
y2,
unsigned
int
fill_color,
unsigned
int
border_color,
int
flags)
8
{
9
FB_GFXCTX
*
context
=
fb_hGetContext
();
10
unsigned
int
old_bg_color;
11
12
if
(!
__fb_gfx
)
13
return
;
14
15
fb_hPrepareTarget
(context,
NULL
);
16
fb_hSetPixelTransfer
(context, border_color);
17
18
fb_hFixCoordsOrder
(&x1, &y1, &x2, &y2);
19
20
if
((x1 | y1 | x2 | y2) != 0xFFFF8000) {
21
22
context->
flags
|=
CTX_VIEWPORT_SET
;
23
24
if
(flags &
VIEW_SCREEN
)
25
context->
flags
|=
CTX_VIEW_SCREEN
;
26
else
27
context->
flags
&= ~
CTX_VIEW_SCREEN
;
28
29
if
(!(flags &
DEFAULT_COLOR_2
)) {
30
border_color =
fb_hFixColor
(context->
target_bpp
, border_color);
31
/* Temporarily set full screen area clipping to draw view border */
32
context->
view_x
= 0;
33
context->
view_y
= 0;
34
context->
view_w
=
__fb_gfx
->
w
;
35
context->
view_h
=
__fb_gfx
->
h
;
36
fb_hGfxBox
(x1 - 1, y1 - 1, x2 + 1, y2 + 1, border_color &
__fb_gfx
->
color_mask
,
FALSE
, 0xFFFF);
37
}
38
39
context->
view_x
=
MID
(0, x1,
__fb_gfx
->
w
);
40
context->
view_y
=
MID
(0, y1,
__fb_gfx
->
h
);
41
context->
view_w
=
MIN
(x2 - x1 + 1,
__fb_gfx
->
w
- x1);
42
context->
view_h
=
MIN
(y2 - y1 + 1,
__fb_gfx
->
h
- y1);
43
44
if
(!(flags &
DEFAULT_COLOR_1
)) {
45
old_bg_color = context->
bg_color
;
46
context->
bg_color
=
fb_hFixColor
(context->
target_bpp
, fill_color);
47
fb_GfxClear
(1);
48
context->
bg_color
= old_bg_color;
49
}
50
51
}
else
{
52
53
context->
flags
&= ~
CTX_VIEWPORT_SET
;
54
55
context->
view_x
= context->
view_y
= 0;
56
context->
view_w
=
__fb_gfx
->
w
;
57
context->
view_h
=
__fb_gfx
->
h
;
58
}
59
}
gfxlib2
gfx_view.c
Generated on Thu Jan 23 2014 19:40:06 for FreeBASIC by
1.8.4