Beispiel #1
0
        public Spline(int degree, double[] knots, Point[] controlPoints, double[] weights, Point[] fitPoints, _DrawingPen pen, double dpiRatio)
        {
            _degree        = degree;
            _knots         = knots;
            _controlPoints = controlPoints;
            _weights       = weights;
            _fitPoints     = fitPoints;
            if (_knots?.Length > 0)
            {
                _domain = _knots.Last();
            }
            else
            {
                _domain = 0;
            }

            _property   = new PrimitiveProperty(pen, Int32Rect.Empty);
            _innerLines = default(List <Line>);

            if (_domain != 0)
            {
                Regular(1000);
            }

            _innerLines = GeometryHelper.CalcSampleLines(this, dpiRatio);

            foreach (var innerLine in _innerLines)
            {
                _property.Bounds = GeometryHelper.ExtendBounds(_property.Bounds, innerLine.Property.Bounds);
            }
        }
Beispiel #2
0
        public Ellipse(byte[] fillColor, Int32Point center, Int32 radiusX, Int32 radiusY, _DrawingPen pen)
        {
            _fillColor     = fillColor;
            Center         = center;
            RadiusX        = radiusX;
            RadiusY        = radiusY;
            RadiusXSquared = (Int64)RadiusX * RadiusX;
            RadiusYSquared = (Int64)RadiusY * RadiusY;
            SplitX         = (Int32)(RadiusXSquared / Math.Sqrt(RadiusXSquared + RadiusYSquared));
            A_2            = Math.Max(RadiusX, RadiusY) << 1;
            Int32 c;

            if (RadiusX > RadiusY)
            {
                c = (Int32)Math.Sqrt(RadiusXSquared - RadiusYSquared);
            }
            else
            {
                c = (Int32)Math.Sqrt(RadiusYSquared - RadiusXSquared);
            }
            if (radiusX > radiusY)
            {
                FocusP1 = new Int32Point(center.X + c, center.Y);
                FocusP2 = new Int32Point(center.X - c, center.Y);
            }
            else
            {
                FocusP1 = new Int32Point(center.X, center.Y + c);
                FocusP2 = new Int32Point(center.X, center.Y - c);
            }
            var _bounds = GeometryHelper.CalcBounds(center, radiusX, RadiusY, pen.Thickness);

            _property = new PrimitiveProperty(pen, _bounds);
        }
Beispiel #3
0
 public CustomGeometry(byte[] fillColor, _DrawingPen pen, bool isClosed)
 {
     _fillColor   = fillColor;
     _property    = new PrimitiveProperty(pen, Int32Rect.Empty);
     _isClosed    = isClosed;
     _stream      = new List <IPrimitive>();
     UnClosedLine = null;
     _shape       = Shape.Custom;
 }
Beispiel #4
0
        internal Cicle(byte[] fillColor, Int32Point center, Int32 radius, _DrawingPen pen)
        {
            _fillColor = fillColor;
            Center     = center;
            Radius     = radius;
            var _bounds = GeometryHelper.CalcBounds(center, radius, pen.Thickness);

            _property = new PrimitiveProperty(pen, _bounds);
        }
Beispiel #5
0
        internal Arc(Int32Point start, Int32Point end, Int32Point center, _DrawingPen pen)
        {
            Start  = start;
            End    = end;
            Center = center;
            Radius = (Start - Center).Length;
            var _bounds = GeometryHelper.CalcBounds(center, start, end, Radius, pen.Thickness);

            _property = new PrimitiveProperty(pen, _bounds);
        }
Beispiel #6
0
        internal Line(Int32Point start, Int32Point end, _DrawingPen pen)
        {
            Start = start;
            End   = end;
            Len   = (Start - End).Length;
            GeometryHelper.CalcLineABC(Start, End, out A, out B, out C);
            Arg = (long)Math.Sqrt((long)A * A + (long)B * B);
            var _bounds = GeometryHelper.CalcBounds(pen.Thickness, start, end);

            _property = new PrimitiveProperty(pen, _bounds);
        }
Beispiel #7
0
        public Bezier(Point[] points, int degree, _DrawingPen pen, double dpiRatio)
        {
            _points = points;
            _degree = degree;

            _property   = new PrimitiveProperty(pen, Int32Rect.Empty);
            _innerLines = default(List <Line>);

            _innerLines = GeometryHelper.CalcSampleLines(this, dpiRatio);

            foreach (var innerLine in _innerLines)
            {
                _property.Bounds = GeometryHelper.ExtendBounds(_property.Bounds, innerLine.Property.Bounds);
            }
        }