The basic technique is as follows.
// create an empty (alpha 0) BitmapData size iW * iH
var data:BitmapData = new BitmapData(iW, iH, false, 0);
// make a shape for drawing
var shape:Shape = new Shape();
// get the Shape's Graphics
var g:Graphics = shape.graphics;
// draw something
g.moveTo(iW / 2, 0);
g.lineTo(iW / 2, 0);// rasterise: draw the Shape to the BitmapData
The lines beginning g. are all drawing commands, with the g dereferenced to make the code more compact (and negligibly more efficient). For illustration this is a very simple example but almost anything can be used, including effects. Filters can be added to the Shape before it is drawn to e.g. smooth the drawing's edges.