Example #1
0
 private void ChooseImageTask_Completed(object sender, PhotoResult e)
 {
     if (e.TaskResult == TaskResult.OK)
     {
         GenerateButton.IsEnabled = true;
         SketchButton.IsEnabled = false;
         InstructionText.Visibility = Visibility.Collapsed;
         DisplayedImage.Visibility = Visibility.Visible;
         selectedImage = PictureDecoder.DecodeJpeg(e.ChosenPhoto);
         DisplayedImage.Source = selectedImage.Copy();
     }
 }
Example #2
0
 private Task<WriteableBitmap> GenerateLineDrawing(WriteableBitmap sourceImage, int thresholdOffset)
 {
     var resultImage = sourceImage.Copy();
     return Task.Run<WriteableBitmap>(() =>
     {
         var colorMatrix = resultImage.ToColorMatrix().Desaturate();
         downSampler.ThresholdOffset = thresholdOffset;
         colorMatrix = downSampler.Execute(colorMatrix);
         colorMatrix = noiseReducer.Execute(colorMatrix);
         resultImage.WriteColors(colorMatrix);
         return resultImage;
     });
 }