com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory Java Examples

The following examples show how to use com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory. 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: MultiPostProcessor.java    From react-native-image-filter-kit with MIT License 6 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(
  Bitmap src,
  PlatformBitmapFactory bitmapFactory
) {
  CloseableReference<Bitmap> prevBitmap = null, nextBitmap = null;

  try {
    for (Postprocessor p : mPostProcessors) {
      nextBitmap = p.process(prevBitmap != null ? prevBitmap.get() : src, bitmapFactory);
      CloseableReference.closeSafely(prevBitmap);
      prevBitmap = nextBitmap.clone();
    }

    return nextBitmap == null ? super.process(src, bitmapFactory) : nextBitmap.clone();
  } finally {
    CloseableReference.closeSafely(nextBitmap);
  }
}
 
Example #2
Source File: ScalingBlurPostprocessor.java    From fresco with MIT License 6 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(
    Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
  final CloseableReference<Bitmap> bitmapRef =
      bitmapFactory.createBitmap(
          sourceBitmap.getWidth() / mScaleRatio, sourceBitmap.getHeight() / mScaleRatio);

  try {
    final Bitmap destBitmap = bitmapRef.get();
    final Canvas canvas = new Canvas(destBitmap);

    canvas.drawBitmap(
        sourceBitmap,
        null,
        new Rect(0, 0, destBitmap.getWidth(), destBitmap.getHeight()),
        mPaint);

    NativeBlurFilter.iterativeBoxBlur(
        destBitmap, mIterations, Math.max(1, mBlurRadius / mScaleRatio));
    return CloseableReference.cloneOrNull(bitmapRef);
  } finally {
    CloseableReference.closeSafely(bitmapRef);
  }
}
 
Example #3
Source File: ImagePipelineExperiments.java    From fresco with MIT License 6 votes vote down vote up
ProducerFactory createProducerFactory(
Context context,
ByteArrayPool byteArrayPool,
ImageDecoder imageDecoder,
ProgressiveJpegConfig progressiveJpegConfig,
boolean downsampleEnabled,
boolean resizeAndRotateEnabledForNetwork,
boolean decodeCancellationEnabled,
ExecutorSupplier executorSupplier,
PooledByteBufferFactory pooledByteBufferFactory,
MemoryCache<CacheKey, CloseableImage> bitmapMemoryCache,
MemoryCache<CacheKey, PooledByteBuffer> encodedMemoryCache,
BufferedDiskCache defaultBufferedDiskCache,
BufferedDiskCache smallImageBufferedDiskCache,
CacheKeyFactory cacheKeyFactory,
PlatformBitmapFactory platformBitmapFactory,
int bitmapPrepareToDrawMinSizeBytes,
int bitmapPrepareToDrawMaxSizeBytes,
boolean bitmapPrepareToDrawForPrefetch,
int maxBitmapSize,
CloseableReferenceFactory closeableReferenceFactory,
boolean keepCancelledFetchAsLowPriority,
int trackedKeysSize);
 
Example #4
Source File: BasePostprocessor.java    From fresco with MIT License 6 votes vote down vote up
/**
 * Clients should override this method only if the post-processed bitmap has to be of a different
 * size than the source bitmap. If the post-processed bitmap is of the same size, clients should
 * override one of the other two methods.
 *
 * <p>The source bitmap must not be modified as it may be shared by the other clients. The
 * implementation must create a new bitmap that is safe to be modified and return a reference to
 * it. Clients should use <code>bitmapFactory</code> to create a new bitmap.
 *
 * @param sourceBitmap The source bitmap.
 * @param bitmapFactory The factory to create a destination bitmap.
 * @return a reference to the newly created bitmap
 */
@Override
public CloseableReference<Bitmap> process(
    Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
  final Bitmap.Config sourceBitmapConfig = sourceBitmap.getConfig();
  CloseableReference<Bitmap> destBitmapRef =
      bitmapFactory.createBitmapInternal(
          sourceBitmap.getWidth(),
          sourceBitmap.getHeight(),
          sourceBitmapConfig != null ? sourceBitmapConfig : FALLBACK_BITMAP_CONFIGURATION);
  try {
    process(destBitmapRef.get(), sourceBitmap);
    return CloseableReference.cloneOrNull(destBitmapRef);
  } finally {
    CloseableReference.closeSafely(destBitmapRef);
  }
}
 
