net.sf.jomic.comic
Class Conversion

java.lang.Object
  extended by java.util.Dictionary
      extended by java.util.Hashtable
          extended by java.util.Properties
              extended by net.sf.jomic.tools.BasicSettings
                  extended by net.sf.jomic.comic.Conversion
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class Conversion
extends BasicSettings

Conversion describing how to convert a comic and/or images in it. To actually convert something, you need a ConvertComicTask.

Author:
Thomas Aglassinger
See Also:
ConversionBean, ConvertComicTask, Serialized Form

Field Summary
static java.lang.String COMIC_FORMAT_CBZ
           
static java.lang.String COMIC_FORMAT_PDF
           
static java.lang.String IMAGE_FORMAT_JFIF
           
static java.lang.String IMAGE_FORMAT_PNG
           
static java.lang.String IMAGE_FORMAT_PRESERVE
           
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
Conversion()
           
Conversion(java.lang.String newComicFormat)
           
 
Method Summary
 void checkValidComicFileFormat(java.lang.String supposedFileFormat)
           
 void checkValidImageFileFormat(java.lang.String supposedFileFormat)
           
 java.lang.String getComicFormat()
           
 java.lang.String getComicFormatSuffix()
          Get the preferred file suffix for a comic according to getComicFormat() (without a leading ".").
 java.lang.String getImageFormat()
           
 java.lang.String getImageFormatName(java.lang.String sourceImageFormatName)
          Get target image format name taking in account the original format of the source image (in case getImageFormat() is IMAGE_FORMAT_PRESERVE) or the format selected by the user.
 int getMaxImageHeight()
           
 int getMaxImageWidth()
           
 int getMaxThumbHeight()
           
 int getMaxThumbWidth()
           
 java.awt.image.RenderedImage getTrimmed(java.awt.image.RenderedImage image)
          Yield image trimmed to maximum size.
 boolean isAddable(ImageInfo imageInfo)
           
 boolean isAddable(java.lang.String imageFormat, java.awt.Dimension imageSize)
          Yield true if file should be added to comic archives.
 boolean isAddOnlyImages()
           
 boolean isExcludeThumbPages()
           
 boolean isLimitImageSize()
           
 boolean needsTrim(java.awt.Dimension imageSize)
          Yield true if the image with size imageSize is bigger than the conversion allows (provided that isLimitImageSize actually is enabled).
 boolean needsTrim(java.io.File imageFile)
          Yield true if the image in imageFile is bigger than the conversion allows (provided that isLimitImageSize actually is enabled).
 void setAddOnlyImages(boolean newValue)
           
 void setComicFormat(java.lang.String newFileFormat)
          Set the format of the target comic.
 void setExcludeThumbPages(boolean newValue)
           
 void setImageFormat(java.lang.String newImageFormat)
          Set the fomat of the images in the target comic.
 void setLimitImageSize(boolean newValue)
           
 void setMaxImageHeight(int maxImageHeight)
           
 void setMaxImageWidth(int maxImageWidth)
           
 void setMaxThumbHeight(int maxThumbPageHeight)
           
 void setMaxThumbWidth(int maxThumbPageWidth)
           
 
Methods inherited from class net.sf.jomic.tools.BasicSettings
addPropertyChangeListener, addPropertyChangeListener, applyComponentAreaProperty, clear, firePropertyChangeEvent, getBooleanProperty, getChoiceProperty, getColorProperty, getFileProperty, getIntProperty, getLimitedIntProperty, getProperty, getProperty, getSystemPropertyName, isValidPropertyName, remove, removePropertyChangeListener, removePropertyChangeListener, setBooleanProperty, setChoiceProperty, setColorProperty, setComponentAreaProperty, setDefault, setDefault, setDefault, setFileProperty, setIntProperty, setLimitedIntProperty, setProperty, setSystemPropertyPrefix
 
Methods inherited from class java.util.Properties
list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COMIC_FORMAT_CBZ

public static final java.lang.String COMIC_FORMAT_CBZ
See Also:
Constant Field Values

