Class JavaPicture

java.lang.Object
  |
  +--JavaPicture

public class JavaPicture
extends java.lang.Object


Field Summary
 java.awt.image.BufferedImage bimg
           
 java.awt.Canvas canvas
           
 javax.swing.ImageIcon imgIcon
           
 javax.swing.JFrame shower
           
 
Constructor Summary
JavaPicture()
           
 
Method Summary
 void createNewImage(int width, int height)
           
 int getBasicPixel(int x, int y)
          Returns the pixel value of a pixel in the picture, given its coordinates.
 int getHeight()
           
 JavaPixel getPixel(int x, int y)
          Returns a JavaPixel object representing a pixel in the picture given its coordinates
 int getWidth()
           
 void JavaPicture()
          Constructor
 boolean loadImage(java.lang.String filename)
          Load image
static void main(java.lang.String[] args)
          Test Main
 void repaintImage()
           
 boolean saveImage(java.lang.String newfilename)
          Saves the image represented by the JavaPicture object onto disk.
 void setBasicPixel(int x, int y, int rgb)
          Sets the value of a pixel in the picture.
 void showPictureWithTitle(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bimg

public java.awt.image.BufferedImage bimg

shower

public javax.swing.JFrame shower

imgIcon

public javax.swing.ImageIcon imgIcon

canvas

public java.awt.Canvas canvas
Constructor Detail

JavaPicture

public JavaPicture()
Method Detail

JavaPicture

public void JavaPicture()
Constructor


getWidth

public int getWidth()

getHeight

public int getHeight()

loadImage

public boolean loadImage(java.lang.String filename)
Load image


createNewImage

public void createNewImage(int width,
                           int height)

repaintImage

public void repaintImage()

showPictureWithTitle

public void showPictureWithTitle(java.lang.String s)

saveImage

public boolean saveImage(java.lang.String newfilename)
                  throws java.io.IOException
Saves the image represented by the JavaPicture object onto disk.

Parameters:
newfilename - the file name to save to
Throws:
java.io.IOException - raised if the save fails

getBasicPixel

public int getBasicPixel(int x,
                         int y)
Returns the pixel value of a pixel in the picture, given its coordinates.

Parameters:
x - the x coordinate of the pixel
y - the y coordinate of the pixel
Returns:
the pixel value as an integer

setBasicPixel

public void setBasicPixel(int x,
                          int y,
                          int rgb)
Sets the value of a pixel in the picture.

Parameters:
x - the x coordinate of the pixel
y - the y coordinate of the pixel
rgb - the new rgb value of the pixel

getPixel

public JavaPixel getPixel(int x,
                          int y)
Returns a JavaPixel object representing a pixel in the picture given its coordinates

Parameters:
x - the x coordinates of the pixel
y - the y coordinates of the pixel
Returns:
a JavaPixel object representing the requested pixel

main

public static void main(java.lang.String[] args)
Test Main