Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Snapshot causes app to slow down.
Started by mimetic Mar 10 2014 05:11 PM

No replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mimetic

[GLOBAL: userInfoPane.html]
mimetic
  • Contributor

  • 161 posts
  • Corona SDK

It took me the 12 hours to figure this out. I decided to replace my old PNG-based drop shadow with a graphics 2.0 version. Below is the code.

 

However, anything rendering ABOVE it seems to cause it to render again even though I am not asking that to happen! I use it behind another group, behind a slider, and the slider slows to molasses!

 

Help?

 

 

local function buildShadowNew(w,h,sw,opacity)

	sw = sw or 20
	local shadow = display.newSnapshot( w + 2*sw, h + 2*sw )
	
	opacity = opacity or OPAQUE
	opacity = applyPercent( opacity, OPAQUE)

	-- Start with a solid rect
	local srect = display.newRect(0,0,w + 1*sw,h + 1*sw)
	-- Alpha visually matches the graphic pieces. Probably we should use another graphic
	srect:setFillColor( 0,0,0, opacity )
	
	shadow.group:insert(srect)
	
	shadow.fill.effect = "filter.blurGaussian"
	shadow.fill.effect.horizontal.blurSize = sw
	shadow.fill.effect.horizontal.sigma = 140
	shadow.fill.effect.vertical.blurSize = sw
	shadow.fill.effect.vertical.sigma = 140

	--shadow.fill.effect = "filter.blur"

	return shadow

end

 




[topic_controls]
[/topic_controls]