You are not logged in.
Pages: 1
Hello,
I would love to use the great PDF creating component as I create EMF files in my application and need to convert them into PDF.
Unfortunately, when I paint a TWicImage on my MetaFileCanvas and want to convert it, is uses the EMR_ALPHABLEND call which is not yet implemented.
Any idea how to fix this?
I already tried to implement it on my own - but the image does not find its way into the PDF ...
Thanks a lot!
Offline
EMR_ALPHABLEND was not implemented because there is no direct/easy way of handling transparency with PDF commands.
The usual trick is to pre-render the bitmap before adding it to the PDF.
Online
Hello,
thanks for the reply.
I managed to get it working on my side with the following code:
      EMR_ALPHABLEND:
        begin
          ARect := PEMRAlphaBlend(R)^.rclBounds;
          with PEMRAlphaBlend(R)^ do // only handle RGB bitmaps (no palette)
            if (offBmiSrc <> 0) and
               (offBitsSrc <> 0) then
            begin
              E.DrawBitmap (xSrc, ySrc, cxSrc, cySrc, xDest, yDest,
                cxDest, cyDest, iUsageSrc, pointer(PtrUInt(R) + offBmiSrc),
                pointer(PtrUInt(R) + offBitsSrc), @PEMRAlphaBlend(R)^.rclBounds,
                @PEMRAlphaBlend(R)^.xformSrc, SRCCOPY, PEMRAlphaBlend(R)^.dwRop);
            end
            else
              case PEMRBitBlt(R)^.dwRop of // we only handle PATCOPY = fillrect
                PATCOPY:
                  with PEMRBitBlt(R)^ do
                    E.FillRectangle(Rect(xDest, yDest,
                      xDest + cxDest, yDest + cyDest), true);
              end;
        end;In difference to the previous code, the parameters of the call "DrawBitmap" were changed.
Now the image is correctly shown in the created PDF :-).
Offline
Online
Pages: 1