Hi! const int MAX_WIDTH = 640; const int MAX_HEIGHT = 480; const int MAX_COLOR =
ID: 3705196 • Letter: H
Question
Hi!
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
{
public:
ImageMaker();
ImageMaker(string filename);
void LoadImage(string filename);
void SaveImage(string filename);
// Size functions
int GetWidth();
int GetHeight();
void SetWidth(int width);
void SetHeight(int height);
// Color functions
int GetRed();
int GetGreen();
int GetBlue();
void SetRed(int newR);
void SetGreen(int newG);
void SetBlue(int newB);
//---------------------------Help with these-------------------------------------------------------
// Drawing methods
void DrawPixel(int x, int y); // Uses red, green, blue for the color
void DrawRectangle(int x1, int y1, int x2, int y2);
void DrawLine(int x1, int y1, int x2, int y2);
//-------------------------------------------------------------------------------------------------------
private:
int width;
int height;
int red; // Used by draw methods
int green; // Used by draw methods
int blue; // Used by draw methods
short image[MAX_WIDTH][MAX_HEIGHT][3];
};
// Thank you for helping!
Assignment 1: ImageMaker Portable Pix Map Image Format Specification The portable pix map image format (ppm) is one of the simplest methods of creating an image file. This format is encoded as readable ascii text or viewed as an image with an image viewing program such as gimp. In this assignment, you will make a class that create a ppm image using basic drawing methods. In addition, you will make a driver that can be used to help test the functionality of the class. BE SURE TO READ THE DELIVERABLES! RGB Format P3 255 0 0 0200 0 0 0 0155 0 155 0 155 275000 0 0 0 0 0 100 1750 0 0 255 255 255 00 0 0 155 155 155 The first three lines defines the image header. P3 indicates that the image will use RGB color. The second line indicates width and height. The 255 indicates the maximum value for the color. In the example above colors are between 0-255. Read the following wiki-link for additional details: https://en.wikipedia.org/wiki/Netpbm format Coordinate System Unlike in math, the standard coordinate system for images starts in the upper left hand corner.Explanation / Answer
// for drawing different shapes like rectangle,pixel and line
public class RectanglesDrawing extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.blue);
g.drawRect(50, 80, 150, 100);
g.setColor(Color.magenta);
g.fillRect(230, 80, 150, 100);
}
}
/// FOR PIXEL
aTHEN IN MAIN CLASS
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.