OSDN Git Service

AI003:config.txt, words.txtを追加。
[chnosproject/CHNOSProject.git] / CHNOSProject / chnos / tolset_chn_000 / chnos_010 / chnos / draw16.c
1 \r
2 #include "core.h"\r
3 \r
4 void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
5 {\r
6         uint x, y;\r
7 \r
8 //if negative location\r
9         if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){\r
10                 return;\r
11         }\r
12 \r
13         c = RGB_32_To_16(c);\r
14         for(y = y0; y <= y1; y++){\r
15                 for(x = x0; x <= x1; x++){\r
16                         ((ushort *)vram)[y * xsize + x] = (ushort)c;\r
17                 }\r
18         }\r
19         return;\r
20 }\r
21 \r
22 void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
23 {\r
24         int i;\r
25         uchar d;\r
26         ushort *p;\r
27 \r
28 //if negative location\r
29         if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
30                 return;\r
31         }\r
32 \r
33         for (i = 0; i < 16; i++) {\r
34                 p = (ushort *)vram + (y + i) * xsize + x;\r
35                 d = font[i];\r
36                 if ((d & 0x80) != 0) { p[0] = (ushort)c; }\r
37                 if ((d & 0x40) != 0) { p[1] = (ushort)c; }\r
38                 if ((d & 0x20) != 0) { p[2] = (ushort)c; }\r
39                 if ((d & 0x10) != 0) { p[3] = (ushort)c; }\r
40                 if ((d & 0x08) != 0) { p[4] = (ushort)c; }\r
41                 if ((d & 0x04) != 0) { p[5] = (ushort)c; }\r
42                 if ((d & 0x02) != 0) { p[6] = (ushort)c; }\r
43                 if ((d & 0x01) != 0) { p[7] = (ushort)c; }\r
44         }\r
45         return;\r
46 }\r
47 \r
48 void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])\r
49 {\r
50 //if negative location\r
51         if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
52                 return;\r
53         }\r
54 \r
55         if(s == Null){\r
56                 return;\r
57         }\r
58 \r
59         c = RGB_32_To_16(c);\r
60         for(; *s != 0x00; s++){\r
61                 if(x > xsize - 8){\r
62                         break;\r
63                 }\r
64                 Drawing16_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);\r
65                 x += 8;\r
66         }\r
67         return;\r
68 }\r
69 \r
70 void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)\r
71 {\r
72 //if negative location\r
73         if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
74                 return;\r
75         }\r
76 \r
77         ((ushort *)vram)[y * xsize + x] = RGB_32_To_16(c);\r
78         return;\r
79 }\r