public class ICOEncoder
extends java.lang.Object
限定符和类型 | 方法和说明 |
---|---|
static java.awt.image.BufferedImage |
convert(java.awt.image.BufferedImage img,
int bpp)
Utility method, which converts the given image to the specified colour depth.
|
static IconEntry |
createIconEntry(InfoHeader ih)
Constructs an IconEntry from the given InfoHeader
structure.
|
static void |
write(java.awt.image.BufferedImage image,
java.io.File file)
Encodes and writes a single image to file without colour depth conversion.
|
static void |
write(java.awt.image.BufferedImage image,
int bpp,
java.io.File file)
Encodes and writes a single image to file with colour depth conversion using the specified value.
|
static void |
write(java.awt.image.BufferedImage image,
int bpp,
java.io.OutputStream os)
Encodes and outputs a single image in ICO format.
|
static void |
write(java.awt.image.BufferedImage image,
java.io.OutputStream os)
Encodes and writes a single image without colour depth conversion.
|
static void |
write(java.util.List images,
java.io.File file)
Encodes and writes multiple images to file without colour depth conversion.
|
static void |
write(java.util.List images,
int[] bpp,
boolean[] compress,
java.io.File file)
Encodes and outputs a list of images in ICO format.
|
static void |
write(java.util.List images,
int[] bpp,
boolean[] compress,
java.io.OutputStream os)
Encodes and outputs a list of images in ICO format.
|
static void |
write(java.util.List images,
int[] bpp,
java.io.File file)
Encodes and writes multiple images to file with the colour depth conversion using the specified values.
|
static void |
write(java.util.List images,
int[] bpp,
java.io.OutputStream os)
Encodes and outputs a list of images in ICO format.
|
static void |
write(java.util.List images,
java.io.OutputStream os)
Encodes and writes multiple images without colour depth conversion.
|
static void |
writeAndBitmap(java.awt.image.BufferedImage img,
LittleEndianOutputStream out)
Encodes the AND bitmap for the given image according the its alpha channel (transparency) and writes it to the given output.
|
static void |
writeFileHeader(int count,
int type,
LittleEndianOutputStream out)
Writes the ICO file header for an ICO containing the given number of images.
|
public static void write(java.awt.image.BufferedImage image, java.io.File file) throws java.io.IOException
image
- the source image to encodefile
- the output file to which the encoded image will be writtenjava.io.IOException
- if an exception occurspublic static void write(java.awt.image.BufferedImage image, java.io.OutputStream os) throws java.io.IOException
image
- the source image to encodeos
- the output to which the encoded image will be writtenjava.io.IOException
- if an exception occurspublic static void write(java.util.List images, java.io.OutputStream os) throws java.io.IOException
images
- the list of source images to be encodedos
- the output to which the encoded image will be writtenjava.io.IOException
- if an error occurspublic static void write(java.util.List images, java.io.File file) throws java.io.IOException
images
- the list of source images to encodefile
- the file to which the encoded images will be writtenjava.io.IOException
- if an exception occurspublic static void write(java.util.List images, int[] bpp, java.io.File file) throws java.io.IOException
images
- the list of source images to encodebpp
- array containing desired colour depths for colour depth conversionfile
- the output file to which the encoded images will be writtenjava.io.IOException
- if an error occurspublic static void write(java.util.List images, int[] bpp, boolean[] compress, java.io.File file) throws java.io.IOException
images
- List of images to encode, which will be output in the order supplied in the list.bpp
- Array containing the color depth (bits per pixel) for encoding the corresponding image at each index in the images list. If the array is null, no colour depth conversion will be performed. A colour depth value of -1 at a particular index indicates that no colour depth conversion should be performed for that image.compress
- Array containing the compression flag for the corresponding image at each index in the images list. If the array is null, no compression will be peformed. A value of true specifies that compression should be performed, while a value of false specifies that no compression should be performed.file
- the file to which the encoded images will be written.java.io.IOException
- if an error occurred.public static void write(java.awt.image.BufferedImage image, int bpp, java.io.File file) throws java.io.IOException
image
- the source image to encodebpp
- the colour depth (bits per pixel) for the colour depth conversion, or -1 if no colour depth conversion should be performedfile
- the output file to which the encoded image will be writtenjava.io.IOException
- if an error occurspublic static void write(java.awt.image.BufferedImage image, int bpp, java.io.OutputStream os) throws java.io.IOException
write(java.util.List,int[],java.io.OutputStream)
.image
- The image to encode.bpp
- Colour depth (in bits per pixel) for the colour depth conversion, or -1 if no colour depth conversion should be performed.os
- The output to which the encoded image will be written.java.io.IOException
- if an error occurs when trying to write the output.public static void write(java.util.List images, int[] bpp, java.io.OutputStream os) throws java.io.IOException
images
- List of images to encode, which will be output in the order supplied in the list.bpp
- Array containing the color depth (bits per pixel) for encoding the corresponding image at each index in the images list. If the array is null, no colour depth conversion will be performed. A colour depth value of -1 at a particular index indicates that no colour depth conversion should be performed for that image.os
- The output to which the encoded images will be written.java.io.IOException
- if an error occurred.public static void write(java.util.List images, int[] bpp, boolean[] compress, java.io.OutputStream os) throws java.io.IOException
images
- List of images to encode, which will be output in the order supplied in the list.bpp
- Array containing the color depth (bits per pixel) for encoding the corresponding image at each index in the images list. If the array is null, no colour depth conversion will be performed. A colour depth value of -1 at a particular index indicates that no colour depth conversion should be performed for that image.compress
- Array containing the compression flag for the corresponding image at each index in the images list. If the array is null, no compression will be peformed. A value of true specifies that compression should be performed, while a value of false specifies that no compression should be performed.os
- The output to which the encoded images will be written.java.io.IOException
- if an error occurred.public static void writeFileHeader(int count, int type, LittleEndianOutputStream out) throws java.io.IOException
count
- the number of images in the ICOtype
- one of TYPE_ICON
or
TYPE_CURSOR
out
- the output to which the file header will be writtenjava.io.IOException
- if an error occurspublic static IconEntry createIconEntry(InfoHeader ih)
ih
- the InfoHeader structure from which to construct the IconEntry structure.public static void writeAndBitmap(java.awt.image.BufferedImage img, LittleEndianOutputStream out) throws java.io.IOException
img
- the image to encode as the AND bitmap.out
- the output to which the AND bitmap will be writtenjava.io.IOException
- if an error occurs.public static java.awt.image.BufferedImage convert(java.awt.image.BufferedImage img, int bpp)
img
- the image to convert.bpp
- the target colour depth (bits per pixel) for the conversion.