mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
graphics: Add comments to CompositeModes
This commit is contained in:
parent
9c508e0444
commit
5f6f2531a9
35
graphics.go
35
graphics.go
@ -39,19 +39,46 @@ func glFilter(c *opengl.Context, filter Filter) opengl.Filter {
|
|||||||
// CompositeMode represents Porter-Duff composition mode.
|
// CompositeMode represents Porter-Duff composition mode.
|
||||||
type CompositeMode int
|
type CompositeMode int
|
||||||
|
|
||||||
// Note: This name convention follow CSS compositing: https://drafts.fxtf.org/compositing-2/
|
// This name convention follows CSS compositing: https://drafts.fxtf.org/compositing-2/.
|
||||||
|
//
|
||||||
|
// In the above comments,
|
||||||
|
// c_src, c_dst and c_out represent alpha-premultiplied RGB values of source, destination and output respectively. α_src and α_dst represent alpha values of source and destination respectively.
|
||||||
const (
|
const (
|
||||||
CompositeModeSourceOver CompositeMode = CompositeMode(opengl.CompositeModeSourceOver) // regular alpha blending
|
// Regular alpha blending
|
||||||
|
// c_out = c_src + c_dst × (1 - α_src)
|
||||||
|
CompositeModeSourceOver CompositeMode = CompositeMode(opengl.CompositeModeSourceOver)
|
||||||
|
|
||||||
|
// c_out = 0
|
||||||
CompositeModeClear = CompositeMode(opengl.CompositeModeClear)
|
CompositeModeClear = CompositeMode(opengl.CompositeModeClear)
|
||||||
|
|
||||||
|
// c_out = c_src
|
||||||
CompositeModeCopy = CompositeMode(opengl.CompositeModeCopy)
|
CompositeModeCopy = CompositeMode(opengl.CompositeModeCopy)
|
||||||
|
|
||||||
|
// c_out = c_dst
|
||||||
CompositeModeDestination = CompositeMode(opengl.CompositeModeDestination)
|
CompositeModeDestination = CompositeMode(opengl.CompositeModeDestination)
|
||||||
|
|
||||||
|
// c_out = c_src × α_dst
|
||||||
CompositeModeSourceIn = CompositeMode(opengl.CompositeModeSourceIn)
|
CompositeModeSourceIn = CompositeMode(opengl.CompositeModeSourceIn)
|
||||||
|
|
||||||
|
// c_out = c_dst × α_src
|
||||||
CompositeModeDestinationIn = CompositeMode(opengl.CompositeModeDestinationIn)
|
CompositeModeDestinationIn = CompositeMode(opengl.CompositeModeDestinationIn)
|
||||||
|
|
||||||
|
// c_out = c_src × (1 - α_dst)
|
||||||
CompositeModeSourceOut = CompositeMode(opengl.CompositeModeSourceOut)
|
CompositeModeSourceOut = CompositeMode(opengl.CompositeModeSourceOut)
|
||||||
|
|
||||||
|
// c_out = c_dst × (1 - α_src)
|
||||||
CompositeModeDestinationOut = CompositeMode(opengl.CompositeModeDestinationOut)
|
CompositeModeDestinationOut = CompositeMode(opengl.CompositeModeDestinationOut)
|
||||||
|
|
||||||
|
// c_out = c_src × α_dst + c_dst × (1 - α_src)
|
||||||
CompositeModeSourceAtop = CompositeMode(opengl.CompositeModeSourceAtop)
|
CompositeModeSourceAtop = CompositeMode(opengl.CompositeModeSourceAtop)
|
||||||
|
|
||||||
|
// c_out = c_src × (1 - α_dst) + c_dst × α_src
|
||||||
CompositeModeDestinationAtop = CompositeMode(opengl.CompositeModeDestinationAtop)
|
CompositeModeDestinationAtop = CompositeMode(opengl.CompositeModeDestinationAtop)
|
||||||
|
|
||||||
|
// c_out = c_src × (1 - α_dst) + c_dst × (1 - α_src)
|
||||||
CompositeModeXor = CompositeMode(opengl.CompositeModeXor)
|
CompositeModeXor = CompositeMode(opengl.CompositeModeXor)
|
||||||
CompositeModeLighter = CompositeMode(opengl.CompositeModeLighter) // sum of source and destination (a.k.a. 'plus' or 'additive')
|
|
||||||
|
// Sum of source and destination (a.k.a. 'plus' or 'additive')
|
||||||
|
// c_out = c_src + c_dst
|
||||||
|
CompositeModeLighter = CompositeMode(opengl.CompositeModeLighter)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user