예제 #1
0
        public void Resize(int width, int height)
        {
            int renderWidth  = Math.Min(MainScreen.Instance.InnerEmptyBounds.Width, width);
            int renderHeight = Math.Min(MainScreen.Instance.InnerEmptyBounds.Height, height);

            var oldSurface = surface;
            var newSurface = new LayeredSurface(width, height, Settings.Config.ScreenFont, new Rectangle(0, 0, renderWidth, renderHeight), oldSurface.LayerCount);

            hotspotSurface = new BasicSurface(renderWidth, renderHeight, Settings.Config.ScreenFont);

            for (int i = 0; i < oldSurface.LayerCount; i++)
            {
                var oldLayer = oldSurface.GetLayer(i);
                var newLayer = newSurface.GetLayer(i);
                oldSurface.SetActiveLayer(i);
                newSurface.SetActiveLayer(i);
                oldSurface.Copy(newSurface);
                newLayer.Metadata  = oldLayer.Metadata;
                newLayer.IsVisible = oldLayer.IsVisible;
            }

            surface = newSurface;
            layerManagementPanel.SetLayeredSurface(surface);
            toolsPanel.SelectedTool = toolsPanel.SelectedTool;

            if (MainScreen.Instance.ActiveEditor == this)
            {
                MainScreen.Instance.RefreshBorder();
            }
        }