Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' <summary>
- ''' <param name="G"> The Graphic to draw the image </param>
- ''' <param name="R"> The Rectangle area of image </param>
- ''' <param name="_Image"> The image that the custom color applies on it</param>
- ''' <param name="C">The Color that be applied to the image </param>
- ''' <remarks></remarks>
- ''' </summary>
- Public Sub DrawImageWithColor(ByVal G As Graphics, ByVal R As Rectangle, ByVal _Image As Image, C As Color)
- Dim ptsArray As Single()() = {
- New Single() {Convert.ToSingle(C.R / 255), 0, 0, 0, 0}, _
- New Single() {0, Convert.ToSingle(C.G / 255), 0, 0, 0}, _
- New Single() {0, 0, Convert.ToSingle(C.B / 255), 0, 0}, _
- New Single() {0, 0, 0, Convert.ToSingle(C.A / 255), 0}, _
- New Single() {Convert.ToSingle(C.R / 255), Convert.ToSingle(C.G / 255), Convert.ToSingle(C.B / 255), 0.0F, Convert.ToSingle(C.A / 255)}}
- Dim imgAttribs As New Imaging.ImageAttributes
- imgAttribs.SetColorMatrix(New Imaging.ColorMatrix(ptsArray), Imaging.ColorMatrixFlag.Default, Imaging.ColorAdjustType.Default)
- G.DrawImage(_Image, R, 0, 0, _Image.Width, _Image.Height, GraphicsUnit.Pixel, imgAttribs)
- _Image.Dispose()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment