mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
@@ -85,6 +85,9 @@ func imageWithAlpha(img image.Image, alpha *int) image.Image {
|
||||
return img
|
||||
}
|
||||
a := clampColor(*alpha)
|
||||
if a == 255 {
|
||||
return img
|
||||
}
|
||||
bounds := img.Bounds()
|
||||
out := image.NewNRGBA(bounds)
|
||||
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
|
||||
@@ -109,6 +112,9 @@ func imageWithTransparentEdge(img image.Image) (image.Image, int) {
|
||||
if w == 0 || h == 0 {
|
||||
return img, 0
|
||||
}
|
||||
if opaque, ok := img.(interface{ Opaque() bool }); ok && opaque.Opaque() {
|
||||
return img, 0
|
||||
}
|
||||
src := image.NewNRGBA(image.Rect(0, 0, w, h))
|
||||
hasZero, hasVisible := false, false
|
||||
for y := 0; y < h; y++ {
|
||||
|
||||
Reference in New Issue
Block a user