prev | index | next

FLASH8 - Flood fill
8
12
20826 bytes
1800 bytes
2005-10-13 00:00:00
2005-10-18 18:17:24
Oldes (oliva.david@seznam.cz)


To test possibillity of use floodFill on bitmaps.

I'm using to drawings - one with 1px edges and the second one with 3px edges to mask the unwanted effects on the edge after filling. Use the color picker to change the fill color. The used drawing is taken from logo of the NewMediaArt festival in Brno (BRNO ZOOM 2005)

(swf8-floodfill.rswf)
background 255.255.255

require %includes/gui-colorpallet.rswf

spr_bzoom1: sprite [import-swf %includes/bzoom1.swf]
spr_bzoom2: sprite [import-swf %includes/bzoom2.swf]

spr_picture: sprite [
    es: EmptySprite
    bzoombmp: place es [at -50x-137 actions [
        load [clr: #FF0000]
        press  [
            this._parent.bmpPicture.floodFill(this._xmouse this._ymouse clr)
        ]
    ]]
    bzoom1: place spr_bzoom1  at -30x-117 
    bzoom2: place spr_bzoom2 [at -31x-118 actions [press[]]]

    doAction [
        bmpPicture: make BitmapData! [
            (bzoom1._width  + 40)
            (bzoom1._height + 40)
            false #FFFFFF
        ]
        bzoombmp.attachBitmap(bmpPicture 1)
        matrix: make Matrix! []
        matrix.translate(20 20)
        ctrans: make ColorTransform! [1 1 1 1 0 0 0 0]
        bmpPicture.draw(bzoom1 matrix ctrans "normal" bzoom1.drawrect false)
        bzoom1._visible: false
    ]
    showFrame end
]
picture: place spr_picture
pallet:  place spr_pallet at 0x360

doAction [
;   picture._x: (Stage.width - picture._width) / 2
    pallet._x:  (Stage.width - pallet._width) / 2
    pallet.onGetColor: func[clr][
        this._parent.picture.bzoombmp.clr: clr
    ]
    myShadow: make DropShadowFilter![3 45 #000000 0.5 4 4 2 2]
    pallet.filters: [myShadow]
]
showFrame
end