示例#1
0
        public override void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection, bool isStroked, bool isSmoothJoin)
#endif
        {
            SerializePointAndTwoBools(ParserGeometryContextOpCodes.ArcTo, point, isStroked, isSmoothJoin);

            //
            // Pack isLargeArc & sweepDirection into a single byte.
            //
            byte packMe = 0;

            if (isLargeArc)
            {
                packMe = LowNibble;
            }

#if PBTCOMPILER
            if (sweepDirection)
#else
            if (SweepToBool(sweepDirection))
#endif
            {
                packMe |= HighNibble;
            }

            _bw.Write(packMe);

            //
            // Write out Size & Rotation Angle.
            //
            XamlSerializationHelper.WriteDouble(_bw, size.Width);
            XamlSerializationHelper.WriteDouble(_bw, size.Height);
            XamlSerializationHelper.WriteDouble(_bw, rotationAngle);
        }
示例#2
0
        /// <summary>
        /// QuadraticBezierTo - append a QuadraticBezierTo to the current figure.
        /// </summary>
        /// <remarks>
        /// Stored as [PointAndTwoBools] [Number] [Number]
        /// </remarks>
        public override void QuadraticBezierTo(Point point1, Point point2, bool isStroked, bool isSmoothJoin)
        {
            SerializePointAndTwoBools(ParserGeometryContextOpCodes.QuadraticBezierTo, point1, isStroked, isSmoothJoin);

            XamlSerializationHelper.WriteDouble(_bw, point2.X);
            XamlSerializationHelper.WriteDouble(_bw, point2.Y);
        }
示例#3
0
 private void SerializeDouble(double value, bool isScaledInt, int scaledIntValue)
 {
     if (isScaledInt)
     {
         _bw.Write(scaledIntValue);
     }
     else
     {
         XamlSerializationHelper.WriteDouble(_bw, value);
     }
 }
示例#4
0
        // SerializeListOfPointsAndTwoBools
        //
        // Binary format is :
        //
        //  <Byte+OpCode> <Count> <Number1> ... <NumberN>
        //
        //      <Byte+OpCode> := OpCode + bool1 + bool2
        //      <Count> := int32
        //      <NumberN> := <SerializationFloatType.ScaledInteger+Integer> | <SerializationFloatTypeForSpecialNumbers> | <SerializationFloatType.Double+Double>
        private void SerializeListOfPointsAndTwoBools(ParserGeometryContextOpCodes opCode, IList <Point> points, bool bool1, bool bool2)
        {
            // Pack the two bools into one byte
            Byte packedByte = PackByte(opCode, bool1, bool2);

            _bw.Write(packedByte);

            // Write the count.
            _bw.Write(points.Count);

            // Write out all the Points
            for (int i = 0; i < points.Count; i++)
            {
                XamlSerializationHelper.WriteDouble(_bw, points[i].X);
                XamlSerializationHelper.WriteDouble(_bw, points[i].Y);
            }
        }