MCPcopy Create free account
hub / github.com/DentonW/DevIL / SaveBitmap

Method SaveBitmap

DevIL/bindings/DotNet/DevIL.NET.cpp:269–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269bool DevIL::DevIL::SaveBitmap(System::String __gc* i_szFileName, System::Drawing::Bitmap __gc* i_poBitmap)
270{
271 if (!s_bInitDone)
272 {
273 ilInit();
274 s_bInitDone = true;
275 }
276 ilGenImages(1, &s_iImageID);
277 ilBindImage(s_iImageID);
278
279 int iW = i_poBitmap->get_Width();
280 int iH = i_poBitmap->get_Height();
281
282 System::Drawing::Rectangle rect; rect.X = 0; rect.Y = 0; rect.Width = iW; rect.Height = iH;
283
284 i_poBitmap->RotateFlip(System::Drawing::RotateFlipType::RotateNoneFlipY);
285
286 System::Drawing::Imaging::BitmapData __gc* pBd = i_poBitmap->LockBits(rect,
287 System::Drawing::Imaging::ImageLockMode::ReadOnly,
288 System::Drawing::Imaging::PixelFormat::Format32bppArgb);
289
290 void* pScan0 = (void*)(pBd->Scan0);
291
292 bool bSuccess = 0!= ilTexImage(iW, iH, 1, 4, IL_BGRA, IL_UNSIGNED_BYTE, pScan0);
293
294 if (!bSuccess)
295 {
296 return false;
297 }
298
299 bool bRes = ilSaveImage(StringAutoMarshal(i_szFileName))!=0;
300
301 ilDeleteImages(1, &s_iImageID);
302
303 i_poBitmap->UnlockBits(pBd);
304 i_poBitmap->RotateFlip(System::Drawing::RotateFlipType::RotateNoneFlipY);
305
306 return bRes;
307}
308

Callers 1

mnuFileSaveAs_ClickMethod · 0.80

Calls 1

StringAutoMarshalClass · 0.85

Tested by

no test coverage detected