Java源码示例:com.facebook.imagepipeline.postprocessors.IterativeBoxBlurPostProcessor

示例1
public static void setBlurFrescoController(SimpleDraweeView simpleDraweeView, String url, int iterations, int blurRadius) {
    try {
        Uri uri = Uri.parse(url);
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
                .setPostprocessor(new IterativeBoxBlurPostProcessor(iterations, blurRadius))
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setOldController(simpleDraweeView.getController())
                .setImageRequest(request)
                .build();
        simpleDraweeView.setController(controller);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
示例2
static void setPostProcessor(
  @Nullable ReactImageView target,
  @Nullable IterativeBoxBlurPostProcessor postProcessor
) {
  if (target != null) {
    ReflectUtils.setFieldValue(target, "mIterativeBoxBlurPostProcessor", postProcessor);
  }
}
 
示例3
private static Task<ReactImageView> filterImage(
  final @Nonnull FilterableImage filterableImage,
  final @Nullable FrescoControllerListener listener,
  final @Nonnull CancellationTokenSource cancellationTokenSource
) {
  final ReactImageView image = filterableImage.getImage();
  final TaskCompletionSource<ReactImageView> deferred = new TaskCompletionSource<>();

  ArrayList<Postprocessor> postProcessors = new ArrayList<>(filterableImage.getPostProcessors());

  if (postProcessors.size() == 0) {
    postProcessors.add(new DummyPostProcessor());
  }

  IterativeBoxBlurPostProcessor next = new MultiPostProcessor(
    postProcessors,
    filterableImage.isCacheDisabled()
  );

  if (listener != null) {
    listener.setDisabled();
  }

  final ControllerListener<ImageInfo> prevListener = ReactImageViewUtils
    .getControllerListener(image);

  FrescoControllerListener nextListener = new FrescoControllerListener(
    prevListener,
    () -> {
      if (!deferred.getTask().isCompleted()) {
        ReactImageViewUtils.setControllerListener(image, prevListener);
        deferred.setResult(image);
      }
    }
  );

  ReactImageViewUtils.setControllerListener(image, nextListener);

  ReactImageViewUtils.setPostProcessor(image, next);

  ReactImageViewUtils.setDirty(image);

  Task.call((Callable<Void>) () -> {
    image.maybeUpdateView();
    return null;
  }, UiThreadImmediateExecutorService.getInstance(), cancellationTokenSource.getToken());

  return deferred.getTask();
}
 
示例4
private List<Entry> getSpinnerItems() {
  return Arrays.asList(
      new Entry(R.string.imagepipeline_postprocessor_show_original, null),
      new Entry(
          R.string.imagepipeline_postprocessor_set_greyscale_slow,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new SlowGreyScalePostprocessor())),
      new Entry(
          R.string.imagepipeline_postprocessor_set_greyscale,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new FasterGreyScalePostprocessor())),
      new Entry(
          R.string.imagepipeline_postprocessor_set_watermark,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new WatermarkPostprocessor(WATERMARK_COUNT, WATERMARK_STRING))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_watermark_cached,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new CachedWatermarkPostprocessor(WATERMARK_COUNT, WATERMARK_STRING))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_native_blur,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new IterativeBoxBlurPostProcessor(25, 3))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_blur,
          new BenchmarkPostprocessorForDuplicatedBitmap(
              this, new BlurPostProcessor(20, getContext()))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_scaling_blur,
          new BenchmarkPostprocessorForManualBitmapHandling(
              this, new ScalingBlurPostprocessor(25, 3, 4))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_native_round_as_circle,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new RoundAsCirclePostprocessor(false))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_round_as_aa_circle,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new RoundAsCirclePostprocessor(true))),
      new Entry(
          R.string.imagepipeline_postprocessor_set_rounded_corners,
          new BenchmarkPostprocessorForDuplicatedBitmapInPlace(
              this, new RoundedCornersPostprocessor())),
      new Entry(
          R.string.imagepipeline_postprocessor_set_round_as_circle,
          new BenchmarkPostprocessorForDuplicatedBitmap(this, new RoundPostprocessor())));
}