Draw a line inside of an existing image

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
septic
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7
Joined: Sun Jun 28, 2009 11:53 am

Draw a line inside of an existing image

Post by septic » Sat Mar 24, 2012 8:44 pm

This should be easy, but I'm puzzled....

I have an image, and I want to draw a simple line (with my penColor, penHeight end penWidth) inside the same image object. How do I do this with code?

I dont want to fiddle with the imageData... way too complicated.
Overlaying a graphic with a line on the image and than taking a snapshot could work but I do not like this idea.

I'm looking for something like:
choose line tool
draw a line from 0,0 to 50,50 inside image id 1 <-- I'm missing this command

Any suggestions?
Thanks.
Mario

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Draw a line inside of an existing image

Post by jmburnod » Sat Mar 24, 2012 11:50 pm

Hi Mario

You can draw with the pencil too like that

Code: Select all

on mouseUp
   choose pencil tool
   drag from 0,0 to 50,50 -- All points must be inside the image
end mouseUp
Best regards

Jean-Marc
https://alternatic.ch

septic
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7
Joined: Sun Jun 28, 2009 11:53 am

Re: Draw a line inside of an existing image

Post by septic » Sun Mar 25, 2012 10:16 am

Great Jean-Marc!
I completely missed the drag command!

This work perfectly:

Code: Select all

on mouseUp
   set the penColor to "green"
   set the penHeight to 5
   set the penWidth to 5
   choose line tool
   drag from 0,0 to 50,50  -- in an existing image, of course
   choose browse tool
end mouseUp
Thanks for the help.
Mario

Post Reply