I'n using an image class named "pcMemDC". The variable is named "m_cMemDC".
It holds an image with transparent pixels.
I want to remove the transparency and make the transparent pixels white and save this opaque image as a PNG.
To do that, I use a LaVolpe's great c32bppDIB class, named "m_c32DIBBackground".
However, the resulting image has a black background instead of white.Code:With m_c32DIBBackground .ManageOwnDC = True .InitializeDIB m_cMemDC.Width, m_cMemDC.Height 'I initialize it with the size of the source file .Alpha = AlphaNone 'I don't want alpha .CreateWhiteCanvas 'I create a white canvas .MakeOpaque 'And again make sure it is opaque m_cMemDC.Draw .hdc 'Now I draw the alpha image to the white opaque canvas. .SaveToFile_PNG "d:\test1.png", False 'And save it out End With
I don't see where it goes wrong.
I even already suspected the problem in the other class, but I don't know:
Its "Draw" sub looks like this:
What am I doing wrong?Code:Public Sub Draw( _ ByVal uDstDc As Long, _ Optional ByVal xSrc As Long = 0, Optional ByVal ySrc As Long = 0, _ Optional ByVal WidthSrc As Long = 0, Optional ByVal HeightSrc As Long = 0, _ Optional ByVal xDst As Long = 0, Optional ByVal yDst As Long = 0 _ ) If WidthSrc <= 0 Then WidthSrc = m_lWidth If HeightSrc <= 0 Then HeightSrc = m_lHeight Dim lROP& If Not m_bNoMirror Then lROP = vbSrcCopy Else lROP = (vbSrcCopy Or NOMIRRORBITMAP) End If BitBlt uDstDc, xDst, yDst, WidthSrc, HeightSrc, m_hDC, xSrc, ySrc, lROP End Sub




Reply With Quote
