saveFinalCompressedSize(out);
}
private void save(DataOutput out, Paletted8Image image) throws IOException
{
Palette palette = image.getPalette();
boolean system256Palette = isPalmSystemPalette256(palette);
boolean system16GrayPalette = isPalmSystemPaletteGray16(palette);
boolean system16ColorPalette = isPalmSystemPaletteColor16(palette);
boolean system4GrayPalette = isPalmSystemPaletteGray4(palette);
boolean customPalette = !(system256Palette || system16GrayPalette || system16ColorPalette || system4GrayPalette);
if (customPalette)
{
flags |= FLAG_COLOR_TABLE;
}
// determine bits per pixel, bytesPerRow
if (palette.getNumEntries() <= 4)
{
bitsPerPixel = 2;
bytesPerRow = (width + 3) / 4;
}
else
if (palette.getNumEntries() <= 16)
{
bitsPerPixel = 4;
bytesPerRow = (width + 1) / 2;
}
else