Brightness එක වැඩි කිරීම.
මේ සඳහා පහත Code එක භාවිතා කරන්න.
Private Sub Brightness() Dim img As New Bitmap(picImage.Image) Dim colX As Integer Progressbar.Maximum = img.Width For Xpos = 0 To img.Width - 1 For Ypos = 0 To img.Height - 1 colR = img.GetPixel(Xpos, Ypos).R colG = img.GetPixel(Xpos, Ypos).G colB = img.GetPixel(Xpos, Ypos).B colX = (colR + colG + colB) / 3 colX = colX / 10 colR = Math.Min((colR + colX), 255) colG = Math.Min((colG + colX), 255) colB = Math.Min((colB + colX), 255) img.SetPixel(Xpos, Ypos, Color.FromArgb(colR, colG, colB)) Next Progressbar.Value = Xpos Next picImage.Image = img Progressbar.Value = 0 End Subමෙහි colX = colX / 10 යන්නෙහි 10 වෙනුවට වෙනත් අගයක් යෙදීමෙන් Brightness එක අවශ්ය පරිදි වෙනස් කර ගන්න පුලුවන්.
Brightness එක අඩු කිරීම.
මේ සඳහා පහත Code එක භාවිතා කරන්න.
Private Sub Darkness() Dim img As New Bitmap(picImage.Image) Dim colX As Integer Progressbar.Maximum = img.Width For Xpos = 0 To img.Width - 1 For Ypos = 0 To img.Height - 1 colR = img.GetPixel(Xpos, Ypos).R colG = img.GetPixel(Xpos, Ypos).G colB = img.GetPixel(Xpos, Ypos).B colX = (colR + colG + colB) / 3 colX = colX / 10 colR = Math.Min(Math.Abs((colR - colX)), 255) colG = Math.Min(Math.Abs((colG - colX)), 255) colB = Math.Min(Math.Abs((colB - colX)), 255) img.SetPixel(Xpos, Ypos, Color.FromArgb(colR, colG, colB)) Next Progressbar.Value = Xpos Next picImage.Image = img Progressbar.Value = 0 End Subමා මෙම ලිපි දෙකෙන්ම ඉදිරිපත් කරපු දේවල් එකතු කරල පොඩි Application එකක් හදල තියෙනව. පහත Link එකෙන් එය Download කරගන්න.
Download
මෙය භාවිතා කිරීමට .NET Framework 2.0 හෝ ඉහල Version එකක් අවශ්ය වේ.
3 comments:
GDI+ කියන්නේ මොකක්ද කියන තැනෙ ඉදලම පටන් ගත්ත නම් නෙද හොද ඇත්තටම මොකක්ද ඔය GDI+ කියන්නෙ
මීට කලින් ලිපියේ ඒ ගැන ලියල තියෙනවා. http://thecodelibrary.blogspot.com/2010/11/gdi-pictures-effects.html
මම GDI+ මුලින්ම භාවිතා කරේ forum එකක දාල තිබුන මගේ signature එකට. ඒකෙන් form එක බලන කෙනාගෙ විස්තර පෙන්නනව IP to City database එකක් භාවිතා කරල. ඊට පස්සෙ නම් රාජකාරි වැඩ වලටත් භාවිතා කරා. හොඳ ලිපියක්.
Post a Comment