I dont understand why both functions behave differently
One is pasting in a triangle and the other duplicates and deletes outside 
the triangle
(The second one could be used then to do it in place)

function MaskTriang2(imgor,size)
 local img = imgor:Duplicate()
 local imcv = img:cdCreateCanvas()
 imcv:Begin(cd.REGION)
 imcv:Box(0,img:Width(), 0,img:Height())
 imcv:RegionCombineMode(cd.NOTINTERSECT)
 EQTriangle(imcv,size,cd.FILL)
 imcv:End()

 imcv:Clip(cd.CLIPREGION)
 imcv:Foreground(cd.EncodeAlpha(cd.BLACK, 0))

 imcv:Box(0,img:Width(), 0,img:Height())

 imcv:Kill()
 return img
end

function MaskTriang(img,size)
 local im2 = img:Clone()
 im2:AddAlpha()
 local imcv = im2:cdCreateCanvas()
 EQTriangle(imcv,size,cd.CLIP)
 imcv:Clip(cd.CLIPPOLYGON)
 img:cdCanvasPutImageRect(imcv, 0, 0, 0, 0, 0, 0, 0, 0)
 imcv:Kill()
 return im2
end 


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to