/* Ming, an SWF output library Copyright (C) 2001 Opaque Industries - http://www.opaque.net/ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef WINMING_H_INCLUDED #define WINMING_H_INCLUDED #include #define BUILD_WINMING_AS_DLL #ifdef BUILD_WINMING_AS_DLL #ifndef WM_DLL_A #ifdef __cplusplus #define WM_DLL_A extern "C" __declspec (dllexport) #else #define WM_DLL_A __declspec (dllexport) #endif #endif #ifndef WM_DLL_B #define WM_DLL_B __stdcall #endif #else #ifndef WM_DLL_A #define WM_DLL_A #endif #ifndef WM_DLL_B #define WM_DLL_B #endif #endif #define MING_VERSION 0.2a #define MING_VERSION_TEXT "0.2a" WM_DLL_A int WM_DLL_B Ming_init(); /* sets the threshold error for drawing cubic beziers. Lower is more accurate, hence larger file size. */ WM_DLL_A void WM_DLL_B Ming_setCubicThreshold(int num); /* sets the overall scale, default is 20 */ WM_DLL_A void WM_DLL_B Ming_setScale(float scale); float Ming_getScale(); /* set the version number to use */ WM_DLL_A void WM_DLL_B Ming_useSWFVersion(int version); /* change the error/warn behavior. Default prints message and exits. */ WM_DLL_A void WM_DLL_B Ming_setWarnFunction(void (*warn)(char *msg, ...)); WM_DLL_A void WM_DLL_B Ming_setErrorFunction(void (*error)(char *msg, ...)); typedef unsigned char byte; /* a generic output method. specific instances dump output to file, send to stdout, etc. */ typedef void (*SWFByteOutputMethod)(byte b, void *data); WM_DLL_A void WM_DLL_B fileOutputMethod(byte b, void *data); /* we dig opaque types */ typedef void *SWFBlock, *SWFMatrix; /* SWFInput */ typedef void *SWFInput; WM_DLL_A int WM_DLL_B SWFInput_length(SWFInput input); WM_DLL_A void WM_DLL_B SWFInput_rewind(SWFInput input); WM_DLL_A int WM_DLL_B SWFInput_tell(SWFInput input); WM_DLL_A void WM_DLL_B SWFInput_seek(SWFInput input, long offset, int whence); WM_DLL_A int WM_DLL_B SWFInput_eof(SWFInput input); WM_DLL_A SWFInput WM_DLL_B newSWFInput_file(FILE *f); WM_DLL_A SWFInput WM_DLL_B newSWFInput_stream(FILE *f); WM_DLL_A SWFInput WM_DLL_B newSWFInput_buffer(unsigned char *buffer, int length); WM_DLL_A SWFInput WM_DLL_B newSWFInput_allocedBuffer(unsigned char *buffer, int length); WM_DLL_A void WM_DLL_B destroySWFInput(SWFInput input); /* SWFCharacter */ /* everything with a character ID is an SWFCharacter */ typedef void *SWFCharacter; float SWFCharacter_getWidth(SWFCharacter character); float SWFCharacter_getHeight(SWFCharacter character); /* SWFBitmap */ typedef void *SWFBitmap; WM_DLL_A void WM_DLL_B destroySWFBitmap(SWFBitmap b); WM_DLL_A int WM_DLL_B SWFBitmap_getWidth(SWFBitmap b); WM_DLL_A int WM_DLL_B SWFBitmap_getHeight(SWFBitmap b); WM_DLL_A SWFBitmap WM_DLL_B newSWFBitmap_fromInput(SWFInput input); /* SWFDBLBitmap extends SWFBitmap */ typedef void *SWFDBLBitmap; SWFDBLBitmap newSWFDBLBitmap(FILE *f); SWFDBLBitmap newSWFDBLBitmap_fromInput(SWFInput input); /* SWFJpegBitmap extends SWFBitmap */ typedef void *SWFJpegBitmap, *SWFJpegWithAlpha; SWFJpegBitmap newSWFJpegBitmap(FILE *f); SWFJpegBitmap newSWFJpegBitmap_fromInput(SWFInput input); SWFJpegWithAlpha newSWFJpegWithAlpha(FILE *f, FILE *alpha); SWFJpegWithAlpha newSWFJpegWithAlpha_fromInput(SWFInput input, SWFInput alpha); /* SWFGradient */ typedef void *SWFGradient; SWFGradient newSWFGradient(); WM_DLL_A void WM_DLL_B destroySWFGradient(SWFGradient gradient); WM_DLL_A void WM_DLL_B SWFGradient_addEntry(SWFGradient gradient, float ratio, byte r, byte g, byte b, byte a); /* SWFFillStyle */ typedef void *SWFFillStyle; #define SWFFILL_SOLID 0x00 #define SWFFILL_GRADIENT 0x10 #define SWFFILL_LINEAR_GRADIENT 0x10 #define SWFFILL_RADIAL_GRADIENT 0x12 #define SWFFILL_BITMAP 0x40 #define SWFFILL_TILED_BITMAP 0x40 #define SWFFILL_CLIPPED_BITMAP 0x41 WM_DLL_A SWFFillStyle WM_DLL_B newSWFSolidFillStyle(byte r, byte g, byte b, byte a); WM_DLL_A SWFFillStyle WM_DLL_B newSWFGradientFillStyle(SWFGradient gradient, byte radial); WM_DLL_A SWFFillStyle WM_DLL_B newSWFBitmapFillStyle(SWFCharacter bitmap, byte flags); WM_DLL_A SWFMatrix WM_DLL_B SWFFillStyle_getMatrix(SWFFillStyle fill); /* SWFLineStyle */ typedef void *SWFLineStyle; WM_DLL_A SWFLineStyle WM_DLL_B newSWFLineStyle(int width, int r, int g, int b, int a); /* SWFShape */ typedef void *SWFShape; WM_DLL_A SWFShape WM_DLL_B newSWFShape(); WM_DLL_A void WM_DLL_B destroySWFShape(SWFBlock block); WM_DLL_A void WM_DLL_B SWFShape_movePenTo(SWFShape shape, float x, float y); WM_DLL_A void WM_DLL_B SWFShape_movePen(SWFShape shape, float x, float y); WM_DLL_A float WM_DLL_B SWFShape_getPenX(SWFShape shape); WM_DLL_A float WM_DLL_B SWFShape_getPenY(SWFShape shape); WM_DLL_A void WM_DLL_B SWFShape_drawLineTo(SWFShape shape, float x, float y); WM_DLL_A void WM_DLL_B SWFShape_drawLine(SWFShape shape, float dx, float dy); WM_DLL_A void WM_DLL_B SWFShape_drawCurveTo(SWFShape shape, float controlx, float controly, float anchorx, float anchory); WM_DLL_A void WM_DLL_B SWFShape_drawCurve(SWFShape shape, float controldx, float controldy, float anchordx, float anchordy); WM_DLL_A void WM_DLL_B SWFShape_end(SWFShape shape); WM_DLL_A int WM_DLL_B SWFShape_setLineStyle(SWFShape shape, unsigned short width, byte r, byte g, byte b, byte a); WM_DLL_A SWFFillStyle WM_DLL_B SWFShape_addSolidFillStyle(SWFShape shape, byte r, byte g, byte b, byte a); WM_DLL_A SWFFillStyle WM_DLL_B SWFShape_addGradientFillStyle(SWFShape shape, SWFGradient gradient, byte flags); WM_DLL_A SWFFillStyle WM_DLL_B SWFShape_addBitmapFillStyle(SWFShape shape, SWFBitmap bitmap, byte flags); WM_DLL_A void WM_DLL_B SWFShape_setLeftFillStyle(SWFShape shape, SWFFillStyle fill); WM_DLL_A void WM_DLL_B SWFShape_setRightFillStyle(SWFShape shape, SWFFillStyle fill); /* SWFMorph */ typedef void *SWFMorph; WM_DLL_A SWFMorph WM_DLL_B newSWFMorphShape(); WM_DLL_A void WM_DLL_B destroySWFMorph(SWFBlock block); WM_DLL_A SWFShape WM_DLL_B SWFMorph_getShape1(SWFMorph morph); WM_DLL_A SWFShape WM_DLL_B SWFMorph_getShape2(SWFMorph morph); /* SWFFont */ typedef void *SWFFont; WM_DLL_A SWFFont WM_DLL_B newSWFFont(); WM_DLL_A SWFFont WM_DLL_B loadSWFFontFromFile(FILE *file); WM_DLL_A void WM_DLL_B destroySWFFont(SWFBlock block); float SWFFont_getStringWidth(SWFFont font, const char *string); /* XXX */ #define SWFFont_getWidth SWFFont_getStringWidth WM_DLL_A float WM_DLL_B SWFFont_getAscent(SWFFont font); WM_DLL_A float WM_DLL_B SWFFont_getDescent(SWFFont font); WM_DLL_A float WM_DLL_B SWFFont_getLeading(SWFFont font); /* SWFText */ typedef void *SWFText; WM_DLL_A SWFText WM_DLL_B newSWFText(); WM_DLL_A SWFText WM_DLL_B newSWFText2(); WM_DLL_A void WM_DLL_B destroySWFText(SWFBlock block); WM_DLL_A void WM_DLL_B SWFText_setFont(SWFText text, SWFFont font); WM_DLL_A void WM_DLL_B SWFText_setHeight(SWFText text, float height); WM_DLL_A void WM_DLL_B SWFText_moveTo(SWFText text, float x, float y); WM_DLL_A void WM_DLL_B SWFText_setColor(SWFText text, byte r, byte g, byte b, byte a); WM_DLL_A void WM_DLL_B SWFText_addString(SWFText text, const char *string, int *advance); WM_DLL_A void WM_DLL_B SWFText_setSpacing(SWFText text, float spacing); WM_DLL_A float WM_DLL_B SWFText_getStringWidth(SWFText text, const char *string); /* XXX */ #define SWFText_getWidth SWFText_getStringWidth WM_DLL_A float WM_DLL_B SWFText_getAscent(SWFText text); WM_DLL_A float WM_DLL_B SWFText_getDescent(SWFText text); WM_DLL_A float WM_DLL_B SWFText_getLeading(SWFText text); /* deprecated: */ #define SWFText_setXY(t,x,y) SWFText_moveTo((t),(x),(y)) /* SWFBrowserFont */ typedef void *SWFBrowserFont; WM_DLL_A SWFBrowserFont WM_DLL_B newSWFBrowserFont(char *name); WM_DLL_A void WM_DLL_B destroySWFBrowserFont(SWFBlock block); /* SWFTextField */ typedef void *SWFTextField; #define SWFTEXTFIELD_ONMASK 0x2085 /* on bits */ #define SWFTEXTFIELD_OFFMASK 0x38FF /* off bits */ #define SWFTEXTFIELD_HASLENGTH (1<<1) #define SWFTEXTFIELD_NOEDIT (1<<3) #define SWFTEXTFIELD_PASSWORD (1<<4) #define SWFTEXTFIELD_MULTILINE (1<<5) #define SWFTEXTFIELD_WORDWRAP (1<<6) #define SWFTEXTFIELD_DRAWBOX (1<<11) #define SWFTEXTFIELD_NOSELECT (1<<12) #define SWFTEXTFIELD_HTML (1<<9) /* 0x0200 */ typedef enum { SWFTEXTFIELD_ALIGN_LEFT = 0, SWFTEXTFIELD_ALIGN_RIGHT = 1, SWFTEXTFIELD_ALIGN_CENTER = 2, SWFTEXTFIELD_ALIGN_JUSTIFY = 3 } SWFTextFieldAlignment; SWFTextField newSWFTextField(); WM_DLL_A void WM_DLL_B destroySWFTextField(SWFBlock block); WM_DLL_A void WM_DLL_B SWFTextField_setFont(SWFTextField field, SWFBlock font); WM_DLL_A void WM_DLL_B SWFTextField_setBounds(SWFTextField field, float width, float height); WM_DLL_A void WM_DLL_B SWFTextField_setFlags(SWFTextField field, int flags); WM_DLL_A void WM_DLL_B SWFTextField_setColor(SWFTextField field, byte r, byte g, byte b, byte a); WM_DLL_A void WM_DLL_B SWFTextField_setVariableName(SWFTextField field, char *name); WM_DLL_A void WM_DLL_B SWFTextField_addString(SWFTextField field, char *string); WM_DLL_A void WM_DLL_B SWFTextField_setHeight(SWFTextField field, float height); WM_DLL_A void WM_DLL_B SWFTextField_setFieldHeight(SWFTextField field, float height); WM_DLL_A void WM_DLL_B SWFTextField_setLeftMargin(SWFTextField field, float leftMargin); WM_DLL_A void WM_DLL_B SWFTextField_setRightMargin(SWFTextField field, float rightMargin); WM_DLL_A void WM_DLL_B SWFTextField_setIndentation(SWFTextField field, float indentation); WM_DLL_A void WM_DLL_B SWFTextField_setLineSpacing(SWFTextField field, float lineSpacing); WM_DLL_A void WM_DLL_B SWFTextField_setAlignment(SWFTextField field, SWFTextFieldAlignment alignment); WM_DLL_A void WM_DLL_B SWFTextField_setLength(SWFTextField field, int length); /* sound - only mp3 streaming implemented */ typedef void *SWFSound; WM_DLL_A SWFSound WM_DLL_B newSWFSound(FILE *file); WM_DLL_A SWFSound WM_DLL_B newSWFSound_fromInput(SWFInput input); WM_DLL_A void WM_DLL_B destroySWFSound(SWFSound sound); /* SWFCXform */ typedef void *SWFCXform; WM_DLL_A SWFCXform WM_DLL_B newSWFCXform(int rAdd, int gAdd, int bAdd, int aAdd, float rMult, float gMult, float bMult, float aMult); WM_DLL_A SWFCXform WM_DLL_B newSWFAddCXform(int rAdd, int gAdd, int bAdd, int aAdd); WM_DLL_A SWFCXform WM_DLL_B newSWFMultCXform(float rMult, float gMult, float bMult, float aMult); WM_DLL_A void WM_DLL_B SWFCXform_setColorAdd(SWFCXform cXform, int rAdd, int gAdd, int bAdd, int aAdd); WM_DLL_A void WM_DLL_B SWFCXform_setColorMult(SWFCXform cXform, float rMult, float gMult, float bMult, float aMult); WM_DLL_A void WM_DLL_B destroySWFCXform(SWFCXform cXform); /* SWFAction */ typedef void *SWFAction; WM_DLL_A SWFAction WM_DLL_B compileSWFActionCode(char *script); WM_DLL_A void WM_DLL_B destroySWFAction(SWFAction action); /* SWFButton */ typedef void *SWFButton; #define SWFBUTTON_HIT (1<<3) #define SWFBUTTON_DOWN (1<<2) #define SWFBUTTON_OVER (1<<1) #define SWFBUTTON_UP (1<<0) /* deprecated: */ #define SWFBUTTONRECORD_HITSTATE (1<<3) #define SWFBUTTONRECORD_DOWNSTATE (1<<2) #define SWFBUTTONRECORD_OVERSTATE (1<<1) #define SWFBUTTONRECORD_UPSTATE (1<<0) #define SWFBUTTON_KEYPRESS(c) (((c)&0x7f)<<9) #define SWFBUTTON_ONKEYPRESS(c) (((c)&0x7f)<<9) #define SWFBUTTON_OVERDOWNTOIDLE (1<<8) #define SWFBUTTON_IDLETOOVERDOWN (1<<7) #define SWFBUTTON_OUTDOWNTOIDLE (1<<6) #define SWFBUTTON_OUTDOWNTOOVERDOWN (1<<5) #define SWFBUTTON_OVERDOWNTOOUTDOWN (1<<4) #define SWFBUTTON_OVERDOWNTOOVERUP (1<<3) #define SWFBUTTON_OVERUPTOOVERDOWN (1<<2) #define SWFBUTTON_OVERUPTOIDLE (1<<1) #define SWFBUTTON_IDLETOOVERUP (1<<0) /* easier to remember: */ #define SWFBUTTON_MOUSEUPOUTSIDE SWFBUTTON_OUTDOWNTOIDLE #define SWFBUTTON_DRAGOVER (SWFBUTTON_OUTDOWNTOOVERDOWN | SWFBUTTON_IDLETOOVERDOWN) #define SWFBUTTON_DRAGOUT (SWFBUTTON_OVERDOWNTOOUTDOWN | SWFBUTTON_OVERDOWNTOIDLE) #define SWFBUTTON_MOUSEUP SWFBUTTON_OVERDOWNTOOVERUP #define SWFBUTTON_MOUSEDOWN SWFBUTTON_OVERUPTOOVERDOWN #define SWFBUTTON_MOUSEOUT SWFBUTTON_OVERUPTOIDLE #define SWFBUTTON_MOUSEOVER SWFBUTTON_IDLETOOVERUP WM_DLL_A SWFButton WM_DLL_B newSWFButton(); WM_DLL_A void WM_DLL_B destroySWFButton(SWFBlock block); WM_DLL_A void WM_DLL_B SWFButton_addShape(SWFButton button, SWFCharacter character, byte flags); WM_DLL_A void WM_DLL_B SWFButton_addAction(SWFButton button, SWFAction action, int flags); /* SWFSprite */ typedef void *SWFSprite; WM_DLL_A SWFSprite WM_DLL_B newSWFSprite(); WM_DLL_A void WM_DLL_B destroySWFSprite(SWFBlock block); WM_DLL_A void WM_DLL_B SWFSprite_addBlock(SWFSprite sprite, SWFBlock block); /* position.h */ struct _swfPosition { int x; int y; float xScale; float yScale; float xSkew; float ySkew; float rot; SWFMatrix matrix; }; typedef struct _swfPosition *SWFPosition; #define SWFPOSITION_SIZE sizeof(struct _swfPosition) WM_DLL_A void WM_DLL_B destroySWFPosition(SWFPosition position); WM_DLL_A SWFPosition WM_DLL_B newSWFPosition(SWFMatrix matrix); WM_DLL_A void WM_DLL_B SWFPosition_skewX(SWFPosition position, float x); WM_DLL_A void WM_DLL_B SWFPosition_skewXTo(SWFPosition position, float x); WM_DLL_A void WM_DLL_B SWFPosition_skewY(SWFPosition position, float y); WM_DLL_A void WM_DLL_B SWFPosition_skewYTo(SWFPosition position, float y); WM_DLL_A void WM_DLL_B SWFPosition_scaleX(SWFPosition position, float x); WM_DLL_A void WM_DLL_B SWFPosition_scaleXTo(SWFPosition position, float x); WM_DLL_A void WM_DLL_B SWFPosition_scaleY(SWFPosition position, float y); WM_DLL_A void WM_DLL_B SWFPosition_scaleYTo(SWFPosition position, float y); WM_DLL_A void WM_DLL_B SWFPosition_scaleXY(SWFPosition position, float x, float y); WM_DLL_A void WM_DLL_B SWFPosition_scaleXYTo(SWFPosition position, float x, float y); WM_DLL_A void WM_DLL_B SWFPosition_setMatrix(SWFPosition p, float a, float b, float c, float d, float x, float y); WM_DLL_A void WM_DLL_B SWFPosition_rotate(SWFPosition position, float degrees); WM_DLL_A void WM_DLL_B SWFPosition_rotateTo(SWFPosition position, float degrees); WM_DLL_A void WM_DLL_B SWFPosition_move(SWFPosition position, float x, float y); WM_DLL_A void WM_DLL_B SWFPosition_moveTo(SWFPosition position, float x, float y); typedef void *SWFDisplayItem; WM_DLL_A void WM_DLL_B SWFDisplayItem_rotate(SWFDisplayItem item, float degrees); WM_DLL_A void WM_DLL_B SWFDisplayItem_rotateTo(SWFDisplayItem item, float degrees); WM_DLL_A void WM_DLL_B SWFDisplayItem_move(SWFDisplayItem item, float x, float y); WM_DLL_A void WM_DLL_B SWFDisplayItem_moveTo(SWFDisplayItem item, float x, float y); WM_DLL_A void WM_DLL_B SWFDisplayItem_scale(SWFDisplayItem item, float xScale, float yScale); WM_DLL_A void WM_DLL_B SWFDisplayItem_scaleTo(SWFDisplayItem item, float xScale, float yScale); WM_DLL_A void WM_DLL_B SWFDisplayItem_skewX(SWFDisplayItem item, float x); WM_DLL_A void WM_DLL_B SWFDisplayItem_skewXTo(SWFDisplayItem item, float x); WM_DLL_A void WM_DLL_B SWFDisplayItem_skewY(SWFDisplayItem item, float y); WM_DLL_A void WM_DLL_B SWFDisplayItem_skewYTo(SWFDisplayItem item, float y); WM_DLL_A void WM_DLL_B SWFDisplayItem_setMatrix(SWFDisplayItem i, float a, float b, float c, float d, float x, float y); WM_DLL_A int WM_DLL_B SWFDisplayItem_getDepth(SWFDisplayItem item); WM_DLL_A void WM_DLL_B SWFDisplayItem_setDepth(SWFDisplayItem item, int depth); WM_DLL_A void WM_DLL_B SWFDisplayItem_remove(SWFDisplayItem item); WM_DLL_A void WM_DLL_B SWFDisplayItem_setName(SWFDisplayItem item, const char *name); WM_DLL_A void WM_DLL_B SWFDisplayItem_setMaskLevel(SWFDisplayItem item, int masklevel); WM_DLL_A void WM_DLL_B SWFDisplayItem_setRatio(SWFDisplayItem item, float ratio); WM_DLL_A void WM_DLL_B SWFDisplayItem_setCXform(SWFDisplayItem item, SWFCXform cXform); WM_DLL_A void WM_DLL_B SWFDisplayItem_setColorAdd(SWFDisplayItem item, int r, int g, int b, int a); WM_DLL_A void WM_DLL_B SWFDisplayItem_setColorMult(SWFDisplayItem item, float r, float g, float b, float a); #define SWFDisplayItem_addColor SWFDisplayItem_setColorAdd #define SWFDisplayItem_multColor SWFDisplayItem_setColorMult #define SWFACTION_ONLOAD (1<<0) #define SWFACTION_ENTERFRAME (1<<1) #define SWFACTION_UNLOAD (1<<2) #define SWFACTION_MOUSEMOVE (1<<3) #define SWFACTION_MOUSEDOWN (1<<4) #define SWFACTION_MOUSEUP (1<<5) #define SWFACTION_KEYDOWN (1<<6) #define SWFACTION_KEYUP (1<<7) #define SWFACTION_DATA (1<<8) WM_DLL_A void WM_DLL_B SWFDisplayItem_addAction(SWFDisplayItem item, SWFAction action, int flags); /* SWFFill adds a position object to manipulate SWFFillStyle's matrix. */ typedef void *SWFFill; WM_DLL_A SWFFill WM_DLL_B newSWFFill(SWFFillStyle fillstyle); WM_DLL_A void WM_DLL_B destroySWFFill(SWFFill fill); WM_DLL_A void WM_DLL_B SWFFill_skewX(SWFFill fill, float x); WM_DLL_A void WM_DLL_B SWFFill_skewXTo(SWFFill fill, float x); WM_DLL_A void WM_DLL_B SWFFill_skewY(SWFFill fill, float y); WM_DLL_A void WM_DLL_B SWFFill_skewYTo(SWFFill fill, float y); WM_DLL_A void WM_DLL_B SWFFill_scaleX(SWFFill fill, float x); WM_DLL_A void WM_DLL_B SWFFill_scaleXTo(SWFFill fill, float x); WM_DLL_A void WM_DLL_B SWFFill_scaleY(SWFFill fill, float y); WM_DLL_A void WM_DLL_B SWFFill_scaleYTo(SWFFill fill, float y); /* deprecated: */ WM_DLL_A void WM_DLL_B SWFFill_scaleXY(SWFFill fill, float x, float y); WM_DLL_A void WM_DLL_B SWFFill_scaleXYTo(SWFFill fill, float x, float y); WM_DLL_A void WM_DLL_B SWFFill_scale(SWFFill fill, float x, float y); WM_DLL_A void WM_DLL_B SWFFill_scaleTo(SWFFill fill, float x, float y); WM_DLL_A void WM_DLL_B SWFFill_rotate(SWFFill fill, float degrees); WM_DLL_A void WM_DLL_B SWFFill_rotateTo(SWFFill fill, float degrees); WM_DLL_A void WM_DLL_B SWFFill_move(SWFFill fill, float x, float y); WM_DLL_A void WM_DLL_B SWFFill_moveTo(SWFFill fill, float x, float y); WM_DLL_A void WM_DLL_B SWFFill_setMatrix(SWFFill fill, float a, float b, float c, float d, float x, float y); /* shape_util.h */ WM_DLL_A void WM_DLL_B SWFShape_setLine(SWFShape shape, unsigned short width, byte r, byte g, byte b, byte a); WM_DLL_A SWFFill WM_DLL_B SWFShape_addSolidFill(SWFShape shape, byte r, byte g, byte b, byte a); WM_DLL_A SWFFill WM_DLL_B SWFShape_addGradientFill(SWFShape shape, SWFGradient gradient, byte flags); WM_DLL_A SWFFill WM_DLL_B SWFShape_addBitmapFill(SWFShape shape, SWFBitmap bitmap, byte flags); WM_DLL_A void WM_DLL_B SWFShape_setLeftFill(SWFShape shape, SWFFill fill); WM_DLL_A void WM_DLL_B SWFShape_setRightFill(SWFShape shape, SWFFill fill); WM_DLL_A void WM_DLL_B SWFShape_setLine(SWFShape shape, unsigned short width, byte r, byte g, byte b, byte a); WM_DLL_A void WM_DLL_B SWFShape_drawArc(SWFShape shape, float r, float startAngle, float endAngle); WM_DLL_A void WM_DLL_B SWFShape_drawCircle(SWFShape shape, float r); /* draw character c from font font into shape shape at size size */ WM_DLL_A void WM_DLL_B SWFShape_drawGlyph(SWFShape shape, SWFFont font, unsigned char c); WM_DLL_A void WM_DLL_B SWFShape_drawSizedGlyph(SWFShape shape, SWFFont font, unsigned char c, int size); /* approximate a cubic bezier with quadratic segments */ /* returns the number of segments used */ WM_DLL_A int WM_DLL_B SWFShape_drawCubic(SWFShape shape, float bx, float by, float cx, float cy, float dx, float dy); WM_DLL_A int WM_DLL_B SWFShape_drawCubicTo(SWFShape shape, float bx, float by, float cx, float cy, float dx, float dy); WM_DLL_A void WM_DLL_B SWFShape_drawCharacterBounds(SWFShape shape, SWFCharacter character); /* deprecated: */ #define SWFShape_drawFontGlyph(s,f,c) SWFShape_drawGlyph(s,f,c) typedef void *SWFMovieClip; WM_DLL_A void WM_DLL_B destroySWFMovieClip(SWFMovieClip clip); WM_DLL_A SWFMovieClip WM_DLL_B newSWFMovieClip(); WM_DLL_A void WM_DLL_B SWFMovieClip_setNumberOfFrames(SWFMovieClip clip, int frames); SWFDisplayItem SWFMovieClip_add(SWFMovieClip clip, SWFBlock block); WM_DLL_A void WM_DLL_B SWFMovieClip_remove(SWFMovieClip clip, SWFDisplayItem item); WM_DLL_A void WM_DLL_B SWFMovieClip_nextFrame(SWFMovieClip clip); WM_DLL_A void WM_DLL_B SWFMovieClip_labelFrame(SWFMovieClip clip, char *label); WM_DLL_A void WM_DLL_B SWFMovieClip_setSoundStream(SWFMovieClip clip, SWFSound sound, float rate); /* movie.h */ typedef void *SWFMovie; WM_DLL_A void WM_DLL_B destroySWFMovie(SWFMovie movie); WM_DLL_A SWFMovie WM_DLL_B newSWFMovie(); WM_DLL_A SWFMovie WM_DLL_B newSWFMovieWithVersion(int version); WM_DLL_A void WM_DLL_B SWFMovie_setRate(SWFMovie movie, float rate); WM_DLL_A void WM_DLL_B SWFMovie_setDimension(SWFMovie movie, float x, float y); WM_DLL_A void WM_DLL_B SWFMovie_setNumberOfFrames(SWFMovie movie, int frames); WM_DLL_A void WM_DLL_B SWFMovie_addExport(SWFMovie movie, SWFBlock block, char *name); /* XXX - 0.1 name: */ #define SWFMovie_setFrames SWFMovie_setNumberOfFrames WM_DLL_A void WM_DLL_B SWFMovie_setBackground(SWFMovie movie, int r, int g, int b); WM_DLL_A void WM_DLL_B SWFMovie_setSoundStream(SWFMovie movie, SWFSound sound); WM_DLL_A SWFDisplayItem WM_DLL_B SWFMovie_add(SWFMovie movie, SWFBlock block); WM_DLL_A void WM_DLL_B SWFMovie_remove(SWFMovie movie, SWFDisplayItem item); WM_DLL_A void WM_DLL_B SWFMovie_nextFrame(SWFMovie movie); WM_DLL_A void WM_DLL_B SWFMovie_labelFrame(SWFMovie movie, char *label); WM_DLL_A int WM_DLL_B SWFMovie_output(SWFMovie movie, SWFByteOutputMethod method, void *data); WM_DLL_A int WM_DLL_B SWFMovie_save(SWFMovie movie, const char *filename); /*new routines*/ // this is because you can't pass a FILE * pointer to a dll // unless both calling app and dll use the same version of the // C runtime library WM_DLL_A SWFDBLBitmap WM_DLL_B newSWFDBLBitmapForFileName(char *szFileName); WM_DLL_A SWFJpegBitmap WM_DLL_B newSWFJpegBitmapForFileName(char *szJpeg); WM_DLL_A SWFJpegWithAlpha WM_DLL_B newSWFJpegWithAlphaForFileName(char *szJpeg,char *szAlpha); WM_DLL_A SWFSound WM_DLL_B newSWFSoundForFileName(char *szname); WM_DLL_A SWFDBLBitmap WM_DLL_B newSWFDBLBitmapForFileName(char *szFileName); WM_DLL_A SWFFont WM_DLL_B loadSWFFontFromFileOfName(char *filename); // buffered file output typedef void *SFILE; DLL_A void DLL_B fclose_Buf(SFILE *f); DLL_A SFILE * DLL_B fopen_Buf(char *szFile,char *szmethod); typedef void (*SWFByteOutputMethod)(byte b, void *data); typedef void *(*SWFFileOpenMethod)(char *szFile,const char *mode); typedef void (*SWFFileCloseMethod)(void *data); DLL_A void DLL_B Set_fileByteOutputMethod(SWFByteOutputMethod new_method); DLL_A void DLL_B Set_fileOpenMethod(SWFFileOpenMethod new_method); DLL_A void DLL_B Set_fileCloseMethod(SWFFileCloseMethod new_method); // this lets one remove all current display items in the movie // without need to keep track of them all so frame is clear // for next frame of movie. WM_DLL_A void WM_DLL_B MingRemoveAllDisplayItems(char remove_forgotten_items); // Use this to clean up at end of movie. // Can also be used on abnormal exit using // atexit(Ming_cleanup) WM_DLL_A int WM_DLL_B Ming_cleanup(); // These can be called when you end the movie. // They are called also from Ming_cleanup(); WM_DLL_A void WM_DLL_B MingRemoveAllDestructibleBlocks(void); WM_DLL_A void WM_DLL_B MingRemoveAllDisplayItems(char remove_forgotten_items); WM_DLL_A void WM_DLL_B MingRemoveAllFills(void); WM_DLL_A void WM_DLL_B MingRemoveAllGradients(void); WM_DLL_A void WM_DLL_B MingCloseAllFiles(void); WM_DLL_A void WM_DLL_B FreeMovieSels(void); // Can also use MingRemoveAllDisplayItems(0) // at end of each frame if you want a clean slate // but if you want to keep one of the items, e.g. a bitmap filled square // call this with return value from SWFMovie_add_item() WM_DLL_A void WM_DLL_B MingForgetDisplayItem(SWFDisplayItem item); WM_DLL_A void WM_DLL_B MingRememberAllDisplayItems(SWFDisplayItem item); // this should be called if you use the windows gdi routines // to select a movie into a windows hdc (graphics context). WM_DLL_A void WM_DLL_B FreeMovieSels(void); // also for the buffered file output: WM_DLL_A void WM_DLL_B MingCloseAllFiles(void); WM_DLL_A int WM_DLL_B MingFreeAllPointersAllocated(void); // this has effect only if library is compiled with // #define cl_malloc_addp. Otherwise resolves to a // routine that does nothing. Mainly used for // debugging - aim is to make it so library has no memory leaks // after you call Ming_clean_up(); // windows like gdi calls WM_DLL_A void WM_DLL_B WinMing_SelectMovie(HDC hdc,SWFMovie m); WM_DLL_A void WM_DLL_B WinMing_UnSelectMovie(HDC hdc,SWFMovie m); WM_DLL_A SWFMovie WM_DLL_B WinMing_GetMovieForHdc(HDC hdc); WM_DLL_A void WM_DLL_B WinMing_FreeMovieSels(void); WM_DLL_A void WM_DLL_B WinMing_FreeMovieSelsIfPoss(char free_anyway); WM_DLL_A SWFMovie WM_DLL_B WinMing_StartMovie(int width,int height,float frames_per_sec,int nframes); WM_DLL_A int WM_DLL_B WinMing_CloseMovie(SWFMovie m,char *szFileName); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_Polygon(HDC hdc,POINT *pts,int npts); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_Rectangle(HDC hdc,int left,int top,int right,int bottom); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_Polyline(HDC hdc,POINT *pts,int npts); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_PolyPolygon(HDC hdc,POINT *poly_pts,int *poly_counts,int ncounts); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_LineTo(HDC hdc,int x,int y); WM_DLL_A BOOL WM_DLL_B WinMing_MoveTo(HDC hdc,int x,int y,POINT *pt); WM_DLL_A void WM_DLL_B WinMing_FindBrushRGB(HBRUSH hBrush,BYTE *pR,BYTE *pG,BYTE *pB); WM_DLL_A void WM_DLL_B WinMing_FindPenWidthAndRGB(HPEN hPen,int *pwidth,BYTE *pR,BYTE *pG,BYTE *pB); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_GradientFillRect(HDC hdc ,int degrees ,int left,int top,int right,int bottom ,byte rfill, byte gfill, byte bfill, byte afill ,byte rfill2, byte gfill2, byte bfill2, byte afill2 ); WM_DLL_A void WM_DLL_B WinMing_SetGDIMaskLevel(HDC hdc,int ilevel); WM_DLL_A void WM_DLL_B WinMing_SetGDIMaskAsWhite(HDC hdc,BOOL b); WM_DLL_A void WM_DLL_B WinMing_StartPaintMask(HDC hdc); WM_DLL_A void WM_DLL_B WinMing_StopPaintMask(HDC hdc); typedef void *SWFJpeg; WM_DLL_A SWFJpeg WM_DLL_B WinMing_InitJpegFillFromFileName(HDC hdc,char *szJpegFileName); WM_DLL_A void WM_DLL_B WinMing_InitJpegFill(HDC hdc,SWFJpeg jpeg); WM_DLL_A void WM_DLL_B WinMing_StartJpegFill(HDC hdc); WM_DLL_A void WM_DLL_B WinMing_StopJpegFill(HDC hdc); // note you can only have one jpeg fill on the go at a time // if you want to reuse them then keep track of the // pointers returned by InitJpegFillFromFileName // and use them for InitJpegFill WM_DLL_A HBRUSH WM_DLL_B WinMing_FindCurrentBrushRGB(HDC hdc,BYTE *pR,BYTE *pG,BYTE *pB); WM_DLL_A HPEN WM_DLL_B WinMing_FindCurrentPenWidthAndRGB(HDC hdc,int *pwidth,BYTE *pR,BYTE *pG,BYTE *pB); WM_DLL_A void WM_DLL_B WinMing_SetBackground(HDC hdc,HBRUSH hBrush); WM_DLL_A SWFDisplayItem WM_DLL_B WinMing_DrawCentredText(HDC hdc,int left,int top, int right,int bottom ,char *szText ,SWFFont f,int font_height); // See the end of win_ming_dll.h for example of typical use WM_DLL_A void WM_DLL_B WinMing_FreeMovieSels(void); WM_DLL_A void WM_DLL_B WinMing_RemoveAllDisplayItems(char remove_forgotten_items); // same as MingRemoveAllDisplayItems //MingDrawCentredText: No background colour painted - equivalent to SetBkMode(TRANSPARENT); /**: // typical use of the win_ming gdi calls in a calling app: #include "win_ming_dll.h" // wrapper functions for the ming calls to replace various standard Windows routines extern BOOL PolylineOrWinMing_Polyline(HDC hdc,POINT *pts,int npts); extern BOOL RectangleOrWinMing_Rectangle(HDC hdc,int left,int top,int right,int bottom); extern BOOL FillRectOrWinMing_FillRec(HDC hdc,RECT *prc,HBRUSH hBrush); extern BOOL PolyPolygonOrWinMing_PolyPolygon(HDC hdc,POINT *poly_pts,int *counts,int ncounts); extern BOOL PolygonOrWinMing_Polygon(HDC hdc,POINT *pts,int npts); extern BOOL LineToOrWinMing_LineTo(HDC hdc,int x,int y); extern BOOL MoveToOrWinMing_MoveTo(HDC hdc,int x,int y,POINT *ppt); extern void MakeSWFMovie(char *szFileName); BOOL PolylineOrWinMing_Polyline(HDC hdc,POINT *pts,int npts) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) return WinMing_Polyline(xzGetHdcForRecord(hdc),pts,npts)?TRUE:FALSE; else return Polyline(hdc,pts,npts); } BOOL RectangleOrWinMing_Rectangle(HDC hdc,int left,int top,int right,int bottom) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) { POINT pts[4]; pts[0].x=left; pts[0].y=top; pts[1].x=right; pts[1].y=top; pts[2].x=right; pts[2].y=bottom; pts[3].x=left; pts[3].y=bottom; return WinMing_Polygon(xzGetHdcForRecord(hdc),pts,4)?TRUE:FALSE; } else return Rectangle(hdc,left,top,right,bottom); } BOOL FillRectOrWinMing_FillRec(HDC hdc,RECT *prc,HBRUSH hBrush) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) { HBRUSH hBrushWas=SelectObject(hdc,hBrush); BOOL bret=RectangleOrWinMing_Rectangle(hdc,prc->left,prc->top,prc->right,prc->bottom); SelectObject(hdc,hBrushWas); return bret; } else return FillRect(hdc,prc,hBrush); } BOOL PolyPolygonOrWinMing_PolyPolygon(HDC hdc,POINT *poly_pts,int *counts,int ncounts) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) return WinMing_PolyPolygon(xzGetHdcForRecord(hdc),poly_pts,counts,ncounts)?TRUE:FALSE; else return PolyPolygon(hdc,poly_pts,counts,ncounts); } BOOL PolygonOrWinMing_Polygon(HDC hdc,POINT *pts,int npts) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) return WinMing_Polygon(xzGetHdcForRecord(hdc),pts,npts)?TRUE:FALSE; else return Polygon(hdc,pts,npts); } BOOL LineToOrWinMing_LineTo(HDC hdc,int x,int y) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) return WinMing_LineTo(xzGetHdcForRecord(hdc),x,y)?TRUE:FALSE; else return LineTo(hdc,x,y); } BOOL MoveToOrWinMing_MoveTo(HDC hdc,int x,int y,POINT *ppt) { if(WinMing_GetMovieForHdc(xzGetHdcForRecord(hdc))) return WinMing_MoveTo(xzGetHdcForRecord(hdc),x,y,ppt); else return MoveToEx(hdc,x,y,ppt); } void MakeSWFMovie(char *szFileName,int width,int height,int frames_per_sec,int nframes) { SWFMovie movie = WinMing_StartMovie(width,height,frames_per_sec,nframes); HDC hdc=GetDC(NULL);// hdc for desktop HDC hDCForMovie=CreateCompatibleDC(hdc); int iframe=0; ReleaseDC(NULL,hdc); if(hDCForMovie) { WinMing_SelectMovie(hDCForMovie,movie); for(iframe=0;iframe