Example #5
Source File: ExperimentalBitmapAnimationDrawableFactory.java    From fresco with MIT License 6 votes vote down vote up
public ExperimentalBitmapAnimationDrawableFactory(
    AnimatedDrawableBackendProvider animatedDrawableBackendProvider,
    ScheduledExecutorService scheduledExecutorServiceForUiThread,
    ExecutorService executorServiceForFramePreparing,
    MonotonicClock monotonicClock,
    PlatformBitmapFactory platformBitmapFactory,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache,
    Supplier<Integer> cachingStrategySupplier,
    Supplier<Integer> numberOfFramesToPrepareSupplier) {
  mAnimatedDrawableBackendProvider = animatedDrawableBackendProvider;
  mScheduledExecutorServiceForUiThread = scheduledExecutorServiceForUiThread;
  mExecutorServiceForFramePreparing = executorServiceForFramePreparing;
  mMonotonicClock = monotonicClock;
  mPlatformBitmapFactory = platformBitmapFactory;
  mBackingCache = backingCache;
  mCachingStrategySupplier = cachingStrategySupplier;
  mNumberOfFramesToPrepareSupplier = numberOfFramesToPrepareSupplier;
}
 
Example #6
Source File: BitmapAnimationBackend.java    From fresco with MIT License 6 votes vote down vote up
public BitmapAnimationBackend(
    PlatformBitmapFactory platformBitmapFactory,
    BitmapFrameCache bitmapFrameCache,
    AnimationInformation animationInformation,
    BitmapFrameRenderer bitmapFrameRenderer,
    @Nullable BitmapFramePreparationStrategy bitmapFramePreparationStrategy,
    @Nullable BitmapFramePreparer bitmapFramePreparer) {
  mPlatformBitmapFactory = platformBitmapFactory;
  mBitmapFrameCache = bitmapFrameCache;
  mAnimationInformation = animationInformation;
  mBitmapFrameRenderer = bitmapFrameRenderer;
  mBitmapFramePreparationStrategy = bitmapFramePreparationStrategy;
  mBitmapFramePreparer = bitmapFramePreparer;

  mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG);
  updateBitmapDimensions();
}
 
Example #7
Source File: ReScalePostprocessor.java    From WindowImageView with MIT License 6 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
    float scale = 1.0f * width / sourceBitmap.getWidth();
    Log.e("ReScalePostprocessor", "scale:" + scale);

    scaledWidth = (int) (sourceBitmap.getWidth() * scale);
    scaledHeight = (int) (sourceBitmap.getHeight() * scale);

    listener.onProcessFinished(scaledWidth, scaledHeight);

    Matrix matrix = new Matrix();
    matrix.postScale(scale, scale);
    Bitmap bitmap = Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight(), matrix, true);
    CloseableReference<Bitmap> bitmapRef = bitmapFactory.createBitmap(bitmap);
    try {
        return CloseableReference.cloneOrNull(bitmapRef);
    } finally {
        CloseableReference.closeSafely(bitmapRef);
    }
}
 
Example #8
Source File: RenderscriptGeneratorPostProcessor.java    From react-native-image-filter-kit with MIT License 6 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(
  Bitmap src,
  PlatformBitmapFactory bitmapFactory
) {
  final CloseableReference<Bitmap> bitmapRef = bitmapFactory
    .createBitmap(mWidth, mHeight, MainReactPackageWithFrescoCache.bitmapsConfig());

  try {
    final Bitmap dst = bitmapRef.get();

    processGeneratorRenderscript(dst);

    return CloseableReference.cloneOrNull(bitmapRef);
  } finally {
    CloseableReference.closeSafely(bitmapRef);
  }
}
 
Example #9
Source File: GeneratorPostProcessor.java    From react-native-image-filter-kit with MIT License 6 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(
  Bitmap src,
  PlatformBitmapFactory bitmapFactory
) {
  final CloseableReference<Bitmap> bitmapRef = bitmapFactory
    .createBitmap(mWidth, mHeight, MainReactPackageWithFrescoCache.bitmapsConfig());

  try {
    final Bitmap dst = bitmapRef.get();
    final Canvas canvas = new Canvas(dst);
    final Paint paint = new Paint();

    processGenerated(paint, canvas);

    return CloseableReference.cloneOrNull(bitmapRef);
  } finally {
    CloseableReference.closeSafely(bitmapRef);
  }
}
 
