Bladeren bron

兼容png格式图片

Minho 8 jaren geleden
bovenliggende
commit
c71557f61f
1 gewijzigde bestanden met toevoegingen van 2 en 2 verwijderingen
  1. 2 2
      graphics/copy.go

+ 2 - 2
graphics/copy.go

@@ -15,9 +15,9 @@ func ImageCopy(src image.Image,x, y ,w, h int) (image.Image,error)  {
 	if rgbImg,ok := src.(*image.YCbCr); ok {
 		subImg = rgbImg.SubImage(image.Rect(x, y, x+w, y+h)).(*image.YCbCr) //图片裁剪x0 y0 x1 y1
 	}else if rgbImg,ok := src.(*image.RGBA); ok {
-		subImg = rgbImg.SubImage(image.Rect(x, y, x+w, y+h)).(*image.YCbCr) //图片裁剪x0 y0 x1 y1
+		subImg = rgbImg.SubImage(image.Rect(x, y, x+w, y+h)).(*image.RGBA) //图片裁剪x0 y0 x1 y1
 	}else if rgbImg,ok := src.(*image.NRGBA); ok {
-		subImg = rgbImg.SubImage(image.Rect(x, y, x+w, y+h)).(*image.YCbCr) //图片裁剪x0 y0 x1 y1
+		subImg = rgbImg.SubImage(image.Rect(x, y, x+w, y+h)).(*image.NRGBA) //图片裁剪x0 y0 x1 y1
 	} else {
 
 		return subImg,errors.New("图片解码失败")