Add basic input checks for PesFile.designToBitmap() to help diagnose issue #10

master
Nathan Crawford 2016-04-04 22:10:04 -04:00
rodzic 3c9ff412ba
commit 8798fcb80c
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -579,6 +579,20 @@ namespace PesFile
public Bitmap designToBitmap(Single threadThickness, bool filterUglyStitches, double filterUglyStitchesThreshold, float scale)
{
// Do some basic input checks
if(scale < 0.0000001f)
{
throw new ArgumentException("Scale must be > 0");
}
if(filterUglyStitchesThreshold < 1.0)
{
throw new ArgumentException("Filter ungly stitches threshold must be at least 1.0");
}
if(threadThickness < 0.1)
{
throw new ArgumentException("Thread thickness must be at least 0.1");
}
int imageWidth = (int)((GetWidth() + (threadThickness * 2)) * scale);
int imageHeight = (int)((GetHeight() + (threadThickness * 2)) * scale);
float tempThreadThickness = threadThickness * scale;