Пример #1
0
        /// <summary>
        /// Performs a projective 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 projective 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,
            ProjectiveTransformBuilder builder,
            IResampler sampler)
        {
            Matrix4x4 transform        = builder.BuildMatrix(sourceRectangle);
            Size      targetDimensions = TransformUtilities.GetTransformedSize(sourceRectangle.Size, transform);

            return(ctx.Transform(sourceRectangle, transform, targetDimensions, sampler));
        }
Пример #2
0
        /// <summary>
        /// Performs a projective 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 projective 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,
            ProjectiveTransformBuilder builder,
            IResampler sampler)
            where TPixel : struct, IPixel <TPixel>
        {
            Matrix4x4 transform        = builder.BuildMatrix(sourceRectangle);
            Size      targetDimensions = TransformUtils.GetTransformedSize(sourceRectangle.Size, transform);

            return(ctx.Transform(sourceRectangle, transform, targetDimensions, sampler));
        }
Пример #3
0
 /// <summary>
 /// Performs a projective transform of an image using the specified sampling algorithm.
 /// </summary>
 /// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
 /// <param name="builder">The projective 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,
     ProjectiveTransformBuilder builder,
     IResampler sampler) =>
 ctx.Transform(new Rectangle(Point.Empty, ctx.GetCurrentSize()), builder, sampler);
Пример #4
0
 /// <summary>
 /// Performs a projective 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="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Transform(
     this IImageProcessingContext source,
     ProjectiveTransformBuilder builder) =>
 Transform(source, builder, KnownResamplers.Bicubic);
Пример #5
0
 /// <summary>
 /// Performs a projective 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,
     ProjectiveTransformBuilder builder)
     where TPixel : struct, IPixel <TPixel>
 => Transform(source, builder, KnownResamplers.Bicubic);
Пример #6
0
 /// <summary>
 /// Performs a projective 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 projective 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,
     ProjectiveTransformBuilder builder,
     IResampler sampler)
     where TPixel : struct, IPixel <TPixel>
 => ctx.Transform(new Rectangle(Point.Empty, ctx.GetCurrentSize()), builder, sampler);