Degrafa: Declarative Graphics Framework

Degrafa Blog

Get Degrafa Now

Archive for the ‘beta 2’ Category

Degrafa at Michigan Flex Camp

Tuesday, July 29th, 2008

If you’re in Michigan and want to learn about Degrafa you should check out the Michigan Flex Camp. Joe Johnston will be doing a presentation about the framework and may be showing some new Degrafa features coming in future releases. If you haven’t checked out some of the stuff Joe has done with Degrafa, we recommend you check out his site.

Michigan Flex Camp Info

It’s great seeing people going out and speaking to the community about Degrafa. This is really helping us out to spread the word and get even more excited about future features. Here’s some links to other Degrafa presos people have given:

Flex Meetup / Speaker: John Mason

Rocky Mountain Adobe User Group / Speaker: Juan Sanchez

Potential Presenters

If your thinking about presenting on Degrafa be sure to let us know at info [at] degrafa [dot] com. We have slide decks, samples, and a willingness to help you make Degrafa look rockin’.

Catch a Degrafa Connect Session

Wednesday, May 7th, 2008

RMAUG

Tomorrow there will be a Degrafa presentation and Connect session hosted by the Rocky Mountain Adobe User Group. For those of you who voiced interest in attending, here’s your chance. If the time and place don’t suit your schedule I believe it will be recorded for convenient viewing. Features of the framework will be discussed, code samples will be shown, followed with a hands-on session.

You can get more information on the RMAUG website.

Introduction to Degrafa on InsideRIA

Tuesday, May 6th, 2008

InsideRIAThere is an article up on InsideRIA that introduces some of the theory and features of Degrafa. I also put together a couple walkthroughs to get you started, but they just barely scratch the surface of what is possible. Definitely check it out if you’re looking for a quick shot of some beginning Degrafa knowledge.

One of the things we’re beginning to focus on is putting together more tutorials, samples and screencasts that really show off what you can do with Degrafa. This article is part of that initiative. With a new version of Degrafa on the horizon, it will be more important than ever to make sure we share the knowledge.

Read An Introduction to Degrafa

An En-Gauging Experience

Saturday, April 5th, 2008

Degrafa Gauge

Ok, I couldn’t resist using the title. Tom Gonzalez put together a really nice example of a gauge built using Degrafa. He also did a lot more than that. For some of the custom items like the tick marks, he made his own ArcLineRepeater based on Degrafa’s LineRepeater so that it rotated around a central point. Based on what Tom said, it sounds like it was pretty easy for him to do.

This example also allows you to apply different skins like you would any other Flex component, but instead of having to go to an external application like Fireworks or Flash you can do all your skinning for the gauge right in Flex and assign them through CSS. Tom’s example has 2 skins you can choose from and you can change properties like colors, angle, tick alpha and more very easily.

I think the coolest thing about this example is that Tom already had this gauge built before, but realized it had much more potential if he converted to use Degrafa. The result seems to be a much more flexible solution that can be extended quite easily to take on a number of different appearances. Good stuff!

Check out Tom’s blog post about the gauge and don’t forget to view the source.

Degrafa & Data Visualization

Saturday, March 29th, 2008

Andrew Trice had a post over on InsideRIA about using Degrafa as an item renderer within a Data Grid to create a bar chart like effect. His post really helped show just how simple it can be to use Degrafa for visualizing data. In his example he used some RegularRectangles and bound them to the data that was being pulled into a single column to change the width of the rectangle. This was a very simple, yet effective approach and much nicer than looking at a long list of values.

We extended Andrew’s example a bit into another Data Grid example that uses an item renderer with a split bar visualization and optimized the example a little. This example could be extended even further by using Bitmap or Complex fills based on the data, or changing the shape used for the visual. Here’s what it looks like:

While syncing in iTunes I was looking at the indication of how my media was distributed across my iPhone and realized that same visualization could be duplicated using Degrafa. I used a series of different colored RegularRectangles, some VerticalLineRepeaters for the inset markings that dynamically change count depending on the size, some other Rectangles for highlights and shadows, and a RoundedRectangle to mask the area. I also through in a ComplexFill composed of a Solid, Bitmap and Blend fill to create the colored plaid effect. This was really easy to do with binding to change the width, capacity bars, inset marks and colors. Here’s what the example looks like:

UPDATE: Here’s another example that expands upon the bar charts above to create some shape based renderers and a pie chart renderer. The shape renderers were easy to do. They’re masks created with Repeaters. The stars are Polygon Repeaters, the circles are Circle Repeaters, and the squares are Rounded Rectangle Repeaters. The pie chart renderer is just a couple of Elliptical Arcs. See below:

These examples are available on the Degrafa Samples page with View Source enabled.

There’s so much data flying around out there that would be kinda neat to create unique visualizations for using Degrafa. I’ve been checking out COLOURlovers, Echo Nest, FriendFeed and more that would be cool to try and visualize or use in a visualization. Better yet, you could make certain properties accesible to a designer for them to make the visualizations customized to their specifications.

Externalizing Fills & Strokes

Friday, March 21st, 2008

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 file where you’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.

As an example, I could make a Fills.mxml file where I specify a fill, like this:






	
	



Then, I can reference that MXML file wherever I’m drawing with Degrafa. For example, the following Circle.mxml code would reference the Fills.mxml:






	

	
		
	

	



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’s up to you. I put together a more evolved example than what was shown above and you can view it here:

View External Fills and Strokes Example
(View Source enabled. Also available on Degrafa Samples page)

