Query Graphics Data – getGraphicsData()

If you guys have been reading this blog for a while, you may remember that post about querying graphics data. I really wanted this back in the days for AlivePDF to query any DisplayObject to export vector based PDF instead of rasterized vectors in the PDF. But this features gives much more, you can represent anything as a GraphicsData object and serialize that into XML if you need to store a DisplayObject anywhere.

If you need to generate spritesheets at runtime, export to any kind of format, like SVG, you can get that level of granularity, so much stuff to do with it. Some things are not entirely supported yet like some gradients, but we will keep improving it. Here is a little video about it, explaining how it works and a simple demo. As always, thanks Chris for the cute assets:

Query Graphics Data - getGraphicsData() from Thibault Imbert on Vimeo.

Comments (29)

  1. Elliot Geno wrote:

    It doesn’t look like it kept gradients or fills intact.

    Will those be maintained in the final release of this feature?

    Thursday, November 1, 2012 at 11:56 pm #
  2. Elliot Geno wrote:

    Also filters are apparently dismissed on the recursive version.

    Thursday, November 1, 2012 at 11:57 pm #
  3. This looks *amazing* – I would love to integrate this into Box2D (artist draws, programmer implements by simply throwing it on the stage!)

    I made a few functions to round corners on simple shapes too – providing it a graphics objects instead of a Vector of co-ordinates would be a far faster workflow.

    Very excited, good to see that non-Stage3D stuff still has improvements left in it!

    Friday, November 2, 2012 at 12:13 am #
  4. Jerome wrote:

    méthode classe et MovieClip sympa ;)

    Friday, November 2, 2012 at 1:01 am #
  5. Horidream wrote:

    Very nice feature I wanted for years.

    Friday, November 2, 2012 at 5:17 am #
  6. daklab wrote:

    Very cool! Storing display objects as XML files and then reconstructing them at runtime could be very handy. Awesome potential for having a massive library of DisplayObjects that can be loaded quickly (as XML) and then created at will based on the XML definitions. Dig it!

    Friday, November 2, 2012 at 6:52 am #
  7. Antoine wrote:

    Nice feature!
    I love the idea of xml storage

    Friday, November 2, 2012 at 9:38 am #
  8. Oldes wrote:

    I’m a little bit sceptical here. I’m sure a lot of people will find it cool, but I was already able to parse SWF sturctures to get the graphics data. But without fast natice support how to deal with these on GPU it’s usage is limited. It’s not so cool to draw these data as a classic diplay list. On GPU you need to tessellate the data and draw as triangles. The tessellation is possible for example in the Starling’s graphics extension, but I reached very quickly vertex buffer limits with more complicated animations, which are still easy to run in the CPU mode:/

    Friday, November 2, 2012 at 11:17 am #
  9. SasMaster wrote:

    Nice!But when will it be available ?

    Friday, November 2, 2012 at 4:03 pm #
  10. ElliotGeno wrote:

    @oldes I think a true breakthrough won’t come from tesselating these shapes. I hope to see vector shaders replicate all the drawing commands. That would be killer!

    Saturday, November 3, 2012 at 6:02 am #
  11. Michal Czaicki wrote:

    I absolutely love it!
    Hope it will be available soon!

    Saturday, November 3, 2012 at 2:40 pm #
  12. Ohhh yeah baby! Just can`t wait for this in alivePDF

    Monday, November 5, 2012 at 11:09 am #
  13. miels wrote:

    Will this be set-/get-able in a similar way to a BitmapData from a Bitmap object?

    say myShape.graphicsData = …

    Tuesday, November 6, 2012 at 8:20 pm #
  14. ozgur wrote:

    where can I download the updated “introducing starling” book please? I see that the latest update was in the 7th of september 2012, but the oreilly download version was revised on april 2012.

    Tuesday, November 6, 2012 at 8:27 pm #
  15. Thibault Imbert wrote:

    Hi Elliot,

    For info, we just fixed the gradients this morning. They will now work nicely! ;)


    Friday, November 9, 2012 at 6:22 am #
  16. Hello Thibault !

    I’m not sure to understand exactly what I can do with this.

    Is it possible to access to the points of each path and modify their positions ?

    I’m waiting for this since Flash 5…

    Thanks !

    Friday, November 9, 2012 at 2:51 pm #
  17. will we get this for Christmas?

    Friday, November 9, 2012 at 8:22 pm #
  18. Thibault Imbert wrote:

    Hi Thomas,

    Yes, you could :)

    You can also write an SVG exporter at runtime, you could write an XML exporter to allow you to serialize/deserialize and store display objects, you could generate spritesheets at runtime and much more! :)


    Friday, November 9, 2012 at 10:06 pm #
  19. Thibault Imbert wrote:

    Hi Radu,

    Yes, I think we will have a public beta very soon ;)


    Friday, November 9, 2012 at 10:07 pm #
  20. Hi Thibault,

    One thing I’d find helpful to go along with this would be a some way of querying whether the graphics data contains elements that can not (yet!) be represented by getGraphicsData()

    In any case, I’m looking forward to experimenting with this in combination with Starling’s graphics api. :)


    Saturday, November 10, 2012 at 1:16 am #
  21. Salut Thibault
    Excuse moi d’intervenir ici pour ça , je sais que ce n’est pas le bon endroit mais j’aimerais signaler un bug récent et tout les forums adobe sont actuellement cassés.
    Rien ne presse de mon coté, je travaillais sur un expérience perso, mais je viens d’essayer de trouver une solution pendant plusieurs jours et je pense que je vais passer à autre chose ; donc si je dois signaler ce bug c’est maintenant ou jamais :)

    La fonction SoundMixer.computeSpectrum bug online, sur tout les navigateurs (IE/chrome/firefox du moins). Tout fonctionne sans problème offline.

    Je pensais que ça venait de mon code, peut être un problème stupide dans le html mais je viens de regarder plusieurs anciennes démos (utilisant stage3D + computeSpectrum) et toutes sont cassées.

    Il n’y a pas de message d’erreur, mais c’est comme si le framerate de computeSpectrum était beaucoup plus lent que le framerate de l’animation.

    J’ai fait plusieurs tests sur 3-4 PC/Mac différents et j’en suis certain : cette fonction bug

    Voila un exemple que tu as sans doute déjà vu quand il tournait bien

    La démo fonctionne toujours, mais le niveau de détail du spectre est casi nul, ce qui enlève tout l’intérêt.

    Merci d’avance !

    Wednesday, November 28, 2012 at 5:07 am #
  22. (la beta du player 11.5 corrige le problème ! Quelle réactivité ! )

    Wednesday, November 28, 2012 at 10:42 am #
  23. Vincent wrote:

    Salut Thibault, j’ai pas eu le temps de tout lire, mais je pense que cette feature est l’une des plus importantes jamais créées pour Flash,et j’ai une seule concern.

    Please Flash god, make it available on both AIR and Flash Player…

    Is it available on both AIR and Flash Player? ;-P

    - Vincent.

    Saturday, December 8, 2012 at 2:19 am #
  24. Finally!!!

    Saturday, December 8, 2012 at 7:48 pm #
  25. Jeff Ward wrote:


    Now that getGraphicsData is available on labs in Flash 11.6 / Air 3.6, any chance we can get:

    - API docs
    - Your sample code in the video

    Reading your code in the video is doable, but a little painful. =D

    Thanks for this awesome API!

    Wednesday, December 12, 2012 at 7:04 pm #
  26. Jeff Ward wrote:

    BTW, if anyone else is looking, it’s readGraphicsData(recursive:Boolean) now, and as mentioned, requires –target-player=11.6 and –swf-version=19

    Thursday, December 13, 2012 at 6:05 am #
  27. Thibault Imbert wrote:

    Hi Jeff,

    Thanks! It is all here:


    Hope it helps!


    Friday, December 14, 2012 at 12:00 pm #
  28. Hi Thibault,

    This functionality is really helpful. Thanks to you and the team for making it happen.

    However, I have to echo an earlier post’s comments that fills are not being faithfully replicated.

    I’m also seeing strange effects where a swf drawn in Flash Builder with a single path shows up as drawn with two lines when using getGraphicsData().

    Is more work being done on this method to make it more accurate?

    Thanks for your thoughts,


    Wednesday, January 9, 2013 at 1:18 am #
  29. Thibault Imbert wrote:

    Hi Daniel,

    Yes. First, the feature has been improved since I shot this video. Gradients are now supported and some other improvements got done. We are actually doing some other right now and the next beta of 11.6 should have these enhancements. Please if you have some examples and improvements you need, just send me some examples, I will be happy having a look to make it happen.

    Thanks again for the interest!


    Wednesday, January 9, 2013 at 6:15 am #

Trackbacks/Pingbacks (2)

  1. Flash Player 11.6 und Air 3.6 Beta - Flashforum on Saturday, December 8, 2012 at 12:22 am

    [...] In den ReleaseNotes finden sich einige interessante Neuerungen u.a. Multiple SWF support und Graphics Data Query. Aber auch Stage3D wird in Zukunft ausgebaut. Features wie zum Beispiel Multiple Render Targets, [...]

  2. Query Graphics Data – Live demo - ByteArray.org on Sunday, December 9, 2012 at 11:01 am

    [...] – Live demo by Thibault Imbert I wanted to post the demo of the example I posted the other day as a video. It is using the new Query Graphics API we are introducing in Flash Player 11.6/AIR 3.6. Make sure [...]