|
4 | 4 | using namespace bmp; |
5 | 5 |
|
6 | 6 | int main() { |
7 | | - // Create a 512x240 blank image |
8 | | - Bitmap image(512, 240); |
9 | | - image.clear(Pixel(0x25292e)); |
10 | | - |
11 | | - /** Line **/ |
12 | | - // Draw a yellow line from position (250, 50) to position (500, 50) |
13 | | - image.draw_line(250, 50, 500, 50, Yellow); |
14 | | - |
15 | | - /** Rectangle **/ |
16 | | - // Draw a red rectangle in position (10, 10) with size 100x100 |
17 | | - image.draw_rect(10, 10, 100, 100, Red); |
18 | | - // Draw a white filled rectangle in position (120, 10) with size 100x100 |
19 | | - image.fill_rect(120, 10, 100, 100, White); |
20 | | - |
21 | | - /** Triangle **/ |
22 | | - image.draw_triangle(60, 120, 10, 220, 120, 220, Cyan); |
23 | | - image.fill_triangle(180, 120, 130, 220, 245, 220, Magenta); |
24 | | - |
25 | | - /** Circle **/ |
26 | | - // Draw a non-filled Gray circle in position (300, 170) with 50 pixels radius |
27 | | - image.draw_circle(300, 170, 50, Gray); |
28 | | - // Draw a filled Lime circle in position (300, 170) with 50 pixels radius |
29 | | - image.fill_circle(420, 170, 50, Lime); |
30 | | - |
31 | | - // Save bitmap |
32 | | - image.save("primitives.bmp"); |
33 | | - |
34 | | - return EXIT_SUCCESS; |
| 7 | + // Create a 512x240 blank image |
| 8 | + Bitmap image(512, 240); |
| 9 | + image.clear(Pixel(0x25292e)); |
| 10 | + |
| 11 | + /** Line **/ |
| 12 | + // Draw a yellow line from position (250, 50) to position (500, 50) |
| 13 | + image.draw_line(250, 50, 500, 50, Yellow); |
| 14 | + |
| 15 | + /** Rectangle **/ |
| 16 | + // Draw a red rectangle in position (10, 10) with size 100x100 |
| 17 | + image.draw_rect(10, 10, 100, 100, Red); |
| 18 | + // Draw a white filled rectangle in position (120, 10) with size 100x100 |
| 19 | + image.fill_rect(120, 10, 100, 100, White); |
| 20 | + |
| 21 | + /** Triangle **/ |
| 22 | + image.draw_triangle(60, 120, 10, 220, 120, 220, Cyan); |
| 23 | + image.fill_triangle(180, 120, 130, 220, 245, 220, Magenta); |
| 24 | + |
| 25 | + /** Circle **/ |
| 26 | + // Draw a non-filled Gray circle in position (300, 170) with 50 pixels radius |
| 27 | + image.draw_circle(300, 170, 50, Gray); |
| 28 | + // Draw a filled Lime circle in position (300, 170) with 50 pixels radius |
| 29 | + image.fill_circle(420, 170, 50, Lime); |
| 30 | + |
| 31 | + // Save bitmap |
| 32 | + image.save(std::string(BIN_DIR) + "/primitives.bmp"); |
| 33 | + |
| 34 | + return EXIT_SUCCESS; |
35 | 35 | } |
0 commit comments