aspose file tools*
The moose likes Beginning Java and the fly likes Drawing Canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Drawing Canvas" Watch "Drawing Canvas" New topic
Author

Drawing Canvas

zainab alsammak
Greenhorn

Joined: Feb 19, 2012
Posts: 1
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]
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

zainab, welcome to the Ranch! We don't have too many rules here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites
http://au.answers.yahoo.com/question/index?qid=20120219112354AADQao2

We would also like you to ShowSomeEffort ... you might like to go through some more of the sage advice on How To Ask Questions On Java Ranch.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drawing Canvas
 
Similar Threads
Picture Manipulation Methods
How to code a button with image
getting the color of a particular pixel from an image loaded in applet
How to fade an image?