|
@@ -239,6 +239,10 @@ namespace OTSModelSharp
|
|
|
a_strPathName = openFileDialog.FileName;
|
|
|
}
|
|
|
Bitmap rstBm = CreateBitmap(m_poBSE.GetImageDataPtr(), m_poBSE.GetWidth(), m_poBSE.GetHeight());
|
|
|
+ if (rstBm == null)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
rstBm.Save(a_strPathName);
|
|
|
|
|
|
|
|
@@ -263,6 +267,10 @@ namespace OTSModelSharp
|
|
|
/// <returns></returns>
|
|
|
public static Bitmap CreateBitmap(byte[] originalImageData, int originalWidth, int originalHeight)
|
|
|
{
|
|
|
+ if (originalImageData == null || originalWidth == 0 || originalHeight == 0)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
//指定8位格式,即256色
|
|
|
Bitmap resultBitmap = new Bitmap(originalWidth, originalHeight, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
|
|
|
//将该位图存入内存中
|