Recent

Author Topic: Clipboard transparent bitmap  (Read 3377 times)

benohb

  • Full Member
  • ***
  • Posts: 181
Clipboard transparent bitmap
« on: March 04, 2014, 09:59:35 am »
Code: [Select]
Load from clipboard
uses
  Clipbrd, LCLIntf, LCLType, ...;
 
procedure LoadBitmapFromClipboard(Bitmap: TBitmap);
begin
  if Clipboard.HasFormat(PredefinedClipboardFormat(pcfDelphiBitmap)) then
    Bitmap.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfDelphiBitmap));
  if Clipboard.HasFormat(PredefinedClipboardFormat(pcfBitmap)) then
    Bitmap.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfBitmap));
end;
Save to clipboard
uses
  Clipbrd, ...;
 
procedure SaveBitmapToClipboard(Bitmap: TBitmap);
begin
  Clipboard.Assign(Bitmap);
end;

This tutorial is not work with transparent (Transparency = black)  :'(
Any ideas

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: Clipboard transparent bitmap
« Reply #1 on: March 04, 2014, 10:10:14 am »
use 32bit bitmaps with alpha channel set to transparent perhaps?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

benohb

  • Full Member
  • ***
  • Posts: 181
Re: Clipboard transparent bitmap
« Reply #2 on: March 05, 2014, 10:48:18 pm »
Quote
use 32bit bitmaps with alpha channel set to transparent perhaps?

NO and YES  :-\ ...black areas and transparent areas both become transparent

Why bits of pixel  is 24bit ...!
I use "canvas.line(0,0,0,0)" to  convert it to 32bit...Is this a normal thing

+The alpha byte Always 0
« Last Edit: March 05, 2014, 10:50:41 pm by benohb »