Solved

VC++ 5.0and Floodfill

Posted on 1998-02-16
5
295 Views
Last Modified: 2008-02-01
Can someone give me the proper parameters and usage for Floodfill. I apologize for the spelling in advance.
0
Comment
Question by:KOCUBA
  • 4
5 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1182366
Answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1182367
This is right from the VC++ online help.

********************************************************
The FloodFill function fills an area of the display surface with the current brush. The area is assumed to be bounded as specified by the crFill parameter.

The FloodFill function is included only for compatibility with earlier versions of Windows. For Win32-based applications, use the ExtFloodFill function with FLOODFILLBORDER specified.

BOOL FloodFill(HDC hdc, // handle to device context
               int nXStart, // x-coordinate, where fill begins
               int nYStart, // y-coordinate, where fill begins
               COLORREF crFill // fill color
);


Parameters

hdc

Identifies a device context.

nXStart

Specifies the logical x-coordinate of the point where filling is to begin.

nYStart

Specifies the logical y-coordinate of the point where filling is to begin.

crFill

Specifies the color of the boundary or of the area to be filled.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Following are reasons this function might fail:

· The fill could not be completed.

· The given point has the boundary color specified by the crFill parameter.

· The given point lies outside the current clipping region ¾ that is, it is not visible on the device.
*************************************************************

In English, this procedure is used to fill an area of a device context with a brush.  The area to be filled is bounded by pixels of a specified color.  If you've used paint programs before, this is kinda like the paint can tool that "pours" paint into an area until it reaches the edges of the area (pixels of a different color).
0
 
LVL 22

Expert Comment

by:nietod
ID: 1182368
Note as, the documentation said, These days ExtFloodFill is preferred.  It can be made to worj just like FloodFill, but has other options as well.  (It can be made to work more like a paint can tool.)
0
 

Author Comment

by:KOCUBA
ID: 1182369
Great info. The reason I had to ask this question was the VC++ help that I have from the Learning Edition does not show the HDC in the parameters. Good thing I asked.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1182370
That could be showing an MFC version of floodfill.  MFC defines a class that encapsulates device contexts.  The class has all (most at least) the functions that take HDC's.  But you don't pass an HDC to these functions since they operate on the HDC associated with the object.  Does that makes sense?  It is hard to explain clearly.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

747 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

12 Experts available now in Live!

Get 1:1 Help Now