Exemplo n.º 1
0
        public static AnimationTypesTransitionEffectType CreateTransitionEffect(LayerInfo guideLayer, TransitionInfo transitionItem)
        {
            AnimationTypesTransitionEffectType toReturn = AnimationTypesTransitionEffectType.None;

            RectangleF layerBox = guideLayer.GetBoundingBox ();
            RectangleF trBox = new RectangleF (transitionItem.EndLocation, transitionItem.EndSize);

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

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

            }//end if

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

            }//end if

            return toReturn;
        }
Exemplo n.º 2
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<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;
        }