COMIC_FORMAT_PDF

public static final java.lang.String COMIC_FORMAT_PDF
See Also:
Constant Field Values

IMAGE_FORMAT_JFIF

public static final java.lang.String IMAGE_FORMAT_JFIF
See Also:
Constant Field Values

IMAGE_FORMAT_PNG

public static final java.lang.String IMAGE_FORMAT_PNG
See Also:
Constant Field Values

IMAGE_FORMAT_PRESERVE

public static final java.lang.String IMAGE_FORMAT_PRESERVE
See Also:
Constant Field Values
Constructor Detail

Conversion

public Conversion()

Conversion

public Conversion(java.lang.String newComicFormat)
Method Detail

setAddOnlyImages

public void setAddOnlyImages(boolean newValue)

setComicFormat

public void setComicFormat(java.lang.String newFileFormat)
Set the format of the target comic.

Parameters:
newFileFormat - COMIC_FORMAT_CBZ or COMIC_FORMAT_PDF

setExcludeThumbPages

public void setExcludeThumbPages(boolean newValue)

setImageFormat

public void setImageFormat(java.lang.String newImageFormat)
Set the fomat of the images in the target comic.

Parameters:
newImageFormat - IMAGE_FORMAT_JFIF, IMAGE_FORMAT_PNG, or IMAGE_FORMAT_PRESERVE

setLimitImageSize

public void setLimitImageSize(boolean newValue)

setMaxImageHeight

public void setMaxImageHeight(int maxImageHeight)

setMaxImageWidth

public void setMaxImageWidth(int maxImageWidth)

setMaxThumbHeight

public void setMaxThumbHeight(int maxThumbPageHeight)

setMaxThumbWidth

public void setMaxThumbWidth(int maxThumbPageWidth)

getComicFormat

public java.lang.String getComicFormat()

getComicFormatSuffix

public java.lang.String getComicFormatSuffix()
Get the preferred file suffix for a comic according to getComicFormat() (without a leading ".").

Returns:
"cbz" or "pdf".
See Also:
getComicFormat()

getImageFormat

public java.lang.String getImageFormat()

getImageFormatName

public java.lang.String getImageFormatName(java.lang.String sourceImageFormatName)
Get target image format name taking in account the original format of the source image (in case getImageFormat() is IMAGE_FORMAT_PRESERVE) or the format selected by the user.


getMaxImageHeight

public int getMaxImageHeight()

getMaxImageWidth

public int getMaxImageWidth()

getMaxThumbHeight

public int getMaxThumbHeight()

getMaxThumbWidth

public int getMaxThumbWidth()

getTrimmed

public java.awt.image.RenderedImage getTrimmed(java.awt.image.RenderedImage image)
Yield image trimmed to maximum size. Landscape images can have twice the maximum width.

See Also:
getMaxImageHeight(), getMaxImageWidth(), ImageTools.isLandscape(RenderedImage)

isAddOnlyImages

public boolean isAddOnlyImages()

isAddable

public boolean isAddable(java.lang.String imageFormat,
                         java.awt.Dimension imageSize)
Yield true if file should be added to comic archives.


isAddable

public boolean isAddable(ImageInfo imageInfo)

isExcludeThumbPages

public boolean isExcludeThumbPages()

isLimitImageSize

public boolean isLimitImageSize()

checkValidComicFileFormat

public void checkValidComicFileFormat(java.lang.String supposedFileFormat)

checkValidImageFileFormat

public void checkValidImageFileFormat(java.lang.String supposedFileFormat)

needsTrim

public boolean needsTrim(java.io.File imageFile)
                  throws java.io.IOException
Yield true if the image in imageFile is bigger than the conversion allows (provided that isLimitImageSize actually is enabled).

Throws:
java.io.IOException
See Also:
isLimitImageSize()

needsTrim

public boolean needsTrim(java.awt.Dimension imageSize)
Yield true if the image with size imageSize is bigger than the conversion allows (provided that isLimitImageSize actually is enabled).

See Also:
isLimitImageSize()