Draw on an Image Area

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Draw on an Image Area

Post by gepponline » Tue Sep 03, 2013 2:25 pm

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!

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Draw on an Image Area

Post by MaxV » Tue Sep 03, 2013 2:32 pm

Did you read http://www.scribd.com/doc/136198343/LiveCode-userguide ? This PDF is also inside Livecode.
Then just read http://livecode.wikia.com/wiki/Android
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Draw on an Image Area

Post by Simon » Tue Sep 03, 2013 2:42 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Draw on an Image Area

Post by gepponline » Tue Sep 03, 2013 2:56 pm

Yes! it could be a very useful start point. Thank you!

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Draw on an Image Area

Post by gepponline » Tue Sep 03, 2013 2:57 pm

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 :(

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

Re: Draw on an Image Area

Post by Klaus » Tue Sep 03, 2013 3:52 pm

Don't exspect too much, the "paint" tools are still working in 8 bit! 8)

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Draw on an Image Area

Post by Dixie » Tue Sep 03, 2013 8:31 pm

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..
Attachments
Draw.livecode.zip
(1.66 KiB) Downloaded 359 times

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Draw on an Image Area

Post by gepponline » Wed Sep 04, 2013 8:52 am

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?

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

Re: Draw on an Image Area

Post by Klaus » Wed Sep 04, 2013 5:13 pm

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

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Draw on an Image Area

Post by gepponline » Thu Sep 05, 2013 7:18 am

Is there somewhere a table with all object with their properties and definition of them?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Draw on an Image Area

Post by Simon » Thu Sep 05, 2013 7:40 am

Hi gepponline,
In the dictionary select Object from the left column then Graphic.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Draw on an Image Area

Post by gepponline » Thu Sep 05, 2013 8:49 am

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.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Draw on an Image Area

Post by bn » Thu Sep 05, 2013 10:19 am

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Draw on an Image Area

Post by jacque » Thu Sep 05, 2013 5:25 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: Draw on an Image Area

Post by dave_probertGA6e24 » Thu Sep 05, 2013 7:44 pm

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
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

Post Reply