Пример #1
0
 public override Rectangle GetPathShapeRectangle(Point lastPoint)
 {
     double[] points = GetEllipticalArcMinMaxPoints(lastPoint.GetX(), lastPoint.GetY(), GetCoordinate(0), GetCoordinate
                                                        (1), GetCoordinate(2), GetCoordinate(3) != 0, GetCoordinate(4) != 0, GetCoordinate(5), GetCoordinate(6
                                                                                                                                                             ));
     return(new Rectangle((float)CssUtils.ConvertPxToPts(points[0]), (float)CssUtils.ConvertPxToPts(points[1]),
                          (float)CssUtils.ConvertPxToPts(points[2] - points[0]), (float)CssUtils.ConvertPxToPts(points[3] - points
                                                                                                                [1])));
 }
Пример #2
0
        public override Rectangle GetPathShapeRectangle(Point lastPoint)
        {
            Point controlPoint = GetLastControlPoint();
            Point endingPoint  = GetEndingPoint();

            double[] points = GetBezierMinMaxPoints(lastPoint.GetX(), lastPoint.GetY(), controlPoint.GetX(), controlPoint
                                                    .GetY(), endingPoint.GetX(), endingPoint.GetY());
            return(new Rectangle((float)CssUtils.ConvertPxToPts(points[0]), (float)CssUtils.ConvertPxToPts(points[1]),
                                 (float)CssUtils.ConvertPxToPts(points[2] - points[0]), (float)CssUtils.ConvertPxToPts(points[3] - points
                                                                                                                       [1])));
        }
Пример #3
0
 private void ApplyUserSpaceScaling(SvgDrawContext context)
 {
     if (!this.attributesAndStyles.ContainsKey(SvgConstants.Attributes.MARKER_UNITS) || SvgConstants.Values.STROKEWIDTH
         .Equals(this.attributesAndStyles.Get(SvgConstants.Attributes.MARKER_UNITS)))
     {
         String parentValue = this.GetParent().GetAttribute(SvgConstants.Attributes.STROKE_WIDTH);
         if (parentValue != null)
         {
             // If stroke width is a percentage value is always computed as a percentage of the normalized viewBox diagonal length.
             double rootViewPortHeight    = context.GetRootViewPort().GetHeight();
             double rootViewPortWidth     = context.GetRootViewPort().GetWidth();
             double viewBoxDiagonalLength = CssUtils.ConvertPxToPts(Math.Sqrt(rootViewPortHeight * rootViewPortHeight +
                                                                              rootViewPortWidth * rootViewPortWidth));
             float strokeWidthScale = CssUtils.ConvertPtsToPx(ParseAbsoluteLength(parentValue, (float)viewBoxDiagonalLength
                                                                                  , 1f, context));
             context.GetCurrentCanvas().ConcatMatrix(AffineTransform.GetScaleInstance(strokeWidthScale, strokeWidthScale
                                                                                      ));
         }
     }
 }
 /// <summary>Get bounding rectangle of the current path shape.</summary>
 /// <param name="lastPoint">start point for this shape</param>
 /// <returns>calculated rectangle</returns>
 public virtual Rectangle GetPathShapeRectangle(Point lastPoint)
 {
     // TODO DEVSIX-3814 - add method declaration into IPathShape and remove here in iText 7.2
     return(new Rectangle((float)CssUtils.ConvertPxToPts(GetEndingPoint().GetX()), (float)CssUtils.ConvertPxToPts
                              (GetEndingPoint().GetY()), 0, 0));
 }