Translations for the effects

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1660 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-14 14:48:24 +00:00
parent 8471c79533
commit 5038d7d237
9 changed files with 205 additions and 64 deletions

View file

@ -124,6 +124,10 @@ namespace Greenshot.Configuration {
editor_selectall, editor_selectall,
editor_senttoprinter, editor_senttoprinter,
editor_shadow, editor_shadow,
editor_torn_edge,
editor_border,
editor_grayscale,
editor_effects,
editor_storedtoclipboard, editor_storedtoclipboard,
editor_thickness, editor_thickness,
editor_title, editor_title,

View file

@ -110,7 +110,7 @@ namespace Greenshot.Destinations {
// Effects // Effects
if (conf.isExperimentalFeatureEnabled("Effects")) { if (conf.isExperimentalFeatureEnabled("Effects")) {
menu.Items.Add(new ToolStripSeparator()); menu.Items.Add(new ToolStripSeparator());
ToolStripMenuItem effectItem = new ToolStripMenuItem("Effects"); ToolStripMenuItem effectItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_effects));
menu.Items.Add(effectItem); menu.Items.Add(effectItem);
effectItem.DropDownOpening += delegate { effectItem.DropDownOpening += delegate {
effectItem.DropDownItems.Clear(); effectItem.DropDownItems.Clear();
@ -127,17 +127,17 @@ namespace Greenshot.Destinations {
effectSubItem.Click += delegate { effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Shadow); surface.ApplyBitmapEffect(Effects.Shadow);
}; };
effectSubItem = new ToolStripMenuItem("Torn Edge"); effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_torn_edge));
effectItem.DropDownItems.Add(effectSubItem); effectItem.DropDownItems.Add(effectSubItem);
effectSubItem.Click += delegate { effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.TornEdge); surface.ApplyBitmapEffect(Effects.TornEdge);
}; };
effectSubItem = new ToolStripMenuItem("Border"); effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_border));
effectItem.DropDownItems.Add(effectSubItem); effectItem.DropDownItems.Add(effectSubItem);
effectSubItem.Click += delegate { effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Border); surface.ApplyBitmapEffect(Effects.Border);
}; };
effectSubItem = new ToolStripMenuItem("Grayscale"); effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_grayscale));
effectItem.DropDownItems.Add(effectSubItem); effectItem.DropDownItems.Add(effectSubItem);
effectSubItem.Click += delegate { effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Grayscale); surface.ApplyBitmapEffect(Effects.Grayscale);

View file

@ -168,8 +168,6 @@ namespace Greenshot {
this.insert_window_toolstripmenuitem = new System.Windows.Forms.ToolStripMenuItem(); this.insert_window_toolstripmenuitem = new System.Windows.Forms.ToolStripMenuItem();
this.dimensionsLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.dimensionsLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.autoCropToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoCropToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tornEdgeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shadowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.LeftToolStripPanel.SuspendLayout(); this.toolStripContainer1.LeftToolStripPanel.SuspendLayout();
@ -451,22 +449,6 @@ namespace Greenshot {
this.autoCropToolStripMenuItem.Text = "Auto Crop"; this.autoCropToolStripMenuItem.Text = "Auto Crop";
this.autoCropToolStripMenuItem.Click += new System.EventHandler(this.AutoCropToolStripMenuItemClick); this.autoCropToolStripMenuItem.Click += new System.EventHandler(this.AutoCropToolStripMenuItemClick);
// //
// tornEdgeToolStripMenuItem
//
this.tornEdgeToolStripMenuItem.Name = "tornEdgeToolStripMenuItem";
this.tornEdgeToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.tornEdgeToolStripMenuItem.Text = "Torn Edge";
this.tornEdgeToolStripMenuItem.Visible = false;
this.tornEdgeToolStripMenuItem.Click += new System.EventHandler(this.TornEdgeToolStripMenuItemClick);
//
// shadowToolStripMenuItem
//
this.shadowToolStripMenuItem.Name = "shadowToolStripMenuItem";
this.shadowToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.shadowToolStripMenuItem.Text = "Shadow";
this.shadowToolStripMenuItem.Visible = false;
this.shadowToolStripMenuItem.Click += new System.EventHandler(this.ShadowToolStripMenuItemClick);
//
// editToolStripMenuItem // editToolStripMenuItem
// //
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -482,8 +464,6 @@ namespace Greenshot {
this.preferencesToolStripMenuItem, this.preferencesToolStripMenuItem,
this.toolStripSeparator5, this.toolStripSeparator5,
this.autoCropToolStripMenuItem, this.autoCropToolStripMenuItem,
this.tornEdgeToolStripMenuItem,
this.shadowToolStripMenuItem,
this.insert_window_toolstripmenuitem}); this.insert_window_toolstripmenuitem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
@ -1645,7 +1625,5 @@ namespace Greenshot {
private Greenshot.Controls.ToolStripColorButton btnFillColor; private Greenshot.Controls.ToolStripColorButton btnFillColor;
private Greenshot.Controls.ToolStripColorButton btnLineColor; private Greenshot.Controls.ToolStripColorButton btnLineColor;
private System.Windows.Forms.ToolStripMenuItem autoCropToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem autoCropToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem tornEdgeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem shadowToolStripMenuItem;
} }
} }

