PdfBaseShape Class |
Namespace: Atalasoft.PdfDoc.Generating.Shapes
The PdfBaseShape type exposes the following members.
| Name | Description | |
|---|---|---|
| PdfBaseShape |
Initializes a new instance of the PdfBaseShape class.
| |
| PdfBaseShape(IPdfColor) |
Initializes a new instance of the PdfBaseShape class.
| |
| PdfBaseShape(IPdfColor, Double) |
Initializes a new instance of the PdfBaseShape class.
| |
| PdfBaseShape(IPdfColor, PdfLineStyle, IPdfColor) |
Initializes a new instance of the PdfBaseShape class.
| |
| PdfBaseShape(IPdfColor, Double, IPdfColor) |
Initializes a new instance of the PdfBaseShape class.
|
| Name | Description | |
|---|---|---|
| Clip |
Gets or sets a value indicating whether this PdfBaseShape shape will clip.
| |
| FillColor |
Gets or sets the color of the fill.
| |
| Location |
Gets or sets the location.
| |
| Name |
Gets or sets the name of the IPdfRenderable object.
| |
| OutlineColor |
Gets or sets the color of the outline.
| |
| Rotation |
Gets or sets the rotation in degrees.
| |
| Scale |
Gets or sets the scale.
| |
| Style |
Gets or sets the style.
|
| Name | Description | |
|---|---|---|
| Clone |
Creates a new object that is a copy of the current instance.
| |
| CloneInstance |
Clones the instance.
| |
| CopyBaseShapePropertiesTo |
Copies the base shape properties to the parameter shape.
| |
| DrawShape |
Draws the shape.
| |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| GenerateTransform |
Generates the default transform based on Scale, Rotate, and Translate.
| |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| NotifyResourceRenamed |
Notifies a resource consumer that a resource was renamed.
| |
| OnResourceRenamed |
Called when a resource in the base shape has been renamed.
| |
| OnResourcesRequested |
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 | |
| Render |
Generates the PDF.
| |
| ResourcesUsed |
Reports a list of all resources consumed by the object of the given class.
| |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
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); } }