Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have transparent GIF's which I need to print.

I am using TransparentBlt.

It works OK with print preview, but when I print to printer or to Adobe, the transparent images are not printed.

I tried StretchBlt and BitBlt also, but my transparency is lost.

Even Aplhablend is not working.

Please suggest some alternate methods to do so.

Updated 29-Sep-14 4:02am

1 solution

See the final paragraph of the Remarks section in[^].
Share this answer
Rajeev Raina 29-Sep-14 9:14am    
Dear Richard

Thanks for your reply. Do you have a working example of the same? As advised I looked at the final paragraph. What I understand is that I need to use
1. GetDIBits and
2. SetDIBits

I tried it but seems I have not fully understood its use.

I am pasting (relevant) lines of my code and please see if you can add these two functions to my code at the approporiate place so that I can make it work.

//------ CDC& dc -- Passed here into my function

dc.SetBrushOrg(0, 0);

/// CImage m_Image ---> Declared at some other place

LONG nTransparent = m_Image.GetTransparentColor();
HDC hDC = m_Image.GetDC();
::GetDIBColorTable(hDC, nTransparent, 1, &rgb);
if (nTransparent != -1)
void *ptr = m_Image.GetBits();
BOOL bRes = ::TransparentBlt(dc, xDest, yDest, nDestWidth, nDestHeight, hDC, xSrc, ySrc, nSrcWidth, nSrcHeight,RGB(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue));
TRACE("Result = %d\n", bRes);
::StretchBlt(dc, xDest, yDest, nDestWidth, nDestHeight, hDC, xSrc, ySrc, nSrcWidth, nSrcHeight, DSTINVERT);

You help will be highly appreciated.
Richard MacCutchan 29-Sep-14 11:21am    
Sorry but I have not tried this myself, so I have no sample code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900