Exemplo n.º 1
0
        public SetLineCap(LineCapStyle cap)
        {
            if (cap < 0 || (int)cap > 2)
            {
                throw new ArgumentException("Invalid argument passed for line cap style. Should be 0, 1 or 2; instead got: " + cap);
            }

            Cap = cap;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the Bytescout.PDF.SolidPen class.
 /// </summary>
 public SolidPen()
 {
     _width       = 1;
     _color       = new ColorRGB(0, 0, 0);
     _lineCap     = LineCapStyle.Butt;
     _lineJoin    = LineJoinStyle.Miter;
     _dashPattern = new DashPattern();
     _opacity     = 1.0f;
     _miterLimit  = 10.0f;
 }
Exemplo n.º 3
0
 public void SetLineCap(LineCapStyle lineCap)
 {
     if (IsLastOperatorATextObject())
     {
         GetOrAddLastTextObject().SetLineCap(lineCap);
     }
     else
     {
         pageOperators.Add(new LineCapOperator(lineCap));
     }
 }
Exemplo n.º 4
0
        public static int GetLineCapVertexCount(LineCapStyle style)
        {
            switch (style)
            {
            case LineCapStyle.Square: return(2);

            case LineCapStyle.Triangle: return(3);

            case LineCapStyle.Round: return(5);

            default: return(2);
            }
        }
Exemplo n.º 5
0
        private static System.Drawing.Drawing2D.LineCap _ToDevice(LineCapStyle style)
        {
            switch (style)
            {
            case LineCapStyle.Round: return(System.Drawing.Drawing2D.LineCap.Round);

            case LineCapStyle.Square: return(System.Drawing.Drawing2D.LineCap.Square);

            case LineCapStyle.Triangle: return(System.Drawing.Drawing2D.LineCap.Triangle);

            default: return(System.Drawing.Drawing2D.LineCap.Flat);
            }
        }
Exemplo n.º 6
0
        public static System.Windows.Media.PenLineCap ToDeviceCapStyle(this LineCapStyle style)
        {
            switch (style)
            {
            case LineCapStyle.Flat: return(System.Windows.Media.PenLineCap.Flat);

            case LineCapStyle.Round: return(System.Windows.Media.PenLineCap.Round);

            case LineCapStyle.Square: return(System.Windows.Media.PenLineCap.Square);

            case LineCapStyle.Triangle: return(System.Windows.Media.PenLineCap.Triangle);

            default: throw new NotImplementedException();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.SolidPen class.
        /// </summary>
        /// <param name="color">A Bytescout.PDF.Color that indicates the color of the pen.</param>
        public SolidPen(Color color)
        {
            if (color == null)
            {
                throw new ArgumentNullException();
            }

            _width       = 1;
            _color       = color;
            _lineCap     = LineCapStyle.Butt;
            _lineJoin    = LineJoinStyle.Miter;
            _dashPattern = new DashPattern();
            _opacity     = 1.0f;
            _miterLimit  = 10.0f;
        }
Exemplo n.º 8
0
 public virtual void set_Renamed(State state)
 {
     this.scene = state.scene;
     //UPGRADE_ISSUE: Method 'java.awt.geom.AffineTransform.setTransform' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomAffineTransformsetTransform_javaawtgeomAffineTransform_3"'
     //TODO PENDING this.transform.setTransform(state.transform);
     this.font                      = state.font;
     this.strokeColor               = state.strokeColor;
     this.fillColor                 = state.fillColor;
     this.fillBrush                 = state.fillBrush;
     this.lineWidth                 = state.lineWidth;
     this.lineCap                   = state.lineCap;
     this.lineJoin                  = state.lineJoin;
     this.miterLimit                = state.miterLimit;
     this.lineDashLengths           = state.lineDashLengths;
     this.lineDashPhase             = state.lineDashPhase;
     this.fillRule                  = state.fillRule;
     this.textPosition              = state.textPosition;
     this.usesFractionalFontMetrics = state.usesFractionalFontMetrics;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.ColoredTilingPen class.
        /// </summary>
        /// <param name="width" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The width of pattern cells in pixels.</param>
        /// <param name="height" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The height of pattern cells in pixels.</param>
        public ColoredTilingPen(float width, float height)
        {
            if (width < 0)
            {
                throw new ArgumentOutOfRangeException("width");
            }
            if (height < 0)
            {
                throw new ArgumentOutOfRangeException("height");
            }

            _pattern     = new ColoredTilingPatternColorspace(width, height);
            _width       = 1;
            _lineCap     = LineCapStyle.Butt;
            _lineJoin    = LineJoinStyle.Miter;
            _dashPattern = new DashPattern();
            _opacity     = 1.0f;
            _miterLimit  = 10.0f;
        }
Exemplo n.º 10
0
        public void polylineSetStyle(int contextId, float width, LineCapStyle cap, LineJoinStyle join,
                                     float miterLimit, float[] lineDashLengths, float lineDashPhase)
        {
            Scenic.Render.Context context = getContext(contextId);

            context.lineWidth       = width;
            context.lineCap         = cap;
            context.lineJoin        = join;
            context.miterLimit      = miterLimit;
            context.lineDashLengths = new List <float>();
            if (lineDashLengths != null)
            {
                for (int i = 0; i < lineDashLengths.GetLongLength(0); i++)
                {
                    context.lineDashLengths.Add(lineDashLengths[i]);
                }
            }
            context.lineDashPhase = lineDashPhase;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.SolidPen class.
        /// </summary>
        /// <param name="color">A Bytescout.PDF.Color that indicates the color of the pen.</param>
        /// <param name="width" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The width of the pen.</param>
        public SolidPen(Color color, float width)
        {
            if (color == null)
            {
                throw new ArgumentNullException("color");
            }
            if (width < 0)
            {
                throw new ArgumentOutOfRangeException("width");
            }

            _width       = width;
            _color       = color;
            _lineCap     = LineCapStyle.Butt;
            _lineJoin    = LineJoinStyle.Miter;
            _dashPattern = new DashPattern();
            _opacity     = 1.0f;
            _miterLimit  = 10.0f;
        }
Exemplo n.º 12
0
        private System.Windows.Media.Pen _UsePen(COLOR color, Single width, LineCapStyle start, LineCapStyle end)
        {
            if (width <= 0)
            {
                return(null);
            }

            var fill = _UseBrush(color); if (fill == null)
            {
                return(null);
            }

            var pen = new System.Windows.Media.Pen(fill, width)
            {
                StartLineCap = start.ToDeviceCapStyle(),
                EndLineCap   = end.ToDeviceCapStyle()
            };

            return(pen);
        }
            private readonly void _DrawCap(ICoreScene3D dc, ColorStyle fillColor, LineCapStyle cap, Span <POINT3> corners, bool dir)
            {
                var axis = Direction * (Diameter * 0.5f);

                if (dir)
                {
                    axis = -axis;
                }

                switch (cap)
                {
                case LineCapStyle.Round:
                    for (int i = 0; i < corners.Length; ++i)
                    {
                        var j = (i + 1) % corners.Length;

                        var i0 = corners[i].XYZ;
                        var j0 = corners[j].XYZ;
                        var i1 = VECTOR3.Lerp(Point, i0 + axis, 0.7f);
                        var j1 = VECTOR3.Lerp(Point, j0 + axis, 0.7f);

                        dc.DrawConvexSurface(POINT3.Array(i0, j0, j1, i1), fillColor);
                        dc.DrawConvexSurface(POINT3.Array(Point + axis, i1, j1), fillColor);
                    }
                    break;

                case LineCapStyle.Triangle:
                    for (int i = 0; i < corners.Length; ++i)
                    {
                        var j = (i + 1) % corners.Length;
                        dc.DrawConvexSurface(POINT3.Array(Point + axis, corners[i], corners[j]), fillColor);
                    }
                    break;


                default: dc.DrawConvexSurface(corners, fillColor); break;
                }
            }
Exemplo n.º 14
0
        public void polylineSetStyle(int contextId, float width, LineCapStyle cap, LineJoinStyle join,
            float miterLimit, float[] lineDashLengths, float lineDashPhase)
        {
            Scenic.Render.Context context = getContext(contextId);

            context.lineWidth = width;
            context.lineCap = cap;
            context.lineJoin = join;
            context.miterLimit = miterLimit;
            context.lineDashLengths = new List<float>();
            if (lineDashLengths != null)
            {
                for (int i = 0; i < lineDashLengths.GetLongLength(0); i++)
                    context.lineDashLengths.Add(lineDashLengths[i]);
            }
            context.lineDashPhase = lineDashPhase;
        }
Exemplo n.º 15
0
 public void SetLineCapStyle(LineCapStyle style_) { m_capStyle = style_; }
Exemplo n.º 16
0
        public static void FillLineCapVertices(Span <POINT2> dst, int dstIdx, VECTOR2 p, VECTOR2 axisX, float diameter, LineCapStyle style)
        {
            var axisY = new VECTOR2(axisX.Y, -axisX.X);

            var radius = diameter * 0.5f;

            switch (style)
            {
            case LineCapStyle.Flat:
            {
                dst[dstIdx + 0] = p - axisY * radius;
                dst[dstIdx + 1] = p + axisY * radius;
                break;
            }

            case LineCapStyle.Square:
            {
                dst[dstIdx + 0] = p + (-axisX - axisY) * radius;
                dst[dstIdx + 1] = p + (-axisX + axisY) * radius;
                break;
            }

            case LineCapStyle.Triangle:
            {
                dst[dstIdx + 0] = p - axisY * radius;
                dst[dstIdx + 1] = p - axisX * radius;
                dst[dstIdx + 2] = p + axisY * radius;
                break;
            }

            case LineCapStyle.Round:
            {
                var a = -axisY * radius;
                var b = -axisX * radius;
                var c = axisY * radius;

                dst[dstIdx + 0] = p + a;
                dst[dstIdx + 1] = p + (a + b) * 0.7f;
                dst[dstIdx + 2] = p + b;
                dst[dstIdx + 3] = p + (b + c) * 0.7f;
                dst[dstIdx + 4] = p + c;

                break;
            }

            default: throw new NotImplementedException();
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// Constructor for <see cref="LineCapOperator"/>
 /// </summary>
 /// <param name="style">The style to use</param>
 public LineCapOperator(LineCapStyle style)
 {
     Style = style;
 }
Exemplo n.º 18
0
 public LineCapOperator(LineCapStyle lineCap)
 {
     LineCap = lineCap;
 }
Exemplo n.º 19
0
 public DocumentPage SetLineCap(LineCapStyle lineCap)
 {
     contents.SetLineCap(lineCap);
     return(this);
 }
Exemplo n.º 20
0
 public void SetLineCap(LineCapStyle cap)
 {
     GetCurrentState().CapStyle = cap;
 }
Exemplo n.º 21
0
 public void SetLineCap(LineCapStyle lineCap) => operators.Add(new LineCapOperator(lineCap));
Exemplo n.º 22
0
 public PdfOperation SetLineCap(LineCapStyle lcs)
 {
     return(Add(""));
 }