/// <summary> /// Indicates whether the specified point is contained within the annotation. /// </summary> /// <param name="point">Point in image space.</param> /// <returns><b>true</b> if the specified point is contained within the annotation; /// otherwise, <b>false</b>.</returns> public override bool IsPointOnFigure(PointF point) { using (IGraphicsPath path = ((MarkAnnotationRenderer)Renderer).GetAsGraphicsPath(DrawingFactory.Default)) { path.Transform(GetTransformFromContentToImageSpace()); using (IDrawingPen pen = DrawingFactory.Default.CreatePen(Outline)) { return(path.Contains(point) || path.OutlineContains(point, pen)); } } }
/// <summary> /// Returns a drawing box of annotation, in the image space. /// </summary> /// <param name="drawingSurface">The object that provides information about drawing surface.</param> /// <returns>Drawing box of annotation, in the image space.</returns> public override RectangleF GetDrawingBox(DrawingSurface drawingSurface) { using (IGraphicsPath path = GetAsGraphicsPath(DrawingFactory.Default)) { using (IDrawingPen pen = DrawingFactory.Default.CreatePen(Data.Outline)) { // create transformation that allows to get correct bounding box AffineMatrix transform = AffineMatrix.CreateRotation(MarkAnnoData.Rotation); transform.Translate(MarkAnnoData.Location.X, MarkAnnoData.Location.Y); return(path.GetBounds(pen, transform)); } } }
/// <summary> /// Renders the annotation on the <see cref="T:Vintasoft.Imaging.Drawing.DrawingEngine" /> /// in the coordinate space of annotation. /// </summary> /// <param name="drawingEngine">The <see cref="T:Vintasoft.Imaging.Drawing.DrawingEngine" /> to render on.</param> /// <param name="drawingSurface">The object that provides information about drawing surface.</param> protected override void RenderInContentSpace(DrawingEngine drawingEngine, DrawingSurface drawingSurface) { using (IGraphicsPath path = GetAsGraphicsPath(drawingEngine.DrawingFactory)) { if (Data.FillBrush != null) { using (IDrawingBrush brush = drawingEngine.DrawingFactory.CreateBrush(Data.FillBrush)) drawingEngine.FillPath(brush, path); } if (Data.Border) { using (IDrawingPen pen = drawingEngine.DrawingFactory.CreatePen(Data.Outline)) drawingEngine.DrawPath(pen, path); } } }