-
-
Couldn't load subscription status.
- Fork 736
Description
Ebitengine Version
2.9.1
Operating System
- Windows
- macOS
- Linux
- FreeBSD
- OpenBSD
- Android
- iOS
- Nintendo Switch
- PlayStation 5
- Xbox
- Web Browsers
Go Version (go version)
go version go1.25.0 linux/amd64
What steps will reproduce the problem?
package main
import (
"image/color"
"image"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
)
type Engine struct {
i *ebiten.Image
}
func (e *Engine) Init() {
e.i = ebiten.NewImage(80, 80)
vector.FillRect(e.i, 0, 0, 80, 80, color.NRGBA{R: 255, A: 255}, true)
}
func (e *Engine) Update() error {
return nil
}
func (e *Engine) Draw(screen *ebiten.Image) {
var opts ebiten.DrawImageOptions
opts.GeoM.Translate(10, 10)
// screen.DrawImage(e.i, &opts) // if this call runs then the subimage shows up.
// comment out this line and the subimage does not show up
opts.GeoM.Translate(100, 0)
sub := e.i.SubImage(image.Rect(10, 10, 70, 70)).(*ebiten.Image)
screen.DrawImage(sub, &opts)
}
func (e *Engine) Layout(outsideWidth, outsideHeight int) (int, int) {
return outsideWidth, outsideHeight
}
func main() {
var engine Engine
engine.Init()
ebiten.RunGame(&engine)
}
What is the expected result?
A single red square should be drawn. When antialias=false it does work:
vector.FillRect(..., false):
vector.FillRect(..., true)
If the call to screen.DrawImage(e.i, &opts) is left in then the subimage is always drawn, regardless of whether antialias is true or false.
screen.DrawImage(e.i, &opts) and vector.FillRect(..., false)
screen.DrawImage(e.i, &opts) and vector.FillRect(..., true)
I would expect a subimage to be drawn similarly to its parent when the parent has deferred rendering on it due to antialiased vector drawing.
What happens instead?
vector.FillRect(..., true) does not display anything when the subimage by itself is rendered.
Anything else you feel useful to add?
No response