⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ming.h

📁 flash swf file player
💻 H
📖 第 1 页 / 共 2 页
字号:
/*    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*//* ming.h *  * $Id: ming.h,v 1.22 2004/02/02 12:20:26 vapour Exp $ * * This header file contains all declarations of functions and types that * are supposed to be publicly accessable. */#ifndef SWF_MING_H_INCLUDED#define SWF_MING_H_INCLUDED#ifdef __cplusplusextern "C" {#endif#include <stdio.h>#define MING_VERSION        0.3beta1#define MING_VERSION_TEXT  "0.3beta1"/* do we enable gif / png functions? */#include "ming_config.h"/***** Type definitions - avoid cyclic dependencies ****/typedef unsigned char byte;typedef struct SWFBlock_s *SWFBlock;typedef struct SWFMatrix_s *SWFMatrix;typedef struct SWFInput_s *SWFInput;typedef struct SWFCharacter_s *SWFCharacter;typedef struct SWFDBLBitmap_s *SWFDBLBitmap;typedef struct SWFDBLBitmapData_s *SWFDBLBitmapData;typedef struct SWFJpegBitmap_s *SWFJpegBitmap;typedef struct SWFJpegWithAlpha_s *SWFJpegWithAlpha;typedef struct SWFGradient_s *SWFGradient;typedef struct SWFFillStyle_s *SWFFillStyle;typedef struct SWFLineStyle_s *SWFLineStyle;typedef struct SWFShape_s *SWFShape;typedef struct SWFMorph_s *SWFMorph;typedef struct SWFFont_s *SWFFont;typedef struct SWFText_s *SWFText;typedef struct SWFBrowserFont_s *SWFBrowserFont;typedef struct SWFFontCharacter_s *SWFFontCharacter;typedef struct SWFTextField_s *SWFTextField;typedef struct SWFSoundStream_s *SWFSoundStream;typedef struct SWFSound_s *SWFSound;typedef struct SWFSoundInstance_s *SWFSoundInstance;typedef struct SWFCXform_s *SWFCXform;typedef struct SWFOutputBlock_s *SWFAction;typedef struct SWFButton_s *SWFButton;typedef struct SWFSprite_s *SWFSprite;typedef struct SWFPosition_s *SWFPosition;typedef struct SWFDisplayItem_s *SWFDisplayItem;typedef struct SWFFill_s *SWFFill;typedef struct SWFMovieClip_s *SWFMovieClip;typedef struct SWFMovie_s *SWFMovie;typedef struct SWFVideoStream_s *SWFVideoStream;/***** General Ming functions *****/int Ming_init();/* sets the threshold error for drawing cubic beziers.  Lower is more   accurate, hence larger file size. */void Ming_setCubicThreshold(int num);/* sets the overall scale, default is 20 */void Ming_setScale(float scale);float Ming_getScale();/* set the version number to use */void Ming_useSWFVersion(int version);/* change the error/warn behavior.  Default prints message and exits. */void Ming_setWarnFunction(void (*warn)(const char *msg, ...));void Ming_setErrorFunction(void (*error)(const char *msg, ...));/* a generic output method.  specific instances dump output to file,   send to stdout, etc. */typedef void (*SWFByteOutputMethod)(byte b, void *data);void fileOutputMethod(byte b, void *data);/***** SWFBlock *****//***** SWFMatrix *****//***** SWFInput *****//* A generic input object.  Wraps files, buffers and streams; replaces   standard file funcs */SWFInput newSWFInput_file(FILE *f);SWFInput newSWFInput_stream(FILE *f);SWFInput newSWFInput_buffer(unsigned char *buffer, int length);SWFInput newSWFInput_allocedBuffer(unsigned char *buffer, int length);void destroySWFInput(SWFInput input);int SWFInput_length(SWFInput input);void SWFInput_rewind(SWFInput input);int SWFInput_tell(SWFInput input);void SWFInput_seek(SWFInput input, long offset, int whence);int SWFInput_eof(SWFInput input);/***** SWFCharacter *****//* a character is any sort of asset that's referenced later-   SWFBitmap, SWFShape, SWFMorph, SWFSound, SWFSprite are all SWFCharacters */float SWFCharacter_getWidth(SWFCharacter character);float SWFCharacter_getHeight(SWFCharacter character);/***** SWFBitmap *****/typedef SWFCharacter SWFBitmap;SWFBitmap newSWFBitmap_fromInput(SWFInput input);void destroySWFBitmap(SWFBitmap bitmap);int SWFBitmap_getWidth(SWFBitmap b);int SWFBitmap_getHeight(SWFBitmap b);/***** SWFDBLBitmap extends SWFBitmap *****//* create a new DBL (define bits lossless) bitmap from the given file */SWFDBLBitmap newSWFDBLBitmap(FILE *f);/* create a new DBL bitmap from the given input object */SWFDBLBitmap newSWFDBLBitmap_fromInput(SWFInput input);#if USE_GIFSWFDBLBitmapData newSWFDBLBitmapData_fromGifFile(const char *name);SWFDBLBitmapData newSWFDBLBitmapData_fromGifInput(SWFInput input);#endif#if USE_PNGSWFDBLBitmapData newSWFDBLBitmapData_fromPngFile(const char *name);SWFDBLBitmapData newSWFDBLBitmapData_fromPngInput(SWFInput input);#endif/***** SWFJpegBitmap extends SWFBitmap *****/SWFJpegBitmap newSWFJpegBitmap(FILE *f);SWFJpegBitmap newSWFJpegBitmap_fromInput(SWFInput input);SWFJpegWithAlpha newSWFJpegWithAlpha(FILE *f, FILE *alpha);SWFJpegWithAlpha newSWFJpegWithAlpha_fromInput(SWFInput input, SWFInput alpha);/***** SWFGradient *****/SWFGradient newSWFGradient();void destroySWFGradient(SWFGradient gradient);void SWFGradient_addEntry(SWFGradient gradient,			  float ratio, byte r, byte g, byte b, byte a);/***** SWFFillStyle - a fill instance on a shape *****/#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		0x41SWFFillStyle newSWFSolidFillStyle(byte r, byte g, byte b, byte a);SWFFillStyle newSWFGradientFillStyle(SWFGradient gradient, byte radial);SWFFillStyle newSWFBitmapFillStyle(SWFCharacter bitmap, byte flags);SWFMatrix SWFFillStyle_getMatrix(SWFFillStyle fill);/***** SWFLineStyle *****/SWFLineStyle newSWFLineStyle(unsigned short width, byte r, byte g, byte b, byte a);/***** SWFShape *****/SWFShape newSWFShape();void destroySWFShape(SWFShape shape);void SWFShape_end(SWFShape shape);void SWFShape_movePenTo(SWFShape shape, float x, float y);void SWFShape_movePen(SWFShape shape, float x, float y);float SWFShape_getPenX(SWFShape shape);float SWFShape_getPenY(SWFShape shape);void SWFShape_getPen(SWFShape shape, float* penX, float* penY);/* x,y relative to shape origin */void SWFShape_drawLineTo(SWFShape shape, float x, float y);void SWFShape_drawLine(SWFShape shape, float dx, float dy);void SWFShape_drawCurveTo(SWFShape shape, float controlx, float controly,			  float anchorx, float anchory);void SWFShape_drawCurve(SWFShape shape, float controldx, float controldy,			float anchordx, float anchordy);void SWFShape_setLineStyle(SWFShape shape, unsigned short width,			  byte r, byte g, byte b, byte a);SWFFillStyle SWFShape_addSolidFillStyle(SWFShape shape,					byte r, byte g, byte b, byte a);SWFFillStyle SWFShape_addGradientFillStyle(SWFShape shape,					   SWFGradient gradient, byte flags);SWFFillStyle SWFShape_addBitmapFillStyle(SWFShape shape,					 SWFBitmap bitmap, byte flags);void SWFShape_setLeftFillStyle(SWFShape shape, SWFFillStyle fill);void SWFShape_setRightFillStyle(SWFShape shape, SWFFillStyle fill);/***** SWFMorph *****/SWFMorph newSWFMorphShape();void destroySWFMorph(SWFMorph morph);SWFShape SWFMorph_getShape1(SWFMorph morph);SWFShape SWFMorph_getShape2(SWFMorph morph);/***** SWFFont *****/SWFFont newSWFFont();SWFFont loadSWFFontFromFile(FILE *file);void destroySWFFont(SWFFont font);float SWFFont_getStringWidth(SWFFont font, const unsigned char *string);float SWFFont_getUTF8StringWidth(SWFFont font, const unsigned char *string);  /* deprecated? */  float SWFFont_getWideStringWidth(SWFFont font, const unsigned short *string, int len);  #define SWFFont_getWidth SWFFont_getStringWidthfloat SWFFont_getAscent(SWFFont font);float SWFFont_getDescent(SWFFont font);float SWFFont_getLeading(SWFFont font);char *SWFFont_getShape(SWFFont font, unsigned short code);/***** SWFText *****/SWFText newSWFText();SWFText newSWFText2();void destroySWFText(SWFText text);void SWFText_setFont(SWFText text, void* font);void SWFText_setHeight(SWFText text, float height);void SWFText_setColor(SWFText text, byte r, byte g, byte b, byte a);void SWFText_moveTo(SWFText text, float x, float y);void SWFText_addString(SWFText text, const char* string, int* advance);void SWFText_addUTF8String(SWFText text, const char* string, int* advance);void SWFText_addWideString(SWFText text, const unsigned short* string,                           int strlen, int* advance);void SWFText_setSpacing(SWFText text, float spacing);float SWFText_getStringWidth(SWFText text, const unsigned char* string);float SWFText_getUTF8StringWidth(SWFText text, const unsigned char* string);float SWFText_getWideStringWidth(SWFText text, const unsigned short* string);  /* deprecated? */  #define SWFText_getWidth SWFText_getStringWidthfloat SWFText_getAscent(SWFText text);float SWFText_getDescent(SWFText text);float SWFText_getLeading(SWFText text);  /* deprecated: */  #define SWFText_setXY(t,x,y) SWFText_moveTo((t),(x),(y))/***** SWFBrowserFont *****/SWFBrowserFont newSWFBrowserFont(const char *name);void destroySWFBrowserFont(SWFBrowserFont browserFont);/***** SWFFontCharacter *****/SWFFontCharacter SWFMovie_addFont(SWFMovie movie, SWFFont font);void SWFFontCharacter_addChars(SWFFontCharacter font, const char *string);void SWFFontCharacter_addUTF8Chars(SWFFontCharacter font, const char *string);SWFFontCharacter SWFMovie_importFont(SWFMovie movie, const char *filename, const char *name);/***** SWFTextField *****/#define SWFTEXTFIELD_ONMASK  0x2005 /* on bits */#define SWFTEXTFIELD_OFFMASK 0x3BFF /* off bits *//* Taken from textfield.h: #define SWFTEXTFIELD_OFFMASK 0x7BFF / off bits */#define SWFTEXTFIELD_HASFONT   (1<<0)   /* font and size given */#define SWFTEXTFIELD_HASLENGTH (1<<1)#define SWFTEXTFIELD_HASCOLOR  (1<<2)#define SWFTEXTFIELD_NOEDIT    (1<<3)#define SWFTEXTFIELD_PASSWORD  (1<<4)#define SWFTEXTFIELD_MULTILINE (1<<5)#define SWFTEXTFIELD_WORDWRAP  (1<<6)#define SWFTEXTFIELD_HASTEXT   (1<<7)   /* initial text present */#define SWFTEXTFIELD_USEFONT   (1<<8)#define SWFTEXTFIELD_HTML      (1<<9)#define SWFTEXTFIELD_DRAWBOX   (1<<11)#define SWFTEXTFIELD_NOSELECT  (1<<12)#define SWFTEXTFIELD_HASLAYOUT (1<<13)  /* align, margin, lspace, indent */#define SWFTEXTFIELD_AUTOSIZE  (1<<14)  /* SWF6 */typedef enum{  SWFTEXTFIELD_ALIGN_LEFT    = 0,  SWFTEXTFIELD_ALIGN_RIGHT   = 1,  SWFTEXTFIELD_ALIGN_CENTER  = 2,  SWFTEXTFIELD_ALIGN_JUSTIFY = 3} SWFTextFieldAlignment;SWFTextField newSWFTextField();void destroySWFTextField(SWFTextField textField);void SWFTextField_setFont(SWFTextField field, SWFBlock font);void SWFTextField_setBounds(SWFTextField field, float width, float height);void SWFTextField_setFlags(SWFTextField field, int flags);void SWFTextField_setColor(SWFTextField field, byte r, byte g, byte b, byte a);void SWFTextField_setVariableName(SWFTextField field, const char *name);void SWFTextField_addString(SWFTextField field, const char *string);void SWFTextField_addUTF8String(SWFTextField field, const char *string);void SWFTextField_setHeight(SWFTextField field, float height);void SWFTextField_setFieldHeight(SWFTextField field, float height);void SWFTextField_setLeftMargin(SWFTextField field, float leftMargin);void SWFTextField_setRightMargin(SWFTextField field, float rightMargin);void SWFTextField_setIndentation(SWFTextField field, float indentation);void SWFTextField_setLineSpacing(SWFTextField field, float lineSpacing);void SWFTextField_setPadding(SWFTextField field, float padding);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -