func (img *Image) Set(x, y int, clr color.Color) {
	if atomic.LoadInt32(&isRunning) == 0 {
		panic("ebiten: (*Image).Set is not available outside the main loop so far")
	}

	img.copyCheck()
	if img.isDisposed() {
		return
	}
	if img.isSubImage() && !image.Pt(x, y).In(img.bounds) {
		return
	}
	if img.isSubImage() {
		img = img.original
	}

	w, h := img.Size()
	if img.pendingPixels == nil {
		pix := make([]byte, 4*w*h)
		idx := 0
		for j := 0; j < h; j++ {
			for i := 0; i < w; i++ {
				r, g, b, a := img.mipmap.original().At(i, j)
				pix[4*idx] = r
				pix[4*idx+1] = g
				pix[4*idx+2] = b
				pix[4*idx+3] = a
				idx++
			}
		}
		img.pendingPixels = pix
	}
	r, g, b, a := clr.RGBA()
	img.pendingPixels[4*(x+y*w)] = byte(r >> 8)
	img.pendingPixels[4*(x+y*w)+1] = byte(g >> 8)
	img.pendingPixels[4*(x+y*w)+2] = byte(b >> 8)
	img.pendingPixels[4*(x+y*w)+3] = byte(a >> 8)
}
func (img *Image) Set(x, y int, clr color.Color) {
	if atomic.LoadInt32(&isRunning) == 0 {
		panic("ebiten: (*Image).Set is not available outside the main loop so far")
	}

	img.copyCheck()
	if img.isDisposed() {
		return
	}
	if img.isSubImage() && !image.Pt(x, y).In(img.bounds) {
		return
	}
	if img.isSubImage() {
		img = img.original
	}

	w, h := img.Size()
	if img.pendingPixels == nil {
		pix := make([]byte, 4*w*h)
		idx := 0
		for j := 0; j < h; j++ {
			for i := 0; i < w; i++ {
				r, g, b, a := img.mipmap.original().At(i, j)
				pix[4*idx] = r
				pix[4*idx+1] = g
				pix[4*idx+2] = b
				pix[4*idx+3] = a
				idx++
			}
		}
		img.pendingPixels = pix
	}
	r, g, b, a := clr.RGBA()
	img.pendingPixels[4*(x+y*w)] = byte(r >> 8)
	img.pendingPixels[4*(x+y*w)+1] = byte(g >> 8)
	img.pendingPixels[4*(x+y*w)+2] = byte(b >> 8)
	img.pendingPixels[4*(x+y*w)+3] = byte(a >> 8)
}
func ( img * Image ) Set ( x , y int , clr color . Color ) { if atomic . LoadInt32 ( & isRunning ) == 0 { panic ( " " ) } img . copyCheck ( ) if img . isDisposed ( ) { return } if img . isSubImage ( ) && ! image . Pt ( x , y ) . In ( img . bounds ) { return } if img . isSubImage ( ) { img = img . original } w , h := img . Size ( ) if img . pendingPixels == nil { pix := make ( [ ] byte , 4 * w * h ) idx := 0 for j := 0 ; j < h ; j ++ { for i := 0 ; i < w ; i ++ { r , g , b , a := img . mipmap . original ( ) . At ( i , j ) pix [ 4 * idx ] = r pix [ 4 * idx + 1 ] = g pix [ 4 * idx + 2 ] = b pix [ 4 * idx + 3 ] = a idx ++ } } img . pendingPixels = pix } r , g , b , a := clr . RGBA ( ) img . pendingPixels [ 4 * ( x + y * w ) ] = byte ( r >> 8 ) img . pendingPixels [ 4 * ( x + y * w ) + 1 ] = byte ( g >> 8 ) img . pendingPixels [ 4 * ( x + y * w ) + 2 ] = byte ( b >> 8 ) img . pendingPixels [ 4 * ( x + y * w ) + 3 ] = byte ( a >> 8 ) }
// Set sets the color at (x, y).
//
// Set loads pixels from GPU to system memory if necessary, which means that Set can be slow.
//
// Set can't be called outside the main loop (ebiten.Run's updating function) starts.
//
// If the image is disposed, Set does nothing.
Set sets the color at ( x y ) . Set loads pixels from GPU to system memory if necessary which means that Set can be slow . Set can t be called outside the main loop ( ebiten . Run s updating function ) starts . If the image is disposed Set does nothing .