What's new? | Help | Directory | Sign in
Google
degrafa
Degrafa is a declarative graphics framework for Flex.
  
  
  
  
    
Search
for
Updated Dec 30, 2007 by scalenine
Labels: howto, Featured
HowTo  
How to use Degrafa.

How To Use Degrafa

This is a quick description of how to start using Degrafa. For more information you can refer to the samples at http://samples.degrafa.com or the documentation at http://docs.degrafa.com. If you don't have Degrafa installed, refer to the Getting Started wiki page.

Drawing

Anything that is drawn with Degrafa must be inside a <Surface> tag, like this:

<degrafa:Surface verticalCenter=“0“ horizontalCenter=“0“>
    <degrafa:GeometryGroup>
        <geometry:Circle/>
    </degrafa:GeometryGroup>
</degrafa:Surface>

With the <Surface> tags added you can start creating a composition using fills, strokes, geometry shapes, geometry groups, repeaters, etc. To draw a shape it must reside inside a Geometry Group, as shown in the following MXML code. You can have multiple Geometry Groups to create advanced compositions. You can also apply effects and filters to Geometry Groups.

<degrafa:GeometryGroup>
	<geometry:Circle/>
</degrafa:GeometryGroup>

In order for a shape to be visible when drawn, a fill or stroke must be used inline of a shape, or referenced by a shape. For example:

<geometry:Circle radius=“150“>
	<geometry:fill>
		<paint:SolidFill color=“#62ABCD“/>
	</geometry:fill>
</geometry:Circle>

Or you could reference a fill or stroke, like this:

<degrafa:fills>
	<paint:SolidFill id=”blueFill” color=“#62ABCD“/>
</degrafa:fills>

<geometry:Circle fill=“{blueFill}“ radius=“150“>

That's the basics. You can do a lot more and we'll try to add more “How to” information as we have more time. For more information, check out the samples at http://samples.degrafa.com or the documentation at http://docs.degrafa.com.


Comment by stemlaur2, Jan 17, 2008

Is it possible to use that components is AS3 form to draw forms in a sprite ?

Comment by samiha.souissi, Feb 18, 2008

he, I've downloaded degrafa.-1.2 for flex builder 2.0.1 but I have this errors:

1017: The definition of base class Locale was not found. Could not resolve <mx:Application> to a component implementation. unable to load SWC Degrafa.swc: multiple points

can any one help me please?

Comment by thesaj13, Mar 18, 2008

I am trying to take a vector image created in Adobe Illustrator and saved as an SVG and convert it to a Degrafa element.

Is there an easy way to do this?

<ellipse fill="#00A7FF" stroke="#9F1600" cx="122.79" cy="232.249" rx="10.472" ry="14.369"/>

The above does not seem to match the structure that is used by Degrafa. So I was wondering if there is an easier way to do this?

<geometry:Ellipse fill="{iconFill}" stroke="{iconHighlight}" height="20" width="36" x="32.877" y="39.209"/>

Comment by scalenine, Mar 18, 2008

We're currently working on a tool to convert different formats (including SVG) to Degrafa. Until then you'll have to do it manually as you have shown.

Comment by tesshowington, Apr 15, 2008

The surface tag is limiting placement. Right now it only uses absolute positioning. I'd like to be able to wrap it in a HBox, VBox, etc, and have the shapes space themselves apart accordingly.

Also, is there a way to make a dotted or dashed stroke on the shapes?


Sign in to add a comment