ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Problem with alpha after clipboard exchange

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
BionicWave Posted - Jul 28 2011 : 09:41:00
When i paste an image via img.proc.selpastefromclip i have a problem with transparent pixels.
i want to overwrite all pixels in a square of 64x64 with the ones from the clipboard. For that to happen i have to clear all the pixels in the square before using the selpastefromclip-function.

I tried clearsel with clNone as background-color, but it doesnt work.
How do i make the square completely transparent?

thanks in advance
4   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Jul 29 2011 : 05:25:02
procedure TForm1.FormCreate( Sender: TObject );
begin
  ImageEnView1.EnableAlphaChannel := True;
  ImageEnView2.EnableAlphaChannel := True;
  ImageEnView1.IEBitmap.AlphaChannel.Location := ietbitmap;
  ImageEnView1.EnableAlphaChannel := True;
  ImageEnView1.IO.Params.Bmp_HandleTransparency := True;
  ImageEnView2.IEBitmap.AlphaChannel.Location := ietbitmap;
  ImageEnView2.EnableAlphaChannel := True;
  ImageEnView2.IO.Params.Bmp_HandleTransparency := True;
end;

procedure TForm1.Button1Click( Sender: TObject );
begin
  // paste to the clipboard
  ImageEnView1.Proc.SelCopyToClip;
  // if clipboard contains data valid for TImageEnProc
  if ImageEnView2.Proc.IsClipboardAvailable then
  begin
    // assuming X,Y = mouse coordinates, makes all colors the area transparent
    // tolerance specifies the maximum difference from the starting pixel
    ImageEnView2.Proc.CastAlpha( ImageEnView2.SelX1 + 1, ImageEnView2.SelY1 + 1, 0, 15 );
    // paste the contents of the Clipboard inside the ImageEnView2 selected area
    ImageEnView2.Proc.SelPasteFromClip( );
    ImageEnView2.Update;
  end;
end;


If this does not work are you positive that both images are 32-bit?
Is:
ImageEnView1.IO.Params.BitsPerSample = 8;
ImageEnView1.IO.Params.SamplesPerPixel = 4;
ImageEnView2.IO.Params.BitsPerSample = 8;
ImageEnView2.IO.Params.SamplesPerPixel = 4;


William Miller
BionicWave Posted - Jul 29 2011 : 05:06:00
I think i found it.
To delete the pixels i set the Alpha of all pixels in the current selection to Zero.
Seems to do the trick.
BionicWave Posted - Jul 29 2011 : 03:34:47
Im sorry, i tried the parameters, but nothing changed.
I think the problem is that i can not clear out the selected area of the file.

I need to erase the selected area with clear pixels.
Is there a way to do this with TImageEn?
w2m Posted - Jul 28 2011 : 13:27:58
When I paste to a 32-bit image with alphachannel it maintains the alpha channel.

Make sure that:
1. ImageENView.IEBitmap.AlphaChannel.Location := ietbitmap;
2. ImageENView.EnableAlphaChannel := True;
3. ImageENView.IO.Params.Bmp_HandleTransparency := True;

are set and you open an image that supports an alphachannel like png or a 32-bit bitmap. Images without an alphachannel will not have transparency.

If that does not work post the results and we can work on it.



William Miller