Graphics.drawRoundRect() different on Android

36 views
Skip to first unread message

Matthias Bay

unread,
Aug 25, 2013, 11:23:51 AM8/25/13
to codenameone...@googlegroups.com
Hi,

I've noticed that drawing a Round Rect on Android shows a Round Rect with doubled arcWidth and arcHeight. I think this is because Android takes the argument as the radius, not the diameter.
http://developer.android.com/reference/android/graphics/Canvas.html#drawRoundRect%28android.graphics.RectF,%20float,%20float,%20android.graphics.Paint%29
On J2ME and the Simulator it works correctly. What about iOS/WP/BB?
Is this my mistake or should I file a Issue?

Thanks in advance, Matthias

Shai Almog

unread,
Aug 25, 2013, 12:48:43 PM8/25/13
to codenameone...@googlegroups.com
Hi,
thanks. Yes its a known bug that's really hard to fix so we just left it at that.
For simple round borders where you don't care about the look this should work just fine but generally 9-piece image borders will be faster and more efficient than the more complex round border logic you might have. So I suggest using those when applicable.

Matthias Bay

unread,
Aug 25, 2013, 3:57:32 PM8/25/13
to codenameone...@googlegroups.com
Thanks. The value can change in my app, so I think I'll simply half arcWidth and arcHeight.
Is this only on Android or on other platforms, too?

Shai Almog

unread,
Aug 26, 2013, 5:44:23 AM8/26/13
to codenameone...@googlegroups.com
I'm not sure. Its not something we aimed at as overly important since we emphasized the image borders more.
Reply all
Reply to author
Forward
0 new messages