Mega Code Archive

 
Categories / Delphi / Examples
 

Transblt

Subject: Re: Delphi: Transblt In article <bseeley.1.2FB90367@mendel.usu.edu>, bseeley@mendel.usu.edu (Brent Seeley) wrote: >Does anyone have an example of doing a transparent bitblt in Delphi, or >Borland Pascal for windows. I am translating a Visual Basic program which >requires it. Any help will be very appreciated. > >Bseeley@mendel.usu.edu Try this: with Canvas do begin CopyMode := cmSrcAnd; Draw(0, 0, FBitmask); CopyMode := cmSrcPaint; Draw(0, 0, FBitmap); end; FBitmask contains the images with all "transparent" pixels set to white and all opaque pixels set to black. FBitmap contains the image with all "transparent" pixels set to black. The mask acts as a sort of cookie-cutter to cut a whole in the underlying image. The bitmap is then OR'ed in, leaving the underlying image intact where the bitmap has black pixels.