Loading...
Logo
Processing Forum
is there a way to use smooth() and noStroke() between beginDraw() and endDraw()?

or anybody has ideas on how to make this simple application of additive color synthesis look better?

Copy code
  1. PGraphics c1, c2, c3;

    void setup() {

      size(600, 600);
      smooth();
      noStroke();
      background(255);

      c1 = createGraphics(width, height, P2D);
      c2 = createGraphics(width, height, P2D);
      c3 = createGraphics(width, height, P2D);

      c1.beginDraw();
        smooth();
        noStroke();
      c1.fill(255, 0, 0);
      c1.ellipse (width/3, height/3, 2*width/3, 2*width/3);
      c1.endDraw();

      c2.beginDraw();
      smooth();
      noStroke();
      c2.fill(0, 255, 0);
      c2.ellipse (2*width/3, height/3, 2*width/3, 2*width/3);
      c2.endDraw();

      c3.beginDraw();
      smooth();
      noStroke();
      c3.fill(0, 0, 255);
      c3.ellipse (width/2, 2*height/3, 2*width/3, 2*width/3);
      c3.endDraw();


      image(c1, 0, 0);
      image(c2, 0, 0);
      image(c3, 0, 0);
     
    /* 
      fill(255, 0, 0);
      ellipse (width/3, height/3, 2*width/3, 2*width/3);
     
      fill(0, 255, 0);
      ellipse (2*width/3, height/3, 2*width/3, 2*width/3);
     
      fill(0, 0, 255);
      ellipse (width/2, 2*height/3, 2*width/3, 2*width/3);
    */

      blend(c1, 0, 0, width, height, 0, 0, width, height, ADD);
      blend(c2, 0, 0, width, height, 0, 0, width, height, ADD);
      blend(c3, 0, 0, width, height, 0, 0, width, height, ADD);
    }

Replies(4)

cx.smooth();
cx.notStroke();

thanks, that makes sense but i still see the stroke:

Copy code

  1. PGraphics c1, c2, c3;

    void setup() {

      size(600, 600);
      smooth();
      noStroke();
      background(255);

      c1 = createGraphics(width, height, P2D);
      c2 = createGraphics(width, height, P2D);
      c3 = createGraphics(width, height, P2D);

      c1.beginDraw();
      c1.smooth();
      c1.noStroke();
      c1.fill(255, 0, 0);
      c1.ellipse (width/3, height/3, 2*width/3, 2*width/3);
      c1.endDraw();

      c2.beginDraw();
      c2.smooth();
      c2.noStroke();
      c2.fill(0, 255, 0);
      c2.ellipse (2*width/3, height/3, 2*width/3, 2*width/3);
      c2.endDraw();

      c3.beginDraw();
      c3.smooth();
      c3.noStroke();
      c3.fill(0, 0, 255);
      c3.ellipse (width/2, 2*height/3, 2*width/3, 2*width/3);
      c3.endDraw();


      image(c1, 0, 0);
      image(c2, 0, 0);
      image(c3, 0, 0);
     
    /* 
      fill(255, 0, 0);
      ellipse (width/3, height/3, 2*width/3, 2*width/3);
     
      fill(0, 255, 0);
      ellipse (2*width/3, height/3, 2*width/3, 2*width/3);
     
      fill(0, 0, 255);
      ellipse (width/2, 2*height/3, 2*width/3, 2*width/3);
    */

      blend(c1, 0, 0, width, height, 0, 0, width, height, ADD);
      blend(c2, 0, 0, width, height, 0, 0, width, height, ADD);
      blend(c3, 0, 0, width, height, 0, 0, width, height, ADD);
    }

  c1 = createGraphics(width, height, JAVA2D);
  c2 = createGraphics(width, height, JAVA2D);
  c3 = createGraphics(width, height, JAVA2D);

P2D will be abandoned in next version, it adds more issues than solutions...
nice...thanks again!