Solved

VC++ 5.0and Floodfill

Posted on 1998-02-16
5
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

734 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