@Override public Resource<GifBitmapWrapper> transform(Resource<GifBitmapWrapper> resource, int outWidth, int outHeight) { Resource<Bitmap> bitmapResource = resource.get().getBitmapResource(); if (bitmapResource != null) { Resource<Bitmap> transformed = wrapped.transform(bitmapResource, outWidth, outHeight); if (transformed != bitmapResource) { GifBitmapWrapper gifBitmap = new GifBitmapWrapper(transformed, null); return new GifBitmapWrapperResource(gifBitmap); } } else { //TODO: this should be pushed down into a GifData transformation? Resource<GifData> gifResource = resource.get().getGifResource(); GifData gifData = gifResource.get(); Transformation<Bitmap> newTransformation = new MultiTransformation<Bitmap>(gifData.getFrameTransformation(), wrapped); gifData.setFrameTransformation(newTransformation); return new GifBitmapWrapperResource(new GifBitmapWrapper(null, new GifDataResource(gifData))); } return resource; }
public ImageVideoGifDataLoadProvider(DataLoadProvider<ImageVideoWrapper, Bitmap> bitmapProvider, DataLoadProvider<InputStream, GifData> gifProvider) { cacheDecoder = new GifBitmapWrapperStreamResourceDecoder(new GifBitmapWrapperResourceDecoder( bitmapProvider.getSourceDecoder(), gifProvider.getCacheDecoder())); sourceDecoder = new GifBitmapWrapperResourceDecoder( bitmapProvider.getSourceDecoder(), gifProvider.getSourceDecoder()); encoder = new GifBitmapWrapperResourceEncoder(bitmapProvider.getEncoder(), gifProvider.getEncoder()); }
@Override public Resource<GifDrawable> transcode(Resource<GifData> toTranscode) { return new GifDrawableResource(toTranscode); }
public GifBitmapWrapperResourceDecoder(ResourceDecoder<ImageVideoWrapper, Bitmap> bitmapDecoder, ResourceDecoder<InputStream, GifData> gifDecoder) { this.bitmapDecoder = bitmapDecoder; this.gifDecoder = gifDecoder; }
public GifBitmapWrapper(Resource<Bitmap> bitmapResource, Resource<GifData> gifResource) { this.bitmapResource = bitmapResource; this.gifResource = gifResource; }
public Resource<GifData> getGifResource() { return gifResource; }
public GifBitmapWrapperResourceEncoder(ResourceEncoder<Bitmap> bitmapEncoder, ResourceEncoder<GifData> gifEncoder) { this.bitmapEncoder = bitmapEncoder; this.gifEncoder = gifEncoder; }