<?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>Graffiti Markup Language</title>
	<atom:link href="http://www.graffitimarkuplanguage.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.graffitimarkuplanguage.com</link>
	<description>Today&#039;s new digital standard for tomorrow&#039;s vandals.</description>
	<lastBuildDate>Mon, 14 Nov 2011 08:16:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>GML Field Recorder Challenge Deadline Extended!</title>
		<link>http://www.graffitimarkuplanguage.com/gml-field-recorder-challenge-deadline-extended/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml-field-recorder-challenge-deadline-extended/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 11:10:45 +0000</pubDate>
		<dc:creator>evan</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=362</guid>
		<description><![CDATA[The GML Field Recorder Challenge has been extended by two months until Nov. 1. All entries should be emailed to challenge[at]graffitimarkuplanguage[dot]com before this date. The GML Field Recorder Challenge is a friendly competition to create an easily reproducible DIY device for unobtrusively recording graffiti motion data during a graffiti writer’s normal practice in the city. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ni9e.com/photos/data/gml/web/gml-field-recorder-1200eu.jpg" /></p>
<p>The <a href="http://www.graffitimarkuplanguage.com/challenges/gml-field-recorder-challenge/">GML Field Recorder Challenge</a> has been extended by two months until Nov. 1. All entries should be emailed to challenge[at]graffitimarkuplanguage[dot]com before this date. </p>
<p>The <i>GML Field Recorder Challenge</i> is a friendly competition to create an easily reproducible DIY device for unobtrusively recording graffiti motion data during a graffiti writer’s normal practice in the city. For full details go to <a href="http://www.graffitimarkuplanguage.com/challenges/gml-field-recorder-challenge/">http://www.graffitimarkuplanguage.com/challenges/gml-field-recorder-challenge/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml-field-recorder-challenge-deadline-extended/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recording GML</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-recording-gml/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-recording-gml/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:24:57 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=340</guid>
		<description><![CDATA[Recording GML basics To record GML, you can use a GmlRecorder object. The simplest constructor of this object takes a single argument which is a 3D vector giving information about the drawing surface. For instance, if you&#8217;re drawing on a flat screen which size is 800&#215;600, creating a new GmlRecorder will look like this: import [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Recording GML basics</strong></p>
<p>To record GML, you can use a GmlRecorder object.<br />
The simplest constructor of this object takes a single argument which is a 3D vector giving information about the drawing surface.<br />
For instance, if you&#8217;re drawing on a flat screen which size is 800&#215;600, creating a new GmlRecorder will look like this:</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

// Declare a GML recorder object
GmlRecorder recorder;

void setup() {
	Vec3D screen = new Vec3D(800, 600, 0);
	recorder = new GmlRecorder(screen);
}
</pre>
<p></code></p>
<p>The recorder has 3 different methods that you have to use to record a stroke.<br />
When the drawing of a stroke starts, you have to call the beginStroke method which takes a single argument being a unique ID that you will use when adding points and at the end of the stroke.<br />
Having an ID allows you to draw several strokes in the meantime when needed without messing up points and strokes<br />
<code><br />
recorder.beginStroke(666);<br />
</code></p>
<p>When adding points to a stroke, you need to use a minim of two arguments.<br />
First argument is the unique ID we mentionned above.<br />
Second argument is the coordinates of the point, which have to fit within 0 and 1.<br />
Each value between 0 and 1 has to be the ratio of the point&#8217;s coordinates on each axis.<br />
If you screen vector is 800x600x100 and the current coordinates of your point are 400,400, 25, then your point coordinates will be 0.5, 0.66, 0.25<br />
<code><br />
recorder.addPoint(666, new Vec3D(0.5, 0.66, 0.25));<br />
</code></p>
<p>When the drawing of the stroke ends, just call this method with the ID<br />
<code><br />
recorder.endStroke(666);<br />
</code></p>
<p>The recorder handles a Gml object and a temporary stroke list in parallel.<br />
When a stroke ends, it is moved from the temporary list to the Gml object.</p>
<p>Alternatively, you can use the endStrokes() method which will stop all recordings in one shot:<br />
<code><br />
recorder.endStrokes();<br />
</code></p>
<p><strong>Advanced beginStroke</strong></p>
<p>If you intend to work with several layers, you can call the beginStroke method with an extra parameter to store this info along with the stroke information.<br />
<code><br />
recorder.beginStroke(666, 1);<br />
</code></p>
<p>Note: there is a third parameter that you can use which will be covered when we&#8217;ll talk about brushes later on.</p>
<p><strong>Advanced GmlPoints</strong></p>
<p>The recorder also has addPoint methods which will accept more complex GmlPoint<br />
addPoint(int sessionID, Vec3D v, final float time);<br />
Takes a 3rd argument to store time information</p>
<p>addPoint(int sessionID, Vec3D v, final float time, final float pressure, final Vec3D rotation, final Vec3D direction);<br />
Takes even more arguments</p>
<ul>
<li>Time</li>
<li>Pressure: think spray can of flow pen</li>
<li>Rotation: orientation of the tool (ie: spray can)</li>
<li>Direction: direction of the tool (between two points)</li>
</ul>
<p>The recorder also includes several useful methods:</p>
<p><code><br />
recorder.clear()<br />
// Removes all strokes, the Gml ones and the temporary ones.<br />
</code></p>
<p><code><br />
recorder.removeLastStroke(layer)<br />
// Removes the last stroke from the given layer<br />
</code></p>
<p><code><br />
recorder.getStrokes()<br />
// Retrieves a list of GmlStrokes (both Gml strokes and temporary strokes)<br />
</code></p>
<p><code><br />
recorder.getGml()<br />
// Returns a copy of the Gml object used by the recorder<br />
</code></p>
<p><code><br />
recorder.setGml(gml);<br />
// Will replace the recorder's gml file with this one.<br />
// Can be used to continue drawing from an existing Gml file.<br />
</code></p>
<p><strong>Optimizing recording</strong></p>
<p>Your recording device may send way more points than needed to render a stroke correctly.<br />
If you want to limit the number of points, you may add limitations to the GmlRecorder by adding two extra arguments:</p>
<p><code><br />
float minimumStrokeLength = 0.01f; // Default value when omitted<br />
float minimumPointsDistance = 0.001f; // Default value when omitted<br />
recorder = new GmlRecorder(screen, minimumStrokeLength, minimumPointsDistance);<br />
</code></p>
<p>By doing so:<br />
When a stroke ends, it will only be recorded in the Gml object if longer than the value you defined.<br />
When adding a point to a stroke, it will only be added if the distance between this point and the last point of the stroke is greater than the value you defined.</p>
<p>These values can be adjusted afterward by calling these two methods with a float argument<br />
recorder.setMinStrokeLength();<br />
recorder.setMinPointsDistance();</p>
<p><strong>Recording with devices</strong></p>
<p>It is handy to use a protocol like OSC or TUIO for recording purpose.<br />
Once you have your recorder understanding such protocol, it means that you can interface with any device or installation which can send OSC or TUIO messages.<br />
It also means that you&#8217;ll be able to record several strokes in the meantime.</p>
<p>You can check the two examples provided with the library</p>
<ul>
<li>GmlOscRecorder</li>
<li>GmlTuioRecorder</li>
</ul>
<p><a href="http://www.graffitimarkuplanguage.com/gml4u-intro-installation/gml4u-tutorial-01-examples/" rel="attachment wp-att-337"><img class="alignnone size-medium wp-image-337" title="GML4U-Tutorial-01-Examples" src="http://www.graffitimarkuplanguage.com/wp-content/uploads/2011/07/GML4U-Tutorial-01-Examples-300x79.png" alt="" width="300" height="79" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-recording-gml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading GML files</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-loading-gml-files/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-loading-gml-files/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:24:40 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=339</guid>
		<description><![CDATA[There are two ways you can load GML files: The simple way : the execution of your sketch will hang until the file is loaded. The threaded way : won&#8217;t block your sketch. In both cases, the result of the parsing will be stored in a Gml object Simple way import gml4u.brushes.*; import gml4u.recording.*; import [...]]]></description>
			<content:encoded><![CDATA[<p>There are two ways you can load GML files:</p>
<ul>
<li>The simple way : the execution of your sketch  will hang until the file is loaded.</li>
<li>The threaded way : won&#8217;t block your sketch.</li>
</ul>
<p>In both cases, the result of the parsing will be stored in a Gml object</p>
<p><strong>Simple way</strong></p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

// Declare a Gml object
    Gml gml;

void setup() {
    // Loads the gml file into the Gml object
    gml = GmlParsingHelper.getGml(sketchPath+"/sample.gml.xml", false);
}

void draw() {
    // Do things with your gml object
}
</pre>
<p></code></p>
<p>The parsing is done through the GMLParsingHelper&#8217;s getGml static method.</p>
<p>This method has two arguments:</p>
<ul>
<li>The path to you gml file</li>
<li>A boolean (true, false) to force a normalization of the file.</li>
</ul>
<p>Normalization means that GML4U will attempt to remove any inconsistency in the stroke points coordinates to make them fit within a 0 -> 1 range.<br />
If omitted (ie: getGml(sketchPath+&#8221;/sample.gml.xml&#8221;)), the second parameter defaults to true.</p>
<p><strong>Threaded way</strong></p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

// Declare a Gml object and GmlParser
Gml gml;
GmlParser parser;

void setup() {
    // Create and start the thread with a 500ms waiting time, a name and a reference to your sketch (this)
    parser = new GmlParser(500, "myParser", this);
    parser.start();
    parser.parse(sketchPath+"/sample.gml.xml", false);
}

void draw() {
    if (null != gml) {
        // Do things with your gml Object
    }
}

// Callback function used by the GmlParser to send the result of the parsing
public void gmlEvent(GmlEvent event) {
    if (event instanceof GmlParsingEvent) {
        GmlParsingEvent parsingEvent = event;
        gml = parsingEvent.gml;
    }
}
</pre>
<p></code></p>
<p><em>Explainations</em></p>
<p>When the GmlParser is created, il will try to find a public gmlEvent method with a GmlEvent argument.<br />
If missing or incorrect, depending on your log level (something that we will see later on), the GmlParser will log an error and nothing more will happen.<br />
This gmlEvent method will be called at the end of the parsing.<br />
This method takes a generic argument, which is the GmlEvent class.<br />
This is generic to keep a single entry point and  avoid the need to have as many callbacks as event types.<br />
To know which event type was returned, you have to test it using the instanceof comparator against one<br />
of the expected classes extending GmlEvent.<br />
Here, we&#8217;re expecting a GmlParsing event, so we test if this is correct and create a copy of it to get<br />
the results.</p>
<p><code></p>
<pre>
if (event instanceof GmlParsingEvent) {
    GmlParsingEvent parsingEvent = event;
    gml = parsingEvent.gml;
}
</pre>
<p></code></p>
<p>This can also be achieved by casting the GmlEvent to a GmlParsingEvent but to me it&#8217;s less readable.</p>
<p><code></p>
<pre>
if (event instanceof GmlParsingEvent) {
   gml = ((GmlParsingEvent) event).gml;
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-loading-gml-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving GML files</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-saving-gml-files/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-saving-gml-files/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:24:23 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=341</guid>
		<description><![CDATA[As for loading a Gml file, you have two ways to save Gml files. The simple way : the execution of your sketch will hang until the file is saved. The threaded way : won&#8217;t block your sketch. Simple way import gml4u.brushes.*; import gml4u.recording.*; import gml4u.test.*; import gml4u.utils.*; import gml4u.drawing.*; import gml4u.events.*; import gml4u.model.*; // [...]]]></description>
			<content:encoded><![CDATA[<p>As for loading a Gml file, you have two ways to save Gml files.</p>
<ul>
<li>The simple way : the execution of your sketch  will hang until the file is saved.</li>
<li>The threaded way : won&#8217;t block your sketch.</li>
</ul>
<p><strong>Simple way</strong></p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

// Gml object
Gml gml;

void setup() {
	gml = new Gml();
}

void draw() {
	// Add strokes, ... to your Gml object
}

void keyPressed() {
	if (key == 's' || key == 'S') {
		GmlSavingHelper.save(gml, sketchPath+"/gml.xml");
	}
}
</pre>
<p></code></p>
<p>The saving is done through the GMLSavingHelper&#8217;s save() static method.<br />
This method has two arguments:<br />
- The Gml object to be saved<br />
- The path where is should be saved</p>
<p><strong>Threaded way</strong></p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

// Declare a Gml object and GmlParser
Gml gml;
GmlSaver saver;

void setup() {
	// Create and start the thread with a 500ms waiting time, a name and a reference to your sketch (this)
	saver = new GmlSaver(500, "mySaver", this);
	saver.start();
}

void draw() {
	// Add strokes, ... to your Gml object
}

void keyPressed() {
	if (key == 's' || key == 'S') {
		saver.save(gml, sketchPath+"/gml.xml");
	}
}

// Callback function used by the GmlSaver to send the result of the saving
public void gmlEvent(GmlEvent event) {
	if (event instanceof GmlSavingEvent) {
		GmlSavingEvent savingEvent = event;
		boolean result = savingEvent.successful;
		String location = savingEvent.location;
		println((result ? "Succeeded" : "Failed")+ " saving Gml file to " + location);
	}
}
</pre>
<p></code></p>
<p><em>Explainations</em><br />
When the GmlSaver is created, il will try to find a public gmlEvent method with a GmlEvent argument.<br />
If missing or incorrect, depending on your log level (something that we will see later on), the GmlSaver will log an error and nothing more will happen.<br />
This gmlEvent method will be called at the end of the saving.<br />
This method takes a generic argument, which is the GmlEvent class.<br />
This is generic to keep a single entry point and  avoid the need to have as many callbacks as event types.<br />
To know which event type was returned, you have to test it using the instanceof comparator against one of the expected classes extending GmlEvent.<br />
Here, we&#8217;re expecting a GmlSaving event, so we test if this is correct and create a copy of it to get the results.</p>
<p><code></p>
<pre>
if (event instanceof GmlParsingEvent) {
	if (event instanceof GmlSavingEvent) {
		GmlSavingEvent savingEvent = event;
		boolean result = savingEvent.successful;
		String location = savingEvent.location;
		println((result ? "Succeeded" : "Failed") + " saving Gml file to " + location);
	}
}
</pre>
<p></code></p>
<p>As seen before for the GmlParsingEvent, this can also be achieved by casting the GmlEvent to a GmlSavingEvent<br />
<code></p>
<pre>
if (event instanceof GmlSavingEvent) {
	boolean result = ((GmlSavingEvent) event).successful;
	String location = ((GmlSavingEvent) event).location;
	println((result ? "Succeeded" : "Failed")+ " saving Gml file to " + location);
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-saving-gml-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brushes and styles</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-brushes-and-styles/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-brushes-and-styles/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:24:04 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=344</guid>
		<description><![CDATA[Brushes You can attach a brush info to give more info about a GmlStroke. This basically allows you to store information about the tool used to draw and thus reuse this info when you&#8217;ll redraw what you captured. GmlBrush brush = new GmlBrush(); This constructor without arguments will create a new GmlBrush using the default [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Brushes</strong></p>
<p>You can attach a brush info to give more info about a GmlStroke.<br />
This basically allows you to store information about the tool used to draw and thus reuse this info when you&#8217;ll redraw what you captured.</p>
<p><code><br />
GmlBrush brush = new GmlBrush();<br />
</code><br />
This constructor without arguments will create a new GmlBrush using the default brush from GML4U (curve).<br />
You can add as many parameter to it, just knowing it only accepts 6 kind of object:</p>
<p>Vec3D<br />
String<br />
Integer<br />
Float<br />
Long<br />
Color</p>
<p>When adding a parameter, you have to give it a name (String) that you can use later on when you want to retrieve a specific parameter.</p>
<p><code><br />
brush.set("alpha", 128);<br />
brush.set("cap", "fat");<br />
</code></p>
<p>When retrieving a parameter, you&#8217;ll have to know his type and cast it to get the correct value because the brush&#8217;s get method returns generic objects.</p>
<p><code><br />
String capType = (String) brush.get("cap");<br />
int alphaChannel = (int) brush.get("alpha");<br />
</code></p>
<p>When saving as a GML file, your brush information will be automatically saved to the correct format. Same thing when loading the saved file.</p>
<p>There are already a few predefined brushes that you can use without having to create custom ones.</p>
<p>You can get a list of pre-existing brushes through the GmlBrushManager</p>
<p><code></p>
<pre>import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

GmlBrushManager brushManager = new GmlBrushManager();

void setup() {
	for (String styleId : brushManager.getStyles()) {
		println(styleId);
	}
}</pre>
<p></code></p>
<p>At the time being, you should get this as output:</p>
<pre>GML4U_STYLE_CURVES0000
GML4U_STYLE_BOXES0000
GML4U_STYLE_MESH0000</pre>
<p><strong>Forcing styles</strong></p>
<p>(Maybe take a look at the &#8220;Drawing Gml&#8221; tutorial first)<br />
You may bypass the GmlStroke brush information by explicitely passing a style information to the GmlBrushManager&#8217;s draw method.</p>
<p>By default, the GmlBrushManager contains a certain number of predefined GmlStrokeDrawers.<br />
You can make reference those styles using one of these parameters:<br />
GML4U_STYLE_CURVES0000<br />
GML4U_STYLE_BOXES0000<br />
GML4U_STYLE_MESH0000</p>
<p>So, if you want to use boxes rather than a simple curve stroke, you can call the GmlBrushManager with an extra parameter.</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

GmlBrushManager brushManager = new GmlBrushManager();
Gml gml;

void setup() {
	// ie: Load a Gml file
}

void draw() {
	brushManager.draw(g, gml, 600, "GML4U_STYLE_BOXES0000");
}
</pre>
<p></code></p>
<p>Here is another example which allows you to loop through all the registered styles easily using the + and &#8211; keys while your sketch is running.</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

GmlBrushManager brushManager = new GmlBrushManager();
Gml gml;
int currentStyle = 0;

void setup() {
	// ie: Load a Gml file
}

void draw() {
	brushManager.draw(g, gml, 600, GmlBrushManager.get(currentStyle);
}

void keyPressed() {
	if (key == '-') {
		currentStyle--;
		if (currentStyle &lt; 0) currentStyle = GmlBrushManager.size()-1;
	}
	else if (key == '+') {
		currentStyle++;
		if (currentStyle == GmlBrushManager.size()) currentStyle = 0;
		}
	}
}
</pre>
<p><code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-brushes-and-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom styles</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-custom-styles/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-custom-styles/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:23:44 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=345</guid>
		<description><![CDATA[You may add custom styles to the GmlBrushManager by creating your own classes extending the GmlStrokeDrawerBasic or GmlStrokeDrawer classes. GmlStrokeDrawerBasic This is an abstract class extending GmlStrokeDrawer. It has a single abstract draw method that you have to implement as follow with your own way to draw points, given the fact that you&#8217;ll have 2 [...]]]></description>
			<content:encoded><![CDATA[<p>You may add custom styles to the GmlBrushManager by creating your own classes extending the GmlStrokeDrawerBasic or GmlStrokeDrawer classes.</p>
<p><strong>GmlStrokeDrawerBasic</strong><br />
This is an abstract class extending GmlStrokeDrawer.<br />
It has a single abstract draw method that you have to implement as follow with your own way to draw points, given the fact that you&#8217;ll have 2 GmlPoint  available (current and previous ones).<br />
For this purpose, you&#8217;ll use the standard Processing methods prefixed by &#8220;g.&#8221;</p>
<p>In this example, we draw a simple line between each point, assuming that we are in 3D mode.</p>
<p><code></p>
<pre>
class MyCustomDrawer extends GmlStrokeDrawerBasic {

	public draw(PGraphics g, GmlPoint prev, GmlPoint cur) {
		g.line(prev.x, prev.y, prev.z, cur.x, cur.y, cur.z);
	}
}
</pre>
<p></code></p>
<p>Then, in your Processing main program, you&#8217;ll create an object of this class, and make it available through the GmlBrushManager.</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

GmlBrushManager brushManager = new GmlBrushManager();
Gml gml;

void setup() {
	size(600, 400, P3D);
	// Load a gml file

	// Create a custom drawer and register it as default drawer
	MyCustomDrawer customDrawer = new MyCustomeDrawer();
	brushManager.setDefault(customDrawer);
}

void draw() {
	brushManager.draw(g, gml, 600);
}
</pre>
<p></code></p>
<p>This example won&#8217;t work and you&#8217;ll get an error if you use a 2D renderer.<br />
If you apply the following modifications to your draw method, you will be 2D and 3D compliant.</p>
<p><code></p>
<pre>
class MyCustomDrawer extends GmlStrokeDrawerBasic {

	public draw(PGraphics g, GmlPoint prev, GmlPoint cur) {
		if (g.is3D()) {
			g.line(prev.x, prev.y, prev.z, cur.x, cur.y, cur.z);
		}
		else if (g.is2D()) {
			g.line(prev.x, prev.y, cur.x, cur.y);
		}
	}
}
</pre>
<p></code></p>
<p><strong>Drawing GmlStrokes individually</strong></p>
<p>You may draw strokes by looping through the Gml&#8217;s strokes.<br />
The main advantage of it is that you can change parameters in between (like the color).</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

GmlBrushManager brushManager = new GmlBrushManager();
Gml gml;

void setup() {
	size(600, 400, P3D);
	// Load a gml file

	// Create a custom drawer and register it as default drawer
	MyCustomDrawer customDrawer = new MyCustomeDrawer();
	brushManager.setDefault(customDrawer);
}

void draw() {
	for (GmlStroke stroke : gml.getStrokes()) {
		// Change colors according to what's stored in the GmlBrush
		GmlBrush brush = stroke.getBrush();
		color(brush.get("color");
		brushManager.draw(g, stroke, 600);
	}
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-custom-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Other useful stuff</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-other-useful-stuff/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-other-useful-stuff/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:21:19 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=347</guid>
		<description><![CDATA[List files in a directory If you stored a lot of Gml files in a directory and want to retrieve them easily, you may use another utility class to get a list witch could be filtered as well using a regular expression. The static method of the FileUtils class may be used for this purpose. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>List files in a directory</strong></p>
<p>If you stored a lot of Gml files in a directory and want to retrieve them easily, you may use<br />
another utility class to get a list witch could be filtered as well using a regular expression.<br />
The static method of the FileUtils class may be used for this purpose.</p>
<p>This will list any file located in the &#8220;gml_folder&#8221; located at the root of your sketck.<br />
<code><br />
List<String> gmlFiles = FileUtils.scanFolder("gml_folder", "");<br />
</code></p>
<p>To retrieve .gml files only, you may use this in conjunction with a regular expression.<br />
<code><br />
List<String> gmlFiles = FileUtils.scanFolder("gml_folder", ".*\\.gml");<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-other-useful-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with time</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-working-with-time/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-working-with-time/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:14:34 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=346</guid>
		<description><![CDATA[Timer To ease the use of time, the library comes with a timer that you can use for both recording and replay. Here is a timer example that you can adapt to both recording or replay situations. import gml4u.brushes.*; import gml4u.recording.*; import gml4u.test.*; import gml4u.utils.*; import gml4u.drawing.*; import gml4u.events.*; import gml4u.model.*; Timer timer = new [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Timer</strong><br />
To ease the use of time, the library comes with a timer that you can use for both recording and replay.<br />
Here is a timer example that you can adapt to both recording or replay situations.</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

Timer timer = new Timer();

void setup() {
	timer.setStep(10);
	ellipseMode(CENTER);
	fill(255, 0, 0);
}

void draw() {
	// Increments the timer by the interval defined earlier
	timer.tick();
	// Alternatively, you can call the same method and passing the interval that you want
	// timer.tick(10);
	text(""+timer.getTime(), 20, 20);
	if (timer.started()) { // Draws a red circle
		ellipse(10, 10, 10, 10);
	}
	if (timer.paused()) {
		text("||", 5, 5);
	}
}

void keyPressed() {
	if (key == 'a' || key == 'A') {
		// Starts the timer
		timer.start();
	}
	if (key == 'z' || key == 'Z') {
		// Pause/Continue
		timer.pause(!timer.paused());
	}
	if (key == 'e' || key == 'E') {
		// Stops the timer and resets the timer
		timer.stop();
	}
	if (key == 'r' || key == 'R') {
		// Resets the timer (time set to 0)
		timer.reset();
	}
}
</pre>
<p></code></p>
<p><strong>Timebox</strong></p>
<p>For some reasons, you may want to draw gml files consecutively but also want them to have the same duration.<br />
To do so, you can timebox the gml by using the static method timebox of the GmlUtils class.<br />
This method takes 3 parameters:<br />
A Gml object you wanna modify<br />
The total duration (in seconds)<br />
A boolean to tell wether you want the time ratio being kept or not.</p>
<p>If true:<br />
If the Gml object has time information, then it will be timeboxed y setting the first point&#8217;s time to 0 and mapping every other point between 0 and the target duration according to its original time.<br />
This basically means that the drawing rythme will be kept.<br />
If the Gml object has no time information, then every stroke&#8217;s point will be mapped between 0 and the target duration based on an interval calculated using the total number of points in the Gml file.<br />
This means that strokes will be drawn  one after the others.</p>
<p>If false:<br />
Will be the same as set to true when the Gml object has no time information.</p>
<p><code></p>
<pre>
import gml4u.brushes.*;
import gml4u.recording.*;
import gml4u.test.*;
import gml4u.utils.*;
import gml4u.drawing.*;
import gml4u.events.*;
import gml4u.model.*;

GmlBrushManager brushManager = new GmlBrushManager();
Gml gml;

void setup() {
	size(600, 600);
	// Load a gml file

	// Timebox it to 15 seconds
	GmlUtils.timebox(gml, 15, true);
	//GmlUtils.timebox(gml, 15, false);
}

void draw() {
	brushManager.draw(g, gml, 600);
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-working-with-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro &amp; installation</title>
		<link>http://www.graffitimarkuplanguage.com/gml4u-intro-installation/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml4u-intro-installation/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:09:15 +0000</pubDate>
		<dc:creator>jerome</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[gml4u]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=336</guid>
		<description><![CDATA[Introduction GML4U is a GML library for Processing. It helps you load, manipulate, display and save GML files. Pre-requisites Download and install the latest version of Processing from http://processing.org/download Installation Download the latest version from github at http://githib.com/01010101/GML4U Unzip it to the &#8220;libraries&#8221; folder located in your Processing sketchbook folder (where your sketches are usually [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong><br />
GML4U is a GML library for Processing.<br />
It helps you load, manipulate, display and save GML files.</p>
<p><strong>Pre-requisites</strong></p>
<p>Download and install the latest version of Processing from <a href="http://processing.org/download">http://processing.org/download</a></p>
<p><strong>Installation</strong></p>
<p>Download the latest version from github at <a href="http://githib.com/01010101/GML4U">http://githib.com/01010101/GML4U</a></p>
<p>Unzip it to the &#8220;libraries&#8221; folder located in your Processing sketchbook folder (where your sketches are usually saved) in a way that you end up with the following a folder structure:<br />
<code><br />
Processing<br />
+-- libraries<br />
+-- GML4U<br />
+-- examples<br />
+-- library<br />
+-- reference<br />
+-- src<br />
</code></p>
<p><strong>Test if your installation is correct</strong></p>
<p>To do so, launch Processing and go to the Processing Examples (File &gt; Examples).<br />
Then select &#8220;Contributed Libraries &gt; GML4U&#8221;.<br />
<a href="http://www.graffitimarkuplanguage.com/gml4u-intro-installation/gml4u-tutorial-01-examples/" rel="attachment wp-att-337"><img class="alignnone size-medium wp-image-337" title="GML4U-Tutorial-01-Examples" src="http://www.graffitimarkuplanguage.com/wp-content/uploads/2011/07/GML4U-Tutorial-01-Examples-300x79.png" alt="" width="300" height="79" /></a><br />
Open the &#8220;GML4UBasic&#8221; sketch.<br />
Run it (Sketch &gt; Run).<br />
You should see the GML4U logo.<br />
<a href="http://www.graffitimarkuplanguage.com/gml4u-intro-installation/gml4u-tutorial-02-logo/" rel="attachment wp-att-338"><img class="alignnone size-medium wp-image-338" title="GML4U-Tutorial-02-Logo" src="http://www.graffitimarkuplanguage.com/wp-content/uploads/2011/07/GML4U-Tutorial-02-Logo-300x212.png" alt="" width="300" height="212" /></a></p>
<p>If so, everything is fine and you can move forward.</p>
<p>If not, make sure that the default Processing sketch folder if the one where you copied the library (Processing &gt; Preferences) and double-check the folder structure as decribed above.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml4u-intro-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GML Recording Machine</title>
		<link>http://www.graffitimarkuplanguage.com/gml-recording-machine-2/</link>
		<comments>http://www.graffitimarkuplanguage.com/gml-recording-machine-2/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 09:16:48 +0000</pubDate>
		<dc:creator>evan</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[gmlrecordingmaching]]></category>
		<category><![CDATA[maching]]></category>
		<category><![CDATA[recording]]></category>

		<guid isPermaLink="false">http://www.graffitimarkuplanguage.com/?p=334</guid>
		<description><![CDATA[Muharrem Yildirim has developed the first major contender towards solving the GML Field Recorder Challenge, which is a 1200 euro prize to produce an easily reproducible DIY device that can unobtrusively record graffiti motion data during a graffiti writer’s normal practice in the city. The GML Recording Machine uses a hacked mechanical mouse in combination [...]]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/24130438?title=0&amp;byline=0&amp;portrait=0" width="640" height="360" frameborder="0"></iframe></p>
<p><a href="http://muharrem-yildirim.com/">Muharrem Yildirim</a> has developed the first major contender towards solving the <a href="http://www.graffitimarkuplanguage.com/challenges/gml-field-recorder-challenge/">GML Field Recorder Challenge</a>, which is a 1200 euro prize to produce an easily reproducible DIY device that can unobtrusively record graffiti motion data during a graffiti writer’s normal practice in the city. The <a href="http://blog.muharrem-yildirim.com/2011/05/31/gml-recording-machine-vienna/">GML Recording Machine</a> uses a hacked mechanical mouse in combination with an Arduino to measure the length of two strings attached to the graffiti writer&#8217;s feet. The motion captured data is stored in an on board SD card and, with a simple script, is later converted to Graffiti Markup Language (.gml) format. An instruction guide for how to build the device from low cost materials will be on Muharrem&#8217;s <a href="http://blog.muharrem-yildirim.com/">blog</a> shortly.</p>
<p>The GML Recording Machine is an exciting step forward in the development of technologies for real (as opposed to simulated) graffiti.</p>
<p><img src="http://blog.muharrem-yildirim.com/wp-content/uploads/2011/05/IMG_0274-224x300.jpg" width=640 /><br />
<img src="http://blog.muharrem-yildirim.com/wp-content/uploads/2011/05/Screen-shot-2011-05-31-at-3.05.56-PM.png" width=640 /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graffitimarkuplanguage.com/gml-recording-machine-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

