Merge branch 'dev' - v2.8
Changes: Functionality: - Screensot a frame function - Frame note field to store a frame description
This commit is contained in:
53
McBitFont/Form1.Designer.cs
generated
53
McBitFont/Form1.Designer.cs
generated
@@ -34,6 +34,7 @@
|
||||
cbZoom = new System.Windows.Forms.ComboBox();
|
||||
label4 = new System.Windows.Forms.Label();
|
||||
panel1 = new System.Windows.Forms.Panel();
|
||||
tbFrameNote = new System.Windows.Forms.TextBox();
|
||||
btnFill = new System.Windows.Forms.Button();
|
||||
btnClear = new System.Windows.Forms.Button();
|
||||
btnMirrorY = new System.Windows.Forms.Button();
|
||||
@@ -69,6 +70,7 @@
|
||||
importImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
exportFontLayoutPNGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
frameScreenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -230,7 +232,7 @@
|
||||
// panel1
|
||||
//
|
||||
panel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||
panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
panel1.Controls.Add(tbFrameNote);
|
||||
panel1.Controls.Add(btnFill);
|
||||
panel1.Controls.Add(btnClear);
|
||||
panel1.Controls.Add(btnMirrorY);
|
||||
@@ -240,17 +242,28 @@
|
||||
panel1.Controls.Add(btnShiftUp);
|
||||
panel1.Controls.Add(btnShiftRight);
|
||||
panel1.Controls.Add(btnShiftLeft);
|
||||
panel1.Location = new System.Drawing.Point(472, 31);
|
||||
panel1.Location = new System.Drawing.Point(472, 24);
|
||||
panel1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new System.Drawing.Size(140, 139);
|
||||
panel1.Size = new System.Drawing.Size(140, 154);
|
||||
panel1.TabIndex = 9;
|
||||
//
|
||||
// tbFrameNote
|
||||
//
|
||||
tbFrameNote.Location = new System.Drawing.Point(7, 127);
|
||||
tbFrameNote.Name = "tbFrameNote";
|
||||
tbFrameNote.PlaceholderText = "Frame note";
|
||||
tbFrameNote.Size = new System.Drawing.Size(119, 23);
|
||||
tbFrameNote.TabIndex = 9;
|
||||
toolTip1.SetToolTip(tbFrameNote, "Frame note");
|
||||
tbFrameNote.WordWrap = false;
|
||||
tbFrameNote.TextChanged += tbFrameNote_TextChanged;
|
||||
//
|
||||
// btnFill
|
||||
//
|
||||
btnFill.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnFill.Image = Properties.Resources.Canvas_Fill;
|
||||
btnFill.Location = new System.Drawing.Point(92, 9);
|
||||
btnFill.Location = new System.Drawing.Point(91, 3);
|
||||
btnFill.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnFill.Name = "btnFill";
|
||||
btnFill.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -263,7 +276,7 @@
|
||||
//
|
||||
btnClear.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnClear.Image = Properties.Resources.Canvas_Clear;
|
||||
btnClear.Location = new System.Drawing.Point(8, 9);
|
||||
btnClear.Location = new System.Drawing.Point(7, 3);
|
||||
btnClear.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnClear.Name = "btnClear";
|
||||
btnClear.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -276,7 +289,7 @@
|
||||
//
|
||||
btnMirrorY.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnMirrorY.Image = Properties.Resources.Famfamfam_Silk_Shape_flip_vertical_16;
|
||||
btnMirrorY.Location = new System.Drawing.Point(92, 92);
|
||||
btnMirrorY.Location = new System.Drawing.Point(91, 86);
|
||||
btnMirrorY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnMirrorY.Name = "btnMirrorY";
|
||||
btnMirrorY.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -289,7 +302,7 @@
|
||||
//
|
||||
btnMirrorX.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnMirrorX.Image = Properties.Resources.Famfamfam_Silk_Shape_flip_horizontal_16;
|
||||
btnMirrorX.Location = new System.Drawing.Point(50, 92);
|
||||
btnMirrorX.Location = new System.Drawing.Point(49, 86);
|
||||
btnMirrorX.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnMirrorX.Name = "btnMirrorX";
|
||||
btnMirrorX.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -302,7 +315,7 @@
|
||||
//
|
||||
btnInvert.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnInvert.Image = Properties.Resources.z_contrast;
|
||||
btnInvert.Location = new System.Drawing.Point(8, 92);
|
||||
btnInvert.Location = new System.Drawing.Point(7, 86);
|
||||
btnInvert.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnInvert.Name = "btnInvert";
|
||||
btnInvert.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -315,7 +328,7 @@
|
||||
//
|
||||
btnShiftDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnShiftDown.Image = Properties.Resources.z_down;
|
||||
btnShiftDown.Location = new System.Drawing.Point(50, 51);
|
||||
btnShiftDown.Location = new System.Drawing.Point(49, 45);
|
||||
btnShiftDown.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnShiftDown.Name = "btnShiftDown";
|
||||
btnShiftDown.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -328,7 +341,7 @@
|
||||
//
|
||||
btnShiftUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnShiftUp.Image = Properties.Resources.z_uo;
|
||||
btnShiftUp.Location = new System.Drawing.Point(50, 9);
|
||||
btnShiftUp.Location = new System.Drawing.Point(49, 3);
|
||||
btnShiftUp.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnShiftUp.Name = "btnShiftUp";
|
||||
btnShiftUp.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -341,7 +354,7 @@
|
||||
//
|
||||
btnShiftRight.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnShiftRight.Image = Properties.Resources.z_right;
|
||||
btnShiftRight.Location = new System.Drawing.Point(92, 51);
|
||||
btnShiftRight.Location = new System.Drawing.Point(91, 45);
|
||||
btnShiftRight.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnShiftRight.Name = "btnShiftRight";
|
||||
btnShiftRight.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -354,7 +367,7 @@
|
||||
//
|
||||
btnShiftLeft.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||
btnShiftLeft.Image = Properties.Resources.z_left;
|
||||
btnShiftLeft.Location = new System.Drawing.Point(8, 51);
|
||||
btnShiftLeft.Location = new System.Drawing.Point(7, 45);
|
||||
btnShiftLeft.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnShiftLeft.Name = "btnShiftLeft";
|
||||
btnShiftLeft.Size = new System.Drawing.Size(35, 35);
|
||||
@@ -391,6 +404,7 @@
|
||||
miniList.MultiSelect = false;
|
||||
miniList.Name = "miniList";
|
||||
miniList.ShowGroups = false;
|
||||
miniList.ShowItemToolTips = true;
|
||||
miniList.Size = new System.Drawing.Size(427, 455);
|
||||
miniList.SmallImageList = ilMiniatures;
|
||||
miniList.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
@@ -543,7 +557,7 @@
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { newToolStripMenuItem, openToolStripMenuItem, saveToolStripMenuItem, saveAsToolStripMenuItem, toolStripSeparator1, importTextToolStripMenuItem1, importImageToolStripMenuItem, exportToolStripMenuItem, exportFontLayoutPNGToolStripMenuItem, toolStripSeparator2, exitToolStripMenuItem });
|
||||
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { newToolStripMenuItem, openToolStripMenuItem, saveToolStripMenuItem, saveAsToolStripMenuItem, toolStripSeparator1, importTextToolStripMenuItem1, importImageToolStripMenuItem, exportToolStripMenuItem, exportFontLayoutPNGToolStripMenuItem, frameScreenshotToolStripMenuItem, toolStripSeparator2, exitToolStripMenuItem });
|
||||
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
fileToolStripMenuItem.Text = "File";
|
||||
@@ -635,6 +649,16 @@
|
||||
exportFontLayoutPNGToolStripMenuItem.ToolTipText = "Create an image with all a table showing all 256 symbols";
|
||||
exportFontLayoutPNGToolStripMenuItem.Click += ExportPNG;
|
||||
//
|
||||
// frameScreenshotToolStripMenuItem
|
||||
//
|
||||
frameScreenshotToolStripMenuItem.Image = Properties.Resources.picture_go;
|
||||
frameScreenshotToolStripMenuItem.Name = "frameScreenshotToolStripMenuItem";
|
||||
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.Click += frameScreenshotToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
@@ -1208,6 +1232,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)nudX).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)nudY).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
cmMinilist.ResumeLayout(false);
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
@@ -1320,6 +1345,8 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem zerofyWidthToolStripMenuItem;
|
||||
public System.Windows.Forms.NumericUpDown nudBrush;
|
||||
private System.Windows.Forms.Label lblBrush;
|
||||
private System.Windows.Forms.ToolStripMenuItem frameScreenshotToolStripMenuItem;
|
||||
private System.Windows.Forms.TextBox tbFrameNote;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,11 +18,12 @@ namespace McBitFont {
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
public struct FrameMiniature {
|
||||
public FrameMiniature(int cc, int ww, int hh) {
|
||||
public FrameMiniature(int cc, int ww, int hh, string frameNote = "") {
|
||||
code = cc;
|
||||
width = ww;
|
||||
height = hh;
|
||||
data = new bool[ww, hh];
|
||||
note = frameNote;
|
||||
}
|
||||
[Key(0)]
|
||||
public int code;
|
||||
@@ -32,6 +33,8 @@ namespace McBitFont {
|
||||
public int height;
|
||||
[Key(3)]
|
||||
public bool[,] data;
|
||||
[Key(8)]
|
||||
public string note;
|
||||
};
|
||||
|
||||
[Serializable]
|
||||
@@ -59,7 +62,7 @@ namespace McBitFont {
|
||||
public bool monospaced = false;
|
||||
private bool modified = false;
|
||||
private bool prjModified = false;
|
||||
public const string version = "2.7";
|
||||
public const string version = "2.8";
|
||||
public string prjName = "Untitled";
|
||||
public string prjFileName = "";
|
||||
public int codepage = 1251;
|
||||
@@ -112,12 +115,12 @@ namespace McBitFont {
|
||||
// Remember sidebar panels locations
|
||||
private void SideBarRecalc() {
|
||||
|
||||
sidebarLocs[0, 0] = new Point(this.Width - 459, 31);
|
||||
sidebarLocs[0, 1] = new Point(this.Width - 316, 24);
|
||||
sidebarLocs[0, 2] = new Point(this.Width - 487, 31);
|
||||
sidebarLocs[1, 0] = new Point(this.Width - panel1.Width - 70, 180);
|
||||
sidebarLocs[1, 1] = new Point(this.Width - pnlInfo.Width - 110, 320);
|
||||
sidebarLocs[1, 2] = new Point(dotPanel.Width + 17, 31);
|
||||
sidebarLocs[0, 0] = new Point(this.Width - 459, 24); // tool panel
|
||||
sidebarLocs[0, 1] = new Point(this.Width - 316, 24); // info panel
|
||||
sidebarLocs[0, 2] = new Point(this.Width - 487, 31); // vertical scroll
|
||||
sidebarLocs[1, 0] = new Point(this.Width - panel1.Width - 70, 180); // tool panel
|
||||
sidebarLocs[1, 1] = new Point(this.Width - pnlInfo.Width - 110, 340); // info panel
|
||||
sidebarLocs[1, 2] = new Point(dotPanel.Width + 17, 31); // vertical scroll
|
||||
}
|
||||
|
||||
|
||||
@@ -191,8 +194,10 @@ namespace McBitFont {
|
||||
for (int j = 0; j <= selection2.Y - selection1.Y; j++) {
|
||||
ff.data[i, j] = frame.data[i + selection1.X, j + selection1.Y];
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
Array.Copy(frame.data, ff.data, frame.data.Length);
|
||||
ff.note = frame.note;
|
||||
}
|
||||
|
||||
return ff;
|
||||
}
|
||||
@@ -621,7 +626,7 @@ namespace McBitFont {
|
||||
SetModified();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
@@ -717,6 +722,7 @@ namespace McBitFont {
|
||||
string s = f.code.ToString().PadLeft(3, '0');
|
||||
ilMiniatures.Images.RemoveByKey(s);
|
||||
ilMiniatures.Images.Add(s, (Image)sizedBMP);
|
||||
miniList.Items[miniList.Items.IndexOfKey(s)].ToolTipText = f.note;
|
||||
sizedBMP.Dispose();
|
||||
SetModified(false);
|
||||
SetModified(true, true);
|
||||
@@ -935,6 +941,7 @@ namespace McBitFont {
|
||||
nudX.Value = ff.width;
|
||||
nudY.Value = ff.height;
|
||||
f = ff;
|
||||
tbFrameNote.Text = ff.note;
|
||||
|
||||
|
||||
history.Add(code);
|
||||
@@ -983,7 +990,7 @@ namespace McBitFont {
|
||||
var sHex = 'x' + Convert.ToString(f.code, 16).PadLeft(2, '0').ToUpper();
|
||||
var sss = DecodeSymbol(f.code);
|
||||
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(f));
|
||||
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
|
||||
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s).ToolTipText = f.note;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1015,10 +1022,9 @@ namespace McBitFont {
|
||||
nudX.ValueChanged += nudX_ValueChanged;
|
||||
nudY.ValueChanged += nudY_ValueChanged;
|
||||
f = CopyFrame(frames.First());
|
||||
tbFrameNote.Text = frames.First().note;
|
||||
dotPanel.Refresh();
|
||||
miniList.Refresh();
|
||||
SetModified(false);
|
||||
SetModified(false, true);
|
||||
|
||||
prjFileName = filename;
|
||||
prjName = Path.GetFileNameWithoutExtension(filename);
|
||||
@@ -1037,6 +1043,8 @@ namespace McBitFont {
|
||||
zerofyWidthToolStripMenuItem.Enabled = !monospaced;
|
||||
tsmiCodeShift.Visible = frames.Count > 1;
|
||||
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
|
||||
SetModified(false);
|
||||
SetModified(false, true);
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
@@ -1694,5 +1702,18 @@ namespace McBitFont {
|
||||
private void nudBrush_ValueChanged(object sender, EventArgs e) {
|
||||
if (!chkRectSelect.Checked) dotPanel.Cursor = McCursor.GetCursor((int)nudBrush.Value, cellSize, gap);
|
||||
}
|
||||
|
||||
private void frameScreenshotToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
FrameScreenshot iform = new(f);
|
||||
iform.ShowDialog();
|
||||
iform.Dispose();
|
||||
}
|
||||
|
||||
private void tbFrameNote_TextChanged(object sender, EventArgs e) {
|
||||
if (tbFrameNote.Focused) {
|
||||
f.note = tbFrameNote.Text;
|
||||
SetModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
147
McBitFont/FrameScreenshot.Designer.cs
generated
Normal file
147
McBitFont/FrameScreenshot.Designer.cs
generated
Normal file
@@ -0,0 +1,147 @@
|
||||
namespace McBitFont {
|
||||
partial class FrameScreenshot {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
components = new System.ComponentModel.Container();
|
||||
btnClose = new System.Windows.Forms.Button();
|
||||
btnOK = new System.Windows.Forms.Button();
|
||||
toolTip1 = new System.Windows.Forms.ToolTip(components);
|
||||
nudUpscale = new System.Windows.Forms.NumericUpDown();
|
||||
chkTransparent = new System.Windows.Forms.CheckBox();
|
||||
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.Name = "btnClose";
|
||||
btnClose.Size = new System.Drawing.Size(88, 27);
|
||||
btnClose.TabIndex = 3;
|
||||
btnClose.Text = "Close";
|
||||
btnClose.UseVisualStyleBackColor = true;
|
||||
btnClose.Click += btnClose_Click;
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
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.UseVisualStyleBackColor = true;
|
||||
btnOK.Click += btnOK_Click;
|
||||
//
|
||||
// toolTip1
|
||||
//
|
||||
toolTip1.AutoPopDelay = 10000;
|
||||
toolTip1.InitialDelay = 500;
|
||||
toolTip1.ReshowDelay = 100;
|
||||
//
|
||||
// nudUpscale
|
||||
//
|
||||
nudUpscale.Location = new System.Drawing.Point(12, 27);
|
||||
nudUpscale.Maximum = new decimal(new int[] { 255, 0, 0, 0 });
|
||||
nudUpscale.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||
nudUpscale.Name = "nudUpscale";
|
||||
nudUpscale.Size = new System.Drawing.Size(51, 23);
|
||||
nudUpscale.TabIndex = 2;
|
||||
toolTip1.SetToolTip(nudUpscale, "Pixel upscale factor (4 means that for each frame pixel there will be 4x4 pixels generated)");
|
||||
nudUpscale.Value = new decimal(new int[] { 4, 0, 0, 0 });
|
||||
//
|
||||
// chkTransparent
|
||||
//
|
||||
chkTransparent.AutoSize = true;
|
||||
chkTransparent.Location = new System.Drawing.Point(85, 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");
|
||||
chkTransparent.UseVisualStyleBackColor = true;
|
||||
chkTransparent.CheckedChanged += chkTransparent_CheckedChanged;
|
||||
//
|
||||
// dlgSaveImage
|
||||
//
|
||||
dlgSaveImage.DefaultExt = "png";
|
||||
dlgSaveImage.Filter = "PNG Image|*.png;*.PNG";
|
||||
//
|
||||
// lblUpscale
|
||||
//
|
||||
lblUpscale.AutoSize = true;
|
||||
lblUpscale.Location = new System.Drawing.Point(12, 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);
|
||||
Controls.Add(chkBlackBG);
|
||||
Controls.Add(chkTransparent);
|
||||
Controls.Add(nudUpscale);
|
||||
Controls.Add(lblUpscale);
|
||||
Controls.Add(btnClose);
|
||||
Controls.Add(btnOK);
|
||||
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
Name = "FrameScreenshot";
|
||||
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
Text = "Frame Screenshot";
|
||||
Load += FrameScreenshot_Load;
|
||||
((System.ComponentModel.ISupportInitialize)nudUpscale).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnClose;
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.Windows.Forms.SaveFileDialog dlgSaveImage;
|
||||
private System.Windows.Forms.Label lblUpscale;
|
||||
private System.Windows.Forms.NumericUpDown nudUpscale;
|
||||
private System.Windows.Forms.CheckBox chkTransparent;
|
||||
private System.Windows.Forms.CheckBox chkBlackBG;
|
||||
}
|
||||
}
|
69
McBitFont/FrameScreenshot.cs
Normal file
69
McBitFont/FrameScreenshot.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static McBitFont.MainForm;
|
||||
|
||||
namespace McBitFont {
|
||||
public partial class FrameScreenshot : Form {
|
||||
|
||||
private FrameMiniature f;
|
||||
|
||||
public FrameScreenshot(FrameMiniature frame) {
|
||||
InitializeComponent();
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
bool err = false;
|
||||
try {
|
||||
bmp.Save(dlgSaveImage.FileName, ImageFormat.Png);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
err = true;
|
||||
MessageBox.Show("There was an error during image save: " + ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
if (!err) MessageBox.Show("Screenshot has been saved!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void FrameScreenshot_Load(object sender, EventArgs e) {
|
||||
btnOK.Focus();
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e) {
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void chkTransparent_CheckedChanged(object sender, EventArgs e) {
|
||||
chkBlackBG.Enabled = chkTransparent.Checked;
|
||||
}
|
||||
}
|
||||
}
|
126
McBitFont/FrameScreenshot.resx
Normal file
126
McBitFont/FrameScreenshot.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dlgSaveImage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>115, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@@ -20,9 +20,9 @@
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<ApplicationIcon>icon_64.ico</ApplicationIcon>
|
||||
<AssemblyVersion>2.7.0.0</AssemblyVersion>
|
||||
<FileVersion>2.7.0.0</FileVersion>
|
||||
<Version>$(VersionPrefix)2.7.0</Version>
|
||||
<AssemblyVersion>2.8.0.0</AssemblyVersion>
|
||||
<FileVersion>2.8.0.0</FileVersion>
|
||||
<Version>$(VersionPrefix)2.8.0</Version>
|
||||
<Copyright>Anton Mukhin</Copyright>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
@@ -64,3 +64,8 @@ Code Shift dialog
|
||||
Font PNG export example
|
||||
|
||||

|
||||
|
||||
Frame screenshot dialog
|
||||
|
||||

|
||||
|
||||
|
7
TODO.txt
7
TODO.txt
@@ -1,10 +1,9 @@
|
||||
Application:
|
||||
- Consider migrating to WPF in order to make DPI aware UI
|
||||
V Cursor for rectangular selection tool
|
||||
V Icons for tool buttons
|
||||
V Tooltips now has keyboard shortcuts info
|
||||
|
||||
Functionality:
|
||||
V Screensot a frame function
|
||||
V Frame note field to store a frame description
|
||||
|
||||
Bugs:
|
||||
V Fix selection info: change comma to x
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
images/Screenshot_Frame-screenshot.png
Normal file
BIN
images/Screenshot_Frame-screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Reference in New Issue
Block a user