DynaPDF.Triangle
----------------

The function draws a triangle.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.2](newinversion32.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.Triangle"; PDF; x1; y1; x2; y2; x3; y3; FillMode ) 

**MBS**( **"DynaPDF.Triangle";** /\* The function draws a triangle. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$x1**; /\* X-Coordinate of the first point \*/   
**$y1**; /\* Y-Coordinate of the first point \*/   
**$x2**; /\* X-Coordinate of the second point \*/   
**$y2**; /\* y-Coordinate of the second point \*/   
**$x3**; /\* X-Coordinate of the third point \*/   
**$y3**; /\* Y-Coordinate of the third point \*/   
**$FillMode**) /\* Fill mode. Can be FillNoClose, StrokeNoClose, FillStrokeNoClose, Fill, Stroke, FillStroke, FillEvOdd, FillStrokeEvOdd, FillEvOddNoClose, FillStrokeEvOddNoClose, NoFill or Close.e.g. "fill" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| x1 | X-Coordinate of the first point |  |
| y1 | Y-Coordinate of the first point |  |
| x2 | X-Coordinate of the second point |  |
| y2 | y-Coordinate of the second point |  |
| x3 | X-Coordinate of the third point |  |
| y3 | Y-Coordinate of the third point |  |
| FillMode | Fill mode. Can be FillNoClose, StrokeNoClose, FillStrokeNoClose, Fill, Stroke, FillStroke, FillEvOdd, FillStrokeEvOdd, FillEvOddNoClose, FillStrokeEvOddNoClose, NoFill or Close. | "fill" |

### Result

Returns OK or error message.

### Description

The function draws a triangle.  
The draw direction can be changed with the function [DynaPDF.SetDrawDirection](DynaPDFSetDrawDirection.md).  
A triangle is a closed path that can be filled, stroked or both. It is also possible to draw a triangle invisible to apply the filling rules nonzero winding number or even-odd. The filling rules are described under ClipPath(). The parameter FillMode is ignored if the triangle is drawn inside a clipping path. The fill modes are described under ClosePath().  
See also [Triangle](https://www.monkeybreadsoftware.com/DynaPDF-Manual/Triangle.shtml) function in DynaPDF manual.

### Examples

Draw blue triangle with black border:

 Set Variable \[ $r ; Value: MBS ("[DynaPDF.SetStrokeColor](DynaPDFSetStrokeColor.md)"; $pdf ; 0; 0; 0) \]   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.SetFillColor](DynaPDFSetFillColor.md)"; $pdf ; 0; 0; 0.8 ) \]   
Set Variable \[ $r ; Value: MBS ( "DynaPDF.Triangle"; $pdf ; 100; 100; 100; 250; 250; 200; "fillStroke" ) \]  
### See also

- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.Rectangle](DynaPDFRectangle.md)
- [DynaPDF.SetDrawDirection](DynaPDFSetDrawDirection.md)
- [DynaPDF.SetFillColor](DynaPDFSetFillColor.md)
- [DynaPDF.SetStrokeColor](DynaPDFSetStrokeColor.md)

This function checks for a license.

Created 18th August 2014 , last changed 3th January 2021

  
[DynaPDF.TranslateCoords](DynaPDFTranslateCoords.md) - [DynaPDF.UnLockLayer](DynaPDFUnLockLayer.md)

[HTML Version](DynaPDFTriangle.shtml)