diff --git a/allg5/bitmap.go b/allg5/bitmap.go index e001574..a6e8977 100644 --- a/allg5/bitmap.go +++ b/allg5/bitmap.go @@ -103,10 +103,11 @@ func NewBitmapFromImage(src image.Image, video bool) (*Bitmap, error) { return nil, errors.New("unable to lock bitmap") } dst := (*[1 << 30]uint8)(region.data) + left, top := bnd.Min.X, bnd.Min.Y for y := 0; y < height; y++ { row := dst[y*int(region.pitch):] for x := 0; x < width; x++ { - r, g, b, a := src.At(x, y).RGBA() + r, g, b, a := src.At(left+x, top+y).RGBA() row[x*4] = uint8(r >> 8) row[x*4+1] = uint8(g >> 8) row[x*4+2] = uint8(b >> 8)