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

📄 ming.py

📁 flash swf file player
💻 PY
📖 第 1 页 / 共 2 页
字号:
import mingc# should raise an exception if return is non-zero:mingc.Ming_init()def Ming_setCubicThreshold(t):    mingc.Ming_setCubicThreshold(t);def Ming_setScale(scale):    mingc.Ming_setScale(scale);def Ming_useSWFVersion(num):    mingc.Ming_useSWFVersion(num);class SWFBase:    def __init__(self, o):        self.this = o    # reportedly useful for zope/zwiff:    def set(self, name, val):        setattr(self, name, val)class SWFRect(SWFBase):    def __init__(self, minX, maxX, minY, maxY):        self.this = mingc.newSWFRect(minX, maxX, minY, maxY)    def __del__(self):        mingc.destroySWFRect(self.this)    def getWidth(self):        return mingc.SWFRect_getWidth(self.this)    def getHeight(self):        return mingc.SWFRect_getHeight(self.this)class SWFShape(SWFBase):    def __init__(self, o=None):        self.fills = []        if o is None:            self.this = mingc.newSWFShape()        else:            self.this = o    def __del__(self):        mingc.destroySWFShape(self.this)    def setLine(self, width, r, g, b, a=0xff):        return mingc.SWFShape_setLine(self.this, width, r, g, b, a)    # I know there's probably a better way to do this..    def addFill(self, arg1, arg2=0, arg3=None, arg4=0xff):        if arg3 != None:            return SWFFill(mingc.SWFShape_addSolidFill(self.this, arg1, arg2, arg3, arg4))        if arg1.this[-11:] == 'SWFGradient':            # XXX - have to keep reference to gradient so it's not disposed            self.fills.append(arg1)            return SWFFill(mingc.SWFShape_addGradientFill(self.this, arg1.this, arg2))        if arg1.this[-9:] == 'SWFBitmap':            # XXX - have to keep reference to bitmap so it's not disposed            self.fills.append(arg1)            return SWFFill(mingc.SWFShape_addBitmapFill(self.this, arg1.this, arg2))        else:            raise AttributeError, "bad argument to SWFShape::addFill"    def setLeftFill(self, fill):        mingc.SWFShape_setLeftFill(self.this, fill)    def setRightFill(self, fill):        mingc.SWFShape_setRightFill(self.this, fill)    def movePenTo(self, x, y):        mingc.SWFShape_movePenTo(self.this, x, y)    def movePen(self, x, y):        mingc.SWFShape_movePen(self.this, x, y)    def drawLineTo(self, x, y):        mingc.SWFShape_drawLineTo(self.this, x, y)    def drawLine(self, dx, dy):        mingc.SWFShape_drawLine(self.this, dx, dy)    def drawRect(self, rect):        mingc.SWFShape_drawRect(self.this, rect.this);    def drawArc(self, x, y, r, startAngle, endAngle):        mingc.SWFShape_drawArc(self.this, x, y, r, startAngle, endAngle)    def drawCircle(self, r):        mingc.SWFShape_drawCircle(self.this, r)    def drawCurveTo(self, bx, by, cx, cy, dx=None, dy=None):        if(dx != None):            mingc.SWFShape_drawCubicTo(self.this, bx, by, cx, cy, dx, dy)        else:            mingc.SWFShape_drawCurveTo(self.this, bx, by, cx, cy)    def drawCurve(self, bx, by, cx, cy, dx=None, dy=None):        if(dx != None):            mingc.SWFShape_drawCubic(self.this, bx, by, cx, cy, dx, dy)        else:            mingc.SWFShape_drawCurve(self.this, bx, by, cx, cy)    def drawCubicTo(self, bx, by, cx, cy, dx, dy):        mingc.SWFShape_drawCubicTo(self.this, bx, by, cx, cy, dx, dy)    def drawCubic(self, bx, by, cx, cy, dx, dy):        mingc.SWFShape_drawCubic(self.this, bx, by, cx, cy, dx, dy)    def drawGlyph(self, font, char, size=0):        mingc.SWFShape_drawSizedGlyph(self.this, font.this, ord(char[0]), size)    def drawCharacterBounds(self, char):        mingc.SWFShape_drawCharacterBounds(self.this, char.this)    def end(self):        mingc.SWFShape_end(self.this)    # deprecated:    def moveTo(self, x, y):        mingc.SWFShape_moveTo(self.this, x, y)    def lineTo(self, x, y):        mingc.SWFShape_lineTo(self.this, x, y)    def lineToRelative(self, dx, dy):        mingc.SWFShape_lineToRelative(self.this, dx, dy)    def curveTo(self, controlx, controly, anchorx, anchory):        mingc.SWFShape_curveTo(self.this, controlx, controly, anchorx, anchory)    def curveToRelative(self, controldx, controldy, anchordx, anchordy):        mingc.SWFShape_curveToRelative(self.this, controldx, controldy,                                       anchordx, anchordy)    def addSolidFill(self, r, g, b, a=0xff):        return mingc.SWFShape_addSolidFill(self.this, r, g, b, a)    def addGradientFill(self, gradient, flags):        return mingc.SWFShape_addGradientFill(self.this, gradient.this, flags)    def addBitmapFill(self, bitmap, flags):        return mingc.SWFShape_addBitmapFill(self.this, bitmap.this, flags)# addFill flags:SWFFILL_LINEAR_GRADIENT = mingc.SWFFILL_LINEAR_GRADIENTSWFFILL_RADIAL_GRADIENT = mingc.SWFFILL_RADIAL_GRADIENTSWFFILL_TILED_BITMAP    = mingc.SWFFILL_TILED_BITMAPSWFFILL_CLIPPED_BITMAP  = mingc.SWFFILL_CLIPPED_BITMAPclass SWFFill(SWFBase):    def __init__(self, o):        self.this = o    def __del__(self):        mingc.destroySWFFill(self.this)    def rotateTo(self, degrees):        mingc.SWFFill_rotateTo(self.this, degrees)    def moveTo(self, x, y):        mingc.SWFFill_moveTo(self.this, x, y)    def scaleTo(self, xScale, yScale=None):        if yScale is None:            mingc.SWFFill_scaleXYTo(self.this, xScale, xScale)        else:            mingc.SWFFill_scaleXYTo(self.this, xScale, yScale)    def scaleXTo(self, xScale):        mingc.SWFFill_scaleXTo(self.this, xScale)    def scaleYTo(self, yScale):        mingc.SWFFill_scaleYTo(self.this, yScale)    def skewXTo(self, x):        mingc.SWFFill_skewXTo(self.this, x);    def skewYTo(self, y):        mingc.SWFFill_skewYTo(self.this, y)class SWFDisplayItem(SWFBase):    def rotate(self, degrees):        mingc.SWFDisplayItem_rotate(self.this, degrees)    def rotateTo(self, degrees):        mingc.SWFDisplayItem_rotateTo(self.this, degrees)    def move(self, x, y):        mingc.SWFDisplayItem_move(self.this, x, y)    def moveTo(self, x, y):        mingc.SWFDisplayItem_moveTo(self.this, x, y)    def scale(self, xScale, yScale):        mingc.SWFDisplayItem_scale(self.this, xScale, yScale)    def scaleTo(self, xScale, yScale):        mingc.SWFDisplayItem_scaleTo(self.this, xScale, yScale)    def skewX(self, x):        mingc.SWFDisplayItem_skewX(self.this, x)    def skewXTo(self, x):        mingc.SWFDisplayItem_skewXTo(self.this, x);    def skewY(self, y):        mingc.SWFDisplayItem_skewY(self.this, y)    def skewYTo(self, y):        mingc.SWFDisplayItem_skewYTo(self.this, y)    def setMatrix(self, a, b, c, d, x, y):        mingc.SWFDisplayItem_setMatrix(self.this, a, b, c, d, x, y)    def setName(self, name):        mingc.SWFDisplayItem_setName(self.this, name)    def setRatio(self, ratio):        mingc.SWFDisplayItem_setRatio(self.this, ratio)    def getDepth(self):        return mingc.SWFDisplayItem_getDepth(self.this)    def setDepth(self, depth):        mingc.SWFDisplayItem_setDepth(self.this, depth)    def addColor(self, r, g, b, a=0):        mingc.SWFDisplayItem_setColorAdd(self.this, r, g, b, a)    def multColor(self, r, g, b, a=1.0):        mingc.SWFDisplayItem_setColorMult(self.this, r, g, b, a)    def remove(self):        mingc.SWFDisplayItem_remove(self.this)    # methods to retrieve item position data    # added by David McNab <david@rebirthing.co.nz>    def get_x(self):        """        Returns the display item's current x position        """        return mingc.SWFDisplayItem_get_x(self.this)    def get_y(self):        """        Returns the display item's current y position        """        return mingc.SWFDisplayItem_get_y(self.this)    def get_xScale(self):        """        Returns the display item's current x scale        """        return mingc.SWFDisplayItem_get_xScale(self.this)    def get_yScale(self):        """        Returns the display item's current y scale        """        return mingc.SWFDisplayItem_get_yScale(self.this)    def get_xSkew(self):        """        Returns the display item's current x skew        """        return mingc.SWFDisplayItem_get_xSkew(self.this)    def get_ySkew(self):        """        Returns the display item's current y skew        """        return mingc.SWFDisplayItem_get_ySkew(self.this)    def get_rot(self):        """        Returns the display item's current rotation (in degrees)        """        return mingc.SWFDisplayItem_get_rot(self.this)class SWFMovie(SWFBase):    def __init__(self):        self.this = mingc.newSWFMovie()        self.blocks = []    def __del__(self):        mingc.destroySWFMovie(self.this)    def setRate(self, rate):        mingc.SWFMovie_setRate(self.this, rate)    def setDimension(self, x, y):        mingc.SWFMovie_setDimension(self.this, x, y)    def setBackground(self, r, g, b):        mingc.SWFMovie_setBackground(self.this, r, g, b)    def setFrames(self, totalFrames):        mingc.SWFMovie_setNumberOfFrames(self.this, totalFrames)    # or:    def setNumberOfFrames(self, totalFrames):        mingc.SWFMovie_setNumberOfFrames(self.this, totalFrames)    def nextFrame(self):        mingc.SWFMovie_nextFrame(self.this)    def add(self, block):        self.blocks.append(block)        return SWFDisplayItem(mingc.SWFMovie_add(self.this, block.this))    def remove(self, item):        mingc.SWFMovie_remove(self.this, item.this)    def streamMp3(self, mp3):        sound = SWFSoundStream(mp3)        self.blocks.append(sound)        mingc.SWFMovie_setSoundStream(self.this, sound.this)    def setSoundStream(self, sound):        self.blocks.append(sound)        mingc.SWFMovie_setSoundStream(self.this, sound.this);    def output(self):        return mingc.SWFMovie_simpleOutput(self.this)    def save(self, filename, level=0):        mingc.SWFMovie_save(self.this, filename, level)    def saveToFile(self, file, level=0):        mingc.SWFMovie_saveToFileNo(self.this, file.fileno(), level)    def labelFrame(self, label):

⌨️ 快捷键说明

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