Example #1
0
        void addNewLayerFromFile_Click(object sender, EventArgs e)
        {
            SelectFilePopup popup = new SelectFilePopup();

            popup.Closed += (o2, e2) =>
            {
                if (popup.DialogResult)
                {
                    BasicSurface newSurface = BasicSurface.Load(popup.SelectedFile);

                    if (newSurface.Width != surface.Width || newSurface.Height != surface.Height)
                    {
                        var tempSurface = new BasicSurface(surface.Width, surface.Height, surface.Font);
                        newSurface.Copy(tempSurface);
                        var newLayer = surface.Add(tempSurface);
                        LayerMetadata.Create("Loaded", true, true, true, newLayer);
                    }
                    else
                    {
                        var layer = surface.Add(newSurface);
                        LayerMetadata.Create("Loaded", true, true, true, layer);
                    }

                    surface.IsDirty = true;
                    RebuildListBox();
                }
            };
            popup.CurrentFolder   = Environment.CurrentDirectory;
            popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.BasicSurface() };
            popup.Show(true);
            popup.Center();
        }
Example #2
0
        public void LoadBrush(BasicSurface surface)
        {
            _panel.State = SelectionToolPanel.CloneState.Stamp;

            // Copy data to new animation
            var cloneAnimation = new AnimatedSurface("clone", surface.Width, surface.Height, SadConsoleEditor.Settings.Config.ScreenFont);
            var frame          = cloneAnimation.CreateFrame();

            surface.Copy(frame);

            cloneAnimation.Center = new Point(cloneAnimation.Width / 2, cloneAnimation.Height / 2);

            Brush.SelectedSurface.Animation = cloneAnimation;
            //Brush.Animation.Tint = new Color(0f, 0f, 0f, 0f);

            Brush.IsVisible = true;

            MakeBoxAnimation(surface.Width, surface.Height, cloneAnimation.Center);
        }