<?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 stroke() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=stroke%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:45:04 +0000</pubDate>
         <description>Tagged with stroke() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedstroke%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Stroke not visible through png</title>
      <link>https://forum.processing.org/two/discussion/23212/stroke-not-visible-through-png</link>
      <pubDate>Mon, 26 Jun 2017 11:56:48 +0000</pubDate>
      <dc:creator>frankbass</dc:creator>
      <guid isPermaLink="false">23212@/two/discussions</guid>
      <description><![CDATA[<p>I can't see the stroke of the box() when the png image is in front.
What am I doing wrong?</p>

<pre><code>PImage body1;
int w = 400;    
int h = 200;

void setup() {    
  size(1000, 700, P3D);   
  body1 = loadImage("Basketball.png");    
}

void draw() {    
  background(200);   
  translate(width/2, height/2);   
  float x = map(mouseX, 0, width, -PI/2, PI/2);   
  rotateY(x);

  noFill();   
  box(w, h, w);

  pushMatrix();
  translate(-100, 15);
  scale(.25);    
  image(body1, 0, 0);    
  popMatrix();    
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Drawing dotted line around a rect (ie: dotted stroke)?</title>
      <link>https://forum.processing.org/two/discussion/13585/drawing-dotted-line-around-a-rect-ie-dotted-stroke</link>
      <pubDate>Sat, 21 Nov 2015 07:54:47 +0000</pubDate>
      <dc:creator>brig</dc:creator>
      <guid isPermaLink="false">13585@/two/discussions</guid>
      <description><![CDATA[<p>Hi all. Is there any easy way to draw a dotted stroke? 
Just want to draw an empty rectangle (bar chart) with a dotted line around its borders (stroke), instead of solid. Don't see any easy way to do that. No shortcuts?</p>
]]></description>
   </item>
   <item>
      <title>Unexpected Color Change</title>
      <link>https://forum.processing.org/two/discussion/20932/unexpected-color-change</link>
      <pubDate>Tue, 21 Feb 2017 19:23:34 +0000</pubDate>
      <dc:creator>papak</dc:creator>
      <guid isPermaLink="false">20932@/two/discussions</guid>
      <description><![CDATA[<p>// Using Processing-3.3
// The stroke color defaults to black if no stroke command is issued.
// In the code I was expecting the rectangle to have a black stroke color.
// The ellipse has the expected blue stroke color.
// The line has the expected green stroke color.</p>

<p>// Why does the rectangle have a green stroke color?</p>

<p>void setup()
{
  size(480,420);
  background(220);
}</p>

<p>void draw()
{
  rect(100,200,100,100);  // Expect this to have a black stroke color
  stroke(255,0,0);
  strokeWeight(3);
  stroke(0,0,255);
  ellipse(240,80, 115,115);
  stroke(0,255,0);
  line(5,5,400,310);
}</p>
]]></description>
   </item>
   <item>
      <title>Using stroke() on a 2D array of objects to only highlight the border of a specified object</title>
      <link>https://forum.processing.org/two/discussion/20739/using-stroke-on-a-2d-array-of-objects-to-only-highlight-the-border-of-a-specified-object</link>
      <pubDate>Fri, 10 Feb 2017 21:20:54 +0000</pubDate>
      <dc:creator>drewbaumgartner</dc:creator>
      <guid isPermaLink="false">20739@/two/discussions</guid>
      <description><![CDATA[<pre><code>import processing.core.*;

public class floodFillGUI extends PApplet {

    private cell grid[][]; // this is the grid layout of the cell objects
    private boolean overCell = false; // used to determine when the mouse is hovering over a cell
    private int rowSize = 4; // currently hard coded size of the grid array "grid[rowSize][columnSize]", plan to make this dynamic in the future
    private int columnSize = 4; // currently hard coded size of the grid array "grid[rowSize][columnSize]", plan to make this dynamic in the future
    private int currentRow = 0; // used to track the index of the current row (current == mouse over) 
    private int currentColumn = 0; // used to track the index of the current column (current == mouse over) 

    public static void main(String[] args)
    {
        PApplet.main("floodFillGUI");
    }

    public void setup()
    {
        size(400, 600);
        buildGrid();                
    }

    public void draw()
    {           
        for(int row = 0; row &lt; grid.length; row++)
        {
            for(int column = 0; column &lt; grid[row].length; column++)
            {
                isMouseOverCell();
                grid[row][column].display(grid.length, row, grid[row].length, column, overCell);
            }
        }           
    }

    public void buildGrid()
    {
        grid = new cell[rowSize][columnSize];

        for(int row = 0; row &lt; grid.length; row++)
        {
            for(int column = 0; column &lt; grid[row].length; column++)
            {
                grid[row][column] = new cell(this, width, height-200); //initialize the grid object, -200 height is to give a buffer at the bottom of the window for adding new  display features
                grid[row][column].set_bgColor(column);
                grid[row][column].set_fgColor(column);
                grid[row][column].setNumber(column);
            }
        }
    }

    public void isMouseOverCell()
    {
        int rowIndex = 0;
        int columnIndex = 0;

        // get mouse position Y and divide by applet height / rowSize ([R][C] or [Y][X])
        // Example if mouseY is on pixel 150 and total height of applet is 400 and our rowSize array is 4
        // then it is (150 / (400 / 4)) which is (150 / 100) which is 1, therefore my rowIndex is 1 in [R][C] 
        rowIndex = (mouseY / ((int) (height-200) / rowSize));
        columnIndex = (mouseX / ((int) width / columnSize));

        // If our mouse is in a cell set overCell to true and record that cell's indexes
        if(rowIndex &lt; rowSize &amp;&amp; columnIndex &lt; columnSize)
        {
            currentRow = rowIndex;
            currentColumn = columnIndex;
            overCell = true;
            //System.out.println("[" + currentRow + "][" + currentColumn + "]");
        }
        else
        {
            overCell = false;
        }
    }
}


import processing.core.*;

public class cell{
    private final int RADIUS = 2; // int processing.core.PConstants.RADIUS = 2
    private final int CENTER = 3; // int processing.core.PConstants.CENTER = 3

    private PApplet parent; // the parent PApplet that we will render ourselves onto
    private int number = 0; // stores integer value that is to be displayed on the cell
    private int fgColor = 0; // stores foreground color
    private int bgColor = 0; // stores background color
    private int rowSize = 0; // stores [R].length of the [R][C] cell array
    private int columnSize = 0; // stores [C].length of the [R][C] cell array
    private float xPos = 0; // center position of cell on x axis
    private float yPos = 0; // center position of cell on y axis
    private float xSize = 0; // size of cell in the x axis
    private float ySize = 0; // size of cell in the y axis
    private float width = 0; // width of area containing all cells (usually going to be equal to parent.width)
    private float height = 0; // height of area containing all cells (usually going to be less than parent.height)

    public enum colors
    {
        BLUE        (0, 0, 255),
        DARK_BLUE   (0, 0, 200),
        ORANGE      (255, 102, 0),
        DARK_ORANGE (179, 71, 0),
        GREEN       (0, 255, 0),
        DARK_GREEN  (0, 200, 0),
        PURPLE      (153, 51, 255),
        DARK_PURPLE (115, 0, 230),
        RED         (255, 0, 0),
        DARK_RED    (200, 0, 0),
        YELLOW      (255, 255, 0),
        DARK_YELLOW (179, 179, 0),
        AQUA        (51, 204, 204),
        DARK_AQUA   (36, 143, 143),
        PINK        (255, 51, 153),
        DARK_PINK   (230, 0, 115),
        LIME        (153, 255, 102),
        DARK_LIME   (119, 255, 51),
        SALMON      (255, 128, 128),
        DARK_SALMON (255, 85, 85),
        GRAY        (150, 150, 150),
        DARK_GRAY   (100, 100, 100);

        private final int red;
        private final int green;
        private final int blue;

        private colors(int r, int g, int b)
        {
            red = r;
            green = g;
            blue = b;
        }

        public int[] getColor()
        {
            int[] array = {this.red, this.green, this.blue};
            return array;
        }

        public int getR_val()
        {
            return this.red;
        }

        public int getG_val()
        {
            return this.green;
        }

        public int getB_val()
        {
            return this.blue;
        }
    }

    public cell(PApplet p, float width, float height)
    {
        parent = p;
        this.width = width;
        this.height = height;
    }

    public void display(int rSize, int rowIndex, int cSize, int columnIndex, boolean mouseOver)
    {
        columnSize = cSize;
        rowSize = rSize;
        float xDis = 2 * columnSize; // double column array length [R][C]
        float yDis = 2 * rowSize; // double the row array length [R][C]
        xSize = width / xDis; // this is the size of the square in the X axis
        ySize = height / yDis; // this is the size of the square in the Y axis
        xPos = (width * ((1 + columnIndex * 2) / xDis)); // position of the square based on its center in the X axis.  The (1 + index * 2) is the offset from the left edge (X axis)
        yPos = (height * ((1 + rowIndex * 2) / yDis));  // position of the square based on its center in the Y axis  The (1 + index * 2) is the offset from the top edge (Y axis)

        parent.stroke(0); // set the outline of the geometry to black

        this.set_bgColor(number); // set the background color to the "dark" variant
        parent.fill(bgColor); 
        parent.rectMode(RADIUS);
        parent.rect(xPos, yPos, xSize, ySize); 

        if(mouseOver)
        {
            parent.stroke(255);
        }

        this.set_fgColor(number);
        parent.fill(fgColor);
        parent.rectMode(CENTER);
        parent.rect(xPos, yPos, width * 7/32, height * 7/32, 5);

        parent.fill(0);
        parent.textSize(40);
        parent.textAlign(CENTER, CENTER);
        parent.text(number, xPos, yPos - 5);        
    }

    public void set_fgColor(int r, int g, int b)
    {
        fgColor = parent.color(r, g, b);
    }

    public void set_fgColor(int numValue)
    {
        switch(numValue){
            case 0:
                fgColor = parent.color(colors.BLUE.getR_val(), colors.BLUE.getG_val(), colors.BLUE.getB_val());
                break;
            case 1:
                fgColor = parent.color(colors.ORANGE.getR_val(), colors.ORANGE.getG_val(), colors.ORANGE.getB_val());
                break;
            case 2:
                fgColor = parent.color(colors.GREEN.getR_val(), colors.GREEN.getG_val(), colors.GREEN.getB_val());
                break;
            case 3:
                fgColor = parent.color(colors.PURPLE.getR_val(), colors.PURPLE.getG_val(), colors.PURPLE.getB_val());
                break;
            case 4:
                fgColor = parent.color(colors.RED.getR_val(), colors.RED.getG_val(), colors.RED.getB_val());
                break;
            case 5:
                fgColor = parent.color(colors.YELLOW.getR_val(), colors.YELLOW.getG_val(), colors.YELLOW.getB_val());
                break;
            case 6:
                fgColor = parent.color(colors.AQUA.getR_val(), colors.AQUA.getG_val(), colors.AQUA.getB_val());
                break;
            case 7:
                fgColor = parent.color(colors.PINK.getR_val(), colors.PINK.getG_val(), colors.PINK.getB_val());
                break;
            case 8:
                fgColor = parent.color(colors.LIME.getR_val(), colors.LIME.getG_val(), colors.LIME.getB_val());
                break;
            case 9:
                fgColor = parent.color(colors.SALMON.getR_val(), colors.SALMON.getG_val(), colors.SALMON.getB_val());
                break;
            default:
                fgColor = parent.color(colors.GRAY.getR_val(), colors.GRAY.getG_val(), colors.GRAY.getB_val());
                break;
        }
    }

    public int get_fgColor()
    {
        return fgColor;
    }

    public void set_bgColor(int r, int g, int b)
    {
        bgColor = parent.color(r, g, b);
    }

    public void set_bgColor(int numValue)
    {
        switch(numValue){
            case 0:
                bgColor = parent.color(colors.DARK_BLUE.getR_val(), colors.DARK_BLUE.getG_val(), colors.DARK_BLUE.getB_val());
                break;
            case 1:
                bgColor = parent.color(colors.DARK_ORANGE.getR_val(), colors.DARK_ORANGE.getG_val(), colors.DARK_ORANGE.getB_val());
                break;
            case 2:
                bgColor = parent.color(colors.DARK_GREEN.getR_val(), colors.DARK_GREEN.getG_val(), colors.DARK_GREEN.getB_val());
                break;
            case 3:
                bgColor = parent.color(colors.DARK_PURPLE.getR_val(), colors.DARK_PURPLE.getG_val(), colors.DARK_PURPLE.getB_val());
                break;
            case 4:
                bgColor = parent.color(colors.DARK_RED.getR_val(), colors.DARK_RED.getG_val(), colors.DARK_RED.getB_val());
                break;
            case 5:
                bgColor = parent.color(colors.DARK_YELLOW.getR_val(), colors.DARK_YELLOW.getG_val(), colors.DARK_YELLOW.getB_val());
                break;
            case 6:
                bgColor = parent.color(colors.DARK_AQUA.getR_val(), colors.DARK_AQUA.getG_val(), colors.DARK_AQUA.getB_val());
                break;
            case 7:
                bgColor = parent.color(colors.DARK_PINK.getR_val(), colors.DARK_PINK.getG_val(), colors.DARK_PINK.getB_val());
                break;
            case 8:
                bgColor = parent.color(colors.DARK_LIME.getR_val(), colors.DARK_LIME.getG_val(), colors.DARK_LIME.getB_val());
                break;
            case 9:
                bgColor = parent.color(colors.DARK_SALMON.getR_val(), colors.DARK_SALMON.getG_val(), colors.DARK_SALMON.getB_val());
                break;
            default:
                bgColor = parent.color(colors.DARK_GRAY.getR_val(), colors.DARK_GRAY.getG_val(), colors.DARK_GRAY.getB_val());
                break;
        }
    }

    public int get_bgColor()
    {
        return bgColor;
    }

    public void setNumber(int val)
    {
        number = val;
    }

    public int getNumber()
    {
        return number;
    }

    public float getXPos()
    {
        return xPos;
    }

    public float getYPos()
    {
        return yPos;
    }

    public float getXSize()
    {
        return xSize;
    }

    public float getYSize()
    {
        return ySize;
    }

}
</code></pre>

<p>Sorry for the huge block of code but I figure I would just include it all to provide full context.  I'm currently trying to build a game that I found while browsing reddit's daily programming challenges (<a href="http://entibo.fr/lvlr/" target="_blank" rel="nofollow">http://entibo.fr/lvlr/</a>).  I'm just laying down the ground work at the moment and I've hit a road block.  This is my first time using the processing library (found it from the University of California, San Diego OOP in Java class) but this is not my first time using Java or Eclipse and so naturally that is the IDE that I am currently using.  Also, this is my first time using ENUM classes...so if the one I'm using is useless I apologize in advance.</p>

<p>Anyway, my programming issue is that when I attempt to draw the border around a cell that is being moused over I instead draw borders around all the rectangles (cells) on screen.  I have already put the logic in place for determining which rectangle needs the border drawn around it (I've tested this by my commented out println statement and it does print out the correct indexes of the moused over cell).  I just need help figuring out how I should modify my cell class's display() method to accomplish this.</p>

<p>This image is an example of the program running and the mouse is not hovering over any of the cells.<br />
<img src="https://forum.processing.org/two/uploads/imageupload/517/RY86QOU0M1L3.PNG" alt="not rolled over" title="not rolled over" />
<br />Notice no borders are lit up? This is working as intended!</p>

<p>This image is an example of the program running and the mouse is touching one of the cells.<br />
<img src="https://forum.processing.org/two/uploads/imageupload/207/TVXTW2O0VWW1.PNG" alt="rolled over" title="rolled over" />
<br />Notice how all the borders are lit up? This is not working as intended!</p>

<p>I only want 1 cell at any given time to become highlighted upon mouse roll over.  For example if I mouse over the cell located in grid[1][2], then I would want the 3rd from the top "Orange" cell to be highlighted and nothing else.</p>

<p>Any help would be appreciated and again sorry for posting all my code, I just want to be as thorough as possible.</p>
]]></description>
   </item>
   <item>
      <title>stroke() influencing the textstyle()?</title>
      <link>https://forum.processing.org/two/discussion/16634/stroke-influencing-the-textstyle</link>
      <pubDate>Mon, 16 May 2016 09:25:56 +0000</pubDate>
      <dc:creator>technik5</dc:creator>
      <guid isPermaLink="false">16634@/two/discussions</guid>
      <description><![CDATA[<p>There is an interessting bug, when my function calls stroke in an object it changes the textstyle afterwards and gives a strokeWeight() to it...
my TextClass:</p>

<pre><code>    function textClass(_x, _y) {
      colorMode(HSB,100);
      textAlign(CENTER);
      this.x = _x;
      this.y = _y;
      this.writeText = function(_content, _font, _size, _color) {
        this.content = _content;
        this.font = _font;
        this.size = _size;
        this.col = color(_color);
        textSize(this.size);
        fill (this.col);
        text (this.content, this.x, this.y);
      }
      this.writeTextBox = function(_content, _font, _size, _color, _x2, _y2) {
        this.content = _content;
        this.font = _font;
        this.size = _size;
        this.col = color(_color);
        this.x2 = _x2;
        this.y2 = _y2;
        textSize(this.size);
        fill (this.col);
        text (this.content, this.x, this.y, this.x2, this.y2);
      }
    }
</code></pre>

<p>And my objectClass with the stroke(255)-Problem.</p>

<pre><code>function buttons(_bPosX, _bPosY, _bWidth2, _bHeight2, _bColor) {
  colorMode(HSB, 100);
  this.bPosX = _bPosX;
  this.bPosY = _bPosY;
  this.bWidth2 = _bWidth2;
  this.bHeight2 = _bHeight2;
  this.bColor = color(_bColor);
  //function to draw Rect Buttons
  this.drawButtonRect = function() {
    //bPosX = _bPosX;
    stroke(1);//HERE IS NO PROBLEM
    strokeWeight(1);
    fill(this.bColor);
    rect(this.bPosX, this.bPosY, this.bWidth2, this.bHeight2);
    noStroke();
  }

  //function to draw Ellipse Buttons
  this.drawButtonEllipse = function() {
    stroke(1);//HERE IS THE PROBLEM, JUST FOR ELLIPSE BUTTONS, if away no StrokeWeight to text, but also no stockeWeight to my ellipse...hmmm
    strokeWeight(1);
    fill(this.bColor);
    ellipseMode(CENTER);
    ellipse(this.bPosX, this.bPosY, this.bWidth2, this.bHeight2);
  }

  //function to update the Buttons
  this.updateButtonRect = function() {
    stroke(255); //DOES NOT MAKE ANY PROBLEM AT ALL
    strokeWeight(1);
    //colorMode(HSB, 100);
    this.bSelectColor = color('#9b8c8c');
    fill(this.bSelectColor);
    rect(this.bPosX, this.bPosY, this.bWidth2, this.bHeight2);
  }

  this.updateButtonEllipse = function() {
      stroke(255); //HERE IS THE PROBLEM, JUST FOR ELLIPSE BUTTONS
      strokeWeight(1);
      //colorMode(HSB, 100);
      this.bSelectColor = color('#939393');
      fill(this.bSelectColor);
      ellipseMode(CENTER);
      ellipse(this.bPosX, this.bPosY, this.bWidth2, this.bHeight2);
    }
    //
    //Checks if Mouse is Over Rectangular Button
  this.mouseOverRect = function() {
      if (touchX &gt; this.bPosX &amp;&amp; touchX &lt; this.bPosX + this.bWidth2 &amp;&amp; touchY &gt; this.bPosY &amp;&amp; touchY &lt; this.bPosY + this.bHeight2) {
        return true;
      } else {
        return false;
      }
    }
    //Checks if Mouse is Over Rectangular Button
  this.mouseOverEllipse = function() {
    this.disX = this.bPosX - touchX;
    this.disY = this.bPosY - touchY;
    if (sqrt(sq(this.disX) + sq(this.disY)) &lt; this.bWidth2 / 2) {
      return true;
    } else {
      return false;
    }
  }
}
</code></pre>

<p>Any Ideas where the Problem could lie?</p>
]]></description>
   </item>
   <item>
      <title>For each new object, the same color is being returned from the color array</title>
      <link>https://forum.processing.org/two/discussion/14240/for-each-new-object-the-same-color-is-being-returned-from-the-color-array</link>
      <pubDate>Mon, 04 Jan 2016 00:52:16 +0000</pubDate>
      <dc:creator>AceSlowman</dc:creator>
      <guid isPermaLink="false">14240@/two/discussions</guid>
      <description><![CDATA[<p>I have a class, in which I am storing a group of colors. When each object is initialized, I want a random color from that array to be chosen, but currently, it is returning the same color for all objects. What could be going on here?</p>

<pre><code>//
/**
Rotor draws circle for random period of time, then moves
in a straight direction for a random period of time, beginning a 
new circle
*/
//

Rotor[] r;
float timer = 0;
int number = 0;
boolean freeze = true;

void setup() {
  //regular resolution
  //size(1280,720);
  //300 dpi
  size(5333,3000);

  noFill();
  frameRate(30);
  background(65,5,17);

  timeLimit();
  r = new Rotor[50];

  for(int i=0; i&lt;r.length; i++){
    r[i] = new Rotor(random(width),random(height),random(200));
  }
}

void draw() {
  timer = timer + frameRate/1000;

  if(timer &gt; timeLimit()){
    timer = 0;
    timeLimit();

    if(freeze == true){ 
      for(int i = 0; i &lt; r.length; i++)
        r[i].drawNewRotor();
      freeze = false;
      //r.pointSpeed = r.pointSpeed * -1;
    }else{
      for(int i = 0; i &lt; r.length; i++)
        r[i].calcTangent();

      freeze = true;
    }
  }

  if(!freeze){
    for(int i = 0; i &lt; r.length; i++)
      r[i].drawRotor(); 
  }else{
    for(int i = 0; i &lt; r.length; i++)
      r[i].holdSteady();
  }
}

float timeLimit(){
  float timeLimit = random(200); 
  return timeLimit;
}

void keyPressed(){
  if(key=='s') {
    String s = "screen_" + nf(number, 3) +".jpg";
    save(s);
    number++;
  } 
}



/*
assuming you are taking derivatives with respect to the theta: 
dx/d(theta)=-cos(theta) and dy/d(theta)= sin(theta)...
dx/d(theta) and dy/d(theta) 
just says "derivative of x (or y) with respect to (theta)" 
*/

class Rotor {

  color[] colors = new color[5];
  int thickness;
  float xPoint = random(width);
  float yPoint = random(height);
  float nXPoint;
  float nYPoint;
  float radius;
  float theta = 0;
  float centerX;
  float centerY;
  float yLine;
  float pointSpeed = 0.02;
  float deltaX;
  float deltaY;

  Rotor(float cX, float cY, float rad) {
    colors[0] = color(119,216,197);
    colors[1] = color(99,56,53);
    colors[2] = color(176,51,40);
    colors[3] = color(232,131,123);
    colors[4] = color(199,58,46);

    thickness = 2;

    noStroke();
    stroke(colors[int(random(colors.length))]);
    strokeWeight(thickness);

    centerX = cX;
    centerY = cY;
    radius = rad;
    theta = 0.0;
  } 

  void drawRotor() {
    theta = theta + pointSpeed;
    xPoint = centerX + cos(theta) * radius;
    yPoint = centerY + sin(theta) * radius;
    ellipse(xPoint, yPoint,thickness,thickness);
    //ellipse(centerX,centerY,5,5);//center point
  }

  void holdSteady() {
    xPoint = xPoint + deltaX/50;//speed /100
    yPoint = yPoint + deltaY/50;
    ellipse(xPoint,yPoint,thickness,thickness);
  }

  void calcTangent() {
    deltaX = radius * -sin(theta);
    deltaY = radius * cos(theta);
  }

  void drawNewRotor() {
    radius = random(200);

    centerX = xPoint + radius * cos(theta);
    centerY = yPoint + radius * sin(theta);

    theta = (theta + PI)%(2*PI);
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Back to black?</title>
      <link>https://forum.processing.org/two/discussion/13526/back-to-black</link>
      <pubDate>Sun, 15 Nov 2015 16:07:29 +0000</pubDate>
      <dc:creator>Dirruk</dc:creator>
      <guid isPermaLink="false">13526@/two/discussions</guid>
      <description><![CDATA[<p>Okay, so I am completely new to Processing and I am trying to get the basics. I am trying to build an arduino printer that uses data sent by Processing over serial to draw a bitmap on a wall, but that is way too ambitious for where I am right now.</p>

<p>I figured I wanted to have a bitmap with an alpha of 50 per cent that brightens up when you go over it with your mouse. So I took the pointillism sketch and manipulated it a bit. But somehow I cannot get a color value using get() and all pixels turn out black. What am I missing here?</p>

<p>(I was using a picture of "Girl with a pearl earring" by Johannes Vermeer for this)</p>

<pre><code>        PImage img;

        void setup()

        {

          img = loadImage("parel.jpg");

          size(182,262);

          tint (255,127);

          image (img,0,0);

        }


        void draw()

        { 

          color pix = img.get(mouseX, mouseY);

          fill(pix);

          point(mouseX, mouseY);

        }
</code></pre>
]]></description>
   </item>
   <item>
      <title>p5js - Suport for noFill() and stroke() in WEBGL</title>
      <link>https://forum.processing.org/two/discussion/13472/p5js-suport-for-nofill-and-stroke-in-webgl</link>
      <pubDate>Tue, 10 Nov 2015 20:31:58 +0000</pubDate>
      <dc:creator>ukmikeb</dc:creator>
      <guid isPermaLink="false">13472@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I'm looking to draw the mesh of a sphere in p5js.</p>

<p>noFill() and stroke don't seem to work in WEBGL mode.. is that correct or am I missing something?</p>

<p>Seems we can only render solid meshes so far.</p>

<p>Thanks</p>

<p>Mike</p>
]]></description>
   </item>
   <item>
      <title>how to light stroke?</title>
      <link>https://forum.processing.org/two/discussion/12613/how-to-light-stroke</link>
      <pubDate>Mon, 21 Sep 2015 03:52:04 +0000</pubDate>
      <dc:creator>mattleaf</dc:creator>
      <guid isPermaLink="false">12613@/two/discussions</guid>
      <description><![CDATA[<p>hello,</p>

<p>playing around with lights and noticed lighting has no effect on stroke.</p>

<p>is there a way i can achieve it?</p>

<p>many thanks</p>

<pre><code>void setup() {
  size(400, 400, P3D);
  smooth(8);
}

void draw() {
  background(0);
  fill(255);
  stroke(255, 255, 255, 255);
  pointLight(150, 102, 122, mouseX, 40, mouseY);
  translate(width/2, height/2, 0);
  sphere(100);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Fill over stroke?</title>
      <link>https://forum.processing.org/two/discussion/12221/fill-over-stroke</link>
      <pubDate>Sun, 23 Aug 2015 13:39:20 +0000</pubDate>
      <dc:creator>rmaskey</dc:creator>
      <guid isPermaLink="false">12221@/two/discussions</guid>
      <description><![CDATA[<p>for some reason I am getting this effect... the inner most circle which is filled in black is not removing the stroke from the arc. But when I copied the code out into a new sketch is is doing it correctly.</p>

<p>Any idea what I should be looking for in the code that might be causing this? I've tried removing blendMode but still nothing changes.</p>

<p><img src="http://forum.processing.org/two/uploads/imageupload/100/LI78N5EQVH5P.png" alt="Screen Shot 2015-08-23 at 14.35.48" title="Screen Shot 2015-08-23 at 14.35.48" /></p>

<pre><code>float timer;
void setup () {
  size (800, 600);
  frameRate(30);
}
void draw() {
  background(0);
  timer += 0.01;
  float a = map(sin(timer), -1, 1, 40, 360);

  float arc1 = map(sin(timer), -1, 1, 0, 360);
  float arc2 = map(cos(timer), -1, 1, 0, 360);
  strokeWeight(10);
  noFill();

  stroke(200, 0, 0, a);
  arc(width/2, height/2, 180, 180, radians(181), radians(arc1+180), OPEN);         ///// INNER RING /////
  stroke(0, 200, 0, a);
  arc(width/2, height/2, 300, 300, 0, radians(arc1), OPEN);                        ///// SECOND RING /////
  stroke(0, 0, 200, a);
  arc(width/2, height/2, 240, 240, radians(-arc1), 0, OPEN);                      //// MAIN RING //////
  stroke(200, 200, 0, a/2);
  arc(width/2, height/2, 360, 360, radians(-arc2+181), radians(180), OPEN);       //// OTHER RING /////
  stroke(0, 200, 200, a);
  fill(200, 0, 200, 60);
  arc(width/2, height/2, 360, 360, radians(-arc1+181), radians(180), PIE);      ///// OTHER RING //////
  fill(0);
  stroke(0);
  ellipse(width/2, height/2, 60, 60);        ////// INNERMOST CIRCLE /////
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>[SOLVED] Is stroke applied after fill?</title>
      <link>https://forum.processing.org/two/discussion/11140/solved-is-stroke-applied-after-fill</link>
      <pubDate>Wed, 03 Jun 2015 19:45:19 +0000</pubDate>
      <dc:creator>khoma</dc:creator>
      <guid isPermaLink="false">11140@/two/discussions</guid>
      <description><![CDATA[<p>Hi</p>

<p>I'm creating a simple breakout game where in when a block is hit it moves out of the screen at a certain pace, and then disappears. I would like said block to be drawn on top of any block that is still stationary. It works only partially. For some reason the fill of the moving block is drawn on top of the fill of the stationary block, but the stroke of the stationary block shows through the moving block. Image here:
<img src="http://s11.postimg.org/dwxsombhf/processing_stroke_fill.png" alt="" /></p>

<p>The moving blocks are drawn after the stationary blocks. The code for drawing a block looks like this:</p>

<pre><code>    @ Override
    public void draw() {
        if (doomed) {
            x += velocity * cos(angle);
            y += velocity * sin(angle);
        }
        if (x &lt; 0 || x &gt; width || y &lt; 0 || y &gt; height) {
            dead = true;
        } else {
            strokeCap(SQUARE);
            fill(red, green, blue);
            stroke(0);
            rect(x, y, w, h);
            noStroke();
            fill(red + lowerColor, green + lowerColor, blue + lowerColor);
            triangle(x, y + blockHeight, x + blockWidth, y + blockHeight, x + blockWidth, y);
            fill(red + upperColor, green + upperColor, blue + upperColor);
            rect(x + bevel * cos(bevelAngle), y + bevel * sin(bevelAngle), blockWidth - 2 * bevel * cos(bevelAngle), blockHeight - 2 * bevel * sin(bevelAngle));
        }
    }
</code></pre>

<p>The main draw loop called by processing looks like this, where blockArray contain all the stationary blocks, and doomedBlockArray contains all the moving blocks:</p>

<pre><code>@ Override
public void draw() {
    if (firstRun &amp;&amp; frame != null) {                    // Lock frame size
        frame.setResizable(false);
        firstRun = false;
    }

    background(230);                                    // Clear frame

    if (blockArray.size() == 0) {
        levelUp();
    }

    blockIterator = blockArray.iterator();              // Draw stationary blocks
    while (blockIterator.hasNext()) {
        blockIterator.next().draw();
    }

    doomedBlockIterator = blockArrayOfDoom.iterator();  // Draw moving blocks
    while (doomedBlockIterator.hasNext()) {
        block = doomedBlockIterator.next();
        if (block.isDead()) {
            doomedBlockIterator.remove();               // Remove if block is outside screen
        } else {
            block.draw();
        }
    }

    drawableIterator = drawablesArray.iterator();       // Draw anything else
    while (drawableIterator.hasNext()) {
        drawableIterator.next().draw();
    }
}
</code></pre>

<p>As you can see, the "doomed" blocks are drawn after the regular blocks, and yet the stroke from the regular blocks overlap the doomed blocks. Is this normal, can it be avoided?</p>

<p>Any help much appreciated!</p>

<p>Edit:</p>

<p>Solved after changing from P3D to P2D renderer!</p>
]]></description>
   </item>
   <item>
      <title>P3D renders incorrect stroke color on some computers</title>
      <link>https://forum.processing.org/two/discussion/10506/p3d-renders-incorrect-stroke-color-on-some-computers</link>
      <pubDate>Sat, 25 Apr 2015 15:48:29 +0000</pubDate>
      <dc:creator>norm_krumpe</dc:creator>
      <guid isPermaLink="false">10506@/two/discussions</guid>
      <description><![CDATA[<p>Here is a very short program that should draw a rectangle with a green border:</p>

<pre><code>size(400, 400, P3D);
stroke(0, 255, 0);
rect(0, 0, 50, 50);
</code></pre>

<p>On most computers, this works just fine.  But on some computers (my home computer, and a computer in a lab where I teach), the rectangle ends up with a blue border.  Some specifics:</p>

<ul>
<li>On my home computer, it fails in Chrome, FireFox, and IE</li>
<li>It works fine in Java mode</li>
<li>It works fine if I use P2D rather than P3D, but I need to use P3D for what I want to write</li>
<li>The 2 computers where this fails are running Windows 8.1, but it works fine on most Windows 8.1 computers I've tested</li>
</ul>

<p>I actually discovered this issue in a larger program that was supposed to produce <a rel="nofollow" href="http://www.openprocessing.org/sketch/195215">random pastel-colored butterflies</a>.  On my home computer, all butterflies are red.</p>

<p>How could such a simple program produce such unexpected results?</p>
]]></description>
   </item>
   </channel>
</rss>