Example #10
Source File: AnimatedImageFactoryWebPImplTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setup() {
  PowerMockito.mockStatic(WebPImage.class);
  mWebPImageMock = mock(WebPImage.class);

  mMockAnimatedDrawableBackendProvider = mock(AnimatedDrawableBackendProvider.class);
  mMockBitmapFactory = mock(PlatformBitmapFactory.class);

  mAnimatedImageFactory =
      new AnimatedImageFactoryImpl(mMockAnimatedDrawableBackendProvider, mMockBitmapFactory);

  ((AnimatedImageFactoryImpl) mAnimatedImageFactory).sWebpAnimatedImageDecoder = mWebPImageMock;
}
 
Example #11
Source File: BenchmarkPostprocessorForManualBitmapHandling.java    From fresco with MIT License 5 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(
    Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
  long startTime = System.nanoTime();
  CloseableReference<Bitmap> result = mPostprocessor.process(sourceBitmap, bitmapFactory);
  showDuration(System.nanoTime() - startTime);
  return result;
}
 
Example #12
Source File: PorterDuffXfermodePostProcessor.java    From react-native-image-filter-kit with MIT License 5 votes vote down vote up
@Override
protected CloseableReference<Bitmap> processComposition(
  Bitmap dstImage,
  Bitmap srcImage,
  PlatformBitmapFactory bitmapFactory
) {
  final CloseableReference<Bitmap> outRef = bitmapFactory.createBitmap(
    canvasExtent(dstImage.getWidth(), srcImage.getWidth(), mWidth),
    canvasExtent(dstImage.getHeight(), srcImage.getHeight(), mHeight)
  );

  try {
    final Canvas canvas = new Canvas(outRef.get());
    final int flags = Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG | Paint.FILTER_BITMAP_FLAG;
    final Paint paint = new Paint(flags);

    if (mSwapImages) {
      drawSrc(canvas, srcImage, paint);

    } else {
      drawDst(canvas, dstImage, paint);
    }

    paint.setXfermode(new PorterDuffXfermode(mMode));

    if (mSwapImages) {
      drawDst(canvas, dstImage, paint);

    } else {
      drawSrc(canvas, srcImage, paint);
    }

    return CloseableReference.cloneOrNull(outRef);
  } finally {
    CloseableReference.closeSafely(outRef);
  }
}
 
Example #13
Source File: ExampleBitmapAnimationFactory.java    From fresco with MIT License 5 votes vote down vote up
public static BitmapAnimationBackend createColorBitmapAnimationBackend(
    final int[] colors, final int animationDurationMs, final BitmapFrameCache bitmapFrameCache) {
  final PlatformBitmapFactory platformBitmapFactory =
      Fresco.getImagePipelineFactory().getPlatformBitmapFactory();
  final BitmapFrameRenderer bitmapFrameRenderer = new ColorAndFrameNumberRenderer(colors);
  final AnimationInformation animationInformation =
      new ColorListAnimationInformation(colors, animationDurationMs);
  final ExecutorService executorServiceForFramePreparer =
      new DefaultSerialExecutorService(new DefaultExecutorSupplier(1).forDecode());
  final BitmapFramePreparationStrategy framePreparationStrategy =
      new FixedNumberBitmapFramePreparationStrategy(NUMBER_OF_FRAMES_TO_PREPARE);
  final BitmapFramePreparer bitmapFramePreparer =
      new DefaultBitmapFramePreparer(
          platformBitmapFactory,
          bitmapFrameRenderer,
          Bitmap.Config.ARGB_8888,
          executorServiceForFramePreparer);

  BitmapAnimationBackend bitmapAnimationBackend =
      new BitmapAnimationBackend(
          platformBitmapFactory,
          bitmapFrameCache,
          animationInformation,
          bitmapFrameRenderer,
          framePreparationStrategy,
          bitmapFramePreparer);

  bitmapAnimationBackend.setFrameListener(new DebugBitmapAnimationFrameListener());
  return bitmapAnimationBackend;
}
 
Example #14
Source File: AnimatedImageFactoryGifImplTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setup() {
  PowerMockito.mockStatic(GifImage.class);
  mGifImageMock = mock(GifImage.class);

  mMockAnimatedDrawableBackendProvider = mock(AnimatedDrawableBackendProvider.class);
  mMockBitmapFactory = mock(PlatformBitmapFactory.class);

  mAnimatedImageFactory =
      new AnimatedImageFactoryImpl(mMockAnimatedDrawableBackendProvider, mMockBitmapFactory);

  ((AnimatedImageFactoryImpl) mAnimatedImageFactory).sGifAnimatedImageDecoder = mGifImageMock;
}
 
Example #15
Source File: ImagePipelineFactory.java    From fresco with MIT License 5 votes vote down vote up
public PlatformBitmapFactory getPlatformBitmapFactory() {
  if (mPlatformBitmapFactory == null) {
    mPlatformBitmapFactory =
        PlatformBitmapFactoryProvider.buildPlatformBitmapFactory(
            mConfig.getPoolFactory(), getPlatformDecoder(), getCloseableReferenceFactory());
  }
  return mPlatformBitmapFactory;
}
 
Example #16
Source File: PostprocessorProducer.java    From fresco with MIT License 5 votes vote down vote up
public PostprocessorProducer(
    Producer<CloseableReference<CloseableImage>> inputProducer,
    PlatformBitmapFactory platformBitmapFactory,
    Executor executor) {
  mInputProducer = Preconditions.checkNotNull(inputProducer);
  mBitmapFactory = platformBitmapFactory;
  mExecutor = Preconditions.checkNotNull(executor);
}
 
Example #17
Source File: CompositionPostProcessor.java    From react-native-image-filter-kit with MIT License 5 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(
  Bitmap dst,
  PlatformBitmapFactory bitmapFactory
) {
  Bitmap src = ((CloseableBitmap) mSrc.get()).getUnderlyingBitmap();

  return processComposition(dst, src, bitmapFactory);
}
 
