alexvasilkov / GestureViews

ImageView and FrameLayout with gestures control and position animation
Apache License 2.0
2.38k stars 384 forks source link

GestureImageViews shapes. #67

Closed Khunchheang closed 7 years ago

Khunchheang commented 7 years ago

Currently I work with many shapes of ImageView. So Can GestureImageViews work as round shape?

alashow commented 7 years ago

See this

Khunchheang commented 7 years ago

Can you show me about problem below: java.lang.RuntimeException: For better performance only BitmapDrawables are supported, but you can override getBitmapFromDrawable() and build bitmap on your own

alexvasilkov commented 7 years ago

Image rounding uses BitmapShader for performance optimization. So in order to round the image it needs to directly use bitmap instance.

It is possible to create bitmap from any drawable manually, but it will require unnecessary memory pressure, so this feature was not implemented intentionally.

By default library only supports BitmapDrawable, but if you know how to extract bitmap instances from your drawables or you want to generate bitmaps for any drawables then you have to override both CircleImageView and CircleGestureImageView and provide your implementation of getBitmapFromDrawable(Drawable) method.

If you use Glide then another option would be to just use Glide.with(...).load(...).asBitmap().