Rounded rectangle without stroke

hi. am i going to have to roll my own rounded rectangles if i want them without a stroke applied? rect() seems to use the stroke color for the corners, all i get with noStroke() or a transparent stroke are blocks. If I am, how do I replicate what rect() does using curves, for example? I found https://www.processing.org/discourse/beta/num_1201879926.html this.

I don't know if this is intentional or a bug? All I want are rectangles without strokes, where the background shows through the rounded parts.

Answers

  • Answer ✓

    This worked for me

    void setup() {
      size(200, 200);
    }
    
    void draw() {
      background(100, 100, 200);
      noStroke();
      fill(0, 200, 0);
      rect(20, 50, 100, 60, 10);
      fill(200, 0, 0);
      rect(80, 80, 100, 60, 10);
    }
    

    image

  • Yes, it now seems to work as expected in my sketch as well. Some kind of fluke? Thanks!

Sign In or Register to comment.