hello everyone .. well this my second course in have
java programming and im really lost i don't have the simplest clue to how do it so im seeking some help .. well below is my program and im using net beans to program it .. i really would be regretful if someone dropped some hints here and there ...
thank you
1 Drawing Canvas
Computer images are made of small colored elements called pixels. An image is therefore
a two-dimentional table of pixels. Each pixel has three color components that specify
the pixel’s red, green, and blue values (this is commonly called an RGB color). Each
component can have any value from 0 to 255 inclusive.
A pixel is an object of a Pixel class. A Pixel class has a constructor that takes the three
RGB color values and has three accessors named red, green, and blue. The Pixel class
is immutable: this means that none of its fields can be changed once a pixel is created.
In the Pixel class, override the methods equals and hashCode that are defined in the
root class Object.
All images must implement the Image interface specified as follows:
public interface Image {
public int width();
public int height();
public Pixel getPixel(int x, int y);
}
Note that the origin (0,0) point in a computer image is the upper-left corner of the image,
the x axis extends to the right, and the y axis extends downwards.
A mutable image is an image that also provides a setter operation setPixel. The interface
of MutableImage is as follows:
public interface MutableImage extends Image {
public void setPixel(int x, int y, Pixel p);
}
Write the code for a Canvas class that implements the MutableImage interface. The constructor
for Canvas should take a width and height parameters (both of which must be
1
positive integers) as well as an initial color (of type Pixel) of all the pixels in the image.
It must create a 2-D array of pixels with the given dimentions and fills the array with
the given pixel color.[/size]