prev | index | next

FLASH8 - merger effect (v2)
8
24
23627 bytes
1419 bytes
2005-10-19 00:00:00
2007-09-05 14:24:35
Oldes (oliva.david@seznam.cz)


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

Same like the previous merge example but with one bitmap over with the "lighten blend"

(swf8-merge2.rswf)
background 255.255.255
bitmaps images [bmp_picture:  %bitmaps/holky.jpg]
spr_picture: sprite img_picture
exportAssets [bmp_picture "picture"]
es: EmptySprite
picture: place es
picture2: place spr_picture [at 0x0 blend "lighten"]

doAction [
    bmpSource: flash.display.BitmapData.loadBitmap("picture")
    bmpTarget: make BitmapData! [400 300 false #FFFFFF]
    picture.attachBitmap(bmpTarget 1)
    
    copyPicturePart: func[][
        var rx: -50 + random 370
        var ry: -50 + random 270
        var w:  40 + random 100
        var h:  40 + random 100
        var srcRectangle: make Rectangle! [(rx) (ry) (rx + w) (ry + h)]
        var destPoint: make Point! [
            (rx + 30 - random 60)
            (ry + 30 - random 60)
        ]
        bmpTarget.merge(
            bmpSource    ;sourceBitmap:BitmapData
            srcRectangle ;sourceRect:Rectangle
            destPoint
            (random 20) ;redMult:Number
            (random 20) ;greenMult:Number
            (random 20) ;blueMult:Number
            100         ;alphaMult:Number
        )
    ]
    copyPicturePart()
    int: setInterval(copyPicturePart 5)
]
showFrame
end