Computer Science Canada [Snippit] Paint - the hard stuff |
Author: | TheZsterBunny [ Mon Feb 07, 2005 7:47 pm ] | ||
Post subject: | [Snippit] Paint - the hard stuff | ||
This is sort of an experiment. Recently, there has been a spate of paint program projects, each asking questions about various same aspects. Here, the hardest parts of paint (bucket and spray can) in easy to understand procedural form. -Z
I'm sure theres a faster way to do the can. Any ideas? |
Author: | Viper [ Tue Feb 08, 2005 12:59 pm ] |
Post subject: | |
well a really easie and fast way would be to have it draw a box the size of the paint area eg if key ("c") then drawfillbox (100,100,700,1000) end if |
Author: | Delos [ Tue Feb 08, 2005 3:29 pm ] | ||
Post subject: | |||
I take it you don't understand the point of the fill function then. This is not a case where you are drawing a box...not necassarily of course. Here, the 'bucket' draws a indeterminate shape - it simply fills the area occupied by a consitent colour. Try it out in Paint. However, your idea does have its merits to it...but in a completely different implementation involving transparent colours and such... EDIT: Here's my idea. It works on the premise that you know the area of your pic that you want to edit. It also assumes that there is a particular colour within that area that you want replaced. This could be down w/ whatdotcolour, but would be a lot slower.
As you can see, this snippet replaces all the Red in the mainPic to Black. Useful. |
Author: | TheZsterBunny [ Tue Feb 08, 2005 8:12 pm ] |
Post subject: | |
Thats nice ^_^ however, it can replace all the existing color in the paint. Useful if you're going to be doing some fading stack overflow errors in mine. maybe the trick would be to try bigger blocks first... -Z |