mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 05:23:24 -07:00
Added support of another clipboard format "CF_DIBV5" (aka Format17) to Greenshot, this will improve the result for "Open image from clipboard" and the drag&drop actions. Without Format17 these actions still work, but sometimes the transparency is lost as the other formats on the clipboard don't have this information. Greenshot can also write the new format, when enabled in the expert settings. Currently I haven't seen a reason to enable it yet, but due to the complexity of the clipboard and the amount of possible applications maybe an application does work better...
This commit is contained in:
parent
6ddb16e0b1
commit
1ff27810db
5 changed files with 302 additions and 162 deletions
|
@ -651,15 +651,15 @@ namespace GreenshotPlugin.Core {
|
|||
// throw exception
|
||||
throw exceptionToThrow;
|
||||
}
|
||||
// Create BitmapInfoHeader for CreateDIBSection
|
||||
BitmapInfoHeader bmi = new BitmapInfoHeader(captureBounds.Width, captureBounds.Height, 24);
|
||||
// Create BITMAPINFOHEADER for CreateDIBSection
|
||||
BITMAPINFOHEADER bmi = new BITMAPINFOHEADER(captureBounds.Width, captureBounds.Height, 24);
|
||||
|
||||
// Make sure the last error is set to 0
|
||||
Win32.SetLastError(0);
|
||||
|
||||
// create a bitmap we can copy it to, using GetDeviceCaps to get the width/height
|
||||
IntPtr bits0; // not used for our purposes. It returns a pointer to the raw bits that make up the bitmap.
|
||||
using (SafeDibSectionHandle safeDibSectionHandle = GDI32.CreateDIBSection(desktopDCHandle, ref bmi, BitmapInfoHeader.DIB_RGB_COLORS, out bits0, IntPtr.Zero, 0)) {
|
||||
using (SafeDibSectionHandle safeDibSectionHandle = GDI32.CreateDIBSection(desktopDCHandle, ref bmi, BITMAPINFOHEADER.DIB_RGB_COLORS, out bits0, IntPtr.Zero, 0)) {
|
||||
if (safeDibSectionHandle.IsInvalid) {
|
||||
// Get Exception before the error is lost
|
||||
Exception exceptionToThrow = CreateCaptureException("CreateDIBSection", captureBounds);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue