예제 #1
0
        private void updatePreview(int vectorIndex, VectorAction action, PictureBox box)
        {
            if (vectorIndex < 0 || vectorIndex >= vectors.Count || vectors.Count == 0)
            {
                return;
            }

            SVG                 temp        = Editor.svgFromDataFactory(vectors[vectorIndex].data);
            List <SVG>          tempVectors = new List <SVG>();
            List <VectorAction> tempActions = new List <VectorAction>();

            tempVectors.Add(temp);

            if (action != null)
            {
                tempActions.Add(action);
            }

            tempActions.AddRange(actions);

            Editor.refreshActions(tempActions);
            Editor.assignAllActions(tempVectors, tempActions);
            Editor.doActions(tempVectors);

            drawPreview(tempVectors[0], svgPreview);
        }
예제 #2
0
        private void createUpdatePreview(Color oldColor, Color newColor)
        {
            if (oldColor == Color.Transparent || newColor == Color.Transparent)
            {
                return;
            }

            VectorAction action = Editor.actionFactory(oldColor, newColor);

            updatePreview(selectedVector, action, svgPreview);
        }
예제 #3
0
            public bool addAction(VectorAction newAction)
            {
                if (newAction != null)
                {
                    VectorAction dummy = new VectorAction(newAction.oldColor, newAction.newColor);

                    actions.Add(dummy);
                    _actionCount = actions.Count;

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
예제 #4
0
            public static bool assignAction(List <SVG> vectors, VectorAction action)
            {
                if (vectors == null || action == null)
                {
                    return(false);
                }

                masterGarbageDispose(vectors);

                foreach (SVG vector in vectors)
                {
                    if (!vector.actionExists(action))
                    {
                        vector.addAction(action);
                    }
                }

                return(true);
            }
예제 #5
0
            public bool actionExists(VectorAction action)
            {
                if (action == null)
                {
                    return(false);
                }

                garbageDispose();

                foreach (VectorAction a in actions)
                {
                    if (a.newColor.Equals(action.newColor) && a.oldColor.Equals(action.oldColor))
                    {
                        return(true);
                    }
                }

                return(false);
            }