public class ImageUtils
extends java.lang.Object
Constructor and Description |
---|
ImageUtils() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
convertImage(com.android.ddmlib.RawImage rawImage)
Convert a raw image into a buffered image.
|
static java.awt.image.BufferedImage |
convertImage(com.android.ddmlib.RawImage rawImage,
java.awt.image.BufferedImage image)
Convert a raw image into a buffered image.
|
static void |
debug(java.lang.String message) |
static java.awt.image.BufferedImage |
getCopiedImage(java.awt.image.BufferedImage srcImage,
int destWidth,
int destHeight,
java.awt.Color initialColor)
Purpose Create a new BufferedImage object, its size is destWidth*destHeight
If the size is samller than the source image, copy that part from source image to this new image; While if the size is bigger, copy the whole source image to this new image, and the part beyond will be filled by initialColor This method is used when drag to resize an image in ImageManager2 |
static java.awt.image.BufferedImage |
getCopiedImage(java.awt.image.BufferedImage srcImage,
int srcOffsetX,
int srcOffsetY,
int destOffsetX,
int destOffsetY,
int destWidth,
int destHeight,
java.awt.Color initialColor)
Purpose Copy the source image to a new image, whose width and height are given
by destWidth and destHeight; The area of new image outside of the source image will be filled with the color provided by parameter. |
static int |
getMask(int length) |
static java.awt.image.BufferedImage |
getVoidBufferImage(int width,
int height,
int defaultType,
int altType)
Purpose Create a new BufferedImage Object with a certain type.
|
static java.awt.image.BufferedImage |
rotateImage(java.awt.image.BufferedImage bufferedimage,
int angle)
Rotate the Image with 90, 180 or 270 degree.
|
static void |
saveImageToFile(java.awt.image.BufferedImage image,
java.io.File file)
Store our BufferedImage into a File.
|
static void |
saveImageToFile(java.awt.image.BufferedImage image,
java.io.File file,
float quality)
Store our BufferedImage into a File;
If the format is JPG, the third parameter indicate the compression quality.
|
public static java.awt.image.BufferedImage convertImage(com.android.ddmlib.RawImage rawImage, java.awt.image.BufferedImage image)
rawImage
- the raw image to convertimage
- the old image to (possibly) recyclepublic static java.awt.image.BufferedImage convertImage(com.android.ddmlib.RawImage rawImage)
rawImage
- the image to convert.public static int getMask(int length)
public static java.awt.image.BufferedImage rotateImage(java.awt.image.BufferedImage bufferedimage, int angle)
bufferedimage
- angle
- int, the angle the image will be rotated, in 360 degree
only 90, 180 or 270 degree are supported.public static void saveImageToFile(java.awt.image.BufferedImage image, java.io.File file, float quality) throws AndroidRuntimeException
image
- - BufferedImage for ImageIO to write to filefile
- - valid full absolute File to write toquality
- - If the file format is JPG, it indicates the compression quality.
It's value should be between 0.0 and 1.0;AndroidRuntimeException
public static void saveImageToFile(java.awt.image.BufferedImage image, java.io.File file) throws java.lang.SecurityException, java.lang.IllegalArgumentException, java.io.IOException, java.lang.NoClassDefFoundError
image
- - BufferedImage for ImageIO to write to filefile
- -- valid full absolute File to write tojava.lang.SecurityException
- thrown if permission to write to the location is deniedjava.lang.IllegalArgumentException
- if ImageIO doesn't like our invocationjava.io.IOException
- if an error occurs while writing.java.lang.NoClassDefFoundError
- if support for ImageIO is not found (Java Advanced Imaging)public static java.awt.image.BufferedImage getVoidBufferImage(int width, int height, int defaultType, int altType)
width
- height
- defaultType
- The type of the new BufferedImagealtType
- If the default type can not be used to create a BufferedImage,public static java.awt.image.BufferedImage getCopiedImage(java.awt.image.BufferedImage srcImage, int destWidth, int destHeight, java.awt.Color initialColor)
srcImage
- BufferedImage, The source image to be copied.destWidth
- int, the destination image widthdestHeight
- int, the destination image heightinitialColor
- Color, the color to paint on the destination image as initial colorpublic static java.awt.image.BufferedImage getCopiedImage(java.awt.image.BufferedImage srcImage, int srcOffsetX, int srcOffsetY, int destOffsetX, int destOffsetY, int destWidth, int destHeight, java.awt.Color initialColor)
srcImage
- BufferedImage, The source image to be copied.srcOffsetX
- int, the x coordination in source image to begin copysrcOffsetY
- int, the y coordination in source image to begin copydestOffsetX
- int, the x coordination in destination image to begin pastedestOffsetY
- int, the y coordination in destination image to begin pastedestWidth
- int, the destination image widthdestHeight
- int, the destination image heightinitialColor
- Color, the color to paint on the destination image as initial colorpublic static void debug(java.lang.String message)
Copyright © SAS Institute. All Rights Reserved.