//DrawAlpha draw the ballon with alpha blending in the pixels

DrawAlpha draw the ballon with alpha blending in the pixels
// DrawAlpha draw the ballon with alpha blending in the pixels
func (txt *Texture) DrawAlpha(pixels Pixels) Pixels{
	for y := 0; y < txt.H; y++ {
		screenY := y + int(txt.Y)
		if screenY >= 0 && screenY < winHeigth {
			for x := 0; x < txt.W; x++{
				screenX := x + int(txt.X)
				if screenX >= 0 && screenX < winWidth {
					txtIndex := y * txt.Pitch + x * 4
					screenIndex := screenY * winWidth * 4 + screenX * 4 
					srcR := int(txt.TexturePixels[txtIndex])
					srcG := int(txt.TexturePixels[txtIndex + 1])
					srcB := int(txt.TexturePixels[txtIndex + 2])
					srcA := int(txt.TexturePixels[txtIndex + 3])
					newR := int(pixels.screen[screenIndex])
					newG := int(pixels.screen[screenIndex + 1])
					newB := int(pixels.screen[screenIndex + 2])
					rstR := (srcR*255 + newR*(255-srcA)) / 255
					rstG := (srcG*255 + newG*(255-srcA)) / 255
					rstB := (srcB*255 + newB*(255-srcA)) / 255
					pixels.screen[screenIndex] = byte(rstR)
					pixels.screen[screenIndex + 1] = byte(rstG)
					pixels.screen[screenIndex + 2] = byte(rstB)
				}
			}	
		}
	}
	return pixels
}
func ( txt * Texture ) DrawAlpha ( pixels Pixels ) Pixels { for y := 0 ; y < txt . H ; y ++ { screenY := y + int ( txt . Y ) if screenY >= 0 && screenY < winHeigth { for x := 0 ; x < txt . W ; x ++ { screenX := x + int ( txt . X ) if screenX >= 0 && screenX < winWidth { txtIndex := y * txt . Pitch + x * 4 screenIndex := screenY * winWidth * 4 + screenX * 4 srcR := int ( txt . TexturePixels [ txtIndex ] ) srcG := int ( txt . TexturePixels [ txtIndex + 1 ] ) srcB := int ( txt . TexturePixels [ txtIndex + 2 ] ) srcA := int ( txt . TexturePixels [ txtIndex + 3 ] ) newR := int ( pixels . screen [ screenIndex ] ) newG := int ( pixels . screen [ screenIndex + 1 ] ) newB := int ( pixels . screen [ screenIndex + 2 ] ) rstR := ( srcR * 255 + newR * ( 255 - srcA ) ) / 255 rstG := ( srcG * 255 + newG * ( 255 - srcA ) ) / 255 rstB := ( srcB * 255 + newB * ( 255 - srcA ) ) / 255 pixels . screen [ screenIndex ] = byte ( rstR ) pixels . screen [ screenIndex + 1 ] = byte ( rstG ) pixels . screen [ screenIndex + 2 ] = byte ( rstB ) } } } } return pixels }
DrawAlpha draw the ballon with alpha blending in the pixels
DrawAlpha draw the ballon with alpha blending in the pixels