Android: how to apply arbitrary alpha mask to drawing commands?
<p>I am drawing some graphics into a Canvas.  This graphics are a combination of shapes, text, and bitmaps.  I need to set the alpha level of these commands according to an arbitrary mask.  This mask defines an arbitrary alpha for all pixels based on x,y location.   </p>

<p>A simple example of this: a mask is defined such that the top 1/4 of area is 80% alpha, the next 1/4 is 60% alpha, the next is 20% alpha, the last is 0% alpha.  A drawing command exists for line that crosses all 4 alpha regions.   The resulting rendering should be a line whose top 1/4 is 80% alpha, next 1/4 is 60% alpha, etc.  Below is a crude rendering of this scenario.  In actuality the mask does not need to be so simple, it can define any alpha value for any pixel.</p>

<p>Android provides a variety of options/parameters that seem related to this, but I haven't found any that work for me.  Particularly the android.graphics.MaskFilter looks promising, as it is described as a way to transform alpha channels when prior to drawing.  However, MaskFilter can not be subclassed and the provided implementations do not allow for an arbitrary mask.</p>

<p><img src="http://i.stack.imgur.com/vA5mE.png" alt="enter image description here"></p>
