<p>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.</p>

[{'answer_id': 63085, 'author': 'Phil Wright', 'author_id': 6276, 'author_profile': 'https://Stackoverflow.com/users/6276', 'pm_score': 0, 'selected': False, 'text': '<p>Have you tried drawing a white rectangle to initialize the image before you call the DrawImage method?</p>\n'}, {'answer_id': 63371, 'author': 'solsberg2', 'author_id': 7040, 'author_profile': 'https://Stackoverflow.com/users/7040', 'pm_score': 0, 'selected': False, 'text': '<p>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.</p>\n'}, {'answer_id': 236901, 'author': 'codeguru', 'author_id': 31476, 'author_profile': 'https://Stackoverflow.com/users/31476', 'pm_score': 1, 'selected': False, 'text': "<p>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.</p>\n"}, {'answer_id': 9164488, 'author': 'Coder_Dan', 'author_id': 449295, 'author_profile': 'https://Stackoverflow.com/users/449295', 'pm_score': 0, 'selected': False, 'text': "<p>Thanks for asking this question because I was just thinking of perhaps trying to use GDIplus to see whether it could get me around the problems I'm still facing getting patterned diamond shapes to print correctly.  Although nowadays alpha-blending does appear to work on most printers, there are still some that draw black corners on the diamonds.</p>\n\n<p>Aside from alpha-blending, I've also tried using diamond-shaped clip regions to surround the shape, but normally the printers that don't support alpha-blending don't seem to support polygonal clip-regions either.  I've tried copying from the printer-dc into a bitmap to prime it before drawing the diamond on top, hoping that this will allow me to put back (in the corners) what was there before.  This doesn't work either because it appears that the problem boils down to the fact that the printer driver doesn't actually know what is being printed on what part of the page.</p>\n\n<p>In my case, my next plan is to try using a large bitmap brush for drawing the diamond fill directly to the printer hdc.  I suspect there's a moderate chance that this too will fail for certain printers.  It sounds like it may not be an option for what you were doing.</p>\n"}]
['https://Stackoverflow.com/questions/62663', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7040/']