<?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>Degrafa &#187; strokes</title>
	<atom:link href="http://www.degrafa.org/blog/category/strokes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.degrafa.org/blog</link>
	<description>Degrafa is a declarative graphics framework.</description>
	<lastBuildDate>Fri, 06 Nov 2009 05:15:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ready, Set, Shape Stroke</title>
		<link>http://www.degrafa.org/blog/2009/11/ready-set-shape-stroke/</link>
		<comments>http://www.degrafa.org/blog/2009/11/ready-set-shape-stroke/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 23:12:39 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[beta 3]]></category>
		<category><![CDATA[strokes]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://www.degrafa.org/blog/?p=266</guid>
		<description><![CDATA[We will be introducing a couple more simple yet sophisticated decorations into Degrafa Beta 3.2 in order to show the multitude of ways this feature can be used. One of these is ShapeStrokeDecorator. This is a different type of decoration compared to the the SVGDashLine example in that in MXML it &#8220;wraps&#8221; the geometry you [...]]]></description>
			<content:encoded><![CDATA[<p>We will be introducing a couple more simple yet sophisticated decorations into Degrafa Beta 3.2 in order to show the multitude of ways this feature can be used. One of these is <a href="http://degrafa.org/source/ShapeStroke/ShapeStroke_Sample.swf" target="_blank">ShapeStrokeDecorator</a>. This is a different type of decoration compared to the the <a href="http://www.degrafa.org/source/HappyHolidays/HappyHolidays.html" target="_blank">SVGDashLine example</a> in that in MXML it &#8220;wraps&#8221; the geometry you wish to decorate rather than being a nested tag. Consider the order of composition reversed between the two types.</p>
<p>ShapeStrokeDecorator achieves results similar to advanced path tools in a vector editor that allow placement of items along a path.</p>
<p><a href="http://degrafa.org/source/ShapeStroke/ShapeStroke_Sample.swf"><img class="aligncenter size-full wp-image-270" title="ShapeStroke" src="http://www.degrafa.org/blog/wp-content/uploads/2009/11/ShapeStroke.jpg" alt="ShapeStroke" width="485" height="422" /></a></p>
<p>This decoration will be part of beta 3.2 due out this week. <a href="http://degrafa.org/source/ShapeStroke/ShapeStroke_Sample.swf" target="_blank">Here it is in action</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.degrafa.org/blog/2009/11/ready-set-shape-stroke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Externalizing Fills &amp; Strokes</title>
		<link>http://www.degrafa.org/blog/2008/03/externalizing-fills-strokes/</link>
		<comments>http://www.degrafa.org/blog/2008/03/externalizing-fills-strokes/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 18:18:57 +0000</pubDate>
		<dc:creator>juan</dc:creator>
				<category><![CDATA[beta 2]]></category>
		<category><![CDATA[fills]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[strokes]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[external]]></category>
		<category><![CDATA[paint]]></category>

		<guid isPermaLink="false">http://www.degrafa.com/2008/03/21/externalizing-fills-strokes/</guid>
		<description><![CDATA[One of the benefits Degrafa offers as part of the framework is the ability to repurpose code to no end. This may be obvious for things like geometry, but if you find yourself writing redundant code for fills and strokes, this tip should help.
Rather than specifying the same common fills and strokes in every MXML [...]]]></description>
			<content:encoded><![CDATA[<p>One of the benefits Degrafa offers as part of the framework is the ability to repurpose code to no end. This may be obvious for things like geometry, but if you find yourself writing redundant code for fills and strokes, this tip should help.</p>
<p>Rather than specifying the same common fills and strokes in every MXML file where you&#8217;re doing your drawing, you can separate fills and strokes in to their own MXML files. Then, whenever you need to access a fill or stroke, you can add that component to your MXML file and easily access them when appropriate. By doing this, you also have the advantage of code hinting, which makes for quick and easy coding.</p>
<p>As an example, I could make a Fills.mxml file where I specify a fill, like this:</p>
<pre>
<code>
<?xml version=â€œ1.0â€œ encoding=â€œutf-8â€œ?>
<!-- Fills.mxml -->
<geometryComposition
	xmlns:mx=â€œhttp://www.adobe.com/2006/mxmlâ€œ
	xmlns=â€œhttp://www.degrafa.com/2007â€œ
	>

	<!-- Solid Fills -->
	<solidFill
		id=â€œgreyâ€œ
		color=â€œ#666â€œ
		/>

</geometryComposition>
</code>
</pre>
<p>Then, I can reference that MXML file wherever I&#8217;m drawing with Degrafa. For example, the following Circle.mxml code would reference the Fills.mxml:</p>
<pre>
<code>
<?xml version=â€œ1.0â€œ encoding=â€œutf-8â€œ?>
<!-- Circle.mxml -->
<mx:Application
	xmlns:mx=â€œhttp://www.adobe.com/2006/mxmlâ€œ
	layout=â€œabsoluteâ€œ
	xmlns=â€œhttp://www.degrafa.com/2007â€œ
	xmlns:local=â€œ*â€œ>

	<local:Fills
		id=â€œfillsâ€œ
		/>

	<geometryComposition
		graphicsTarget=â€œ{[ surface ]}â€œ
		>
		<circle
			radius=â€œ100â€œ
			fill=â€œ{fills.grey}â€œ
			/>
	</geometryComposition>

	<surface
		id=â€œsurfaceâ€œ
		verticalCenter=â€œ0â€œ
		horizontalCenter=â€œ0â€œ
		/>

</mx:Application>
</code>
</pre>
<p>Those two code samples represent some of the basic methods for cutting down on the amount of code you need to write. I could reference that Fills.mxml in any other component and use the fills defined in that file. You could do the same for strokes as well or make separate MXML files for  each type of stroke or fill. It&#8217;s up to you. I put together a more evolved example than what was shown above and you can view it here:</p>
<p><a href="http://samples.degrafa.com/ExternalFillsStrokes/DegrafaFillsStrokes.html" target="_blank">View External Fills and Strokes Example</a><br />
(<a href="http://samples.degrafa.com/ExternalFillsStrokes/srcview/index.html" target="_blank">View Source</a> enabled. Also available on <a href="http://samples.degrafa.com/" target="_blank">Degrafa Samples</a> page)</p>
<p><strong>Taking This Further</strong></p>
<p>You can expand on this example by making separate Fills and Strokes files for different parts of an application, share those files with other Degrafa users, adjust the structure for what makes most sense for you, etc. One thing that would be interesting is to make a separate Colors class that you can reference from the Fills and Strokes files. Then, when you change the color values in the Colors class the whole scheme of the app could change. Hook that Color class up to a color API like <a href="http://kuler.adobe.com/" target="_blank">Kuler</a> or <a href="http://colourlovers.com.s3.amazonaws.com/blog/wp-content/uploads/_apiDocumentation.html" target="_blank">COLOURlovers</a> and you could get some really unique opportunities for custom UIs, data visualization, compositions, etc.</p>
<p>We&#8217;ve been thinking about a way to grab a color palette using a color API, present a user with a bunch of variations of Fills and Strokes based on that selected palette, allow for selection of which Fills and Strokes the user wants, then write out MXML files with those selections in it. The user could then drop those MXML files into their Flex project and they&#8217;re ready to go. It could work the other way too where a user could read an MXML file and be presented with Fill and Stroke swatches of which they can edit and write out a new MXML file.</p>
<p>The more we keep plugging away on Degrafa it seems there are more and more opportunities for creating some really unique tools. Imagine a Fills and Strokes palette that uses the Fills and Strokes MXML files as the model. Who knows what other kinds of things people will come up with as the framework progresses. Any suggestions?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.degrafa.org/blog/2008/03/externalizing-fills-strokes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Closer Look at Fills and Strokes</title>
		<link>http://www.degrafa.org/blog/2007/07/a-closer-look-at-fills-and-strokes/</link>
		<comments>http://www.degrafa.org/blog/2007/07/a-closer-look-at-fills-and-strokes/#comments</comments>
		<pubDate>Sat, 14 Jul 2007 20:13:41 +0000</pubDate>
		<dc:creator>juan</dc:creator>
				<category><![CDATA[beta 1]]></category>
		<category><![CDATA[fills]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[strokes]]></category>
		<category><![CDATA[paint]]></category>
		<category><![CDATA[sample]]></category>

		<guid isPermaLink="false">http://www.degrafa.com/2007/07/14/a-closer-look-at-fills-and-strokes/</guid>
		<description><![CDATA[As Degrafa evolves, Jason and I are trying to make sure we can account for a number of features someone may find important when creating graphics with the framework. Fills and Strokes are very important because they literally make up the shapes that get drawn.
Without a strong solution for those two things you&#8217;re left with [...]]]></description>
			<content:encoded><![CDATA[<p>As Degrafa evolves, Jason and I are trying to make sure we can account for a number of features someone may find important when creating graphics with the framework. Fills and Strokes are very important because they literally make up the shapes that get drawn.</p>
<p>Without a strong solution for those two things you&#8217;re left with a something somewhat lackluster. Here&#8217;s an example of where things are at so far with Fills and Strokes:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_fills_1835198930"
			class="flashmovie"
			width="436"
			height="120">
	<param name="movie" value="http://www.degrafa.com/wp-content/source/swf/fills.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.degrafa.com/wp-content/source/swf/fills.swf"
			name="fm_fills_1835198930"
			width="436"
			height="120">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Fills</h3>
<p>Fills are created outside and independent of any shape to make sure they can be repurposed. Each type of fill is declared in between a <fills> tag, so the MXML for all these fills together would look like this:</p>
<pre>
<code>
<fills>
  <bitmapFill id="bitmapFill" imageSource="{TestImage}"
      repeat="true" rotation="45" smooth="true"/>
  <gradientFill id="gradientFill" angle="90">
      <gradientStop color="#ff0000" alpha=".8" ratio=".25"/>
      <gradientStop color="#ffffff" alpha=".5" ratio=".5"/>
      <gradientStop color="#999999" alpha=".8" ratio=".8"/>
  </gradientFill>
  <solidFill id="solidFill" alpha="1" color="#a678cd"/>
</fills>
</code>
</pre>
<h4>Bitmap Fills</h4>
<p>Let&#8217;s take a look at each Fill separately. The top-left circle is an example of using a Bitmap Fill and the Fill is created like this:</p>
<pre>
<code>
<bitmapFill id="bitmapFill" imageSource="{printerIcon}"
    repeat="true" rotation="45" smooth="true"/>
</code></pre>
<p>The imageSource variable name points to an embedded image, repeat allows you to specify if you&#8217;d like the image to repeat, rotation allows you to rotate the bitmap fill and smooth allows you to smooth out the bitmap fill. Smooth was helpful in this example where without it the edges of the repeated image were jagged.</p>
<h4>Gradient Fills</h4>
<p>Gradient fills allow you to create linear and radial gradient fills with multiple color, alpha, and ratio specifications. The top-middle circle is an example of a Gradient Fill. The MXML looks like this:</p>
<pre>
<code>
<gradientFill id="gradientFill" angle="90">
    <gradientStop color="#ff0000" alpha=".8" ratio=".25"/>
    <gradientStop color="#ffffff" alpha=".5" ratio=".5"/>
    <gradientStop color="#999999" alpha=".8" ratio=".8"/>
</gradientFill>
</code></pre>
<p>This creates a 3 color gradient fill with various ratios and alphas.</p>
<h4>Solid Fills</h4>
<p>Solid fills are pretty straight forward, it supports color and alpha. The MXML looks like this:</p>
<pre>
<code>
<solidFill id="solidFill" alpha="1" color="#a678cd"/>
</code>
</pre>
<h3>Working with Strokes</h3>
<p>Just like Fills, Strokes are specified independent from any shape or object. Gradient Strokes, both linear and radial, and Solid Strokes are part of Degrafa. You can also specify things like joints, caps, spreadMethod, angle, miterLimit, scaleMode, pixelHinting and more. The MXML for a group of Strokes would look like this:</p>
<pre>
<code>
<strokes>
  <solidStroke color="#000000" alpha=".75"
      weight="6" id="solidStroke"/>
  <gradientStroke id="linearStroke" joints="round"
      gradientType="linear" weight="12" >
      <gradientStop color="#ff0000" alpha=".8" ratio=".25"/>
      <gradientStop color="#ffffff" alpha=".5" ratio=".5"/>
  </gradientStroke>
  <gradientStroke id="radialStroke" caps="square"
      joints="bevel" gradientType="radial" weight="12" >
      <gradientStop color="#ff0000" alpha=".8" ratio=".9"/>
      <gradientStop color="#ffffff" alpha=".5" ratio="1"/>
  </gradientStroke>
</strokes>
</code>
</pre>
<p>As things progress, the ability to created different stroke styles like dashed, dotted, random, etc. will be added as well as the ability to add start/end caps like arrow heads, shapes, images, etc. Here&#8217;s an example of some strokes:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_strokes_101285601"
			class="flashmovie"
			width="436"
			height="120">
	<param name="movie" value="http://www.degrafa.com/wp-content/source/swf/strokes.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.degrafa.com/wp-content/source/swf/strokes.swf"
			name="fm_strokes_101285601"
			width="436"
			height="120">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br/></p>
<h4>Gradient Strokes</h4>
<p>As mentioned above, Radial and Linear Gradient strokes can be created using Degrafa. The code for the top-left example looks like this:</p>
<pre>
<code>
<gradientStroke id="linearStroke" joints="round"
      gradientType="linear" weight="12" >
      <gradientStop color="#ff0000" alpha=".8" ratio=".25"/>
      <gradientStop color="#ffffff" alpha=".5" ratio=".5"/>
 </gradientStroke>
</code>
</pre>
<p>The MXML for the radial stroke example to the top-right has square caps and bevel joints and looks like this:</p>
<pre>
<code>
<gradientStroke id="radialStroke" caps="square"
      joints="bevel" gradientType="radial" weight="12" >
      <gradientStop color="#ff0000" alpha=".8" ratio=".9"/>
      <gradientStop color="#ffffff" alpha=".5" ratio="1"/>
 </gradientStroke>
</code>
</pre>
<h4>Solid Strokes</h4>
<p>Solid Strokes can have caps, joints, color, miterLimit, scaleMode, pixelHinting, etc. specified. The MXML:</p>
<pre>
<code>
<solidStroke color="#000000" alpha=".75" weight="6"/>
</code>
</pre>
<p>Another thing worth mentioning is that we&#8217;re looking to allow the ability to specify Fills and Strokes properties through CSS, so there&#8217;s a way to maintain consistency throughout an app without code redundancy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.degrafa.org/blog/2007/07/a-closer-look-at-fills-and-strokes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