View file

@ -368,7 +368,6 @@ namespace Greenshot {
this.arrowHeadNoneMenuItem.Text = lang.GetString(LangKey.editor_arrowheads_none); this.arrowHeadNoneMenuItem.Text = lang.GetString(LangKey.editor_arrowheads_none);
this.shadowButton.Text = lang.GetString(LangKey.editor_shadow); this.shadowButton.Text = lang.GetString(LangKey.editor_shadow);
this.fontSizeLabel.Text = lang.GetString(LangKey.editor_fontsize); this.fontSizeLabel.Text = lang.GetString(LangKey.editor_fontsize);
this.fontBoldButton.Text = lang.GetString(LangKey.editor_bold); this.fontBoldButton.Text = lang.GetString(LangKey.editor_bold);
this.fontItalicButton.Text = lang.GetString(LangKey.editor_italic); this.fontItalicButton.Text = lang.GetString(LangKey.editor_italic);
@ -380,10 +379,41 @@ namespace Greenshot {
this.loadElementsToolStripMenuItem.Text = lang.GetString(LangKey.editor_load_objects); this.loadElementsToolStripMenuItem.Text = lang.GetString(LangKey.editor_load_objects);
this.autoCropToolStripMenuItem.Text = lang.GetString(LangKey.editor_autocrop); this.autoCropToolStripMenuItem.Text = lang.GetString(LangKey.editor_autocrop);
if (coreConf.isExperimentalFeatureEnabled("Effects")) { if (coreConf.isExperimentalFeatureEnabled("Effects")) {
this.shadowToolStripMenuItem.Text = lang.GetString(LangKey.editor_shadow); this.editToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
this.shadowToolStripMenuItem.Visible = true; ToolStripMenuItem effectItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_effects));
this.tornEdgeToolStripMenuItem.Visible = true; this.editToolStripMenuItem.DropDownItems.Add(effectItem);
ToolStripMenuItem effectSubItem;
effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_shadow));
effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Shadow);
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_torn_edge));
effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.TornEdge);
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_border));
effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Border);
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
effectSubItem = new ToolStripMenuItem(lang.GetString(LangKey.editor_grayscale));
effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Grayscale);
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
} }
this.editToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
this.editToolStripMenuItem.DropDownItems.Add(insert_window_toolstripmenuitem);
} }
public ISurface Surface { public ISurface Surface {
@ -1177,15 +1207,5 @@ namespace Greenshot {
refreshFieldControls(); refreshFieldControls();
} }
} }
void TornEdgeToolStripMenuItemClick(object sender, EventArgs e) {
surface.ApplyBitmapEffect(Effects.TornEdge);
updateUndoRedoSurfaceDependencies();
}
void ShadowToolStripMenuItemClick(object sender, EventArgs e) {
surface.ApplyBitmapEffect(Effects.Shadow);
updateUndoRedoSurfaceDependencies();
}
} }
} }

View file

