vb.net Code:
Dim clrInt As Integer = clr.ToArgb And &HFFFFFF 'zeroise the Alpha byte
Dim TargetImage As New Bitmap(AlphaMask) 'make sure the target image is in 32bpp format
Using fp As New FastPix(TargetImage)
Dim pixels As Integer() = fp.PixelArray
For i As Integer = 0 to pixels.Count-1
Dim alpha As Integer = pixels(i) << 24 'shift the blue byte to the Alpha byte
pixels(i) = alpha Or clrInt 'combine Alpha with the base colour
Next
End Using
Now you can use TargetImage as a BackgroundImage or paint in the Paint event of a Form or other control with DrawImage.