title: Drawing semi-transparently on a BitmapImage on an Image in a ContentPresenter in a Viewbox
body: <p>It seems like variations of this question have been asked before, but not this specifically. Also, it seems that <code>BitmapImages</code> are different from straight <code>Bitmaps</code>. So here we go:</p>
  
  <p>I've got a <code>BitmapImage x:Name="HeightMapImage"</code> that is pointing to an Image <code>x:Name="image"</code> that is inside <code>ContentPresenter x:Name="contentPresenter"</code> that is in <code>Viewbox x:Name="viewBox"</code>. I want to draw both semi-transparently and non-transparently at specific X,Y coordinates on the <code>HeightMapImage</code>. </p>
  
  <p>The reason for this set-up is that the <code>BitmapImage</code> is being scrolled and zoomed. When I draw on the <code>BitmapImage</code> at X,Y I want that to automatically scroll and zoom, too.</p>
  
  <p>I'm a very old geek having written for many machines in many different GDIs over the years. This seems like a 'get the handle' to some graphic device context problem and once I've got it I can merrily draw away. </p>
  
  <p>Your help is greatly appreciated.</p>
  
  <p>Somebody wanted to see the code. Here's the <code>XAML</code>:</p>
  
  <pre><code>&lt;Viewbox x:Name="viewBox" Margin="0,0,0,0"&gt;
      &lt;ContentPresenter x:Name="contentPresenter" Width="350" Height="350" &gt;
          &lt;ContentPresenter.Content&gt;
              &lt;Image x:Name="image" Width="350" Height="350"&gt;
                  &lt;Image.Source&gt;
                      &lt;BitmapImage x:Name="HeightMapImage" UriSource="DinoIslandLogo.bmp" /&gt;
                  &lt;/Image.Source&gt;
              &lt;/Image&gt;
          &lt;/ContentPresenter.Content&gt;
      &lt;/ContentPresenter&gt;
  &lt;/Viewbox&gt;
  </code></pre>
  
  <p>And here's a screen capture that somebody wanted:</p>
  
  <p><img src="https://i.stack.imgur.com/9Ybpx.jpg" alt="enter image description here"></p>
  
  <p>And here's the code that gets the user's selected bitmap and loads and displays it:</p>
  
  <pre><code>string selectedFileName = dlg.FileName;
  BitmapImage bitmap = new BitmapImage();
  
  bitmap.BeginInit();
  bitmap.UriSource = new Uri(selectedFileName);
  bitmap.EndInit();
  
  image.Source = bitmap;
  </code></pre>
  
  <p>Does this need to be rewritten for a <code>Writeable Bitmap</code>?</p>