ggfx/ggfx.go
2023-07-01 02:58:45 -04:00

25 lines
632 B
Go

package ggfx
import "image"
type Image[T any] struct {
// Pix is the actual pixel array of the image.
Pix []T
// Stride represents the distance in slice elements between two pixels
// that are vertically adjacent.
Stride int
// Width specifies how many slice elements make up a single pixel.
Width int
// Bounds specifies a rectangle that all drawing operations will be
// clipped to. It must not reside outside of Data. It is measured in
// pixels and not slice elements.
Bounds image.Rectangle
}
func (this Image[T]) assertWidth (pixel []T) {
if len(pixel) != this.Width { panic("invalid fill pixel width") }
}