Snapshot within a circle
jhurley0305 at sbcglobal.net
Fri Jan 3 13:58:53 EST 2014
I am a volunteer at the local library. They have a program for young children and they want to include my Kaleidoscopic draw program. (They have a bank of 20 computer available to the public. And, by the way, excuse my ignorance, but would it be possible, and legal to put the public version of RunRev on these computers?)
Right now the kids can export a snapshot of their efforts, and they want to be able to post them on the web, Facebook etc. “Look, see what I drew!”
The snapshot is everything within the rect of a black circle of user defined radius and it is exported to Preview (on the Mac).
In Preview the image includes a gray rectangle around the circle.
Right now to clean this up we go to Photoshop and use the magic wand to erase the gray outside the circle.
So, at long last, my question. Is there a way within RunRev, by script, to erase all color pixels outside the circle before sending it off to Preview?
Here is the code (thanks to someone out there, I sorry about forgetting who you are, I’m 81 now with ever diminishing cognitive abilities) to get the image into Preview:
ask "Please name this image." with "Kaleidoscope"
hide group “showhidegroup” —Everything outside the oval rect is hidden.
if it is "" then exit mouseUP
put "/" & it & ".png" into tName
put specialFolderPath ( "desktop") & tName Into tPathAndName
export snapshot from rect (rect of graphic "oval") of this card to file tPathAndName as PNG
launch document tPathANDNAME —That turns out to be Preview on he Mac
show group “showhidegroup” —Show the things previously hidden
More information about the Use-livecode