EDN Admin
Well-known member
I am not sure if this is the right place to ask this question, but just see is there anyone could help.
I am going to blend two images together using multiply blending, and will <span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px iterate through all pixels. I have search
in wikipedia that the calculation of multiply blending is:
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px resultRGB= src * dst / 255
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px but it didnt mention about alpha, how does alpha affect the result?
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:x-small <span style="line-height:16px I just copy my code here to see anyone knows the right way to calculate this.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; For y = 0 <span style="color:Blue; To fsrc.Height - 1
<span style="color:Blue; For x = 0 <span style="color:Blue; To fsrc.Width - 1
<span style="color:Blue; Dim d <span style="color:Blue; As Color = fdst.GetPixel(x, y)
<span style="color:Blue; Dim da = d.A / 255, dr = d.R / 255, dg = d.G / 255, db = d.B / 255
<span style="color:Blue; Dim s <span style="color:Blue; As Color = fsrc.GetPixel(x, y)
<span style="color:Blue; Dim sa = s.A / 255, sr = s.R / 255, sg = s.G / 255, sb = s.B / 255
<span style="color:Blue; Dim ra = sa + da * (1 - sa) <span style="color:Green; alpha?
<span style="color:Blue; Dim rr = sr * dr
<span style="color:Blue; Dim rg = sg * dg
<span style="color:Blue; Dim rb = sb * db
fdst.SetPixel(x, y, Color.FromArgb(ra * 255, rr * 255, rg * 255, rb * 255))
<span style="color:Blue; Next
<span style="color:Blue; Next
[/code]
<img src="http://social.microsoft.com/Forums/getfile/5694/" alt="
View the full article
I am going to blend two images together using multiply blending, and will <span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px iterate through all pixels. I have search
in wikipedia that the calculation of multiply blending is:
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px resultRGB= src * dst / 255
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px but it didnt mention about alpha, how does alpha affect the result?
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:x-small <span style="line-height:16px I just copy my code here to see anyone knows the right way to calculate this.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; For y = 0 <span style="color:Blue; To fsrc.Height - 1
<span style="color:Blue; For x = 0 <span style="color:Blue; To fsrc.Width - 1
<span style="color:Blue; Dim d <span style="color:Blue; As Color = fdst.GetPixel(x, y)
<span style="color:Blue; Dim da = d.A / 255, dr = d.R / 255, dg = d.G / 255, db = d.B / 255
<span style="color:Blue; Dim s <span style="color:Blue; As Color = fsrc.GetPixel(x, y)
<span style="color:Blue; Dim sa = s.A / 255, sr = s.R / 255, sg = s.G / 255, sb = s.B / 255
<span style="color:Blue; Dim ra = sa + da * (1 - sa) <span style="color:Green; alpha?
<span style="color:Blue; Dim rr = sr * dr
<span style="color:Blue; Dim rg = sg * dg
<span style="color:Blue; Dim rb = sb * db
fdst.SetPixel(x, y, Color.FromArgb(ra * 255, rr * 255, rg * 255, rb * 255))
<span style="color:Blue; Next
<span style="color:Blue; Next
[/code]
<img src="http://social.microsoft.com/Forums/getfile/5694/" alt="
View the full article