com.facebook.drawee.backends.pipeline.DraweeConfig Java Examples

The following examples show how to use com.facebook.drawee.backends.pipeline.DraweeConfig. 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: CustomImageFormatConfigurator.java    From fresco with MIT License 5 votes vote down vote up
public static void addCustomDrawableFactories(
    Context context, DraweeConfig.Builder draweeConfigBuilder) {
  // We always add the color drawable factory so that it can be used for image decoder overrides,
  // see ImageFormatOverrideExample.
  draweeConfigBuilder.addCustomDrawableFactory(ColorImageExample.createDrawableFactory());
  if (isSvgEnabled(context)) {
    draweeConfigBuilder.addCustomDrawableFactory(new SvgDecoderExample.SvgDrawableFactory());
  }
  if (isKeyframesEnabled()) {
    draweeConfigBuilder.addCustomDrawableFactory(KeyframesDecoderExample.createDrawableFactory());
  }
}
 
Example #2
Source File: ScrollPerfApplication.java    From fresco with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  final Config config = Config.load(this);
  ImagePipelineConfig.Builder imagePipelineConfigBuilder =
      ImagePipelineConfig.newBuilder(this)
          .setResizeAndRotateEnabledForNetwork(false)
          .setDownsampleEnabled(config.downsampling);
  if (WebpSupportStatus.sIsWebpSupportRequired) {
    imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled);
  }
  if (config.decodingThreadCount == 0) {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS));
  } else {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount));
  }
  imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation);
  DraweeConfig draweeConfig =
      DraweeConfig.newBuilder().setDrawDebugOverlay(config.draweeOverlayEnabled).build();
  if (BuildConfig.FLAVOR == "noNativeCode") {
    imagePipelineConfigBuilder.setMemoryChunkType(MemoryChunkType.BUFFER_MEMORY);
    Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig, false);
  } else {
    Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig, true);
  }
}
 
Example #3
Source File: BigImageLoader.java    From ImageLoader with Apache License 2.0 4 votes vote down vote up
public static BigImageLoader with(Context appContext,
                                  ImagePipelineConfig imagePipelineConfig, DraweeConfig draweeConfig) {
    Fresco.initialize(appContext, imagePipelineConfig, draweeConfig);
    return new BigImageLoader(appContext);
}