Package daevil.iconexe
Class Depth
- java.lang.Object
-
- daevil.iconexe.Depth
-
public class Depth extends java.lang.ObjectProvides useful methods for converting images from one colour depth to another.
-
-
Constructor Summary
Constructors Constructor Description Depth()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.image.BufferedImageconvert(java.awt.image.BufferedImage src, int depth)static java.awt.image.BufferedImageconvert1(java.awt.image.BufferedImage src)Converts the source to 1-bit colour depth (monochrome).static java.awt.image.BufferedImageconvert24(java.awt.image.BufferedImage src)Converts the source image to 24-bit colour (RGB).static java.awt.image.BufferedImageconvert32(java.awt.image.BufferedImage src)Converts the source image to 32-bit colour with transparency (ARGB).static java.awt.image.BufferedImageconvert4(java.awt.image.BufferedImage src)Converts the source image to 4-bit colour using the default 16-colour palette: black dark red dark green dark yellow dark blue dark magenta dark cyan dark grey light grey red green yellow blue magenta cyan white No transparency.static java.awt.image.BufferedImageconvert4(java.awt.image.BufferedImage src, int[] cmap)Converts the source image to 4-bit colour using the given colour map.static java.awt.image.BufferedImageconvert8(java.awt.image.BufferedImage src)Converts the source image to 8-bit colour using the default 256-colour palette.
-
-
-
Method Detail
-
convert
public static java.awt.image.BufferedImage convert(java.awt.image.BufferedImage src, int depth)
-
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:- black
- dark red
- dark green
- dark yellow
- dark blue
- dark magenta
- dark cyan
- dark grey
- light grey
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- 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 convertcmap- 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.
-
-