@ -463,19 +463,31 @@ Zeit, z.B. 11_58_32 (plus Dateinamenerweiterung wie in den Einstellungen definie
<resource name="editor_preview_quality"> <resource name="editor_preview_quality">
Vorschauqualität Vorschauqualität
</resource> </resource>
<resource name="editor_magnification_factor"> <resource name="editor_magnification_factor">
Vergrößerungsfaktor Vergrößerungsfaktor
</resource> </resource>
<resource name="editor_shadow"> <resource name="editor_shadow">
Schatten Schatten
</resource> </resource>
<resource name="editor_confirm"> <resource name="editor_torn_edge">
Gerissene Kanten
</resource>
<resource name="editor_border">
Rand
</resource>
<resource name="editor_grayscale">
Graustufe
</resource>
<resource name="editor_effects">
Effekte
</resource>
<resource name="editor_confirm">
Bestätigen Bestätigen
</resource> </resource>
<resource name="editor_cancel"> <resource name="editor_cancel">
Abbrechen Abbrechen
</resource> </resource>
<resource name="editor_crop"> <resource name="editor_crop">
Zuschneiden (C) Zuschneiden (C)
</resource> </resource>
<resource name="contextmenu_captureclipboard"> <resource name="contextmenu_captureclipboard">

View file

@ -472,6 +472,18 @@ time, e.g. 11_58_32 (plus extension defined in the settings)
<resource name="editor_shadow"> <resource name="editor_shadow">
Shadow Shadow
</resource> </resource>
<resource name="editor_torn_edge">
Torn edge
</resource>
<resource name="editor_effects">
Effects
</resource>
<resource name="editor_border">
Border
</resource>
<resource name="editor_grayscale">
Grayscale
</resource>
<resource name="editor_confirm"> <resource name="editor_confirm">
Confirm Confirm
</resource> </resource>

View file

@ -435,42 +435,54 @@ genereert een directorie voor de huidige dag in uw standaard opslag lokatie, b.v
<resource name="editor_highlight_text"> <resource name="editor_highlight_text">
Text markeren Text markeren
</resource> </resource>
<resource name="editor_highlight_grayscale"> <resource name="editor_highlight_grayscale">
Grijstinten Grijstinten
</resource> </resource>
<resource name="editor_highlight_magnify"> <resource name="editor_highlight_magnify">
Vergroten Vergroten
</resource> </resource>
<resource name="editor_pixel_size"> <resource name="editor_pixel_size">
Pixelgrootte Pixelgrootte
</resource> </resource>
<resource name="editor_obfuscate"> <resource name="editor_obfuscate">
Onherkenbaar maken (O) Onherkenbaar maken (O)
</resource> </resource>
<resource name="editor_blur_radius"> <resource name="editor_blur_radius">
Onduidelijk maken radius Onduidelijk maken radius
</resource> </resource>
<resource name="editor_brightness"> <resource name="editor_brightness">
Helderheid Helderheid
</resource> </resource>
<resource name="editor_preview_quality"> <resource name="editor_preview_quality">
Voorbeeld kwaliteit Voorbeeld kwaliteit
</resource> </resource>
<resource name="editor_magnification_factor"> <resource name="editor_magnification_factor">
Vergrotingsfactor Vergrotingsfactor
</resource> </resource>
<resource name="editor_shadow"> <resource name="editor_shadow">
Schaduw Schaduw
</resource> </resource>
<resource name="editor_confirm"> <resource name="editor_torn_edge">
Gescheurde randen
</resource>
<resource name="editor_border">
Rand
</resource>
<resource name="editor_grayscale">
Grijstinten
</resource>
<resource name="editor_effects">
Effecten
</resource>
<resource name="editor_confirm">
Bevestigen Bevestigen
</resource> </resource>
<resource name="editor_cancel"> <resource name="editor_cancel">
Afbreken Afbreken
</resource> </resource>
<resource name="editor_crop"> <resource name="editor_crop">
Bijsnijden (C) Bijsnijden (C)
</resource> </resource>
<resource name="contextmenu_captureclipboard"> <resource name="contextmenu_captureclipboard">
Laad beeld van het klembord Laad beeld van het klembord
</resource> </resource>

View file

@ -3,10 +3,9 @@ Greenshot: A screenshot tool optimized for productivity. Save a screenshot or a
CHANGE LOG: CHANGE LOG:
0.9.0 Build 1626 0.9.0 Build 1660
We changed the version to 0.9.0 as the amount of features in 0.8.1 was more than planned. We changed the version to 0.9.0 as the amount of features in 0.8.1 was more than planned.
Due to the many changes we need to go through a Release Candidate iteration again...
Bugs resolved: Bugs resolved:
* Fixed a problem with the window preview, if the window had a small height, when using the context menu (Windows Vista and later) * Fixed a problem with the window preview, if the window had a small height, when using the context menu (Windows Vista and later)
@ -24,6 +23,8 @@ Features added:
* Added a "processor" concept, making it possible to modify the capture before it's send to a destination. Currently there is only an internal implementation which replaces the TitleFix plugin. * Added a "processor" concept, making it possible to modify the capture before it's send to a destination. Currently there is only an internal implementation which replaces the TitleFix plugin.
* Added Office destinations (Word, Excel, Powerpoint & Outlook) with dynamic resolving of open "instances". * Added Office destinations (Word, Excel, Powerpoint & Outlook) with dynamic resolving of open "instances".
* Added Ctrl/shift logic to the editor, hard to explain (see help) but hold one of the keys down and draw.. * Added Ctrl/shift logic to the editor, hard to explain (see help) but hold one of the keys down and draw..
* Added a color picker in the color dialog.
* Added shadow & torn edges
0.8.1 Build 1483 0.8.1 Build 1483

View file

@ -28,6 +28,7 @@ using System.Drawing.Drawing2D;
using GreenshotPlugin.UnmanagedHelpers; using GreenshotPlugin.UnmanagedHelpers;
using GreenshotPlugin.Core; using GreenshotPlugin.Core;
using IniFile; using IniFile;
using System.Runtime.InteropServices;
namespace GreenshotPlugin.Core { namespace GreenshotPlugin.Core {
/// <summary> /// <summary>
@ -557,6 +558,106 @@ namespace GreenshotPlugin.Core {
} }
} }
public static Bitmap FastBlur(Bitmap sourceBitmap, int radius) {
if (radius < 1) return null;
var rct = new Rectangle(0, 0, sourceBitmap.Width, sourceBitmap.Height);
var dest = new int[rct.Width * rct.Height];
var source = new int[rct.Width * rct.Height];
var bits = sourceBitmap.LockBits(rct, ImageLockMode.ReadWrite, sourceBitmap.PixelFormat);
Marshal.Copy(bits.Scan0, source, 0, source.Length);
sourceBitmap.UnlockBits(bits);
int w = rct.Width;
int h = rct.Height;
int wm = w - 1;
int hm = h - 1;
int wh = w * h;
int div = radius + radius + 1;
var r = new int[wh];
var g = new int[wh];
var b = new int[wh];
int rsum, gsum, bsum, x, y, i, p1, p2, yi;
var vmin = new int[max(w, h)];
var vmax = new int[max(w, h)];
var dv = new int[256 * div];
for (i = 0; i < 256 * div; i++) {
dv[i] = (i / div);
}
int yw = yi = 0;
for (y = 0; y < h; y++) { // blur horizontal
rsum = gsum = bsum = 0;
for (i = -radius; i <= radius; i++) {
int p = source[yi + min(wm, max(i, 0))];
rsum += (p & 0xff0000) >> 16;
gsum += (p & 0x00ff00) >> 8;
bsum += p & 0x0000ff;
}
for (x = 0; x < w; x++) {
r[yi] = dv[rsum];
g[yi] = dv[gsum];
b[yi] = dv[bsum];
if (y == 0) {
vmin[x] = min(x + radius + 1, wm);
vmax[x] = max(x - radius, 0);
}
p1 = source[yw + vmin[x]];
p2 = source[yw + vmax[x]];
rsum += ((p1 & 0xff0000) - (p2 & 0xff0000)) >> 16;
gsum += ((p1 & 0x00ff00) - (p2 & 0x00ff00)) >> 8;
bsum += (p1 & 0x0000ff) - (p2 & 0x0000ff);
yi++;
}
yw += w;
}
for (x = 0; x < w; x++) { // blur vertical
rsum = gsum = bsum = 0;
int yp = -radius * w;
for (i = -radius; i <= radius; i++) {
yi = max(0, yp) + x;
rsum += r[yi];
gsum += g[yi];
bsum += b[yi];
yp += w;
}
yi = x;
for (y = 0; y < h; y++) {
dest[yi] = unchecked((int)(0xff000000u | (uint)(dv[rsum] << 16) | (uint)(dv[gsum] << 8) | (uint)dv[bsum]));
if (x == 0) {
vmin[y] = min(y + radius + 1, hm) * w;
vmax[y] = max(y - radius, 0) * w;
}
p1 = x + vmin[y];
p2 = x + vmax[y];
rsum += r[p1] - r[p2];
gsum += g[p1] - g[p2];
bsum += b[p1] - b[p2];
yi += w;
}
}
// copy back to image
Bitmap newImage = new Bitmap(sourceBitmap.Width, sourceBitmap.Height, sourceBitmap.PixelFormat);
var bits2 = newImage.LockBits(rct, ImageLockMode.ReadWrite, newImage.PixelFormat);
Marshal.Copy(dest, 0, bits2.Scan0, dest.Length);
newImage.UnlockBits(bits);
return newImage;
}
private static int min(int a, int b) { return Math.Min(a, b); }
private static int max(int a, int b) { return Math.Max(a, b); }
/** /**
* This method fixes the problem that we can't apply a filter outside the target bitmap, * This method fixes the problem that we can't apply a filter outside the target bitmap,
* therefor the filtered-bitmap will be shifted if we try to draw it outside the target bitmap. * therefor the filtered-bitmap will be shifted if we try to draw it outside the target bitmap.
@ -624,6 +725,7 @@ namespace GreenshotPlugin.Core {
//} //}
// blur "shadow", apply to whole new image // blur "shadow", apply to whole new image
Rectangle newImageRectangle = new Rectangle(0, 0, newImage.Width, newImage.Height); Rectangle newImageRectangle = new Rectangle(0, 0, newImage.Width, newImage.Height);
//using (Bitmap blurImage = FastBlur(newImage, shadowSize-1)) {
using (Bitmap blurImage = CreateBlur(newImage, newImageRectangle, true, shadowSize, 1d, false, newImageRectangle)) { using (Bitmap blurImage = CreateBlur(newImage, newImageRectangle, true, shadowSize, 1d, false, newImageRectangle)) {
graphics.DrawImageUnscaled(blurImage, newImageRectangle.Location); graphics.DrawImageUnscaled(blurImage, newImageRectangle.Location);
} }