Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters not working #28

Open
robertdolca opened this issue Jun 8, 2016 · 3 comments
Open

Filters not working #28

robertdolca opened this issue Jun 8, 2016 · 3 comments

Comments

@robertdolca
Copy link

I tried applying a filter to the drawable and then loading it in a ImageView.
Any filter I tried is ignored. Even changing the opacity has no effect.
Is this due to the library's implementation?

Thanks

@pflammertsma
Copy link
Collaborator

Likely that it is! Can you provide a snippet for a minimal working example of the problem with expected behavior?

@robertdolca
Copy link
Author

robertdolca commented Jun 8, 2016

InputStream is = response.body().byteStream();
Drawable drawable = Sharp.loadInputStream(is).getDrawable(imageView);
drawable.setAlpha(0);
imageView.setImageDrawable(drawable);

Expected behaviour: a transparent image
Result: an non-transparent image (the original image - unchanged)
It also ignores filters.

If you would like I can make a runnable example.

@pflammertsma
Copy link
Collaborator

pflammertsma commented Jun 8, 2016

I'm afraid these stub methods from PictureDrawable are not implemented in SharpDrawable:

  • setFilterBitmap(boolean filter)
  • setDither(boolean dither)
  • setColorFilter(ColorFilter colorFilter)
  • setAlpha(int alpha)

I'm not certain if there's a trivial way of accomplishing any of this, but perhaps applying canvas.saveLayerAlpha() at the level of SharpDrawable prior to actually drawing the Picture would achieve the desired effect for setAlpha().

I may look into this in a future version, but for now, PRs are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants