Drawing tools (now moved to the correct forum!)

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Drawing tools (now moved to the correct forum!)

Post by Andycal » Wed Feb 27, 2008 12:20 pm

Just had a look around on the forums and someone pointed to an excellent resource, albeit in Japanese for some example stacks that you can draw on an image with.
(http://www.kenjikojima.com/runrev/handbook/download/ - 015, 016, 017)

However, I can't make head nor tail of them.

Reading the scripts, it looks like this should work:

Code: Select all

    
choose pencil tool 
set the pencolor to "black" 
 
I get the pencil tool, but it doesn't draw anything. Also, in the example scripts, he manages to get it to draw just on the image, not the whole card.

Can anyone shed any light? [/code]

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Feb 27, 2008 7:35 pm

Hi Andy,

you cannot paint directly on a card!

Create a new (empty) image and start painting happily :-)

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Wed Feb 27, 2008 8:19 pm

Hi Klaus,

Thanks for that. I thought I'd done that actually, but it won't paint on anything. I set the pen colour, but nothing happens.

The pen just stays a pen with no apparent way of stopping it.

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Feb 28, 2008 2:44 pm

Hi Andy,

hmm, works here as described!

I created a new image and a button with your script and could paint in black on the image...

You can only change the tool in a palette window, sorry!


Best

Klaus

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Thu Feb 28, 2008 2:57 pm

You can only change the tool in a palette window, sorry!
Ahhhhh!.....

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Thu Feb 28, 2008 3:20 pm

Me again. Are you saying that the stack with the image in it needs to be a palette or the stack where you press the button needs to be a palette?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Feb 28, 2008 3:30 pm

The latter one, the palette is needed to change the tool!

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Thu Feb 28, 2008 4:26 pm

OK. I'm sure I'm doing something really stupid here 'cos it looks easy but it just 'aint working!!!

I've got a mainstack that opens up and allows me to press a button to get a screen grab. It then exports this to a file and opens up a substack.

The substack opens up the file and displays it in the middle of the stack. All good so far.

I've put a button on this stack that does this:

Code: Select all

on mouseUp pMouseBtnNo
    open stack "pal"
    palette stack "pal"
end mouseUp
This opens up the 'Pal' stack that has just one button on it that does this:

Code: Select all

on mouseUp pMouseBtnNo
    choose pencil tool
    set pencolor to "black"
end mouseUp
If I press this button it turns it into a pencil when I move onto the previous substack (the one with the image in it), however, it doesn't let me draw anything.

What am I doing wrong here?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Feb 28, 2008 4:46 pm

You can only paint on internal (imported) images and NOT on referenced ones!
Are setting the filenmae of your image to the (screenshot) file?
Maybe that is you problem...


AND you should add another button to your palette!!!!

Code: Select all

on mouseup
  choose browse tool
end mouseup
Or your user must use the pencil tool until doomsday :-)

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Thu Feb 28, 2008 5:08 pm

Klaus wrote:You can only paint on internal (imported) images and NOT on referenced ones!
Are setting the filenmae of your image to the (screenshot) file?
Maybe that is you problem...
Ahh, yes. I'm setting the image to the screenshot file. So I'm guessing I need to import rather than change the filename? And then when imported, how do I put this on the screen?

Sorry about all the questions but sometimes RunRev is amazingly simple and other times it leaves me tearing my hair out with its strange methods!

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Feb 28, 2008 7:58 pm

Hi Andy,

since you probably already have an image on your card, you can easily "fill" it with the content of the image file on disk:

Code: Select all

...
put url("binfile:path/to/your/image.jpg") into img "Name of your image here")
...
That's it :-)

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Thu Feb 28, 2008 9:20 pm

Klaus, next time I'm at the Oktoberfest, I'll buy you a beer!

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Feb 28, 2008 9:23 pm

Hi Andy,

thanks a lot, but that's about 600 km away from my home!
But if you ever come to or near Cologne, drop a line :-)

Post Reply