resize() public method

public resize ( int w, int h ) : void
w int
h int
return void
Exemplo n.º 1
0
        private void b_resize_Click(object sender, System.EventArgs e)
        {
            LayerResizerWnd lrw = new LayerResizerWnd();

            lrw.init(mlayer);
            if (lrw.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            // resize from here

            Size s = lrw.NewSize;

            if (Global.ActiveMap.Layers.IndexOf(mlayer) == 0)
            {
                Global.ActiveMap.ObsLayer.resize(s.Width, s.Height);
                Global.ActiveMap.ZoneLayer.resize(s.Width, s.Height);
            }
            mlayer.resize(s.Width, s.Height);
            Global.MainMapController.MapView.CalculateScrollValues();
            updateui();
        }
Exemplo n.º 2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            Capture = false;
            trackingMouse = false;
            if (trackingDrag)
            {
                trackingDrag = false;

                int _x0 = dragStart.X;
                int _y0 = (dragStart.Y);
                int _x1 = (dragEnd.X);
                int _y1 = (dragEnd.Y);
                int x0 = Math.Min(_x0, _x1);
                int x1 = Math.Max(_x0, _x1);
                int y0 = Math.Min(_y0, _y1);
                int y1 = Math.Max(_y0, _y1);

                Map m = new Map();
                MapLayer ml = new MapLayer(m);
                ml.resize(x1 - x0 + 1, y1 - y0 + 1);
                for (int y = y0; y <= y1; y++)
                {
                    for (int x = x0; x <= x1; x++)
                    {
                        //((scrollOffset / Global.TILE_SIZE) + (my / Global.TILE_SIZE)) * TilesWide + (mx / Global.TILE_SIZE);
                        int tile = y * TilesWide + x + (scrollOffset / Global.TILE_SIZE * TilesWide);
                        ml.setTile(x - x0, y - y0, tile);
                    }
                }
                m.AddLayer(ml);
                m.IsBrush = true;
                m.vsp = vsp;
                Global.clipboard = m;
            }
        }