Snapshot within a circle

Paul Hibbert paulhibbert at mac.com
Fri Jan 3 15:28:33 EST 2014


Jim,

I looked at the sample you posted on your site and it already produces a transparent PNG. i.e. Just everything within the area of the black circle if you choose the "Save" option, so you may already have the answer within your stack.
Are you exporting a snap from a group of objects in the "Save" option? that could render a transparent PNG.

If you are still unsure, you could just remove the line:

       export snapshot from rect (rect of  graphic "oval") of this card  to file tPathAndName as PNG

And replace it with:

      lock screen
      create image "tempSnap" -- Keep the export snap within LC to apply a mask
      export snapshot from rect (rect of  graphic "oval") of this card to image "tempSnap" as PNG
      create image "tempMask" -- To use for the alphaData
      export snapShot from grc "Oval" to image "tempMask" as PNG -- Assuming it is opaque
      set the alphaData of img "tempSnap" to the alphaData of img "tempMask" -- Apply the mask
      delete img "tempMask" -- No longer needed
      export image "tempSnap" to file tPathAndName as PNG
      delete img "tempSnap" -- No longer needed
      unlock screen

That should work, but exporting a snapshot from the group would probably be a better way.

Paul



On 2014-01-03, at 10:58 AM, Jim Hurley <jhurley0305 at sbcglobal.net> wrote:

> 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:
> 
> on mouseUp
>  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
> end mouseUp
> 
> Thanks,
> 
> Jim Hurley
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list