What's the point of FILL_AND_STROKE?

Viewed 25060

I'm trying out the android graphics classes. I wanted to draw some arcs/circles with a fill color and black outline. The Paint class has a style for FILL_AND_STROKE, but there doesn't seem to be a way to set the fill color vs. stroke color. So as far as I can tell it's the same as FILL?

So what's the point of FILL_AND_STROKE if you can't set a separate fill and stroke color? I haven't managed to find a good explanation.

(I solved my simple problem by doing a fill first, then a stroke, naturally)

Edit: I ran into this bug report: http://code.google.com/p/android/issues/detail?id=4086

Comment 4 and 5 seem to imply that FILL_AND_STROKE is basically the same as FILL and it will be 'fixed' in 2.2. I guess they'll add a new color?

5 Answers

I guess the FILL_AND_STROKE is particularly useful, if one would animate between STROKE and FILL, while wanted to retain the size of the drawn object.

I'm giving an example with the first one below is animated between FILL_AND_STROKE to STROKE, while the second is on just FILL to STROKE. You could easily see the size shrink.

enter image description here

Hence FILL_AND_STROKE is pretty handy here to make size as consistent as possible with others that have STROKE, without have to manually adjust the size of the drawn object (which is complicated)

Related