개정판 7459b663
issue #00000 markus image create 수정
Change-Id: Iadf0c79ef51726a1645f4343a4174c29c80095ce
ID2.Manager/MarkusImageCreate/OdReadExMgd.cs | ||
---|---|---|
3343 | 3343 |
public bool ExportPNG(Database pDb, string savePngPath,int pngWidth,int pngHeight) |
3344 | 3344 |
{ |
3345 | 3345 |
bool result = false; |
3346 |
string tempPngPath = null; |
|
3346 | 3347 |
|
3347 | 3348 |
try |
3348 | 3349 |
{ |
... | ... | |
3354 | 3355 |
|
3355 | 3356 |
string gdPath = "WinOpenGL_20.5_15.txv"; |
3356 | 3357 |
|
3357 |
string bmpPath = savePngPath.Replace(".png", ".bmp");
|
|
3358 |
tempPngPath = System.IO.Path.GetTempFileName().Replace(".tmp", ".png");
|
|
3358 | 3359 |
|
3359 | 3360 |
using (GsModule gsModule = (GsModule)SystemObjects.DynamicLinker.LoadModule(gdPath, false, true)) |
3360 | 3361 |
{ |
... | ... | |
3393 | 3394 |
helperDevice.ActiveView.ZoomExtents(pDb.Extmin, pDb.Extmax); |
3394 | 3395 |
helperDevice.ActiveView.Zoom(1); |
3395 | 3396 |
helperDevice.Update(); |
3396 |
Export_Import.ExportBitmap(helperDevice, bmpPath); |
|
3397 |
|
|
3398 |
Export_Import.ExportBitmap(helperDevice, tempPngPath); |
|
3397 | 3399 |
} |
3398 | 3400 |
} |
3399 | 3401 |
} |
3400 | 3402 |
} |
3401 | 3403 |
|
3402 |
if (File.Exists(bmpPath))
|
|
3404 |
if (File.Exists(tempPngPath))
|
|
3403 | 3405 |
{ |
3404 | 3406 |
if (File.Exists(savePngPath)) |
3405 | 3407 |
{ |
3406 | 3408 |
File.Delete(savePngPath); |
3407 | 3409 |
} |
3408 | 3410 |
|
3409 |
using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(bmpPath)) |
|
3410 |
{ |
|
3411 |
bmp.Save(savePngPath, System.Drawing.Imaging.ImageFormat.Png); |
|
3412 |
} |
|
3413 |
|
|
3414 |
if (File.Exists(bmpPath)) |
|
3415 |
{ |
|
3416 |
File.Delete(bmpPath); |
|
3417 |
} |
|
3411 |
File.Copy(tempPngPath, savePngPath); |
|
3418 | 3412 |
|
3419 | 3413 |
using (System.Drawing.Image image = System.Drawing.Image.FromFile(savePngPath)) |
3420 | 3414 |
{ |
3421 |
if(image.Width == pngWidth && image.Height == pngHeight) |
|
3415 |
if (image.Width == pngWidth && image.Height == pngHeight)
|
|
3422 | 3416 |
{ |
3423 | 3417 |
result = true; |
3424 | 3418 |
} |
... | ... | |
3431 | 3425 |
result = false; |
3432 | 3426 |
throw; |
3433 | 3427 |
} |
3428 |
finally |
|
3429 |
{ |
|
3430 |
if (tempPngPath != null) |
|
3431 |
{ |
|
3432 |
if (File.Exists(tempPngPath)) |
|
3433 |
{ |
|
3434 |
File.Delete(tempPngPath); |
|
3435 |
} |
|
3436 |
} |
|
3437 |
} |
|
3434 | 3438 |
|
3435 | 3439 |
return result; |
3436 | 3440 |
} |
내보내기 Unified diff