com.bumptech.glide.load.Transformation Java Examples

The following examples show how to use com.bumptech.glide.load.Transformation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GifResourceDecoder.java    From giffun with Apache License 2.0 6 votes vote down vote up
private GifDrawableResource decode(byte[] data, int width, int height, GifHeaderParser parser, GifDecoder decoder) {
    final GifHeader header = parser.parseHeader();
    if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) {
        // If we couldn't decode the GIF, we will end up with a frame count of 0.
        return null;
    }

    Bitmap firstFrame = decodeFirstFrame(decoder, header, data);
    if (firstFrame == null) {
        return null;
    }

    Transformation<Bitmap> unitTransformation = UnitTransformation.get();

    GifDrawable gifDrawable = new GifDrawable(context, provider, bitmapPool, unitTransformation, width, height,
            header, data, firstFrame);

    return new GifDrawableResource(gifDrawable);
}
 
Example #2
Source File: DecodeJob.java    From giffun with Apache License 2.0 6 votes vote down vote up
DecodeJob(EngineKey resultKey, int width, int height, DataFetcher<A> fetcher,
        DataLoadProvider<A, T> loadProvider, Transformation<T> transformation, ResourceTranscoder<T, Z> transcoder,
        DiskCacheProvider diskCacheProvider, DiskCacheStrategy diskCacheStrategy, Priority priority, FileOpener
        fileOpener) {
    this.resultKey = resultKey;
    this.width = width;
    this.height = height;
    this.fetcher = fetcher;
    this.loadProvider = loadProvider;
    this.transformation = transformation;
    this.transcoder = transcoder;
    this.diskCacheProvider = diskCacheProvider;
    this.diskCacheStrategy = diskCacheStrategy;
    this.priority = priority;
    this.fileOpener = fileOpener;
}
 
Example #3
Source File: GifDrawable.java    From giffun with Apache License 2.0 6 votes vote down vote up
public GifState(GifHeader header, byte[] data, Context context,
        Transformation<Bitmap> frameTransformation, int targetWidth, int targetHeight,
        GifDecoder.BitmapProvider provider, BitmapPool bitmapPool, Bitmap firstFrame) {
    if (firstFrame == null) {
        throw new NullPointerException("The first frame of the GIF must not be null");
    }
    gifHeader = header;
    this.data = data;
    this.bitmapPool = bitmapPool;
    this.firstFrame = firstFrame;
    this.context = context.getApplicationContext();
    this.frameTransformation = frameTransformation;
    this.targetWidth = targetWidth;
    this.targetHeight = targetHeight;
    bitmapProvider = provider;
}
 
Example #4
Source File: GifResourceEncoder.java    From giffun with Apache License 2.0 5 votes vote down vote up
private Resource<Bitmap> getTransformedFrame(Bitmap currentFrame, Transformation<Bitmap> transformation,
        GifDrawable drawable) {
    // TODO: what if current frame is null?
    Resource<Bitmap> bitmapResource = factory.buildFrameResource(currentFrame, bitmapPool);
    Resource<Bitmap> transformedResource = transformation.transform(bitmapResource,
            drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    if (!bitmapResource.equals(transformedResource)) {
        bitmapResource.recycle();
    }
    return transformedResource;
}
 
Example #5
Source File: EngineKey.java    From giffun with Apache License 2.0 5 votes vote down vote up
public EngineKey(String id, Key signature, int width, int height, ResourceDecoder cacheDecoder,
        ResourceDecoder decoder, Transformation transformation, ResourceEncoder encoder,
        ResourceTranscoder transcoder, Encoder sourceEncoder) {
    this.id = id;
    this.signature = signature;
    this.width = width;
    this.height = height;
    this.cacheDecoder = cacheDecoder;
    this.decoder = decoder;
    this.transformation = transformation;
    this.encoder = encoder;
    this.transcoder = transcoder;
    this.sourceEncoder = sourceEncoder;
}
 
Example #6
Source File: GlideUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取图片处理效果加载配置
 * @param options        {@link RequestOptions}
 * @param transformation {@link Transformation} 图形效果
 * @return {@link RequestOptions}
 */
public static RequestOptions transformationOptions(final RequestOptions options, final Transformation transformation) {
    if (options != null) {
        try {
            options.transform(transformation);
        } catch (Exception e) {
            LogPrintUtils.eTag(TAG, e, "transformationOptions");
        }
    }
    return options;
}
 
Example #7
Source File: Camera1Fragment.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private void onCaptureClicked() {
  orderEnforcer.reset();

  Stopwatch fastCaptureTimer = new Stopwatch("Capture");

  camera.capture((jpegData, frontFacing) -> {
    fastCaptureTimer.split("captured");

    Transformation<Bitmap> transformation = frontFacing ? new MultiTransformation<>(new CenterCrop(), new FlipTransformation())
                                                        : new CenterCrop();

    GlideApp.with(this)
            .asBitmap()
            .load(jpegData)
            .transform(transformation)
            .override(cameraPreview.getWidth(), cameraPreview.getHeight())
            .into(new SimpleTarget<Bitmap>() {
              @Override
              public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                fastCaptureTimer.split("transform");

                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                resource.compress(Bitmap.CompressFormat.JPEG, 80, stream);
                fastCaptureTimer.split("compressed");

                byte[] data = stream.toByteArray();
                fastCaptureTimer.split("bytes");
                fastCaptureTimer.stop(TAG);

                controller.onImageCaptured(data, resource.getWidth(), resource.getHeight());
              }

              @Override
              public void onLoadFailed(@Nullable Drawable errorDrawable) {
                controller.onCameraError();
              }
            });
  });
}
 
