fix wu line iface, pending opacity

This commit is contained in:
2026-01-21 11:39:44 +03:00
parent 2be7717477
commit 378729616f
10 changed files with 108 additions and 51 deletions

View File

@@ -1,8 +1,9 @@
package wu
import (
"lab.zaar.be/thefish/alchemyst-go/engine/types"
"math"
"lab.zaar.be/thefish/alchemyst-go/engine/types"
)
func ipart(x float64) float64 {
@@ -21,7 +22,7 @@ func rfpart(x float64) float64 {
return 1 - fpart(x)
}
func (Layer types.Putable) WuLine(x1, y1, x2, y2 float64, w int) {
func WuLine(l types.Putable, x1, y1, x2, y2 float64, w int) {
dx := x2 - x1
dy := y2 - y1
ax := dx
@@ -40,11 +41,11 @@ func (Layer types.Putable) WuLine(x1, y1, x2, y2 float64, w int) {
x2, y2 = y2, x2
dx, dy = dy, dx
plot = func(x, y int, c float64) {
Layer.Put(y, x, uint8(255 * c))
l.Put(y, x, uint8(255*c))
}
} else {
plot = func(x, y int, c float64) {
Layer.Put(x, y, uint8(255 * c))
l.Put(x, y, uint8(255*c))
}
}
if x2 < x1 {