

typedef struct CXFORM {
  int rmul, gmul, bmul, amul;
  int radd, gadd, badd, aadd;
} CXFORM;

typedef struct RECT {
  S32 minx, miny, maxx, maxy;
} RECT;


typedef struct MATRIX {
  S32 scalex, scaley, rotate0, rotate1;
  S32 tx, ty;
} MATRIX;


typedef struct GRADIENT {
  int a;
} GRADIENT;


// start Sound Flags
enum {
  soundHasInPoint       = 0x01,
  soundHasOutPoint      = 0x02,
  soundHasLoops	        = 0x04,
  soundHasEnvelope      = 0x08
};


enum {
  fillGradient          = 0x10,
  fillLinearGradient    = 0x10,
  fillRadialGradient    = 0x12,
  fillMaxGradientColors = 8,
  fillBits              = 0x40
  	// if this bit is set, must be a bitmap pattern
};


enum {
  eflagsMoveTo          = 0x01,
  eflagsFill0           = 0x02,
  eflagsFill1           = 0x04,
  eflagsLine            = 0x08,
  eflagsNewStyles       = 0x10,
  eflagsEnd             = 0x80  // a state change with no change marks the end
};

// Tag values that represent actions or data in a Flash script.
enum {
  stagEnd                       = 0,
  stagShowFrame                 = 1,
  stagDefineShape               = 2,
  stagFreeCharacter             = 3,
  stagPlaceObject               = 4,
  stagRemoveObject              = 5,
  stagDefineBits                = 6,
  stagDefineButton              = 7,
  stagJPEGTables                = 8,
  stagSetBackgroundColor        = 9,
  stagDefineFont                = 10,
  stagDefineText                = 11,
  stagDoAction                  = 12,
  stagDefineFontInfo            = 13,
  stagDefineSound               = 14,	// Event sound tags
  stagStartSound                = 15,
  stagDefineButtonSound         = 17,
  stagSoundStreamHead           = 18,
  stagSoundStreamBlock          = 19,
  stagDefineBitsLossless        = 20, // A bitmap using lossless zlib compression
  stagDefineBitsJPEG2           = 21, // A bitmap using an internal JPEG compression table
  stagDefineShape2              = 22,
  stagDefineButtonCxform        = 23,
  stagProtect                   = 24, // This file should not be importable for editing

  // These are the new tags for Flash 3.
  stagPlaceObject2              = 26, // The new style place w/ alpha color transform
  stagRemoveObject2             = 28,
  stagDefineShape3              = 32,
  stagDefineText2               = 33,
  stagDefineButton2             = 34,
  stagDefineBitsJPEG3           = 35, // A JPEG bitmap with alpha info
  stagDefineBitsLossless2       = 36, // A lossless bitmap with alpha info
  stagDefineSprite              = 39,
  stagNameCharacter             = 40,
  stagFrameLabel                = 43, // A string label for the current frame.
  stagSoundStreamHead2          = 45, // For lossless streaming sound
  stagDefineMorphShape          = 46, // A morph shape definition
  stagDefineFont2               = 48
};


// PlaceObject2 Flags
enum {
  splaceMove            = 0x01,
  splaceCharacter       = 0x02,
  splaceMatrix          = 0x04,
  splaceColorTransform  = 0x08,
  splaceRatio           = 0x10,
  splaceName            = 0x20,
  splaceDefineClip      = 0x40
};


// action codes
enum {
  sactionHasLength      = 0x80,
  sactionNone           = 0x00,
  sactionGotoFrame      = 0x81,	// frame num (WORD)
  sactionGetURL         = 0x83,	// url (STR), window (STR)
  sactionNextFrame      = 0x04,
  sactionPrevFrame      = 0x05,
  sactionPlay           = 0x06,
  sactionStop           = 0x07,
  sactionToggleQuality  = 0x08,
  sactionStopSounds     = 0x09,
  sactionWaitForFrame   = 0x8A,	// frame needed (WORD), actions to skip (BYTE)
  sactionSetTarget      = 0x8B,	// name (STR)
  sactionGotoLabel      = 0x8C	// name (STR)
};


#define TAG_BODY              1
#define SAVE_JPEGS            2

int flash_read_object(int info);
int flash_read_header(void);
