0

Picture 1 depicting path to draw. Picture 2 depicting the final result

This is a bit more of a geometry-inside-java question. Basically, I want to round a single corner of a square I drew on a canvas, sometimes it's on the top left, other times on the top right, or bottom left or right. How could a shape like the red highlight be drawn and filled using Android's drawing methods? I've read the drawing tutorials on Oracle, but I can't still figure out how to draw something like that in that position. Any help would be greatly appreciated.

arjun
  • 3,514
  • 4
  • 27
  • 48
Joel
  • 51
  • 1
  • 3
  • You could use 4 'sub squares', overlapping. When you need the southeast corner to be rounded, change the southeast sub quarter so it has rounded edges. But it's a really hacky workaround. – EarlGrey Mar 01 '17 at 08:40
  • Or, look at this question: http://stackoverflow.com/questions/8930555/android-drawable-with-rounded-corners-at-the-top-only This seems to be a straighter solution. I'm not sure how easy you can change this properties at runtime. Maybe you can create 4 drawables and change them accordingly to your needs. – EarlGrey Mar 01 '17 at 08:41
  • And I realised, drawing on a canvas is a different thing. So this seems to be a duplicate of http://stackoverflow.com/questions/5896234/how-to-use-android-canvas-to-draw-a-rectangle-with-only-topleft-and-topright-cor – EarlGrey Mar 01 '17 at 08:52

0 Answers0