<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual Information &#187; Programming</title>
	<atom:link href="http://www.visualinformation.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visualinformation.org</link>
	<description>Visualising information</description>
	<lastBuildDate>Fri, 02 Jul 2010 11:59:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>An App</title>
		<link>http://www.visualinformation.org/2010/06/28/an-app/</link>
		<comments>http://www.visualinformation.org/2010/06/28/an-app/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 20:44:22 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thoughts and ideas]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=257</guid>
		<description><![CDATA[
I did this app (Todo Important &#38; Urgent) a year ago for the iPhone. Trying to wrap my head around Objective-C was quite fun. Different &#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2010/06/todo-imagery.001.jpg"><img class="alignnone size-full wp-image-258" title="todo-imagery.001" src="http://www.visualinformation.org/wp-content/uploads/2010/06/todo-imagery.001.jpg" alt="" width="807" height="588" /></a></p>
<p>I did this app (<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321403770&amp;mt=8&amp;ign-mpt=uo%3D6%2522%253E%253Cimg%2520height%253D%252215%2522%2520width%253D%252261%2522%2520alt%253D%2522Todo%2520-%2520Important%2520and%2520Urgent%2522">Todo Important &amp; Urgent</a>) a year ago for the iPhone. Trying to wrap my head around Objective-C was quite fun. Different way of thinking, but nice to deal with in general even if it got kind of messy at the end when it came to releasing it with provisioning etc. Gah. I realised quite quickly that I would not be doing Processing kind of things in Objective-C. So trying to make a simple kind of app and give it a twist was the choice for me. I think it worked even if the time spent making it hardly makes up for the result (or the money). Still, its visual and shows todo-items in a different way. And of course, it costs lowest-tier. Why else would I even try it out when I got Processing.  And then I found <a href="http://luckybite.com/iprocessing/">iProcessing</a>. Not Objective-C but a great feeling to see Processing code in Xcode <img src='http://www.visualinformation.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2010/06/28/an-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent application window in Processing</title>
		<link>http://www.visualinformation.org/2009/09/25/transparent-application-window-in-processing/</link>
		<comments>http://www.visualinformation.org/2009/09/25/transparent-application-window-in-processing/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 06:31:47 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=211</guid>
		<description><![CDATA[
The transparent window or shaped window was supposedly not easy to do. I found that by tweaking in the awt of Java it worked kind &#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/09/windowProcessing1.jpg"><img class="alignnone size-full wp-image-216" title="windowProcessing" src="http://www.visualinformation.org/wp-content/uploads/2009/09/windowProcessing1.jpg" alt="windowProcessing" width="695" height="463" /></a></p>
<p>The transparent window or shaped window was supposedly not easy to do. I found that by tweaking in the awt of Java it worked kind of as I would like it to do. On Windows XP. NOT on MacOSX. Also the shaped window which is demonstrated here. If labbed with some more you should find that you could do pretty much all you want to do, by tweaking the shaped window or tweaking the setOpaque or setOpacity which is two different things. Depending on what you want to do and depending on platform.</p>
<p>Note! This code does not work on MacOSX. Due to different Java implementations I guess. AND it&#8217;s hackish. No exception handling and there is alot of stuff that can go wrong I guess.</p>
<p>UPDATE! December 10 209, the java implementation was updated on MacOSX 10.6, to the current version available on windows. Nice and all, but the problem persists. Hmm. AWT? Workaround on the mac?</p>
<p>Read more on the subject right here:<br />
<a href="http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#Enabling-Per-Pixel-Translucency" target="_blank">http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#&#8230;</a></p>
<p><a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/trans_shaped_windows.html" target="_blank">http://java.sun.com/docs/books/tutorial/uiswing/misc/trans_shaped_windows.html</a></p>
<p>Heres the code I got working on Windows XP:<br />
<span style="font-family: Courier New;"><br />
import com.sun.awt.AWTUtilities;<br />
import  java.awt.GraphicsDevice.*; // PC only<br />
import java.awt.Shape;<br />
import java.awt.geom.*;<br />
import javax.swing.*;</span></p>
<p>public void init(){<br />
// to make a frame not displayable, you can<br />
// use frame.removeNotify()</p>
<p>frame.removeNotify();<br />
frame.setUndecorated(true);</p>
<p>// addNotify, here i am not sure if you have<br />
// to add notify again.<br />
//  frame.addNotify();<br />
// frame.removeNotify();<br />
super.init();<br />
}</p>
<p>void setup() {<br />
size(200, 200);<br />
noStroke();<br />
frame.setAlwaysOnTop(true); // Alltid på topp<br />
frame.setLocation(0,0);<br />
AWTUtilities.setWindowOpaque(frame, false);<br />
AWTUtilities.setWindowOpacity(frame, 0.9f);</p>
<p>Shape shape = null;<br />
//shape = new Ellipse2D.Float(0, 0, frame.getWidth(), frame.getHeight());<br />
//shape = new Ellipse2D.Float(0, 0, 200, 200);<br />
//  shape = new RoundRectangle2D.Float(0, 0, 200, 200, 20, 20);<br />
//shape = new Polygon(int[] xpoints, int[] ypoints, int npoints) ;<br />
int[] myXes = new int[4];<br />
myXes[0]=0;<br />
myXes[1]=150;<br />
myXes[2]=150;<br />
myXes[3]=0;<br />
int[] myYs = new int[4];<br />
myYs[0]=0;<br />
myYs[1]=20;<br />
myYs[2]=180;<br />
myYs[3]=0;<br />
shape = new Polygon(myXes, myYs, 4) ;<br />
AWTUtilities.setWindowShape(frame, shape);</p>
<p>}</p>
<p>void draw() {<br />
setBackground(new Color(0,0,0,255)); // should work with normal background(255) command<br />
//  frame.setVisible(true);</p>
<p>fill(255, 0, 0, 255); // the alpha is not in play at this point &#8211; but it come into play when doing per-pixel translucency<br />
rect(23, 23, 54, 54);<br />
}<br />
<a href="http://visualinformation.org/" target="_blank"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/09/25/transparent-application-window-in-processing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FOTB09?</title>
		<link>http://www.visualinformation.org/2009/09/23/fotb09/</link>
		<comments>http://www.visualinformation.org/2009/09/23/fotb09/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 21:10:15 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Graphic design]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Visualisation]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=208</guid>
		<description><![CDATA[
Yes, Flash on the Beach 2009, and no its not just Flash developers. It was problably awesome. Sheesh, why can&#8217;t people tell me about these &#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flashonthebeach.com/" target="_blank"><img class="alignnone size-medium wp-image-209" title="fotb" src="http://www.visualinformation.org/wp-content/uploads/2009/09/fotb-300x80.gif" alt="fotb" width="300" height="80" /></a></p>
<p>Yes, <a href="http://www.flashonthebeach.com/" target="_blank">Flash on the Beach 2009</a>, and no its not just Flash developers. It was problably awesome. Sheesh, why can&#8217;t people tell me about these kinds of events a little bit sooner <img src='http://www.visualinformation.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/09/23/fotb09/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple picking in 3D</title>
		<link>http://www.visualinformation.org/2009/06/03/simple-picking-in-3d/</link>
		<comments>http://www.visualinformation.org/2009/06/03/simple-picking-in-3d/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 18:35:25 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=175</guid>
		<description><![CDATA[
Thought I&#8217;d post this little hack. I picked up the Terzidis book Algorithms for Visual Design (using Processing) and found a version of my own &#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/06/bild-3.png"><img class="alignnone size-full wp-image-178" title="bild-3" src="http://www.visualinformation.org/wp-content/uploads/2009/06/bild-3.png" alt="bild-3" width="649" height="421" /></a></p>
<p>Thought I&#8217;d post this little hack. I picked up the <a href="http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470375485.html">Terzidis book Algorithms for Visual Design</a> (using Processing) and found a version of my own little 3D picking hack and thought that my hack might be ok. I never saw this as anything but a quick hack, but it has helped me alot, still does. I thought that it hopefully could help some people having difficulties solving the picking problem the &#8220;real&#8221; (and hard) way. It would have helped me.<br />
Heres the code:</p>
<address><span style="color: #000000;">/**</span></address>
<address><span style="color: #000000;">* Selecting_objects_3D &#8211; easy way</span></address>
<address><span style="color: #000000;">* by Johan Wastring</span></address>
<address><span style="color: #000000;">*</span></address>
<address><span style="color: #000000;">* Quick and dirty way f picking in 3D if you have less</span></address>
<address><span style="color: #000000;">* than 200 objects in a list. It&#8217;s not fancy,</span></address>
<address><span style="color: #000000;">* but it works on small numbers of objects.</span></address>
<address><span style="color: #000000;">* Run sketch and pick with mouse to change the color.</span></address>
<address><span style="color: #000000;">*</span></address>
<address><span style="color: #000000;">*/</span></address>
<address><span style="color: #000000;">import processing.opengl.*;</span></address>
<address><span style="color: #000000;">int numOfShapes = 5;</span></address>
<address><span style="color: #000000;">Shape[] myShapes = new Shape[numOfShapes];</span></address>
<address><span style="color: #000000;">void setup() {</span></address>
<address><span style="color: #000000;"> noStroke ();</span></address>
<address><span style="color: #000000;"> size (400, 400, OPENGL);</span></address>
<address><span style="color: #000000;"> // create your shapes in a list</span></address>
<address><span style="color: #000000;"> for (int i = 0; i &lt; numOfShapes; i ++) {</span></address>
<address><span style="color: #000000;"> myShapes[i] = new Shape(i*20, 0, 0);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;">}</span></address>
<address><span style="color: #000000;">void draw() {</span></address>
<address><span style="color: #000000;"> background(255);</span></address>
<address><span style="color: #000000;"> // Call theSelector before you draw your shapes</span></address>
<address><span style="color: #000000;"> theSelector();</span></address>
<address><span style="color: #000000;"> // draw your shapes</span></address>
<address><span style="color: #000000;"> for (int i = 0; i &lt; numOfShapes; i ++) {</span></address>
<address><span style="color: #000000;"> myShapes[i].display();</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> // a Camera well placed after all above</span></address>
<address><span style="color: #000000;"> camera(</span></address>
<address><span style="color: #000000;"> 40, 0, -120,</span></address>
<address><span style="color: #000000;"> 40, 0, 0,</span></address>
<address><span style="color: #000000;"> 0, 1, 0 );</span></address>
<address><span style="color: #000000;">}</span></address>
<address><span style="color: #000000;">// the nice Selector</span></address>
<address><span style="color: #000000;">void theSelector() {</span></address>
<address><span style="color: #000000;"> // SELECTION BY MOUSE</span></address>
<address><span style="color: #000000;"> int tolerance = 10; // to make it easy to pick the shape</span></address>
<address><span style="color: #000000;"> for ( int i = 0; i &lt; numOfShapes; i ++) {</span></address>
<address><span style="color: #000000;"> // get objects screenX coords</span></address>
<address><span style="color: #000000;"> float checkX = myShapes[i].getScreenX();</span></address>
<address><span style="color: #000000;"> // if it matches the mouseX decently proceed to get Y</span></address>
<address><span style="color: #000000;"> if (checkX &gt;= (mouseX-tolerance) &amp;&amp; checkX &lt;= (mouseX+tolerance)) {</span></address>
<address><span style="color: #000000;"> boolean yes = true;</span></address>
<address><span style="color: #000000;"> if (yes == true) {</span></address>
<address><span style="color: #000000;"> // get the Y one</span></address>
<address><span style="color: #000000;"> float checkY = myShapes[i].getScreenY();</span></address>
<address><span style="color: #000000;"> // if that one matches decently with the mouseY do something with that shape</span></address>
<address><span style="color: #000000;"> if (checkY &gt;= (mouseY-tolerance) &amp;&amp; checkY &lt;= (mouseY+tolerance)) {</span></address>
<address><span style="color: #000000;"> // make new cursor indicating selection is possible</span></address>
<address><span style="color: #000000;"> cursor(MOVE);</span></address>
<address><span style="color: #000000;"> if (mousePressed == true &amp;&amp; mouseButton == LEFT) {</span></address>
<address><span style="color: #000000;"> // here the action happens if it gets this far</span></address>
<address><span style="color: #000000;"> myShapes[i].setSelected(i);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;">}</span></address>
<address><span style="color: #000000;">class Shape {</span></address>
<address><span style="color: #000000;"> float x, y, z;</span></address>
<address><span style="color: #000000;"> boolean isSelected = false;</span></address>
<address><span style="color: #000000;"> Shape(float inX, float inY, float inZ) {</span></address>
<address><span style="color: #000000;"> x = inX;</span></address>
<address><span style="color: #000000;"> y = inY;</span></address>
<address><span style="color: #000000;"> z = inZ;</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> void display(){</span></address>
<address><span style="color: #000000;"> pushMatrix();</span></address>
<address><span style="color: #000000;"> translate(x, y, z);</span></address>
<address><span style="color: #000000;"> rotateX(HALF_PI/2);</span></address>
<address><span style="color: #000000;"> stroke(255);</span></address>
<address><span style="color: #000000;"> if (isSelected == true) {</span></address>
<address><span style="color: #000000;"> fill(255, 0, 0);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> else {</span></address>
<address><span style="color: #000000;"> fill(0, 0, 255);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> box(10);</span></address>
<address><span style="color: #000000;"> popMatrix();</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> void setSelected(int i) {</span></address>
<address><span style="color: #000000;"> this.isSelected = true;</span></address>
<address><span style="color: #000000;"> println(&#8220;Got it &#8221; + i);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> float getScreenX() {</span></address>
<address><span style="color: #000000;"> float f = screenX(x, y, z);</span></address>
<address><span style="color: #000000;"> return f;</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> float getScreenY() {</span></address>
<address><span style="color: #000000;"> float f = screenY(x, y, z);</span></address>
<address><span style="color: #000000;"> return f;</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;">}</span></address>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/06/03/simple-picking-in-3d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Move from Processing to Eclipse</title>
		<link>http://www.visualinformation.org/2009/05/01/move-from-processing-to-eclipse/</link>
		<comments>http://www.visualinformation.org/2009/05/01/move-from-processing-to-eclipse/#comments</comments>
		<pubDate>Fri, 01 May 2009 21:58:41 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://visualjohan.wordpress.com/?p=35</guid>
		<description><![CDATA[
Originally posted December 5 2008
Today I moved from the Processing IDE to Eclipse as an environment for the 3D demo development. Hopefully this will mean &#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-3.png"><img class="alignnone size-full wp-image-147" title="bild-3" src="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-3.png" alt="bild-3" width="803" height="277" /></a></p>
<p><em>Originally posted December 5 2008</em></p>
<p>Today I moved from the Processing IDE to Eclipse as an environment for the 3D demo development. Hopefully this will mean a bit leaner development with better support from the IDE. There should be no apparent difference for the user.<br />
I do this primarily because the processing IDE is nice for small sketches, but becomes cumbersome when the classes grow in numbers. But another important reason is that since I don’t see any real start for the ”real” java-demo in the Evolver-project I might as well take the demo seriously.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/05/01/move-from-processing-to-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Superpoint library</title>
		<link>http://www.visualinformation.org/2009/05/01/superpoint-library/</link>
		<comments>http://www.visualinformation.org/2009/05/01/superpoint-library/#comments</comments>
		<pubDate>Fri, 01 May 2009 21:13:27 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://visualjohan.wordpress.com/?p=12</guid>
		<description><![CDATA[
Very cool library for processing.
http://www.hardcorepawn.com/SuperPoint/
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-9.png"><img class="alignnone size-full wp-image-165" title="bild-9" src="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-9.png" alt="bild-9" width="758" height="453" /></a></p>
<p>Very cool library for processing.<br />
<a href="http://www.hardcorepawn.com/SuperPoint/">http://www.hardcorepawn.com/SuperPoint/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/05/01/superpoint-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
