Jump to content

  • Log In with Google      Sign In   
  • Create Account


Pixelformat conversions


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Cthulhu   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 September 1999 - 11:58 AM

I'm currently making a graphics engine and I'd like to support various bit depths, but that makes things like alpha blending little difficult. I thought about doing everything in 32 bits per pixel and finally convert the picture before displaying it.

And it seems DirectDraw doesn't do conversions so I'll have to do it myself. Are there any good algorithms for converting 32 bit pixels to 24 and 16 bits (both 1555 and 565), splitting color values is very slow to do for 640x480=307200 pixels.

I'm using Visual c++ 6.0, assembly tips are also welcome.

------------------
"Tank, I need an exit. Fast!"


Sponsor:

#2 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 30 September 1999 - 11:58 AM

I think the best way to approach this would be to use function pointers.

Setup a system that swaps in the correct functions for the bitdepth you are working in so you don't have to have switch() statements in your code..

You'll want to change all your data from 32 bits to 24, 16 or 8 at load time. Doing it realtime will be too slow, and you'll be moving twice as much data as needed for 16 bit users.

32 to 24 is easy - just drop the least significant data by shifting. 32 to 16 is the same, but be sure you check which mode the card requires, 555 or 565 - shift appropriately. 8 bit will be a disaster, and if you really want to use it you'll either have to dither your images, or keep a seperate set of 8 bit bitmaps. Most people don't bother with 8 bit anymore. (except us slow pokes with P166's.)





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS