Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ drawing pixels lines rectangles implementing functions Implement all of the

ID: 3813700 • Letter: C

Question

C++ drawing pixels lines rectangles implementing functions

Implement all of the functions in the class and make driver for testing

This is what i have so far:

const int MAX_WIDTH = 640;
const int MAX_HEIGHT = 480;
const int MAX_COLOR = 255;
enum COLOR{ RED, GREEN, BLUE};

using namespace std;

class ImageMaker
{

private:
int width;
int height;
int red;
int green;
int blue;
short image[MAX_WIDTH][MAX_HEIGHT][3];


public:

ImageMaker::ImageMaker()
{
   int height = 0;
   int width = 0;
}

ImageMaker(string filename)
{

}


void LoadImage(string filename)
{
   outf.open("out1.txt");
  

}
void SaveImage(string filename)
{

   outf<<image[][];

}
// Write the matrix to file


void DrawPixel(int x, int y)
{

}

void DrawRectangle(int x1, int y1, int x2, int y2)
{

}

void DrawLine(int x1, int y1, int x2, int y2)
{


}

ImageMaker::setWidth(int w)
{

width = w;

}

ImageMaker::setHeight(int h)
{

height = h;


}

ImageMaker::getWidth()
{

return width;

}

ImageMaker::getHeight()
{

return height;

}

imageMaker::SetRed(int newR)
{
red = newR;
}
void SetGreen(int newG)
{
green = newG;
}
void SetBlue(int newB)
{
blue = newB;
}

int GetRed()
{
return Red;
}

int GetGreen()
{
return green;
}

int GetBlue()
{
return blue;
}


};

Class Definition The following is the class definition: const int MAX NIDTH 640 const int MAX HEIGHT 480; nt MAX COLOR enum COLOR (RED, GREEN, BLUE); using namespace std, class InageMaker Inage Hake file geHi void LoadImage string filenane) void Save Image string filenane) Write the matrix to file int Getwidt Rht void set ilidth (int Hidth); void SetHeight (int ght Col nt Gethod nt GetG int Get Blue(); void S Green (int neMG); void setBlue (int new6); Dr wine met hods void Dra Rectangle (int x1, int y1, int 2, int y2); void Dra Line (int xi, int yi, int x2, int y2); int width; int h ght int int blue; hort HAX-WIDTH JIMAX HEIGHT RED red Before you start looking at how to implement this class, you must determine and document the appropriate preconditions and postconditions for each operation. Test Driver Before this class can become a permanent part of your program library, it must be thoroughly tested. The test driver should support the following test commands: DrawPixel, x y Draw a pixel at x, y DrawRectangle y1 x2 y2 Draw a rectangle using the points xl,yl to x2, y2 DrawLine Draw a line from x1, yl to x2, y2 Set Color rgib valt Sets the r, g, or b to value Print Prants out the RGD Set Size width height nd height Print Load imagename rename saves the image using the name imagename

Explanation / Answer

#include &lt;iostream&gt;
#include &lt;list&gt;
using namespace std;

// a category that represents Associate in Nursing adrift graph
class Graph
closeness lists
public:
// builder and destructor
Graph(int V)   
~Graph()   

// perform to feature a foothold to graph
void addEdge(int v, int w);

// Prints greedy coloring of the vertices
void greedyColoring();
};

void Graph::addEdge(int v, int w)
{
adj[v].push_back(w);
adj[w].push_back(v); // Note: the graph is adrift
}

// Assigns colours (starting from 0) to all or any vertices and prints
// the assignment of colours
void Graph::greedyColoring()
1st|the primary} color to first vertex
result[0] = 0;

// Initialize remaining guided missile vertices as unassigned
for (int u = 1; u &lt; V; u++)
result[u] = -1; // no color is assigned to u

// a brief array to store the on the market colours. True
// worth of available[cr] would mean that the colour metal is
// assigned to at least one of its adjacent vertices
bool available[V];
for (int metal = 0; metal &lt; V; cr++)
available[cr] = false;

// Assign colours to remaining guided missile vertices
for (int u = 1; u &lt; V; u++)
method all adjacent vertices and flag their colours
// as unobtainable
list&lt;int&gt;::iterator i;
for (i = adj[u].begin(); i != adj[u].end(); ++i)
if (result[*i] != -1)
available[result[*i]] = true;

// realize the primary on the market color
int cr;
for (cr = 0; metal &lt; V; cr++)
if (available[cr] == false)
break;

result[u] = cr; // Assign the found color

// Reset the values back to false for successive iteration
for (i = adj[u].begin(); i != adj[u].end(); ++i)
if (result[*i] != -1)
available[result[*i]] = false;
}

// print the result
for (int u = 0; u &lt; V; u++)
cout &lt;&lt; "Vertex " &lt;&lt; u &lt;&lt; " ---&gt; Color "
&lt;&lt; result[u] &lt;&lt; endl;
}

// Driver program to check higher than perform
int main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote