public void AddOrReplaceDrawingInfo(DrawingInfo drInfo) { this.DrawingItems[drInfo.DrawingID] = drInfo; }
public static LayerInfo Clone(LayerInfo layerInfo, bool withoutTransitions) { Dictionary<int, TransitionInfo> transitions = new Dictionary<int, TransitionInfo>(); if (!withoutTransitions) { foreach (KeyValuePair<int, TransitionInfo> eachTransition in layerInfo.Transitions) { TransitionInfo trObj = new TransitionInfo(eachTransition.Value.ID); trObj.SetEndFadeValue(eachTransition.Value.FadeOpacity); trObj.SetEndLocation(eachTransition.Value.EndLocation); trObj.SetEndScaleValue(eachTransition.Value.EndSize); trObj.SetRotationValue(eachTransition.Value.RotationAngle); // trObj.EffectType = eachTransition.Value.EffectType; foreach (KeyValuePair<AnimationTypesTransitionEffectType, TransitionEffectSettings> eachItem in eachTransition.Value.Settings) { trObj.Settings[eachItem.Key] = eachItem.Value; }//end foreach transitions.Add(trObj.ID, trObj); }//end foreach }//end if LayerInfo toReturn = new LayerInfo(layerInfo.ID, layerInfo.CanvasSize, transitions); foreach (KeyValuePair<int, DrawingInfo> eachDrawingItem in layerInfo.DrawingItems) { DrawingInfo drawingItem = null; if (eachDrawingItem.Value.DrawingType == DrawingLayerType.Drawing) { drawingItem = new DrawingInfo(eachDrawingItem.Key, new List<PointF>(eachDrawingItem.Value.PathPoints), eachDrawingItem.Value.Brush, eachDrawingItem.Value.LineColor); } else { drawingItem = new DrawingInfo(eachDrawingItem.Key, eachDrawingItem.Value.ImageBuffer, eachDrawingItem.Value.ImageFrame); }//end if else switch (eachDrawingItem.Value.DrawingType) { case DrawingLayerType.Drawing: drawingItem = new DrawingInfo(eachDrawingItem.Key, new List<PointF>(eachDrawingItem.Value.PathPoints), eachDrawingItem.Value.Brush, eachDrawingItem.Value.LineColor); break; case DrawingLayerType.Image: drawingItem = new DrawingInfo(eachDrawingItem.Key, eachDrawingItem.Value.ImageBuffer, eachDrawingItem.Value.ImageFrame); drawingItem.RotationAngle = eachDrawingItem.Value.RotationAngle; drawingItem.RotatedImageBox = eachDrawingItem.Value.RotatedImageBox; break; case DrawingLayerType.Callout: case DrawingLayerType.Comix: case DrawingLayerType.Stamp: drawingItem = new DrawingInfo(eachDrawingItem.Key, eachDrawingItem.Value.ContentPackItemID, eachDrawingItem.Value.DrawingType, eachDrawingItem.Value.ImageBuffer, eachDrawingItem.Value.ImageFrame, eachDrawingItem.Value.LineColor); drawingItem.RotationAngle = eachDrawingItem.Value.RotationAngle; drawingItem.RotatedImageBox = eachDrawingItem.Value.RotatedImageBox; drawingItem.CalloutText = eachDrawingItem.Value.CalloutText; drawingItem.CalloutTextRect = eachDrawingItem.Value.CalloutTextRect; break; }//end switch toReturn.AddOrReplaceDrawingInfo(drawingItem); }//end foreach return toReturn; }