Example #8
Source File: GifDrawable.java    From giffun with Apache License 2.0 5 votes vote down vote up
public void setFrameTransformation(Transformation<Bitmap> frameTransformation, Bitmap firstFrame) {
    if (firstFrame == null) {
        throw new NullPointerException("The first frame of the GIF must not be null");
    }
    if (frameTransformation == null) {
        throw new NullPointerException("The frame transformation must not be null");
    }
    state.frameTransformation = frameTransformation;
    state.firstFrame = firstFrame;
    frameLoader.setFrameTransformation(frameTransformation);
}
 
Example #9
Source File: ImageLoader.java    From AccountBook with GNU General Public License v3.0 5 votes vote down vote up
private void loadImageView(Object object, int placeholderId, int errorId, Transformation transform, ImageView imageView){
    DrawableRequestBuilder builder = load(object, with());
    if(builder != null){
        // 设置占位图
        if(placeholderId != -1) builder.placeholder(placeholderId);
        // 设置加载错误时占位图
        if(errorId != -1)       builder.error(errorId);
        // 设置 transform
        if(transform != null)   builder.bitmapTransform(transform);
        // 加载到图片
        builder.into(imageView);
    }
}
 
Example #10
Source File: EngineKeyFactory.java    From giffun with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public EngineKey buildKey(String id, Key signature, int width, int height, ResourceDecoder cacheDecoder,
        ResourceDecoder sourceDecoder, Transformation transformation, ResourceEncoder encoder,
        ResourceTranscoder transcoder, Encoder sourceEncoder) {
    return new EngineKey(id, signature, width, height, cacheDecoder, sourceDecoder, transformation, encoder,
            transcoder, sourceEncoder);
}
 
Example #11
Source File: TestFragment.java    From glide-support with The Unlicense 5 votes vote down vote up
private BitmapDrawable transformDrawable(Drawable drawable, Transformation<Bitmap> transform, int size) {
	// render original
	Bitmap bitmap = Bitmap.createBitmap(size, size, Config.ARGB_8888);
	Canvas canvas = new Canvas(bitmap);
	drawable.setBounds(0, 0, size, size);
	drawable.draw(canvas);
	// make rounded
	Resource<Bitmap> original = BitmapResource.obtain(bitmap, Glide.get(getContext()).getBitmapPool());
	Resource<Bitmap> rounded = transform.transform(original, size, size);
	if (!original.equals(rounded)) {
		original.recycle();
	}
	return new BitmapDrawable(getResources(), rounded.get());
}
 
Example #12
Source File: GifFrameLoader.java    From giffun with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void setFrameTransformation(Transformation<Bitmap> transformation) {
    if (transformation == null) {
        throw new NullPointerException("Transformation must not be null");
    }
    requestBuilder = requestBuilder.transform(transformation);
}
 
