tags:

views:

1291

answers:

4

Does anybody have any pointers on how to successfully draw a bitmap that has an alpha channel using Graphics::DrawImage() when the Graphics context is created based on a printer HDC? The printer drivers don't generally support alpha blending - so is there an alternative to rendering everything to an offscreen bitmap and just sending that to the printer. This is often not feasible, especially for high res printing to large format printers.

A: 

Have you tried drawing a white rectangle to initialize the image before you call the DrawImage method?

Phil Wright
A: 

The whole point is that I need the line-drawn graphics behind the image to be visible. I did try filling the rectangle first the with RGBA color of (255, 255, 255, 0) but this does not help. Pixels with an alpha value of zero do get printed as fully transparent but partially transparent pixels are drawn fully opaque.

solsberg2
+1  A: 

What kind of printer is that? Regular printers don't print white. Create in-memory image and 'flatten' it (remove alpha channel) and then print the result.

codeguru
A: 

I thought it was ARGB. Have you tried (0, 255, 255, 255)?

Cedrik