/// <summary>
        /// Performs an affine transform of an image using the specified sampling algorithm.
        /// </summary>
        /// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
        /// <param name="sourceRectangle">The source rectangle</param>
        /// <param name="builder">The affine transform builder.</param>
        /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
        /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
        public static IImageProcessingContext Transform(
            this IImageProcessingContext ctx,
            Rectangle sourceRectangle,
            AffineTransformBuilder builder,
            IResampler sampler)
        {
            Matrix3x2 transform        = builder.BuildMatrix(sourceRectangle);
            Size      targetDimensions = TransformUtilities.GetTransformedSize(sourceRectangle.Size, transform);

            return(ctx.Transform(sourceRectangle, transform, targetDimensions, sampler));
        }
Beispiel #2
0
        /// <summary>
        /// Performs an affine transform of an image using the specified sampling algorithm.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="ctx">The <see cref="IImageProcessingContext{TPixel}"/>.</param>
        /// <param name="sourceRectangle">The source rectangle</param>
        /// <param name="builder">The affine transform builder.</param>
        /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
        /// <returns>The <see cref="Image{TPixel}"/></returns>
        public static IImageProcessingContext <TPixel> Transform <TPixel>(
            this IImageProcessingContext <TPixel> ctx,
            Rectangle sourceRectangle,
            AffineTransformBuilder builder,
            IResampler sampler)
            where TPixel : struct, IPixel <TPixel>
        {
            Matrix3x2 transform        = builder.BuildMatrix(sourceRectangle);
            Size      targetDimensions = TransformUtils.GetTransformedSize(sourceRectangle.Size, transform);

            return(ctx.Transform(sourceRectangle, transform, targetDimensions, sampler));
        }
 /// <summary>
 /// Performs an affine transform of an image using the specified sampling algorithm.
 /// </summary>
 /// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
 /// <param name="builder">The affine transform builder.</param>
 /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Transform(
     this IImageProcessingContext ctx,
     AffineTransformBuilder builder,
     IResampler sampler) =>
 ctx.Transform(new Rectangle(Point.Empty, ctx.GetCurrentSize()), builder, sampler);
 /// <summary>
 /// Performs an affine transform of an image.
 /// </summary>
 /// <param name="source">The image to transform.</param>
 /// <param name="builder">The affine transform builder.</param>
 /// <returns>The <see cref="Image{TPixel}"/></returns>
 public static IImageProcessingContext Transform(
     this IImageProcessingContext source,
     AffineTransformBuilder builder) =>
 Transform(source, builder, KnownResamplers.Bicubic);
Beispiel #5
0
 /// <summary>
 /// Performs an affine transform of an image using the specified sampling algorithm.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="ctx">The <see cref="IImageProcessingContext{TPixel}"/>.</param>
 /// <param name="builder">The affine transform builder.</param>
 /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
 /// <returns>The <see cref="Image{TPixel}"/></returns>
 public static IImageProcessingContext <TPixel> Transform <TPixel>(
     this IImageProcessingContext <TPixel> ctx,
     AffineTransformBuilder builder,
     IResampler sampler)
     where TPixel : struct, IPixel <TPixel>
 => ctx.Transform(new Rectangle(Point.Empty, ctx.GetCurrentSize()), builder, sampler);
Beispiel #6
0
 /// <summary>
 /// Performs an affine transform of an image.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image to transform.</param>
 /// <param name="builder">The affine transform builder.</param>
 /// <returns>The <see cref="Image{TPixel}"/></returns>
 public static IImageProcessingContext <TPixel> Transform <TPixel>(
     this IImageProcessingContext <TPixel> source,
     AffineTransformBuilder builder)
     where TPixel : struct, IPixel <TPixel>
 => Transform(source, builder, KnownResamplers.Bicubic);