well i have 2 pictures and i whant to make a efect at the second image and then aply the result in the 1 image.
1 image:
2 image or so called mask:
the code i have in the first button it makes the change color of the mask from red to green and then in the 2 button it makes the transparent and it passes to picturebox4
now i whanted a button that take the picturebox1 and the picturebox4 and join togheter to create the outfit with the mask color.
and save that on picturebox5 :|
somebody can help??? the code is \/
1 image:
2 image or so called mask:
the code i have in the first button it makes the change color of the mask from red to green and then in the 2 button it makes the transparent and it passes to picturebox4
now i whanted a button that take the picturebox1 and the picturebox4 and join togheter to create the outfit with the mask color.
and save that on picturebox5 :|
somebody can help??? the code is \/
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim originalBMP As New Bitmap(PictureBox2.Image)
' //make a copy so original will still be available
Dim swappedBMP = New Bitmap(originalBMP)
Dim g As Graphics = Graphics.FromImage(swappedBMP)
' // Create a color map.
Dim MyColorMap(0) As ColorMap
MyColorMap(0) = New ColorMap()
MyColorMap(0).OldColor = Color.Red
MyColorMap(0).NewColor = Color.Green
'// Create an ImageAttributes object, and call SetRemapTable
Dim imageAttr As New ImageAttributes()
imageAttr.SetRemapTable(MyColorMap)
' //overdraw the bitmap with swapped colors
g.DrawImage(swappedBMP, New Rectangle(0, 0, swappedBMP.Width, swappedBMP.Height), 0, 0, swappedBMP.Width, swappedBMP.Height, GraphicsUnit.Pixel, imageAttr)
PictureBox3.Image = swappedBMP
Dim ga As Graphics = Me.PictureBox3.CreateGraphics()
ga.Clear(Me.BackColor)
Dim rect As New Rectangle(20, 20, 200, 100)
Dim bitmap As Bitmap = Me.PictureBox3.Image
Dim ptsArray As Single()() = {New Single() {1, 0, 0, 0, 0}, New Single() {0, 1, 0, 0, 0}, New Single() {0, 0, 1, 0, 0}, New Single() {0, 0, 0, 0.5F, 0}, New Single() {0, 0, 0, 0, 1}}
Dim clrMatrix As New ColorMatrix(ptsArray)
Dim imgAttributes As New ImageAttributes
imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap)
ga.DrawImage(bitmap, New Rectangle(0, 0, PictureBox3.Width, PictureBox3.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, imgAttributes)
' Dispose
PictureBox4.Image = bitmap
ga.Dispose()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim g As Graphics = Me.PictureBox3.CreateGraphics()
g.Clear(Me.BackColor)
Dim rect As New Rectangle(20, 20, 200, 100)
Dim bitmap As Bitmap = Me.PictureBox3.Image
Dim ptsArray As Single()() = {New Single() {1, 0, 0, 0, 0}, New Single() {0, 1, 0, 0, 0}, New Single() {0, 0, 1, 0, 0}, New Single() {0, 0, 0, 0.5F, 0}, New Single() {0, 0, 0, 0, 1}}
Dim clrMatrix As New ColorMatrix(ptsArray)
Dim imgAttributes As New ImageAttributes
imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap)
g.DrawImage(bitmap, New Rectangle(0, 0, PictureBox3.Width, PictureBox3.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, imgAttributes)
' Dispose
g.Dispose()
End Sub