Paint Tools

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
emmefisch
Posts: 27
Joined: Thu Jul 23, 2009 2:50 am

Paint Tools

Post by emmefisch » Sun Jan 02, 2011 2:43 pm

Is there a possibility to "record" the work done with the paint tools and get the code for that? Thanks for any idea.
I like to fill some parts of a picture programmaticaly.
Best
Fredi

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Paint Tools

Post by Mark » Mon Jan 03, 2011 12:38 pm

Hi Fredi,

You might be able to use a frontscript (mouseDown handler) to record clicks and tools. This will work with the graphics tools, not with the image/paint tools.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

fredigertsch
Posts: 38
Joined: Mon Jan 03, 2011 5:42 pm

Re: Paint Tools

Post by fredigertsch » Mon Jan 17, 2011 3:28 pm

Thanks Mark.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Paint Tools

Post by dunbarx » Mon Jan 17, 2011 6:22 pm

Try these. There are certainly others you can use to get the starting and ending locs of anything you do, and the tools and targets you choose.

on mouseDown
put the target
end mouseDown

This will work in either the tools palette or your working stack.

on mousemove x,y
put the tool && x && y
end mousemove

This will give you a start on your drawing data. I bet you can make a "macro" recording of all your actions.

Craig Newman

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Paint Tools

Post by Mark » Mon Jan 17, 2011 6:24 pm

Hi Craig,

Have you actually tried that? I couldn't get it to work.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Paint Tools

Post by dunbarx » Mon Jan 17, 2011 7:22 pm

Mark.

Yes. I placed the handlers into a card script, and inserted the card script into front, per your suggestion.

Craig

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Paint Tools

Post by Mark » Mon Jan 17, 2011 7:26 pm

Hi Craig,

Maybe I wasn't clear. I mean, did it also work for the paint tools, or only for the graphics and other tools?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Paint Tools

Post by dunbarx » Mon Jan 17, 2011 8:20 pm

Mark.

Yes. I get a "bucket", or a "spray can" when I click on those tools. This is from the mouseDown handler.

And it is very important to pass mouseDown, I now see, or you will cripple ordinary tool selection methods.

I made a fld "gg" on a card (id 12821) so I could track the tool names:

on mouseDown
put the target & return after fld "gg" of cd id 12821 of stack "test1"
pass mouseDown
end mouseDown

Craig

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

Re: Paint Tools

Post by bn » Mon Jan 17, 2011 8:42 pm

Hi Craig, Mark,

I dont get the mouseMove to work if there is painting going on.
This does record coordinates and the tool if put into an image object.

Code: Select all

local sRecord

on mouseEnter
   put the tool into tTool
   put tTool && the milliseconds
   if tTool is among the items of "pencil tool,bucket tool,brush tool,eraser tool,spray tool,line tool,curve tool" then
      put true into sRecord
      send trackMe to me in 10 milliseconds
   end if
end mouseEnter

on trackMe
   if sRecord then
      if the mouse Is Down then
         put the tool && the mouseLoc && the milliseconds
      end if
      if trackMe is not in the pendingMessages then
         send trackMe to me in 10 milliseconds
      end if
   end if
end trackMe

on mouseLeave
   put false into sRecord
end mouseLeave
Whether you can redo everything you want from this recording is an other question.

Kind regards

Bernd

Post Reply