Added background grid to drawing panel

Includes setting to enable and disable the grid
Branch_2.1.x
Nathan Crawford 2013-12-06 19:05:15 -05:00
rodzic edd9f83d84
commit 91331d915c
11 zmienionych plików z 145 dodań i 88 usunięć

Wyświetl plik

@ -558,14 +558,29 @@ namespace PesFile
} }
} }
public Bitmap designToBitmap(Single threadThickness, bool filterUglyStitches, double filterUglyStitchesThreshold) public Bitmap designToBitmap(Single threadThickness, bool filterUglyStitches, double filterUglyStitchesThreshold, bool includeGrid)
{ {
Bitmap DrawArea; Bitmap DrawArea;
Graphics xGraph; Graphics xGraph;
int imageWidth = GetWidth() + (int)(threadThickness * 2);
int imageHeight = GetHeight() + (int)(threadThickness * 2);
int gridSize = 10;
DrawArea = new Bitmap(GetWidth() + (int)(threadThickness * 2), GetHeight() + (int)(threadThickness * 2)); DrawArea = new Bitmap(imageWidth, imageHeight);
xGraph = Graphics.FromImage(DrawArea); xGraph = Graphics.FromImage(DrawArea);
if (includeGrid)
{
for (int xStart = 0; (xStart * gridSize) < imageWidth; xStart++)
{
for (int yStart = 0; (yStart * gridSize) < imageHeight; yStart++)
{
if ((xStart % 2) == (yStart % 2))
{
xGraph.FillRectangle(Brushes.Gray, (xStart * gridSize), (yStart * gridSize), gridSize, gridSize);
}
}
}
}
xGraph.TranslateTransform(threadThickness+translateStart.X, threadThickness+translateStart.Y); xGraph.TranslateTransform(threadThickness+translateStart.X, threadThickness+translateStart.Y);
//xGraph.FillRectangle(Brushes.White, 0, 0, DrawArea.Width, DrawArea.Height); //xGraph.FillRectangle(Brushes.White, 0, 0, DrawArea.Width, DrawArea.Height);

Wyświetl plik

@ -41,7 +41,7 @@ namespace embroideryInfo
if (args[0] == "--image" && args.Length > 1) if (args[0] == "--image" && args.Length > 1)
{ {
PesFile.PesFile design = new PesFile.PesFile(args[1]); PesFile.PesFile design = new PesFile.PesFile(args[1]);
Bitmap DrawArea = design.designToBitmap(5, false, 0); Bitmap DrawArea = design.designToBitmap(5, false, 0, false);
Bitmap temp = new Bitmap(DrawArea.Width, DrawArea.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); Bitmap temp = new Bitmap(DrawArea.Width, DrawArea.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Graphics tempGraph = Graphics.FromImage(temp); Graphics tempGraph = Graphics.FromImage(temp);
tempGraph.FillRectangle(Brushes.White, 0, 0, temp.Width, temp.Height); tempGraph.FillRectangle(Brushes.White, 0, 0, temp.Width, temp.Height);

Wyświetl plik

@ -1,7 +1,7 @@
/* /*
Embroidery Reader - an application to view .pes embroidery designs Embroidery Reader - an application to view .pes embroidery designs
Copyright (C) 2011 Nathan Crawford Copyright (C) 2013 Nathan Crawford
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -54,6 +54,8 @@ namespace embroideryReader
private const String SETTING_WINDOW_WIDTH = "window width"; private const String SETTING_WINDOW_WIDTH = "window width";
private const String SETTING_WINDOW_HEIGHT = "window height"; private const String SETTING_WINDOW_HEIGHT = "window height";
private const String SETTING_DRAW_GRID = "draw background grid";
private const String VALUE_YES = "yes"; private const String VALUE_YES = "yes";
private const String VALUE_NO = "no"; private const String VALUE_NO = "no";
@ -130,6 +132,12 @@ namespace embroideryReader
settings.setValue(SETTING_LAST_SAVE_IMAGE_LOCATION, oldSettings.getValue(SETTING_LAST_SAVE_IMAGE_LOCATION)); settings.setValue(SETTING_LAST_SAVE_IMAGE_LOCATION, oldSettings.getValue(SETTING_LAST_SAVE_IMAGE_LOCATION));
} }
} }
// Default to background grid enabled
if (settings.getValue(SETTING_DRAW_GRID) == null)
{
settings.setValue(SETTING_DRAW_GRID, VALUE_TRUE);
}
} }
// This is no longer in the settings file, but I'm keeping it here because // This is no longer in the settings file, but I'm keeping it here because
@ -318,5 +326,22 @@ namespace embroideryReader
settings.setValue(SETTING_WINDOW_HEIGHT, value.ToString()); settings.setValue(SETTING_WINDOW_HEIGHT, value.ToString());
} }
} }
public bool drawBackgroundGrid
{
get
{
return (settings.getValue(SETTING_DRAW_GRID) == VALUE_TRUE);
}
set
{
String output = VALUE_FALSE;
if (value)
{
output = VALUE_TRUE;
}
settings.setValue(SETTING_DRAW_GRID, output);
}
}
} }
} }

Wyświetl plik

@ -1,7 +1,7 @@
/* /*
Embroidery Reader - an application to view .pes embroidery designs Embroidery Reader - an application to view .pes embroidery designs
Copyright (C) 2011 Nathan Crawford Copyright (C) 2013 Nathan Crawford
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

Wyświetl plik

@ -105,13 +105,13 @@ namespace embroideryReader
this.toolStripSeparator3, this.toolStripSeparator3,
this.exitToolStripMenuItem}); this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File"; this.fileToolStripMenuItem.Text = "File";
// //
// openToolStripMenuItem // openToolStripMenuItem
// //
this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(166, 22); this.openToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.openToolStripMenuItem.Text = "Open..."; this.openToolStripMenuItem.Text = "Open...";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
// //
@ -119,20 +119,20 @@ namespace embroideryReader
// //
this.saveAsBitmapToolStripMenuItem.Enabled = false; this.saveAsBitmapToolStripMenuItem.Enabled = false;
this.saveAsBitmapToolStripMenuItem.Name = "saveAsBitmapToolStripMenuItem"; this.saveAsBitmapToolStripMenuItem.Name = "saveAsBitmapToolStripMenuItem";
this.saveAsBitmapToolStripMenuItem.Size = new System.Drawing.Size(166, 22); this.saveAsBitmapToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.saveAsBitmapToolStripMenuItem.Text = "Save as image..."; this.saveAsBitmapToolStripMenuItem.Text = "Save as image...";
this.saveAsBitmapToolStripMenuItem.Click += new System.EventHandler(this.saveAsBitmapToolStripMenuItem_Click); this.saveAsBitmapToolStripMenuItem.Click += new System.EventHandler(this.saveAsBitmapToolStripMenuItem_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(163, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(154, 6);
// //
// printToolStripMenuItem // printToolStripMenuItem
// //
this.printToolStripMenuItem.Enabled = false; this.printToolStripMenuItem.Enabled = false;
this.printToolStripMenuItem.Name = "printToolStripMenuItem"; this.printToolStripMenuItem.Name = "printToolStripMenuItem";
this.printToolStripMenuItem.Size = new System.Drawing.Size(166, 22); this.printToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.printToolStripMenuItem.Text = "Print..."; this.printToolStripMenuItem.Text = "Print...";
this.printToolStripMenuItem.Click += new System.EventHandler(this.printToolStripMenuItem_Click); this.printToolStripMenuItem.Click += new System.EventHandler(this.printToolStripMenuItem_Click);
// //
@ -140,19 +140,19 @@ namespace embroideryReader
// //
this.printPreviewToolStripMenuItem.Enabled = false; this.printPreviewToolStripMenuItem.Enabled = false;
this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem";
this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(166, 22); this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.printPreviewToolStripMenuItem.Text = "Print Preview..."; this.printPreviewToolStripMenuItem.Text = "Print Preview...";
this.printPreviewToolStripMenuItem.Click += new System.EventHandler(this.printPreviewToolStripMenuItem_Click); this.printPreviewToolStripMenuItem.Click += new System.EventHandler(this.printPreviewToolStripMenuItem_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(163, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(154, 6);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(166, 22); this.exitToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
@ -163,26 +163,26 @@ namespace embroideryReader
this.toolStripSeparator4, this.toolStripSeparator4,
this.preferencesToolStripMenuItem}); this.preferencesToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "Edit"; this.editToolStripMenuItem.Text = "Edit";
// //
// copyToolStripMenuItem // copyToolStripMenuItem
// //
this.copyToolStripMenuItem.Enabled = false; this.copyToolStripMenuItem.Enabled = false;
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(155, 22); this.copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.copyToolStripMenuItem.Text = "Copy"; this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
// //
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(152, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6);
// //
// preferencesToolStripMenuItem // preferencesToolStripMenuItem
// //
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem"; this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(155, 22); this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.preferencesToolStripMenuItem.Text = "Preferences..."; this.preferencesToolStripMenuItem.Text = "Preferences...";
this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click); this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click);
// //
@ -193,14 +193,14 @@ namespace embroideryReader
this.rotateRightToolStripMenuItem, this.rotateRightToolStripMenuItem,
this.refreshToolStripMenuItem}); this.refreshToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View"; this.viewToolStripMenuItem.Text = "View";
// //
// rotateLeftToolStripMenuItem // rotateLeftToolStripMenuItem
// //
this.rotateLeftToolStripMenuItem.Enabled = false; this.rotateLeftToolStripMenuItem.Enabled = false;
this.rotateLeftToolStripMenuItem.Name = "rotateLeftToolStripMenuItem"; this.rotateLeftToolStripMenuItem.Name = "rotateLeftToolStripMenuItem";
this.rotateLeftToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.rotateLeftToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.rotateLeftToolStripMenuItem.Text = "Rotate left"; this.rotateLeftToolStripMenuItem.Text = "Rotate left";
this.rotateLeftToolStripMenuItem.Click += new System.EventHandler(this.rotateLeftToolStripMenuItem_Click); this.rotateLeftToolStripMenuItem.Click += new System.EventHandler(this.rotateLeftToolStripMenuItem_Click);
// //
@ -208,7 +208,7 @@ namespace embroideryReader
// //
this.rotateRightToolStripMenuItem.Enabled = false; this.rotateRightToolStripMenuItem.Enabled = false;
this.rotateRightToolStripMenuItem.Name = "rotateRightToolStripMenuItem"; this.rotateRightToolStripMenuItem.Name = "rotateRightToolStripMenuItem";
this.rotateRightToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.rotateRightToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.rotateRightToolStripMenuItem.Text = "Rotate right"; this.rotateRightToolStripMenuItem.Text = "Rotate right";
this.rotateRightToolStripMenuItem.Click += new System.EventHandler(this.rotateRightToolStripMenuItem_Click); this.rotateRightToolStripMenuItem.Click += new System.EventHandler(this.rotateRightToolStripMenuItem_Click);
// //
@ -216,8 +216,8 @@ namespace embroideryReader
// //
this.refreshToolStripMenuItem.Enabled = false; this.refreshToolStripMenuItem.Enabled = false;
this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem"; this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem";
this.refreshToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.refreshToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.refreshToolStripMenuItem.Text = "Reset"; this.refreshToolStripMenuItem.Text = "Reset / Refresh";
this.refreshToolStripMenuItem.Click += new System.EventHandler(this.refreshToolStripMenuItem_Click); this.refreshToolStripMenuItem.Click += new System.EventHandler(this.refreshToolStripMenuItem_Click);
// //
// helpToolStripMenuItem // helpToolStripMenuItem
@ -229,13 +229,13 @@ namespace embroideryReader
this.toolStripSeparator1, this.toolStripSeparator1,
this.aboutToolStripMenuItem}); this.aboutToolStripMenuItem});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(40, 20); this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "Help"; this.helpToolStripMenuItem.Text = "Help";
// //
// checkForUpdateToolStripMenuItem // checkForUpdateToolStripMenuItem
// //
this.checkForUpdateToolStripMenuItem.Name = "checkForUpdateToolStripMenuItem"; this.checkForUpdateToolStripMenuItem.Name = "checkForUpdateToolStripMenuItem";
this.checkForUpdateToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.checkForUpdateToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.checkForUpdateToolStripMenuItem.Text = "Check for update"; this.checkForUpdateToolStripMenuItem.Text = "Check for update";
this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click); this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click);
// //
@ -243,7 +243,7 @@ namespace embroideryReader
// //
this.saveDebugInfoToolStripMenuItem.Enabled = false; this.saveDebugInfoToolStripMenuItem.Enabled = false;
this.saveDebugInfoToolStripMenuItem.Name = "saveDebugInfoToolStripMenuItem"; this.saveDebugInfoToolStripMenuItem.Name = "saveDebugInfoToolStripMenuItem";
this.saveDebugInfoToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.saveDebugInfoToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.saveDebugInfoToolStripMenuItem.Text = "Save design debug info"; this.saveDebugInfoToolStripMenuItem.Text = "Save design debug info";
this.saveDebugInfoToolStripMenuItem.Click += new System.EventHandler(this.saveDebugInfoToolStripMenuItem_Click); this.saveDebugInfoToolStripMenuItem.Click += new System.EventHandler(this.saveDebugInfoToolStripMenuItem_Click);
// //
@ -251,19 +251,19 @@ namespace embroideryReader
// //
this.showDebugInfoToolStripMenuItem.Enabled = false; this.showDebugInfoToolStripMenuItem.Enabled = false;
this.showDebugInfoToolStripMenuItem.Name = "showDebugInfoToolStripMenuItem"; this.showDebugInfoToolStripMenuItem.Name = "showDebugInfoToolStripMenuItem";
this.showDebugInfoToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.showDebugInfoToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.showDebugInfoToolStripMenuItem.Text = "Show design debug info"; this.showDebugInfoToolStripMenuItem.Text = "Show design debug info";
this.showDebugInfoToolStripMenuItem.Click += new System.EventHandler(this.showDebugInfoToolStripMenuItem_Click); this.showDebugInfoToolStripMenuItem.Click += new System.EventHandler(this.showDebugInfoToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(196, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(199, 6);
// //
// aboutToolStripMenuItem // aboutToolStripMenuItem
// //
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.aboutToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
// //
@ -335,8 +335,8 @@ namespace embroideryReader
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "frmMain"; this.Name = "frmMain";
this.Text = "Form1"; this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.panel2.ResumeLayout(false); this.panel2.ResumeLayout(false);

Wyświetl plik

@ -1,7 +1,7 @@
/* /*
Embroidery Reader - an application to view .pes embroidery designs Embroidery Reader - an application to view .pes embroidery designs
Copyright (C) 2011 Nathan Crawford Copyright (C) 2013 Nathan Crawford
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -111,6 +111,14 @@ namespace embroideryReader
} }
} }
private void updateDesignImage()
{
DrawArea = design.designToBitmap((float)settings.threadThickness, (settings.filterStiches), settings.filterStitchesThreshold, settings.drawBackgroundGrid);
panel1.Width = design.GetWidth() + (int)(settings.threadThickness * 2);
panel1.Height = design.GetHeight() + (int)(settings.threadThickness * 2);
panel1.Invalidate();
}
private void openFile(string filename) private void openFile(string filename)
{ {
if (!System.IO.File.Exists(filename)) if (!System.IO.File.Exists(filename))
@ -122,10 +130,7 @@ namespace embroideryReader
{ {
this.Text = System.IO.Path.GetFileName(filename) + " - " + APP_TITLE; this.Text = System.IO.Path.GetFileName(filename) + " - " + APP_TITLE;
DrawArea = design.designToBitmap((float)settings.threadThickness, (settings.filterStiches), settings.filterStitchesThreshold); updateDesignImage();
panel1.Width = design.GetWidth() + (int)(settings.threadThickness * 2);
panel1.Height = design.GetHeight() + (int)(settings.threadThickness * 2);
panel1.Invalidate();
if (design.getFormatWarning()) if (design.getFormatWarning())
{ {
@ -300,7 +305,7 @@ namespace embroideryReader
float dpiY = 100; float dpiY = 100;
double inchesPerMM = 0.03937007874015748031496062992126; double inchesPerMM = 0.03937007874015748031496062992126;
e.Graphics.ScaleTransform((float)(dpiX * inchesPerMM * 0.1), (float)(dpiY * inchesPerMM * 0.1)); e.Graphics.ScaleTransform((float)(dpiX * inchesPerMM * 0.1), (float)(dpiY * inchesPerMM * 0.1));
Bitmap tempDrawArea = design.designToBitmap((float)settings.threadThickness, (settings.filterStiches), settings.filterStitchesThreshold, false);
e.Graphics.DrawImage(DrawArea, 30, 30); e.Graphics.DrawImage(DrawArea, 30, 30);
} }
} }
@ -329,10 +334,7 @@ namespace embroideryReader
{ {
if (design != null && design.getStatus() == PesFile.statusEnum.Ready) if (design != null && design.getStatus() == PesFile.statusEnum.Ready)
{ {
DrawArea = design.designToBitmap((float)settings.threadThickness, (settings.filterStiches), (int)settings.filterStitchesThreshold); updateDesignImage();
panel1.Width = design.GetWidth() + (int)(settings.threadThickness * 2);
panel1.Height = design.GetHeight() + (int)(settings.threadThickness * 2);
panel1.Invalidate();
if (design.getClassWarning()) if (design.getClassWarning())
{ {

Wyświetl plik

@ -112,30 +112,30 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>147, 17</value> <value>147, 17</value>
</metadata> </metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>256, 17</value> <value>256, 17</value>
</metadata> </metadata>
<metadata name="printDocument1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="printDocument1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>366, 17</value> <value>366, 17</value>
</metadata> </metadata>
<metadata name="printDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="printDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>497, 17</value> <value>497, 17</value>
</metadata> </metadata>
<metadata name="printPreviewDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="printPreviewDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>609, 17</value> <value>609, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="printPreviewDialog1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="printPreviewDialog1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA
@ -309,13 +309,13 @@
wf+0BQAAgAUAAIAFAACAAQAAgAHB/4ABAACAAQAAgAEAALwBAAC8AQAAvAHB/4ABbP///5H/ wf+0BQAAgAUAAIAFAACAAQAAgAHB/4ABAACAAQAAgAEAALwBAAC8AQAAvAHB/4ABbP///5H/
</value> </value>
</data> </data>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>760, 17</value> <value>760, 17</value>
</metadata> </metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>888, 17</value> <value>888, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>43</value> <value>43</value>
</metadata> </metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

Wyświetl plik

@ -39,10 +39,11 @@ namespace embroideryReader
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.chkUglyStitches = new System.Windows.Forms.CheckBox();
this.txtThreshold = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtThreshold = new System.Windows.Forms.TextBox();
this.chkUglyStitches = new System.Windows.Forms.CheckBox();
this.chkDrawGrid = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -80,7 +81,7 @@ namespace embroideryReader
// btnOK // btnOK
// //
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(171, 190); this.btnOK.Location = new System.Drawing.Point(171, 208);
this.btnOK.Name = "btnOK"; this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 3; this.btnOK.TabIndex = 3;
@ -91,7 +92,7 @@ namespace embroideryReader
// btnCancel // btnCancel
// //
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(252, 190); this.btnCancel.Location = new System.Drawing.Point(252, 208);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 4; this.btnCancel.TabIndex = 4;
@ -138,6 +139,7 @@ namespace embroideryReader
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.chkDrawGrid);
this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.txtThreshold); this.groupBox2.Controls.Add(this.txtThreshold);
@ -147,11 +149,36 @@ namespace embroideryReader
this.groupBox2.Controls.Add(this.label2); this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Location = new System.Drawing.Point(12, 97); this.groupBox2.Location = new System.Drawing.Point(12, 97);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(315, 87); this.groupBox2.Size = new System.Drawing.Size(315, 105);
this.groupBox2.TabIndex = 3; this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Stitch drawing"; this.groupBox2.Text = "Stitch drawing";
// //
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 58);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(67, 13);
this.label4.TabIndex = 11;
this.label4.Text = "Ugly Length:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(168, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 13);
this.label3.TabIndex = 10;
this.label3.Text = "pixels";
//
// txtThreshold
//
this.txtThreshold.Location = new System.Drawing.Point(130, 55);
this.txtThreshold.Name = "txtThreshold";
this.txtThreshold.Size = new System.Drawing.Size(32, 20);
this.txtThreshold.TabIndex = 9;
//
// chkUglyStitches // chkUglyStitches
// //
this.chkUglyStitches.AutoSize = true; this.chkUglyStitches.AutoSize = true;
@ -162,30 +189,15 @@ namespace embroideryReader
this.chkUglyStitches.Text = "Remove \'ugly\' stitches"; this.chkUglyStitches.Text = "Remove \'ugly\' stitches";
this.chkUglyStitches.UseVisualStyleBackColor = true; this.chkUglyStitches.UseVisualStyleBackColor = true;
// //
// txtThreshold // chkDrawGrid
// //
this.txtThreshold.Location = new System.Drawing.Point(130, 55); this.chkDrawGrid.AutoSize = true;
this.txtThreshold.Name = "txtThreshold"; this.chkDrawGrid.Location = new System.Drawing.Point(7, 79);
this.txtThreshold.Size = new System.Drawing.Size(32, 20); this.chkDrawGrid.Name = "chkDrawGrid";
this.txtThreshold.TabIndex = 9; this.chkDrawGrid.Size = new System.Drawing.Size(131, 17);
// this.chkDrawGrid.TabIndex = 12;
// label3 this.chkDrawGrid.Text = "Draw background grid";
// this.chkDrawGrid.UseVisualStyleBackColor = true;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(168, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 13);
this.label3.TabIndex = 10;
this.label3.Text = "pixels";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 58);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(67, 13);
this.label4.TabIndex = 11;
this.label4.Text = "Ugly Length:";
// //
// frmSettingsDialog // frmSettingsDialog
// //
@ -193,7 +205,7 @@ namespace embroideryReader
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(339, 225); this.ClientSize = new System.Drawing.Size(339, 244);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
@ -228,5 +240,6 @@ namespace embroideryReader
private System.Windows.Forms.TextBox txtThreshold; private System.Windows.Forms.TextBox txtThreshold;
private System.Windows.Forms.CheckBox chkUglyStitches; private System.Windows.Forms.CheckBox chkUglyStitches;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkDrawGrid;
} }
} }

Wyświetl plik

@ -1,7 +1,7 @@
/* /*
Embroidery Reader - an application to view .pes embroidery designs Embroidery Reader - an application to view .pes embroidery designs
Copyright (C) 2011 Nathan Crawford Copyright (C) 2013 Nathan Crawford
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -115,6 +115,8 @@ namespace embroideryReader
{ {
settings.filterStitchesThreshold = threshold; settings.filterStitchesThreshold = threshold;
} }
settings.drawBackgroundGrid = chkDrawGrid.Checked;
} }
} }
} }

Wyświetl plik

@ -112,12 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

Wyświetl plik

@ -1,7 +1,7 @@
/* /*
Embroidery Reader - an application to view .pes embroidery designs Embroidery Reader - an application to view .pes embroidery designs
Copyright (C) 2011 Nathan Crawford Copyright (C) 2013 Nathan Crawford
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -175,7 +175,7 @@ namespace embroideryThumbs
logfile.WriteLine("Called Extract"); logfile.WriteLine("Called Extract");
logfile.Close(); logfile.Close();
System.Drawing.Bitmap designBitmap = designFile.designToBitmap(3, false, 0); System.Drawing.Bitmap designBitmap = designFile.designToBitmap(3, false, 0, false);
IntPtr hBmp = designBitmap.GetHbitmap(); IntPtr hBmp = designBitmap.GetHbitmap();