local function newMaskedSprite(__mask, __pic)
local __mb = ccBlendFunc:new()
__mb.src = GL_ONE
__mb.dst = GL_ZERO
local __pb = ccBlendFunc:new()
__pb.src = GL_DST_ALPHA
__pb.dst = GL_ZERO
local __maskSprite = display.newSprite(__mask):align(display.LEFT_BOTTOM, 0, 0)
__maskSprite:setBlendFunc(__mb)
local __picSprite = display.newSprite(__pic):align(display.LEFT_BOTTOM, 0, 0)
__picSprite:setBlendFunc(__pb)
local __maskSize = __maskSprite:getContentSize()
local __canva = CCRenderTexture:create(__maskSize.width,__maskSize.height)
__canva:begin()
__maskSprite:visit()
__picSprite:visit()
__canva:endToLua()
local __resultSprite = CCSpriteExtend.extend(
CCSprite:createWithTexture(
__canva:getSprite():getTexture()
))
:flipY(true)
return __resultSprite
end