Solved

Graphical Methodes of the PictureBox Object

Posted on 1997-11-11
4
234 Views
Last Modified: 2010-05-18
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
 
0
Comment
Question by:never
4 Comments
 
LVL 3

Expert Comment

by:wolfcrag
Comment Utility
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
0
 

Author Comment

by:never
Comment Utility
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.
0
 
LVL 8

Accepted Solution

by:
mrmick earned 50 total points
Comment Utility
You can access bitmap data as an array.  It's not an easy method.  Get the scoop in the October 1997 Visual Basic Programmer's Journal article titled "Write Faster Apps with VB Pointers".

In regard to the floodfill issue, You can floodfill an area bounded by different colors by using the FLOODFILLSURFACE as the fill type.  In this case, the fill area is defined by the color that is specified by FillColor. Filling continues outward in all directions as long as the FillColor is encountered.

0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
Bought This Question.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now