开发者

What's the point of FILL_AND_STROKE?

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 开发者_如何学Goto 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?


afaik: FILL fills your circle, while FILL_AND_STROKE also draws the border. If you increase the size of the stroke, it should result in different circles sizes (only visual!)

Think about this: you draw a circle by hand with a small sized pencil. The radius is what you wanted. If you now take a big brush and draw the circle again, your radius is much bigger... (i hope its understandable O.o )


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.

What's the point of FILL_AND_STROKE?

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)


Yes it's a bit silly. The only use for it is if you want to change between a stroke only and a filled circle then you can use FILL_AND_STROKE to keep the size of the circle the same.

If you went from STROKE to FILL you would lose the width of the stroke when you drew the circle again.


If your stroke style is something other than a solid line (eg a dashed line), you should be able to see the difference. Not that it seems a very useful feature though.

Being able to extend the silhouette of something (more complex than a circle) outwards can be extremely useful though, and not easily obtained by other means


Please see @Shurane's comment.

Just draw it twice, one filled, one stroke and each with one color.

Worked great for me, and gives the impression of a STROKE and a FILL!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