|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrebuild.util.GraphicsUtilities
public final class GraphicsUtilities
A collection of various Graphics utilities.
Field Summary | |
---|---|
static int |
BMP
Windows Bitmap (BMP) format. |
static int |
GIF
GIF format. |
static int |
JPEG
JPEG format. |
static int |
PNG
PNG format. |
static int |
TIFF
TIFF format. |
static int |
WBMP
Windows Bitmap (WBMP) format. |
Method Summary | |
---|---|
static EncodedImage |
bitmapToEncodedImage(Bitmap map)
Convert a Bitmap to an EncodedImage . |
static EncodedImage |
bitmapToEncodedImage(Bitmap map,
boolean encodeAlpha)
Convert a Bitmap to an EncodedImage . |
static EncodedImage |
bitmapToEncodedImage(Bitmap map,
boolean encodeAlpha,
int type)
Convert a Bitmap to an EncodedImage in the specified format. |
static int |
colorFromArgb(int argb)
Creates a Color from a 32-bit ARGB value. |
static int |
colorFromArgb(int alpha,
int baseColor)
Creates a Color from the specified Color , but with the new specified alpha value. |
static int |
colorFromArgb(int red,
int green,
int blue)
Creates a Color from the specified 8-bit color values (red, green, and blue). |
static int |
colorFromArgb(int alpha,
int red,
int green,
int blue)
Creates a Color from the four ARGB component (alpha, red, green, and blue) values. |
static int |
colorGetAlpha(int argb)
Get the alpha channel from the specified color. |
static int |
colorGetBlue(int argb)
Get the blue channel from the specified color. |
static int |
colorGetGreen(int argb)
Get the green channel from the specified color. |
static int |
colorGetRed(int argb)
Get the red channel from the specified color. |
static int |
colorSetAlpha(int argb,
int value)
Set the alpha channel in the specified color. |
static int |
colorSetBlue(int argb,
int value)
Set the blue channel in the specified color. |
static int |
colorSetGreen(int argb,
int value)
Set the green channel in the specified color. |
static int |
colorSetRed(int argb,
int value)
Set the red channel in the specified color. |
static int |
getPixel(Bitmap map,
int x,
int y)
Get a pixel from a bitmap in AARRGGBB format. |
static Bitmap |
loadBitmap(java.io.InputStream in)
Load the specified Bitmap object. |
static Bitmap |
loadBitmap(java.lang.String file)
Load the specified Bitmap object. |
static EncodedImage |
loadEncodedImage(java.io.InputStream in)
Load the specified loadEncodedImage object. |
static EncodedImage |
loadEncodedImage(java.lang.String file)
Load the specified EncodedImage object. |
static Image |
loadImage(java.io.InputStream in)
Load the specified Image object. |
static Image |
loadImage(java.lang.String file)
Load the specified Image object. |
static void |
saveBitmap(java.io.OutputStream out,
Bitmap map,
int format)
Save a Bitmap to a OutputStream in a specified format. |
static boolean |
saveBitmap(java.lang.String file,
Bitmap map,
int format)
Save a Bitmap to a file in a specified format. |
static void |
saveEncodedImage(java.io.OutputStream out,
EncodedImage map)
Save a EncodedImage to a OutputStream . |
static boolean |
saveEncodedImage(java.lang.String file,
EncodedImage map)
Save a EncodedImage to a file. |
static void |
saveImage(java.io.OutputStream out,
Image map,
int format)
Save a Image to a OutputStream in a specified format. |
static boolean |
saveImage(java.lang.String file,
Image map,
int format)
Save a Image to a file in a specified format. |
static void |
setPixel(Bitmap map,
int color,
int x,
int y)
Set a pixel in a bitmap in AARRGGBB format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BMP
public static final int GIF
public static final int JPEG
public static final int PNG
public static final int TIFF
public static final int WBMP
BMP
.
Method Detail |
---|
public static EncodedImage bitmapToEncodedImage(Bitmap map)
Bitmap
to an EncodedImage
. Alpha channel (if present) is decoded by default.
map
- The Bitmap
to convert.
EncodedImage
(in the format of a PNGEncodedImage
). Null if an error occurred.public static EncodedImage bitmapToEncodedImage(Bitmap map, boolean encodeAlpha)
Bitmap
to an EncodedImage
.
map
- The Bitmap
to convert.encodeAlpha
- True if alpha channel (if present) should be decoded/encoded.
EncodedImage
(in the format of a PNGEncodedImage
). Null if an error occurred.public static EncodedImage bitmapToEncodedImage(Bitmap map, boolean encodeAlpha, int type)
Bitmap
to an EncodedImage
in the specified format.
map
- The Bitmap
to convert.encodeAlpha
- True if alpha channel (if present) should be decoded/encoded. This will be ignored if the type does not support alpha.type
- One of the following formats to convert the Bitmap
to: BMP
, GIF
, JPEG
, PNG
, TIFF
, or WBMP
. If a invalid format is specified then BMP
is used.
EncodedImage
. Null if an error occurred.public static int getPixel(Bitmap map, int x, int y)
map
- The bitmap to get the pixel from.x
- The x pixel to get.y
- The y pixel to get.
public static void setPixel(Bitmap map, int color, int x, int y)
map
- The bitmap to set the pixel on.color
- The pixel to set in AARRGGBB format.The
- x pixel to set.The
- y pixel to set.public static int colorFromArgb(int argb)
Color
from a 32-bit ARGB value.
argb
- A value specifying the 32-bit ARGB value.
Color
that this method creates.public static int colorFromArgb(int alpha, int baseColor)
Color
from the specified Color
, but with the new specified alpha value. Although this method allows a 32-bit value to be passed for the alpha value, the value is limited to 8 bits.
alpha
- The alpha value for the new Color
. Valid values are 0 through 255.baseColor
- The Color
from which to create the new Color
.
Color
that this method creates.public static int colorFromArgb(int red, int green, int blue)
Color
from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (fully opaque). Although this method allows a 32-bit value to be passed for each color component, the value of each component is limited to 8 bits.
red
- The red component value for the new Color
. Valid values are 0 through 255.green
- The green component value for the new Color
. Valid values are 0 through 255.blue
- The blue component value for the new Color
. Valid values are 0 through 255.
Color
that this method creates.public static int colorFromArgb(int alpha, int red, int green, int blue)
Color
from the four ARGB component (alpha, red, green, and blue) values. Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits.
alpha
- The alpha component. Valid values are 0 through 255.red
- The red component. Valid values are 0 through 255.green
- The green component. Valid values are 0 through 255.blue
- The blue component. Valid values are 0 through 255.
Color
that this method creates.public static int colorGetRed(int argb)
argb
- The ARGB color to get the red channel from.
public static int colorGetGreen(int argb)
argb
- The ARGB color to get the green channel from.
public static int colorGetBlue(int argb)
argb
- The ARGB color to get the blue channel from.
public static int colorGetAlpha(int argb)
argb
- The ARGB color to get the alpha channel from.
public static int colorSetRed(int argb, int value)
argb
- The color to set the red channel for.value
- The value to set the red channel. Range is 0 - 255.
public static int colorSetGreen(int argb, int value)
argb
- The color to set the green channel for.value
- The value to set the green channel. Range is 0 - 255.
public static int colorSetBlue(int argb, int value)
argb
- The color to set the blue channel for.value
- The value to set the blue channel. Range is 0 - 255.
public static int colorSetAlpha(int argb, int value)
argb
- The color to set the alpha channel for.value
- The value to set the alpha channel. Range is 0 - 255.
public static boolean saveImage(java.lang.String file, Image map, int format)
Image
to a file in a specified format.
file
- The path to save the Image
to.map
- The Image
to write.format
- One of the following formats to write the Image
as: BMP
, GIF
, JPEG
, PNG
, TIFF
, or WBMP
. If a invalid format is specified then BMP
is used.
Image
was saved, false if otherwise.public static void saveImage(java.io.OutputStream out, Image map, int format)
Image
to a OutputStream
in a specified format.
out
- The OutputStream
to write the Bitmap
to.map
- The Image
to write.format
- One of the following formats to write the Image
as: BMP
, GIF
, JPEG
, PNG
, TIFF
, or WBMP
. If a invalid format is specified then BMP
is used.public static boolean saveBitmap(java.lang.String file, Bitmap map, int format)
Bitmap
to a file in a specified format.
file
- The path to save the Bitmap
to.map
- The Bitmap
to write.format
- One of the following formats to write the Bitmap
as: BMP
, GIF
, JPEG
, PNG
, TIFF
, or WBMP
. If a invalid format is specified then BMP
is used.
Bitmap
was saved, false if otherwise.public static void saveBitmap(java.io.OutputStream out, Bitmap map, int format)
Bitmap
to a OutputStream
in a specified format.
out
- The OutputStream
to write the Bitmap
to.map
- The Bitmap
to write.format
- One of the following formats to write the Bitmap
as: BMP
, GIF
, JPEG
, PNG
, TIFF
, or WBMP
. If a invalid format is specified then BMP
is used.public static boolean saveEncodedImage(java.lang.String file, EncodedImage map)
EncodedImage
to a file.
file
- The path to save the EncodedImage
to.map
- The EncodedImage
to write.
EncodedImage
was saved, false if otherwise.public static void saveEncodedImage(java.io.OutputStream out, EncodedImage map)
EncodedImage
to a OutputStream
.
out
- The OutputStream
to write the EncodedImage
to.map
- The EncodedImage
to write.public static Image loadImage(java.lang.String file)
Image
object.
file
- The path to the Image
.
Image
.public static Image loadImage(java.io.InputStream in)
Image
object.
file
- The InputStream
to load the Image
from.
Image
.public static Bitmap loadBitmap(java.lang.String file)
Bitmap
object.
file
- The path to the Bitmap
.
Bitmap
.public static Bitmap loadBitmap(java.io.InputStream in)
Bitmap
object.
file
- The InputStream
to load the Bitmap
from.
Bitmap
.public static EncodedImage loadEncodedImage(java.lang.String file)
EncodedImage
object.
file
- The path to the EncodedImage
.
EncodedImage
.public static EncodedImage loadEncodedImage(java.io.InputStream in)
loadEncodedImage
object.
file
- The InputStream
to load the loadEncodedImage
from.
loadEncodedImage
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |