private void cmb_drawMode_SelectionChangeCommitted(object sender, EventArgs e) { if (SelectedPair == null) { return; } DrawJointType type = (DrawJointType)Enum.Parse(typeof(DrawJointType), cmb_drawMode.SelectedIndex.ToString()); SelectedPair.Item1.DrawType = type; GLContext.Invalidate(); }
public void Read(BinaryReader reader, UInt16 version) { float x = (float)reader.ReadDouble(); float y = (float)reader.ReadDouble(); Location = new PointF(x, y); byte joint_a = reader.ReadByte(); byte joint_r = reader.ReadByte(); byte joint_g = reader.ReadByte(); byte joint_b = reader.ReadByte(); JointColor = Color.FromArgb(joint_a, joint_r, joint_g, joint_b); byte handle_a = reader.ReadByte(); byte handle_r = reader.ReadByte(); byte handle_g = reader.ReadByte(); byte handle_b = reader.ReadByte(); HandleColor = Color.FromArgb(handle_a, handle_r, handle_g, handle_b); Thickness = (float)reader.ReadDouble(); if (version >= 2) { DrawType = (DrawJointType)Enum.Parse(typeof(DrawJointType), reader.ReadString()); HandleVisible = reader.ReadBoolean(); Manipulatable = reader.ReadBoolean(); Visible = reader.ReadBoolean(); } else { DrawType = reader.ReadBoolean() ? DrawJointType.CircleLine : DrawJointType.Normal; HandleVisible = true; Manipulatable = true; Visible = true; } Children = FileFormat.ReadList<Joint>(reader, version); foreach (Joint child in Children) child.Parent = this; if (version >= 4) { List<string> names = FileFormat.ReadStringList(reader, version); List<Bitmap> images = FileFormat.ReadBitmapList(reader, version); List<float> rotations = FileFormat.ReadFloatList(reader, version); List<PointF> offsets = FileFormat.ReadPointFList(reader, version); List<Tuple<int, Tuple<string, Bitmap>>> bitmapTuple = new List<Tuple<int, Tuple<string, Bitmap>>>(); Dictionary<Bitmap, Tuple<float, PointF>> offsetDict = new Dictionary<Bitmap, Tuple<float, PointF>>(); for (int i = 0; i < names.Count; i++) { bitmapTuple.Add(new Tuple<int, Tuple<string, Bitmap>>(Drawing.GenerateTexID(images[i]), new Tuple<string, Bitmap>(names[i], images[i]))); offsetDict.Add(images[i], new Tuple<float, PointF>(rotations[i], offsets[i])); } Bitmaps = bitmapTuple; BitmapOffsets = offsetDict; InitialBitmapIndex = reader.ReadInt32(); } }
public void Read(BinaryReader reader, UInt16 version) { float x = (float)reader.ReadDouble(); float y = (float)reader.ReadDouble(); Location = new PointF(x, y); byte joint_a = reader.ReadByte(); byte joint_r = reader.ReadByte(); byte joint_g = reader.ReadByte(); byte joint_b = reader.ReadByte(); JointColor = Color.FromArgb(joint_a, joint_r, joint_g, joint_b); byte handle_a = reader.ReadByte(); byte handle_r = reader.ReadByte(); byte handle_g = reader.ReadByte(); byte handle_b = reader.ReadByte(); HandleColor = Color.FromArgb(handle_a, handle_r, handle_g, handle_b); Thickness = (float)reader.ReadDouble(); if (version >= 2) { DrawType = (DrawJointType)Enum.Parse(typeof(DrawJointType), reader.ReadString()); HandleVisible = reader.ReadBoolean(); Manipulatable = reader.ReadBoolean(); Visible = reader.ReadBoolean(); } else { DrawType = reader.ReadBoolean() ? DrawJointType.CircleLine : DrawJointType.Normal; HandleVisible = true; Manipulatable = true; Visible = true; } Children = FileFormat.ReadList <Joint>(reader, version); foreach (Joint child in Children) { child.Parent = this; } if (version >= 4) { List <string> names = FileFormat.ReadStringList(reader, version); List <Bitmap> images = FileFormat.ReadBitmapList(reader, version); List <float> rotations = FileFormat.ReadFloatList(reader, version); List <PointF> offsets = FileFormat.ReadPointFList(reader, version); List <Tuple <int, Tuple <string, Bitmap> > > bitmapTuple = new List <Tuple <int, Tuple <string, Bitmap> > >(); Dictionary <Bitmap, Tuple <float, PointF> > offsetDict = new Dictionary <Bitmap, Tuple <float, PointF> >(); for (int i = 0; i < names.Count; i++) { bitmapTuple.Add(new Tuple <int, Tuple <string, Bitmap> >(Drawing.GenerateTexID(images[i]), new Tuple <string, Bitmap>(names[i], images[i]))); offsetDict.Add(images[i], new Tuple <float, PointF>(rotations[i], offsets[i])); } Bitmaps = bitmapTuple; BitmapOffsets = offsetDict; InitialBitmapIndex = reader.ReadInt32(); } }