tags:

views:

101

answers:

0

I have a collection of images that are simply grayscale images that I need to use as a stencil or alpha mask so I can draw other things though them.

Something along the lines of this pseudo code...

void paint(Graphics g) {
    Bitmap src = loadStencil(...);
    Bitmap dst = new Bitmap(src.getWidth(), src.getHeight());
    Graphics dstG = Graphics.create(dst);
    dstG.setAlphaMask(src); // what would this call be?
    dstG.setColor(Color.RED);
    dstG.fillRect(...); // full sized flood fill in red through stencil.
    g.drawBitmap(dst); // draw new bitmap
}

How can I do this with the Blackberry APIs?