diff --git a/McBitFont/Form1.Designer.cs b/McBitFont/Form1.Designer.cs
index bf26ce2..c99abea 100644
--- a/McBitFont/Form1.Designer.cs
+++ b/McBitFont/Form1.Designer.cs
@@ -642,7 +642,7 @@
//
// exportFontLayoutPNGToolStripMenuItem
//
- exportFontLayoutPNGToolStripMenuItem.Image = Properties.Resources.picture_go;
+ exportFontLayoutPNGToolStripMenuItem.Image = Properties.Resources.picture_save;
exportFontLayoutPNGToolStripMenuItem.Name = "exportFontLayoutPNGToolStripMenuItem";
exportFontLayoutPNGToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
exportFontLayoutPNGToolStripMenuItem.Text = "Export font layout PNG";
@@ -656,7 +656,7 @@
frameScreenshotToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P;
frameScreenshotToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
frameScreenshotToolStripMenuItem.Text = "Frame Screenshot";
- frameScreenshotToolStripMenuItem.ToolTipText = "Make a screenshot of the current frame";
+ frameScreenshotToolStripMenuItem.ToolTipText = "Make a screenshot of the current frame and save it to a file or copy to clipboard";
frameScreenshotToolStripMenuItem.Click += frameScreenshotToolStripMenuItem_Click;
//
// toolStripSeparator2
@@ -688,7 +688,7 @@
undoToolStripMenuItem.Image = Properties.Resources.arrow_undo;
undoToolStripMenuItem.Name = "undoToolStripMenuItem";
undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z;
- undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
+ undoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
undoToolStripMenuItem.Text = "Undo";
undoToolStripMenuItem.ToolTipText = "Undo last canvas change";
undoToolStripMenuItem.Click += undoToolStripMenuItem_Click;
@@ -698,7 +698,7 @@
redoToolStripMenuItem.Image = Properties.Resources.arrow_redo;
redoToolStripMenuItem.Name = "redoToolStripMenuItem";
redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y;
- redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
+ redoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
redoToolStripMenuItem.Text = "Redo";
redoToolStripMenuItem.ToolTipText = "Redo canvas change";
redoToolStripMenuItem.Click += redoToolStripMenuItem_Click;
@@ -709,7 +709,7 @@
copyToolStripMenuItem.Name = "copyToolStripMenuItem";
copyToolStripMenuItem.ShortcutKeyDisplayString = "";
copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C;
- copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
+ copyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
copyToolStripMenuItem.Text = "Copy";
copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard";
copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
@@ -720,7 +720,7 @@
pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
pasteToolStripMenuItem.ShortcutKeyDisplayString = "";
pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V;
- pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
+ pasteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
pasteToolStripMenuItem.Text = "Paste";
pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol";
pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click;
@@ -730,7 +730,7 @@
selectToolStripMenuItem.Image = Properties.Resources.fam_rectt;
selectToolStripMenuItem.Name = "selectToolStripMenuItem";
selectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R;
- selectToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
+ selectToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
selectToolStripMenuItem.Text = "Select";
selectToolStripMenuItem.ToolTipText = "Toggle Rectangle selection tool";
selectToolStripMenuItem.Click += selectToolStripMenuItem_Click;
@@ -741,7 +741,7 @@
selectAllToolStripMenuItem.Image = Properties.Resources.arrow_out;
selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
selectAllToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A;
- selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
+ selectAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
selectAllToolStripMenuItem.Text = "Select All";
selectAllToolStripMenuItem.ToolTipText = "Select entire canvas";
selectAllToolStripMenuItem.Click += selectAllToolStripMenuItem_Click;
diff --git a/McBitFont/FrameScreenshot.Designer.cs b/McBitFont/FrameScreenshot.Designer.cs
index d465e2b..1bfd8bd 100644
--- a/McBitFont/FrameScreenshot.Designer.cs
+++ b/McBitFont/FrameScreenshot.Designer.cs
@@ -29,29 +29,35 @@
toolTip1 = new System.Windows.Forms.ToolTip(components);
nudUpscale = new System.Windows.Forms.NumericUpDown();
chkTransparent = new System.Windows.Forms.CheckBox();
+ chkBlackBG = new System.Windows.Forms.CheckBox();
+ btnCopy = new System.Windows.Forms.Button();
dlgSaveImage = new System.Windows.Forms.SaveFileDialog();
lblUpscale = new System.Windows.Forms.Label();
- chkBlackBG = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)nudUpscale).BeginInit();
SuspendLayout();
//
// btnClose
//
- btnClose.Location = new System.Drawing.Point(144, 67);
+ btnClose.Location = new System.Drawing.Point(234, 67);
btnClose.Name = "btnClose";
btnClose.Size = new System.Drawing.Size(88, 27);
btnClose.TabIndex = 3;
btnClose.Text = "Close";
+ toolTip1.SetToolTip(btnClose, "Close the dialog");
btnClose.UseVisualStyleBackColor = true;
btnClose.Click += btnClose_Click;
//
// btnOK
//
+ btnOK.Image = Properties.Resources.Famfamfam_Silk_Disk_16;
+ btnOK.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
btnOK.Location = new System.Drawing.Point(12, 67);
btnOK.Name = "btnOK";
btnOK.Size = new System.Drawing.Size(88, 27);
btnOK.TabIndex = 1;
btnOK.Text = "Save";
+ btnOK.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+ toolTip1.SetToolTip(btnOK, "Save to file");
btnOK.UseVisualStyleBackColor = true;
btnOK.Click += btnOK_Click;
//
@@ -63,7 +69,7 @@
//
// nudUpscale
//
- nudUpscale.Location = new System.Drawing.Point(12, 27);
+ nudUpscale.Location = new System.Drawing.Point(71, 27);
nudUpscale.Maximum = new decimal(new int[] { 255, 0, 0, 0 });
nudUpscale.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
nudUpscale.Name = "nudUpscale";
@@ -75,15 +81,41 @@
// chkTransparent
//
chkTransparent.AutoSize = true;
- chkTransparent.Location = new System.Drawing.Point(85, 18);
+ chkTransparent.Location = new System.Drawing.Point(144, 18);
chkTransparent.Name = "chkTransparent";
chkTransparent.Size = new System.Drawing.Size(155, 19);
chkTransparent.TabIndex = 5;
chkTransparent.Text = "Transparent background";
- toolTip1.SetToolTip(chkTransparent, "Make background transparent");
+ toolTip1.SetToolTip(chkTransparent, "Make background transparent (Doesn't work with clipboard - background will be gray)");
chkTransparent.UseVisualStyleBackColor = true;
chkTransparent.CheckedChanged += chkTransparent_CheckedChanged;
//
+ // chkBlackBG
+ //
+ chkBlackBG.AutoSize = true;
+ chkBlackBG.Enabled = false;
+ chkBlackBG.Location = new System.Drawing.Point(144, 35);
+ chkBlackBG.Name = "chkBlackBG";
+ chkBlackBG.Size = new System.Drawing.Size(132, 19);
+ chkBlackBG.TabIndex = 6;
+ chkBlackBG.Text = "Background is black";
+ toolTip1.SetToolTip(chkBlackBG, "White color is considered as background by default. Check this to invert that");
+ chkBlackBG.UseVisualStyleBackColor = true;
+ //
+ // btnCopy
+ //
+ btnCopy.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
+ btnCopy.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ btnCopy.Location = new System.Drawing.Point(122, 67);
+ btnCopy.Name = "btnCopy";
+ btnCopy.Size = new System.Drawing.Size(88, 27);
+ btnCopy.TabIndex = 7;
+ btnCopy.Text = "Copy";
+ btnCopy.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+ toolTip1.SetToolTip(btnCopy, "Copy to clipboard");
+ btnCopy.UseVisualStyleBackColor = true;
+ btnCopy.Click += btnCopy_Click;
+ //
// dlgSaveImage
//
dlgSaveImage.DefaultExt = "png";
@@ -92,31 +124,20 @@
// lblUpscale
//
lblUpscale.AutoSize = true;
- lblUpscale.Location = new System.Drawing.Point(12, 9);
+ lblUpscale.Location = new System.Drawing.Point(71, 9);
lblUpscale.Name = "lblUpscale";
lblUpscale.Size = new System.Drawing.Size(51, 15);
lblUpscale.TabIndex = 4;
lblUpscale.Text = "Upscale:";
//
- // chkBlackBG
- //
- chkBlackBG.AutoSize = true;
- chkBlackBG.Enabled = false;
- chkBlackBG.Location = new System.Drawing.Point(85, 35);
- chkBlackBG.Name = "chkBlackBG";
- chkBlackBG.Size = new System.Drawing.Size(132, 19);
- chkBlackBG.TabIndex = 6;
- chkBlackBG.Text = "Background is black";
- toolTip1.SetToolTip(chkBlackBG, "White color is considered as background by default. Check this to invert that");
- chkBlackBG.UseVisualStyleBackColor = true;
- //
// FrameScreenshot
//
AcceptButton = btnClose;
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
CancelButton = btnClose;
- ClientSize = new System.Drawing.Size(244, 111);
+ ClientSize = new System.Drawing.Size(334, 111);
+ Controls.Add(btnCopy);
Controls.Add(chkBlackBG);
Controls.Add(chkTransparent);
Controls.Add(nudUpscale);
@@ -143,5 +164,6 @@
private System.Windows.Forms.NumericUpDown nudUpscale;
private System.Windows.Forms.CheckBox chkTransparent;
private System.Windows.Forms.CheckBox chkBlackBG;
+ private System.Windows.Forms.Button btnCopy;
}
}
\ No newline at end of file
diff --git a/McBitFont/FrameScreenshot.cs b/McBitFont/FrameScreenshot.cs
index 4abcf54..469fe9f 100644
--- a/McBitFont/FrameScreenshot.cs
+++ b/McBitFont/FrameScreenshot.cs
@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
+using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
@@ -21,26 +22,34 @@ namespace McBitFont {
f = frame;
}
- private void btnOK_Click(object sender, EventArgs e) {
- if (dlgSaveImage.ShowDialog() == DialogResult.OK) {
- int upscale = (int)nudUpscale.Value;
- int x, y;
- bool transp = chkTransparent.Checked;
- bool blackBG = chkBlackBG.Checked;
+ private Bitmap GenerateScreenshot() {
+ int upscale = (int)nudUpscale.Value;
+ int x, y;
+ bool transp = chkTransparent.Checked;
+ bool blackBG = chkBlackBG.Checked;
- Bitmap bmp = new(f.width * upscale, f.height * upscale);
- SolidBrush bb = new(Color.Black);
- SolidBrush bw = new(Color.White);
- using (Graphics g = Graphics.FromImage(bmp)) {
- for (x = 0; x < f.width; x++) {
- for (y = 0; y < f.height; y++) {
- if (f.data[x, y]) {
- if (!transp || (transp && !blackBG)) g.FillRectangle(bb, x * upscale, y * upscale, upscale, upscale);
- } else
- if (!transp || (transp && blackBG)) g.FillRectangle(bw, x * upscale, y * upscale, upscale, upscale);
- }
+ Bitmap bmp = new(f.width * upscale, f.height * upscale);
+ SolidBrush bb = new(Color.Black);
+ SolidBrush bw = new(Color.White);
+ using (Graphics g = Graphics.FromImage(bmp)) {
+ for (x = 0; x < f.width; x++) {
+ for (y = 0; y < f.height; y++) {
+ if (f.data[x, y]) {
+ if (!transp || (transp && !blackBG)) g.FillRectangle(bb, x * upscale, y * upscale, upscale, upscale);
+ } else
+ if (!transp || (transp && blackBG)) g.FillRectangle(bw, x * upscale, y * upscale, upscale, upscale);
}
}
+ }
+
+ return bmp;
+ }
+
+ private void btnOK_Click(object sender, EventArgs e) {
+ if (dlgSaveImage.ShowDialog() == DialogResult.OK) {
+
+ Bitmap bmp = GenerateScreenshot();
+
bool err = false;
try {
bmp.Save(dlgSaveImage.FileName, ImageFormat.Png);
@@ -65,5 +74,14 @@ namespace McBitFont {
private void chkTransparent_CheckedChanged(object sender, EventArgs e) {
chkBlackBG.Enabled = chkTransparent.Checked;
}
+
+ private void btnCopy_Click(object sender, EventArgs e) {
+ Bitmap bmp = GenerateScreenshot();
+ using MemoryStream stream = new();
+ bmp.Save(stream, ImageFormat.Png);
+ DataObject data = new("PNG", stream);
+ data.SetImage(bmp);
+ Clipboard.SetDataObject(data, true);
+ }
}
}
diff --git a/McBitFont/Properties/Resources.Designer.cs b/McBitFont/Properties/Resources.Designer.cs
index ee6c114..80aefdd 100644
--- a/McBitFont/Properties/Resources.Designer.cs
+++ b/McBitFont/Properties/Resources.Designer.cs
@@ -340,6 +340,16 @@ namespace McBitFont.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap picture_save {
+ get {
+ object obj = ResourceManager.GetObject("picture_save", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
diff --git a/McBitFont/Properties/Resources.resx b/McBitFont/Properties/Resources.resx
index b2051b4..b1cad7e 100644
--- a/McBitFont/Properties/Resources.resx
+++ b/McBitFont/Properties/Resources.resx
@@ -148,6 +148,9 @@
..\Resources\redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -166,6 +169,9 @@
..\Resources\Canvas_Clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\text_letterspacing2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -205,17 +211,14 @@
..\Resources\fam_rectt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Famfamfam-Silk-Page-white.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\arrow_turn_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Famfamfam-Silk-Page-white.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\folder_table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -241,7 +244,7 @@
..\Resources\icon_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\text_letterspacing2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\picture_save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
\ No newline at end of file
diff --git a/McBitFont/Resources/picture_save.png b/McBitFont/Resources/picture_save.png
new file mode 100644
index 0000000..777fb5d
Binary files /dev/null and b/McBitFont/Resources/picture_save.png differ
diff --git a/TODO.txt b/TODO.txt
index 0869a62..99b7edd 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,6 +4,7 @@ Application:
Functionality:
V Show note field in Export comments
V When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw
+V Frame screenshot can be copied to clipboard with some limitations (no transparency)
Bugs:
V Fixed "Frame modified" check. It leaves modified flag if user refused to save changes.
diff --git a/icons/famfamfam/picture_save.png b/icons/famfamfam/picture_save.png
new file mode 100644
index 0000000..777fb5d
Binary files /dev/null and b/icons/famfamfam/picture_save.png differ