title: Applying mask image for erasing with Win2D
body: <p>I want to make transparent (erase) particular area of an image using Win2D.</p>
  
  <p>For that purpose I have a mask which contains transparent colour 
  (RRGGBBAA = xxxxxx00) for pixels that need to be erased, and white colour (RRGGBBAA = FFFFFFFF) for pixels that should stay.</p>
  
  <p>Ideally, I need either <em>CanvasBlend.And</em> or <em>CanvasBlend.Mutiply</em>, but neither of those is provided with Win2D. However, there is <em>CanvasBlend.Min</em>, which, as I expect, should also do the job.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>  internal static CanvasBitmap applyMask(
          ICanvasResourceCreatorWithDpi creator,
          CanvasBitmap sourceBmp, CanvasBitmap maskBmp,
          CanvasBlend blendMode = CanvasBlend.Min) {
  
          var destSize = sourceBmp.Size;
          var crt = new CanvasRenderTarget(creator, destSize);
          var rect = new Rect(new Point(), destSize);
  
          using (var ds = crt.CreateDrawingSession()) {
               ds.Blend = CanvasBlend.SourceOver;
               ds.DrawImage(sourceBmp, rect);
               ds.Blend = blendMode;
               ds.DrawImage(maskBmp, rect);
          }
  
          return crt;
    }
  </code></pre>
  
  <p>It comes up with showing source image completely unmodified, as if masked image opacity (Alpha) is ignored. Any suggestions? </p>