From 24424d036ca108433bf1dbc03da4cba6fb19c80d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 8 Aug 2022 03:41:45 +0900 Subject: [PATCH] ebiten: update comments --- image.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/image.go b/image.go index 3206ad675..af6574dc2 100644 --- a/image.go +++ b/image.go @@ -783,11 +783,16 @@ func (i *Image) ColorModel() color.Model { // ReadPixels reads the image's pixels from the image. // +// The given pixels represent RGBA pre-multiplied alpha values. +// // ReadPixels loads pixels from GPU to system memory if necessary, which means that ReadPixels can be slow. // // ReadPixels always sets a transparent color if the image is disposed. // -// len(pixels) must be 4*width*height. If the sizes don't match, ReadPixels panics. +// len(pixels) must be 4 * (bounds width) * (bounds height). +// If len(pixels) is not correct, ReadPixels panics. +// +// ReadPixels also works on a sub-image. // // Note that an important logic should not rely on values returned by ReadPixels, since // the returned values can include very slight differences between some machines. @@ -917,14 +922,14 @@ func (i *Image) Dispose() { i.setVerticesCache = nil } -// ReplacePixels replaces the pixels of the image with p. +// ReplacePixels replaces the pixels of the image. // -// The given p must represent RGBA pre-multiplied alpha values. -// len(pix) must equal to 4 * (bounds width) * (bounds height). +// The given pixels are treated as RGBA pre-multiplied alpha values. // -// ReplacePixels works on a sub-image. +// len(pix) must be 4 * (bounds width) * (bounds height). +// If len(pix) is not correct, WritePixels panics. // -// When len(pix) is not appropriate, ReplacePixels panics. +// ReplacePixels also works on a sub-image. // // When the image is disposed, ReplacePixels does nothing. func (i *Image) ReplacePixels(pixels []byte) {