Example #13
Source File: GenericRequestBuilder.java    From giffun with Apache License 2.0 5 votes vote down vote up
/**
 * Transform resources with the given {@link Transformation}s. Replaces any existing transformation or
 * transformations.
 *
 * @param transformations the transformations to apply in order.
 * @return This request builder.
 */
public GenericRequestBuilder<ModelType, DataType, ResourceType, TranscodeType> transform(
        Transformation<ResourceType>... transformations) {
    isTransformationSet = true;
    if (transformations.length == 1) {
        transformation = transformations[0];
    } else {
        transformation = new MultiTransformation<ResourceType>(transformations);
    }

    return this;
}
 
Example #14
Source File: GifRequestBuilder.java    From giffun with Apache License 2.0 5 votes vote down vote up
private GifDrawableTransformation[] toGifTransformations(Transformation<Bitmap>[] bitmapTransformations) {
    GifDrawableTransformation[] transformations = new GifDrawableTransformation[bitmapTransformations.length];
    for (int i = 0; i < bitmapTransformations.length; i++) {
        transformations[i] = new GifDrawableTransformation(bitmapTransformations[i], glide.getBitmapPool());
    }
    return transformations;
}
 
Example #15
Source File: GlideImageLoader.java    From NIM_Android_UIKit with MIT License 5 votes vote down vote up
private static void displayAlbum(ImageView imageView, String path, Transformation<Bitmap> transformation,
                                 int placeHoder) {
    Context context = imageView.getContext();
    RequestOptions options = new RequestOptions().error(placeHoder).placeholder(placeHoder).diskCacheStrategy(
            DiskCacheStrategy.RESOURCE);

    if (transformation != null) {
        options = options.transforms(new CenterCrop(), transformation);
    } else {
        options = options.transform(new CenterCrop());
    }

    Glide.with(context).asDrawable().apply(options).load(Uri.fromFile(new File(path))).into(imageView);
}
 
Example #16
Source File: GlideImageConfig.java    From AcgClub with MIT License 4 votes vote down vote up
public Transformation<Bitmap> getTransformation() {
  return transformation;
}
 
Example #17
Source File: GlideTransformHook.java    From DoraemonKit with Apache License 2.0 4 votes vote down vote up
public static Transformation<Bitmap> transform(Object baseRequestOptions, Object transformation) {
    return new DokitGlideTransform(baseRequestOptions, transformation);
}
 
Example #18
Source File: DokitGlideTransform.java    From DoraemonKit with Apache License 2.0 4 votes vote down vote up
public DokitGlideTransform(Object mRequestBuilder, Object transformation) {
    this.mRequestBuilder = mRequestBuilder;
    if (transformation instanceof Transformation) {
        this.mWrap = (Transformation) transformation;
    }
}
 
Example #19
Source File: Engine.java    From giffun with Apache License 2.0 4 votes vote down vote up
/**
 * Starts a load for the given arguments. Must be called on the main thread.
 *
 * <p>
 *     The flow for any request is as follows:
 *     <ul>
 *         <li>Check the memory cache and provide the cached resource if present</li>
 *         <li>Check the current set of actively used resources and return the active resource if present</li>
 *         <li>Check the current set of in progress loads and add the cb to the in progress load if present</li>
 *         <li>Start a new load</li>
 *     </ul>
 * </p>
 *
 * <p>
 *     Active resources are those that have been provided to at least one request and have not yet been released.
 *     Once all consumers of a resource have released that resource, the resource then goes to cache. If the
 *     resource is ever returned to a new consumer from cache, it is re-added to the active resources. If the
 *     resource is evicted from the cache, its resources are recycled and re-used if possible and the resource is
 *     discarded. There is no strict requirement that consumers release their resources so active resources are
 *     held weakly.
 * </p>
 *
 * @param signature A non-null unique key to be mixed into the cache key that identifies the version of the data to
 *                  be loaded.
 * @param width The target width in pixels of the desired resource.
 * @param height The target height in pixels of the desired resource.
 * @param fetcher The fetcher to use to retrieve data not in the disk cache.
 * @param loadProvider The load provider containing various encoders and decoders use to decode and encode data.
 * @param transformation The transformation to use to transform the decoded resource.
 * @param transcoder The transcoder to use to transcode the decoded and transformed resource.
 * @param priority The priority with which the request should run.
 * @param isMemoryCacheable True if the transcoded resource can be cached in memory.
 * @param diskCacheStrategy The strategy to use that determines what type of data, if any,
 *                          will be cached in the local disk cache.
 * @param cb The callback that will be called when the load completes.
 *
 * @param <T> The type of data the resource will be decoded from.
 * @param <Z> The type of the resource that will be decoded.
 * @param <R> The type of the resource that will be transcoded from the decoded resource.
 */
