protected override void FormatPlaceElement(PlaceObject2Tag tag, XElement elem) { if (tag.HasName) { elem.Add(new XAttribute(NAME_ATTRIB, tag.Name)); } if (tag.HasClipActions) { var flags1 = XClipEventFlags.GetFlags1(tag.ClipActions.Flags); var flags2 = XClipEventFlags.GetFlags2(tag.ClipActions.Flags); elem.Add(new XAttribute("allflags1", flags1)); elem.Add(new XAttribute("allflags2", flags2)); } if (tag.HasColorTransform) { elem.Add(new XElement(COLOR_TRANSFORM_ELEM, XColorTransformRGBA.ToXml(tag.ColorTransform))); } if (tag.HasClipDepth) { elem.Add(new XAttribute(CLIP_DEPTH, tag.ClipDepth)); } if (tag.HasClipActions) { elem.Add(XClipActionsList.ToXml(tag.ClipActions)); } if (tag.HasRatio) { elem.Add(new XAttribute(MORPH_ATTRIB, tag.Ratio)); } elem.Add(new XAttribute(REPLACE_ATTRIB, CommonFormatter.Format(tag.Move))); }
protected override void FormatPlaceElement(PlaceObject3Tag tag, XElement elem) { if (tag.Name != null) { elem.Add(new XAttribute("name", tag.Name)); } if (tag.ClassName != null) { elem.Add(new XAttribute("className", tag.ClassName)); } if (tag.HasClipActions) { var flags1 = XClipEventFlags.GetFlags1(tag.ClipActions.Flags); var flags2 = XClipEventFlags.GetFlags2(tag.ClipActions.Flags); elem.Add(new XAttribute("allflags1", flags1)); elem.Add(new XAttribute("allflags2", flags2)); } if (tag.Ratio.HasValue) { elem.Add(new XAttribute("morph", tag.Ratio.Value)); } elem.Add(new XAttribute("replace", CommonFormatter.Format(tag.Move))); elem.Add(new XAttribute("hasImage", CommonFormatter.Format(tag.HasImage))); if (tag.BitmapCache.HasValue) { elem.Add(new XAttribute(BITMAP_CACHING_ATTRIB, tag.BitmapCache.Value)); } if (tag.ColorTransform.HasValue) { elem.Add(new XElement("colorTransform", XColorTransformRGBA.ToXml(tag.ColorTransform.Value))); } if (tag.Filters.Count > 0) { var xFilters = new XElement("filters"); foreach (var filter in tag.Filters) { xFilters.Add(XFilter.ToXml(filter)); } elem.Add(xFilters); } if (tag.HasClipActions) { elem.Add(XClipActionsList.ToXml(tag.ClipActions)); } }
protected override bool AcceptPlaceAttribute(PlaceObject3Tag tag, XAttribute attrib) { switch (attrib.Name.LocalName) { case NAME_ATTRIB: tag.Name = attrib.Value; break; case "className": tag.ClassName = attrib.Value; break; case REPLACE_ATTRIB: tag.Move = CommonFormatter.ParseBool(attrib.Value); break; case MORPH_ATTRIB: tag.Ratio = ushort.Parse(attrib.Value); break; case ALL_FLAGS1_ATTRIB: tag.HasClipActions = true; var flags1 = int.Parse(attrib.Value); XClipEventFlags.SetFlags1(ref tag.ClipActions.Flags, flags1); break; case ALL_FLAGS2_ATTRIB: tag.HasClipActions = true; var flags2 = int.Parse(attrib.Value); XClipEventFlags.SetFlags2(ref tag.ClipActions.Flags, flags2); break; case "hasImage": tag.HasImage = CommonFormatter.ParseBool(attrib.Value); break; case BITMAP_CACHING_ATTRIB: tag.BitmapCache = byte.Parse(attrib.Value); break; default: return(false); } return(true); }
protected override bool AcceptPlaceAttribute(PlaceObject2Tag tag, XAttribute attrib) { tag.Move = true; switch (attrib.Name.LocalName) { case NAME_ATTRIB: tag.Name = attrib.Value; tag.HasName = true; break; case CLIP_DEPTH: tag.ClipDepth = ushort.Parse(attrib.Value); tag.HasClipDepth = true; break; case MORPH_ATTRIB: tag.Ratio = ushort.Parse(attrib.Value); tag.HasRatio = true; break; case REPLACE_ATTRIB: tag.Move = CommonFormatter.ParseBool(attrib.Value); break; case ALL_FLAGS1_ATTRIB: tag.HasClipActions = true; var flags1 = int.Parse(attrib.Value); XClipEventFlags.SetFlags1(ref tag.ClipActions.Flags, flags1); break; case ALL_FLAGS2_ATTRIB: tag.HasClipActions = true; var flags2 = int.Parse(attrib.Value); XClipEventFlags.SetFlags2(ref tag.ClipActions.Flags, flags2); break; default: return(false); } return(true); }