public class LazyImage extends BaseLazyImage implements ImageMatrix
open()可以在不将图像全部解码加载到内存而获取图像的基本信息read(ImageReadParam)使用内存做cache读取(不使用临时文件做cache)read(Rectangle, ImageTypeSpecifier)可以对图像指定区域解码autoClose, height, imgBytes, localFile, matrixBGR, matrixGray, matrixRGB, matrixRGBA, md5, suffix, width| Constructor and Description |
|---|
LazyImage(java.awt.image.BufferedImage bufferedImage) |
LazyImage(byte[] imgBytes) |
LazyImage(java.io.File src,
java.lang.String md5)
用本地图像文件创建对象
|
LazyImage(T src)
多源创建对象
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
释放资源
|
static LazyImage |
create(java.awt.image.BufferedImage bufferedImage)
创建对象
|
static LazyImage |
create(byte[] imgBytes)
创建并打开对象
|
static LazyImage |
create(java.io.File file,
java.lang.String md5)
用本地图像文件创建对象
|
static <T> LazyImage |
create(T src)
多源创建对象
|
void |
finalize() |
byte[] |
getMatrixBGR()
对图像解码返回BGR格式矩阵数据
|
byte[] |
getMatrixGray()
对图像数据指定的区域解码返回灰度图像数据
|
byte[] |
getMatrixRGB()
对图像解码返回RGB格式矩阵数据
|
byte[] |
getMatrixRGBA()
对图像解码返回RGBA格式矩阵数据
|
java.awt.Rectangle |
getRectangle()
获取图像矩形对象
|
LazyImage |
open()
通过
ImageReader来读取图像基本信息,检查图像数据有效性 |
java.awt.image.BufferedImage |
read() |
protected java.awt.image.BufferedImage |
read(javax.imageio.ImageReadParam param)
对图像数据解码生成
BufferedImage对象 |
java.awt.image.BufferedImage |
read(java.awt.Rectangle rect,
javax.imageio.ImageTypeSpecifier destinationType)
对图像数据指定的区域解码
|
byte[] |
wirteJPEGBytes() |
byte[] |
wirtePNGBytes() |
getHeight, getImgBytes, getLazyImageFactory, getLocalFile, getMd5, getSuffix, getWidth, save, setAutoClose, wirteJPEG, wirtePNGBclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHeight, getWidthpublic LazyImage(java.awt.image.BufferedImage bufferedImage)
bufferedImage - 已经解码的图像数据,为null或为空,则抛出 IllegalArgumentExceptionpublic LazyImage(byte[] imgBytes)
imgBytes - 图像数据,imgBytes为null或为空,则抛出 IllegalArgumentExceptionpublic LazyImage(java.io.File src, java.lang.String md5) throws java.io.FileNotFoundException
src - md5 - java.io.FileNotFoundExceptionpublic LazyImage(T src) throws java.io.IOException
src - java.io.IOExceptionFaceUtilits.getBytesNotEmpty(Object)public LazyImage open() throws UnsupportedFormatException, NotImageException
ImageReader来读取图像基本信息,检查图像数据有效性open in class BaseLazyImageUnsupportedFormatExceptionNotImageExceptionprotected java.awt.image.BufferedImage read(javax.imageio.ImageReadParam param) throws UnsupportedFormatException
BufferedImage对象param - 图像读取参数对象,为null使用默认参数ImageReader.getDefaultReadParam()UnsupportedFormatExceptionImageReadParampublic java.awt.image.BufferedImage read() throws UnsupportedFormatException
UnsupportedFormatExceptionpublic java.awt.image.BufferedImage read(java.awt.Rectangle rect, javax.imageio.ImageTypeSpecifier destinationType) throws UnsupportedFormatException
rect - 解码区域对象, 默认(null)全图解码IIOParam.setSourceRegion(Rectangle)destinationType - 目标图像的所需图像类型,默认为null, ImageTypeSpecifier destinationType=ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_3BYTE_BGR);
ImageReadParam.setDestinationType(ImageTypeSpecifier)UnsupportedFormatExceptionread(ImageReadParam)public byte[] getMatrixRGBA() throws UnsupportedFormatException
ImageMatrixgetMatrixRGBA in interface ImageMatrixUnsupportedFormatExceptionpublic byte[] getMatrixRGB() throws UnsupportedFormatException
ImageMatrixgetMatrixRGB in interface ImageMatrixUnsupportedFormatExceptionpublic byte[] getMatrixBGR() throws UnsupportedFormatException
ImageMatrixgetMatrixBGR in interface ImageMatrixUnsupportedFormatExceptionpublic byte[] getMatrixGray() throws UnsupportedFormatException
getMatrixGray in interface ImageMatrixUnsupportedFormatExceptionpublic byte[] wirtePNGBytes()
wirtePNGBytes in class BaseLazyImagepublic byte[] wirteJPEGBytes()
wirteJPEGBytes in class BaseLazyImagepublic static LazyImage create(byte[] imgBytes) throws NotImageException, UnsupportedFormatException
imgBytes - NotImageExceptionUnsupportedFormatExceptionLazyImage(byte[]),
open()public static LazyImage create(java.awt.image.BufferedImage bufferedImage)
bufferedImage - LazyImage(BufferedImage),
open()public static LazyImage create(java.io.File file, java.lang.String md5) throws NotImageException, UnsupportedFormatException
file - md5 - file的MD5较验码,可以为nullNotImageExceptionUnsupportedFormatExceptionpublic static <T> LazyImage create(T src) throws NotImageException, UnsupportedFormatException
src - NotImageExceptionUnsupportedFormatExceptionLazyImage(Object),
FaceUtilits.getBytesNotEmpty(Object)public void close() throws java.io.IOException
close in class BaseLazyImagejava.io.IOExceptionpublic void finalize() throws java.lang.Throwable
finalize in class BaseLazyImagejava.lang.Throwablepublic java.awt.Rectangle getRectangle()
Copyright © 2019. All rights reserved.