Connect
[Amiga Image Question]

I am used to working with pixels from a 32-bit integer representing RGBA or ARGB colors where each of the alpha, red, green and blue get a byte’s worth of color representation.

Can anybody recommend a reference to learn the differences between this modern approach and how it works for planar pixel data? As well as discerning how to read and set colors for this setup?
Jon-lennart Aasenden: Planar is a bit of a bitch, because you have to set bits in multiple places. So if you have 32 colors, 5 bitplanes, that means writing the color bits to the same spot on different planes. This is ultimately what killed the Amiga for 3d, because normal 8bit "index" based chunky modes only required 1 write to be set. While the amiga had to do 5-8 times the work for the same result (!). It worked great with video hardware though, but sucked for more demanding games. Ill see if i can find some examples for you over xmas, i have a ton of code. You can probably find some simple stuff on aminet too. The copper is really the key for color management
Brielle Harrison: Not that I want to work in this mode much but I do feel a need to understand it and do some basic things with it. Are we writing pen colors in each bit plane array? And if so, what does it mean to write pen 3 in bit plane 2 and color 7 in bit plane 3 in the same pixel location? Do colors blend? How does one know the actual color of the location programmatically?
Jon-lennart Aasenden: You write the palette index, but the bits must be written spread over the planes. Each plane has just 1 bit per pixel. So yeah, fiddly as hell. But isolating it in a procedure like setpixel(int8 coloridx) is what you end up with. This is why blitzbasic etc is easier, you dont have to roll your own in assembler. But yeah, understanding it is important, especially for demo/game coding. Blitter does plane offsets etc automatically
Jon-lennart Aasenden: Same for reading, you have to read the bits back, AND them intoa byte at the plane-index number. The final result is the olor index. So this is binary 101
Brielle Harrison: So does that mean bitplane one is the ones place, bitplane two the twos place, bitplane three the fours place and bitplane four the eights place and that using binary math in that way we must add up to the color index we want for that pixel?
Jon-lennart Aasenden: Yep. %00001 is index 1, so each bit must me mapped to the corresponding bit-plane.
nightshft: Yes correct. Look here http://amigademomaking.dk-games.com/step20-bitplanes-are-evil I guess they went for this system because you'd save memory when using less than 8 bits for color. But as already mentioned you'd loose a lot of time for conversion and bit-setting in some graphic engines. This is what's called "chunky to planar" conversion and it's a science in itself. It's also the reason why 3d engines in general (and "doom" as a reference in particular) cost more cpu on the miggy than on early dos pc's.
Brielle Harrison: The demo making page is awesome. All these links really help not only myself but others as well.