public void CheckDarkPixel() { originalPicture[0, 0] = new Pixel(10, 10, 10); resultPicture = new BlackAndWhiteFilter().ChangeImage(originalPicture, 100); Assert.IsTrue(resultPicture[0, 0].Equals(new Pixel(0, 0, 0))); }
public void CheckLightPixel() { originalPicture[0, 0] = new Pixel(200, 200, 200); resultPicture = new BlackAndWhiteFilter().ChangeImage(originalPicture, 100); Assert.IsTrue(resultPicture[0, 0].Equals(new Pixel(255, 255, 255))); }
static void Strategy() { JpegCompressor compressor = new JpegCompressor(); BlackAndWhiteFilter filter = new BlackAndWhiteFilter(); ImageStorage imageStorage = new ImageStorage(compressor, filter); imageStorage.Store("Video File"); }
public static void DoSomething(string path) { var image = Image.Load(path); // Here you can select any pixel shader type in BlackAndWhitePixelShaderType enum var filter = new BlackAndWhiteFilter(image, BlackAndWhitePixelShaderType.FullBlackAndWhite); AdaptiveWorkflow workflow = new AdaptiveWorkflow(); image = workflow.AddFilter(filter); using (FileStream fs = new FileStream(@"C:\Users\r_bon\Pictures\Camera Roll\" + Guid.NewGuid() + ".png", FileMode.OpenOrCreate)) { image.SaveAsPng(fs); } }
/// <summary> /// Use filter black and white /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BlackAndWhiteMenu_Click(object sender, RoutedEventArgs e) { IImageFilter bw = new BlackAndWhiteFilter(); this.UseFilter(bw); }