public WicUnsharpMask(WicTransform prev) : base(prev) { var ss = Context.Settings.UnsharpMask; if (ss.Radius <= 0d || ss.Amount <= 0) { return; } var fmt = PixelFormat.Cache[Source.GetPixelFormat()]; mapx = KernelMap <int> .MakeBlurMap(Context.Width, ss.Radius, 1u, fmt.AlphaRepresentation != PixelAlphaRepresentation.None); mapy = KernelMap <int> .MakeBlurMap(Context.Height, ss.Radius, 1u, fmt.AlphaRepresentation != PixelAlphaRepresentation.None); Source = source = new WicUnsharpMask <byte, int>(Source, mapx, mapy, ss); }
public WicHighQualityScaler(WicTransform prev) : base(prev) { uint width = (uint)Context.Settings.Width, height = (uint)Context.Settings.Height; var interpolatorx = width == Context.Width ? InterpolationSettings.NearestNeighbor : Context.Settings.Interpolation; var interpolatory = height == Context.Height ? InterpolationSettings.NearestNeighbor : Context.Settings.Interpolation; var fmt = PixelFormat.Cache[Source.GetPixelFormat()]; if (fmt.NumericRepresentation == PixelNumericRepresentation.Float) { var mx = KernelMap <float> .MakeScaleMap(Context.Width, width, fmt.ColorChannelCount, fmt.AlphaRepresentation != PixelAlphaRepresentation.None, true, interpolatorx); var my = KernelMap <float> .MakeScaleMap(Context.Height, height, fmt.ColorChannelCount, fmt.AlphaRepresentation != PixelAlphaRepresentation.None, true, interpolatory); source = new WicConvolution <float, float>(Source, mx, my); mapx = mx; mapy = my; } else { var mx = KernelMap <int> .MakeScaleMap(Context.Width, width, 1, fmt.AlphaRepresentation == PixelAlphaRepresentation.Unassociated, false, interpolatorx); var my = KernelMap <int> .MakeScaleMap(Context.Height, height, 1, fmt.AlphaRepresentation == PixelAlphaRepresentation.Unassociated, false, interpolatory); if (fmt.NumericRepresentation == PixelNumericRepresentation.Fixed) { source = new WicConvolution <ushort, int>(Source, mx, my); } else { source = new WicConvolution <byte, int>(Source, mx, my); } mapx = mx; mapy = my; } Source = source; Source.GetSize(out Context.Width, out Context.Height); }