We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
due to not free the DG on the function BitmapToJpg fix it:
oid BitmapToJpg(HDC* hDc, HBITMAP* hbmpImage, int width, int height) { ULONG_PTR gdiplusToken; GdiplusStartupInput gdiplusStartupInput; if (GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL) != Ok) { return; } Funcs::pSelectObject(*hDc, hbmpImage); Funcs::pBitBlt(*hDc, 0, 0, width, height, GetDC(0), 0, 0, SRCCOPY); IStream* jpegStream = NULL; if (CreateStreamOnHGlobal(NULL, TRUE, &jpegStream) != S_OK) { GdiplusShutdown(gdiplusToken); return; } Bitmap* image = Bitmap::FromHBITMAP(*hbmpImage, NULL); if (!image || image->GetLastStatus() != Ok) { jpegStream->Release(); GdiplusShutdown(gdiplusToken); delete image; return; } if (image->Save(jpegStream, &jpegID, NULL) != Ok) { jpegStream->Release(); delete image; GdiplusShutdown(gdiplusToken); return; } delete image; LARGE_INTEGER li = { 0 }; jpegStream->Seek(li, STREAM_SEEK_SET, NULL); Bitmap* jpegImage = Bitmap::FromStream(jpegStream, FALSE); jpegStream->Release(); if (!jpegImage || jpegImage->GetLastStatus() != Ok) { delete jpegImage; GdiplusShutdown(gdiplusToken); return; } HBITMAP compressedImage = NULL; jpegImage->GetHBITMAP(Color::White, &compressedImage); Funcs::pGetDIBits(*hDc, compressedImage, 0, height, g_pixels, (BITMAPINFO*)&g_bmpInfo, DIB_RGB_COLORS); delete jpegImage; if (compressedImage) { DeleteObject(compressedImage); } GdiplusShutdown(gdiplusToken); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
due to not free the DG on the function BitmapToJpg
fix it:
The text was updated successfully, but these errors were encountered: