I have a Pshape like this:
PShape s;
s.setFill(0);
if (s colour == color(0))
How do I detect the PShape colour?
Do I have to create my own PShape class?
I have a Pshape like this:
PShape s;
s.setFill(0);
if (s colour == color(0))
How do I detect the PShape colour?
Do I have to create my own PShape class?
I’ve tested this code that works on certain renderers.
I’ts on this link where GoToLoop also has another solution.
void setup() {
size(200, 200, P2D);
PShape bli = createShape();
bli.beginShape();
bli.fill(#ff0000);
bli.vertex(0, 0);
bli.fill(#00ff00);
bli.vertex(100, 100);
bli.fill(#0000ff);
bli.vertex(10, 100);
bli.endShape(CLOSE);
shape(bli);
fill( bli.getFill(0) ); //this only works with a renderer (p2d, etc)
rect(40, 40, 40, 40);
fill( bli.getFill(1) );
rect(60, 60, 40, 40);
fill( bli.getFill(2) );
rect(80, 80, 40, 40);
}