Overlay Blend Mode

Hi guys,

I am trying to accomplish a photoshop style overlay blend mode. And thus I was wondering if there is a way to use the composite.overlay effect on a combination of a display object and an image. Right now, as I understand it, a composite effect requires two images? However, I am planning on using one image and one display object (lets say display.newCircle). So how could I implement an overlay composite effect using one image and one display object? 

I guess I could display.save() to save the display object and then use it as an image, but that would be too much. Is there an easier way to achieve this? Or any other way to achieve an overlay blend mode ?

Thank you.

You could save your display.newCircle out then load it back in as an image.

Rob

Thanks Rob. That’s what I was thinking, but was wondering if there would be an easier/straightforward way. I guess some  way is better than no way. 

Is there no way we can get composite effects capable of using display objects, instead of just images?

local compositePaint = {

type=“composite”,
paint1={ type=“camera” },
paint2={ type=“displayObject”, myDisplayImage }
}

object.fill = compositePaint

object.fill.effect = “composite.colorDodge”

That would be ideal. (And been around as an “open possibility” for a couple years). 

Or, could some of the other modes be added to blendmode ?  (overlay, difference, subtract, pinlight, etc.)

Hi Rob, 

I was wondering how to load the Image back? because the parameter filename within the composite effect only accepts a name of the file and it defaults to to ResourceDirectory.

local compositePaint = { type="composite", paint1={ type="image", filename="image01.png" }, paint2={ type="image", filename="texture.png" } } 

But if I save a display object it will be saved in DocumentsDirectory. So is there a way to change the directory of the composite effect so DocumentsDirectory ?  

paint1={ type=“image”, filename= “system.DocumentsDirectory/Image.png” }, tried doing this but no result.

Thanks.

Okay I figured it out. 

You can just do

paint1={ type=“image”, filename= “Image.png”, baseDir=system.DocumentsDirectory }

You could save your display.newCircle out then load it back in as an image.

Rob

Thanks Rob. That’s what I was thinking, but was wondering if there would be an easier/straightforward way. I guess some  way is better than no way. 

Is there no way we can get composite effects capable of using display objects, instead of just images?

local compositePaint = {

type=“composite”,
paint1={ type=“camera” },
paint2={ type=“displayObject”, myDisplayImage }
}

object.fill = compositePaint

object.fill.effect = “composite.colorDodge”

That would be ideal. (And been around as an “open possibility” for a couple years). 

Or, could some of the other modes be added to blendmode ?  (overlay, difference, subtract, pinlight, etc.)

Hi Rob, 

I was wondering how to load the Image back? because the parameter filename within the composite effect only accepts a name of the file and it defaults to to ResourceDirectory.

local compositePaint = { type="composite", paint1={ type="image", filename="image01.png" }, paint2={ type="image", filename="texture.png" } } 

But if I save a display object it will be saved in DocumentsDirectory. So is there a way to change the directory of the composite effect so DocumentsDirectory ?  

paint1={ type=“image”, filename= “system.DocumentsDirectory/Image.png” }, tried doing this but no result.

Thanks.

Okay I figured it out. 

You can just do

paint1={ type=“image”, filename= “Image.png”, baseDir=system.DocumentsDirectory }