XRendering AntiAliasPolygons Property. Whether to anti-alias polygons. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Value Read Only Description
[C#] bool

[Visual Basic]
Boolean
true No Whether to anti-alias polygons.

 

   

Notes
 

Determines whether polygons will be rendered with anti-aliased edges.

Anti-aliasing is a technique for using gradients of color to eliminate jagged edges when objects are drawn. The object edges are blurred to reduce pixelation.

 

   

Example
 

The following example shows the effect that this parameter has on PDF rendering.

[C#]
Doc theDoc = new Doc();
// Add a polygon
theDoc.Color.String = "255 0 0";
theDoc.AddPoly("32 650 50 704 68 650 22 683 79 683 32 650", true);
theDoc.Rect.String = "20 650 80 704";
// Render the drawn area with AntiAliasPolygons (default)
Bitmap antiAliasedBitmap = theDoc.Rendering.GetBitmap();
// Render the drawn area without AntiAliasPolygons
theDoc.Rendering.AntiAliasPolygons = false;
Bitmap aliasedBitmap = theDoc.Rendering.GetBitmap();
// Add magnified aliased image
theDoc.Rect.String = "5 20 605 560";
theDoc.AddImageBitmap(aliasedBitmap, false);
// Anotate
theDoc.Color.String = "black";
theDoc.FontSize = 30;
theDoc.Pos.String = "20 750";
theDoc.AddText("Original path:");
theDoc.Pos.String = "20 620";
theDoc.AddText("Magnified rendered image:");
// Render the document with aliased image
theDoc.Rendering.DotsPerInch = 36;
theDoc.Rect.String = theDoc.MediaBox.String;
theDoc.Rendering.Save(Server.MapPath("RenderingAntiAliasPolygonsFalse.png"));
// Add magnified antialiased image
theDoc.Rect.String = "5 20 605 560";
theDoc.AddImageBitmap(antiAliasedBitmap, false);
// Render the document with antialiased image
theDoc.Rendering.DotsPerInch = 36;
theDoc.Rect.String = theDoc.MediaBox.String;
theDoc.Rendering.Save(Server.MapPath("RenderingAntiAliasPolygonsTrue.png"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
' Add a polygon
theDoc.Color.String = "255 0 0"
theDoc.AddPoly("32 650 50 704 68 650 22 683 79 683 32 650", True)
theDoc.Rect.String = "20 650 80 704"
' Render the drawn area with AntiAliasPolygons (default)
Dim antiAliasedBitmap As Bitmap = theDoc.Rendering.GetBitmap()
' Render the drawn area without AntiAliasPolygons
theDoc.Rendering.AntiAliasPolygons = False
Dim aliasedBitmap As Bitmap = theDoc.Rendering.GetBitmap()
' Add magnified aliased image
theDoc.Rect.String = "5 20 605 560"
theDoc.AddImageBitmap(aliasedBitmap, False)
' Anotate
theDoc.Color.String = "black"
theDoc.FontSize = 30
theDoc.Pos.String = "20 750"
theDoc.AddText("Original path:")
theDoc.Pos.String = "20 620"
theDoc.AddText("Magnified rendered image:")
' Render the document with aliased image
theDoc.Rendering.DotsPerInch = 36
theDoc.Rect.String = theDoc.MediaBox.String
theDoc.Rendering.Save(Server.MapPath("RenderingAntiAliasPolygonsFalse.png"))
' Add magnified antialiased image
theDoc.Rect.String = "5 20 605 560"
theDoc.AddImageBitmap(antiAliasedBitmap, False)
' Render the document with antialiased image
theDoc.Rendering.DotsPerInch = 36
theDoc.Rect.String = theDoc.MediaBox.String
theDoc.Rendering.Save(Server.MapPath("RenderingAntiAliasPolygonsTrue.png"))
theDoc.Clear()


RenderingAntiAliasPolygonsTrue.png


RenderingAntiAliasPolygonsFalse.png