/// <summary> /// Initializes a new instance of the <see cref="PositionAwarePixelShaderProcessor{TPixel}"/> class. /// </summary> /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param> /// <param name="definition">The <see cref="PositionAwarePixelShaderProcessor"/> defining the processor parameters.</param> /// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param> /// <param name="sourceRectangle">The source area to process for the current processor instance.</param> public PositionAwarePixelShaderProcessor(Configuration configuration, PositionAwarePixelShaderProcessor definition, Image <TPixel> source, Rectangle sourceRectangle) : base(configuration, definition.Modifiers, source, sourceRectangle) { this.pixelShader = definition.PixelShader; }
/// <summary> /// Applies a user defined pixel shader to the image. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="pixelShader">The user defined pixel shader to use to modify images.</param> /// <param name="rectangle"> /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// </param> /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader, Rectangle rectangle, PixelConversionModifiers modifiers) => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader, modifiers), rectangle);
/// <summary> /// Initializes a new instance of the <see cref="PositionAwarePixelShaderProcessor"/> class. /// </summary> /// <param name="pixelShader"> /// The user defined pixel shader to use to modify images. /// </param> /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param> public PositionAwarePixelShaderProcessor(PositionAwarePixelShader pixelShader, PixelConversionModifiers modifiers) { this.PixelShader = pixelShader; this.Modifiers = modifiers; }
/// <summary> /// Applies a user defined pixel shader to the image. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="pixelShader">The user defined pixel shader to use to modify images.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader) => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader));
/// <summary> /// Initializes a new instance of the <see cref="PositionAwarePixelShaderProcessor"/> class. /// </summary> /// <param name="pixelShader"> /// The user defined pixel shader to use to modify images. /// </param> public PositionAwarePixelShaderProcessor(PositionAwarePixelShader pixelShader) { this.PixelShader = pixelShader; this.Modifiers = DefaultModifiers; }