image.go
func (i *Image) ReplacePixels(p []byte) error {
	i.copyCheck()
	if i.isDisposed() {
		return nil
	}
	// TODO: Implement this.
	if i.isSubImage() {
		panic("ebiten: render to a subimage is not implemented (ReplacePixels)")
	}
	i.resolvePendingPixels(false)
	s := i.Bounds().Size()
	if l := 4 * s.X * s.Y; len(p) != l {
		panic(fmt.Sprintf("ebiten: len(p) was %d but must be %d", len(p), l))
	}
	i.mipmap.original().ReplacePixels(p)
	i.disposeMipmaps()
	return nil
}
func (i *Image) ReplacePixels(p []byte) error {
	i.copyCheck()
	if i.isDisposed() {
		return nil
	}
	// TODO: Implement this.
	if i.isSubImage() {
		panic("ebiten: render to a subimage is not implemented (ReplacePixels)")
	}
	i.resolvePendingPixels(false)
	s := i.Bounds().Size()
	if l := 4 * s.X * s.Y; len(p) != l {
		panic(fmt.Sprintf("ebiten: len(p) was %d but must be %d", len(p), l))
	}
	i.mipmap.original().ReplacePixels(p)
	i.disposeMipmaps()
	return nil
}
// ReplacePixels replaces the pixels of the image with p.
//
// The given p must represent RGBA pre-multiplied alpha values. len(p) must equal to 4 * (image width) * (image height).
//
// ReplacePixels may be slow (as for implementation, this calls glTexSubImage2D).
//
// When len(p) is not appropriate, ReplacePixels panics.
//
// When the image is disposed, ReplacePixels does nothing.
//
// ReplacePixels always returns nil as of 1.5.0-alpha.