misterxed Level: VB Lord

 Registered: 12-06-2005 Posts: 151
|
Path To Region Error
hi there,
i want to create a REGION consisting only of the white part of a monochrome picture. The code i have used converts the white part into a PATH, and then use da PathToRegion API to convert the path into a region. As far as the formation of the path is concerned, its good, and i am able to draw it on the screen using StrokePath API. But unfortunately when the conversion of path into Region comes, the region formed is not like the Path.
It might be because the PathToRegion API first closes all the open figures and then converts the path into a region.If anybody can help me then I'll be obliged.I'm using the following code to make the path:
started = 0
Call BeginPath(Picture2.hdc)
For y = 1 To Picture1.ScaleHeight - 1
For x = 1 To Picture1.ScaleWidth - 1
If GetPixel(Picture1.hdc, x, y) Then
If started = 0 Then
Call MoveToEx(Picture2.hdc, x, y, POINT)
started = 1
End If
Call LineTo(Picture2.hdc, x, y)
End If
Next x
Next y
Call EndPath(Picture2.hdc)
Call StrokePath(Picture2.hdc)
|
This code will just make the Path and draw it for you on the Picture2.Try to get a Monochrome picture in the Picture1.
Regards,
Misterxed...
____________________________
lOsT...
|