mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Merge remote-tracking branch 'remotes/origin/master' into release/1.2.9
This commit is contained in:
commit
0323705513
276 changed files with 5382 additions and 3666 deletions
|
@ -86,7 +86,8 @@ namespace Greenshot.Core {
|
|||
/// </summary>
|
||||
[TypeConverter(typeof(EffectConverter))]
|
||||
public class TornEdgeEffect : DropShadowEffect {
|
||||
public TornEdgeEffect() : base() {
|
||||
public TornEdgeEffect()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
public int ToothHeight {
|
||||
|
@ -116,7 +117,7 @@ namespace Greenshot.Core {
|
|||
ToothHeight = 12;
|
||||
HorizontalToothRange = 20;
|
||||
VerticalToothRange = 20;
|
||||
Edges = new bool[] { true, true, true, true };
|
||||
Edges = new[] { true, true, true, true };
|
||||
GenerateShadow = true;
|
||||
}
|
||||
public override Image Apply(Image sourceImage, Matrix matrix) {
|
||||
|
@ -146,16 +147,16 @@ namespace Greenshot.Core {
|
|||
/// MonochromeEffect
|
||||
/// </summary>
|
||||
public class MonochromeEffect : IEffect {
|
||||
private byte threshold;
|
||||
private readonly byte _threshold;
|
||||
/// <param name="threshold">Threshold for monochrome filter (0 - 255), lower value means less black</param>
|
||||
public MonochromeEffect(byte threshold) {
|
||||
this.threshold = threshold;
|
||||
_threshold = threshold;
|
||||
}
|
||||
public void Reset() {
|
||||
// TODO: Modify the threshold to have a default, which is reset here
|
||||
}
|
||||
public Image Apply(Image sourceImage, Matrix matrix) {
|
||||
return ImageHelper.CreateMonochrome(sourceImage, threshold);
|
||||
return ImageHelper.CreateMonochrome(sourceImage, _threshold);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +164,8 @@ namespace Greenshot.Core {
|
|||
/// AdjustEffect
|
||||
/// </summary>
|
||||
public class AdjustEffect : IEffect {
|
||||
public AdjustEffect() : base() {
|
||||
public AdjustEffect()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
public float Contrast {
|
||||
|
@ -192,8 +194,9 @@ namespace Greenshot.Core {
|
|||
/// ReduceColorsEffect
|
||||
/// </summary>
|
||||
public class ReduceColorsEffect : IEffect {
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(ReduceColorsEffect));
|
||||
public ReduceColorsEffect() : base() {
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(ReduceColorsEffect));
|
||||
public ReduceColorsEffect()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
public int Colors {
|
||||
|
@ -355,9 +358,10 @@ namespace Greenshot.Core {
|
|||
|
||||
public class EffectConverter : TypeConverter {
|
||||
// Fix to prevent BUG-1753
|
||||
private NumberFormatInfo numberFormatInfo = new NumberFormatInfo();
|
||||
private readonly NumberFormatInfo numberFormatInfo = new NumberFormatInfo();
|
||||
|
||||
public EffectConverter() : base() {
|
||||
public EffectConverter()
|
||||
{
|
||||
numberFormatInfo.NumberDecimalSeparator = ".";
|
||||
numberFormatInfo.NumberGroupSeparator = ",";
|
||||
}
|
||||
|
@ -382,7 +386,7 @@ namespace Greenshot.Core {
|
|||
return base.CanConvertTo(context, destinationType);
|
||||
}
|
||||
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
|
||||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
|
||||
// to string
|
||||
if (destinationType == typeof(string)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -400,7 +404,7 @@ namespace Greenshot.Core {
|
|||
}
|
||||
}
|
||||
// from string
|
||||
if (value.GetType() == typeof(string)) {
|
||||
if (value is string) {
|
||||
string settings = value as string;
|
||||
if (destinationType == typeof(DropShadowEffect)) {
|
||||
DropShadowEffect effect = new DropShadowEffect();
|
||||
|
@ -417,14 +421,13 @@ namespace Greenshot.Core {
|
|||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
|
||||
if (value != null && value.GetType() == typeof(string)) {
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
|
||||
if (value != null && value is string) {
|
||||
string settings = value as string;
|
||||
if (settings.Contains("ToothHeight")) {
|
||||
return ConvertTo(context, culture, value, typeof(TornEdgeEffect));
|
||||
} else {
|
||||
return ConvertTo(context, culture, value, typeof(DropShadowEffect));
|
||||
}
|
||||
return ConvertTo(context, culture, value, typeof(DropShadowEffect));
|
||||
}
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue