Link to home
Start Free TrialLog in
Avatar of never
never

asked on

Graphical Methodes of the PictureBox Object

I use a filling algorithm along with the point and pset methods of the picturebox to fill or mask shapes contained in a bitmap like a tree or a house
this way seems to be rather slow
is there any other way which enabels me to perform graphical analysis and changes to a bitmap rather than pset
, point methods
 
Avatar of wolfcrag
wolfcrag

Take a look at the FloodFill and ExtFloodFill API's. What they do is (quickly) fill an area (in a device context) which is defined by a single boundary color. Here is an example of using FloodFill to fill a triangle:

' Place the following code in the declarations section of the form.
Private Declare Sub FloodFill Lib "GDI32" Alias "FloodFill" _
 (ByVal hDC As Long, ByVal X As Long, ByVal Y As _
 Long, ByVal crColor As Long) As Long

Private Sub Form_Click ()
    ScaleMode = vbPixels        ' Windows draws in pixels.
    ForeColor = vbBlack        ' Set draw line to black.
    Line (100, 50)-(300, 50) ' Draw a triangle.
    Line -(200, 200)
    Line -(100, 50)
    FillStyle = vbFSSolid    ' Set FillStyle to solid.
    FillColor = RGB(128, 128, 255)     ' Set FillColor.
   ' Call Windows API to fill.
    FloodFill hDC, 200, 100, ForeColor
End Sub
Avatar of never

ASKER

yes floodfill API dose fill areas bounded by a color ,but i need somthing that fill areas bounded by diffrent colors , or as I said, I need somthing to perform the action of POINT and PSET methods faster than they do,thanks.
ASKER CERTIFIED SOLUTION
Avatar of mrmick
mrmick

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Bought This Question.