Set the bitmap device to 32 bits per pixel, as at the default 24, the image has no alpha channel, and use a background colour with an alpha value below 255:
pDevice->properties()->putAt(OD_T("BitPerPixel"), OdRxVariantValue(OdUInt32(32)));
pDevice->setBackgroundColor(ODRGBA(255, 255, 255, 0));Then save the RasterImage device property to a .png file using RxRasterServices.
For a complete example, see Drawing/Examples/SimpleExportToRaster. There, add the BitPerPixel line and set bgColor to ODRGBA(255, 255, 255, 0) before pDevice->update().