Pixplicity / sharp

Scalable vector graphics for Android
Apache License 2.0
1.03k stars 117 forks source link

Filters not working #28

Open robertdolca opened 8 years ago

robertdolca commented 8 years ago

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 commented 8 years ago

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

robertdolca commented 8 years ago
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 commented 8 years ago

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

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!