Printing BITMAP with transparent background

This forum is for eXpress++ general support.
Post Reply
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Printing BITMAP with transparent background

#1 Post by skiman »

Hi,

When printing a bitmap with transparent background sometimes this will be just a black rectangle.

See also:
https://ilx.alaska-software.com/index.p ... areas.133/

This can be implemented in Express in _dcprc.prg.

Add the function at the bottom:

Code: Select all

FUNCTION GetPrintBitmap( oBmp )
 LOCAL oRet
 LOCAL oPS

   IF .NOT. oBmp:hasAlphaChannel .AND. oBmp:transparentClr == GRA_CLR_INVALID
      RETURN oBmp
   ENDIF

   oRet := XbpBitmap():new():create()
   oRet:make( obmp:xSize, oBmp:ySize )
 
   oPS := XbpPresSpace():new():create()
   oRet:presSpace( oPS )

   GraSetColor( oPS, GRA_CLR_WHITE, GRA_CLR_WHITE )
   GraBox( oPS, {0,0}, {obmp:xSize-1,oBmp:ySize-1}, GRA_FILL )
   oBmp:draw( oPS, {0,0,oBmp:xSize-1,oBmp:ySize-1} )
   oPS:destroy()
RETURN oRet
On about line 1348 modify the code to:

Code: Select all

  BEGIN SEQUENCE
  oBitmap := GetPrintBitmap( oBitmap )     // ADD THIS LINE
  oBitmap:draw( ::oPS, aTarget, aSource, , nRasterOp )
  Sleep(1)
  END SEQUENCE
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Printing BITMAP with transparent background

#2 Post by rdonnay »

Chris -

Thanks for that contribution. I will add it to the next build.
The eXpress train is coming - and it has more cars.

Post Reply