Skip to content

Commit

Permalink
兼容png格式图片
Browse files Browse the repository at this point in the history
  • Loading branch information
lifei6671 committed May 10, 2017
1 parent e60c602 commit c71557f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions graphics/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("图片解码失败")
Expand Down

0 comments on commit c71557f

Please sign in to comment.