-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeometricobjects.cpp
More file actions
93 lines (61 loc) · 2.02 KB
/
Geometricobjects.cpp
File metadata and controls
93 lines (61 loc) · 2.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "GeometricObjects.h"
#include "Circle.h"
#include "Box.h"
#include "Line.h"
#include "Triangle.h"
#include "Polygon.h"
void Geometricobjects::draw() {
std::cout << " This is a Mother class circle" << std::endl;
}
void Geometricobjects::drawonepixel(const int& i, const int& j, const float& red, const float& green, const float& blue)
{
// testing if this code is wxwcuted.
//std::cout << "this is a value assigned to pixel array" << std::endl;
//pixels[(i + width*j) * 3 + 0] = red; //red
//pixels[(i + width*j) * 3 + 1] = green; //green
//pixels[(i + width*j) * 3 + 2] = blue; //blue
/*Geometricobjects::drawonepixel_1(const int& i, const int& j, const float& red, const float& green, const float& blue);*/
Geometricobjects* obj = new Geometricobjects;
obj->drawonepixel_1(i,j,red,green,blue);
}
void Geometricobjects::drawonepixel_1(const int& i, const int& j, const float& red, const float& green, const float& blue)
{
// testing if this code is wxwcuted.
//std::cout << "this is a value assigned to pixel array drawonepixel_1 " << std::endl;
pixels[(i + width*j) * 3 + 0] = red; //red
pixels[(i + width*j) * 3 + 1] = green; //green
pixels[(i + width*j) * 3 + 2] = blue; //blue
}
void Geometricobjects::draw_red_circle(const int& center_x, const int& center_y, const int& _radius, const int& _thickness)
{
std::cout << " This is a Mother class RED circle" << std::endl;
//Circle::drawcircle(const int& _center_x, const int& _center_y, const int& radius, const int& thickness, const float& red, const float& green, const float& blue)
Circle::drawcircle(center_x, center_y, _radius, _thickness, 1.0f, 0.0f, 0.0f);
}
Geometricobjects* Geometricobjects::createGeometricObjects(std::string& name)
{
//switchcase
if (name == "Circle") {
return new Circle;
}
else if (name == "Line")
{
return new Line;
}
else if (name == "Box")
{
return new Box;
}
else if (name == "Triangle")
{
return new Triangle;
}
else if (name == "Polygon")
{
return new Polygon;
}
else
{
return nullptr;
}
}