Java 类com.facebook.drawee.drawable.OrientedDrawable 实例源码

项目:GitHub    文件:BoxingFrescoLoader.java   
private Drawable createDrawableFromFetchedResult(Context context, CloseableImage image) {
    if (image instanceof CloseableStaticBitmap) {
        CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
        BitmapDrawable bitmapDrawable = createBitmapDrawable(context, closeableStaticBitmap.getUnderlyingBitmap());
        return (closeableStaticBitmap.getRotationAngle() != 0 && closeableStaticBitmap.getRotationAngle() != -1 ? new OrientedDrawable(bitmapDrawable, closeableStaticBitmap.getRotationAngle()) : bitmapDrawable);
    } else if (image instanceof CloseableAnimatedImage) {
        AnimatedDrawableFactory animatedDrawableFactory = Fresco.getImagePipelineFactory().getAnimatedFactory().getAnimatedDrawableFactory(context);
        if (animatedDrawableFactory != null) {
            AnimatedDrawable animatedDrawable = (AnimatedDrawable) animatedDrawableFactory.create(image);
            if (animatedDrawable != null) {
                return animatedDrawable;
            }
        }
    }
    throw new UnsupportedOperationException("Unrecognized image class: " + image);
}
项目:GitHub    文件:PipelineDraweeController.java   
@Override
public Drawable createDrawable(CloseableImage closeableImage) {
  if (closeableImage instanceof CloseableStaticBitmap) {
    CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) closeableImage;
    Drawable bitmapDrawable =
        new BitmapDrawable(mResources, closeableStaticBitmap.getUnderlyingBitmap());
    if (!hasTransformableRotationAngle(closeableStaticBitmap)
        && !hasTransformableExifOrientation(closeableStaticBitmap)) {
      // Return the bitmap drawable directly as there's nothing to transform in it
      return bitmapDrawable;
    } else {
      return new OrientedDrawable(
          bitmapDrawable,
          closeableStaticBitmap.getRotationAngle(),
          closeableStaticBitmap.getExifOrientation());
    }
  } else if (mAnimatedDrawableFactory != null
      && mAnimatedDrawableFactory.supportsImageType(closeableImage)) {
    return mAnimatedDrawableFactory.createDrawable(closeableImage);
  }
  return null;
}
项目:boxing    文件:BoxingFrescoLoader.java   
private Drawable createDrawableFromFetchedResult(Context context, CloseableImage image) {
    if (image instanceof CloseableStaticBitmap) {
        CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
        BitmapDrawable bitmapDrawable = createBitmapDrawable(context, closeableStaticBitmap.getUnderlyingBitmap());
        return (closeableStaticBitmap.getRotationAngle() != 0 && closeableStaticBitmap.getRotationAngle() != -1 ? new OrientedDrawable(bitmapDrawable, closeableStaticBitmap.getRotationAngle()) : bitmapDrawable);
    } else if (image instanceof CloseableAnimatedImage) {
        AnimatedDrawableFactory animatedDrawableFactory = Fresco.getImagePipelineFactory().getAnimatedFactory().getAnimatedDrawableFactory(context);
        if (animatedDrawableFactory != null) {
            AnimatedDrawable animatedDrawable = (AnimatedDrawable) animatedDrawableFactory.create(image);
            if (animatedDrawable != null) {
                return animatedDrawable;
            }
        }
    }
    throw new UnsupportedOperationException("Unrecognized image class: " + image);
}
项目:fresco    文件:PipelineDraweeController.java   
@Override
public Drawable createDrawable(CloseableImage closeableImage) {
  if (closeableImage instanceof CloseableStaticBitmap) {
    CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) closeableImage;
    Drawable bitmapDrawable =
        new BitmapDrawable(mResources, closeableStaticBitmap.getUnderlyingBitmap());
    if (!hasTransformableRotationAngle(closeableStaticBitmap)
        && !hasTransformableExifOrientation(closeableStaticBitmap)) {
      // Return the bitmap drawable directly as there's nothing to transform in it
      return bitmapDrawable;
    } else {
      return new OrientedDrawable(
          bitmapDrawable,
          closeableStaticBitmap.getRotationAngle(),
          closeableStaticBitmap.getExifOrientation());
    }
  } else if (mAnimatedDrawableFactory != null
      && mAnimatedDrawableFactory.supportsImageType(closeableImage)) {
    return mAnimatedDrawableFactory.createDrawable(closeableImage);
  }
  return null;
}