fix Picture.Image
This commit is contained in:
parent
e656130ce3
commit
f16eb8271e
|
@ -54,20 +54,17 @@ func NewPicture(img image.Image, smooth bool) *Picture {
|
||||||
// Image returns the content of the Picture as an image.NRGBA.
|
// Image returns the content of the Picture as an image.NRGBA.
|
||||||
func (p *Picture) Image() *image.NRGBA {
|
func (p *Picture) Image() *image.NRGBA {
|
||||||
bounds := p.Bounds()
|
bounds := p.Bounds()
|
||||||
nrgba := image.NewNRGBA(image.Rect(
|
nrgba := image.NewNRGBA(image.Rect(0, 0, int(bounds.W()), int(bounds.H())))
|
||||||
int(bounds.X()),
|
|
||||||
int(bounds.Y()),
|
|
||||||
int(bounds.X()+bounds.W()),
|
|
||||||
int(bounds.Y()+bounds.H()),
|
|
||||||
))
|
|
||||||
|
|
||||||
mainthread.Call(func() {
|
mainthread.Call(func() {
|
||||||
|
p.texture.Begin()
|
||||||
nrgba.Pix = p.texture.Pixels(
|
nrgba.Pix = p.texture.Pixels(
|
||||||
int(bounds.X()),
|
int(bounds.X()),
|
||||||
int(bounds.Y()),
|
int(bounds.Y()),
|
||||||
int(bounds.W()),
|
int(bounds.W()),
|
||||||
int(bounds.H()),
|
int(bounds.H()),
|
||||||
)
|
)
|
||||||
|
p.texture.End()
|
||||||
})
|
})
|
||||||
|
|
||||||
// flip the image vertically
|
// flip the image vertically
|
||||||
|
|
Loading…
Reference in New Issue