com.hdcookbook.grin.mosaic
Class Mosaic

java.lang.Object
  extended by com.hdcookbook.grin.mosaic.Mosaic

public class Mosaic
extends java.lang.Object

Represents a single mosaic image, composed of a number of parts, or tiles.

Author:
Bill Foote (http://jovial.com)

Constructor Summary
Mosaic(MosaicSpec spec)
          Create a new mosaic, with the given parameters
 
Method Summary
 boolean compile(java.awt.Component progressComponent)
          Compile this mosaic into an optimal arrangement.
 int getHeightUsed()
           
 java.lang.String getOutputName()
          Get the name of the file we'll be written to.
 int getPosition()
          Get our position within the binary list of mosaics that's written out for GRIN to consult at runtime.
 int getWidthUsed()
           
 MosaicPart putImage(ManagedImage mi, int maxWidth, int maxHeight)
          Put the image represented by mi and im into the mosaic.
 void setPosition(int position)
          Set our position within the binary list of mosaics that's written out for GRIN to consult at runtime.
 void writeMosaicImage(java.io.File out)
          Write out our image buffer as a PNG image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mosaic

public Mosaic(MosaicSpec spec)
Create a new mosaic, with the given parameters

Method Detail

getHeightUsed

public int getHeightUsed()

getWidthUsed

public int getWidthUsed()

putImage

public MosaicPart putImage(ManagedImage mi,
                           int maxWidth,
                           int maxHeight)
Put the image represented by mi and im into the mosaic. This always works, and returns a MosaicPart.


compile

public boolean compile(java.awt.Component progressComponent)
Compile this mosaic into an optimal arrangement.

Returns:
true if this mosaic is used for images, false if it's empty

getOutputName

public java.lang.String getOutputName()
Get the name of the file we'll be written to.


setPosition

public void setPosition(int position)
Set our position within the binary list of mosaics that's written out for GRIN to consult at runtime.


getPosition

public int getPosition()
Get our position within the binary list of mosaics that's written out for GRIN to consult at runtime.


writeMosaicImage

public void writeMosaicImage(java.io.File out)
                      throws java.io.IOException
Write out our image buffer as a PNG image.

Throws:
java.io.IOException