public InvertNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) { Name = "Invert"; Id = Guid.NewGuid().ToString(); width = w; height = h; red = true; blue = true; green = true; alpha = false; tileX = tileY = 1; previewProcessor = new BasicImageRenderer(); processor = new InvertProcessor(); internalPixelType = p; input = new NodeInput(NodeType.Color | NodeType.Gray, this, "Image Input"); output = new NodeOutput(NodeType.Color | NodeType.Gray, this); input.OnInputAdded += Input_OnInputAdded; input.OnInputChanged += Input_OnInputChanged; input.OnInputRemoved += Input_OnInputRemoved; Inputs = new List <NodeInput>(); Inputs.Add(input); Outputs = new List <NodeOutput>(); Outputs.Add(output); }
public override void Dispose() { base.Dispose(); if (processor != null) { processor.Release(); processor = null; } }
/// <summary> /// Inverts the colors of the image. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="rectangle"> /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// </param> /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param> /// <returns>The <see cref="Image"/>.</returns> public static Image <T, TP> Invert <T, TP>(this Image <T, TP> source, Rectangle rectangle, ProgressEventHandler progressHandler = null) where T : IPackedVector <TP> where TP : struct { InvertProcessor <T, TP> processor = new InvertProcessor <T, TP>(); processor.OnProgress += progressHandler; try { return(source.Process(rectangle, processor)); } finally { processor.OnProgress -= progressHandler; } }