<?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>Saturnboy &#187; inkscape</title>
	<atom:link href="http://saturnboy.com/tag/inkscape/feed/" rel="self" type="application/rss+xml" />
	<link>http://saturnboy.com</link>
	<description>Code, Work, and Life</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:20:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Inkscape SVG to Degrafa Path</title>
		<link>http://saturnboy.com/2009/06/inkscape-svg-degrafa-path/</link>
		<comments>http://saturnboy.com/2009/06/inkscape-svg-degrafa-path/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 03:44:44 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[degrafa]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[inkscape]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://saturnboy.com/?p=528</guid>
		<description><![CDATA[Going from SVG data to a Degrafa Path couldn&#8217;t be easier: just copy &#38; paste. You can watch this video tutorial or you can check out this demo. But there is one trick for Inkscape: even though the coordinate origin on the Inkscape document is the normal cartesian origin in the bottom left and the [...]]]></description>
			<content:encoded><![CDATA[<p>Going from <a href="http://www.w3.org/TR/SVG/">SVG</a> data to a <a href="http://www.degrafa.org/">Degrafa</a> <code>Path</code> couldn&#8217;t be easier: just copy &amp; paste.  You can watch <a href="http://www.vimeo.com/1223682">this video tutorial</a> or you can check out <a href="http://www.degrafa.org/source/Car/Car.html">this demo</a>.</p>
<p><b>But there is one trick for <a href="http://www.inkscape.org/">Inkscape</a></b>: even though the coordinate origin on the Inkscape document is the normal cartesian origin in the bottom left and the y-axis points up, the SVG output always uses the upper left corner of the document as the origin and the y-axis points down (per the <a href="http://www.w3.org/TR/SVG/coords.html#InitialCoordinateSystem">SVG Spec, &sect; 7.3</a>).</p>
<p class="bottom">To demonstrate, I created a new document in Inkscape, set my dimensions to 500 x 500, and placed a simple path (which happens to be a square) in the upper left corner:</p>
<div class="span-14 top bottom last" style="min-height:453px;">
<img src="http://saturnboy.com/wp-content/uploads/2009/06/square.png" alt="square" title="square" width="459" height="443" />
</div>
<p>You can see by the rulers in Inkscape that the square&#8217;s origin is at (0,500).</p>
<p class="bottom">If we save our square and examine the SVG output, we see:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svg</span> ...<span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;g</span> ...<span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">d</span>=<span style="color: #ff0000;">&quot;M 0,0 L 100,0 L 100,100 L 0,100 L 0,0 z&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/g<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/svg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>If we ignore everything in the file except the relevant path data, we can see the very first path command is <code>M 0,0</code> which is path-speak for move to (0,0).  This is exactly as expected from the SVG spec: upper left <b>is</b> the coordinate origin.  <b>The cartesian origin in Inkscape is bogus!</b></p>
<p class="bottom">Next, we can just copy the path data from the SVG file and paste it into the <code>data</code> attribute of a Degrafa <code>Path</code> component.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:Path</span> data=<span style="color: #ff0000;">&quot;M 0,0 L 100,0 L 100,100 L 0,100 L 0,0 z&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:fill</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:SolidFill</span> color=<span style="color: #ff0000;">&quot;#EECCEE&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:stroke</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:SolidStroke</span> color=<span style="color: #ff0000;">&quot;#FF00FF&quot;</span> weight=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:stroke</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:Path</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Give it a fill color and a stroke color, and we get a <a href="http://saturnboy.com/proj/degrafa_svg/degrafa_square/degrafa_square.html">pretty purple square</a>.  Now I know my Degrafa <code>Path</code> component will have a square in the upper left, because I know my square was in the upper left in Inkscape.  Nice and easy.</p>
<h5>Files</h5>
<ul>
<li><a href="http://saturnboy.com/wp-content/uploads/2009/06/square.svg">square.svg</a></li>
<li><a href="http://saturnboy.com/proj/degrafa_svg/degrafa_square/degrafa_square.html">Square</a> (<a href="http://saturnboy.com/proj/degrafa_svg/degrafa_square/srcview/degrafa_square.zip">download</a>)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://saturnboy.com/2009/06/inkscape-svg-degrafa-path/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Degrafa Video Player, Part 2</title>
		<link>http://saturnboy.com/2009/06/degrafa-video-player-2/</link>
		<comments>http://saturnboy.com/2009/06/degrafa-video-player-2/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 10:00:57 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[degrafa]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[inkscape]]></category>
		<category><![CDATA[open video player]]></category>
		<category><![CDATA[skinning]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://saturnboy.com/?p=503</guid>
		<description><![CDATA[The plan is simple, take the nice Degrafa-skinned components from Part 1 and assemble them into a video player powered by the OvpNetStream class from the Open Video Player project. Design I knew right away that the design was not going to have any right angles, but I also didn&#8217;t want to go with rounded [...]]]></description>
			<content:encoded><![CDATA[<p>The plan is simple, take the nice <a href="http://www.degrafa.org/">Degrafa</a>-skinned components from <a href="http://saturnboy.com/2009/05/degrafa-video-player-1/">Part 1</a> and assemble them into a video player powered by the <code>OvpNetStream</code> class from the <a href="http://www.openvideoplayer.com/">Open Video Player</a> project.</p>
<h5>Design</h5>
<p class="bottom">I knew right away that the design was not going to have any right angles, but I also didn&#8217;t want to go with rounded rectangles everywhere.  Modern TVs tend to have a lot of soft rounded edges, so I decided to go with a more vintage look.  So I fired up <a href="http://www.inkscape.org/">Inkscape</a> and got to work:</p>
<div class="span-14 top bottom" style="min-height:232px; text-align:center;">
<img src="http://saturnboy.com/wp-content/uploads/2009/06/tv.png" alt="tv" title="tv" width="176" height="222" />
</div>
<p class="bottom">Implementing the video player design above in Degrafa, the cabinet mapped to a <code>RoundedRectangle</code>, and the screen &#038; antenna became <code>Path</code>s.  You can read more about about translating SVG to Degrafa in my <a href="http://saturnboy.com/2009/06/inkscape-svg-degrafa-pathinkscape-svg-degrafa-path/">Inkscape SVG to Degrafa Path</a> article.  But for now, let&#8217;s focus on the resulting Degrafa code:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        xmlns:Degrafa=<span style="color: #ff0000;">&quot;http://www.degrafa.com/2007&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;absolute&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:GeometryComposition</span> graphicsTarget=<span style="color: #ff0000;">&quot;{[box]}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Antenna --&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:Path</span> data=<span style="color: #ff0000;">&quot;...path data...&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:transform</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:TranslateTransform</span> x=<span style="color: #ff0000;">&quot;15&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:transform</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:Path</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
        <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- TV cabinet --&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:RoundedRectangle</span> y=<span style="color: #ff0000;">&quot;144&quot;</span> width=<span style="color: #ff0000;">&quot;350&quot;</span> height=<span style="color: #ff0000;">&quot;300&quot;</span></span>
<span style="color: #000000;">                cornerRadius=<span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:SolidFill</span> color=<span style="color: #ff0000;">&quot;#333333&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:fill</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:SolidStroke</span> color=<span style="color: #ff0000;">&quot;#FF00FF&quot;</span> weight=<span style="color: #ff0000;">&quot;4&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:stroke</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:GeometryComposition</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- TV Screen --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:GeometryComposition</span> graphicsTarget=<span style="color: #ff0000;">&quot;{[tvscreen]}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:Path</span> data=<span style="color: #ff0000;">&quot;...path data...&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:fill</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:SolidFill</span> color=<span style="color: #ff0000;">&quot;#FF99FF&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:stroke</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:SolidStroke</span> color=<span style="color: #ff0000;">&quot;#FF00FF&quot;</span> weight=<span style="color: #ff0000;">&quot;2&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;Degrafa:filters</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:GlowFilter</span> color=<span style="color: #ff0000;">&quot;#EEEEEE&quot;</span> alpha=<span style="color: #ff0000;">&quot;0.2&quot;</span> blurX=<span style="color: #ff0000;">&quot;16&quot;</span> blurY=<span style="color: #ff0000;">&quot;16&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:filters</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:Path</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/Degrafa:GeometryComposition</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> width=<span style="color: #ff0000;">&quot;350&quot;</span> height=<span style="color: #ff0000;">&quot;444&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> id=<span style="color: #ff0000;">&quot;box&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> x=<span style="color: #ff0000;">&quot;50&quot;</span> y=<span style="color: #ff0000;">&quot;174&quot;</span> id=<span style="color: #ff0000;">&quot;tvscreen&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Canvas</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>I ended up using a pair of <code>GeometryComposition</code>s to wrap my three shapes to help keep my fills, strokes, and filters organized.  It made sense to do it this way, but I won&#8217;t claim it&#8217;s the best way.  Throw the control bar on below the TV screen, and the design is done.</p>
<h5>Backend</h5>
<p>The backend is build on the <code>OvpNetStream</code> class provided by the Open Video Player project.  <code>OvpNetStream</code> extends <code>NetStream</code> and smooths out some of the rough edges as I <a href="http://saturnboy.com/2009/04/open-video-player-air/">discussed</a> previously.  Basically, it provides a sane interface (no need to construct a dynamic object with function callbacks) and useful events (like metadata and progress events).</p>
<p class="bottom">For this demo, we simply instantiate <code>OvpNetStream</code> on <code>creationComplete</code> and wire up all the event handlers:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> complete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    nc = <span style="color: #000000; font-weight: bold;">new</span> OvpConnection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    nc.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>OvpEvent.<span style="color: #0066CC;">ERROR</span>, errorHandler<span style="color: #66cc66;">&#41;</span>;
    nc.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>NetStatusEvent.<span style="color: #006600;">NET_STATUS</span>, connStatusHandler<span style="color: #66cc66;">&#41;</span>;
    nc.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    ns = <span style="color: #000000; font-weight: bold;">new</span> OvpNetStream<span style="color: #66cc66;">&#40;</span>nc<span style="color: #66cc66;">&#41;</span>;
    ns.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>OvpEvent.<span style="color: #0066CC;">ERROR</span>, errorHandler<span style="color: #66cc66;">&#41;</span>;
    ns.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>NetStatusEvent.<span style="color: #006600;">NET_STATUS</span>, streamStatusHandler<span style="color: #66cc66;">&#41;</span>;
    ns.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>OvpEvent.<span style="color: #006600;">NETSTREAM_METADATA</span>, streamMetadataHandler<span style="color: #66cc66;">&#41;</span>;
    ns.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>OvpEvent.<span style="color: #006600;">PROGRESS</span>, streamProgressHandler<span style="color: #66cc66;">&#41;</span>;
    ns.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>OvpEvent.<span style="color: #006600;">COMPLETE</span>, streamCompleteHandler<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    vid = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Video</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    vid.<span style="color: #006600;">attachNetStream</span><span style="color: #66cc66;">&#40;</span>ns<span style="color: #66cc66;">&#41;</span>;
    vidContainer.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>vid<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The most interesting events are the metadata and progress events.  The metadata event delivers the duration of the video and its size.  The progress event arrives periodically (theoretically every 100ms by default, but in reality I see them come in just a couple of times per second) and delivers the current video time.</p>
<h5>Control Bar</h5>
<p>The control bar consists of three components: a play-pause button, a scrubber, and a volume slider.  They were skinned using Degrafa in <a href="http://saturnboy.com/2009/05/degrafa-video-player-1/">Part 1</a>.  In order to control video playback, we need to wire the control bar components to the instance of <code>OvpNetStream</code> created above.</p>
<p class="bottom">Here are the event handlers for the three control bar components:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// PlayPause event handler</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> playPauseClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>first<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        first = <span style="color: #000000; font-weight: bold;">false</span>;
        ns.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span>filename<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
        ns.<span style="color: #006600;">togglePause</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
     <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Scrub event handlers</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> scrubPress<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    ns.<span style="color: #0066CC;">pause</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    playPause.<span style="color: #006600;">selected</span> = <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> scrubDrag<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    ns.<span style="color: #0066CC;">seek</span><span style="color: #66cc66;">&#40;</span>scrub.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> scrubRelease<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    ns.<span style="color: #006600;">togglePause</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    playPause.<span style="color: #006600;">selected</span> = <span style="color: #000000; font-weight: bold;">true</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Volume event handler</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> volumeChange<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    ns.<span style="color: #006600;">volume</span> = volume.<span style="color: #006600;">value</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>In the <code>playPauseHandler()</code>, the initial click calls <code>play()</code> which actually <i>loads</i> the video (and then starts playback), all subsequent clicks just toggle between play or pause.  For the scrubber handlers, I chose to break them up into three separate steps: on mouse down pause the video, on mouse up restart playback, and on drag attempt to seek to the to the new time.</p>
<p class="bottom">That&#8217;s it.  Here is the resulting Degrafa-skinned video player (view source enabled):</a></p>
<div id="flashcontent-degrafa-videoplayer">
Flash is required.  <a href="http://www.adobe.com/go/getflashplayer">Get it here!</a>
</div>
<p>Click <b>Play</b> to start playing <a href="http://www.elephantsdream.org/">Elephants Dream</a> (which is the &#8220;world&#8217;s first open movie,&#8221; and pretty cool too).  Right away you&#8217;ll notice some visual issues because the dimensions of the video are unknown until the metadata arrives.  Also, scrubbing has some problems which I believe are related to cue points in progressive downloads.  Lastly, I didn&#8217;t implement any indicators for buffering or download progress, so you&#8217;ll need to be patient.  Since this is just a demo, I&#8217;ll have to leave fixing those bugs as an exercise for the reader.</p>
<h5>Files</h5>
<ul>
<li><a href="http://saturnboy.com/proj/degrafa_videoplayer/degrafa_videoplayer.html">Video Player</a> (<a href="http://saturnboy.com/proj/degrafa_videoplayer/srcview/degrafa_videoplayer.zip">download</a>)</li>
</ul>
<div>
<script type="text/javascript">
swfobject.embedSWF('http://saturnboy.com/proj/degrafa_videoplayer/degrafa_videoplayer.swf', 'flashcontent-degrafa-videoplayer', '500', '460', '9.0.28', 'expressInstall.swf', false, { bgColor:'#ffffff', base:'.' });
</script></div>
]]></content:encoded>
			<wfw:commentRss>http://saturnboy.com/2009/06/degrafa-video-player-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing with Inkscape and Blueprint CSS</title>
		<link>http://saturnboy.com/2008/11/designing-with-inkscape-and-blueprint-css/</link>
		<comments>http://saturnboy.com/2008/11/designing-with-inkscape-and-blueprint-css/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 05:15:42 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[blueprint css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[inkscape]]></category>

		<guid isPermaLink="false">http://saturnboy.com/?p=69</guid>
		<description><![CDATA[I don&#8217;t know how a real designer does it, but when I attempt a design, particularly a blog design, I always start with a simple theme. If the ideas begin to flow, I&#8217;ll know I chose well. If not, and I still think it&#8217;s a good theme, I&#8217;ll visit the usual suspects for some inspiration. [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know how a real designer does it, but when I attempt a design, particularly a blog design, I always start with a simple theme.  If the ideas begin to flow, I&#8217;ll know I chose well.  If not, and I still think it&#8217;s a good theme, I&#8217;ll visit the <a href="http://www.deviantart.com/">usual</a> <a href="http://images.google.com/">suspects</a> for some inspiration.</p>
<p>On this blog, I started with robots, which quickly lead to gears and mechanics.  For this post, I started with circles.  Actually, I started with Ironman&#8217;s HUD.  The whole movie was super cool, but the HUD was the best.  And the HUD had all this motion and targeting, and that&#8217;s what got me to circles.  So that&#8217;s the theme.  I already know I&#8217;m going to apply this theme to a simple grid-based blog layer that I <a href="http://saturnboy.com/2008/11/blueprint-css-magic/">discussed earlier</a>.</p>
<h5>Palette</h5>
<p class="bottom">After the theme, I worked on the color palette.  I&#8217;ve used <a href="http://kuler.adobe.com/">Kuler</a> in the past to build out a couple of palettes, but this time I just jumped into <a href="http://inkscape.org/">Inkscape</a> and started messing around.  I came up with a nice blood red and black palette.</p>
<div class="span-14 top bottom" style="min-height:58px; text-align:center;">
<img src="http://saturnboy.com/wp-content/uploads/2008/11/palette.png" alt="palette" title="palette" width="250" height="48" />
</div>
<h5>Circles</h5>
<p class="bottom">Now that I have a palette, I shift my design focus back to circles.  It&#8217;s not just gonna be &#8220;Dot, dot, dot&#8221; as my daughter likes to say, so it&#8217;s back to Inkscape.  Here&#8217;s the result:</p>
<div class="span-14 top bottom" style="min-height:148px; text-align:center;">
<img src="http://saturnboy.com/wp-content/uploads/2008/11/circles.png" alt="circles" title="circles" width="325" height="138" />
</div>
<h5>Layout</h5>
<p>Not much left but the real work &ndash; make a cool blog design with circles plus some pretty colors.  I know my <a href="http://saturnboy.com/2008/11/blueprint-css-magic/">layout</a>, so once again it&#8217;s back to Inkscape.  There is a nice <a href="http://www.vunzzz.net/blueprint-inkscape/">Inkscape template generator</a> for Blueprint CSS grid layouts.  Choosing which colors go where isn&#8217;t too bad, because I love dark text on white for blogs.  Following that decision, I go with lots of circles in the header in blood red, over a black background.  We know the main content will be white with black text, so I decide to make the sidebar really stand out with a bold blood red.</p>
<p class="bottom">The circles in the header are really easy, I just pick random sizes and put them in random locations.  Darker usually means further away, so I just reduce the opacity to let more black through.  I use a rounded rectangle with a thick stroke for the main content area.  I also add a black shadow around the entire content area to highlight the content.  The finished design is <a href="http://saturnboy.com/wp-content/uploads/2008/11/circles-of-doom.png" target="_blank">here</a>, and I&#8217;m calling it <strong>Circles Of Doom</strong>.  Here is a closeup of the header:</p>
<div class="span-14 top bottom" style="min-height:135px; text-align:center;">
<a href="http://saturnboy.com/wp-content/uploads/2008/11/circles-of-doom.png"><img src="http://saturnboy.com/wp-content/uploads/2008/11/circles-of-doom-closeup.png" alt="" title="circles-of-doom-closeup" width="300" height="125" /></a>
</div>
<p>Next, we <a href="http://saturnboy.com/2008/12/slice-and-dice/">slice and dice</a>&#8230;</p>
<h5>Files</h5>
<ul>
<li><a href="http://saturnboy.com/proj/circles_of_doom/palette.svg">palette.svg</a></li>
<li><a href="http://saturnboy.com/proj/circles_of_doom/circles.svg">circles.svg</a></li>
<li><a href="http://saturnboy.com/proj/circles_of_doom/circles-of-doom.svg">circles-of-doom.svg</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://saturnboy.com/2008/11/designing-with-inkscape-and-blueprint-css/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
