org.millscript.millscript.datatypes
Class RasterImage

java.lang.Object
  extended by org.millscript.millscript.datatypes.Image
      extended by org.millscript.millscript.datatypes.RasterImage
All Implemented Interfaces:
java.lang.Cloneable

public final class RasterImage
extends Image
implements java.lang.Cloneable

This class represents a raster image in MillScript.


Constructor Summary
RasterImage(java.awt.image.BufferedImage image)
          Constructs a new raster image for the specified buffered image.
 
Method Summary
 java.lang.Object clone()
           
 void drawLine(int x1, int y1, int x2, int y2)
          Draws a line in the current colour, between the points ( x1, y1 ) and ( x2, y2 ).
 void drawOval(int x, int y, int width, int height)
          Draws the outline of an oval in the current color.
 void drawRect(int x, int y, int width, int height)
          Draws the outline of a rectangle in the current color.
 void drawString(java.lang.String str, int x, int y)
          Draws the text using the current font, in the current color, at the specified position.
 void fillOval(int x, int y, int width, int height)
          Draws a filled oval in the current color.
 void fillRect(int x, int y, int width, int height)
          Draws a filled rectangle in the current color.
 java.awt.Graphics2D getGraphics2D()
          Returns a Graphics2D object to draw on this image.
 int height()
          Returns the height of this image, in pixels.
 void renderAsRasterToStream(java.io.OutputStream ostream, ImageRender render)
          Renders this image to the specified stream as a raster image.
 void setColor(java.awt.Color color)
          Sets the current color to the specified value.
 java.lang.String toString()
          Returns the string representation of this raster image.
 int width()
          Returns the width of this image, in pixels.
 
Methods inherited from class org.millscript.millscript.datatypes.Image
showImage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RasterImage

public RasterImage(java.awt.image.BufferedImage image)
Constructs a new raster image for the specified buffered image.

Parameters:
image - the buffered image to wrap as a raster image
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class Image
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Description copied from class: Image
Draws a line in the current colour, between the points ( x1, y1 ) and ( x2, y2 ).

Specified by:
drawLine in class Image
Parameters:
x1 - the first point's x coordinate
y1 - the first point's y coordinate
x2 - the second point's x coordinate
y2 - the second point's y coordinate
See Also:
Image.drawLine(int, int, int, int)

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Description copied from class: Image
Draws the outline of an oval in the current color. The oval fits in the rectangle specified by the starting point ( x, y ) coordinate and the rectangles width and height.

Specified by:
drawOval in class Image
Parameters:
x - the starting point x coordinate
y - the starting point y coordinate
width - the width of the rectangle the oval fits in
height - the height of the rectangle the oval fits in
See Also:
Image.drawOval(int, int, int, int)

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height)
Description copied from class: Image
Draws the outline of a rectangle in the current color. The rectangle is specified by the starting point ( x, y ) coordinate, the width and height.

Specified by:
drawRect in class Image
Parameters:
x - the starting point x coordinate
y - the starting point y coordinate
width - the width of the rectangle
height - the height of the rectangle
See Also:
Image.drawRect(int, int, int, int)

drawString

public void drawString(java.lang.String str,
                       int x,
                       int y)
Description copied from class: Image
Draws the text using the current font, in the current color, at the specified position.

Specified by:
drawString in class Image
Parameters:
str - the string to draw
x - the starting point x coordinate
y - the starting point y coordinate
See Also:
Image.drawString(java.lang.String, int, int)

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Description copied from class: Image
Draws a filled oval in the current color. The oval fits in the rectangle specified by the starting point ( x, y ) coordinate and the rectangles width and height.

Specified by:
fillOval in class Image
Parameters:
x - the starting point x coordinate
y - the starting point y coordinate
width - the width of the rectangle the oval fits in
height - the height of the rectangle the oval fits in
See Also:
Image.fillOval(int, int, int, int)

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height)
Description copied from class: Image
Draws a filled rectangle in the current color. The rectangle is specified by the starting point ( x, y ) coordinate, the width and height.

Specified by:
fillRect in class Image
Parameters:
x - the starting point x coordinate
y - the starting point y coordinate
width - the width of the rectangle
height - the height of the rectangle
See Also:
Image.fillRect(int, int, int, int)

getGraphics2D

public java.awt.Graphics2D getGraphics2D()
Description copied from class: Image
Returns a Graphics2D object to draw on this image.

Specified by:
getGraphics2D in class Image
Returns:
a Graphics2D object to draw on this image.
See Also:
Image.getGraphics2D()

height

public int height()
Description copied from class: Image
Returns the height of this image, in pixels.

Specified by:
height in class Image
Returns:
the height of this image
See Also:
Image.height()

renderAsRasterToStream

public void renderAsRasterToStream(java.io.OutputStream ostream,
                                   ImageRender render)
                            throws java.io.IOException
Description copied from class: Image
Renders this image to the specified stream as a raster image.

Specified by:
renderAsRasterToStream in class Image
Parameters:
ostream - the stream to render to
render - the image renderer to use for rasterising the image
Throws:
java.io.IOException - thrown if problems occur with the stream
See Also:
Image.renderAsRasterToStream(java.io.OutputStream, org.millscript.millscript.render.ImageRender)

setColor

public void setColor(java.awt.Color color)
Description copied from class: Image
Sets the current color to the specified value.

Specified by:
setColor in class Image
Parameters:
color - the new color to draw in
See Also:
Image.setColor(java.awt.Color)

toString

public java.lang.String toString()
Returns the string representation of this raster image.

Overrides:
toString in class java.lang.Object
Returns:
a String holding a representation of this raster image

width

public int width()
Description copied from class: Image
Returns the width of this image, in pixels.

Specified by:
width in class Image
Returns:
the width of this image
See Also:
Image.width()


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.