Solved

VC++ 5.0and Floodfill

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

815 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