這是快取的 http://www.degrafa.com/2007/07/04/degrafa-a-flex-graphics-framework-is-begun/ 擷取日期在2009-02-07 02:01:38。
此為 Vifind 漫遊網路時所暫存之網頁,它可能已經更新,請連至 http://www.degrafa.com/2007/07/04/degrafa-a-flex-graphics-framework-is-begun/ 查看最新網頁。
由於與原作者無關,Vifind 不對網頁內容負責。
您的查詢為 flash

Degrafa: A Flex Graphics Framework is Begun

Degrafa: A Flex Graphics Framework is Begun

Degrafa, short for Declarative Graphics Framework, is a coordinated and concentrated effort to bring one of the principle items lacking in Flex to the surface and expose it as the MXML mark-up language we all love. The framework is a mark-up syntax for the Flex Graphics APIs and built from the ground up with both developers and designers in mind.

Primary Goals

  • To provide a transparent and coordinated mechanism between designer and developer so that bridges of communication and collaboration can be achieved.
  • To find a common, and readable syntax so that transition can be rewarding, educating, and productive.
  • To allow the creation of complex graphics within Flex without wading through the muddy waters of the graphics api’s.
  • To provide a mechanism through which any Flex user can get maximum benefit from the graphics api’s available, with a limited learning curve and still profit from optimum reusability opportunities.
  • To make all of these easily accessible to both beginner and experienced Flex users.

Creating a Common Ground

Designers don’t speak Action Script and developers don’t speak Photoshop, Flash CS3, layers and masks (Okay, we know this isn’t entirely true, but you get what we’re saying). One language construct common between the two is MXML. However, the existing Flex framework doesn’t allow this common language where graphics and visual design is concerned. Degrafa provides a common dialog between these two areas of expertise.

Degrafa in Action

This is a basic example of a star which was drawn quite easily using Degrafa and without any necessary knowledge of ActionScript.

The star is comprised of three parts, a Linear Gradient Fill, a Stroke and a Geometry Polygon shape. To get the shape to look as it is above I first define the Fill, which can have multiple colors, alphas, gradient ratios and an angle value. Radial Gradients are also supported. In this case, a Linear Fill is created and given an id of OrangeFill:

<Fills>
  <mx:LinearGradient id="OrangeFill" angle="45" >
    <mx:GradientEntry ratio="0" alpha="1" color="#FAE38F"/>
    <mx:GradientEntry ratio="1" alpha="1" color="#EE9819"/>
  </mx:LinearGradient>
</Fills>

Next, a basic Stroke is created with an id of OrangeStroke:

<Strokes>
    <mx:Stroke id="OrangeStroke" color="#EE9819" />
</Strokes>

The final step is drawing the shape. In this case a Geometry shape of Polygon is used to create the star using a point structure and the Stroke and Fill attributes are assigned by referencing the Stroke and Fill ids that were created prior. This draws the star:

<Geometry:Polygon x="140" y="60"
    Stroke="{OrangeStroke}" Fill="{OrangeFill}"
    data="60,10 45,40 12,45 36,68 31,100
    60,85 89,100 84,68 108,45 75,40">
</Geometry:Polygon>

The point structure in the above MXML is noted using a short hand version of specifying the x and y values of each point. This is a quick way to specify points, but there is also a long hand version that will serve it’s own purposes. Specifying a set of points in long hand would look something like:

<Geometry:Polygon x="140" y="60"
    Stroke="{OrangeStroke}" Fill="{OrangeFill}">
    <Geometry:Points>
        <geom:Point x="60" y="10"/>
        <geom:Point x="45" y="40"/>
    </Geometry:Points>
</Geometry:Polygon>

As progress is made we’ll be posting more complex examples, but this star example represents several core capabilities that will be further explored and expanded upon in future posts here. Stay tuned..

2 Comments, Comment or Ping

  1. Xavier Tapia

    Hello,

    Very interesting but how to test it ???

  2. Degrafa is still in development and is not yet open for testing, but the first version of the framework will be available for testing very soon.

Reply to “Degrafa: A Flex Graphics Framework is Begun”