From 5d82c3cdb9f19ca1e081903572b51b91895da1f8 Mon Sep 17 00:00:00 2001 From: faiface Date: Mon, 10 Apr 2017 13:59:16 +0200 Subject: [PATCH] rename ComposeDst* -> ComposeR* + add ComposePlus, ComposeCopy --- interface.go | 10 ++++++---- pixelgl/canvas.go | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/interface.go b/interface.go index fed7ac8..d92d460 100644 --- a/interface.go +++ b/interface.go @@ -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, diff --git a/pixelgl/canvas.go b/pixelgl/canvas.go index 5ebe5bf..df71f6d 100644 --- a/pixelgl/canvas.go +++ b/pixelgl/canvas.go @@ -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")) }