Rev 5678 | Rev 6698 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5678 | Rev 6672 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | 4 | ||
5 | #ifndef INCLUDE_KOLIBRI_H |
5 | #ifndef INCLUDE_KOLIBRI_H |
6 | #include "../lib/kolibri.h" |
6 | #include "../lib/kolibri.h" |
Line 7... | Line 7... | ||
7 | #endif |
7 | #endif |
Line 8... | Line 8... | ||
8 | 8 | ||
9 | dword buf_data; |
9 | unsigned buf_data; |
10 | 10 | ||
Line 11... | Line 11... | ||
11 | 11 | ||
12 | struct DrawBufer { |
12 | struct DrawBufer { |
13 | int bufx, bufy, bufw, bufh; |
13 | unsigned bufx, bufy, bufw, bufh; |
Line 23... | Line 23... | ||
23 | void AlignRight(); |
23 | void AlignRight(); |
24 | }; |
24 | }; |
Line 25... | Line 25... | ||
25 | 25 | ||
26 | void DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh) |
26 | void DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh) |
- | 27 | { |
|
27 | { |
28 | if (!zoom) zoom = 1; |
28 | bufx = i_bufx; |
29 | bufx = i_bufx; |
29 | bufy = i_bufy; |
30 | bufy = i_bufy; |
30 | bufw = i_bufw * zoom; |
31 | bufw = i_bufw * zoom; |
31 | bufh = i_bufh * zoom; |
32 | bufh = i_bufh * zoom; |
32 | free(buf_data); |
33 | free(buf_data); |
33 | buf_data = malloc(bufw * bufh * 4 + 8); |
34 | buf_data = malloc(bufw * bufh * 4 + 8); |
34 | ESDWORD[buf_data] = bufw; |
35 | ESDWORD[buf_data] = bufw; |
35 | ESDWORD[buf_data+4] = bufh; |
36 | ESDWORD[buf_data+4] = bufh; |
Line 36... | Line 37... | ||
36 | } |
37 | } |
37 | 38 | ||
38 | void DrawBufer::Fill(dword fill_color) |
39 | void DrawBufer::Fill(unsigned fill_color) |
39 | { |
40 | { |
40 | int i; |
41 | unsigned i; |
41 | int max_i = bufw * bufh * 4 + buf_data + 8; |
42 | unsigned max_i = bufw * bufh * 4 + buf_data + 8; |
Line 42... | Line 43... | ||
42 | for (i=buf_data+8; i |
43 | for (i=buf_data+8; i |
43 | } |
44 | } |
44 | 45 | ||
45 | void DrawBufer::DrawBar(dword x, y, w, h, color) |
46 | void DrawBufer::DrawBar(unsigned x, y, w, h, color) |
46 | { |
47 | { |
47 | int i, j; |
48 | int i, j; |
48 | for (j=0; j |
49 | for (j=0; j |
49 | { |
50 | { |
Line 50... | Line 51... | ||
50 | for (i = y+j*bufw+x*4+8+buf_data; i |
51 | for (i = y+j*bufw+x*4+8+buf_data; i |
51 | } |
52 | } |
52 | } |
53 | } |
53 | 54 | ||
54 | void DrawBufer::PutPixel(dword x, y, color) |
55 | void DrawBufer::PutPixel(unsigned x, y, color) |
Line 55... | Line 56... | ||
55 | { |
56 | { |
56 | int pos = y*bufw+x*4+8+buf_data; |
57 | int pos = y*bufw+x*4+8+buf_data; |
57 | ESDWORD[pos] = color; |
58 | ESDWORD[pos] = color; |
58 | } |
59 | } |
59 | 60 | ||
60 | char shift[]={8,8,4,4}; |
61 | char shift[]={8,8,4,4}; |
61 | void DrawBufer::Skew(dword x, y, w, h) |
62 | void DrawBufer::Skew(unsigned x, y, w, h) |
62 | { |
63 | { |
63 | int i, j; |
64 | int i, j; |
64 | for (j=0; j<=3; j++) |
65 | for (j=0; j<=3; j++) |
Line 65... | Line 66... | ||
65 | { |
66 | { |
66 | for (i = y+j*bufw+x+w+h*4; i>y+j*bufw+x+h-12*4 ; i-=4) |
67 | for (i = y+j*bufw+x+w+h*4; i>y+j*bufw+x+h-12*4 ; i-=4) |
67 | ESDWORD[buf_data+i+8] = ESDWORD[-shift[j]+buf_data+i+8]; |
68 | ESDWORD[buf_data+i+8] = ESDWORD[-shift[j]+buf_data+i+8]; |
68 | } |
69 | } |
69 | } |
70 | } |
70 | 71 | ||
Line 79... | Line 80... | ||
79 | ESDWORD[buf_data+8+i] >< ESDWORD[buf_data+8+l]; |
80 | ESDWORD[buf_data+8+i] >< ESDWORD[buf_data+8+l]; |
80 | } |
81 | } |
81 | } |
82 | } |
82 | } |
83 | } |
Line 83... | Line 84... | ||
83 | 84 | ||
84 | void DrawBufer::AlignCenter(dword x,y,w,h, content_width) |
85 | void DrawBufer::AlignCenter(unsigned x,y,w,h, content_width) |
85 | { |
86 | { |
86 | int i, j, l; |
87 | int i, j, l; |
87 | int content_left = w - content_width / 2; |
88 | int content_left = w - content_width / 2; |
88 | for (j=0; j |
89 | for (j=0; j |
Line 96... | Line 97... | ||
96 | 97 | ||
97 | /* |
98 | /* |
98 | void DrawBufer::Zoom2x() |
99 | void DrawBufer::Zoom2x() |
99 | { |
100 | { |
100 | int i, s; |
101 | int i, s; |
Line 101... | Line 102... | ||
101 | dword point_x, max_i, zline_w, s_inc; |
102 | unsigned point_x, max_i, zline_w, s_inc; |
102 | 103 | ||
103 | point_x = 0; |
104 | point_x = 0; |
104 | max_i = bufw * bufh * 4 + buf_data+8; |
105 | max_i = bufw * bufh * 4 + buf_data+8; |