Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 16 bit depth bitmap memblocks... Anyone know?

Author
Message
ironhoof
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 20th Oct 2002 04:11
I cant seem to reform an image properly from 16 bit color depth bitmap memblocks are they compressed or somthing?

they are not RGB components nor are the the huse color number usually created by RGB() function..

I get an image but its usually tinted with highly intense red or green or blue.

how dose one read the bitmap memblock 16 bit into a viewable image agian? is the a fancey little decompression formulea to split the strange mystery numbers back into the rightfull color pixels agian?
-----\
There was a man on the stairs that wasn't there.
He wasn't there agian today I think he's from the CIA.
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th Oct 2002 13:26
The image bits are stored in standard 5-6-5 16-bit format.
What you have to do is bitshift as it were to get the value of each colour from the single 16-bit colour...
use this function



Effectively what happens here is that the it takes the colour and rather than doing some fancy math to find out the next colour it just shifts the Bits of the colour.
Now the bitshift function is extremely useful when dealing with data as it can quickly get inaccessable data.
I setup a Bool within the function so that both Right and Left Bitshift are within the same function, however you can simply attach these to new functions if you choose.
Also the colour function stores the colours backwards in the Array, this is simply because it is safer to read backwards - however when writing to pixel you'll need to run everything backward

Hope this helps

Anata aru kowagaru no watashi!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th Oct 2002 13:28
oh i forgot...
add /255 to the end of int(fValue)
( int(fValue)/255 )

otherwise it wont return in 256 Colour

Anata aru kowagaru no watashi!
ironhoof
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 20th Oct 2002 13:59
256 color? ^_^ isnt that 8-BIT? no wait *-BIT is 16 colors 16-bit is 256 color... um THEN what th heck am I using then O_o I mean the next one up from 256 colors.. not quiet 24-bit you know I hate to sound like a retard, but im gunna say it like this "You know that mode thats really fast! Set display mode 16,320,240 that graphics depth memblock. Unless thats what you DID mean then pardon my ignorance on that issue

-----\
There was a man on the stairs that wasn't there.
He wasn't there agian today I think he's from the CIA.
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th Oct 2002 15:50
oki i'll help explain this for you and others...

computer graphics work from the primary colours Red, Green and Blue. For this reason, any colour setup requires to be divided into these 3 colours.

24-bit can be divided into 8 this tells us that the setup is 8-8-8 ... as an 8-bit value is 0-255 (256) this is where we get the RGB(0-255,0-255,0-255) from.

hopefully this all make sense so far

now db uses 16-bit colour in memblocks, this is due to the fact that it saves alot of space!
however as you might notice 16 / 3 doesn't give you a nice number
and as you can't have float bits (as bits are delt with in binary and there is only 1 or 0) - so from this fact 2 formats of 16bit were developed.
5-5-5 and the common 5-6-5 ... now unlike 24bit which is actually in 3x Byte values 16-Bit colour is in a single word value.
So what we need to do is find out what the values for each bit section - which is where the bitshift function comes in
now there are 3 values which aren't 0-255, so what is the last step is to divide into a 255 value.

1-bit 2 colours
2-bit 4 colours
4-bit 16 colours
8-bit 256 colours
16-bit 65535 colours
24-bit 4million colours
32-bit 16million colours
hope this make everything a little more sense now

Anata aru kowagaru no watashi!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th Oct 2002 16:40
probably should explain the bitshift a little more...
an 8-bit colour value is a simple 8 string binary value
e.g. 01101101 - now each of the 1/0 represent a single bit.
now say we have a 16-bit value 0110110110101001. If we bitshift this into RGB then we'll divide the groups like this 01101 - 101101 - 01001 now each of these groups represent a colour.
Now technically in DB we don't work within Binary (would be interesting if we did) so what we do is find out the value for each bit, as each is either 1/0 that means we already know the there are 2 possible values per bit.
Now we muliply to the power of this to gain the numerical value in DB so 2^8 = 256 8-bit colour

so if we have a 24-bit value of lets say 2147418112
you want to find the RGB of this simply
Bitshift the values to the right using the function.
I did this wrong earlier (and sorry)

i'm gonna work on a demo right now to show and example of this.

Anata aru kowagaru no watashi!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 21st Oct 2002 00:48
hahaa... i really should learn to finish my train of thought before pressing post

the math above isn't right (sorry only just noticed as i'm finally fully awake again ... and bored on this damn'd flight) - still working on the demo, really is something to go damn'd indepth

the right math should be ->



oki now i'm almost certain that works
if someone could try it out on several picture though it would help - as i forgot the math

Anata aru kowagaru no watashi!
ironhoof
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location:
Posted: 21st Oct 2002 08:56
Makes perfect sense my only problem with the WHOLE entire thing was i didnt know what bit was what ^_^ after a while it just slipped my mind between 8-16 bit Sadly i used to know that YES your math has changed several times O_O training your thought would be good! :just kdding:
Yea I figured it out as my icon decoder in the windowing gui i made uses a adaquate formula for it.

-----\
There was a man on the stairs that wasn't there.
He wasn't there agian today I think he's from the CIA.
Viktor
21
Years of Service
User Offline
Joined: 7th Oct 2002
Location: Austria
Posted: 26th Oct 2002 00:48
Correction to Raven Vegeta sama:
16 Bit=65536 colors
24 Bit=16.777.216 colors
32 Bit=16.777.216 colors with Alpha channel
Where did you find the information that 24 Bit is 4 Million and 32 Bit is 16 Million colors?

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 26th Oct 2002 03:25
its pure calculations,
both 24bit and 32bit however can have alpha channels!
however i've also being doing art for a very long time and its known fact to how many can be displayed.
All depends on the compression techniques and bit sampling.

I mean 16-bit is 32,000 or 65,536
just as 24-bit is 4Million however is taken down when used with an alpha channel as 1bit per colour is used for the alpha
same goes for 32-bit ... the standard calculations setup the colours that can be defined.

Anata aru kowagaru no watashi!

Login to post a reply

Server time is: 2024-04-24 06:47:09
Your offset time is: 2024-04-24 06:47:09