4 //#include <aygshell.h>
9 /* TO DO: Detect whether we're running on an AXIM or an iPAQ at runtime,
10 and set accordingly. */
13 # define FB_ADR 0x14042000
15 # define FB_ADR 0xA0051000
20 #define SET 0xffffffff
28 fb
=(UINT16
*)VirtualAlloc((void*)0x0,LCD_X_RES
*LCD_Y_RES
*2, MEM_RESERVE
,PAGE_READWRITE
);
29 VirtualCopy((void*)fb
,(void *) (FB_ADR
/256),LCD_X_RES
*LCD_Y_RES
*2, PAGE_READWRITE
|PAGE_NOCACHE
|PAGE_PHYSICAL
);
37 Image
ReadBMP(char FileName
[30])
42 unsigned char red
,green
,blue
;
46 stream
=fopen(FileName
,"rb");
47 if(!stream
) return image
;
48 fread(buff
,26,1,stream
);
50 offset
=(unsigned char)buff
[13]*16777216+(unsigned char)buff
[12]*65536+(unsigned char)buff
[11]*256+(unsigned char)buff
[10];
51 x
=(unsigned char)buff
[21]*256*256*256+(unsigned char)buff
[20]*256*256+(unsigned char)buff
[19]*256+(unsigned char)buff
[18];
52 y
=(unsigned char)buff
[25]*256*256*256+(unsigned char)buff
[24]*256*256+(unsigned char)buff
[23]*256+(unsigned char)buff
[22];
57 p
=image
.p
=(UINT16
*)malloc(x
*y
*2);
58 if(!image
.p
) return(image
);
59 fseek(stream
,offset
,SEEK_SET
);
62 for(UINT32 zz
=0;zz
<y
;zz
++)
66 for(UINT32 yy
=0;yy
<x
;yy
++)
71 c
=(red
/8)*2048+(green
/4)*32+blue
/8;
85 // shows picture pointed to by p, with res (x by y), at (x_pos, y_pos)
86 void ShowImage(UINT16
*p
, int x
, int y
,int x_pos
,int y_pos
)
90 fb
+=y_pos
*LCD_X_RES
+x_pos
;
91 for(int yy
=0;yy
<y
;yy
++)
93 for(int xx
=0;xx
<x
;xx
++)
99 if(x
<LCD_X_RES
) fb
+=LCD_X_RES
-x
;