title: Saving multiple canvas controls as an image in silverlight/wpf
body: <p>I have a situation where I have a canvas with an image and I lay multiple canvas controls over it and each canvas may have multiple controls drawn on them (Ellipses, Lines, etc).  What is the best/most efficient way to save all these canvas controls toone image?   I assume WritableBitmap, but how will this work with multiple canvas controls?  One given is that each canvas will be the same size.</p>
  
  <p>EDIT:</p>
  
  <p>This is what I tried.  I also tried with the dpi of the original image, which gives me the tiny result.</p>
  
  <pre><code>BitmapSource bms = (BitmapSource)this.ctlImage.Source;
  
  Matrix m = PresentationSource.FromVisual(this.ctlImgCanvas).CompositionTarget.TransformToDevice; 
  
  RenderTargetBitmap rtb = new RenderTargetBitmap(bms.PixelWidth, bms.PixelHeight, m.M11 * 96.0, m.M22 * 96.0, PixelFormats.Pbgra32);
  
  rtb.Render(this.ctlImgCanvas);
  
  PngBitmapEncoder encoder = new PngBitmapEncoder();
  encoder.Frames.Add(BitmapFrame.Create(rtb));
              encoder.Save(memStream);
  </code></pre>