My mask is inversed... help

Hey guys,
this should probly be an easy to answer question for all the pros out there. I am trying to create a mask, exactly similar to the one in the flashlight demo. I am using the same “mask” graphic thats in the flashlight demo, when i create my mask, rather than the center of the mask being clear, its darkened, and outside the mask is visible, so it seems to be inversed, here is my code, any help would be great!

[lua]M.underGroundFilter = display.newRect(0,0,800,500)
M.underGroundFilter:setFillColor(0,0,0)
M.underGroundFilter.x = midX
M.underGroundFilter.y = midY
M.displayFilterGroup:insert(M.underGroundFilter)

M.underGroundFilter:translate( halfW, halfH )

local mask = graphics.newMask( “circlemask.png” )
M.underGroundFilter:setMask( mask )[/lua] [import]uid: 19620 topic_id: 18423 reply_id: 318423[/import]

So a mask works by “The image is converted internally to grayscale; black values are then masked, while white values are not.” so is your mask image setup properly? [import]uid: 46343 topic_id: 18423 reply_id: 70705[/import]

well so in this case my “image” is just a black rectangle that ive created, im just trying to make it so its black everywhere on the screen except for the circle around my player character. [import]uid: 19620 topic_id: 18423 reply_id: 70707[/import]

I guess really what im doing is out of the ordinary now that i think about it. Because i want my game world to be behind this black rectangle, and then make it so the mask lets you see past the black rectangle and make the game world viewable through that mask area… [import]uid: 19620 topic_id: 18423 reply_id: 70709[/import]

So are you looking to do something like diablo 2 where your “hero” is the only thing visible and he moves around? [import]uid: 46343 topic_id: 18423 reply_id: 70710[/import]

yes exactly, my character is going “underground” so i wanted it too be like that [import]uid: 19620 topic_id: 18423 reply_id: 70712[/import]

Hello, I have exactly the same problem, anyone solved it ?
The only solution I found is to create a very big image as mask, something like 1400x1400 pixel.

Thank you

Ray [import]uid: 106680 topic_id: 18423 reply_id: 75813[/import]

I havent gotten the results i want yet, but i need to spend more time on it, been away from my project during the holiday, ill let you know if i make it work somehow. [import]uid: 19620 topic_id: 18423 reply_id: 75820[/import]

rxmarccall is trying to do something similar to what I am doing; namely that I want to provide a ‘flashlight’ around the player to light the underground when player is underground.

I basically have a front tile layer on my map ( built in Tiled ) that blacks out the cave region tiles. So I thought, rightly so I think, that all I need to do is take the circlemask.png from the sample file and simply invert it, so that when applied to the blackout layer tiles, it would show through the underlying cave tiles only at the centre, as if lit, and preserve the blackout all around it.

It doesnt work as you would expect because Corona’s masking is flawed. Masking works as long as ALL pixels at the edge are black, but an inverted mask has all pixels WHITE.

The problem is that while the pixels of a mask on top and left edges are propagated top and left to the rest of the masked image and applied. . . the pixels at the bottom and right edges are never propagated ( and in fact assumed to be black ). In short, it will mask correctly everything to the top and left of an inverted mask correctly, but to the bottom and right masking is never applied.

This is a clear case of a flawed implementation of masking and it needs to be addressed. The solution suggested, that of simply making your mask _very large to cover the entire screen is just not a very good one and a waste of valuable asset space.

I would like to know if and when this issue is going to be addressed. To not be able to use an inverted mask is to me a fairly major shortcoming. Btw I am using the last free build 720 on windows.

[import]uid: 112449 topic_id: 18423 reply_id: 87133[/import]

Glad to see i wasn’t the only one having an issue with that, i never could make it work how i wanted it too so i gave up on it for my last project, but i would love to have a way to accomplish what we are after. [import]uid: 19620 topic_id: 18423 reply_id: 87136[/import]