Exemple #1
0
 /// <summary>
 /// Applies the processor to the image.
 /// <remarks>
 /// This method resizes the image.
 /// </remarks>
 /// </summary>
 /// <typeparam name="TColor">The pixel format.</typeparam>
 /// <typeparam name="TPacked">The packed format. <example>long, float.</example></typeparam>
 /// <param name="source">The source image. Cannot be null.</param>
 /// <param name="width">The target image width.</param>
 /// <param name="height">The target image height.</param>
 /// <param name="sampler">The processor to apply to the image.</param>
 /// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
 internal static Image <TColor, TPacked> Process <TColor, TPacked>(this Image <TColor, TPacked> source, int width, int height, IImageSamplingProcessor <TColor, TPacked> sampler)
     where TColor : struct, IPackedPixel <TPacked>
     where TPacked : struct
 {
     return(Process(source, width, height, source.Bounds, default(Rectangle), sampler));
 }
Exemple #2
0
 /// <summary>
 /// Applies the processor to the image.
 /// <remarks>This method does not resize the target image.</remarks>
 /// </summary>
 /// <typeparam name="TColor">The pixel format.</typeparam>
 /// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="processor">The processor to apply to the image.</param>
 /// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
 internal static Image <TColor, TPacked> Process <TColor, TPacked>(this Image <TColor, TPacked> source, IImageSamplingProcessor <TColor, TPacked> processor)
     where TColor : struct, IPackedPixel <TPacked>
     where TPacked : struct
 {
     return(Process(source, source.Bounds, processor));
 }
Exemple #3
0
 /// <summary>
 /// Applies the processor to the image.
 /// <remarks>This method does not resize the target image.</remarks>
 /// </summary>
 /// <typeparam name="TColor">The pixel format.</typeparam>
 /// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="sourceRectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to draw.
 /// </param>
 /// <param name="processor">The processors to apply to the image.</param>
 /// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
 internal static Image <TColor, TPacked> Process <TColor, TPacked>(this Image <TColor, TPacked> source, Rectangle sourceRectangle, IImageSamplingProcessor <TColor, TPacked> processor)
     where TColor : struct, IPackedPixel <TPacked>
     where TPacked : struct
 {
     return(PerformAction(source, true, (sourceImage, targetImage) => processor.Apply(targetImage, sourceImage, sourceRectangle)));
 }
Exemple #4
0
 /// <summary>
 /// Applies the processor to the image.
 /// <remarks>
 /// This method does will resize the target image if the source and target rectangles are different.
 /// </remarks>
 /// </summary>
 /// <typeparam name="TColor">The pixel format.</typeparam>
 /// <typeparam name="TPacked">The packed format. <example>long, float.</example></typeparam>
 /// <param name="source">The source image. Cannot be null.</param>
 /// <param name="width">The target image width.</param>
 /// <param name="height">The target image height.</param>
 /// <param name="sourceRectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to draw.
 /// </param>
 /// <param name="targetRectangle">
 /// The <see cref="Rectangle"/> structure that specifies the location and size of the drawn image.
 /// The image is scaled to fit the rectangle.
 /// </param>
 /// <param name="sampler">The processor to apply to the image.</param>
 /// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
 internal static Image <TColor, TPacked> Process <TColor, TPacked>(this Image <TColor, TPacked> source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSamplingProcessor <TColor, TPacked> sampler)
     where TColor : struct, IPackedPixel <TPacked>
     where TPacked : struct
 {
     return(PerformAction(source, false, (sourceImage, targetImage) => sampler.Apply(targetImage, sourceImage, width, height, targetRectangle, sourceRectangle)));
 }