<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with setfill() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=setfill%28%29</link>
      <pubDate>Sun, 08 Aug 2021 20:15:15 +0000</pubDate>
         <description>Tagged with setfill() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedsetfill%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Exporting Sketch to Website using Javascript Mode - Always shows Errors</title>
      <link>https://forum.processing.org/two/discussion/27727/exporting-sketch-to-website-using-javascript-mode-always-shows-errors</link>
      <pubDate>Mon, 09 Apr 2018 18:54:16 +0000</pubDate>
      <dc:creator>borgejor</dc:creator>
      <guid isPermaLink="false">27727@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I am trying to embed my processing sketches on my website using the Javascript Mode. Every time I export however, it comes up with some type of error within the console log and won't load my sketch. The errors I have received on two different sketches are:</p>

<p><strong>VM20:145 Uncaught TypeError: circle.bind is not a function</strong>
    at eval (eval at attach (processing.js:872), :145:17)
    at Processing.Sketch.attach (processing.js:873)
    at executeSketch (processing.js:21501)
    at new Processing.Processing (processing.js:21535)
    at callback (processing.js:950)
    at XMLHttpRequest.xhr.onreadystatechange (processing.js:929)</p>

<p><strong>VM20:29 Uncaught ReferenceError: createShape is not defined</strong>
    at Processing.Processing.setup (eval at attach (processing.js:872), :29:9)
    at executeSketch (processing.js:21508)
    at new Processing.Processing (processing.js:21535)
    at callback (processing.js:950)
    at XMLHttpRequest.xhr.onreadystatechange (processing.js:929)</p>

<p>I had to download the JavaScriptMode from an online source so I am not sure if it will work, but it seems to handle simple sketches just fine. Is it having problems with 2D arrays? or something else I am unaware of.</p>

<p>The code for one of the sketches not working is below:</p>

<p>`    PImage logo;</p>

<pre><code>// Three possible shapes
PShape[] shapes = new PShape[4]; //Pshape array
int shapesize = 100; //shape sizes
int cols = 5;
int rows = 5;
int[][] shapeNumbers;

color[][] colors; //2D color array
color[] colorsb = 
{ 
#F71F02, //red
#13C081, //green
#5BC0EB, //blue
#FDE74C, //yellow
#133C55,
//#FF00FF, //pink
//#FF8000, //orange
};




void setup() {
  size(1920, 1080, P2D);
  ellipseMode(CENTER);
 rectMode(CENTER);
 logo = loadImage("thesis_logo.png");
  shapes[0] = createShape(ELLIPSE,shapesize,shapesize,shapesize,shapesize);
  //shapes[0].setFill(color(255,0,0));
  //shapes[0].setStroke(255);
  shapes[1] = createShape(RECT,shapesize,shapesize,shapesize,shapesize);
  //shapes[1].setFill(color(0));
  //shapes[1].setStroke(255);
  shapeMode(CENTER);
  shapes[2] = createShape();  
  shapes[2].beginShape();
 //shapes[2].fill(0); //fill squares
 // shapes[2].setStroke(255);
   shapes[2].vertex(-14+shapesize, -20+shapesize);
   shapes[2].vertex(-47+shapesize, -15+shapesize);
   shapes[2].vertex(-23+shapesize, 7+shapesize);
   shapes[2].vertex(-29+shapesize, 40+shapesize);
   shapes[2].vertex(0+shapesize, 25+shapesize);
    shapes[2].vertex(29+shapesize, 40+shapesize);
    shapes[2].vertex(23+shapesize, 7+shapesize);
    shapes[2].vertex(47+shapesize, -15+shapesize);
     shapes[2].vertex(14+shapesize, -20+shapesize);
  shapes[2].vertex(0+shapesize, -50+shapesize);
  shapes[2].endShape(CLOSE);

   shapes[3] = createShape(TRIANGLE,30, 75, 58, 20, 86, 75);  


shapeNumbers = new int[rows][cols];
 colors();
mix();
}




void draw() {
  background(255);
 shapes(150,150);
  image(logo, 50, 50, width/8, height/8);



 if (keyPressed) {
      if(key==ENTER){
       mix();
       colors();
      }
    }
}

void shapes(int posx, int posy){
 pushMatrix();
  translate(width/3,200);
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

      int shapeIndex = shapeNumbers[i][j];
PShape currentShape = shapes[shapeIndex];
     currentShape.setFill(colors[i][j]);
     currentShape.setStroke(false);
    shape(currentShape,i*posx,j*posy,shapesize,shapesize);

    if (mousePressed ==true){
      int x = i*posx+width/3;
      int y = j*posy+200;
     if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + shapesize) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + shapesize)){
      colors[i][j]=color(255);
    }
    }
    }
  }
    popMatrix();
}

void mix(){
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

    shapeNumbers[i][j] = int(random(shapes.length));

    }}
}

void colors(){
  colors = new color[cols][rows];
  for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {
      int rand = (int)random(colorsb.length); //choose a random value in array
      colors[i][j] = color(colorsb[rand]); //random color from array
    }
  }
}`
</code></pre>
]]></description>
   </item>
   <item>
      <title>[SOLVED] How to use variables from one function in another, when variables were ...</title>
      <link>https://forum.processing.org/two/discussion/27717/solved-how-to-use-variables-from-one-function-in-another-when-variables-were</link>
      <pubDate>Sat, 07 Apr 2018 18:07:27 +0000</pubDate>
      <dc:creator>borgejor</dc:creator>
      <guid isPermaLink="false">27717@/two/discussions</guid>
      <description><![CDATA[<p>I am not very skilled in Processing, but I have been trying to convert my sketch from mouse clicks to using Kinect hand states. How do I use variables from function1 in function2, when the variables were declared using function1's arguments?</p>

<pre><code>void shapes(int posx, int posy)
{
 pushMatrix();
translate(width/3,200);
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

      int shapeIndex = shapeNumbers[i][j];
      PShape currentShape = shapes[shapeIndex];
     currentShape.setFill(colors[i][j]);
     currentShape.setStroke(false);
     shape(currentShape,i*posx,j*posy,shapesize,shapesize);

    if (mousePressed ==true){
    int  x = i*posx+width/3;
     int y = j*posy+200;
     if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + shapesize) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + shapesize)){
      colors[i][j]=color(255);
    }
    }
    }
  }
    popMatrix();
}

void shapes(int posx, int posy){
 pushMatrix();
  translate(width/3,200);
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

      int shapeIndex = shapeNumbers[i][j];
PShape currentShape = shapes[shapeIndex];
     currentShape.setFill(colors[i][j]);
     currentShape.setStroke(false);
    shape(currentShape,i*posx,j*posy,shapesize,shapesize);

    if (mousePressed ==true){
    int  x = i*posx+width/3;
     int y = j*posy+200;
     if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + shapesize) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + shapesize)){
      colors[i][j]=color(255);
    }
    }
    }
  }
    popMatrix();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Pshape setFill() not working for me</title>
      <link>https://forum.processing.org/two/discussion/26825/pshape-setfill-not-working-for-me</link>
      <pubDate>Wed, 14 Mar 2018 00:53:48 +0000</pubDate>
      <dc:creator>vizologist</dc:creator>
      <guid isPermaLink="false">26825@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I am trying to create an annulus sector and be able to control the interior fill color. I created the shape as Pshape using arcs and lines, and then try to fill the color in the draw() routine.
The annulus sector displays, but the setFill() did not change the color.</p>

<p>Is there a way to make this work ?</p>

<p>Thanks.</p>

<p>(Formatted code below)</p>
]]></description>
   </item>
   <item>
      <title>How do I fill a 3D PShape Cube with color?</title>
      <link>https://forum.processing.org/two/discussion/26854/how-do-i-fill-a-3d-pshape-cube-with-color</link>
      <pubDate>Thu, 15 Mar 2018 01:16:57 +0000</pubDate>
      <dc:creator>Jsot745</dc:creator>
      <guid isPermaLink="false">26854@/two/discussions</guid>
      <description><![CDATA[<p>I was able to create the PShape Cube with a stroke the color that I want, but I am having trouble adding color to my cube. I have also tried moving "cube.setFill(color(100,200,0));" after "PShape cube = createShape();". Any help is greatly appreciated.</p>

<pre><code>import peasy.*;
import peasy.org.apache.commons.math.*;
import peasy.org.apache.commons.math.geometry.*;

PeasyCam cam;

void setup(){
  size(600,600, P3D);
  cam = new PeasyCam(this, 600);
}
void draw(){
  background(255);

  PVector p1 = new PVector(0, 0, 0);
  PVector p2 = new PVector(0, -100, 0);
  PVector p3 = new PVector(-100, -100, 0);
  PVector p4 = new PVector(-100, 0, 0);
  PVector p5 = new PVector(0, 0, -100); 
  PVector p6 = new PVector(0, -100, -100);
  PVector p7 = new PVector(-100, -100, -100);
  PVector p8 = new PVector(-100, 0, -100);

  PShape cube = createShape();
  cube.beginShape();
  cube.vertex(p1.x, p1.y, p1.z);
  cube.vertex(p2.x, p2.y, p2.z);
  cube.vertex(p3.x, p3.y, p3.z);
  cube.vertex(p4.x, p4.y, p4.z);

  cube.vertex(p1.x, p1.y, p1.z);
  cube.vertex(p5.x, p5.y, p5.z);
  cube.vertex(p6.x, p6.y, p6.z);
  cube.vertex(p2.x, p2.y, p2.z);

  cube.vertex(p3.x, p3.y, p3.z);
  cube.vertex(p7.x, p7.y, p7.z);
  cube.vertex(p8.x, p8.y, p8.z);
  cube.vertex(p4.x, p4.y, p4.z);

  cube.vertex(p8.x, p8.y, p8.z);
  cube.vertex(p5.x, p5.y, p5.z);
  cube.vertex(p6.x, p6.y, p6.z);
  cube.vertex(p7.x, p7.y, p7.z);

  cube.vertex(p8.x, p8.y, p8.z);
  cube.vertex(p4.x, p4.y, p4.z);

  cube.endShape(CLOSE);

  cube.setFill(color(100,200,0));
  stroke(100,200,0);
  shape(cube);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Convert a String to a Hexidecimal</title>
      <link>https://forum.processing.org/two/discussion/23953/convert-a-string-to-a-hexidecimal</link>
      <pubDate>Mon, 28 Aug 2017 18:45:39 +0000</pubDate>
      <dc:creator>Tallen121</dc:creator>
      <guid isPermaLink="false">23953@/two/discussions</guid>
      <description><![CDATA[<p>So I have an excel spreadsheet with "6ef442", I load the string and put it into classColor[0],  then here's where things get really stupid:</p>

<p>Tab1:</p>

<p><code>newEvent.coloring(classColor[0]);</code></p>

<p>Tab2:</p>

<p><code>void coloring(String chosen) {
   classColor = unhex(chosen);
}</code></p>

<p><code>void draw() {
   eventColor = createShape(RECT, 0, 0, 40, 40);
   eventColor.setFill(classColor);
   eventColor.setStroke(false);
}</code></p>

<p>No matter what obscure type of code I try, I cannot get that rectangle to turn 6ef442. Just... Help. If you know how to improve my ridiculous code or if you know how to get just my stupid rectangle to be the color I want it to be. I appreciate it a ton. Thank</p>
]]></description>
   </item>
   <item>
      <title>How to merge shapes that overlaps another?</title>
      <link>https://forum.processing.org/two/discussion/22040/how-to-merge-shapes-that-overlaps-another</link>
      <pubDate>Mon, 17 Apr 2017 05:48:00 +0000</pubDate>
      <dc:creator>kelvinh111</dc:creator>
      <guid isPermaLink="false">22040@/two/discussions</guid>
      <description><![CDATA[<p>Hi, as title described, here is my code:</p>

<pre><code>PShape grp, head, head2;

void setup() {
  size(200, 200);
  grp = createShape(GROUP);

  noStroke();

  head = createShape(ELLIPSE, 70, 70, 100, 100);
  head.setFill(color(255, 255, 255, 150));

  head2 = createShape(ELLIPSE, 120, 120, 100, 100);
  head2.setFill(color(255, 255, 255, 150));

  grp.addChild(head2);
  grp.addChild(head);
}

void draw() {
  background(150);
  shape(grp);
}
</code></pre>

<p>The result is:</p>

<p><img src="http://static.kelvinhung.me/files/tmp/p5-1.png" alt="" /></p>

<p>However, what I want is like this:</p>

<p><img src="http://static.kelvinhung.me/files/tmp/p5-2.png" alt="" />
<img src="http://static.kelvinhung.me/files/tmp/p5-3.png" alt="" /></p>

<p>Researched a bit but had no luck, is there any way to do this? 
Either Processing or p5.js solution is welcome, I'll be grateful.
Thanks.</p>
]]></description>
   </item>
   <item>
      <title>PShape OBJ.setStroke</title>
      <link>https://forum.processing.org/two/discussion/15866/pshape-obj-setstroke</link>
      <pubDate>Tue, 05 Apr 2016 20:19:24 +0000</pubDate>
      <dc:creator>noamnav</dc:creator>
      <guid isPermaLink="false">15866@/two/discussions</guid>
      <description><![CDATA[<p>hello all,</p>

<p>i'm trying to set the stroke of an imported obj file i'm importing into the drawing with no success. funnily, the setFill() function works just fine.</p>

<p>at the moment, the setStroke() function has no effect on the drawing.</p>

<p>suggestions?</p>

<p>thanks</p>

<pre><code>PShape p;

void setup() {
  size (500, 500, P3D);
  p = loadShape("poly.obj");
  p.setFill(color(150, 0, 0, 100));
  p.setStrokeWeight(10);
  p.setStroke(color(0));
} 

void draw() {
  background(214);
  shape(p, 0, 0);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to change the color of one triangle in a PShape? (TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP...)</title>
      <link>https://forum.processing.org/two/discussion/19317/how-to-change-the-color-of-one-triangle-in-a-pshape-triangles-triangle-fan-triangle-strip</link>
      <pubDate>Sat, 26 Nov 2016 19:55:12 +0000</pubDate>
      <dc:creator>AKK</dc:creator>
      <guid isPermaLink="false">19317@/two/discussions</guid>
      <description><![CDATA[<p>In processing there is this cool tool called PShape that if you don't know about, you should learn, it is extremly powerful when it comes to complicated graphics (3d graphics in my case), and makes even unthinkable concepts managable.
But I ran into a problem with it, processing provides a variaty of cool built-in shapes you can use, in my case things like triangle fans, triangle strips, and just a bunch of triangles, but they lack some functionality I wish it had, changing single triangle colors.
When you use a GROUP shape it can have many children shapes which consist of it, and the best part is you still can use each child as an individual shape, and you would think triangle strips and fans should be the same, it is a big shape made from many little triangles, so I should be able to control each triangle individually, and to some level it is, you can get how many vertices make the shape, and even move them, but when it comes to color you can control only the color of the entire shape, and not each triangle by itself.
Is there any way around this? Can I somehow change the color of a single triangle without the rest in a built-in shape?</p>
]]></description>
   </item>
   <item>
      <title>Shape.setFill()</title>
      <link>https://forum.processing.org/two/discussion/17234/shape-setfill</link>
      <pubDate>Mon, 20 Jun 2016 22:53:08 +0000</pubDate>
      <dc:creator>rtavakko</dc:creator>
      <guid isPermaLink="false">17234@/two/discussions</guid>
      <description><![CDATA[<p>Hi people,</p>

<p>Not sure if I'm using setFill() correctly but I get the error "Array Index out of bounds: 6" when I use it this way:</p>

<p>shape1.setFill(color(255,0,0,226));</p>

<p>I'd appreciate any tips you may have.</p>

<p>Thanks!</p>
]]></description>
   </item>
   <item>
      <title>Help with PShape are setTint() or setFill() working?</title>
      <link>https://forum.processing.org/two/discussion/4226/help-with-pshape-are-settint-or-setfill-working</link>
      <pubDate>Tue, 08 Apr 2014 10:35:01 +0000</pubDate>
      <dc:creator>Schievelbein</dc:creator>
      <guid isPermaLink="false">4226@/two/discussions</guid>
      <description><![CDATA[<p>I do not know if this should go under "Questions about Code" or "Libraries"
Are the setFill() and/or setTint() functionalities working within PShape.
I am trying to use wither of the capabilities in the code below and seeing no changes.
Am I missing something in my code?
Does anybody have any code that uses this functionality?
Thanks for all of the help.</p>

<pre><code>void settrans(int trans) { 
  println("Setting TRANSPARENCY to "+trans+" *********************************");
  int braincells = brain.getChildCount();
    for (int cellnum = 0; cellnum &lt; braincells; ++cellnum) {
      tempcell= brain.getChild(cellnum);
      for (int j = 0; j&lt;6; j++) {
        tempface=tempcell.getChild(j);
        //tempface.setFill(quadBG[j]);
        tempface.setTint(trans);
    }}
  shape(brain);}      // Draw the brain
</code></pre>

<p>My tracing when I make the calls is :
Setting TRANSPARENCY to 255 *********************************
Setting TRANSPARENCY to 88 *********************************
Setting TRANSPARENCY to 255 *********************************
Setting TRANSPARENCY to 88 *********************************</p>
]]></description>
   </item>
   </channel>
</rss>