Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Applying a filter to solid fill
Started by gregmcdo Sep 28 2016 05:49 AM

3 replies to this topic
filter paint solid color displayobject

Best Answer gregmcdo , 20 March 2017 - 03:01 PM

I think the correct solution is to add the DisplayObject a rounded rectangle in this example) with any paint-like fills to a SnapshotGroup and apply the blur effect to the snapshot.  Incidentally, this is also how image effects can be applied to TextObjects.

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

gregmcdo

[GLOBAL: userInfoPane.html]
gregmcdo
  • Observer

  • 9 posts
  • Corona SDK

I would like to blur a shape object filled with solid color.  My code looks like this:

local shape = display.newRoundedRect(
        sceneGroup, 
        0, 
        0, 
        myW, 
        myH, 
        10 )
local paint = { 0.3 }
shape.fill = paint
shape.fill.effect = "filter.blur"    

This is producing no visible change in the display object.  Am I doing something wrong or can these filters just not be applied to solid fills?  Appreciate any help. Thanks.



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 3,934 posts
  • Enterprise

Blurring a solid color won't have a visible effect to the filled area of the object.

 

Are you trying to create soft edges?


  • gregmcdo likes this

[TOPIC: post.html]
#3

gregmcdo

[GLOBAL: userInfoPane.html]
gregmcdo
  • Observer

  • 9 posts
  • Corona SDK

Yes, I'm making objects for drop shadows.  Maybe there's a better way?  I don't want to use image files if I can avoid it.



[TOPIC: post.html]
#4

gregmcdo

[GLOBAL: userInfoPane.html]
gregmcdo
  • Observer

  • 9 posts
  • Corona SDK

  Best Answer

I think the correct solution is to add the DisplayObject a rounded rectangle in this example) with any paint-like fills to a SnapshotGroup and apply the blur effect to the snapshot.  Incidentally, this is also how image effects can be applied to TextObjects.




[topic_controls]
[/topic_controls]



Also tagged with one or more of these keywords: filter, paint, solid, color, displayobject