FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
gfx_readxy.c
Go to the documentation of this file.
1
/* implementation of SCREEN function for graphics mode */
2
3
#include "
fb_gfx.h
"
4
5
6
/*:::::*/
7
unsigned
int
fb_GfxReadXY
(
int
col,
int
row,
int
colorflag )
8
{
9
FB_GFXCTX
*
context
=
fb_hGetContext
();
10
GFX_CHAR_CELL
*cell;
11
12
if
(
__fb_gfx
==
NULL
)
13
return
0;
14
15
if
( col < 1 || col >
__fb_gfx
->
text_w
16
|| row < 1 || row >
__fb_gfx
->
text_h
)
17
return
0;
18
19
cell =
20
__fb_gfx
->
con_pages
[ context->
work_page
]
21
+ (row - 1) *
__fb_gfx
->
text_w
22
+ col - 1;
23
if
( colorflag == 0 ) {
24
return
cell->
ch
;
25
}
26
27
if
(
__fb_gfx
->
depth
<= 4 ) {
28
return
cell->
fg
+ (cell->
bg
<< 4);
29
}
else
if
(
__fb_gfx
->
depth
<= 8 ) {
30
return
cell->
fg
+ (cell->
bg
<< 8);
31
}
else
if
(
__fb_gfx
->
depth
== 16 ) {
32
unsigned
c;
33
if
( colorflag == 2 )
34
c = cell->
bg
;
35
else
36
c = cell->
fg
;
37
return
(((c & 0x001F) << 3) | ((c >> 2) & 0x7) |
38
((c & 0x07E0) << 5) | ((c >> 1) & 0x300) |
39
((c & 0xF800) << 8) | ((c << 3) & 0x70000) | 0xff000000);
40
}
else
{
41
if
( colorflag == 2 )
42
return
cell->
bg
;
43
return
cell->
fg
;
44
}
45
}
gfxlib2
gfx_readxy.c
Generated on Thu Jan 23 2014 19:40:06 for FreeBASIC by
1.8.4