1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-19 10:56:07 -05:00
OpenDiablo2/d2core/d2render/ebiten/composite_mode_helper.go
Alex Yatskov b5c1f5222d
Move rendering stuff out of d2common into d2render (#281)
* Move rendering stuff out of d2common into d2render

* Remove d2interface
2020-02-01 20:39:28 -05:00

73 lines
2.4 KiB
Go

package ebiten
import (
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2render"
"github.com/hajimehoshi/ebiten"
)
func d2ToEbitenCompositeMode(comp d2render.CompositeMode) ebiten.CompositeMode {
switch comp {
case d2render.CompositeModeSourceOver:
return ebiten.CompositeModeSourceOver
case d2render.CompositeModeClear:
return ebiten.CompositeModeClear
case d2render.CompositeModeCopy:
return ebiten.CompositeModeCopy
case d2render.CompositeModeDestination:
return ebiten.CompositeModeDestination
case d2render.CompositeModeDestinationOver:
return ebiten.CompositeModeDestinationOver
case d2render.CompositeModeSourceIn:
return ebiten.CompositeModeSourceIn
case d2render.CompositeModeDestinationIn:
return ebiten.CompositeModeDestinationIn
case d2render.CompositeModeSourceOut:
return ebiten.CompositeModeSourceOut
case d2render.CompositeModeDestinationOut:
return ebiten.CompositeModeDestinationOut
case d2render.CompositeModeSourceAtop:
return ebiten.CompositeModeSourceAtop
case d2render.CompositeModeDestinationAtop:
return ebiten.CompositeModeDestinationAtop
case d2render.CompositeModeXor:
return ebiten.CompositeModeXor
case d2render.CompositeModeLighter:
return ebiten.CompositeModeLighter
}
return ebiten.CompositeModeSourceOver
}
func ebitenToD2CompositeMode(comp ebiten.CompositeMode) d2render.CompositeMode {
switch comp {
case ebiten.CompositeModeSourceOver:
return d2render.CompositeModeSourceOver
case ebiten.CompositeModeClear:
return d2render.CompositeModeClear
case ebiten.CompositeModeCopy:
return d2render.CompositeModeCopy
case ebiten.CompositeModeDestination:
return d2render.CompositeModeDestination
case ebiten.CompositeModeDestinationOver:
return d2render.CompositeModeDestinationOver
case ebiten.CompositeModeSourceIn:
return d2render.CompositeModeSourceIn
case ebiten.CompositeModeDestinationIn:
return d2render.CompositeModeDestinationIn
case ebiten.CompositeModeSourceOut:
return d2render.CompositeModeSourceOut
case ebiten.CompositeModeDestinationOut:
return d2render.CompositeModeDestinationOut
case ebiten.CompositeModeSourceAtop:
return d2render.CompositeModeSourceAtop
case ebiten.CompositeModeDestinationAtop:
return d2render.CompositeModeDestinationAtop
case ebiten.CompositeModeXor:
return d2render.CompositeModeXor
case ebiten.CompositeModeLighter:
return d2render.CompositeModeLighter
}
return d2render.CompositeModeSourceOver
}