My favorites | Sign in
Project Home Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 53: Optimize sprite positions
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


 
Reported by ascal...@gmail.com, Sep 16, 2009
I've noticed that a lot of times spriting the images, while reducing the 
number of round trips (which is great), will create a file that's 
ultimately larger (in bytes) than the original images. This behavior could 
be reduced by optimizing the way the sprite image is constructed to take 
advantage of empty space.

For example, when you have one image to be sprited that's 100x20px and 5 
that are 15x20px you could create a sprite image that has the 5 smaller 
images directly beneath the larger file. Instead of this:
___________
|xxxxxxxxx|
|x        |
|x        |
|x        |
|x        |
|x        |
___________

You could have this:
___________
|xxxxxxxxx|
|x x x x x|
___________

I know that this logic is much more difficult, but would result in much 
smaller file sizes because of a reduction in wasted space.
Sep 21, 2009
Project Member #1 stevesou...@gmail.com
I don't think this affects file size very much. It might affect memory size.
Sep 21, 2009
Project Member #2 sunny.dr...@gmail.com
Steve, anyway it will be very useful. And algorithm can be quite simple: just sort 
images by x*x+y*y, then try to add to the Sprite one-by-one, checking for 'filled' 
pixels.
Oct 14, 2010
#3 bay...@gmail.com
It turns out that the memory implications here are pretty significant, as Steve mentions here: http://www.stevesouders.com/blog/2009/09/21/spriteme-part-3/ 

Powered by Google Project Hosting