rebol [ title: "FLASH8 - merger effect" type: 'swf8 file: %swf8-merge.swf background: 255.255.255 rate: 24 size: 400x300 author: "Oldes" email: oliva.david@seznam.cz date: 19-10-2005 purpose: {Example of function merge (per-channel blending from a source image to a destination image).} comment: {This example is the same like the copyPixels - the diference is, that here is used function merge with random color multipliers.} compressed: true ] 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