Fill Polygon

Fills a polygon with a color.

Examples Filter
#setup vars

$OutputFile = "C:\Users\cs1dah\Downloads\result.jpg"

$bmp = new-object System.Drawing.Bitmap 400,400

$brushWhite = [System.Drawing.Brushes]::White
$brushBlack = [System.Drawing.Brushes]::Black

$graphics = [System.Drawing.Graphics]::FromImage($bmp) 
$graphics.FillRectangle($brushBg,0,0,$bmp.Width,$bmp.Height)

#define points

[System.Drawing.Point]$pt1 = [System.Drawing.Point]::new(100,100)
[System.Drawing.Point]$pt2 = [System.Drawing.Point]::new(100,150)
[System.Drawing.Point]$pt3 = [System.Drawing.Point]::new(150,150)

#create array of points

[System.Drawing.Point[]]$PolyPoints = ($pt1,$pt2,$pt3)

$graphics.FillPolygon($brushBlack, $PolyPoints)

$bmp.Save($OutputFile) 

# Tidy Up

$bmp.Dispose()

# launch Output file 

& $OutputFile