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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to remove a part of the image using the erase
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

khorsandreza

Iran
26 Posts

Posted - Jun 24 2018 :  02:09:03  Show Profile  Reply
Hello friends
I use the following commands (I downloaded from this site) to remove part of the image, like erasing Photoshop. But the size of the pencil does not change. It stays at 1 pixel.
Please give me advice.
Sincerely, Reza



procedure TAlbumImageForm.ImageEnVect1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  iP1: TPoint;
  iTransparency: Integer;
  iRGB: TRGB;
  APX,APY,AStartX,AstartY:Integer;
  iColor: TColor;
  mx ,
  my ,
  lx ,
  ly :integer;
begin
  mx := X;
  my := Y;
  lx := X;
  ly := Y;
  APX := ImageEnVect1.Layers[ImageEnVect1.LayersCurrent].ConvXScr2Bmp(X);
  APY := ImageEnVect1.Layers[ImageEnVect1.LayersCurrent].ConvYScr2Bmp(Y);
  AStartX := ImageEnVect1.Layers[ImageEnVect1.LayersCurrent].ConvXScr2Bmp(X);
  AstartY := ImageEnVect1.Layers[ImageEnVect1.LayersCurrent].ConvYScr2Bmp(Y);
//  if (Erase1.Down) and (ImageEnVect1.MouseCapture) then
  if (Erase1.Down)  then
  begin
    { Paint Point Opacity as 0}
    with ImageEnVect1 do
     begin
       Proc.SaveUndoCaptioned('Erase ' + IntToStr(Proc.UndoCount + 1));
       iP1.X := Layers[LayersCurrent].ConvXScr2Bmp(X);
       iP1.Y := Layers[LayersCurrent].ConvYScr2Bmp(Y);
       HighlightedPixel := iP1;
       iTransparency := 0;
       IEBitmap.AlphaChannel.Canvas.Pen.Width := 30;
       IEBitmap.AlphaChannel.Canvas.Pen.Color := $02000000 or (iTransparency)
         or (iTransparency shl 8) or (iTransparency shl 16);
       IEBitmap.AlphaChannel.Canvas.Brush.Color := $02000000 or
         (iTransparency) or (iTransparency shl 8) or (iTransparency shl 16);
       IEBitmap.AlphaChannel.Canvas.Pixels
         [Layers[LayersCurrent].ConvXScr2Bmp(X),
         Layers[LayersCurrent].ConvYScr2Bmp(Y)] := ColorDialog1.Color;
       IEBitmap.Alpha[Layers[LayersCurrent].ConvXScr2Bmp(X),
         Layers[LayersCurrent].ConvYScr2Bmp(Y)] := iTransparency;
       Update;
       Bitmap.Modified := True;
     end;
   end;

w2m

USA
1990 Posts

Posted - Jun 24 2018 :  10:51:36  Show Profile  Reply
There are several demos that show how to do canvas drawing here:
attach/w2m/20153817538_GDIPlusImageMaker.zip
attach/w2m/2017420145919_PaintBrush.zip

Highlightedpixel can only be 1 pixel and highlightedpixel does not support an alpha channel.

Look at the canvas brush drawing demos listed above.


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38203 Posts

Posted - Jun 25 2018 :  18:13:22  Show Profile  Reply
Also, in 8.0.0 (ready shortly) there is a new eraser brush mode.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: