Fixed Window corner cut to skip tool windows, and use a cut shape from the configuration.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2300 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-21 10:00:55 +00:00
commit 57ebc0c675
2 changed files with 8 additions and 8 deletions

View file

@ -48,7 +48,7 @@ namespace GreenshotPlugin.Core {
/// </summary>
[IniSection("Core", Description="Greenshot core configuration")]
public class CoreConfiguration : IniSection {
[IniProperty("Language", Description="The language in IETF format (e.g. en-US)")]
[IniProperty("Language", Description = "The language in IETF format (e.g. en-US)")]
public string Language;
[IniProperty("RegionHotkey", Description="Hotkey for starting the region capture", DefaultValue="PrintScreen")]
@ -203,6 +203,9 @@ namespace GreenshotPlugin.Core {
[IniProperty("EnableSpecialDIBClipboardReader", Description = "Enable a special DIB clipboard reader", DefaultValue="True")]
public bool EnableSpecialDIBClipboardReader;
[IniProperty("WindowCornerCutShape", Description = "The cutshape which is used to remove the window corners, is mirrorred for all corners", DefaultValue = "5,3,2,1,1")]
public List<int> WindowCornerCutShape;
// Specifies what THIS build is
public BuildStates BuildState = BuildStates.UNSTABLE;
@ -222,9 +225,6 @@ namespace GreenshotPlugin.Core {
/// <returns>object with the default value for the supplied property</returns>
public override object GetDefault(string property) {
switch(property) {
case "OutputPrintFooterPattern":
break;
case "PluginWhitelist":
case "PluginBacklist":
return new List<string>();

View file

@ -973,7 +973,8 @@ namespace GreenshotPlugin.Core {
if (capturedBitmap != null) {
// Not needed for Windows 8
if (!(Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 2)) {
if (conf.WindowCaptureRemoveCorners && !Maximised) {
// Only if the Inivalue is set, not maximized and it's not a tool window.
if (conf.WindowCaptureRemoveCorners && !Maximised && (this.ExtendedWindowStyle | ExtendedWindowStyleFlags.WS_EX_TOOLWINDOW) != 0) {
// Remove corners
if (!Image.IsAlphaPixelFormat(capturedBitmap.PixelFormat)) {
LOG.Debug("Changing pixelformat to Alpha for the RemoveCorners");
@ -1016,11 +1017,10 @@ namespace GreenshotPlugin.Core {
/// </summary>
/// <param name="image">The bitmap to remove the corners from.</param>
private void RemoveCorners(Bitmap image) {
int [] cornerRange = {5,3,2,1,1};
using (BitmapBuffer buffer = new BitmapBuffer((Bitmap)image, false)) {
buffer.Lock();
for (int y = 0; y < cornerRange.Length; y++) {
for (int x = 0; x < cornerRange[y]; x++) {
for (int y = 0; y < conf.WindowCornerCutShape.Count; y++) {
for (int x = 0; x < conf.WindowCornerCutShape[y]; x++) {
buffer.SetColorAt(x, y, Color.Transparent);
buffer.SetColorAt(image.Width-1-x, y, Color.Transparent);
buffer.SetColorAt(image.Width-1-x, image.Height-1-y, Color.Transparent);