Rev 7254 | Rev 7259 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7254 | Rev 7257 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #define MAX_CELL_SIZE 256 |
1 | #define MAX_CELL_SIZE 256 |
Line -... | Line 2... | ||
- | 2 | ||
- | 3 | ////////////////////////////////////////////////////////////////////////////////////// |
|
- | 4 | // // |
|
- | 5 | // DRAW PIXEL // |
|
- | 6 | // // |
|
- | 7 | ////////////////////////////////////////////////////////////////////////////////////// |
|
- | 8 | ||
- | 9 | //The 'draw[]' in the array which holds the states should we draw a pixel or not. |
|
- | 10 | //Is need to decrese redraw when using some tools like line, rectangle and selection. |
|
- | 11 | ||
- | 12 | struct _pixel_state |
|
- | 13 | { |
|
- | 14 | unsigned image_rows, image_columns; |
|
- | 15 | bool draw[MAX_CELL_SIZE*MAX_CELL_SIZE]; |
|
- | 16 | void set_drawable_state(); |
|
- | 17 | bool is_drawable(); |
|
- | 18 | void reset_and_set_all_drawable(); |
|
- | 19 | void set_sizes(); |
|
- | 20 | } pixel_state; |
|
- | 21 | ||
- | 22 | void _pixel_state::set_drawable_state(int _r, _c, _state) |
|
- | 23 | { |
|
- | 24 | draw[image_columns*_r + _c] = _state; |
|
- | 25 | } |
|
- | 26 | ||
- | 27 | bool _pixel_state::is_drawable(int _r, _c) |
|
- | 28 | { |
|
- | 29 | return draw[image_columns*_r + _c]; |
|
- | 30 | } |
|
- | 31 | ||
- | 32 | void _pixel_state::reset_and_set_all_drawable() |
|
- | 33 | { |
|
- | 34 | int i; |
|
- | 35 | for (i = 0; i < image_columns*image_rows; i++) draw[i]=true; |
|
- | 36 | } |
|
- | 37 | ||
- | 38 | void _pixel_state::set_sizes(dword _r, _c) |
|
- | 39 | { |
|
- | 40 | image_rows = _r; |
|
- | 41 | image_columns = _c; |
|
- | 42 | } |
|
- | 43 | ||
- | 44 | ////////////////////////////////////////////////////////////////////////////////////// |
|
- | 45 | // // |
|
- | 46 | // IMAGE // |
|
- | 47 | // // |
|
- | 48 | ////////////////////////////////////////////////////////////////////////////////////// |
|
- | 49 | ||
- | 50 | //This stucture determines basic actions that can be done with image (icon). |
|
2 | 51 | ||
3 | struct _image |
52 | struct _image |
4 | { |
53 | { |
5 | unsigned rows, columns; |
54 | unsigned rows, columns; |
6 | dword mas[MAX_CELL_SIZE*MAX_CELL_SIZE]; |
55 | dword mas[MAX_CELL_SIZE*MAX_CELL_SIZE]; |
- | 56 | dword img; |
|
7 | dword img; |
57 | _pixel_state pixel_state; |
8 | void create(); |
58 | void create(); |
9 | void set_pixel(); |
59 | void set_pixel(); |
10 | void draw_line(); |
60 | void draw_line(); |
11 | void fill(); |
61 | void fill(); |
Line 19... | Line 69... | ||
19 | { |
69 | { |
20 | int i; |
70 | int i; |
21 | rows = _rows; |
71 | rows = _rows; |
22 | columns = _columns; |
72 | columns = _columns; |
23 | for (i = 0; i < columns*rows; i++) mas[i]=0xBFCAD2; |
73 | for (i = 0; i < columns*rows; i++) mas[i]=0xBFCAD2; |
- | 74 | pixel_state.set_sizes(rows, columns); |
|
24 | } |
75 | } |
Line 25... | Line 76... | ||
25 | 76 | ||
26 | void _image::set_pixel(int _r, _c, _color) |
77 | void _image::set_pixel(int _r, _c, _color) |
27 | { |
78 | { |
Line 207... | Line 258... | ||
207 | }>>>>>>>>>>>>>>>>>>>>> |
258 | }>>>>>>>>>>>>>>>>>>>>>> |
Line 208... | Line -... | ||
208 | - | ||
209 | - | ||
210 | - |