pt.ua.gboard
Class ImageGelem

java.lang.Object
  extended by pt.ua.gboard.Gelem
      extended by pt.ua.gboard.ImageGelem

public class ImageGelem
extends Gelem

This gelem draws an image in a rectangle of cells.


Field Summary
 boolean imageOk
           
 
Constructor Summary
ImageGelem(java.awt.Image image, GBoard board, double cellOccupation)
          Constructs a new ImageGelem (1x1 cells).
ImageGelem(java.awt.Image image, GBoard board, double cellOccupation, int numberOfLines, int numberOfColumns)
          Constructs a new ImageGelem.
ImageGelem(java.lang.String imagePath, GBoard board, double cellOccupation)
          Constructs a new ImageGelem (1x1 cells).
ImageGelem(java.lang.String imagePath, GBoard board, double cellOccupation, int numberOfLines, int numberOfColumns)
          Constructs a new ImageGelem.
ImageGelem(java.net.URL imageURL, GBoard board, double cellOccupation)
          Constructs a new ImageGelem (1x1 cells).
ImageGelem(java.net.URL imageURL, GBoard board, double cellOccupation, int numberOfLines, int numberOfColumns)
          Constructs a new ImageGelem.
 
Method Summary
 void draw(java.awt.Graphics g, int line, int column, int cellWidth, int cellHeight, java.awt.Color background)
          Draw ImageGelem in GBoard.
 void erase(java.awt.Graphics g, int line, int column, int cellWidth, int cellHeight, java.awt.Color background)
          Erase ImageGelem from GBoard.
 boolean imageOk()
          Indicates if the image was correctly loaded.
 
Methods inherited from class pt.ua.gboard.Gelem
height, intersects, isMutable, mutable, numberOfColumns, numberOfLines, width, x, y
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageOk

public boolean imageOk
Constructor Detail

ImageGelem

public ImageGelem(java.awt.Image image,
                  GBoard board,
                  double cellOccupation)
Constructs a new ImageGelem (1x1 cells).

requires: image != null && board != null && cellOccupation >= 0.0 && cellOccupation <= 100.0

Parameters:
image - image's object
board - GBoard where the image will be drawed
cellOccupation - total cell's occupation (%)

ImageGelem

public ImageGelem(java.lang.String imagePath,
                  GBoard board,
                  double cellOccupation)
Constructs a new ImageGelem (1x1 cells).

requires: imagePath != null && board != null && cellOccupation >= 0.0 && cellOccupation <= 100.0

Parameters:
imagePath - image's file path
board - GBoard where the image will be drawed
cellOccupation - total cell's occupation (%)

ImageGelem

public ImageGelem(java.lang.String imagePath,
                  GBoard board,
                  double cellOccupation,
                  int numberOfLines,
                  int numberOfColumns)
Constructs a new ImageGelem.

requires: imagePath != null && board != null && cellOccupation >= 0.0 && cellOccupation <= 100.0 && numberOfLines >= 1 && numberOfColumns >= 1

Parameters:
imagePath - image's file path
board - GBoard where the image will be drawed
cellOccupation - total cell's occupation (%)
numberOfLines - number of lines
numberOfColumns - number of columns

ImageGelem

public ImageGelem(java.net.URL imageURL,
                  GBoard board,
                  double cellOccupation)
Constructs a new ImageGelem (1x1 cells).

requires: imageURL != null && board != null && cellOccupation >= 0.0 && cellOccupation <= 100.0

Parameters:
imageURL - image's file url
board - GBoard where the image will be drawed
cellOccupation - total cell's occupation (%)

ImageGelem

public ImageGelem(java.net.URL imageURL,
                  GBoard board,
                  double cellOccupation,
                  int numberOfLines,
                  int numberOfColumns)
Constructs a new ImageGelem.

requires: imageURL != null && board != null && cellOccupation >= 0.0 && cellOccupation <= 100.0 && numberOfLines >= 1 && numberOfColumns >= 1

Parameters:
imageURL - image's file url
board - GBoard where the image will be drawed
cellOccupation - total cell's occupation (%)
numberOfLines - number of lines
numberOfColumns - number of columns

ImageGelem

public ImageGelem(java.awt.Image image,
                  GBoard board,
                  double cellOccupation,
                  int numberOfLines,
                  int numberOfColumns)
Constructs a new ImageGelem.

requires: image != null && board != null && cellOccupation >= 0.0 && cellOccupation <= 100.0 && numberOfLines >= 1 && numberOfColumns >= 1

Parameters:
image - image's object
board - GBoard where the image will be drawed
cellOccupation - total cell's occupation (%)
numberOfLines - number of lines
numberOfColumns - number of columns
Method Detail

draw

public void draw(java.awt.Graphics g,
                 int line,
                 int column,
                 int cellWidth,
                 int cellHeight,
                 java.awt.Color background)
Draw ImageGelem in GBoard.

requires: Gelem.draw(java.awt.Graphics, int, int, int, int, java.awt.Color)
requires: imageOk()

Specified by:
draw in class Gelem
Parameters:
g - Java's Graphics object to use in drawing
line - line in GBoard to draw Gelem.
column - column in GBoard to draw Gelem.
cellWidth - number of horizontal pixels per cell
cellHeight - number of vertical pixels per cell
background - background color

erase

public void erase(java.awt.Graphics g,
                  int line,
                  int column,
                  int cellWidth,
                  int cellHeight,
                  java.awt.Color background)
Erase ImageGelem from GBoard.

requires: Gelem.erase(java.awt.Graphics, int, int, int, int, java.awt.Color)
requires: imageOk()

Specified by:
erase in class Gelem
Parameters:
background - background color
g - Java's Graphics object to use in drawing
line - line in GBoard to draw Gelem.
column - column in GBoard to draw Gelem.
cellWidth - number of horizontal pixels per cell
cellHeight - number of vertical pixels per cell

imageOk

public boolean imageOk()
Indicates if the image was correctly loaded.

Returns:
boolean true if successfully loaded, otherwise it returns false