fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Setting background image to color with roundAsCircle="true" should be masked by circle

Open emhagman opened this issue 11 years ago • 3 comments

At the moment, displaying the image with roundAsCircle set to true creates a square around the circle as a background when setting backgroundImage to @color/white or any other color resource.

In my opinion, it makes sense for the circle to be used as a mask for the background.

Current code:

Proposed fix:

Appologies for the teribble photo shopping, just trying get point across.

emhagman avatar Apr 01 '15 03:04 emhagman

in this case, you can use RoundingParams.RoundingMethod.BITMAP_ONLY: just like this:

RoundingParams roundingParams = new RoundingParams();
roundingParams.setRoundAsCircle(true);
roundingParams.setBorder(R.color.border_color, 10);
roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);

and set it to GenericDraweeHierarchyBuilder;

blackiedm avatar Apr 01 '15 06:04 blackiedm

The thing is that we do not apply rounding on overlays and backgrounds when using the BITMAP_ONLY mode (which is default). I'll try to send a fix for that.

But, we do provide RoundedColorDrawable, so as a workaround, you can use that if you are creating your hierarchy programmatically. https://github.com/facebook/fresco/blob/847851a8de6d223c0a6634447bddee1252e01c64/drawee/src/main/java/com/facebook/drawee/drawable/RoundedColorDrawable.java

plamenko avatar Apr 02 '15 18:04 plamenko

Fixed in 0.3.0.

tyronen avatar Apr 16 '15 18:04 tyronen