private void SelectedFrameChanged(BasicSurface frame) { var meta = surface.GetLayer(LayerDrawing); meta.Cells = meta.RenderCells = frame.Cells; surface.SetActiveLayer(LayerDrawing); surface.IsDirty = true; }
public void New(Color foreground, Color background, int width, int height) { int renderWidth = Math.Min(MainScreen.Instance.InnerEmptyBounds.Width, width); int renderHeight = Math.Min(MainScreen.Instance.InnerEmptyBounds.Height, height); hotspotSurface = new BasicSurface(renderWidth, renderHeight, Settings.Config.ScreenFont); // Create the new text surface surface = new LayeredSurface(width, height, new Rectangle(0, 0, renderWidth, renderHeight), 1); // Update metadata LayerMetadata.Create("main", false, false, true, surface.GetLayer(0)); surface.SetActiveLayer(0); surface.Font = Settings.Config.ScreenFont; // Update the layer management panel layerManagementPanel.SetLayeredSurface(surface); // Set the text surface as the one we're displaying // Update the border if (MainScreen.Instance.ActiveEditor == this) { MainScreen.Instance.RefreshBorder(); } }
private void SelectedAnimationChanged(AnimatedSurface animation) { selectedAnimation = animation; surface = new LayeredSurface(animation.Width, animation.Height, Settings.Config.ScreenFont, 4); SyncSpecialLayerToAnimation(); surface.SetActiveLayer(0); // inform the outer box we've changed size if (MainScreen.Instance.ActiveEditor == this) { MainScreen.Instance.RefreshBorder(); } framesPanel.SetAnimation(animation); SelectedTool = selectedTool; }
public void Resize(int width, int height) { Reset(); int renderWidth = Math.Min(MainScreen.Instance.InnerEmptyBounds.Width, width); int renderHeight = Math.Min(MainScreen.Instance.InnerEmptyBounds.Height, height); var oldSurface = surface; surface = new SadConsole.Surfaces.LayeredSurface(width, height, SadConsoleEditor.Settings.Config.ScreenFont, new Rectangle(0, 0, renderWidth, renderHeight), 1); for (var index = 0; index < oldSurface.LayerCount; index++) { oldSurface.SetActiveLayer(index); surface.SetActiveLayer(index); oldSurface.Copy(surface); surface.GetLayer(index).Metadata = oldSurface.GetLayer(index).Metadata; } layerManagementPanel.SetLayeredSurface(surface); MainScreen.Instance.RefreshBorder(); }