Пример #1
0
        /// <summary>
        /// A history item for when text is created, edited, and/or finalized.
        /// </summary>
        /// <param name="icon">The history item's icon.</param>
        /// <param name="text">The history item's title.</param>
        /// <param name="passedTextSurface">The stored TextLayer surface.</param>
        /// <param name="passedUserSurface">The stored UserLayer surface.</param>
        /// <param name="passedTextEngine">The text engine being used.</param>
        /// <param name="passedUserLayer">The UserLayer being modified.</param>
        public TextHistoryItem(string icon, string text, ImageSurface passedTextSurface,
                               ImageSurface passedUserSurface, TextEngine passedTextEngine,
                               UserLayer passedUserLayer) : base(icon, text)
        {
            userLayer = passedUserLayer;


            text_surface_diff = SurfaceDiff.Create(passedTextSurface, userLayer.TextLayer.Layer.Surface, true);

            if (text_surface_diff == null)
            {
                textSurface = passedTextSurface;
            }
            else
            {
                (passedTextSurface as IDisposable).Dispose();
            }


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

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


            tEngine = passedTextEngine;

            textBounds = new Gdk.Rectangle(userLayer.textBounds.X, userLayer.textBounds.Y, userLayer.textBounds.Width, userLayer.textBounds.Height);
        }
Пример #2
0
        public SimpleHistoryItem(string icon, string text, ImageSurface oldSurface, int layerIndex) : base(icon, text)
        {
            layer_index  = layerIndex;
            surface_diff = SurfaceDiff.Create(oldSurface, PintaCore.Layers[layer_index].Surface);

            // If the diff was too big, store the original surface, else, dispose it
            if (surface_diff == null)
            {
                old_surface = oldSurface;
            }
            else
            {
                (oldSurface as IDisposable).Dispose();
            }
        }