http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GP] Diversifying sprite images.



===========================================================
MORTGAGE / REFINANCE RATES ARE LOW. ACT NOW!
3 Mortgage brokers compete for your business.
Great rates, no obligation, and easy form.
http://click.topica.com/caabZulbUrGczb7tEAoa/ Insurance4usa.com
===========================================================

On Wed, 2004-03-31 at 14:43, Jason Clark wrote:
> ===========================================================
> MORTGAGE / REFINANCE RATES ARE LOW. ACT NOW!
> 3 Mortgage brokers compete for your business.
> Great rates, no obligation, and easy form.
> http://click.topica.com/caabZulbUrGczbU6Xnda/ Insurance4usa.com
> ===========================================================
> 
> I was going to send this question to the SDL list but realized it was
> probably more appropriate here. I am using SDL, and building for both
> Windows and Linux.
> 
> Here's the question:
> Say I have a bitmap for my sprite of a girl in a dress in various poses. I
> would like to randomly put several of these girls into my game with various
> color dresses, but without having to make a completely new bitmap for each
> one (girl or dress). Does anyone have any suggestions, or pointers to some
> reading material?

One way to do that is to have a bit mask with a 1 bit for each pixel
that belongs to the dress and a 0 bit for pixels that are not part of
the dress. Then you can use the bit mask to tell you which pixels to
repaint and repaint the dress to any color you want on the fly. Of
course, that is only really practical if the dress is a solid color.

Another way is to build a polygon (or set of polygons) that outline the
dress for each pose and redraw the contents of the polygon to get the
new dress color. Again, that is really only practical if the dress is a
solid color.

If the part of the dress whose color you want to change is a fixed
color, or fixed range of colors, you can scan each pixel in the image
and if it is in the range of colors that belong to the dress, you can
just change it. Of course, that means you can't use dress colors
anywhere else in the image or those pixels will change too.

		Bob Pendleton

> 
> Thanks,
> Jason.
> 
> ===========================================================
> INSTANT CAR INSURANCE QUOTE!
> Save time, save money, and get the best deal.
> Get quote, buy, and print insurance cards online!
> http://click.topica.com/caabZujbUrGczbU6Xndf/ Insurance4usa.com
> ===========================================================
> 
> 
-- 
+---------------------------------------+
+ Bob Pendleton: writer and programmer. +
+ email: Bob@Pendleton.com              +
+ web:   www.GameProgrammer.com         +
+---------------------------------------+

===========================================================
INSTANT CAR INSURANCE QUOTE!
Save time, save money, and get the best deal.
Get quote, buy, and print insurance cards online!
http://click.topica.com/caabZujbUrGczb7tEAof/ Insurance4usa.com
===========================================================

--^----------------------------------------------------------------
This email was sent to: list1@swordx.com

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrGcz.b7tEAo.bGlzdDFA
Or send an email to: gameprogrammer-unsubscribe@topica.com

For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------