Enhancements.
This commit is contained in:
@@ -27,6 +27,11 @@ namespace MarketData.CNNProcessing
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DisposeAll();
|
||||
}
|
||||
|
||||
private void DisposeAll()
|
||||
{
|
||||
if(null!=bitmap)
|
||||
{
|
||||
@@ -55,20 +60,38 @@ namespace MarketData.CNNProcessing
|
||||
return copy;
|
||||
}
|
||||
|
||||
public bool LoadImage(Stream stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
DisposeAll();
|
||||
Image image=Image.FromStream(stream);
|
||||
bitmap = new Bitmap(image);
|
||||
height = bitmap.Height;
|
||||
width = bitmap.Width;
|
||||
return true;
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoadImage(string pathFileName)
|
||||
{
|
||||
Stream bitmapStream = null;
|
||||
try
|
||||
{
|
||||
bitmapStream = File.Open(pathFileName,FileMode.Open);
|
||||
Image image = Image.FromStream(bitmapStream);
|
||||
bitmap=new Bitmap(image);
|
||||
DisposeAll();
|
||||
bitmap = new Bitmap(pathFileName);
|
||||
width=bitmap.Width;
|
||||
height=bitmap.Height;
|
||||
return true;
|
||||
}
|
||||
catch(Exception)
|
||||
catch(Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
@@ -125,8 +148,9 @@ namespace MarketData.CNNProcessing
|
||||
graphics.Dispose();
|
||||
return true;
|
||||
}
|
||||
catch(Exception)
|
||||
catch(Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user