Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

swf.h

Go to the documentation of this file.
00001 #ifndef _SWF_H_
00002 #define _SWF_H_
00003 
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <string.h>
00007 #include <setjmp.h>
00008 #include <assert.h>
00009 #include <limits.h>
00010 
00011 #ifdef DUMP
00012 #include "bitstream.h"
00013 #endif
00014 
00015 #include "flash.h"
00016 
00017 extern int debug;
00018 
00019 // Global Types
00020 typedef unsigned long U32, *P_U32, **PP_U32;
00021 typedef signed long S32, *P_S32, **PP_S32;
00022 typedef unsigned short U16, *P_U16, **PP_U16;
00023 typedef signed short S16, *P_S16, **PP_S16;
00024 typedef unsigned char U8, *P_U8, **PP_U8;
00025 typedef signed char S8, *P_S8, **PP_S8;
00026 typedef signed long SFIXED, *P_SFIXED;
00027 typedef signed long SCOORD, *P_SCOORD;
00028 typedef unsigned long BOOL;
00029 
00030 #define ZOOM(v,f) ((v)/(f))
00031 
00032 #include "matrix.h"
00033 #include "cxform.h"
00034 #include "rect.h"
00035 
00036 #include <sys/time.h>
00037 #define ST struct timeval t1,t2;
00038 #define START gettimeofday(&t1,0)
00039 #define STOP(msg) gettimeofday(&t2,0); printf("%s Delta = %d ms\n", msg, (t2.tv_sec-t1.tv_sec)*1000+(t2.tv_usec-t1.tv_usec)/1000); fflush(stdout);
00040 
00041 // Start Sound Flags
00042 enum {
00043         soundHasInPoint         = 0x01,
00044         soundHasOutPoint        = 0x02,
00045         soundHasLoops           = 0x04,
00046         soundHasEnvelope        = 0x08
00047 
00048         // the upper 4 bits are reserved for synchronization flags
00049 };
00050 
00051 // Flags for Sound Format
00052 enum SounfFlags {
00053         soundIsStereo           = 0x01,
00054         soundIs16bit            = 0x02,
00055         soundIsADPCMCompressed  = 0x10
00056 };
00057 
00058 // Flags for defining Button States
00059 enum ButtonState {
00060         stateHitTest = 0x08,
00061         stateDown    = 0x04,
00062         stateOver    = 0x02,
00063         stateUp      = 0x01
00064 };
00065 
00066 // Actions
00067 enum Action {
00068                 // Internal actions
00069                 ActionRefresh           = 0x00,
00070                 ActionPlaySound         = 0x01,
00071                 // Normal actions
00072                 ActionGotoFrame         = 0x81,
00073                 ActionGetURL            = 0x83,
00074                 ActionNextFrame         = 0x04,
00075                 ActionPrevFrame         = 0x05,
00076                 ActionPlay              = 0x06,
00077                 ActionStop              = 0x07,
00078                 ActionToggleQuality     = 0x08,
00079                 ActionStopSounds        = 0x09,
00080                 ActionWaitForFrame      = 0x8a,
00081                 ActionSetTarget         = 0x8b,
00082                 ActionGoToLabel         = 0x8c
00083 };
00084 
00085 class Sound;
00086 
00087 struct ActionRecord {
00088         Action                   action;
00089 
00090         // GotoFrame  & WaitForFrame
00091         long                     frameIndex;
00092 
00093         // GetURL
00094         char                    *url;
00095         char                    *target;
00096 
00097         // GotoLabel
00098         char                    *frameLabel;
00099 
00100         // WaitForFrame
00101         long                     skipCount;
00102 
00103         // Sound
00104         Sound                   *sound;
00105 
00106         struct ActionRecord     *next;
00107         
00108         ActionRecord() {
00109                 frameLabel = 0;
00110                 url = 0;
00111                 target = 0;
00112                 sound = 0;
00113         };
00114 
00115         ~ActionRecord() {
00116                 if (frameLabel) free(frameLabel);
00117                 if (url) free(url);
00118                 if (target) free(target);
00119         };
00120 };
00121 
00122 enum FontFlags {
00123         fontUnicode   = 0x20,
00124         fontShiftJIS  = 0x10,
00125         fontANSI      = 0x08,
00126         fontItalic    = 0x04,
00127         fontBold      = 0x02,
00128         fontWideCodes = 0x01
00129 };
00130 
00131 enum TextFlags {
00132         isTextControl = 0x80,
00133 
00134         textIsLarge   = 0x70,
00135         textHasFont   = 0x08,
00136         textHasColor  = 0x04,
00137         textHasYOffset= 0x02,
00138         textHasXOffset= 0x01
00139 };
00140 
00141 #ifndef NULL
00142 #define NULL 0
00143 #endif
00144 
00145 // Tag values that represent actions or data in a Flash script.
00146 enum
00147 { 
00148     stagEnd                     = 0,
00149     stagShowFrame               = 1,
00150     stagDefineShape             = 2,
00151     stagFreeCharacter           = 3,
00152     stagPlaceObject             = 4,
00153     stagRemoveObject            = 5,
00154     stagDefineBits              = 6,
00155     stagDefineButton            = 7,
00156     stagJPEGTables              = 8,
00157     stagSetBackgroundColor      = 9,
00158     stagDefineFont              = 10,
00159     stagDefineText              = 11,
00160     stagDoAction                = 12,
00161     stagDefineFontInfo          = 13,
00162     stagDefineSound             = 14,   // Event sound tags.
00163     stagStartSound              = 15,
00164     stagStopSound               = 16,
00165     stagDefineButtonSound       = 17,
00166     stagSoundStreamHead         = 18,
00167     stagSoundStreamBlock        = 19,
00168     stagDefineBitsLossless      = 20,   // A bitmap using lossless zlib compression.
00169     stagDefineBitsJPEG2         = 21,   // A bitmap using an internal JPEG compression table.
00170     stagDefineShape2            = 22,
00171     stagDefineButtonCxform      = 23,
00172     stagProtect                 = 24,   // This file should not be importable for editing.
00173 
00174     // These are the new tags for Flash 3.
00175     stagPlaceObject2            = 26,   // The new style place w/ alpha color transform and name.
00176     stagRemoveObject2           = 28,   // A more compact remove object that omits the character tag (just depth).
00177     stagDefineShape3            = 32,   // A shape V3 includes alpha values.
00178     stagDefineText2             = 33,   // A text V2 includes alpha values.
00179     stagDefineButton2           = 34,   // A button V2 includes color transform, alpha and multiple actions
00180     stagDefineBitsJPEG3         = 35,   // A JPEG bitmap with alpha info.
00181     stagDefineBitsLossless2     = 36,   // A lossless bitmap with alpha info.
00182     stagDefineSprite            = 39,   // Define a sequence of tags that describe the behavior of a sprite.
00183     stagNameCharacter           = 40,   // Name a character definition, character id and a string, (used for buttons, bitmaps, sprites and sounds).
00184     stagFrameLabel                      = 43,   // A string label for the current frame.
00185     stagSoundStreamHead2        = 45,   // For lossless streaming sound, should not have needed this...
00186     stagDefineMorphShape        = 46,   // A morph shape definition
00187     stagDefineFont2             = 48,
00188 
00189     notEnoughData               = 0xffff,       // Special code
00190 };
00191 
00192 #ifndef false
00193 #define false 0
00194 #endif
00195 #ifndef true
00196 #define true 1
00197 #endif
00198 
00199 extern int shape_size,shape_nb,shaperecord_size,shaperecord_nb,style_size,style_nb;
00200 
00201 typedef void (*ScanLineFunc)(void *id, long y, long start, long end);
00202 
00203 class Bitmap;
00204 struct FlashMovie;
00205 
00206 extern "C" {
00207 #include "jpeglib.h"
00208 };
00209 extern "C" {
00210 //#include "zlib.h"
00211 #include "../src/3rdparty/zlib/zlib.h"
00212 };
00213 
00214 #include "graphic.h"
00215 #include "character.h"
00216 #include "bitmap.h"
00217 #include "shape.h"
00218 #include "displaylist.h"
00219 #include "sound.h"
00220 #include "button.h"
00221 #include "font.h"
00222 #include "text.h"
00223 #include "adpcm.h"
00224 #include "program.h"
00225 #include "sprite.h"
00226 #include "script.h"
00227 #include "movie.h"
00228 
00229 #endif /* _SWF_H_ */

Generated on Sat Nov 5 16:15:36 2005 for OPIE by  doxygen 1.4.2