Taking This Further

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 Kuler or COLOURlovers and you could get some really unique opportunities for custom UIs, data visualization, compositions, etc.

We’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’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.

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?

Interested in a Degrafa Connect Session?

Sunday, March 16th, 2008

Last week I spoke at the Rocky Mountain Adobe Users Group about Degrafa and someone asked if I would go back and do a full session about the topic. They also asked how I would feel about making it a Connect session for anyone else interested could participate remotely. I thought would be great idea.

There are so many thinks that you can do with Degrafa and it’s evolving every week. Having a Connect Session would enable us to expose a lot of these features to a wider audience as long as there is a demand. So, I’m asking, is there a lot of interest in this? What areas do you have the most trouble/questions with? Any specific topics you’d like to see covered? I could also record the session and post it after the fact.

Degrafa Map Sample Source Available

Sunday, March 16th, 2008

Degrafa Map Sample

A lot of people we’ve talked to have been interested in using Degrafa for mapping. Of particular interest was drawing states or regions that incorporate events and data. We put together a proof of concept a while back for EffectiveUI and we’re now making the source available after some clean up and updates to the latest beta release. The sample uses Degrafa to draw the states and for some custom skinning.

There were a number of people on the Degrafa Group asking for the source, so we’ve enable “View Source” on the application. This sample is also available on the Degrafa Samples page.

View The Degrafa Map Sample

New Degrafa Samples Available

Thursday, March 13th, 2008

New samples of Degrafa in use can be found at http://samples.degrafa.com. If you attended the Degrafa session at 360|Flex you may remember seeing them. They all address some of the new features in latest beta and include samples for:

  • Skinning a VSlider to look like a thermometer
  • Advanced skinning using Tweener, cursor position, color tweening, skin states, etc.
  • Using the derive property
  • Reusing compositions created in external MXML files
  • Random art with Degrafa and Tweener
  • Creating and using libraries

Visit the Degrafa Samples page and enjoy!

Degrafa Beta 2 Change Log

Wednesday, March 5th, 2008

Here’s a general list of some of the changes and additions that were made between Degrafa Beta 1 and Beta 2:

Bugs

  1. The collection base class has been updated with bug fixes it also now properly add(s)/remove(s) event listeners at the right moments. As this is the base class, these changes propagate up to all of it’s sub classed versions. The result is that adding or removing items to the collection through Action Script will now correctly dispatch the change and/or clean up.
  2. Fill and stroke properties when directly set with a new fill or stroke will now properly update. This problem seen in Action Script, happens when you want to replace the fill or stroke objects on a geometry item with a different one.
  3. On some of the geometry objects computation was being redone when a fill or stroke change occurred causing the object to be drawn twice. This is no longer the case.
  4. On some geometry objects (path, polygon, and polyline), resetting the data property would not clear the existing items. Setting the data property will now properly clear and re compute the object.
  5. The bounds and drawing commands in the Polygon and Polyline geometry objects were not correctly taking into account the x and y properties during computation. This will now work as expected.

ï¾ Enhancements

  1. All Boolean properties accessible from mxml have be updated to show an enumeration of true,false. Makes the mxml experience more enjoyable.
  2. We have added icons to all the mxml level objects so that the various objects are more apparent in the mxml outline view.
  3. Drawing to arbitrary graphics contexts is now supported via the property graphicsTarget this property accepts an array of display objects and is supported on all subclasses of geometry. As part of this features functionality we also added the property autoClearGraphicsTarget. The default value is true and when true the target graphics contexts will be cleared before rendering.
  4. The ability to nest geometry for proper composition is now possible. We also added a new geometry object GeometryComposition that makes a good root candidate for composing. This new object in conjunction with the graphicsTarget property allow one to use Degrafa with out having to setup a Surface and a GeometryGroup. However it is not a DisplayObject so with out a graphicsTarget specified no rendering will be performed.
  5. The various color properties have been merged into one. We feel overall this will provide a much simpler method to specify the color settings as you see fit.
  6. New state and stateEvent properties have been added to all geometry objects. At this time state is only taken into account when using the Degrafa skins and stateEvent is not yet implemented. The bright side is that we can now have all skin states in one mxml file. Expect more features to be added using these 2 properties in the near future.
  7. Segments now have constructor arguments as well as a data argument. The data argument has been moved to the end of the argument list so you will have to update code that uses data in the constructor of a segment. The path object specifically takes advantage of this which allowed us to eliminate unnecessary parsing for each segment in the collection providing a performance boost.
  8. LinearGradientFill and stroke now support a definable bounds via new properties (x, y, width, and height). If all of these or just width and height are specified then it will use the specified rectangle for it’s rendering. If none are specified it will fall back to the geometry object bounds or the rectangle that is passed to the draw method. We added the same support to the RadialGradientFill and stroke except the properties in this case are cx, cy, and radius.
  9. Create objects reusing or overriding properties derived from other objects using the derive property.
  10. New library base classes, starting with Polygon, others will soon follow as well as libraries to help get you started.
  11. Specify ratios for gradients using different units, like inches, px, etc. using the ratioUnit property.
  12. Some of the geometry drawing code has been updated. Circle, Ellipse, RegularRectangle, RoundedRectangle and RoundedRectangleComplex are no longer using the built in flash drawing commands (drawCircle()) for example. This was an important step for future enhancements. All drawing code now boils down to a command stack of moveTo, lineTo or curveTo. There will be refactoring throughout all geometry that will bring a cleaner code base and remove duplicate code once we have finished defining the architectural rendering pipline required to support where we need to go.
  13. ï¾