rename ComposeDst* -> ComposeR* + add ComposePlus, ComposeCopy

This commit is contained in:
faiface 2017-04-10 13:59:16 +02:00
parent 8489bdad27
commit 5d82c3cdb9
2 changed files with 14 additions and 8 deletions

View File

@ -56,11 +56,13 @@ const (
ComposeIn
ComposeOut
ComposeAtop
ComposeDstOver
ComposeDstIn
ComposeDstOut
ComposeDstAtop
ComposeRover
ComposeRin
ComposeRout
ComposeRatop
ComposeXor
ComposePlus
ComposeCopy
)
// Triangles represents a list of vertices, where each three vertices form a triangle. (First,

View File

@ -153,16 +153,20 @@ func setBlendFunc(cmp pixel.ComposeMethod) {
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.Zero)
case pixel.ComposeAtop:
glhf.BlendFunc(glhf.DstAlpha, glhf.OneMinusSrcAlpha)
case pixel.ComposeDstOver:
case pixel.ComposeRover:
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.One)
case pixel.ComposeDstIn:
case pixel.ComposeRin:
glhf.BlendFunc(glhf.Zero, glhf.SrcAlpha)
case pixel.ComposeDstOut:
case pixel.ComposeRout:
glhf.BlendFunc(glhf.Zero, glhf.OneMinusSrcAlpha)
case pixel.ComposeDstAtop:
case pixel.ComposeRatop:
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.SrcAlpha)
case pixel.ComposeXor:
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.OneMinusSrcAlpha)
case pixel.ComposePlus:
glhf.BlendFunc(glhf.One, glhf.One)
case pixel.ComposeCopy:
glhf.BlendFunc(glhf.One, glhf.Zero)
default:
panic(errors.New("Canvas: invalid compose method"))
}