blur a background

Jan Schenkel janschenkel at yahoo.com
Fri Aug 30 01:25:31 EDT 2013


Hi Chris,

Here's a trick I used a while back: make a snapshot of the card, then scale the image down, then scale it up again.

Simple recipe to try it out:
- create a new stack and drag random controls onto it
- drag on a button and set its script to
##
constant kBlurFactor = 2
on mouseUp
   local tBlurredImage
   put the long id of image "BlurredImage" into tBlurredImage
   set the lockLocation of tBlurredImage to false
   export snapshot from this card to image "BlurredImage" as PNG
   set the lockLocation of tBlurredImage to true
   set the height of tBlurredImage to the height of tBlurredImage div kBlurFactor
   set the width of tBlurredImage to the width of tBlurredImage div kBlurFactor
   export snapshot from image "BlurredImage" to image "BlurredImage" as PNG
   set the rect of tBlurredImage to (0,0,the width of this card,the height of this card)
   show tBlurredImage
end mouseUp
##
- drag on an image; set its name to "BlurredImage", set its resizeQuality to Best and set its script to
##
on mouseUp
   hide me
end mouseUp
##
-> maybe also turn on its colorOverlay and tweak the settings

It's not a gaussian blur, but it's good enough and quicker to execute than a scipt that fiddles with imageData.


HTH,

Jan Schenkel.
 
=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com


=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


>________________________________
> From: Chris Sheffield <cmsheffield at icloud.com>
>To: How to use LiveCode <use-livecode at lists.runrev.com> 
>Sent: Thursday, August 29, 2013 6:45 PM
>Subject: blur a background
> 
>
>Is there any way in LC to set a graphic effect such that everything behind is blurred, much like we see in mobile apps? I need to do something like this and am not sure how. If it's not possible, can something be done to an image to create this effect, and then have that image imported into an LC stack?
>
>Thanks,
>Chris
>
>
>--
>Chris Sheffield
>Read Naturally, Inc.
>www.readnaturally.com
>
>
>_______________________________________________
>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