A tool to reverse the process of sprite composition by ImageBundle and split the generated sprite back into image snippets

StackOverflow https://stackoverflow.com/questions/12940504

Domanda

Is there any tool out there (perhaps the GWT compiler itself can be used as a standalone app) for generating individual images from the *.cache.png files created during compilation?

Or, is the mapping information (for sprite geometries) available via an API?

I looked up information on the GWT repository, the documentation, here on StackOverflow, and possibly every google group on the subject, to no avail.

Motivation

My aim is to provide easy means of white-labeling a web application by instructing the GWT compiler to avoid inlining of bundled images (using <set-property name="ClientBundle.enableInlining" value="false" />), thus forcing the use of sprite images on every user agent, than building a WAR and passing it on to a graphics designer to only edit the image assets within the packed WAR (hoping to make it a little bit easier on him/she by providing such a tool).

The designer would than use the provided tool to disassemble and reassemble the sprite image, for convenient editing.

Illustration

sprite to snippets

È stato utile?

Soluzione

Hmm, that's not an easy one (really, it'd much simpler to just recompile the app after the designer has done his homework), but there's no reason you couldn't do it.

First, you can ask the GWT compiler to output the generated classes to disk (using the -gen argument). You'll find there the implementation(s) for your ClientBundle, with all the ImageResource methods returning instances of ImageResourcePrototype. IIRC, you should be able to compile those classes and use them to grab the region for each sprite, and therefore extract the individual images from the bundle, and repackage them back.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top