com.facebook.imagepipeline.postprocessors.IterativeBoxBlurPostProcessor Java Examples

The following examples show how to use com.facebook.imagepipeline.postprocessors.IterativeBoxBlurPostProcessor. 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: FrescoUtil.java    From PicKing with Apache License 2.0 6 votes vote down vote up
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();
    }

}
 
Example #2
Source File: ReactImageViewUtils.java    From react-native-image-filter-kit with MIT License 5 votes vote down vote up
static void setPostProcessor(
  @Nullable ReactImageView target,
  @Nullable IterativeBoxBlurPostProcessor postProcessor
) {
  if (target != null) {
    ReflectUtils.setFieldValue(target, "mIterativeBoxBlurPostProcessor", postProcessor);
  }
}
 
Example #3
Source File: ImageFilter.java    From react-native-image-filter-kit with MIT License 4 votes vote down vote up
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();
}
 
Example #4
Source File: ImagePipelinePostProcessorFragment.java    From fresco with MIT License 4 votes vote down vote up
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())));
}