|
|
Rank: Member Groups: Member
Joined: 11/5/2007 Posts: 3 Points: 0
|
I tried converting this function up to VB .NET but it doesn't seem to want to work.. so many references seem to have changed since the version that this code was made for: http://www.aurigma.com/Forums/Topic62-3-1.aspxCould someone possibly provide a .NET version of this? Thanks!
|
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 8/3/2003 Posts: 586 Points: 588
|
Hello, API of Graphics Mill for .NET is not fully compatible with Graphics Mill for ActiveX. The main concept of algorithm is correct but there should be changes in code lines for getting histogram. In .NET version you should use Bitmap.Statistics.GetSumHistogram(Int32). Please, try it out.
Sincerely yours, Dmitry Sevostyanov.
|
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 1/31/2005 Posts: 386 Points: 403
|
Hi, Here is an equivalent of the mentioned ActiveX sample: Code:
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("x:/tests/Rgb24.jpg")
bv.Bitmap = bitmap
Dim histogram As Aurigma.GraphicsMill.Histogram
Dim avgRed, avgGreen, avgBlue As Integer
histogram = bitmap.Statistics.GetSumHistogram(Aurigma.GraphicsMill.ColorChannel.Red)
avgRed = System.Math.Round(histogram.Mean)
histogram.Dispose()
histogram = bitmap.Statistics.GetSumHistogram(Aurigma.GraphicsMill.ColorChannel.Green)
avgGreen = System.Math.Round(histogram.Mean)
histogram.Dispose()
histogram = bitmap.Statistics.GetSumHistogram(Aurigma.GraphicsMill.ColorChannel.Blue)
avgBlue = System.Math.Round(histogram.Mean)
histogram.Dispose()
Dim color As Aurigma.GraphicsMill.Color = Aurigma.GraphicsMill.Color.FromRgb(avgRed, avgGreen, avgBlue)
Dim g As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics()
Try
Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush(color)
g.FillRectangle(brush, 0, 0, 100, 100)
Finally
g.Dispose()
End Try
Best wishes, Alex.
|
|
Rank: Member Groups: Member
Joined: 11/5/2007 Posts: 3 Points: 0
|
Great! That works just fine. Now, I've dug up another 'classic' from your forums: http://www.aurigma.com/Forums/Topic77-3-1.aspxThis one doesn't seem to be .NET 2.0, would it be possible to have this one in the latest format? Thanks a lot.
|
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 1/31/2005 Posts: 386 Points: 403
|
Hello, You can find the updated version of the sample in this topic.
Best wishes, Alex.
|
|
|
Guest |