rmx256, on Jan 18 2006, 06:28 PM, said:
I would like to hear the specifics, if you don't mind. I would figure that the format was an absolute with no room for variation betwixt the encoders?
Well, it really depends on the sprite in question. Anyway, here you go:
The RLE format, like most file and resource formats, is split into a header and a data section. The header is irrelevant for this explanation. The data is read by reading a token byte, then depending on what the token is, reading a certain number of pixels following the token and doing something with them. There are some obvious ones - pixel with this color, end of shape, end of line. However, there are two tokens which work in a special way - the fill color token and the transparency token. The fill color token is used when you have more than one adjacent pixel of the same color. Rather than storing each individual pixel color, it stores the color and how many pixels hare of that color. The transparency token works similarly, telling the decoder that the next X pixels are transparent.
EnRLE is smart enough to detect adjacent pixels that are either of the same color or both transparent. MC, on the other hand, works on an easier but less intelligent pixel-by-pixel basis, so each pixel is stored rather than using the fill color, and for each transparent pixel it writes a transparency token with a value of one. Try it - make, say, a 50x1 sprite, all the same color. Encode it with EnRLE and with MC, and you'll see a size difference.