Allow toggling png export

why not; I guess if you don't want the items/reticle and want dat clean "here's my terraforming work"
This commit is contained in:
Kurt 2020-05-09 17:32:15 -07:00
parent d1b7032b79
commit 826ba00fcd
3 changed files with 54 additions and 20 deletions

View File

@ -69,7 +69,6 @@ private void InitializeComponent()
this.GB_Remove = new System.Windows.Forms.Label();
this.TC_Editor = new System.Windows.Forms.TabControl();
this.Tab_Item = new System.Windows.Forms.TabPage();
this.ItemEdit = new NHSE.WinForms.ItemEditor();
this.B_DumpLoadField = new System.Windows.Forms.Button();
this.CM_DLField = new System.Windows.Forms.ContextMenuStrip(this.components);
this.B_DumpAcre = new System.Windows.Forms.ToolStripMenuItem();
@ -135,6 +134,9 @@ private void InitializeComponent()
this.RB_Item = new System.Windows.Forms.RadioButton();
this.RB_Terrain = new System.Windows.Forms.RadioButton();
this.L_TileMode = new System.Windows.Forms.Label();
this.ItemEdit = new NHSE.WinForms.ItemEditor();
this.Menu_SavePNGItems = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_SavePNGTerrain = new System.Windows.Forms.ToolStripMenuItem();
this.CM_Click.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit();
this.CM_Picture.SuspendLayout();
@ -295,15 +297,16 @@ private void InitializeComponent()
// CM_Picture
//
this.CM_Picture.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Menu_SavePNG});
this.Menu_SavePNG,
this.Menu_SavePNGItems,
this.Menu_SavePNGTerrain});
this.CM_Picture.Name = "CM_Picture";
this.CM_Picture.ShowImageMargin = false;
this.CM_Picture.Size = new System.Drawing.Size(101, 26);
this.CM_Picture.Size = new System.Drawing.Size(152, 70);
//
// Menu_SavePNG
//
this.Menu_SavePNG.Name = "Menu_SavePNG";
this.Menu_SavePNG.Size = new System.Drawing.Size(100, 22);
this.Menu_SavePNG.Size = new System.Drawing.Size(180, 22);
this.Menu_SavePNG.Text = "Save .png";
this.Menu_SavePNG.Click += new System.EventHandler(this.Menu_SavePNG_Click);
//
@ -546,14 +549,6 @@ private void InitializeComponent()
this.Tab_Item.Text = "Items";
this.Tab_Item.UseVisualStyleBackColor = true;
//
// ItemEdit
//
this.ItemEdit.Dock = System.Windows.Forms.DockStyle.Top;
this.ItemEdit.Location = new System.Drawing.Point(3, 3);
this.ItemEdit.Name = "ItemEdit";
this.ItemEdit.Size = new System.Drawing.Size(238, 390);
this.ItemEdit.TabIndex = 40;
//
// B_DumpLoadField
//
this.B_DumpLoadField.ContextMenuStrip = this.CM_DLField;
@ -1243,6 +1238,32 @@ private void InitializeComponent()
this.L_TileMode.Text = "Tile Editor Mode";
this.L_TileMode.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// ItemEdit
//
this.ItemEdit.Dock = System.Windows.Forms.DockStyle.Top;
this.ItemEdit.Location = new System.Drawing.Point(3, 3);
this.ItemEdit.Name = "ItemEdit";
this.ItemEdit.Size = new System.Drawing.Size(238, 390);
this.ItemEdit.TabIndex = 40;
//
// Menu_SavePNGItems
//
this.Menu_SavePNGItems.Checked = true;
this.Menu_SavePNGItems.CheckOnClick = true;
this.Menu_SavePNGItems.CheckState = System.Windows.Forms.CheckState.Checked;
this.Menu_SavePNGItems.Name = "Menu_SavePNGItems";
this.Menu_SavePNGItems.Size = new System.Drawing.Size(180, 22);
this.Menu_SavePNGItems.Text = "Include Items";
//
// Menu_SavePNGTerrain
//
this.Menu_SavePNGTerrain.Checked = true;
this.Menu_SavePNGTerrain.CheckOnClick = true;
this.Menu_SavePNGTerrain.CheckState = System.Windows.Forms.CheckState.Checked;
this.Menu_SavePNGTerrain.Name = "Menu_SavePNGTerrain";
this.Menu_SavePNGTerrain.Size = new System.Drawing.Size(151, 22);
this.Menu_SavePNGTerrain.Text = "Include Terrain";
//
// FieldItemEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1420,5 +1441,7 @@ private void InitializeComponent()
private System.Windows.Forms.NumericUpDown NUD_MapAcreTemplateOutside;
private System.Windows.Forms.NumericUpDown NUD_MapAcreTemplateField;
private System.Windows.Forms.Label L_MapAcreTemplateField;
private System.Windows.Forms.ToolStripMenuItem Menu_SavePNGItems;
private System.Windows.Forms.ToolStripMenuItem Menu_SavePNGTerrain;
}
}

View File

@ -456,10 +456,21 @@ private void Menu_SavePNG_Click(object sender, EventArgs e)
if (sfd.ShowDialog() != DialogResult.OK)
return;
var img = (Bitmap)PB_Map.BackgroundImage.Clone();
using var gfx = Graphics.FromImage(img);
gfx.DrawImage(PB_Map.Image, new Point(0, 0));
img.Save(sfd.FileName, ImageFormat.Png);
if (!Menu_SavePNGTerrain.Checked)
{
PB_Map.Image.Save(sfd.FileName, ImageFormat.Png);
}
else if (!Menu_SavePNGItems.Checked)
{
PB_Map.BackgroundImage.Save(sfd.FileName, ImageFormat.Png);
}
else
{
var img = (Bitmap)PB_Map.BackgroundImage.Clone();
using var gfx = Graphics.FromImage(img);
gfx.DrawImage(PB_Map.Image, new Point(0, 0));
img.Save(sfd.FileName, ImageFormat.Png);
}
}
private void PB_Map_MouseDown(object sender, MouseEventArgs e) => ClickMapAt(e, true);

View File

@ -129,15 +129,15 @@
<metadata name="CM_Remove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>465, 17</value>
</metadata>
<metadata name="CM_DLMapAcres.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="CM_DLField.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>620, 17</value>
</metadata>
<metadata name="CM_DLBuilding.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>930, 17</value>
</metadata>
<metadata name="CM_DLMapAcres.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="CM_DLTerrain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>775, 17</value>
</metadata>