net.gdface.image.LazyImageFactoryByBitmap Maven / Gradle / Ivy
package net.gdface.image;
import java.io.File;
import android.graphics.Bitmap;
import net.gdface.utils.Assert;
public class LazyImageFactoryByBitmap implements LazyImageFactory {
public LazyImageFactoryByBitmap() {
}
@Override
public BaseLazyImage create(byte[] imgBytes) throws NotImageException, UnsupportedFormatException {
return LazyImage.create(imgBytes);
}
@Override
public BaseLazyImage create(File file, String md5) throws NotImageException, UnsupportedFormatException {
return LazyImage.create(file, md5);
}
@Override
public BaseLazyImage create(T src) throws NotImageException, UnsupportedFormatException {
if(src instanceof Bitmap){
return LazyImage.create((Bitmap)src);
}
return LazyImage.create(src);
}
@Override
public BaseLazyImage createByImageObject(T imgObj){
Assert.notNull(imgObj, "imageObj");
if(imgObj instanceof Bitmap){
return LazyImage.create((Bitmap)imgObj);
}
throw new IllegalArgumentException(
String.format("UNSUPPORTED image type: %s, android.graphics.Bitmap required",
imgObj.getClass().getName()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy