<?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 setsize() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=setsize%28%29</link>
      <pubDate>Sun, 08 Aug 2021 21:20:58 +0000</pubDate>
         <description>Tagged with setsize() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedsetsize%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>how resize sketch without recompile</title>
      <link>https://forum.processing.org/two/discussion/28022/how-resize-sketch-without-recompile</link>
      <pubDate>Sun, 27 May 2018 22:59:01 +0000</pubDate>
      <dc:creator>vjjv</dc:creator>
      <guid isPermaLink="false">28022@/two/discussions</guid>
      <description><![CDATA[<p>hey! how can i change the sketch size without recompile? i try to make a button but not work. I use void settings() cos i`ve more that one canvas. i trying to change the main canvas.</p>

<pre><code>int choiceSize = 0;

void settings() {
  //size(500, 500, P3D);
  //fullScreen(P3D);

  if (choiceSize==0) {
    fullScreen(P3D, 2);
  }
  if (choiceSize==1) {
    size(1000, 1000, P3D);
  }
  if (choiceSize==2) {
    size(720, 1280, P3D);
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Pause cycling of images with spacebar and creating ArrayList with PImage</title>
      <link>https://forum.processing.org/two/discussion/27466/pause-cycling-of-images-with-spacebar-and-creating-arraylist-with-pimage</link>
      <pubDate>Wed, 28 Mar 2018 18:24:12 +0000</pubDate>
      <dc:creator>kinesthtiaSonja</dc:creator>
      <guid isPermaLink="false">27466@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I have created a sketch that cycles through images, but when I hit the spacebar, I want it to stop cycling through the images and remain on that particular image until I hit the return key. I don't know how to implement that. Here is my code:</p>

<pre><code>String basedir = "/Users/admin/Desktop/Borderscape_OF/clean"; 
String fileext = ".jpg"; 

PImage img;
int i = 0;
String[] filenames;
int imgSize = 182;

java.io.File folder = new java.io.File(dataPath(basedir));
java.io.FilenameFilter extfilter = new java.io.FilenameFilter() {
  boolean accept(File dir, String name) {
    return name.toLowerCase().endsWith(fileext);
  }
};

void setup() {
  fullScreen();
  frameRate(7);
  background(0);

  //pull from string
  filenames = folder.list(extfilter);
  img = loadImage(basedir+"/"+filenames[0]);
  surface.setSize(img.width, img.height); // Takes the size of the first image in the folder.
}

void draw() {
   keyPressed();

  img = loadImage(basedir+"/"+filenames[i]);
  float x = random(0, 255);
  tint(255, x);
  image(img, 0, 0);
  i++;

  if (i + 1 == filenames.length) {
    i = 0;
  }
}

void keyPressed() {
  if (key == 'x') {
    basedir = "/Users/admin/Desktop/Borderscape_OF/glitched";
  }
  if (key == 's') {
    basedir = "/Users/admin/Desktop/Borderscape_OF/clean";
  }

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>resize sketch in processing 3</title>
      <link>https://forum.processing.org/two/discussion/11284/resize-sketch-in-processing-3</link>
      <pubDate>Fri, 12 Jun 2015 10:33:20 +0000</pubDate>
      <dc:creator>clankill3r</dc:creator>
      <guid isPermaLink="false">11284@/two/discussions</guid>
      <description><![CDATA[<p>Is there any way, no matter how hacky to resize the sketch in processing 3?</p>
]]></description>
   </item>
   <item>
      <title>Referencing to mainApp(PApplet) instead of "this"</title>
      <link>https://forum.processing.org/two/discussion/23440/referencing-to-mainapp-papplet-instead-of-this</link>
      <pubDate>Fri, 14 Jul 2017 14:05:05 +0000</pubDate>
      <dc:creator>fleetfox</dc:creator>
      <guid isPermaLink="false">23440@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I would like to use the gif library out of a class that I have written. If I write something like: <br />
<code>Gif myAnimation = new Gif(this, myFile);</code><br />
...Processing gives an error as it references to my class and not my main App. How do I reference to main sketch? I am pretty sure it has something to do with PApplet, but I can not get it working! Thank you!</p>
]]></description>
   </item>
   <item>
      <title>Resizing a Movie - Possible Bug?</title>
      <link>https://forum.processing.org/two/discussion/23389/resizing-a-movie-possible-bug</link>
      <pubDate>Mon, 10 Jul 2017 14:14:46 +0000</pubDate>
      <dc:creator>danlj</dc:creator>
      <guid isPermaLink="false">23389@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I'm getting some inconsistent behaviour with PImage.width, PImage.height, and PImage.resize() when working with Movie files. Width and height will almost always return 0, though will occasionally return the correct dimensions. PImage.resize() will sometimes throw an error: "Width(0) and Height(0) cannot be &lt;= 0" - even when the dimensions are hardcoded in. I'm posting this here because I'm not sure whether this is a bug or I'm just doing something silly with the code:</p>

<p>macOS 10.12.5; Quicktime 10.4; P3.3.5</p>

<pre><code>import processing.video.*;

Movie m;
PImage mS;
int vScale = 4;
int mW;
int mH;

void setup() {
  size(480, 270);
  m = new Movie(this, "test.mov"); // original dim: 1920 1080
  m.loop();
  mW = m.width; 
  mH = m.height;

  // Almost always returns 0 for both values, but occasionally returns the correct dimensions.  
  println("width: " + mW +" " + "Height: " + mH); 
}

void draw() {
  mS = m.get();

  //This almost never works
  //mS.resize(mW/vScale, mH/vScale); 

  //This works most of the time, but not always!
  //mS.resize(1920/vScale, 1080/vScale); 

  //Again works most of the time, but not always...
  mS.resize(480, 270);


  image(mS, 0, 0);
}

void movieEvent(Movie m) {
 m.read(); 
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Surface Size dependant on input Image dimensions</title>
      <link>https://forum.processing.org/two/discussion/13484/surface-size-dependant-on-input-image-dimensions</link>
      <pubDate>Wed, 11 Nov 2015 12:16:09 +0000</pubDate>
      <dc:creator>demetrios</dc:creator>
      <guid isPermaLink="false">13484@/two/discussions</guid>
      <description><![CDATA[<p>Hi everybody,</p>

<p>I am rewriting some code for P3. My aim is to fill up a PImage object with input image file data, selected with the new select-methods (such as <a href="https://processing.org/reference/selectInput_.html" target="_blank" rel="nofollow">https://processing.org/reference/selectInput_.html</a>) and afterwards adjust the surface size depending on this PImages width and height.</p>

<p>This is an exampe code:</p>

<pre><code>PImage input;

void setup() {
  size (200, 200);
  surface.setResizable(true);
  selectInput("Select an image to process", "imageSelected");
  surface.setSize(input.width, input.height);
}

void imageSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    input = loadImage (selection.getAbsolutePath());
  }
}
</code></pre>

<p>It seems the interpreter can not wait until an input-file is picked (No clue about the selection window). It instantly neeeeeeds to run the setSize method - and crash (throws NullPointerException, because "input.width" is not available, because he wants it way to soon)! Is there another solution to my attempt? I think it is a decent desire, to set surface properties as a function of selected input. At least it is what my client desires ;)</p>

<p>Cheers!</p>
]]></description>
   </item>
   <item>
      <title>How to make keyPressed respond to the number of times the key is pressed</title>
      <link>https://forum.processing.org/two/discussion/16476/how-to-make-keypressed-respond-to-the-number-of-times-the-key-is-pressed</link>
      <pubDate>Sat, 07 May 2016 14:09:13 +0000</pubDate>
      <dc:creator>kk324</dc:creator>
      <guid isPermaLink="false">16476@/two/discussions</guid>
      <description><![CDATA[<p>I'm very new to Processing. I am working on a project that involves Makey Makey. 
I was wondering if it is possible to use keyPressed or something similar to respond to the number of times the key is pressed?
For instance, I want the user to press LEFT three times and RIGHT two times, and after that the video will play. Is there a way to do it?</p>
]]></description>
   </item>
   <item>
      <title>Is this a bug? Presentation mode doesn't blank the rest of the screen when using surface.setSize().</title>
      <link>https://forum.processing.org/two/discussion/22102/is-this-a-bug-presentation-mode-doesn-t-blank-the-rest-of-the-screen-when-using-surface-setsize</link>
      <pubDate>Thu, 20 Apr 2017 11:42:38 +0000</pubDate>
      <dc:creator>fagerli</dc:creator>
      <guid isPermaLink="false">22102@/two/discussions</guid>
      <description><![CDATA[<pre><code>void setup() {

size(1000,1414);
surface.setResizable(true);
surface.setSize(500,707);

 }
</code></pre>

<p>This code when run in presentation mode will display a canvas in the top left of the screen, and not blank the rest of the screen. It displays like it should in regular "run". Why?</p>
]]></description>
   </item>
   <item>
      <title>Resize window</title>
      <link>https://forum.processing.org/two/discussion/20846/resize-window</link>
      <pubDate>Fri, 17 Feb 2017 13:57:13 +0000</pubDate>
      <dc:creator>jaspervanblokland</dc:creator>
      <guid isPermaLink="false">20846@/two/discussions</guid>
      <description><![CDATA[<p>Hi There,</p>

<p>I am using Python (Jython) in processing. Is there a function to resize the size of the window like 'frame.resize(600,400);'</p>

<p>Cheers</p>
]]></description>
   </item>
   <item>
      <title>Problem with 3.x - Pimage and size() - Errors</title>
      <link>https://forum.processing.org/two/discussion/12079/problem-with-3-x-pimage-and-size-errors</link>
      <pubDate>Fri, 14 Aug 2015 10:32:52 +0000</pubDate>
      <dc:creator>BigFred</dc:creator>
      <guid isPermaLink="false">12079@/two/discussions</guid>
      <description><![CDATA[<p>I have just updated my processing to Processing 3.x, but loads of my sketches have stopped working. e.g:</p>

<p>CODE:</p>

<p><code>void setup() {
      background(33);
      source = loadImage("5.jpg");
      size(source.width, source.height);
    }</code></p>

<p>ERROR:
"The size of this sketch could not be determined from your code....."</p>

<p>any idea how I can set the size of the sketch to the PImage size?</p>
]]></description>
   </item>
   <item>
      <title>Using PGraphics class in Java without instantiating PApplet class</title>
      <link>https://forum.processing.org/two/discussion/20482/using-pgraphics-class-in-java-without-instantiating-papplet-class</link>
      <pubDate>Thu, 26 Jan 2017 13:31:15 +0000</pubDate>
      <dc:creator>NATALAN</dc:creator>
      <guid isPermaLink="false">20482@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I'd like to use PGraphics in a JavaFX Application, which means my Main-Class cannot extend from PApplet. Is there any example or any chance at all to make usage of PGraphics without instantiating the PApplet-Class? 
I also tried to runn the PApplet from another class, but it was a mess which didnt seem to work at all.</p>

<p>Thank you</p>
]]></description>
   </item>
   <item>
      <title>surface.setSize and a 2D array</title>
      <link>https://forum.processing.org/two/discussion/20224/surface-setsize-and-a-2d-array</link>
      <pubDate>Thu, 12 Jan 2017 21:36:54 +0000</pubDate>
      <dc:creator>jaspervanblokland</dc:creator>
      <guid isPermaLink="false">20224@/two/discussions</guid>
      <description><![CDATA[<p>Hi All</p>

<p>I am working on a surface.setSize with multiple sizes. Now i know how to do that. 
Inside the 'surface.setSize', i wanne use a 2dimensional array, but that doesnt work. I don't know why.</p>

<p>int cols = 400;
int rows = 500;</p>

<p>int[][] size = new int[cols][rows];</p>

<p>void setup()
{
  size(100, 100);
  surface.setResizable(true);
}</p>

<p>void draw()
{
  background(2);
  if (key == '1') {
    surface.setSize(size[][]) ;
  } else   if (key == '2') {
    surface.setSize(size[][]) ;
  }
}</p>

<p>Can anyone tell me the problem.</p>

<p>Tnanks@!</p>
]]></description>
   </item>
   <item>
      <title>surface.setSize() reference</title>
      <link>https://forum.processing.org/two/discussion/18820/surface-setsize-reference</link>
      <pubDate>Tue, 01 Nov 2016 09:32:25 +0000</pubDate>
      <dc:creator>werty37</dc:creator>
      <guid isPermaLink="false">18820@/two/discussions</guid>
      <description><![CDATA[<p>Hi</p>

<p>Where do i find reference for surface.setSize() or surface in general? I didn't find it on Processing reference site.</p>

<p>Thanks
Sujith</p>
]]></description>
   </item>
   <item>
      <title>Can't draw anything just after using surface.setSize()</title>
      <link>https://forum.processing.org/two/discussion/18813/can-t-draw-anything-just-after-using-surface-setsize</link>
      <pubDate>Mon, 31 Oct 2016 17:45:24 +0000</pubDate>
      <dc:creator>BriceFW</dc:creator>
      <guid isPermaLink="false">18813@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I have a problem using surface.setSize().
Here is a code example :</p>

<p><code>void setup(){
  background(0);
  surface.setSize(1000, 1000);
  fill(255);
  rect(10, 10, 10, 10);
}
void mouseClicked(){
  surface.setSize(1000, 1000);
  fill(255);
  rect(10, 10, 10, 10);
}
void draw(){}</code></p>

<p>When starting the sketch, I only have the black windows, the rectangle doesn't appear. But when I click the mouse, the rectangle appears. If I change mouseClicked() like that :</p>

<p><code>void mouseClicked(){
  surface.setSize(width + 1, height + 1);
  fill(255);
  rect(10, 10, 10, 10);
}</code></p>

<p>The windows becomes 1 pixel larger as expected but the white rectangle doesn't appear. I tried to do text(), to add delay() after surface.setSize() but it's the same.</p>

<p>Somebody knows how to fix this issue ?</p>

<p>Thanks.</p>
]]></description>
   </item>
   <item>
      <title>opencv problem with bootcamp</title>
      <link>https://forum.processing.org/two/discussion/18536/opencv-problem-with-bootcamp</link>
      <pubDate>Thu, 13 Oct 2016 22:27:38 +0000</pubDate>
      <dc:creator>jayson</dc:creator>
      <guid isPermaLink="false">18536@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to do face detection on a video with opencv on bootcamp (windows 10) and processing 2.2.1</p>

<blockquote class="Quote">
  <p>import processing.video.*;</p>
  
  <p>Movie video;
  import gab.opencv.*;
  import java.awt.Rectangle;</p>
  
  <p>OpenCV opencv;
  Rectangle[] faces;</p>
  
  <p>void setup()
  {
    size(640,360);</p>
  
  <p>video = new Movie(this, "people.mp4");
    video.play();
    video.loop();
  <br />
     opencv = new OpenCV(this, video.width, video.height);
     opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
  }</p>
  
  <p>void draw()
  {
    background(0);
    fill(255);
  <br />
    image(video,0,0);
  <br />
    opencv.loadImage(video);
    faces = opencv.detect();
  <br />
  }</p>
  
  <p>void movieEvent(Movie m)
  {
      m.read();
  <br />
  }</p>
</blockquote>

<p>It crashes at the line: 
  opencv.loadImage(video);</p>

<p>With the message: IndexOutOfBoundsException: Index 3: Size 0</p>

<p>Any ideas? This works fine on mac osx with the same version of processing.</p>
]]></description>
   </item>
   <item>
      <title>ControlP5 ColorPicker size adjusting</title>
      <link>https://forum.processing.org/two/discussion/18108/controlp5-colorpicker-size-adjusting</link>
      <pubDate>Thu, 08 Sep 2016 00:26:18 +0000</pubDate>
      <dc:creator>KikeRamirez</dc:creator>
      <guid isPermaLink="false">18108@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I am implementing a GUI which has an accordion and a colorPicker inside of one of its groups. I am setting the size of colorPicker with setSize(), but the color bars (R,G,B) does not change with this command. How can I change color bars size to fit the color area?</p>

<p>This is the code to implement colorPicker:</p>

<p><code>cp5.addColorPicker("Color Background")
     .setPosition(dw, 9 * dh)
     .setSize(13*dw, 6*dh)
     .setColorValue(color(255))
     .moveTo(g6);</code></p>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>setUndecorated frame in Processing 3.0?</title>
      <link>https://forum.processing.org/two/discussion/17455/setundecorated-frame-in-processing-3-0</link>
      <pubDate>Fri, 08 Jul 2016 03:10:15 +0000</pubDate>
      <dc:creator>FFD8</dc:creator>
      <guid isPermaLink="false">17455@/two/discussions</guid>
      <description><![CDATA[<p>I've got a nice fullScreen()'esque toggle, via this <a rel="nofollow" href="https://github.com/processing/processing/wiki/Changes-in-3.0#things-that-may-break-your-2x-sketches">tip here</a>... But how can one turn off the frame decoration in 3.0? The previous workarounds aren't allowed– no more 'frame' and the new 'surface' doesn't have that function. Any ideas/workarounds?</p>

<pre><code>boolean isFullscreen = false;

void setup() {
  size(800, 600);
  surface.setResizable(true);
}

void draw() {
  background(255);
  line(100, 100, width-100, height-100);
}

void keyPressed() {
  if (key == 'f') {
    if (!isFullscreen) {
      surface.setLocation(0, 0);
      surface.setSize(displayWidth, displayHeight);
      //frame.setUndecorated(true); // not allowed
      //surface.setUndecorated(true); // doesn't exist
      isFullscreen = true;
    } else {
      surface.setSize(800, 600); 
      //frame.setUndecorated(false);
      isFullscreen = false;
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Dynamic Sketch size.</title>
      <link>https://forum.processing.org/two/discussion/17646/dynamic-sketch-size</link>
      <pubDate>Mon, 25 Jul 2016 23:35:07 +0000</pubDate>
      <dc:creator>xweet</dc:creator>
      <guid isPermaLink="false">17646@/two/discussions</guid>
      <description><![CDATA[<p>Hello Friends.
I am trying to control the sketch size dynamically with checkBox. So, if I select the checkbox it will change size or if I un-check  the checkBox then it will comeback to normal size as before.
here is code.</p>

<pre><code>// Need G4P library
import g4p_controls.*;


public void setup(){
  size(500, 670, JAVA2D);
  if(chkPro.isSelected()){
  size(480, 320, JAVA2D);
  }
  else{
   size(480, 600, JAVA2D);
  }


  createGUI();
  customGUI();
  // Place your setup code here

}

public void draw(){
  background(230);

}

// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){

}


public void chkProperty(GCheckbox source, GEvent event) { //_CODE_:chkPro:390305:
  println("chkPro - GCheckbox &gt;&gt; GEvent." + event + " @ " + millis());
}


public void createGUI(){
  G4P.messagesEnabled(false);
  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  G4P.setCursor(ARROW);
  surface.setTitle("Sketch Window");
  chkPro = new GCheckbox(this, 168, 150, 120, 20);
  chkPro.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
  chkPro.setText("Characteristics");
  chkPro.setTextBold();
  chkPro.setOpaque(false);
  chkPro.addEventHandler(this, "chkProperty");
}

// Variable declarations 
// autogenerated do not edit
GCheckbox chkPro; 
</code></pre>

<p>Thanks in Advance</p>
]]></description>
   </item>
   <item>
      <title>how to use pourcent in processing</title>
      <link>https://forum.processing.org/two/discussion/17640/how-to-use-pourcent-in-processing</link>
      <pubDate>Mon, 25 Jul 2016 12:35:19 +0000</pubDate>
      <dc:creator>georges4242</dc:creator>
      <guid isPermaLink="false">17640@/two/discussions</guid>
      <description><![CDATA[<p>hi ! 
I have made a sketche with a size like : size( 2000,1000,P2D); and i want to transform this sketche in pourcent for integrate him in a website (responsive).</p>

<p>I have a mousereleased in my sketche and if i change size in pourcent it doesnt work correctly :s</p>

<p>Thks for the help :)</p>
]]></description>
   </item>
   <item>
      <title>Processing doesn't let me use the size of the image for the size of the window</title>
      <link>https://forum.processing.org/two/discussion/17551/processing-doesn-t-let-me-use-the-size-of-the-image-for-the-size-of-the-window</link>
      <pubDate>Sat, 16 Jul 2016 17:01:57 +0000</pubDate>
      <dc:creator>cadavara</dc:creator>
      <guid isPermaLink="false">17551@/two/discussions</guid>
      <description><![CDATA[<p>I got the following code from a tutorial. I checked it with the reference and it should work.</p>

<p>The error I get is: "The size of this sketch could not be determined from your code. Use only numbers (not variables) for the size() command. Read the size() reference for more details.".</p>

<p><code>void setup(){
  PImage img = loadImage("image.jpg"); 
  size(img.width*2, img.height, P2D); 
  }</code></p>
]]></description>
   </item>
   <item>
      <title>Crossed memory pointers / cleanup missing ?</title>
      <link>https://forum.processing.org/two/discussion/17024/crossed-memory-pointers-cleanup-missing</link>
      <pubDate>Tue, 07 Jun 2016 14:05:05 +0000</pubDate>
      <dc:creator>MSquare</dc:creator>
      <guid isPermaLink="false">17024@/two/discussions</guid>
      <description><![CDATA[<p>My sketch is a little complicated, so it is spread in several .PDE files. I do use the semi-documented surface.setSize(), but otherwise pure Processing Java without any libraries.</p>

<p>The code has a class "Button". It is used quite a lot, even arrays of it. Sometimes, even after a clean restart of Processing, it confuses which button does what, or omits drawing a button. This is in the "first" loop, so it has not done anything fancy. It fails on both 3.0.2 and the latest 3.1.1, both 32bit XP, 32 bit Win7 and 64bit Win7.</p>

<p>The code has worked fine for a while, as I am still developing it. The natural thing is to presume the last change broke it, but that is too difficult to roll back.</p>

<p>I also have had an issue with the debugger ignoring some breakpoints which make me believe I have somehow corrupted memory - or found a bug.</p>

<p>So the question is - am I doing something "subtly" wrong?</p>
]]></description>
   </item>
   <item>
      <title>Processing 3: How to setUndecorated(true)</title>
      <link>https://forum.processing.org/two/discussion/12200/processing-3-how-to-setundecorated-true</link>
      <pubDate>Sat, 22 Aug 2015 00:12:34 +0000</pubDate>
      <dc:creator>IcyIcicle</dc:creator>
      <guid isPermaLink="false">12200@/two/discussions</guid>
      <description><![CDATA[<p>As a reference for other people who need help in the transition from Processing 2 to 3:</p>

<p>Processing 2:</p>

<pre><code>void init() {
    frame.removeNotify();
    frame.setUndecorated(true);
    frame.addNotify();
    super.init();
}
</code></pre>

<p>Processing 3:</p>

<pre><code>void settings() {
    fullScreen();
}
void setup() {
    surface.setSize(500,500);
}
</code></pre>

<p>Hope this helps!</p>

<p>-Icy</p>
]]></description>
   </item>
   <item>
      <title>drawing shapes in setup() not working</title>
      <link>https://forum.processing.org/two/discussion/16515/drawing-shapes-in-setup-not-working</link>
      <pubDate>Mon, 09 May 2016 21:07:13 +0000</pubDate>
      <dc:creator>joliver</dc:creator>
      <guid isPermaLink="false">16515@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,</p>

<p>I'm working on a game currently and I'm trying to setup the playground with the setup() function of processing. I tried to break down the problem into easy code.</p>

<p>Consider the following sketch:</p>

<pre><code> void setup(){
     surface.setSize(300, 300);
     background(0);
     fill(255);
     rect(100, 100, 30, 30);
 }

 void draw(){
 }
</code></pre>

<p>When i execute this code, I'd expect a canvas of size=300x300 with black background and a white rectangle of size=30x30 at x=100 and y=100 on the canvas.</p>

<p>However the rectangle does not appear. Could anybody clarify why you can't draw rectangles in the setup function?</p>

<p>I'm using Processing 3.0.2</p>

<p>I've already looked at the processing references pages for:<br />
setup() : <a href="https://processing.org/reference/setup_.html" target="_blank" rel="nofollow">https://processing.org/reference/setup_.html</a><br />
background() : <a href="https://processing.org/reference/background_.html" target="_blank" rel="nofollow">https://processing.org/reference/background_.html</a><br />
rect() : <a href="https://processing.org/reference/rect_.html" target="_blank" rel="nofollow">https://processing.org/reference/rect_.html</a></p>

<p>It also appears to me that the reference page is not updated on all the issues that may break processing 2.0 code when updating on 3.0 <a href="https://github.com/processing/processing/wiki/Changes-in-3.0#things-that-may-break-your-2x-sketches" target="_blank" rel="nofollow">https://github.com/processing/processing/wiki/Changes-in-3.0#things-that-may-break-your-2x-sketches</a><br />
, so I'm not sure if I'm missing something.</p>

<p>I haven't found anything on this issue yet. Maybe I'm just misunderstanding the behavior of the setup function.</p>
]]></description>
   </item>
   <item>
      <title>How to make the webcam capture window go away or put images over it</title>
      <link>https://forum.processing.org/two/discussion/16435/how-to-make-the-webcam-capture-window-go-away-or-put-images-over-it</link>
      <pubDate>Thu, 05 May 2016 09:26:15 +0000</pubDate>
      <dc:creator>Clova</dc:creator>
      <guid isPermaLink="false">16435@/two/discussions</guid>
      <description><![CDATA[<p>I'm using a webcam for the beginning of my project, but after a while I want to clear the screen and start a whole new page. I can probably do this by covering up the screen with a big white rectangle, however, nothing will cover up the webcam window. The camera part of my code looks like this:</p>

<p>String[] cameras = Capture.list();
cam = new Capture(this, cameras[000]);
    cam.start();</p>

<p>and then</p>

<p>void draw() {
  if (cam.available() == true) {
    cam.read();
  }</p>

<p>Since it says if(cam.available() == true), I tried to set cam.available to false, but even that wouldn't work, giving the error, "the field capture.available is not visible." 
I'm very desperate.</p>

<p>As an alternative, does anyone know a way to make different pages, so when you click a button, it takes everything you've already done away completely? I've looked into it a lot, and found people saying setting the background(255) at the beggining of draw, or doing multiple draws, but I couldn't get it to work. I also tried the redraw() and clear() functions without any success.</p>

<p>PLEASE help</p>
]]></description>
   </item>
   <item>
      <title>launch() won't work inside selectInput() function;</title>
      <link>https://forum.processing.org/two/discussion/16097/launch-won-t-work-inside-selectinput-function</link>
      <pubDate>Tue, 19 Apr 2016 11:06:50 +0000</pubDate>
      <dc:creator>Almeida</dc:creator>
      <guid isPermaLink="false">16097@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I've come across a weird problem in my program. I am making a program that launches a video after I use the function launch() inside it that initializes another program called video_segmentation. This program generates a txt file with information about when each shot and scene of the selected video begins and ends.</p>

<p>The problem here is that this program will not launch inside my <code>selectInput()</code> unless I put another <code>selectInput()</code> before it. Here's my code:</p>

<pre><code>  import processing.video.*;
  import gab.opencv.*;
  import java.awt.*;
  import java.util.*;
  import java.io.*;

  OpenCV openCv;

  PrintWriter output;
  StringList kf;
  StringList [] movieScenes;
  int c=0;
  BufferedReader HowManyScenes;
  int lines;
  String line = "1";
  String [] scenes;

  Movie theMov; 
  File selectionF, selectionT;
  String selectText;
  int fc;
  ArrayList &lt;PImage&gt; frames= new ArrayList();
  int avgFrameColor;

  Boolean trufals=false;
  Boolean process=true;

  void setup() {

    size(1280, 720);
    //frameRate(200);
    selectInput("Select a film to process:", "selectFilm");

  }

  void selectFilm(File selection) {
    println("ola");
    if (selection == null) {
      println("Window was closed or you hit cancel.");
    } else {
      theMov = new Movie (this, selection.getAbsolutePath());
      // println(selection.getAbsolutePath());

      String [] params = split (selection.getAbsolutePath(), "\\");
      String [] segmentation = {"C:/Users/Nuno/Desktop/Segmentation/windows64/video_segmentation", params[params.length-1]};

      launch(segmentation);
      println(segmentation);
      //process=true;

    }
  }  

  void draw() { 

    if (theMov == null || selectText == null) {
      trufals=false;
    } else {
      trufals=true;
    }

//rest of my code which doesnt start untill I select both a video file and a txt file

}
</code></pre>

<p>The problem I have is in the setup I believe, because if I put another random <code>selectInput()</code> before it all works fine and video_segmentation.exe will run. Example:</p>

<pre><code>void setup(){
  size(1280,720);
  selectInput("hi","hi");
  selectInput("Select a film to process:", "selectFilm", selectionF)

}
</code></pre>

<p>I discovered this because I was running another <code>selectInput()</code> that initializes the function <code>selectScenes()</code>which reads the file generated by video_segmentation.exe.</p>

<p>I would appreciate some help if anyone has any idea what this is about.</p>
]]></description>
   </item>
   <item>
      <title>Question about ControlP5 library</title>
      <link>https://forum.processing.org/two/discussion/15740/question-about-controlp5-library</link>
      <pubDate>Tue, 29 Mar 2016 07:33:56 +0000</pubDate>
      <dc:creator>Daantje</dc:creator>
      <guid isPermaLink="false">15740@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I have questions about the ControlP5 library. Yesterday, I've found this library with a scrollable list example:</p>

<pre><code>import controlP5.*;

import java.util.*;

String[] listItems = new String[5];

ControlP5 cp5;

void setup() {

  size(400, 400);

  surface.setResizable(true);

  listItems[0] = "5130";

  listItems[1] = "5131";

  listItems[2] = "5150";

  listItems[3] = "5170";

  listItems[4] = "9591";

  cp5 = new ControlP5(this);

  List l = Arrays.asList(listItems);

  /* add a ScrollableList, by default it behaves like a DropdownList */

  cp5.addScrollableList("dropdown")

     .setPosition(10, 10)

     .setSize(width-20, height-20)

     .setBarHeight(50)

     .setItemHeight(20)

     .addItems(l)

     .setType(ScrollableList.LIST) // currently supported DROPDOWN and LIST

;    

}

void draw() {

  background(240);

}

void dropdown(int n) {

  CColor c = new CColor();

  c.setBackground(color(255,0,0));

  cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);

}
</code></pre>

<p>(I've removed some code from the example which was un-necessary for me)
Now, I have this questions:</p>

<ol>
<li>How can I change the cp5.setSize in my loop? As you can see, the sketch size is resizable, but if I change the size of the program, the list size won't change.</li>
<li>How can you set the colors of the list text? I have a very light background, so I need black text in my list. Is this possible?</li>
<li>Is it possible to let the user also unselect items? In this example code, there is no option.</li>
</ol>

<p>Thanks in advance,
Daantje</p>
]]></description>
   </item>
   <item>
      <title>Cannot access size in the Python mode</title>
      <link>https://forum.processing.org/two/discussion/15408/cannot-access-size-in-the-python-mode</link>
      <pubDate>Thu, 10 Mar 2016 15:26:21 +0000</pubDate>
      <dc:creator>misswoz</dc:creator>
      <guid isPermaLink="false">15408@/two/discussions</guid>
      <description><![CDATA[<p>I understand that with the upgrade, size has to be worked a bit differently.  However, surface and setSize do not seem to be recognized in the Python mode.  I don't know what to use.  I have gotten some help on this, but the examples were Java and when I tried in Python I got an error.
<img src="https://forum.processing.org/two/uploads/imageupload/040/2FTH181PHYZJ.png" alt="Screen Shot 2016-03-10 at 9.12.44 AM" title="Screen Shot 2016-03-10 at 9.12.44 AM" /></p>
]]></description>
   </item>
   <item>
      <title>why are all this examples missing surface</title>
      <link>https://forum.processing.org/two/discussion/15365/why-are-all-this-examples-missing-surface</link>
      <pubDate>Tue, 08 Mar 2016 20:23:38 +0000</pubDate>
      <dc:creator>Jai</dc:creator>
      <guid isPermaLink="false">15365@/two/discussions</guid>
      <description><![CDATA[<p>i downloaded the boofCV for processing example and all the examples are giving errors about no surfaces found
<code>surface.setSize(input.width, input.height);</code>
<a href="http://boofcv.org/index.php?title=Tutorial_Processing" target="_blank" rel="nofollow">http://boofcv.org/index.php?title=Tutorial_Processing</a></p>
]]></description>
   </item>
   <item>
      <title>Change one colour from a PNG to another one</title>
      <link>https://forum.processing.org/two/discussion/14352/change-one-colour-from-a-png-to-another-one</link>
      <pubDate>Fri, 08 Jan 2016 23:03:46 +0000</pubDate>
      <dc:creator>maxarch</dc:creator>
      <guid isPermaLink="false">14352@/two/discussions</guid>
      <description><![CDATA[<p>hello!
I have PNG with transparency, green, and white
I will like to be able  to change the green to another colour and the white for another.</p>

<p>I imagine it will go something like this</p>

<pre><code>PImage myImage = loadImage("apples.jpg");
image(myImage, 0, 0);

loadPixels();
get () green pixel
change green pixel to  x pixel
get () white pixel
change white pixel to  y pixel
updatePixels();
</code></pre>

<p>I am a bit confuse on how to proceed between loadPixels(); and updatePixels();  if it the right way,
any help will be appreciated.</p>
]]></description>
   </item>
   <item>
      <title>I can't size my window</title>
      <link>https://forum.processing.org/two/discussion/14422/i-can-t-size-my-window</link>
      <pubDate>Wed, 13 Jan 2016 04:15:29 +0000</pubDate>
      <dc:creator>ru14lv35</dc:creator>
      <guid isPermaLink="false">14422@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to change the size() of the window and I can't, it tells me I can't do that and to go check the references. But the problem is that I don't find anything wrong...
What can I do?</p>
]]></description>
   </item>
   </channel>
</rss>