/// <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));
        }
Exemple #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));
        }