// Public Methods
//__________________________________________________________________________
//--------------------------------------------------------------------------
public void loadChunk(Map map) throws ChunkLoadException {
MapHeader mapHeader = map.getMapHeader();
Colour[] colours = map.getColours();
int colourDepth = mapHeader.getColourDepth();
PixelData imageData[] = new PixelData[mapHeader.getNoOfImages()];
int intAlpha=0 , intRed=0, intGreen=0, intBlue=0, colourIndex;
// cache some map header values
int blockHeight = mapHeader.getBlockHeight();
int blockWidth = mapHeader.getBlockWidth();
// grab the transparent colour
Colour chromeKey = null;
if (mapHeader.getColourDepth() == 8) {
colourIndex = mapHeader.getChromeKeyIndex();
chromeKey = colours[colourIndex];
} else {
chromeKey = mapHeader.getChromeKey();
}
int transparent = chromeKey.toInt();
PixelData pixelData;
log.info("Reading [" + mapHeader.getNoOfImages() + "] images...");
for (int i=0; i < mapHeader.getNoOfImages(); i++) {
int[] intImage = new int [mapHeader.getBlockWidth() * mapHeader.getBlockHeight()];
byte[] bytImage = new byte[mapHeader.getBlockWidth() * mapHeader.getBlockHeight()];
int index = 0;
boolean hasTransparentPixels = false;
for (int y=0 ; y<blockHeight; y++) {
for (int x=0 ; x<blockWidth; x++) {