Anyway I'm working on building some functions in C# for loading, editing, and outputing DMI files. So far I've been using Lummox JR's post on the format as a guide([link]). But I'm a bit confused and need some clarification.
4 bytes: icon ID
Starts at 2 and goes up
0 for transparent icons
I'm guessing this is a unique identifier for the icon but if so why is 0 used for transparent icons? My guess is that the transparent icons aren't stored in memory and the 0 ID is just a flag to indicate that I shouldn't bother reading for icon pixel data for this icon. But this is just a guess as it wasn't to explicit in the post. Is the 1 ID reserved for something? If I run into it in an icon file does that mean something is corrupt?
n bytes: Length of run (1 byte each)
y bytes: Color encoding
Is this a change in notation or am I missing something :P? I'm assuming Lummox JR means 1 byte is for the length of the run and n is the label he's using to refer to the value of the byte. Rather than n being the label refering to the number of bytes needed to represent this as it's explicilty stated that it is one byte anyway. Same with y for the encoding format of the current run.
x = bits per color (1 for 2-color, 2 for 3-4, 3 for 5-8...)
y = (n+k)*x/8, where 0<=k<8
(y must be an integral number of bytes holding an integral number of x-bit values)
e.g.:
x=8, n=51: y=51
x=4, n=51: y=52*4/8=26
x=3, n=51: y=56*3/8=21
x=2, n=51: y=52*2/8=13
x=1, n=51: y=56*1/8=7
I'm lost here on everything but possibly the bits per color which I'm assuming is the number of bits needed to represent a unique palette index along the run. What is k and is y related to the y bytes for color encoding or is this just a clash of labels? Could someone elaborate for me the meaning and relations of these numbers and how they relate to getting palette index for the pixel?
[Edit] Whoops I should have read the subthreads :P. It atleast covers the last block.
[Edit2] Nevermind Flicks explaination doesn't make much sense as it is not RLE and storing n wouldn't make sense as x would be the same for every pixel and thus you already know how much to extract.
You're pretty much right about the 0, I believe. I don't know why 1 isn't used, but you can safely ignore any ID besides 0 there.
Nope, you're missing something. n and y are the number of bytes for each section here. n is the number of runs, so each of those bytes in the section is the length of a run.
Likewise y, the number of bytes in the color encoding section, is calculated in the following.
These aren't labels; they're variables. y is the number of bytes needed for color encoding. k is some number of unused x-bit color values, so that x*(n+k) bits is equal to an exact number of bytes (y).
Lummox JR