prev | index | next

FLASH8 - merger effect
8
24
23567 bytes
1381 bytes
2005-10-19 00:00:00
2007-09-05 14:24:25
Oldes (oliva.david@seznam.cz)


Example of function merge (per-channel blending from a source image to a destination image).

This example is the same like the copyPixels - the diference is, that here is used function merge with random color multipliers.

(swf8-merge.rswf)
background 255.255.255
bmp_picture: bitmap %bitmaps/holky.jpg
exportAssets [bmp_picture "picture"]
es: EmptySprite
picture: place es
doAction [
    bmpSource: flash.display.BitmapData.loadBitmap("picture")
    bmpTarget: make BitmapData! [400 300 false #FFFFFF]
    picture.attachBitmap(bmpTarget 1)
    
    copyPicturePart: func[][
        var rx: -30 + random 370
        var ry: -30 + random 270
        var w:  30 + random 30
        var h:  30 + random 30
        var srcRectangle: make Rectangle! [(rx) (ry) (rx + w) (ry + h)]
        var destPoint: make Point! [
            (rx + 2 - random 4)
            (ry + 2 - random 4)
        ]
        bmpTarget.merge(
            bmpSource       ;sourceBitmap:BitmapData
            srcRectangle    ;sourceRect:Rectangle
            destPoint
            (random 200)    ;redMult:Number
            (random 200)    ;greenMult:Number
            (random 200)    ;blueMult:Number
            50              ;alphaMult:Number
        )
    ]
    copyPicturePart()
    int: setInterval(copyPicturePart 5)
]
showFrame
end