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
 Make area inside selection transparent?

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
PeterPanino Posted - May 28 2013 : 07:33:19
Hi!

Is there a quick method to make all pixels inside a selection transparent?
3   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - May 28 2013 : 12:17:09
Correct!

William Miller
PeterPanino Posted - May 28 2013 : 11:57:35
Hi William!

Thanks for the code! But just now I have discovered that a simple ImageEnVIew1.Proc.SetTransparentColors also makes the selection area transparent!

EDIT: Oops, I think I am wrong! ImageEnVIew1.Proc.SetTransparentColors only makes a specific color (or a range of colors) transparent, while your code makes all colors inside the selection transparent. Am I right?
w2m Posted - May 28 2013 : 08:51:56
procedure TForm1.MakeTransparent1Click(Sender: TObject);
{ Make the area inside of the selection transparent. }
begin
  if ImageEnView1.Selected then
  begin
    Screen.Cursor := crHourGlass;
    try
      ImageEnView1.Proc.SaveUndoCaptioned('Make Selection Transparent ' +
        IntToStr(ImageEnView1.Proc.UndoCount));
      Undo1.Hint := 'Make Selection Transparent ' + IntToStr(ImageEnView1.Proc.UndoCount);
      ImageEnView1.EnableAlphaChannel := True;
      ImageEnView1.IO.Params.BitsPerSample := 8;
      ImageEnView1.IO.Params.SamplesPerPixel := 4;
      ImageEnVIew1.SetSelectedAreaAlpha(0);
      Undo1.Enabled := ImageEnView1.Proc.CanUndo;
      ImageEnView1.Bitmap.Modified := True;
    finally
      Screen.Cursor := crDefault;
    end;
  end
  else
  begin
    MessageDlg('There is no selection.  Please make a selection and try again.', mtWarning, [mbOK],
      0);
  end;
end
;
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html