تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] فلاتر والوان للصور
#1
Photo 
السلام عليكم ورحمة الله وبركاته


لمحبين ال GDI

من خلال التجارب الي جربتها على الصورة كانت النتيجه حلوه وتغيرت عندي الوان الصورة بشكل فلاتر




الاصلية

1.jpg -  209 KB

التغييرات

222.jpg -  180 KB
333.jpg -  207 KB
444.jpg -  205 KB
555.jpg -  212 KB
666.jpg -  208 KB



للأسف لم استطع رفع البرنامج
لكن هذا السوروس كود كامل



كود :
'3booody
'vb4arb.com
Public Class Form1
   Dim btm1, btm2 As Bitmap
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       btm1 = New Bitmap("C:\Users\ahmed\Desktop\abod\image1.jpg") 'هنا توضع مسار الصورة
       PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
       PictureBox1.Image = btm1
   End Sub
   Enum Filter
       Red
       Blue
       BlackWhite
       Yellow
       Green
   End Enum
   Function NewImage(ByVal oldImage As Bitmap, ByVal Filter As Filter) As Image
       Dim R, G, B As Short
       btm2 = New Bitmap(oldImage)
       Select Case Filter
           Case Form1.Filter.BlackWhite
               For x As Integer = 0 To btm2.Width - 1
                   For y As Integer = 0 To btm2.Height - 1
                       Dim Clr As Color = btm2.GetPixel(x, y)
                       R = Clr.R : G = Clr.G : B = Clr.B
                       Dim A As Short = R + G + B
                       Dim Av As Short = A / 3
                       btm2.SetPixel(x, y, Color.FromArgb(Av, Av, Av))
                   Next
               Next
               Return btm2
           Case Form1.Filter.Red
               For x As Integer = 0 To btm2.Width - 1
                   For y As Integer = 0 To btm2.Height - 1
                       Dim Clr As Color = btm2.GetPixel(x, y)
                       R = Clr.R : G = Clr.G : B = Clr.B
                       R += 30
                       If R > 255 Then R = 255
                       G -= 30
                       If G < 0 Then G = 0
                       B -= 30
                       If B < 0 Then B = 0
                       btm2.SetPixel(x, y, Color.FromArgb(R, G, B))
                   Next
               Next
               Return btm2
           Case Form1.Filter.Blue
               For x As Integer = 0 To btm2.Width - 1
                   For y As Integer = 0 To btm2.Height - 1
                       Dim Clr As Color = btm2.GetPixel(x, y)
                       R = Clr.R : G = Clr.G : B = Clr.B
                       B += 30
                       If B > 255 Then B = 255
                       R -= 30
                       If R < 0 Then R = 0
                       G -= 30
                       If G < 0 Then G = 0
                       btm2.SetPixel(x, y, Color.FromArgb(R, G, B))
                   Next
               Next
               Return btm2
           Case Form1.Filter.Yellow
               For x As Integer = 0 To btm2.Width - 1
                   For y As Integer = 0 To btm2.Height - 1
                       Dim Clr As Color = btm2.GetPixel(x, y)
                       R = Clr.R : G = Clr.G : B = Clr.B
                       B -= 100
                       If B < 0 Then B = 0
                       btm2.SetPixel(x, y, Color.FromArgb(R, G, B))
                   Next
               Next
               Return btm2
           Case Form1.Filter.Green
               For x As Integer = 0 To btm2.Width - 1
                   For y As Integer = 0 To btm2.Height - 1
                       Dim Clr As Color = btm2.GetPixel(x, y)
                       R = Clr.R : G = Clr.G : B = Clr.B
                       G += 30
                       If G > 255 Then G = 255
                       R -= 30
                       If R < 0 Then R = 0
                       B -= 30
                       If B < 0 Then B = 0
                       btm2.SetPixel(x, y, Color.FromArgb(R, G, B))
                   Next
               Next
               Return btm2
       End Select
   End Function
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       If btm1 Is Nothing Then Return
       PictureBox1.Image = NewImage(btm1, Filter.BlackWhite)
   End Sub
   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       If btm1 Is Nothing Then Return
       PictureBox1.Image = NewImage(btm1, Filter.Red)
   End Sub
   Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
       If btm1 Is Nothing Then Return
       PictureBox1.Image = NewImage(btm1, Filter.Blue)
   End Sub
   Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
       If btm1 Is Nothing Then Return
       PictureBox1.Image = NewImage(btm1, Filter.Yellow)
   End Sub
   Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
       If btm1 Is Nothing Then Return
       PictureBox1.Image = NewImage(btm1, Filter.Green)
   End Sub
   Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
       If PictureBox1.Image Is Nothing Then Return
       Dim x As Short = e.X * PictureBox1.Image.Width / PictureBox1.ClientSize.Width
       Dim y As Short = e.Y * PictureBox1.Image.Height / PictureBox1.ClientSize.Height
       Using b As New Bitmap(PictureBox1.Image)
           Me.Text = b.GetPixel(x, y).ToString
       End Using
   End Sub
End Class
الرد }}}
تم الشكر بواسطة: tryold , tryold , عبد الهادي بهاب



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم