public class OAImageUtil extends Object
Constructor and Description |
---|
OAImageUtil() |
Modifier and Type | Method and Description |
---|---|
static BufferedImage |
brighter(Image image,
byte offset) |
static BufferedImage |
contrast(Image image,
float scale) |
static String |
convertOAPropertyToImageServlet(String html) |
static String |
convertOAPropertyToImageServlet(String html,
String servletPath) |
static BufferedImage |
convertToBufferedImage(byte[] bs)
Use a byte array to create an image.
|
static BufferedImage |
convertToBufferedImage(Image img) |
static byte[] |
convertToBytes(BufferedImage bi)
calls convertToJavaJPG(bi).
|
static byte[] |
convertToBytes(Image img)
Converts image to bufferedImage and then returns
convertToBytes(BufferedImage bi).
|
static byte[] |
convertToJavaJPG(BufferedImage bi)
Converts a bufferedImage to a "java only" byte array "jpg" image.
|
static byte[] |
convertToJPG(BufferedImage bi) |
static byte[] |
convertToJPG(byte[] bs) |
static byte[] |
convertToJPG(Image img) |
static byte[] |
convertToPNG(BufferedImage bi) |
static byte[] |
convertToPNG(BufferedImage bi,
int bufferSize) |
static byte[] |
convertToPNG(byte[] bs) |
static byte[] |
convertToPNG(Image img) |
static BufferedImage |
createBufferedImage(Image img)
Creates a new BufferedImage with the given image.
|
static BufferedImage |
createScreenBufferedImage(Graphics2D g2d,
int width,
int height) |
static BufferedImage |
createScreenBufferedImage(int width,
int height) |
static BufferedImage |
crop(Image image,
int l,
int t,
int r,
int b) |
static BufferedImage |
crop(Image image,
Rectangle rect) |
static ColorModel |
getColorModel(Image img) |
static String |
getHtmlForJarImg(String classPath,
String fileName) |
static String |
getHtmlForJarImg(String classPath,
String fileName,
int maxW,
int maxH)
ex: /com/vetplan/view/image, or com.vetplan.view.image
will return:
![]() |
static BufferedImage |
getScaledInstance(Image image,
int newWidth,
int newHeight) |
static BufferedImage |
getScreenImage() |
static BufferedImage |
getScreenImage(Rectangle rect) |
static BufferedImage |
getScreenImage(Window window) |
static boolean |
hasAlpha(Image img) |
protected static BufferedImage |
loadCMYK(InputStream is) |
static BufferedImage |
loadImage(File file)
Uses imageio to read an image.
|
static void |
loadImage(Image img) |
static BufferedImage |
loadImage(InputStream is) |
static BufferedImage |
loadImage(String fname) |
static BufferedImage |
loadImage(URL url) |
static BufferedImage |
loadImage(URLConnection conn) |
static BufferedImage |
loadImageUsingURL(String urlString) |
static BufferedImage |
loadImageUsingURL(URL url) |
static BufferedImage |
loadWebImage(String url) |
static byte[] |
loadWebImageBytes(String url) |
static void |
main(String[] args) |
static void |
mainA(String[] args) |
static void |
mainB(String[] args) |
static void |
mainx(String[] args) |
static void |
mainZ(String[] args) |
static BufferedImage |
removeAlphaChannel(BufferedImage src) |
static BufferedImage |
removeTransparency(Image image) |
static BufferedImage |
rotate(Image image,
int degrees) |
static void |
saveAsGif(Image image,
File file) |
static boolean |
saveAsJpeg(Image img,
File file) |
static boolean |
saveAsJpeg(Image img,
File file,
float quality) |
static void |
saveAsPng(Image image,
File file) |
static BufferedImage |
scale(Image image,
double xPercent,
double yPercent) |
static BufferedImage |
scale(Image image,
int newWidth,
int newHeight) |
static BufferedImage |
scaleDownToSize(Image image,
int maxWidth,
int maxHeight) |
static BufferedImage |
scaleToSize(Image image,
int maxWidth,
int maxHeight) |
static BufferedImage |
setTransparentColor(Image img,
Color color) |
static void |
test() |
public static BufferedImage convertToBufferedImage(byte[] bs) throws IOException
IOException
public static void loadImage(Image img)
public static BufferedImage createBufferedImage(Image img)
public static boolean hasAlpha(Image img)
public static ColorModel getColorModel(Image img)
public static BufferedImage convertToBufferedImage(Image img)
img
- if this is a BufferedImage, then it will be returned, else a
BufferedImage will be created.public static byte[] convertToBytes(BufferedImage bi) throws IOException
IOException
public static byte[] convertToJavaJPG(BufferedImage bi) throws IOException
IOException
public static byte[] convertToPNG(Image img) throws IOException
IOException
public static byte[] convertToPNG(byte[] bs) throws IOException
IOException
public static byte[] convertToPNG(BufferedImage bi) throws IOException
IOException
public static byte[] convertToPNG(BufferedImage bi, int bufferSize) throws IOException
IOException
public static byte[] convertToJPG(Image img) throws IOException
IOException
public static byte[] convertToJPG(BufferedImage bi) throws IOException
IOException
public static byte[] convertToJPG(byte[] bs) throws IOException
IOException
public static byte[] convertToBytes(Image img) throws IOException
IOException
public static BufferedImage crop(Image image, Rectangle rect)
public static BufferedImage crop(Image image, int l, int t, int r, int b)
public static BufferedImage scale(Image image, double xPercent, double yPercent)
public static BufferedImage getScaledInstance(Image image, int newWidth, int newHeight)
public static BufferedImage scaleToSize(Image image, int maxWidth, int maxHeight)
public static BufferedImage scaleDownToSize(Image image, int maxWidth, int maxHeight)
public static BufferedImage scale(Image image, int newWidth, int newHeight)
public static BufferedImage rotate(Image image, int degrees)
public static BufferedImage loadImage(String fname) throws IOException
IOException
public static BufferedImage loadImage(File file) throws IOException
IOException
public static boolean saveAsJpeg(Image img, File file, float quality)
img
- file
- quality
- between 0.0 and 1.0, 0=best compressionpublic static BufferedImage getScreenImage()
public static BufferedImage getScreenImage(Window window)
public static BufferedImage getScreenImage(Rectangle rect)
public static BufferedImage brighter(Image image, byte offset)
offset
- to add to each pixel, between 0-255public static BufferedImage contrast(Image image, float scale)
scale
- contrast multiplierpublic static BufferedImage removeTransparency(Image image)
public static BufferedImage setTransparentColor(Image img, Color color)
public static BufferedImage loadImageUsingURL(URL url)
public static BufferedImage loadImageUsingURL(String urlString)
public static BufferedImage loadImage(URLConnection conn)
public static BufferedImage loadImage(URL url)
public static BufferedImage loadImage(InputStream is) throws Exception
Exception
protected static BufferedImage loadCMYK(InputStream is) throws Exception
Exception
public static String getHtmlForJarImg(String classPath, String fileName, int maxW, int maxH)
com.viaoa.jfc.editor.html.protocol.classpath.Handler
public static BufferedImage createScreenBufferedImage(int width, int height)
public static BufferedImage createScreenBufferedImage(Graphics2D g2d, int width, int height)
public static String convertOAPropertyToImageServlet(String html, String servletPath)
public static BufferedImage removeAlphaChannel(BufferedImage src)
public static BufferedImage loadWebImage(String url) throws Exception
Exception
Copyright © 1999–2019 ViaOA. All rights reserved.