Click or drag to resize

PdfBaseShape Class

A base class for any repeatable composite drawing action. To use this class inherit from PdfBaseShape then override the CloneInstance and DrawShape methods to get the PdfPageRenderer object.
Inheritance Hierarchy
SystemObject
  Atalasoft.PdfDoc.Generating.ShapesPdfBaseShape
    More...

Namespace:  Atalasoft.PdfDoc.Generating.Shapes
Assembly:  Atalasoft.PdfDoc (in Atalasoft.PdfDoc.dll) Version: 11.0.0.0.0.297 (.NET 4.5.2, x86)
Syntax
[SerializableAttribute]
public abstract class PdfBaseShape : ICloneable, 
	IPdfRenderable, IPdfResourceConsumer

The PdfBaseShape type exposes the following members.

Constructors
  NameDescription
Protected methodPdfBaseShape
Initializes a new instance of the PdfBaseShape class.
Protected methodPdfBaseShape(IPdfColor)
Initializes a new instance of the PdfBaseShape class.
Protected methodPdfBaseShape(IPdfColor, Double)
Initializes a new instance of the PdfBaseShape class.
Protected methodPdfBaseShape(IPdfColor, Double, IPdfColor)
Initializes a new instance of the PdfBaseShape class.
Top
Properties
  NameDescription
Public propertyClip
Gets or sets a value indicating whether this PdfBaseShape shape will clip.
Public propertyFillColor
Gets or sets the color of the fill.
Public propertyLocation
Gets or sets the location.
Public propertyName
Gets or sets the name of the IPdfRenderable object.
Public propertyOutlineColor
Gets or sets the color of the outline.
Public propertyRotation
Gets or sets the rotation in degrees.
Public propertyScale
Gets or sets the scale.
Public propertyStyle
Gets or sets the style.
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
Protected methodCloneInstance
Clones the instance.
Public methodCopyBaseShapePropertiesTo
Copies the base shape properties to the parameter shape.
Protected methodDrawShape
Draws the shape.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Protected methodGenerateTransform
Generates the default transform based on Scale, Rotate, and Translate.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNotifyResourceRenamed
Notifies a resource consumer that a resource was renamed.
Protected methodOnResourceRenamed
Called when a resource in the base shape has been renamed.
Protected methodOnResourcesRequested
Called when the PdfBaseShape is requested to report resources used. If client code consumes resources, it should override this method combining its results with those of base.OnResourceRequested
Public methodRender
Generates the PDF.
Public methodResourcesUsed
Reports a list of all resources consumed by the object of the given class.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
public class RegularPolygon : PdfBaseShape
{
public RegularPolygon(PdfPoint center, double radius, int sides):base(PdfColorFactory.FromGray(0.0),5.0)
{
if (sides < 3) throw new ArgumentException("Polygons must have 3 sides");
GeneratePoints(center, radius, sides);
Center = center;
Radius = radius;
Sides = sides;
}
public PdfPoint Center { get; private set; }
public double Radius { get; private set; }
public int Sides { get; private set; }
private void GeneratePoints(PdfPoint center, double radius, int sides)
{
Points = new List<PdfPoint>();
PdfPoint currPoint = new PdfPoint(0, radius);
Points.Add(currPoint + center);
PdfTransform transform = PdfTransform.Rotate(2 * Math.PI/(double)sides);
for (int i = 1; i < sides; i++)
{
currPoint = transform.Transform(currPoint);
Points.Add(currPoint + center);
}
}
public List<PdfPoint> Points { get; set; }
protected override PdfBaseShape CloneInstance()
{
return new RegularPolygon(Center, Radius, Sides);
}
protected override void DrawShape(PdfPageRenderer r)
{
bool first = true;
PdfPath path = new PdfPath(this);
foreach (PdfPoint p in Points)
{
if (first) { first = false; path.MoveTo(p); }
else { path.LineTo(p); }
}
path.Close();
path.GeneratePdf(w);
}
}
See Also
Inheritance Hierarchy
SystemObject
  Atalasoft.PdfDoc.Generating.ShapesPdfBaseShape
    Atalasoft.PdfDoc.BarcodeWritingBarcodeWritingShape
    Atalasoft.PdfDoc.BarcodeWritingDataMatrixBarcodeWritingShape
    Atalasoft.PdfDoc.BarcodeWritingPdf417BarcodeWritingShape
    Atalasoft.PdfDoc.Generating.ShapesPdfArc
    Atalasoft.PdfDoc.Generating.ShapesPdfBaseTextShape
    Atalasoft.PdfDoc.Generating.ShapesPdfCircle
    Atalasoft.PdfDoc.Generating.ShapesPdfImageShape
    Atalasoft.PdfDoc.Generating.ShapesPdfPath
    Atalasoft.PdfDoc.Generating.ShapesPdfRectangle
    Atalasoft.PdfDoc.Generating.ShapesPdfRoundedRectangle
    Atalasoft.PdfDoc.Generating.ShapesPdfTemplateShape
    Atalasoft.PdfDoc.Generating.ShapesPostnetBarcodeShape
    Atalasoft.PdfDoc.Generating.Utilities.VectorImport.DOMSvgDocument