public <T, Z, R> LoadStatus load(Key signature, int width, int height, DataFetcher<T> fetcher,
        DataLoadProvider<T, Z> loadProvider, Transformation<Z> transformation, ResourceTranscoder<Z, R> transcoder,
        Priority priority, boolean isMemoryCacheable, DiskCacheStrategy diskCacheStrategy, ResourceCallback cb) {
    Util.assertMainThread();
    long startTime = LogTime.getLogTime();

    final String id = fetcher.getId();
    EngineKey key = keyFactory.buildKey(id, signature, width, height, loadProvider.getCacheDecoder(),
            loadProvider.getSourceDecoder(), transformation, loadProvider.getEncoder(),
            transcoder, loadProvider.getSourceEncoder());

    EngineResource<?> cached = loadFromCache(key, isMemoryCacheable);
    if (cached != null) {
        cb.onResourceReady(cached);
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            logWithTimeAndKey("Loaded resource from cache", startTime, key);
        }
        return null;
    }

    EngineResource<?> active = loadFromActiveResources(key, isMemoryCacheable);
    if (active != null) {
        cb.onResourceReady(active);
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            logWithTimeAndKey("Loaded resource from active resources", startTime, key);
        }
        return null;
    }

    EngineJob current = jobs.get(key);
    if (current != null) {
        current.addCallback(cb);
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            logWithTimeAndKey("Added to existing load", startTime, key);
        }
        return new LoadStatus(cb, current);
    }

    EngineJob engineJob = engineJobFactory.build(key, isMemoryCacheable);
    DecodeJob<T, Z, R> decodeJob = new DecodeJob<T, Z, R>(key, width, height, fetcher, loadProvider, transformation,
            transcoder, diskCacheProvider, diskCacheStrategy, priority);
    EngineRunnable runnable = new EngineRunnable(engineJob, decodeJob, priority);
    jobs.put(key, engineJob);
    engineJob.addCallback(cb);
    engineJob.start(runnable);

    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        logWithTimeAndKey("Started new load", startTime, key);
    }
    return new LoadStatus(cb, engineJob);
}
 
Example #20
Source File: GlideImageLoaderConfig.java    From NewFastFrame with Apache License 2.0 4 votes vote down vote up
public Transformation<Bitmap> getBitmapTransformation() {
    return bitmapTransformation;
}
 
Example #21
Source File: GlideImageLoaderConfig.java    From NewFastFrame with Apache License 2.0 4 votes vote down vote up
public Builder bitmapTransformation(Transformation<Bitmap> val) {
    bitmapTransformation = val;
    return this;
}
 
Example #22
Source File: GlideLoader.java    From ImageLoader with Apache License 2.0 4 votes vote down vote up
private Transformation[] getBitmapTransFormations(SingleConfig config) {

        Transformation[] forms = null;
        int shapeMode = config.getShapeMode();
        List<Transformation> transformations = new ArrayList<>();

        if(config.isCropFace()){
            // transformations.add(new FaceCenterCrop());//脸部识别
        }

        if(config.getScaleMode() == ScaleMode.CENTER_CROP){
            transformations.add(new CenterCrop(config.getContext()));
        }else{
            transformations.add(new FitCenter(config.getContext()));
        }


        if(config.isNeedBlur()){
            transformations.add(new BlurTransformation(config.getContext(), config.getBlurRadius()));
        }

        switch (shapeMode){
            case ShapeMode.RECT:

                if(config.getBorderWidth()>0){

                }
                break;
            case ShapeMode.RECT_ROUND:
            case ShapeMode.RECT_ROUND_ONLY_TOP:

                RoundedCornersTransformation.CornerType cornerType = RoundedCornersTransformation.CornerType.ALL;
                if(shapeMode == ShapeMode.RECT_ROUND_ONLY_TOP){
                    cornerType = RoundedCornersTransformation.CornerType.TOP;
                }
                /*transformations.add(new BorderRoundTransformation2(config.getContext(),
                        config.getRectRoundRadius(), 0,config.getBorderWidth(),
                        config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));*/

                if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add(new BorderRoundTransformation(config.getContext(),
                            config.getRectRoundRadius(), 0,config.getBorderWidth(),
                            config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));
                }else {
                    transformations.add(new RoundedCornersTransformation(config.getContext(),
                            config.getRectRoundRadius(),config.getBorderWidth(), cornerType));
                }

                break;
            case ShapeMode.OVAL:
                if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add( new CropCircleWithBorderTransformation(config.getContext(),
                            config.getBorderWidth(),config.getContext().getResources().getColor(config.getBorderColor())));
                }else {
                    transformations.add( new CropCircleTransformation(config.getContext()));
                }


                break;
            default:break;
        }

        if(!transformations.isEmpty()){
             forms = new Transformation[transformations.size()];
            for (int i = 0; i < transformations.size(); i++) {
                forms[i] = transformations.get(i);
            }
           return forms;
        }
        return forms;

    }
 
