Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8102 superturbo 1
 
2
3
 
4
5
 
6
{
7
// поставить точку
8
9
 
10
11
 
12
	return;
13
14
 
15
	return;
16
17
 
18
19
 
20
*( b -> bmp + s + 1) = (c >> 8) & 0xff;
21
*( b -> bmp + s + 2) = (c >> 16)& 0xff;
22
23
 
24
25
 
26
27
 
28
{
29
// получить точку
30
31
 
32
33
 
34
	return 0;
35
36
 
37
	return 0;
38
39
 
40
41
 
42
green = *( b -> bmp + s + 1);
43
red   = *( b -> bmp + s + 2);
44
45
 
46
47
 
48
}
49
50
 
51
52
 
53
{
54
// линия заданного цвета с использованием
55
// алгоpитма Брезенхэма
56
57
 
58
int xerr=0, yerr=0, delta_x, delta_y;
59
int incx, incy;
60
61
 
62
delta_x = x2 - x1;
63
delta_y = y2 - y1;
64
65
 
66
// шаг вычисляется либо по веpтикальной, либо гоpизонтальной
67
// линии
68
if (delta_x > 0)
69
	incx = 1;
70
else
71
	if (0 == delta_x)
72
		incx = 0;
73
	else
74
		incx = -1;
75
76
 
77
	incy = 1;
78
else
79
	if ( 0 == delta_y)
80
		incy = 0;
81
	else
82
		incy = -1;
83
84
 
85
if (delta_x < 0)
86
	delta_x *= -1;
87
if (delta_y < 0)
88
	delta_y *= -1;
89
90
 
91
	dist = delta_x;
92
else
93
	dist = delta_y;
94
95
 
96
 
97
for (t = 0; t <= dist+1; t++)
98
	{
99
	gb_pixel_set(b, x1, y1, c);
100
	xerr+=delta_x;
101
	yerr+=delta_y;
102
103
 
104
		{
105
		xerr -= dist;
106
		x1 += incx;
107
		}
108
109
 
110
		{
111
		yerr -= dist;
112
		y1 += incy;
113
		}
114
115
 
116
}
117
118
 
119
120
 
121
{
122
// прямоугольник
123
124
 
125
gb_line (b, x,     y+h-1, x+w-1, y+h-1, c);
126
gb_line (b, x,     y,     x,     y+h-1, c);
127
gb_line (b, x+w-1, y,     x+w-1, y+h-1, c);
128
}
129
130
 
131
132
 
133
{
134
135
 
136
int _y;
137
int d;
138
139
 
140
_y = r;
141
d = 3-2*r;
142
while( _y >= _x)
143
	{
144
	gb_pixel_set(b,  _x + x,  _y + y, c);
145
	gb_pixel_set(b,  _x + x, -_y + y, c);
146
	gb_pixel_set(b, -_x + x,  _y + y, c);
147
	gb_pixel_set(b, -_x + x, -_y + y, c);
148
	gb_pixel_set(b,  _y + x,  _x + y, c);
149
	gb_pixel_set(b,  _y + x, -_x + y, c);
150
	gb_pixel_set(b, -_y + x,  _x + y, c);
151
	gb_pixel_set(b, -_y + x, -_x + y, c);
152
	if( d<0 )
153
		d = d+4*_x+6;
154
        else
155
		{
156
		d = d+4*(_x-_y)+10;
157
		_y--;
158
		}
159
	_x++;
160
	}
161
162
 
163
164
 
165
166
 
167
{
168
// закрашенный прямоугольник
169
170
 
171
int i, j;
172
173
 
174
	return;
175
176
 
177
for (i = 0; i < h; i++)
178
//	gb_pixel_set(b, x+j, y+i, c);
179
	{
180
	s = 3*( (y+i)*(b->w) + x + j );
181
182
 
183
	*( b -> bmp + s + 1) = (c >> 8) & 0xff;
184
	*( b -> bmp + s + 2) = (c >> 16)& 0xff;
185
186
 
187
}
188
189
 
190
191
 
192
{
193
// вывод изображения
194
195
 
196
unsigned d;
197
198
 
199
	return;
200
201
 
202
	return;
203
204
 
205
	for (x = 0; x < w; x++)
206
		if ( gb_pixel_get(b_src, x_s+x, y_s+y, &d) )
207
			gb_pixel_set(b_dest, x_d+x, y_d+y, d);
208
209
 
210
 
211
212
 
213
214
 
215
{
216
// вывод изображения с прозрачным цветом
217
218
 
219
unsigned d;
220
221
 
222
	return;
223
224
 
225
	return;
226
227
 
228
	for (x = 0; x < w; x++)
229
		if ( gb_pixel_get(b_src, x_s+x, y_s+y, &d) )
230
			if (c != d)
231
				gb_pixel_set(b_dest, x_d+x, y_d+y, d);
232
233
 
234
 
235
236
 
237
238
 
239
240
 
241
{
242
void	*name;
243
void	*function;
244
} export_t;
245
246
 
247
248
 
249
char szGb_pixel_get[]   =  "gb_pixel_get";
250
char szGb_line[]        =  "gb_line";
251
char szGb_rect[]        =  "gb_rect";
252
char szGb_bar[]         =  "gb_bar";
253
char szGb_circle[]      =  "gb_circle";
254
char szGb_image_set[]   =  "gb_image_set";
255
char szGb_image_set_t[] =  "gb_image_set_t";
256
257
 
258
{
259
{ szGb_pixel_set,   (void*) gb_pixel_set},
260
{ szGb_pixel_get,   (void*) gb_pixel_get},
261
{ szGb_line,        (void*) gb_line},
262
{ szGb_rect,        (void*) gb_rect},
263
{ szGb_bar,         (void*) gb_bar},
264
{ szGb_circle,      (void*) gb_circle},
265
{ szGb_image_set,   (void*) gb_image_set},
266
{ szGb_image_set_t, (void*) gb_image_set_t},
267
{ NULL, NULL },
268
};
269