Ejemplo n.º 1
0
        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<TransitionEffectType, 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.Image, 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.Image, 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.Image,
                                        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.AddDrawingInfo (drawingItem);

            }//end foreach

            return toReturn;
        }
Ejemplo n.º 2
0
        public static TransitionEffectType CreateTransitionEffect(LayerInfo guideLayer, TransitionInfo transitionItem)
        {
            TransitionEffectType toReturn = TransitionEffectType.None;

            RectangleF layerBox = guideLayer.GetBoundingBox ();
            // Check for Move transition
            if (layerBox.Location != transitionItem.EndLocation) {
                toReturn = TransitionEffectType.Move;
            }//end if

            // Check for Rotation transition
            double guideRotationAngle = guideLayer.DrawingItems.Select (s => s.Value.RotationAngle).Max ();
            if (guideRotationAngle != transitionItem.RotationAngle) {
                if (toReturn == TransitionEffectType.None) {
                    toReturn = TransitionEffectType.Rotate;
                } else {
                    toReturn |= TransitionEffectType.Rotate;
                }//end if else

            }//end if

            // Check for Scale transition
            if (layerBox.Size != transitionItem.EndSize) {
                if (toReturn == TransitionEffectType.None) {
                    toReturn = TransitionEffectType.Scale;
                } else {
                    toReturn |= TransitionEffectType.Scale;
                }//end if else

            }//end if

            return toReturn;
        }