Merge pull request #414 from imprity/NewImageFromImage-fix
Fix NewImageFromImage color converting
This commit is contained in:
commit
6bc3d79c96
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++ {
|
for x := 0; x < size.X; x++ {
|
||||||
col := img.At(x, y)
|
col := img.At(x, y)
|
||||||
r, g, b, a := col.RGBA()
|
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)
|
ImageDrawPixel(ret, int32(x), int32(y), rcolor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ func NewImageFromImage(img image.Image) *Image {
|
||||||
for x := 0; x < size.X; x++ {
|
for x := 0; x < size.X; x++ {
|
||||||
color := img.At(x, y)
|
color := img.At(x, y)
|
||||||
r, g, b, a := color.RGBA()
|
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)
|
ccolor = colorCptr(rcolor)
|
||||||
|
|
||||||
cx = (C.int)(x)
|
cx = (C.int)(x)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue