github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/framework/drawfillover_other.go (about) 1 // +build !amd64 !go1.10 2 3 package framework 4 5 import ( 6 "image" 7 ) 8 9 func drawFillOver(dst *image.RGBA, r image.Rectangle, sr, sg, sb, sa uint32) { 10 const m = 1<<16 - 1 11 // The 0x101 is here for the same reason as in drawRGBA. 12 a := (m - sa) * 0x101 13 i0 := dst.PixOffset(r.Min.X, r.Min.Y) 14 i1 := i0 + r.Dx()*4 15 for y := r.Min.Y; y != r.Max.Y; y++ { 16 for i := i0; i < i1; i += 4 { 17 dr := &dst.Pix[i+0] 18 dg := &dst.Pix[i+1] 19 db := &dst.Pix[i+2] 20 da := &dst.Pix[i+3] 21 22 *dr = uint8((uint32(*dr)*a/m + sr) >> 8) 23 *dg = uint8((uint32(*dg)*a/m + sg) >> 8) 24 *db = uint8((uint32(*db)*a/m + sb) >> 8) 25 *da = uint8((uint32(*da)*a/m + sa) >> 8) 26 } 27 i0 += dst.Stride 28 i1 += dst.Stride 29 } 30 }