Subversion Repositories Kolibri OS

Rev

Rev 7155 | Rev 7190 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7155 Rev 7156
Line 1... Line 1...
1
struct _image
1
struct _image
2
{
2
{
3
 
-
 
4
	unsigned rows, columns;
3
	unsigned rows, columns;
5
	dword mas[32*32];
4
	dword mas[32*32];
6
	dword img;
5
	dword img;
7
	void create();
6
	void create();
8
	void set_pixel();
7
	void set_pixel();
-
 
8
	void set_image();
9
	dword get_pixel();
9
	dword get_pixel();
10
	dword get_image();
10
	dword get_image();
11
	void move();
11
	void move();
12
};
12
};
Line 27... Line 27...
27
dword _image::get_pixel(int _r, _c)
27
dword _image::get_pixel(int _r, _c)
28
{
28
{
29
	return mas[columns*_r + _c];
29
	return mas[columns*_r + _c];
30
}
30
}
Line -... Line 31...
-
 
31
 
-
 
32
void _image::set_image(dword _inbuf)
-
 
33
{
-
 
34
	dword i;
-
 
35
	for (i = 0; i < columns*rows; i++;) 
-
 
36
	{
-
 
37
		mas[i] = ESDWORD[i*4+_inbuf] & 0x00FFFFFF;
-
 
38
	}
-
 
39
}
31
 
40
 
32
dword _image::get_image()
41
dword _image::get_image()
33
{
42
{
34
	int r=0, c=0;
43
	int r=0, c=0;
Line 35... Line 44...
35
	dword i;
44
	dword i;
36
 
45
 
Line 37... Line 46...
37
	free(img);
46
	free(img);
38
	i = img = malloc(rows*columns*3);
-
 
39
 
47
	i = img = malloc(rows*columns*3);
40
	for (r = 0; r < rows; r++)
48
 
41
	{
49
	for (r = 0; r < rows; r++)
42
		for (c = 0; c < columns; c++)
50
		for (c = 0; c < columns; c++)
43
		{
51
		{
44
			rgb.DwordToRgb(get_pixel(r,c));
52
			rgb.DwordToRgb(get_pixel(r,c));
45
			ESBYTE[i] = rgb.b;
53
			ESBYTE[i] = rgb.b;
46
			ESBYTE[i+1] = rgb.g;
54
			ESBYTE[i+1] = rgb.g;
47
			ESBYTE[i+2] = rgb.r;
-
 
48
			i += 3;
55
			ESBYTE[i+2] = rgb.r;
49
		}
56
			i += 3;
Line 50... Line 57...
50
	}
57
		}
51
	return img;
58
	return img;
Line 99... Line 106...
99
					set_pixel(0, c, first_element_data);
106
					set_pixel(0, c, first_element_data);
100
				}
107
				}
101
				break;
108
				break;
102
		case FLIP_HOR:
109
		case FLIP_HOR:
103
				for (r = 0; r < rows; r++)
110
				for (r = 0; r < rows; r++)
104
				{
-
 
105
					for (c = 0; c < columns/2; c++) {
111
					for (c = 0; c < columns/2; c++) {
106
						first_element_data = get_pixel(r, c);
112
						first_element_data = get_pixel(r, c);
107
						set_pixel(r, c, get_pixel(r, columns-c-1));
113
						set_pixel(r, c, get_pixel(r, columns-c-1));
108
						set_pixel(r, columns-c-1, first_element_data);
114
						set_pixel(r, columns-c-1, first_element_data);
109
					}
115
					}
110
				}
-
 
111
				break;
116
				break;
112
		case FLIP_VER:
117
		case FLIP_VER:
113
				for (c = 0; c < columns; c++)
118
				for (c = 0; c < columns; c++)
114
				{
-
 
115
					for (r = 0; r < rows/2; r++) {
119
					for (r = 0; r < rows/2; r++) {
116
						first_element_data = get_pixel(r, c);
120
						first_element_data = get_pixel(r, c);
117
						set_pixel(r, c, get_pixel(rows-r-1, c));
121
						set_pixel(r, c, get_pixel(rows-r-1, c));
118
						set_pixel(rows-r-1, c, first_element_data);
122
						set_pixel(rows-r-1, c, first_element_data);
119
					}
123
					}
120
				}
-
 
121
				break;	
124
				break;	
122
	}
125
	}
123
}
126
}