Solved

VC++ 5.0and Floodfill

Posted on 1998-02-16
5
296 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

937 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

6 Experts available now in Live!

Get 1:1 Help Now