Comment fix

This commit is contained in:
Hajime Hoshi 2015-01-21 00:42:27 +09:00
parent e03076ef67
commit f88f48f0ae
2 changed files with 8 additions and 5 deletions

View File

@ -100,6 +100,11 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
}
// NewImageFromImage creates a new image with the given image (img).
//
// NewImageFromImage generates a new texture and a new framebuffer.
// Be careful that image objects will never be released
// even though nothing refers the image object and GC works.
// It is because there is no way to define finalizers for Go objects if you use GopherJS.
func NewImageFromImage(img image.Image, filter Filter) (*Image, error) {
var eimg *Image
var err error

View File

@ -163,13 +163,11 @@ func (i *Image) At(x, y int) color.Color {
return color.RGBA{r, g, b, a}
}
// ReplacePixels replaces the pixels of image with p.
// ReplacePixels replaces the pixels of the image with p.
//
// The given p must represent RGBA pre-multiplied alpha values.
// The given p must represent RGBA pre-multiplied alpha values. len(p) must equal to 4 * (image width) * (image height).
//
// len(p) must equal to 4 * (image width) * (image height)
//
// This function may be slow.
// This function may be slow (as for implementation, this calls glTexSubImage2D).
func (i *Image) ReplacePixels(p []uint8) error {
w, h := i.Size()
l := 4 * w * h