picturedream.implementation
Class Picture

java.lang.Object
  |
  +--picturedream.implementation.Picture
All Implemented Interfaces:
IPicture

public class Picture
extends java.lang.Object
implements IPicture

Title: PictureDream

Description: Implementation of a 32bit picture

Copyright: Copyright (c) 2003 MRoc

Organisation: MRoc Audiosolutions

Version:
1.0
Author:
MRoc mail@mroc.de

Field Summary
private  java.awt.Image ivCachedImage
          image cached for faster access
private  java.util.Vector ivListeners
          the picture listeners
private  PictureData picturedata
           
 
Constructor Summary
Picture()
          constructor
 
Method Summary
 void addListener(IPictureListener l)
          adds the given IPictureListener
 void fill(int value)
          fills the entire buffer data with the given 32 bit value
private  void firePictureChanged()
          fires a picture changed notify
 int[] getData()
          returns a reference to the internal 32 bit buffer
 int getHeight()
          returns the picture height
 java.awt.Image getImage()
          produces a image from the internal 32 bit buffer
 int getWidth()
          returns the picture width
 boolean isValid()
          returns the images state, false if no or a corrupted image was loaded, true if valid picture data is stored in the picture.
 void loadImage(java.lang.String fileName)
          loads a image from file, gif or jpg, java std ;-)
 void process(IPictureProcessor processor)
          uses the given processor to process the image data.
 void redoPicture()
           
 void removeListener(IPictureListener l)
          removes the given IPictureListener
 void reset()
          resets the image
 void saveImage(java.lang.String fileName)
          save a image as Windows Bitmap
 void setData(int[] data, int width, int height)
          sets the picture data directly. the width and height must match the buffers length!
 void setDimension(int width, int height)
          allocates memory for a picture of the given width and height.
 void undoPicture()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ivListeners

private java.util.Vector ivListeners
the picture listeners

ivCachedImage

private java.awt.Image ivCachedImage
image cached for faster access

picturedata

private PictureData picturedata
Constructor Detail

Picture

public Picture()
constructor
Method Detail

reset

public void reset()
resets the image
Specified by:
reset in interface IPicture

isValid

public boolean isValid()
returns the images state, false if no or a corrupted image was loaded, true if valid picture data is stored in the picture.
Specified by:
isValid in interface IPicture

loadImage

public void loadImage(java.lang.String fileName)
               throws java.lang.Exception
loads a image from file, gif or jpg, java std ;-)
Specified by:
loadImage in interface IPicture
Parameters:
fileName - - the filename of the picture to be loaded
Throws:
java.lang.Exception -  

saveImage

public void saveImage(java.lang.String fileName)
               throws java.lang.Exception
Description copied from interface: IPicture
save a image as Windows Bitmap
Specified by:
saveImage in interface IPicture

setData

public void setData(int[] data,
                    int width,
                    int height)
sets the picture data directly. the width and height must match the buffers length!
Specified by:
setData in interface IPicture
Parameters:
data - - a 32 bit buffer
width - - the picture width
height - - the picture height

getData

public int[] getData()
returns a reference to the internal 32 bit buffer
Specified by:
getData in interface IPicture

getImage

public java.awt.Image getImage()
produces a image from the internal 32 bit buffer
Specified by:
getImage in interface IPicture

getWidth

public int getWidth()
returns the picture width
Specified by:
getWidth in interface IPicture

getHeight

public int getHeight()
returns the picture height
Specified by:
getHeight in interface IPicture

process

public void process(IPictureProcessor processor)
uses the given processor to process the image data.
Specified by:
process in interface IPicture
Parameters:
processor - is the processor used tio process the image data

addListener

public void addListener(IPictureListener l)
adds the given IPictureListener
Specified by:
addListener in interface IPicture

removeListener

public void removeListener(IPictureListener l)
removes the given IPictureListener
Specified by:
removeListener in interface IPicture

setDimension

public void setDimension(int width,
                         int height)
allocates memory for a picture of the given width and height.
Parameters:
width -  
height -  

fill

public void fill(int value)
fills the entire buffer data with the given 32 bit value
Parameters:
value -  

firePictureChanged

private void firePictureChanged()
fires a picture changed notify

undoPicture

public void undoPicture()

redoPicture

public void redoPicture()