MCPcopy
hub / github.com/EngoEngine/engo / ImageToNRGBA

Function ImageToNRGBA

common/render_filetype.go:135–140  ·  view source on GitHub ↗

ImageToNRGBA takes a given `image.Image` and converts it into an `image.NRGBA`. Especially useful when transforming image.Uniform to something usable by `engo`.

(img image.Image, width, height int)

Source from the content-addressed store, hash-verified

133// ImageToNRGBA takes a given `image.Image` and converts it into an `image.NRGBA`. Especially useful when transforming
134// image.Uniform to something usable by `engo`.
135func ImageToNRGBA(img image.Image, width, height int) *image.NRGBA {
136 newm := image.NewNRGBA(image.Rect(0, 0, width, height))
137 draw.Draw(newm, newm.Bounds(), img, image.Point{0, 0}, draw.Src)
138
139 return newm
140}
141
142// ImageObject is a pure Go implementation of a `Drawable`
143type ImageObject struct {

Callers

nothing calls this directly

Calls 2

BoundsMethod · 0.80
DrawMethod · 0.65

Tested by

no test coverage detected