Files
sanspie 515f4ca1b3 Stage 11a: animation (D333–D340, D344, D354–D357)
Clips (.aeanim) and controllers (.aectrl) with importers, AnimationPlayer and Animator with crossfades, root motion and events on fixed steps, rewind support. Editor: Animation panel (dope sheet, curves, record, preview, trajectory), Animator panel, sprite sheet slicer and flipbooks, Programming workspace, export panel redesign. Motion 2D ledge climb. 11c: the component and Create palette.
2026-10-25 15:31:22 +03:00

28 lines
630 B
Go

package slice
import (
"image"
"image/draw"
"image/png"
"os"
"aego/core/errs"
)
// Pixels reads a png sheet as straight RGBA rows for Alpha.
func Pixels(abs string) ([]byte, int, int, error) {
f, err := os.Open(abs)
if err != nil {
return nil, 0, 0, errs.Wrap(err, errs.VFSIO, "cannot read the sheet")
}
defer f.Close()
img, err := png.Decode(f)
if err != nil {
return nil, 0, 0, errs.Wrap(err, errs.AssetImportFailed, "cannot decode the sheet")
}
b := img.Bounds()
out := image.NewNRGBA(image.Rect(0, 0, b.Dx(), b.Dy()))
draw.Draw(out, out.Rect, img, b.Min, draw.Src)
return out.Pix, b.Dx(), b.Dy(), nil
}