mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 09:03:44 -07:00
Small change to allow window capture and automatically add a shadow, only inside the editor.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1652 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
c8fc93ee53
commit
594f8f9a0a
2 changed files with 11 additions and 2 deletions
|
@ -38,6 +38,7 @@ using Greenshot.Plugin;
|
||||||
using GreenshotPlugin.Core;
|
using GreenshotPlugin.Core;
|
||||||
using IniFile;
|
using IniFile;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
|
||||||
namespace Greenshot {
|
namespace Greenshot {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1151,7 +1152,15 @@ namespace Greenshot {
|
||||||
this.Activate();
|
this.Activate();
|
||||||
WindowDetails.ToForeground(this.Handle);
|
WindowDetails.ToForeground(this.Handle);
|
||||||
if (capture!= null && capture.Image != null) {
|
if (capture!= null && capture.Image != null) {
|
||||||
surface.AddBitmapContainer((Bitmap)capture.Image, 100, 100);
|
bool addShadow = false;
|
||||||
|
if (addShadow) {
|
||||||
|
Point offset = new Point(6, 6);
|
||||||
|
using (Bitmap shadowImage = ImageHelper.CreateShadow(capture.Image, 1f, 7, offset, PixelFormat.Format32bppArgb)) {
|
||||||
|
surface.AddBitmapContainer(shadowImage, 100, 100);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
surface.AddBitmapContainer((Bitmap)capture.Image, 100, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -583,7 +583,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <param name="targetPixelformat">What pixel format must the returning bitmap have</param>
|
/// <param name="targetPixelformat">What pixel format must the returning bitmap have</param>
|
||||||
/// <param name="offset">How many pixels is the original image moved?</param>
|
/// <param name="offset">How many pixels is the original image moved?</param>
|
||||||
/// <returns>Bitmap with the shadow, is bigger than the sourceBitmap!!</returns>
|
/// <returns>Bitmap with the shadow, is bigger than the sourceBitmap!!</returns>
|
||||||
public static Bitmap CreateShadow(Bitmap sourceBitmap, float darkness, int shadowSize, Point offset, PixelFormat targetPixelformat) {
|
public static Bitmap CreateShadow(Image sourceBitmap, float darkness, int shadowSize, Point offset, PixelFormat targetPixelformat) {
|
||||||
// Create a new "clean" image
|
// Create a new "clean" image
|
||||||
Bitmap newImage = new Bitmap(sourceBitmap.Width + (shadowSize * 2), sourceBitmap.Height + (shadowSize * 2), targetPixelformat);
|
Bitmap newImage = new Bitmap(sourceBitmap.Width + (shadowSize * 2), sourceBitmap.Height + (shadowSize * 2), targetPixelformat);
|
||||||
newImage.SetResolution(sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
|
newImage.SetResolution(sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue