Back to project page AndroidImageCache.
The source code is released under:
Przemys?aw Jakubczyk Polidea Sp. z o.o. Copyright (c) 2012 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the follo...
If you think the Android project AndroidImageCache listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package pl.polidea.webimageview.processor; /* w ww . ja v a 2s .c o m*/ import android.graphics.Bitmap; import pl.polidea.webimageview.BitmapDecodeException; import pl.polidea.webimageview.Bitmaps; /** * @author Mateusz Grzechoci?ski <mateusz.grzechocinski@pl.polidea.pl> */ public class Processor { ProcessorType type; int width; int height; Processor(final ProcessorType type) { this.type = type; } Processor(final ProcessorType type, final int width, final int height) { this.type = type; this.width = width; this.height = height; } @Override public String toString() { return "Processor [type=" + type + ", width=" + width + ", height=" + height + "]"; } public Bitmap processBitmap(Bitmaps bitmaps) throws BitmapDecodeException { return type.processBitmap(bitmaps, width, height); } /** * @author Mateusz Grzechoci?ski <mateusz.grzechocinski@pl.polidea.pl> */ public enum ProcessorType { ORIGNAL { @Override public Bitmap processBitmap(Bitmaps bitmaps, int width, int height) throws BitmapDecodeException { return bitmaps.generateBitmap(); } }, FIX_WIDTH { @Override public Bitmap processBitmap(Bitmaps bitmaps, int width, int height) throws BitmapDecodeException { return bitmaps.generateScaledWidthBitmap(width); } }, FIX_HEIGHT { @Override public Bitmap processBitmap(Bitmaps bitmaps, int width, int height) throws BitmapDecodeException { return bitmaps.generateScaledHeightBitmap(height); } }, FIX_BOTH { @Override public Bitmap processBitmap(Bitmaps bitmaps, int width, int height) throws BitmapDecodeException { return bitmaps.generateBitmap(width, height); } }; public abstract Bitmap processBitmap(Bitmaps bitmaps, int width, int height) throws BitmapDecodeException; } }