Example #18
Source File: DokitFrescoPostprocessor.java    From DoraemonKit with Apache License 2.0 5 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
    try {
        if (PerformanceSpInfoConfig.isLargeImgOpen()) {
            double imgSize = ConvertUtils.byte2MemorySize(sourceBitmap.getByteCount(), MemoryConstants.MB);
            LargePictureManager.getInstance().saveImageInfo(mUri.toString(), imgSize, sourceBitmap.getWidth(), sourceBitmap.getHeight(), "Fresco");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (mOriginalPostprocessor != null) {
        return mOriginalPostprocessor.process(sourceBitmap, bitmapFactory);
    }

    final Bitmap.Config sourceBitmapConfig = sourceBitmap.getConfig();
    CloseableReference<Bitmap> destBitmapRef =
            bitmapFactory.createBitmapInternal(
                    sourceBitmap.getWidth(),
                    sourceBitmap.getHeight(),
                    sourceBitmapConfig != null ? sourceBitmapConfig : FALLBACK_BITMAP_CONFIGURATION);
    try {
        process(destBitmapRef.get(), sourceBitmap);
        return CloseableReference.cloneOrNull(destBitmapRef);
    } finally {
        CloseableReference.closeSafely(destBitmapRef);
    }

}
 
Example #19
Source File: AnimatedFactoryProvider.java    From fresco with MIT License 5 votes vote down vote up
public static AnimatedFactory getAnimatedFactory(
    PlatformBitmapFactory platformBitmapFactory,
    ExecutorSupplier executorSupplier,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache,
    boolean downscaleFrameToDrawableDimensions) {
  if (!sImplLoaded) {
    try {
      final Class<?> clazz =
          Class.forName("com.facebook.fresco.animation.factory.AnimatedFactoryV2Impl");
      final Constructor<?> constructor =
          clazz.getConstructor(
              PlatformBitmapFactory.class,
              ExecutorSupplier.class,
              CountingMemoryCache.class,
              Boolean.TYPE);
      sImpl =
          (AnimatedFactory)
              constructor.newInstance(
                  platformBitmapFactory,
                  executorSupplier,
                  backingCache,
                  downscaleFrameToDrawableDimensions);
    } catch (Throwable e) {
      // Head in the sand
    }
    if (sImpl != null) {
      sImplLoaded = true;
    }
  }
  return sImpl;
}
 
Example #20
Source File: AnimatedFactoryV2Impl.java    From fresco with MIT License 5 votes vote down vote up
@DoNotStrip
public AnimatedFactoryV2Impl(
    PlatformBitmapFactory platformBitmapFactory,
    ExecutorSupplier executorSupplier,
    CountingMemoryCache<CacheKey, CloseableImage> backingCache,
    boolean downscaleFrameToDrawableDimensions) {
  mPlatformBitmapFactory = platformBitmapFactory;
  mExecutorSupplier = executorSupplier;
  mBackingCache = backingCache;
  mDownscaleFrameToDrawableDimensions = downscaleFrameToDrawableDimensions;
}
 
Example #21
Source File: DefaultBitmapFramePreparer.java    From fresco with MIT License 5 votes vote down vote up
public DefaultBitmapFramePreparer(
    PlatformBitmapFactory platformBitmapFactory,
    BitmapFrameRenderer bitmapFrameRenderer,
    Bitmap.Config bitmapConfig,
    ExecutorService executorService) {
  mPlatformBitmapFactory = platformBitmapFactory;
  mBitmapFrameRenderer = bitmapFrameRenderer;
  mBitmapConfig = bitmapConfig;
  mExecutorService = executorService;
  mPendingFrameDecodeJobs = new SparseArray<>();
}
 
Example #22
Source File: MultiPostprocessor.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public CloseableReference<Bitmap>	process(Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
  CloseableReference<Bitmap> prevBitmap = null, nextBitmap = null;

  try {
    for (Postprocessor p : mPostprocessors) {
      nextBitmap = p.process(prevBitmap != null ? prevBitmap.get() : sourceBitmap, bitmapFactory);
      CloseableReference.closeSafely(prevBitmap);
      prevBitmap = nextBitmap.clone();
    }
    return nextBitmap.clone();
  } finally {
    CloseableReference.closeSafely(nextBitmap);
  }
}
 
Example #23
Source File: ReactImageView.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public CloseableReference<Bitmap> process(Bitmap source, PlatformBitmapFactory bitmapFactory) {
  final Rect destRect = new Rect(0, 0, getWidth(), getHeight());

  mScaleType.getTransform(
    sTileMatrix,
    destRect,
    source.getWidth(),
    source.getHeight(),
    0.0f,
    0.0f);

  Paint paint = new Paint();
  paint.setAntiAlias(true);
  Shader shader = new BitmapShader(source, mTileMode, mTileMode);
  shader.setLocalMatrix(sTileMatrix);
  paint.setShader(shader);

  CloseableReference<Bitmap> output = bitmapFactory.createBitmap(getWidth(), getHeight());
  try {
    Canvas canvas = new Canvas(output.get());
    canvas.drawRect(destRect, paint);
    return output.clone();
  } finally {
    CloseableReference.closeSafely(output);
  }
}
 
Example #24
Source File: AnimatedImageFactoryImpl.java    From fresco with MIT License 4 votes vote down vote up
public AnimatedImageFactoryImpl(
    AnimatedDrawableBackendProvider animatedDrawableBackendProvider,
    PlatformBitmapFactory bitmapFactory) {
  mAnimatedDrawableBackendProvider = animatedDrawableBackendProvider;
  mBitmapFactory = bitmapFactory;
}
 
Example #25
Source File: RenderscriptCompositionPostProcessor.java    From react-native-image-filter-kit with MIT License 4 votes vote down vote up
@Override
protected CloseableReference<Bitmap> processComposition(
  Bitmap dstImage,
  Bitmap srcImage,
  PlatformBitmapFactory bitmapFactory
) {
  final int width = canvasExtent(dstImage.getWidth(), srcImage.getWidth(), mWidth);
  final int height = canvasExtent(dstImage.getHeight(), srcImage.getHeight(), mHeight);

  final CloseableReference<Bitmap> tmpDstRef = bitmapFactory.createBitmap(width, height);
  final CloseableReference<Bitmap> tmpSrcRef = bitmapFactory.createBitmap(width, height);
  final CloseableReference<Bitmap> outRef = bitmapFactory.createBitmap(width, height);

  try {
    final Bitmap out = outRef.get();
    final Bitmap tmpDst = tmpDstRef.get();
    final Bitmap tmpSrc = tmpSrcRef.get();

    final Canvas dstCanvas = new Canvas(tmpDst);
    final Canvas srcCanvas = new Canvas(tmpSrc);
    final int flags = Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG | Paint.FILTER_BITMAP_FLAG;
    final Paint paint = new Paint(flags);

    dstCanvas.drawBitmap(
      dstImage,
      bitmapTransform(width, height, dstImage.getWidth(), dstImage.getHeight(), mDstTransform),
      paint
    );

    srcCanvas.drawBitmap(
      srcImage,
      bitmapTransform(width, height, srcImage.getWidth(), srcImage.getHeight(), mSrcTransform),
      paint
    );

    processRenderscriptComposition(
      mSwapImages ? tmpSrc : tmpDst,
      mSwapImages ? tmpDst : tmpSrc,
      out
    );

    return CloseableReference.cloneOrNull(outRef);
  } finally {
    CloseableReference.closeSafely(tmpDstRef);
    CloseableReference.closeSafely(tmpSrcRef);
    CloseableReference.closeSafely(outRef);
  }
}
 
Example #26
Source File: ImagePipelineConfig.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
public PlatformBitmapFactory getPlatformBitmapFactory() {
  return mPlatformBitmapFactory;
}
 
Example #27
Source File: CompositionPostProcessor.java    From react-native-image-filter-kit with MIT License 4 votes vote down vote up
protected abstract CloseableReference<Bitmap> processComposition(
  Bitmap dstImage,
  Bitmap srcImage,
  PlatformBitmapFactory bitmapFactory
);
 
Example #28
Source File: ImagePipelineExperiments.java    From fresco with MIT License 4 votes vote down vote up
@Override
public ProducerFactory createProducerFactory(
    Context context,
    ByteArrayPool byteArrayPool,
    ImageDecoder imageDecoder,
    ProgressiveJpegConfig progressiveJpegConfig,
    boolean downsampleEnabled,
    boolean resizeAndRotateEnabledForNetwork,
    boolean decodeCancellationEnabled,
    ExecutorSupplier executorSupplier,
    PooledByteBufferFactory pooledByteBufferFactory,
    MemoryCache<CacheKey, CloseableImage> bitmapMemoryCache,
    MemoryCache<CacheKey, PooledByteBuffer> encodedMemoryCache,
    BufferedDiskCache defaultBufferedDiskCache,
    BufferedDiskCache smallImageBufferedDiskCache,
    CacheKeyFactory cacheKeyFactory,
    PlatformBitmapFactory platformBitmapFactory,
    int bitmapPrepareToDrawMinSizeBytes,
    int bitmapPrepareToDrawMaxSizeBytes,
    boolean bitmapPrepareToDrawForPrefetch,
    int maxBitmapSize,
    CloseableReferenceFactory closeableReferenceFactory,
    boolean keepCancelledFetchAsLowPriority,
    int trackedKeysSize) {
  return new ProducerFactory(
      context,
      byteArrayPool,
      imageDecoder,
      progressiveJpegConfig,
      downsampleEnabled,
      resizeAndRotateEnabledForNetwork,
      decodeCancellationEnabled,
      executorSupplier,
      pooledByteBufferFactory,
      bitmapMemoryCache,
      encodedMemoryCache,
      defaultBufferedDiskCache,
      smallImageBufferedDiskCache,
      cacheKeyFactory,
      platformBitmapFactory,
      bitmapPrepareToDrawMinSizeBytes,
      bitmapPrepareToDrawMaxSizeBytes,
      bitmapPrepareToDrawForPrefetch,
      maxBitmapSize,
      closeableReferenceFactory,
      keepCancelledFetchAsLowPriority,
      trackedKeysSize);
}
 
Example #29
Source File: ImagePipelineConfig.java    From fresco with MIT License 4 votes vote down vote up
@Nullable
public PlatformBitmapFactory getPlatformBitmapFactory() {
  return mPlatformBitmapFactory;
}
 
Example #30
Source File: ImagePipelineConfig.java    From fresco with MIT License 4 votes vote down vote up
public Builder setPlatformBitmapFactory(PlatformBitmapFactory platformBitmapFactory) {
  mPlatformBitmapFactory = platformBitmapFactory;
  return this;
}