net.sf.image4j.util
Class ConvertUtil

java.lang.Object
  extended by net.sf.image4j.util.ConvertUtil

public class ConvertUtil
extends java.lang.Object

Provides useful methods for converting images from one colour depth to another.

Author:
Ian McDonagh

Constructor Summary
ConvertUtil()
           
 
Method Summary
static java.awt.image.BufferedImage convert1(java.awt.image.BufferedImage src)
          Converts the source to 1-bit colour depth (monochrome).
static java.awt.image.BufferedImage convert24(java.awt.image.BufferedImage src)
          Converts the source image to 24-bit colour (RGB).
static java.awt.image.BufferedImage convert32(java.awt.image.BufferedImage src)
          Converts the source image to 32-bit colour with transparency (ARGB).
static java.awt.image.BufferedImage convert4(java.awt.image.BufferedImage src)
          Converts the source image to 4-bit colour using the default 16-colour palette: blackdark reddark green dark yellowdark bluedark magenta dark cyandark greylight grey redgreenyellowblue magentacyanwhite No transparency.
static java.awt.image.BufferedImage convert4(java.awt.image.BufferedImage src, int[] cmap)
          Converts the source image to 4-bit colour using the given colour map.
static java.awt.image.BufferedImage convert8(java.awt.image.BufferedImage src)
          Converts the source image to 8-bit colour using the default 256-colour palette.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertUtil

public ConvertUtil()
Method Detail

convert1

public static java.awt.image.BufferedImage convert1(java.awt.image.BufferedImage src)
Converts the source to 1-bit colour depth (monochrome). No transparency.

Parameters:
src - the source image to convert
Returns:
a copy of the source image with a 1-bit colour depth.

convert4

public static java.awt.image.BufferedImage convert4(java.awt.image.BufferedImage src)
Converts the source image to 4-bit colour using the default 16-colour palette: No transparency.

Parameters:
src - the source image to convert
Returns:
a copy of the source image with a 4-bit colour depth, with the default colour pallette

convert4

public static java.awt.image.BufferedImage convert4(java.awt.image.BufferedImage src,
                                                    int[] cmap)
Converts the source image to 4-bit colour using the given colour map. No transparency.

Parameters:
src - the source image to convert
cmap - the colour map, which should contain no more than 16 entries The entries are in the form RRGGBB (hex).
Returns:
a copy of the source image with a 4-bit colour depth, with the custom colour pallette

convert8

public static java.awt.image.BufferedImage convert8(java.awt.image.BufferedImage src)
Converts the source image to 8-bit colour using the default 256-colour palette. No transparency.

Parameters:
src - the source image to convert
Returns:
a copy of the source image with an 8-bit colour depth

convert24

public static java.awt.image.BufferedImage convert24(java.awt.image.BufferedImage src)
Converts the source image to 24-bit colour (RGB). No transparency.

Parameters:
src - the source image to convert
Returns:
a copy of the source image with a 24-bit colour depth

convert32

public static java.awt.image.BufferedImage convert32(java.awt.image.BufferedImage src)
Converts the source image to 32-bit colour with transparency (ARGB).

Parameters:
src - the source image to convert
Returns:
a copy of the source image with a 32-bit colour depth.