Page 1 of 1
Draw on an Image Area
Posted: Tue Sep 03, 2013 2:25 pm
by gepponline
Hi!
I've just get in touch wth Livecode and it seems to me a very good tool to develop application so I'm trying to learn it focused on simple android application.
So, I'm trying to make an app that draw line an an Image area when the mouse is down on that area.
Then 3 buttons to select color.
First of all, I need an image area control or i can draw everywhere in the stack?
No help about what i want to do in official tutorials
I was looking for command to draw but i could not found them.
Can anyone help me on this application?
I need to know:
- how to get mouse coordinates
- how to draw line or points at that coordinates
- how to change points color.
and last step...
- how to play sounds
It should be something like "Baby Games" android app from SwanApps (unfortunately I can't post link to that app)
thank you!
Re: Draw on an Image Area
Posted: Tue Sep 03, 2013 2:32 pm
by MaxV
Re: Draw on an Image Area
Posted: Tue Sep 03, 2013 2:42 pm
by Simon
Here is a recent example:
http://forums.runrev.com/viewtopic.php? ... 43&p=84792
Still more for you to do, but it's a start.
Simon
Re: Draw on an Image Area
Posted: Tue Sep 03, 2013 2:56 pm
by gepponline
Yes! it could be a very useful start point. Thank you!
Re: Draw on an Image Area
Posted: Tue Sep 03, 2013 2:57 pm
by gepponline
Thanks but MaxV for the moment i don't need to develop an android application but only replicate the functioning on a PC.
On the user guide nothing about how to use graphic

Re: Draw on an Image Area
Posted: Tue Sep 03, 2013 3:52 pm
by Klaus
Don't exspect too much, the "paint" tools are still working in 8 bit!

Re: Draw on an Image Area
Posted: Tue Sep 03, 2013 8:31 pm
by Dixie
Hi
This app was written using liveCode...
https://itunes.apple.com/us/app/skribbl ... 45290?mt=8
The basics that I used can be seen in the attached stack... I chose to use the line tool, not a polygon..
Re: Draw on an Image Area
Posted: Wed Sep 04, 2013 8:52 am
by gepponline
Hi Dixie!
nice app.
Where did you find documentation on how to use these commands?
And..
I have a quetsion:
"set the points of grc "draw" to the points of grc "draw" & cr & the mouseLoc"
which kind of object is "the point"? how do i build a correct value to pass to it?
Re: Draw on an Image Area
Posted: Wed Sep 04, 2013 5:13 pm
by Klaus
Hi gepponline,
"the points" is a property of the graphic object!
Check "points" in the dictionary to get more info:
...
Value
The points of a graphic is a list of points (two integers separated by a comma), one per line.
...
Best
Klaus
Re: Draw on an Image Area
Posted: Thu Sep 05, 2013 7:18 am
by gepponline
Is there somewhere a table with all object with their properties and definition of them?
Re: Draw on an Image Area
Posted: Thu Sep 05, 2013 7:40 am
by Simon
Hi gepponline,
In the dictionary select Object from the left column then Graphic.
Simon
Re: Draw on an Image Area
Posted: Thu Sep 05, 2013 8:49 am
by gepponline
ok..maybe my problem is with the name.
This is the description of point:
"specifies where the vertexes of a graphic are located."
How could i find that this property draw a point in the graphic? The description seems to me that it only set coordinates.
I think i should work a lot with it...Tutorials are not complete for many arguments.
Re: Draw on an Image Area
Posted: Thu Sep 05, 2013 10:19 am
by bn
Hi gepponline,
here is a stack on revOnline, LivecodeShare I made some years ago.
http://livecodeshare.runrev.com/stack/3 ... on-Graphic
If I understand you correctly it does what you want and then some.
It has probably more features than you want. But you can play with them and see the code.
Just as you should study Dixie's code how he does what he does. It will help you with many questions.
Kind regards
Bernd
Re: Draw on an Image Area
Posted: Thu Sep 05, 2013 5:25 pm
by jacque
gepponline wrote:ok..maybe my problem is with the name.
This is the description of point:
"specifies where the vertexes of a graphic are located."
How could i find that this property draw a point in the graphic? The description seems to me that it only set coordinates.
I think i should work a lot with it...Tutorials are not complete for many arguments.
A point is what the dictionary describes. There is also an entry for "points" (with an "s") which is a return-delimited list of individual point(s). With the "s", it refers to the different vertices of a graphic. You'll find both entries in the dictionary.
Re: Draw on an Image Area
Posted: Thu Sep 05, 2013 7:44 pm
by dave_probertGA6e24
Hi all,
I think gepponline is getting confused with 'points in a graphic' and 'pixels in an image'. Even though a graphic is an image in english terms, the programming context of them is different.
gepponline, there is no command (that I know of) that will set a pixel in an image at runtime (currently!). You would have to create a command to do that yourself (or find one in a tutorial or on this forum).
A graphic in Livecode is a 'vector shape', whereas an image is a 'bitmap array'. Google the terms if you are not sure of the difference
You could use the examples given to draw the vector graphics and then use the 'snapshot' command to grab that graphic as a bitmap image - with that you can 'draw' over another image with relative ease. There are examples of doing this in various places mentioned on the forum.
Hope that helps a bit.
Cheers,
Dave