color depth

Blitz3D Forums/Blitz3D Programming/color depth

Amanda Dearheart(Posted 2012) [#1]
First of all, let me tell you my understanding of computer memory so we can all be on the same page.
The amallest part of computer memory is a bit, which can only hold the units 0 and 1. Next up is the byte, which is an arrangement of 8 bits, and therefore can hold values from 0 to 255. I don;t know what two bytes are (word) or what a 32 data arrangement is (perhaps this is the word that I read about so often or is 32 a DWORD, short for Double WORD)
In C++, we can talk about short Int's and Long Int's, but those conversations are beyond the scope ot this topic.

Back on track. The Blitz docs state that the Graphics and Graphics3D commands can set color depth to 16, 24, and 32 depths (the numbers I assume are bit levels) which means that the higher bit levels have MORE colors than the lower bit levels.

Fine and dandy.

Now here is where the problem occurs (if there is one)

The color command only have fields for three colors (Red, Green, and Blue) If each field is a byte, then that is only 24, which means thet while you can address the 32 bit color depth by the graphics command, how would you acheive those extra colors if the color command can only access colors in the 24 bit area.

It would seem to me that you would need an extra field for this varaible to address those commands. Popular painting programs (such as Adobe PhotoShop or Paint Shop Pro) use this fourth command field either for the intensity level of the color or transperacy efftects.

My simple question is how does Blit3d handle the levels of color depth. (Yeah, I know that a programmer can use the graphics command to set the depth, but where does it go from there)


GfK(Posted 2012) [#2]
24 of the bits are for red, green and blue (8 each) - the others are for the level of alpha transparency. Colour-wise there is no difference between 24 and 32 bit. As for 16-bit, you have fewer colours and it's always best demonstrated with a gradient. In 32-bit you have a smooth transition. In 16-bit you have bands of colour with a dithered transition (which basically, looks like crap).

Never really heard of anybody wanting to use a 24-bit graphics mode, you want 32 these days.


Amanda Dearheart(Posted 2012) [#3]
Color-wise, there is no differnce between 24 and 32 bit
Aha, almost what I thought.

So GFk, how would a person go about achieving alpha transpercy effects.

Last edited 2012

Last edited 2012


K(Posted 2012) [#4]
Err.. you don't
Try this
Graphics 640,480,32
Rect 10,10,100,100,1
For k=1To 10
For t=1To 10
WritePixel 40+k,40+t,$FF000000
Next:Next
WaitKey()
End

Now try changing the 'FF' component of the Hex and note the black square is always black. This is the alpha component, but is not used for drawing to the screen, only for textures.

Last edited 2012