Marblecore Imaging Library Documentation

Documentation Introduction
Documentation / Marblecore Imaging / Methods / DrawFloodFill

DrawFloodFill method

Fills a region on the current image canvas with a specific color beginning on the specified position.

Syntax

Boolean DrawFloodFill(nLeft As Number, nTop As Number, nFillColor As Number, nFillOpacity As Number, bFillReplace As Boolean, nFill As Fill, nTolerance As Number, nStopColor As Number, bDiagonal As Boolean)

Return value

Returns true if the function succeeded.

Parameters

ParameterTypeRequiredDescription
nLeftNumberYesLeft coordinate of the begin point.
nTopNumberYesTop coordinate of the begin point.
nFillColorNumberYesSpecifies the fill color.
nFillOpacityNumberNoOptional parameter containing the opacity percentage (where 0% is completely transparent) for the fill color.
bFillReplaceBooleanNoOptional parameter which specifies if the fill color needs to replace each pixel or to overlay the fill color over the pixel using the specified opacity. This parameter only has influence on the fill proces when a fill opacity less then 100% is specified.
nFillFill (Enumeration)NoOptional parameter which specifies the fill method.
nToleranceNumberNoOptional parameter which specifies the fill tolerance (only available if the fill-over method is used).
nStopColorNumberNoOptional parameter which specifies the stop color when using the fill-towards method.
bDiagonalBooleanNoOptional parameter enabling or disabling 8-way floodfill. Disabled by default (4-way floodfill).

Example

The example below shows the effect of this method and how to use it. You can slide the marker in the before/after picture to see the difference. If you take a look at the example code, assume there is a reference to the Marblecore Imaging object with the name 'MarblecoreImaging'. Transparent parts of the image are displayed using a checkerboard pattern.
 
before
after
 
1 // Creates a new transparent image
2 MarblecoreImaging.Create(150, 150, true);
3 
4 // Execute the operation
5 MarblecoreImaging.DrawFloodFill(75, 75, 16711680, 100, true, "Toward", 0, 0);
6 
7 // Save the modified image to the specified file
8 MarblecoreImaging.SaveToFile("example-drawfloodfill-after.jpg");

Category

Drawing

See also

DrawArc | DrawArrow | DrawBackground | DrawBezier | DrawCheckerboard | DrawCurve | DrawCurveBorder | DrawCurveFilled | DrawCurveGradient | DrawEllipse | DrawEllipseBorder | DrawEllipseFilled | DrawEllipseGradient | DrawLine | DrawPie | DrawPieBorder | DrawPieFilled | DrawPieGradient | DrawPixel | DrawPolygon | DrawPolygonBorder | DrawPolygonFilled | DrawPolygonGradient | DrawRectangle | DrawRectangleBorder | DrawRectangleFilled | DrawRectangleGradient | DrawRectangleTransparent | DrawRhombus | DrawRhombusBorder | DrawRhombusFilled | DrawRhombusGradient | DrawRoundRectangle | DrawRoundRectangleBorder | DrawRoundRectangleFilled | DrawRoundRectangleGradient | DrawTriangle | DrawTriangleBorder | DrawTriangleFilled | DrawTriangleGradient | GetPixelColor | LineTo | MoveTo