tabs
Class ScribbleUtility

java.lang.Object
  extended by tabs.ScribbleUtility

public class ScribbleUtility
extends java.lang.Object

Instances of this class can be used to make line drawings onto the drawing area


Constructor Summary
ScribbleUtility(int resizedImageWidth, int resizedImageHeight)
          Creates a new instance of this class given the project's width and height of the drawing area
 
Method Summary
 void clear()
          Clear the scribble's image
 void dispose()
           
 void drawCurrentLayer(java.awt.Graphics2D g2d)
          Draw this scribble image using the given graphics context
protected  java.awt.Color getcurrentColor()
          Returns the scribble's current drawing color
 java.lang.Object getCurrentState()
          Returns a copy of the scribble's current image
 java.awt.image.BufferedImage getLayerImage()
          Returns the scribble's current image
 void mouseDragged(java.awt.event.MouseEvent evt)
          Notify the scribble that the mouse is dragged; results in drawing a line in the scibble's current layer
 void mousePressed(java.awt.event.MouseEvent e)
          Notify the scribble that the mouse was pressed; results in creating a new empty layer ready to be drawn with mouseDragged method
 void mouseReleased(java.awt.event.MouseEvent e)
          Notify the scribble that the mouse was released; results in closing the current layer and add it to the scribble's final image
 void setAlphaOpacity(java.awt.AlphaComposite ac)
          Change the scribble's drawing opacity
protected  void setCurrentColor(java.awt.Color color)
          Change the scribble's drawing color
 void setCurrentState(java.lang.Object o)
          Set the current scribble's image
 void setStroke(java.awt.Stroke stroke)
          Change the scribble's drawing stroke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScribbleUtility

public ScribbleUtility(int resizedImageWidth,
                       int resizedImageHeight)
Creates a new instance of this class given the project's width and height of the drawing area

Parameters:
resizedImageWidth - width of the project's drawing area
resizedImageHeight - height of the project's drawing area
Method Detail

clear

public void clear()
Clear the scribble's image


drawCurrentLayer

public void drawCurrentLayer(java.awt.Graphics2D g2d)
Draw this scribble image using the given graphics context

Parameters:
g2d - the graphics context to use for drawing

getCurrentState

public java.lang.Object getCurrentState()
Returns a copy of the scribble's current image

Returns:
a copy of the scribble's current image

getLayerImage

public java.awt.image.BufferedImage getLayerImage()
Returns the scribble's current image

Returns:
the scribble's current image

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Notify the scribble that the mouse was pressed; results in creating a new empty layer ready to be drawn with mouseDragged method

Parameters:
e -

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Notify the scribble that the mouse was released; results in closing the current layer and add it to the scribble's final image

Parameters:
e -

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Notify the scribble that the mouse is dragged; results in drawing a line in the scibble's current layer

Parameters:
evt -

setCurrentState

public void setCurrentState(java.lang.Object o)
Set the current scribble's image

Parameters:
o - a BuferedImage containing the new scribble's image

setStroke

public void setStroke(java.awt.Stroke stroke)
Change the scribble's drawing stroke

Parameters:
stroke - the new stroke to be used by the scribble

setAlphaOpacity

public void setAlphaOpacity(java.awt.AlphaComposite ac)
Change the scribble's drawing opacity

Parameters:
ac - the new opacity to be used by the scribble

setCurrentColor

protected void setCurrentColor(java.awt.Color color)
Change the scribble's drawing color

Parameters:
color - the new color to be used by the scribble

getcurrentColor

protected java.awt.Color getcurrentColor()
Returns the scribble's current drawing color

Returns:
the scribble's current drawing color

dispose

public void dispose()