Geoff,
Geoff Jones said:
Thanks for looking at this for me Herfried. Here is my VB version:
Very quick and dirty, but seems to work:
\\\
Private Function GetRegion( _
ByVal _img As Bitmap, _
ByVal color As Color _
) As Region
Dim _matchColor As Color = _
color.FromArgb(color.R, color.G, color.B)
Dim rgn As System.Drawing.Region = New Region
rgn.MakeEmpty()
Dim rc As Rectangle = New Rectangle(0, 0, 0, 0)
Dim inimage As Boolean = False
Dim x As Integer
Dim y As Integer
For y = 0 To _img.Height - 1
For x = 0 To _img.Width - 1
If Not (inimage) Then
If _
Not color.op_Equality(_img.GetPixel(x, y), _matchColor)
_
Then
inimage = True
rc.X = x
rc.Y = y
rc.Height = 1
End If
Else
inimage = False
rc.Width = _img.Width - rc.X
rgn.Union(rc)
End If
Next
If inimage Then
inimage = False
rc.Width = _img.Width - rc.X
rgn.Union(rc)
End If
Next
Return rgn
End Function
///