Package _api.alienfactory.javamappy

Examples of _api.alienfactory.javamappy.MapHeader


   **/
  public JDK11Renderer(Map map) throws IllegalArgumentException {
    super(map);
   
    PixelData imageData[]  = map.getImageData();
    MapHeader mapHeader   = map.getMapHeader();
    Colour[]  colours     = map.getColours();

    super.opaqueImages    = new Image[imageData.length];
    super.transparentImages  = new Image[imageData.length];
   
    int[] intImageData;
    PixelData pixelData;

    // index colour models are only valid for Colour Map images
    boolean usesColourMap = (mapHeader.getColourDepth() == 8);
    IndexColorModel icmSolid = null, icmTrans = null;
    if (usesColourMap) {
        LOG.debug("Using IndexColourModels");
      icmSolid = new IndexColorModel(8, colours.length, toByteArray(colours), 0, false);   
      icmTrans = new IndexColorModel(8, colours.length, toByteArray(colours), 0, false, mapHeader.getChromeKeyIndex());
    }
   
    for (int i=0; i < imageData.length; i++) {
      pixelData    = imageData[i];
     
View Full Code Here


    log.debug("Block Stagger Y = [" + blockStaggerY + "]");
    log.debug("Click Mask      = [" + clickMask + "]");
    log.debug("Pillars         = [" + pillars + "]");
   
    // copy the values into a MapHeader object
    MapHeader mapHeader     = map.getMapHeader();
    mapHeader.setMapVersionMajor(mapVersionMajor);
    mapHeader.setMapVersionMinor(mapVersionMinor);
    mapHeader.setLsb      (lsb);
    mapHeader.setMapType    (mapType);
    mapHeader.setMapBlockWidth    (mapWidth);
    mapHeader.setMapBlockHeight    (mapHeight);
    mapHeader.setBlockWidth    (blockWidth);
    mapHeader.setBlockHeight  (blockHeight);
    mapHeader.setColourDepth  (colourDepth);
    mapHeader.setBlockSize    (blockSize);
    mapHeader.setNoOfBlocks    (noOfBlocks);
    mapHeader.setNoOfImages    (noOfImages);
    mapHeader.setChromeKeyIndex  (cKey8Bit);
    mapHeader.setChromeKey    (new Colour(cKeyRed, cKeyGreen, cKeyBlue));
    mapHeader.setBlockGapX    (blockGapX);
    mapHeader.setBlockGapY    (blockGapY);
    mapHeader.setBlockStaggerX  (blockStaggerX)
    mapHeader.setBlockStaggerY  (blockStaggerY);
    mapHeader.setClickMask    (clickMask);
    mapHeader.setRisingPillarMode(pillars > 0);   
  }
View Full Code Here

  //__________________________________________________________________________
  //--------------------------------------------------------------------------

  // JavaDoc inherited from ChunkLoader
  public void loadChunk(Map map) throws ChunkLoadException {
    MapHeader   mapHeader     = map.getMapHeader();
    Block[]    blocks       = new Block[mapHeader.getNoOfBlocks()];
    int      imageByteSize  = 1;
    int     bits;
    int      textStringUdi  = mapHeader.getTextStringUserDataIndex();
    String[]  textStrings    = map.getTextStrings();
    int      textStringIndex;

    if (mapHeader.getMapType() == 0)
      imageByteSize = mapHeader.getBlockWidth() * mapHeader.getBlockHeight() * ((mapHeader.getColourDepth() + 1) / 8)// the "+1" caters for a colour depth of 15

    log.info("Reading [" + mapHeader.getNoOfBlocks() + "] block properties...");
    for (int i = 0; i < mapHeader.getNoOfBlocks(); i++) {
      Block block = new Block();

      block.setImageIndex(Block.BACKGROUND,  super.readInt() / imageByteSize);
      block.setImageIndex(Block.FOREGROUND1, super.readInt() / imageByteSize);
      block.setImageIndex(Block.FOREGROUND2, super.readInt() / imageByteSize);
View Full Code Here

  // Public Methods
  //__________________________________________________________________________
  //--------------------------------------------------------------------------
 
  public void loadChunk(Map map) throws ChunkLoadException {
    MapHeader   mapHeader   = map.getMapHeader();

    int bytesToStart     = super.readInt();
    int noOfStrings      = super.readInt();
    int userDataIndex    = super.readInt();
    String[] textStrings  = new String[noOfStrings];
   
    // consume extra data
    bytesToStart -= (3 * 4);
    super.skip(bytesToStart);

    // read the strings
    if (Logger.isLoggingEnabled())
      log.info("Reading [" + noOfStrings + "] Text Strings...");
   
    for (int i = 0; i< noOfStrings; i++) {
      textStrings[i] = super.readString();
      log.debug("TextString [" + i + "] :: " + textStrings[i]);
    }

    // save our data for others
    mapHeader.setTextStringUserDataIndex(userDataIndex);
    map.setTextStrings(textStrings);
   
    // there might be the odd byte left over to keep the addressing even
    super.skip(super.getBytesRemaining());
  }
View Full Code Here

  // 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++) {
View Full Code Here

  // Public Methods
  //__________________________________________________________________________
  //--------------------------------------------------------------------------

  public void loadChunk(Map map) throws ChunkLoadException {
    MapHeader mapHeader = map.getMapHeader();

    short  mapLayer[][] = new short[mapHeader.getMapBlockHeight()][mapHeader.getMapBlockWidth()];

    for (int y=0; y < mapHeader.getMapBlockHeight(); y++) {
      for (int x=0; x < mapHeader.getMapBlockWidth(); x++) {
       
        int data = super.readShort();

        // does the RLE not wrap around rows?
        if (mapHeader.getMapType() == 2) {  //map is RLE compressed
          int rleCount = data;
          if (rleCount >= 32768) rleCount -= 65536;
         
          if (rleCount > 0) {
            while (rleCount > 0) {
              data = super.readShort();
              mapLayer[y][x] = (short) data;
              x++; rleCount--;
            }
          } else {
            data = super.readShort();
            short rleval = (short) data;
            while (rleCount < 0) {
              mapLayer[y][x] = rleval;
              x++; rleCount++;
            }
          }
          x--; //correct for RLE
        } else {
          mapLayer[y][x] = (short) data;

          if (mapLayer[y][x] >= 0) {
            if (mapHeader.getMapType() == 0) mapLayer[y][x] /= mapHeader.getBlockSize();
          } else {
            if (mapHeader.getMapType() == 0) mapLayer[y][x] /= 16;
          }
        }       
      }
    }
View Full Code Here

TOP

Related Classes of _api.alienfactory.javamappy.MapHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.