-4

How can I inscribe line into oval using Canvas and Paint in Android?

UPDT:

I need something like that:

enter image description here

Thanks

earsonheart
  • 1,012
  • 2
  • 11
  • 25
  • 1
    I assume you are trying to write text on top of an oval shape. Knowning the coordinates of the oval, use `Canvas.drawText` method at similar coordinates. If you're trying to draw a line, use `Canvas.drawLine` with similar coordinates – IAmGroot Jan 09 '13 at 16:32
  • Solved with clipPath based on oval – earsonheart Jan 10 '13 at 09:45

2 Answers2

1

I don't believe you can inscribe a line into an oval with the methods available in the Canvas class. As for as my experience goes, you can only render straight lines. However you can draw oval with the Canvas class. I'm not sure what your primary goal is, but you might want to look up some Graphic libraries, that might over something like this.

Update:

Based on your provided image, I believe this is possible. You just need to find the two coordinates of the line: starting coordinate and Ending coordinate.

Once you have done this, render the oval shape then render the line based on the two coordinates.

I hope this helps.

Community
  • 1
  • 1
Luke Taylor
  • 8,865
  • 13
  • 39
  • 69
0

Try drawing the line with and oval mask. u can rotate the canvas all you want to get the effects u need.

Wops
  • 955
  • 9
  • 22