Example #23
Source File: Glide4Loader.java    From ImageLoader with Apache License 2.0 4 votes vote down vote up
private Transformation[] getBitmapTransFormations(SingleConfig config) {

        Transformation[] forms = null;
        int shapeMode = config.getShapeMode();
        List<Transformation> transformations = new ArrayList<>();

        if(config.isCropFace()){
            // transformations.add(new FaceCenterCrop());//脸部识别
        }

        if(config.getScaleMode() == ScaleMode.CENTER_CROP){
            transformations.add(new CenterCrop());
        }else{
            transformations.add(new FitCenter());
        }


        if(config.isNeedBlur()){
            transformations.add(new BlurTransformation( config.getBlurRadius()));
        }

        switch (shapeMode){
            case ShapeMode.RECT:

                if(config.getBorderWidth()>0){

                }
                break;
            case ShapeMode.RECT_ROUND:
            case ShapeMode.RECT_ROUND_ONLY_TOP:

                RoundedCornersTransformation.CornerType cornerType = RoundedCornersTransformation.CornerType.ALL;
                if(shapeMode == ShapeMode.RECT_ROUND_ONLY_TOP){
                    cornerType = RoundedCornersTransformation.CornerType.TOP;
                }
                /*transformations.add(new BorderRoundTransformation2(config.getContext(),
                        config.getRectRoundRadius(), 0,config.getBorderWidth(),
                        config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));*/

                /*if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add(new BorderRoundTransformation(config.getContext(),
                            config.getRectRoundRadius(), 0,config.getBorderWidth(),
                            config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));
                }else {*/
                    transformations.add(new RoundedCornersTransformation(
                            config.getRectRoundRadius(),config.getBorderWidth(), cornerType));
               // }

                break;
            case ShapeMode.OVAL:
                if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add( new CropCircleWithBorderTransformation(
                            config.getBorderWidth(),config.getContext().getResources().getColor(config.getBorderColor())));
                }else {
                    transformations.add( new CropCircleTransformation());
                }


                break;
            default:break;
        }

        if(!transformations.isEmpty()){
             forms = new Transformation[transformations.size()];
            for (int i = 0; i < transformations.size(); i++) {
                forms[i] = transformations.get(i);
            }
           return forms;
        }
        return forms;

    }
 
Example #24
Source File: GlideLoader.java    From LiveGiftLayout with Apache License 2.0 4 votes vote down vote up
public GlideLoader bitmapTransform(Transformation<Bitmap> transformation) {
    apply(RequestOptions.bitmapTransform(transformation));
    return this;
}
 
Example #25
Source File: DelayTransformation.java    From glide-support with The Unlicense 4 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
public static <T> Transformation<T>[] create(int delay) {
	return new Transformation[] {new DelayTransformation<Object>(delay)};
}
 
Example #26
Source File: GlideImageLoader.java    From NIM_Android_UIKit with MIT License 4 votes vote down vote up
private static Transformation<Bitmap> createRounded() {
    return createRounded(4);
}
 
Example #27
Source File: GlideImageLoader.java    From NIM_Android_UIKit with MIT License 4 votes vote down vote up
private static Transformation<Bitmap> createRounded(int dp) {
    return new RoundedCorners(ScreenUtil.dip2px(dp));
}
 
Example #28
Source File: RepositoryAdapter.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
Transformation<Bitmap> getTransform(int position, Context mContext) {
    if (position % 19 == 0) {
        return new CropCircleTransformation(mContext);
    } else if (position % 19 == 1) {
        return new RoundedCornersTransformation(mContext, 30, 0,
                RoundedCornersTransformation.CornerType.BOTTOM);

    } else if (position % 19 == 2) {
        return new CropTransformation(mContext, 300, 100, CropTransformation.CropType.BOTTOM);

    } else if (position % 19 == 3) {
        return new CropSquareTransformation(mContext);

    } else if (position % 19 == 4) {
        return new CropTransformation(mContext, 300, 100, CropTransformation.CropType.CENTER);

    } else if (position % 19 == 5) {
        return new ColorFilterTransformation(mContext, Color.argb(80, 255, 0, 0));

    } else if (position % 19 == 6) {
        return new GrayscaleTransformation(mContext);

    } else if (position % 19 == 7) {
        return new CropTransformation(mContext, 300, 100);

    } else if (position % 19 == 8) {
        return new BlurTransformation(mContext, 25);
    } else if (position % 19 == 9) {
        return new ToonFilterTransformation(mContext);

    } else if (position % 19 == 10) {
        return new SepiaFilterTransformation(mContext);

    } else if (position % 19 == 11) {
        return new ContrastFilterTransformation(mContext, 2.0f);
    } else if (position % 19 == 12) {
        return new InvertFilterTransformation(mContext);
    } else if (position % 19 == 13) {
        return new PixelationFilterTransformation(mContext, 20);
    } else if (position % 19 == 14) {
        return new SketchFilterTransformation(mContext);
    } else if (position % 19 == 15) {
        return new SwirlFilterTransformation(mContext, 0.5f, 1.0f, new PointF(0.5f, 0.5f));
    } else if (position % 19 == 16) {
        return new BrightnessFilterTransformation(mContext, 0.5f);
    } else if (position % 19 == 17) {
        return new KuwaharaFilterTransformation(mContext, 25);
    } else if (position % 19 == 18) {
        return new VignetteFilterTransformation(mContext, new PointF(0.5f, 0.5f),
                new float[]{0.0f, 0.0f, 0.0f}, 0f, 0.75f);
    }
    return null;
}
 
Example #29
Source File: GifDrawable.java    From giffun with Apache License 2.0 4 votes vote down vote up
public Transformation<Bitmap> getFrameTransformation() {
    return state.frameTransformation;
}
 
Example #30
Source File: GenericRequest.java    From giffun with Apache License 2.0 4 votes vote down vote up
public static <A, T, Z, R> GenericRequest<A, T, Z, R> obtain(
        LoadProvider<A, T, Z, R> loadProvider,
        A model,
        Key signature,
        Context context,
        Priority priority,
        Target<R> target,
        float sizeMultiplier,
        Drawable placeholderDrawable,
        int placeholderResourceId,
        Drawable errorDrawable,
        int errorResourceId,
        Drawable fallbackDrawable,
        int fallbackResourceId,
        RequestListener<? super A, R> requestListener,
        RequestCoordinator requestCoordinator,
        Engine engine,
        Transformation<Z> transformation,
        Class<R> transcodeClass,
        boolean isMemoryCacheable,
        GlideAnimationFactory<R> animationFactory,
        int overrideWidth,
        int overrideHeight,
        DiskCacheStrategy diskCacheStrategy) {
    @SuppressWarnings("unchecked")
    GenericRequest<A, T, Z, R> request = (GenericRequest<A, T, Z, R>) REQUEST_POOL.poll();
    if (request == null) {
        request = new GenericRequest<A, T, Z, R>();
    }
    request.init(loadProvider,
            model,
            signature,
            context,
            priority,
            target,
            sizeMultiplier,
            placeholderDrawable,
            placeholderResourceId,
            errorDrawable,
            errorResourceId,
            fallbackDrawable,
            fallbackResourceId,
            requestListener,
            requestCoordinator,
            engine,
            transformation,
            transcodeClass,
            isMemoryCacheable,
            animationFactory,
            overrideWidth,
            overrideHeight,
            diskCacheStrategy);
    return request;
}