Fix NewImageFromImage color converting
Old version of NewImageFromImage converted colors incorrectly. This commit fixes the issue.
This commit is contained in:
parent
123ec7ae6b
commit
2053879bfb
2 changed files with 2 additions and 2 deletions
|
@ -3776,7 +3776,7 @@ func NewImageFromImage(img image.Image) *Image {
|
|||
for x := 0; x < size.X; x++ {
|
||||
col := img.At(x, y)
|
||||
r, g, b, a := col.RGBA()
|
||||
rcolor := NewColor(uint8(r), uint8(g), uint8(b), uint8(a))
|
||||
rcolor := NewColor(uint8(r>>8), uint8(g>>8), uint8(b>>8), uint8(a>>8))
|
||||
ImageDrawPixel(ret, int32(x), int32(y), rcolor)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ func NewImageFromImage(img image.Image) *Image {
|
|||
for x := 0; x < size.X; x++ {
|
||||
color := img.At(x, y)
|
||||
r, g, b, a := color.RGBA()
|
||||
rcolor := NewColor(uint8(r), uint8(g), uint8(b), uint8(a))
|
||||
rcolor := NewColor(uint8(r>>8), uint8(g>>8), uint8(b>>8), uint8(a>>8))
|
||||
ccolor = colorCptr(rcolor)
|
||||
|
||||
cx = (C.int)(x)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue