is there a method to draw/fill a rounded rectangle?

Posted on
Page
of 2
Prev
/ 2
  • Yes, that is exactly how I came to that algorithm. I had been trying to create a solid ring. At one point in desperation I started with the same polygon approach you tried, but I stopped when I hit the point limit.

    It isn't described on the English wikipedia, I don't think I saw it on the German one either even though it lists many more circle drawing algorithms than the English one.

    I haven't been able to read the original paper by Andres, it is paywalled, but I have read some of his later papers* and others that expand on the work. If you want to see the proof (or just out of interest) they can be found online.

    • I say read, but I don't understand most of it. It took me a long time before I even remembered how the notation for sets worked.
  • It always surprises me to see how many ways there are to solve a given problem - and what brilliant solutions some people were able to invent!

  • Just to say there's now the ability to fill a rounded rect in cutting edge firmwares, with:

    g.fillRect({x:10, y:10, w:100,h:100, r:8});
    

    draw is not yet implemented

  • Thank you very much, @Gordon!

  • @Gordon Thanks for this! I gave up using rounded rectangles in my app due to effort vs benefit to implement, but will use this once it is in a stable release. Is there a way to mark apps as needing something from a specific firmware version?

  • Is there a way to mark apps as needing something from a specific firmware version?

    Not right now - there's another thread on this, but the best bet right now would be to either check process.env.VERSION in your code, or maybe even call fillRect as above in a try/catch block and see if it errors.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

is there a method to draw/fill a rounded rectangle?

Posted by Avatar for Andreas_Rozek @Andreas_Rozek

Actions