How to Dynamically drawing a transparent image ?



How to Dynamically drawing a transparent image ?..

Answer / Avneet Kumar Gill

To draw a transparent image dynamically in Delphi, you can use the TBitmap and AlphaBlend functions. Here's an example:nn```delphinprocedure DrawTransparentImage(Canvas: TCanvas; const Bitmap: TBitmap; const Alpha: Byte);nvarn SrcRect, DestRect: TRect;nbeginn // Get the size of the bitmap and set source and destination rectanglesnn SrcRect.Left := 0;n SrcRect.Top := 0;n SrcRect.Right := Bitmap.Width;n SrcRect.Bottom := Bitmap.Height;nn DestRect.Left := 0;n DestRect.Top := 0;n DestRect.Right := Canvas.Width;n DestRect.Bottom := Canvas.Height;nn // Draw the bitmap with alpha blendingn AlphaBlend(Canvas.Handle, DestRect.Left, DestRect.Top, SrcRect.Left, SrcRect.Top, Bitmap.Handle, SrcRect.Left, SrcRect.Top, SrcRect.Width, SrcRect.Height, RGB(255, 255, 255), Alpha);nend;n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Delphi Interview Questions

How to add system menu items to a form ?

1 Answers  


How to Set custom tabstops in a ListBox?

1 Answers  


How to Allot CPU time ?

1 Answers  


How to assign a file variable in a Record?

1 Answers  


How to make the TDateTimePicker display blank?

1 Answers  


How to Determine if Delphi Running?

1 Answers  


How to get the coding for : Well-ordered numbers

0 Answers  


How to Write a raw string of data to the printer?

1 Answers  


How to Disable system menu in code?

1 Answers  


what are the Steps to uninstall and reinstall Delphi 6 ?

1 Answers  


How to Align maximized forms?

1 Answers  


what are the Versions of DB2 supported by BDE 5.10 ?

1 Answers  


Categories