示例#1
0
        public static IImageProcessingContext <TPixel> PowerAlpha <TPixel>(this IImageProcessingContext <TPixel> source, float amount = 1) where TPixel : struct, IPixel <TPixel>
        {
            var filter = new Matrix4x4()
            {
                M11 = 1,
                M22 = 1,
                M33 = 1,
                M44 = amount
            };

            return(source.Filter(filter));
        }
示例#2
0
        public static IImageProcessingContext <TPixel> Tint <TPixel>(this IImageProcessingContext <TPixel> source, IPixel color, float amount = 1) where TPixel : struct, IPixel <TPixel>
        {
            var rgb = color.ToVector4() * amount;

            var filter = new Matrix4x4()
            {
                M11 = 1 - amount,
                M22 = 1 - amount,
                M33 = 1 - amount,
                M41 = rgb.X,
                M42 = rgb.Y,
                M43 = rgb.Z,
                M44 = 1
            };

            return(source.Filter(filter));
        }
示例#3
0
        /// <summary>
        ///     Applies a tint to an image.
        /// </summary>
        public static IImageProcessingContext Tint(this IImageProcessingContext context, Color colour)
        {
            var tintMatrix = CreateTintMatrix(colour);

            return(context.Filter(tintMatrix));
        }