Cannot get this floodfill to work

I had trouble getting this floodfill to work. Could anybody with experience please help?

https://www.dropbox.com/s/xoutl0sv2wdvjwz/test.xojo_binary_project?dl=0

Left click on the image to change it and right click to floodfill the pixel at coordinates 0, 0.

Thanks

if there is no picture it crashes on left click

what should happen with the picture?

insert ‘if me.Image <> nil then’ in Mousedown

.....
    if f <> nil then
      ME.IMAGE = PICTURE.OPEN(F)
    end if
  else
    if me.Image <> nil then
      dim origPic as picture = me.image
      dim floodfillmask as picture = origPic.copymask
.....

What exactly are you trying to accomplish with this? I’ve downloaded the project and taken a quick look through the floodfill code - and can’t tell what you expect the final result to be. Big black square? Inverted color map for the loaded image?

In short, when I load an image and then click to floodfill, what do you expect I should see next?

[quote=141080:@Axel Schneider]if there is no picture it crashes on left click

what should happen with the picture?

insert ‘if me.Image <> nil then’ in Mousedown

..... if f <> nil then ME.IMAGE = PICTURE.OPEN(F) end if else if me.Image <> nil then dim origPic as picture = me.image dim floodfillmask as picture = origPic.copymask ..... [/quote]
Just a quick test. But thanks anyway.

[quote=141083:@Kimball Larsen]What exactly are you trying to accomplish with this? I’ve downloaded the project and taken a quick look through the floodfill code - and can’t tell what you expect the final result to be. Big black square? Inverted color map for the loaded image?

In short, when I load an image and then click to floodfill, what do you expect I should see next?[/quote]
I am trying to floodfill with alpha mask support so you can floodfill over a fully transparent area.
Thanks

When I try this with a .jpg, this line:

dim floodfillmask as picture = origPic.copymask
results in nil for floodfillmask. If the mask is nil, then your floodfill won’t ever work the way you expect it to… (though I’m still unclear about what you are trying to do).

[quote=141094:@Kimball Larsen]When I try this with a .jpg, this line:

dim floodfillmask as picture = origPic.copymask
results in nil for floodfillmask. If the mask is nil, then your floodfill won’t ever work the way you expect it to… (though I’m still unclear about what you are trying to do).[/quote]
This project is just a test.

For my project, I am making an image editor. It has a fill bucket tool. I have very easily achieved making it fill areas which are not fully transparent but not for transparent areas.

Thanks