示例#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));
        }