private static void DeserializeArcTo(BinaryReader br, byte firstByte, StreamGeometryContext sc) { Point point; Size size = new Size(); double rotationAngle; bool isStroked; bool isSmoothJoin; bool isLargeArc; SweepDirection sweepDirection; DeserializePointAndTwoBools(br, firstByte, out point, out isStroked, out isSmoothJoin); // Read the packed byte for isLargeArd & sweepDirection. // // Pack isLargeArc & sweepDirection into a signle byte. // byte packedByte = br.ReadByte(); isLargeArc = ((packedByte & LowNibble) != 0); sweepDirection = BoolToSweep(((packedByte & HighNibble) != 0)); size.Width = XamlSerializationHelper.ReadDouble(br); size.Height = XamlSerializationHelper.ReadDouble(br); rotationAngle = XamlSerializationHelper.ReadDouble(br); sc.ArcTo(point, size, rotationAngle, isLargeArc, sweepDirection, isStroked, isSmoothJoin); }
private static Double DeserializeDouble(BinaryReader br, bool isScaledInt) { if (isScaledInt) { return(XamlSerializationHelper.ReadScaledInteger(br)); } else { return(XamlSerializationHelper.ReadDouble(br)); } }
private static void DeserializeQuadraticBezierTo(BinaryReader br, byte firstByte, StreamGeometryContext sc) { Point point1; Point point2 = new Point(); bool isStroked; bool isSmoothJoin; DeserializePointAndTwoBools(br, firstByte, out point1, out isStroked, out isSmoothJoin); point2.X = XamlSerializationHelper.ReadDouble(br); point2.Y = XamlSerializationHelper.ReadDouble(br); sc.QuadraticBezierTo(point1, point2, isStroked, isSmoothJoin); }
[FriendAccessAllowed] // Built into Core, also used by Framework. internal static object DeserializeFrom(BinaryReader reader) { // Get the size. uint count = reader.ReadUInt32(); PointCollection collection = new PointCollection((int)count); for (uint i = 0; i < count; i++) { Point point = new Point( XamlSerializationHelper.ReadDouble(reader), XamlSerializationHelper.ReadDouble(reader)); collection.Add(point); } return(collection); }
private static IList <Point> DeserializeListOfPointsAndTwoBools(BinaryReader br, Byte firstByte, out bool bool1, out bool bool2) { int count; IList <Point> points; Point point; // Pack the two bools into one byte UnPackBools(firstByte, out bool1, out bool2); count = br.ReadInt32(); points = new List <Point>(count); for (int i = 0; i < count; i++) { point = new Point(XamlSerializationHelper.ReadDouble(br), XamlSerializationHelper.ReadDouble(br)); points.Add(point); } return(points); }