mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
More fixes, the ClipboardDestination "should" now work again, mostly...
This commit is contained in:
parent
602e2270d8
commit
35ad8784f0
2 changed files with 29 additions and 8 deletions
|
@ -152,16 +152,16 @@ EndSelection:<<<<<<<4
|
||||||
/// Place the bitmap as embedded HTML on the clipboard
|
/// Place the bitmap as embedded HTML on the clipboard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clipboardAccessToken">IClipboardAccessToken</param>
|
/// <param name="clipboardAccessToken">IClipboardAccessToken</param>
|
||||||
/// <param name="bitmap">Bitmap</param>
|
/// <param name="surface">ISurface</param>
|
||||||
public static void SetAsEmbeddedHtml(this IClipboardAccessToken clipboardAccessToken, Bitmap bitmap)
|
public static void SetAsEmbeddedHtml(this IClipboardAccessToken clipboardAccessToken, ISurface surface)
|
||||||
{
|
{
|
||||||
using (var pngStream = new MemoryStream())
|
using (var pngStream = new MemoryStream())
|
||||||
{
|
{
|
||||||
var pngOutputSettings = new SurfaceOutputSettings(OutputFormats.png, 100, false);
|
var pngOutputSettings = new SurfaceOutputSettings(OutputFormats.png, 100, false);
|
||||||
ImageOutput.SaveToStream(bitmap, null, pngStream, pngOutputSettings);
|
ImageOutput.SaveToStream(surface, pngStream, pngOutputSettings);
|
||||||
pngStream.Seek(0, SeekOrigin.Begin);
|
pngStream.Seek(0, SeekOrigin.Begin);
|
||||||
// Set the PNG stream
|
// Set the PNG stream
|
||||||
var htmlText = GenerateHtmlDataUrlString(bitmap.Size, pngStream);
|
var htmlText = GenerateHtmlDataUrlString(new NativeSize(surface.Width, surface.Height), pngStream);
|
||||||
clipboardAccessToken.SetAsHtml(htmlText);
|
clipboardAccessToken.SetAsHtml(htmlText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ using Greenshot.Addons.Core.Enums;
|
||||||
using Greenshot.Addons.Extensions;
|
using Greenshot.Addons.Extensions;
|
||||||
using Greenshot.Addons.Interfaces;
|
using Greenshot.Addons.Interfaces;
|
||||||
using Greenshot.Addons.Interfaces.Plugin;
|
using Greenshot.Addons.Interfaces.Plugin;
|
||||||
using Greenshot.Configuration;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -67,9 +66,31 @@ namespace Greenshot.Destinations
|
||||||
using (var clipboardAccessToken = ClipboardNative.Access())
|
using (var clipboardAccessToken = ClipboardNative.Access())
|
||||||
{
|
{
|
||||||
clipboardAccessToken.ClearContents();
|
clipboardAccessToken.ClearContents();
|
||||||
|
|
||||||
//clipboardAccessToken.SetAsDeviceIndependendBitmap(surface);
|
foreach (var clipboardFormat in CoreConfiguration.ClipboardFormats)
|
||||||
clipboardAccessToken.SetAsFormat17(surface);
|
{
|
||||||
|
switch (clipboardFormat)
|
||||||
|
{
|
||||||
|
case ClipboardFormats.DIB:
|
||||||
|
clipboardAccessToken.SetAsDeviceIndependendBitmap(surface);
|
||||||
|
break;
|
||||||
|
case ClipboardFormats.DIBV5:
|
||||||
|
clipboardAccessToken.SetAsFormat17(surface);
|
||||||
|
break;
|
||||||
|
case ClipboardFormats.PNG:
|
||||||
|
clipboardAccessToken.SetAsBitmap(surface, new SurfaceOutputSettings(OutputFormats.png));
|
||||||
|
break;
|
||||||
|
case ClipboardFormats.BITMAP:
|
||||||
|
clipboardAccessToken.SetAsBitmap(surface, new SurfaceOutputSettings(OutputFormats.bmp));
|
||||||
|
break;
|
||||||
|
case ClipboardFormats.HTML:
|
||||||
|
clipboardAccessToken.SetAsHtml(surface);
|
||||||
|
break;
|
||||||
|
case ClipboardFormats.HTMLDATAURL:
|
||||||
|
clipboardAccessToken.SetAsEmbeddedHtml(surface);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exportInformation.ExportMade = true;
|
exportInformation.ExportMade = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue