當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.equals方法代碼示例

本文整理匯總了Java中com.bumptech.glide.load.engine.Resource.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.equals方法的具體用法?Java Resource.equals怎麽用?Java Resource.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.bumptech.glide.load.engine.Resource的用法示例。


在下文中一共展示了Resource.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: transform

import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<GifDrawable> transform(
    Context context, Resource<GifDrawable> resource, int outWidth, int outHeight) {
  GifDrawable drawable = resource.get();

  // The drawable needs to be initialized with the correct width and height in order for a view
  // displaying it to end up with the right dimensions. Since our transformations may arbitrarily
  // modify the dimensions of our GIF, here we create a stand in for a frame and pass it to the
  // transformation to see what the final transformed dimensions will be so that our drawable can
  // report the correct intrinsic width and height.
  BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
  Bitmap firstFrame = drawable.getFirstFrame();
  Resource<Bitmap> bitmapResource = new BitmapResource(firstFrame, bitmapPool);
  Resource<Bitmap> transformed = wrapped.transform(context, bitmapResource, outWidth, outHeight);
  if (!bitmapResource.equals(transformed)) {
    bitmapResource.recycle();
  }
  Bitmap transformedFrame = transformed.get();

  drawable.setFrameTransformation(wrapped, transformedFrame);
  return resource;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:GifDrawableTransformation.java

示例2: transform

import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<BitmapDrawable> transform(
    Context context, Resource<BitmapDrawable> drawableResourceToTransform, int outWidth,
    int outHeight) {
  BitmapDrawable drawableToTransform = drawableResourceToTransform.get();
  Bitmap bitmapToTransform = drawableToTransform.getBitmap();

  BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
  BitmapResource bitmapResourceToTransform = BitmapResource.obtain(bitmapToTransform, bitmapPool);
  Resource<Bitmap> transformedBitmapResource =
      wrapped.transform(context, bitmapResourceToTransform, outWidth, outHeight);

  if (transformedBitmapResource.equals(bitmapResourceToTransform)) {
    return drawableResourceToTransform;
  } else {
    return LazyBitmapDrawableResource.obtain(context, transformedBitmapResource.get());
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:BitmapDrawableTransformation.java

示例3: transform

import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<Drawable> transform(Context context, Resource<Drawable> resource, int outWidth,
    int outHeight) {
  BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
  Drawable drawable = resource.get();
  Resource<Bitmap> bitmapResourceToTransform =
      DrawableToBitmapConverter.convert(bitmapPool, drawable, outWidth, outHeight);
  if (bitmapResourceToTransform == null) {
    if (isRequired) {
      throw new IllegalArgumentException("Unable to convert " + drawable + " to a Bitmap");
    } else {
      return resource;
    }
  }
  Resource<Bitmap> transformedBitmapResource =
      wrapped.transform(context, bitmapResourceToTransform, outWidth, outHeight);

  if (transformedBitmapResource.equals(bitmapResourceToTransform)) {
    transformedBitmapResource.recycle();
    return resource;
  } else {
    return newDrawableResource(context, transformedBitmapResource.get());
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:DrawableTransformation.java

示例4: getTransformedFrame

import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
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(
          context, bitmapResource, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
  if (!bitmapResource.equals(transformedResource)) {
    bitmapResource.recycle();
  }
  return transformedResource;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ReEncodingGifResourceEncoder.java

示例5: transform

import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<T> transform(
    Context context, Resource<T> resource, int outWidth, int outHeight) {
  Resource<T> previous = resource;

  for (Transformation<T> transformation : transformations) {
    Resource<T> transformed = transformation.transform(context, previous, outWidth, outHeight);
    if (previous != null && !previous.equals(resource) && !previous.equals(transformed)) {
      previous.recycle();
    }
    previous = transformed;
  }
  return previous;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:MultiTransformation.java


注:本文中的com.bumptech.glide.load.engine.Resource.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。