-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.cpp
More file actions
56 lines (36 loc) · 1.02 KB
/
Box.cpp
File metadata and controls
56 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "Box.h"
void Box::draw() // declaration - definition (header , body)
{
//
Geometricobjects::draw_red_circle(350, 350, 50, 2);
Geometricobjects::draw_red_circle(550, 350, 50, 2);
//
std::cout << " This is a child class Box" << std::endl;
//drawrectangle(1.0f, 1.0f, 0.0f);
//
//drawing empty box
drawrectangle(0.0f, 0.0f, 1.0f);
// drawing filled box.
const int i_center = 550, j_center = 350;
const int thickness = 26;
for (int j = j_center - thickness; j < j_center + thickness; j++)
for (int i = i_center - thickness; i < i_center + thickness; i++)
{
Geometricobjects::drawonepixel(i, j, 0.0f, 1.0f, 0.0f);
}
}
void Box::drawrectangle(const float& red, const float& green, const float& blue)
{
for (int i = 325; i <= 375; i++)
{
int j = 375, x = 325;
drawonepixel(i, j, red, green, blue);
drawonepixel(i, x, red, green, blue);
}
for (int j = 325; j <= 375; j++)
{
int i = 325, y = 375;
drawonepixel(i, j, red, green, blue);
drawonepixel(y, j, red, green, blue);
}
}