Exemplo n.º 1
0
 /// <summary>
 /// A partially cloneable CurveEngine collection. This constructor creates a partial clone of an existing CurveEngineCollection.
 /// </summary>
 /// <param name="passedCEC">An existing CurveEngineCollection to partially clone.</param>
 public CurveEngineCollection(CurveEngineCollection passedCEC)
 {
     for (int n = 0; n < passedCEC.CEL.Count; ++n)
     {
         CEL.Add(passedCEC.CEL[n].PartialClone());
     }
 }
Exemplo n.º 2
0
        private void Swap()
        {
            // Grab the original surface
            ImageSurface surf = PintaCore.Workspace.ActiveDocument.ToolLayer.Surface;



            // Grab the original surface
            surf = userLayer.Surface;

            if (user_surface_diff != null)
            {
                user_surface_diff.ApplyAndSwap(surf);
                PintaCore.Workspace.Invalidate(user_surface_diff.GetBounds());
            }
            else
            {
                // Undo to the "old" surface
                userLayer.Surface = userSurface;

                // Store the original surface for Redo
                userSurface = surf;
            }



            //Redraw everything since surfaces were swapped.
            PintaCore.Workspace.Invalidate();



            //Store the old curve data temporarily.
            CurveEngineCollection oldCEngine = cEngines;

            //Swap half of the data.
            cEngines = Pinta.Tools.LineCurveTool.cEngines;

            //Swap the other half.
            Pinta.Tools.LineCurveTool.cEngines = oldCEngine;


            //Swap the selected point data.
            int temp = selectedPointIndex;

            selectedPointIndex = Pinta.Tools.LineCurveTool.selectedPointIndex;
            Pinta.Tools.LineCurveTool.selectedPointIndex = temp;

            //Swap the selected curve data.
            temp = selectedPointCurveIndex;
            selectedPointCurveIndex = Pinta.Tools.LineCurveTool.selectedPointCurveIndex;
            Pinta.Tools.LineCurveTool.selectedPointCurveIndex = temp;
        }
Exemplo n.º 3
0
        /// <summary>
        /// A history item for when curves are finalized.
        /// </summary>
        /// <param name="icon">The history item's icon.</param>
        /// <param name="text">The history item's title.</param>
        /// <param name="passedUserSurface">The stored UserLayer surface.</param>
        /// <param name="passedUserLayer">The UserLayer being modified.</param>
        /// <param name="passedSelectedPointIndex">The selected point's index.</param>
        /// <param name="passedSelectedPointCurveIndex">The selected point's curve index.</param>
        public CurvesHistoryItem(string icon, string text, ImageSurface passedUserSurface, UserLayer passedUserLayer,
                                 int passedSelectedPointIndex, int passedSelectedPointCurveIndex) : base(icon, text)
        {
            userLayer = passedUserLayer;


            user_surface_diff = SurfaceDiff.Create(passedUserSurface, userLayer.Surface, true);

            if (user_surface_diff == null)
            {
                userSurface = passedUserSurface;
            }
            else
            {
                (passedUserSurface as IDisposable).Dispose();
            }


            cEngines                = Pinta.Tools.LineCurveTool.cEngines.PartialClone();
            selectedPointIndex      = passedSelectedPointIndex;
            selectedPointCurveIndex = passedSelectedPointCurveIndex;
        }
        private void Swap()
        {
            //Store the old curve data temporarily.
            CurveEngineCollection oldCEngine = cEngines;

            //Swap half of the data.
            cEngines = Pinta.Tools.LineCurveTool.cEngines;

            //Swap the other half.
            Pinta.Tools.LineCurveTool.cEngines = oldCEngine;


            //Swap the selected point data.
            int temp = selectedPointIndex;

            selectedPointIndex = Pinta.Tools.LineCurveTool.selectedPointIndex;
            Pinta.Tools.LineCurveTool.selectedPointIndex = temp;

            //Swap the selected curve data.
            temp = selectedPointCurveIndex;
            selectedPointCurveIndex = Pinta.Tools.LineCurveTool.selectedPointCurveIndex;
            Pinta.Tools.LineCurveTool.selectedPointCurveIndex = temp;
        }
 /// <summary>
 /// A history item for when curves are modified.
 /// </summary>
 /// <param name="icon">The history item's icon.</param>
 /// <param name="text">The history item's title.</param>
 public CurveModifyHistoryItem(string icon, string text) : base(icon, text)
 {
     cEngines                = Pinta.Tools.LineCurveTool.cEngines.PartialClone();
     selectedPointIndex      = Pinta.Tools.LineCurveTool.selectedPointIndex;
     selectedPointCurveIndex = Pinta.Tools.LineCurveTool.selectedPointCurveIndex;
 }