Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Did you know about Google's high-tech image sprite? (google.com)
7 points by andrewljohnson on May 31, 2009 | hide | past | favorite | 2 comments


If you find this technique interesting, check out GWT's excellent support for automatically generating these at compile-time: just subclass ImageBundle (a simple tag interface) and use annotations to reference the PNGs you need, and the compiler will bundle them into one image like this. At runtime, when you create an Image (from an AbstractImagePrototype that the ImageBundle's methods will give you) all of the work of slicing the specific section is done for you automatically.

And the cherry on top: you can use PNG transparency and the framework will automatically insert the appropriate hack for IE6 in the version of the javascript that those users will get.

It's extremely slick.


Bonus points to anyone who can figure out what the "x" to the right of the "+-" is for.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: