//Class Bitmap contains graphic objects
//Author: Tommy Grandefors
//Date: October 1996

#ifndef BITMAP_HH
 #define BITMAP_HH

#include "typedef.hh"	//Type defines such as 'unsigned char' means 'UBYTE'

class Bitmap
{
   public:
      Bitmap(void);
      ~Bitmap(void);
      Bitmap(const Bitmap& theBitmap);
      Bitmap &operator=(Bitmap& theBitmap);
      friend class Graphix;  //There is nothing wrong with a good friend!
      friend class ModeX;
      friend class VESA;                
      UWORD GetWidth(void);
      UWORD GetHeight(void);
      UWORD GetXposition(void); //The bitmap's current position in x-axis
      UWORD GetYposition(void); //The bitmap's current position in y-axis
      void SetXposition(UWORD xPosition); //Set current position in x-axis
      void SetYposition(UWORD yPosition); //Set current position in y-axis
      void ConvertBitmap(WORD mode, WORD screenWidth); //Used by other classes.
      void SetCollisionSensitivity(WORD theValue);
      WORD DetectBitmapCollision(WORD x1, WORD y1, Bitmap &theObject, WORD x2, WORD y2);
      WORD DetectAreaCollision(WORD x1,WORD y1,WORD width,WORD height,WORD x2,WORD y2);
   private:
      void ConvLin2PlanBitmap(void);
      void ConvPlan2LinBitmap(void);
      UBYTE CompileLinearBitmap(WORD width);
      UBYTE AllocRLELinearBitmap(WORD width);
      UBYTE CompilePlanarBitmap(WORD width);
      UBYTE AllocRLEPlanarBitmap(WORD width);
      UBYTE* myPicture; //Pointer to bitmap stored in memory
      UBYTE* myRLEPicture; //Pointer to a Run Length Encoded bitmap
      UDWORD myRLEPictureLength; //Holds the length of 'myRLEPicture'
      UDWORD* myIndexTable; //Holds adress indexes for RLE-bitmaps
      UDWORD myIndexTableLength; //Holds the length of 'myIndexTable'
      UWORD myWidth; //The width of the bitmap
      UWORD myHeight; //The height of the bitmap
      UWORD myCurrentXposition; //The current x-position on the screen
      UWORD myCurrentYposition; //The current y-position on the screen
      UBYTE aligned; //A flag indicating if the bitmap is aligned
      UBYTE transparent; //A flag indicating if the bitmap is transparent or not.
      UBYTE myTransparentColor; //The eventual transparent color.
      UBYTE myCurrentMode;
      UWORD collisionSensitivityX;
      UWORD collisionSensitivityY;
      DWORD myObjectID;
};

#endif
