net.sf.jomic.comic
Class ComicSheetLayout

java.lang.Object
  extended by net.sf.jomic.comic.ComicSheetLayout

public class ComicSheetLayout
extends java.lang.Object

Layout specifying how to render the images of a ComicSheet.

Author:
Thomas Aglassinger
See Also:
ComicSheet

Field Summary
static int RENDER_BOTH
           
static int RENDER_LEFT
           
static int RENDER_RIGHT
           
 
Constructor Summary
ComicSheetLayout()
           
 
Method Summary
 java.awt.geom.AffineTransform getTargetRotationTransformation(int targetWidth, int targetHeight)
          Get transformation to rotate image(s) during render().
 double[] getTargetScales(int targetWidth, int targetHeight, int imagesToRender)
          Get scales needed to render leftImage and/or rightImage in a target with size targetWidth x targetHeight.
 int[] getTargetTopLeft(int targetWidth, int targetHeight, int imagesToRender, double[] scales)
          Get the top left corner in for drawing the sheet in a target with size targetWidth x targetHeight.
 void prepare(java.awt.image.RenderedImage newLeftImage, java.awt.image.RenderedImage newRightImage, ComicSheetRenderSettings newRenderSettings)
          Set images and settings to be used for layout.
 void renderTo(java.awt.Graphics2D myGraphics, int screenWidth, int screenHeight, int imageIndex, ComicSheet comicSheet, java.awt.image.RenderedImage leftImageToRender, java.awt.image.RenderedImage rightImageToRender, ComicSheetRenderSettings newRenderSettings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDER_LEFT

public static final int RENDER_LEFT
See Also:
Constant Field Values

RENDER_RIGHT

public static final int RENDER_RIGHT
See Also:
Constant Field Values

RENDER_BOTH

public static final int RENDER_BOTH
See Also:
Constant Field Values
Constructor Detail

ComicSheetLayout

public ComicSheetLayout()
Method Detail

prepare

public void prepare(java.awt.image.RenderedImage newLeftImage,
                    java.awt.image.RenderedImage newRightImage,
                    ComicSheetRenderSettings newRenderSettings)
Set images and settings to be used for layout.


getTargetRotationTransformation

public java.awt.geom.AffineTransform getTargetRotationTransformation(int targetWidth,
                                                                     int targetHeight)
Get transformation to rotate image(s) during render().


getTargetScales

public double[] getTargetScales(int targetWidth,
                                int targetHeight,
                                int imagesToRender)
Get scales needed to render leftImage and/or rightImage in a target with size targetWidth x targetHeight.

Parameters:
imagesToRender - which images to render: RENDER_LEFT, RENDER_RIGHT, RENDER_BOTH
Returns:
result[0] is the scale for the left image and result[1] for the right image or NO_SCALE if there is no such image

getTargetTopLeft

public int[] getTargetTopLeft(int targetWidth,
                              int targetHeight,
                              int imagesToRender,
                              double[] scales)
Get the top left corner in for drawing the sheet in a target with size targetWidth x targetHeight.


renderTo

public void renderTo(java.awt.Graphics2D myGraphics,
                     int screenWidth,
                     int screenHeight,
                     int imageIndex,
                     ComicSheet comicSheet,
                     java.awt.image.RenderedImage leftImageToRender,
                     java.awt.image.RenderedImage rightImageToRender,
                     ComicSheetRenderSettings newRenderSettings)