Added decoder for Atari Falcon 16-bit pixel format.

This commit is contained in:
2018-03-02 12:25:20 +00:00
parent c1e7636a7e
commit f6fc1491ec

View File

@@ -131,6 +131,8 @@ namespace libexeinfo
int[] pixels = PlaneToRasterIndexed(data, width, height, planes); int[] pixels = PlaneToRasterIndexed(data, width, height, planes);
int[] palette = null; int[] palette = null;
if(planes <= 8)
{
switch(planes) switch(planes)
{ {
case 1: case 1:
@@ -153,6 +155,23 @@ namespace libexeinfo
} }
for(int i = 0; i < pixels.Length; i++) pixels[i] = palette[pixels[i]]; for(int i = 0; i < pixels.Length; i++) pixels[i] = palette[pixels[i]];
}
// This is the Falcon030 pixel format: RRRRRGGG GGGBBBBB
else if(planes == 16)
{
int[] pixels2 = new int[pixels.Length];
for(int i = 0; i < pixels.Length; i++)
{
// Red, from 5 to 8 bit
pixels2[i] = (((pixels[i] >> 11) * 0xFF) / 0x1F) << 16;
// Green, from 6 to 8 bit
pixels2[i] = ((((pixels[i] >> 5) & 0x3F) * 0xFF) / 0x3F) << 8;
// Blue, from 5 to 8 bit
pixels2[i] += ((pixels[i] & 0x1F) * 0xFF) / 0x1F;
}
pixels = pixels2;
}
return pixels; return pixels;
} }