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

This commit is contained in:
faiface 2017-04-10 13:59:16 +02:00
parent 4eca5f2d1e
commit aa2c560d4c
2 changed files with 14 additions and 8 deletions

View File

@ -56,11 +56,13 @@ const (
ComposeIn ComposeIn
ComposeOut ComposeOut
ComposeAtop ComposeAtop
ComposeDstOver ComposeRover
ComposeDstIn ComposeRin
ComposeDstOut ComposeRout
ComposeDstAtop ComposeRatop
ComposeXor ComposeXor
ComposePlus
ComposeCopy
) )
// Triangles represents a list of vertices, where each three vertices form a triangle. (First, // 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) glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.Zero)
case pixel.ComposeAtop: case pixel.ComposeAtop:
glhf.BlendFunc(glhf.DstAlpha, glhf.OneMinusSrcAlpha) glhf.BlendFunc(glhf.DstAlpha, glhf.OneMinusSrcAlpha)
case pixel.ComposeDstOver: case pixel.ComposeRover:
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.One) glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.One)
case pixel.ComposeDstIn: case pixel.ComposeRin:
glhf.BlendFunc(glhf.Zero, glhf.SrcAlpha) glhf.BlendFunc(glhf.Zero, glhf.SrcAlpha)
case pixel.ComposeDstOut: case pixel.ComposeRout:
glhf.BlendFunc(glhf.Zero, glhf.OneMinusSrcAlpha) glhf.BlendFunc(glhf.Zero, glhf.OneMinusSrcAlpha)
case pixel.ComposeDstAtop: case pixel.ComposeRatop:
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.SrcAlpha) glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.SrcAlpha)
case pixel.ComposeXor: case pixel.ComposeXor:
glhf.BlendFunc(glhf.OneMinusDstAlpha, glhf.OneMinusSrcAlpha) 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: default:
panic(errors.New("Canvas: invalid compose method")) panic(errors.New("Canvas: invalid compose method"))
} }