Worklog for Qweeg

Worklog 1

Return to Worklogs

Flood Fill - the solution(Posted 2006-03-24)
As usual the user community come up trumps - special thanks to Tonyg (who always seems to be helping me out); Curtastic; and ENAY.

tonyg supplied me with code from snarty - which runs much quicker than mine. The only problem with it was that I found it a little difficult to follow. So I went back to the archives and found this BB snippet by Jim Brown, which seemed similar but a little more straightforward for me to follow:

http://www.blitzbasic.com/codearcs/codearcs.php?code=151

So I converted this code to Max, It uses an array rather than a TList, but actually seems to run a little quicker than the snarty code, so for now I think this will do the job. I might look at converting Curtastic's code to Max at some point to compare, but since I have something that works now I think I will move on.

Here is the converted code:



Next up I think I will take a look at the gui interface next and start trying to pull the code I have done into something more usable. Good excuse to spend some time with the GUI module too.


Flood Fill Frolic(Posted 2006-03-24)
Now I have the basis for applying effect filters to images, next up is printables and colouring. Basically I think I will put in a few black and white line drawings and a colour pallette and allow the user to choose a colour and click areas of the pictures to fill them in that colour. But to do that I need a flood fill routine...

Now here's where things get tricky - my first effort at this did actually work but ran like a dog. The problem was I was filling a pixel then checking its neighbours and in turn their neighbours etc. Whilst this works it means each pixel could get check multiple times - and this just slows the thing down to a crawl.

After banging my head against a wall for a while I decide its time to seek some help...


pixmap and stuff(Posted 2006-03-20)
Okay. Dug out some old DBPro code I did ages ago and decided to try and adapt it to Blitzmax. The DB code used Memblocks, so the plan is to convert to use Pixmaps instead.

And voila it works! Not the quickest code in the world, and probably been done before - but hey, the kids think its cool.

For anyone that is interested here is the code I have at the moment. There are 12 effects (well 11 as one is the original image), accessed via the function keys. If you want to try it out you will need to substitute the image for one of your own. Be patient - particularly with F10 and F11 - they are a little slow, but I am actually quite pleased with some of the effects. There are loads more too, but I ran out of function keys - need to use a list item in the GUI module I think, and try out drag and drop windows maybe - hmm, maybe that's for another day (probably best if I tidy up the code I have already written too :) ).




Special Effects with Pixmaps(Posted 2006-03-20)
At the request of my two daughters I have decided to try and cobble together a painting program/game for them. Probably this will have some sort of click and colour pictures for them to work with, and some special effects that can be applied to pictures or photos. Obviously there are loads of programs that do this already, but my kids like to play with the things I code and it will also give me some experience with pixmaps and the GUI module.

First up, manipulating images using pixmaps...