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
 how to create a smooth freehand draw

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
ted Posted - Feb 06 2017 : 10:12:53
Hi,

is it possible to create a smooth freehand draw in ImageEn?

Thanks in advance

Regards,
Ted
3   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Feb 10 2017 : 14:53:56
if you use this code the brush will be drawn as fast as possible without skipping:

Global Var
 ALastX: integer;
 ALastY: integer;
var
  iX: Integer;
  iY: Integer;
  iTransparency: Integer;
  iPenColor: TColor;
  iPenWidth: Integer;
begin
  iX := ImageEnView1.Layers[ImageEnView1.LayersCurrent].ConvXScr2Bmp(X);
  iY := ImageEnView1.Layers[ImageEnView1.LayersCurrent].ConvYScr2Bmp(Y);
  if (PaintBrush1.Down) and (ImageEnView1.MouseCapture) then
    begin
      { Paint Brush }
      with ImageEnView1 do
      begin
        iPenWidth := StrToIntDef(PenSize1.Text, 20);
        iPenColor := PenColor.Color;
        iTransparency := ieOpacityToAlpha(StrToIntDef(PenOpacity1.Text, 100));
        IEBitmap.Canvas.Pen.Width := iPenWidth;
        IEBitmap.Canvas.Pen.Color := iPenColor;
        IEBitmap.Canvas.MoveTo(iX, iY);
        IEBitmap.Canvas.LineTo(ALastX, ALastY);
        IEBitmap.AlphaChannel.Canvas.Brush.Color := iPenColor or (iTransparency)
          or (iTransparency shl 8) or (iTransparency shl 16);
        IEBitmap.AlphaChannel.CanvasCurrentAlpha := iTransparency;
        IEBitmap.AlphaChannel.Canvas.Pen.Width := iPenWidth;
        IEBitmap.AlphaChannel.Canvas.MoveTo(iX, iY);
        IEBitmap.AlphaChannel.Canvas.LineTo(ALastX, ALastY);
        Update;
      end;
    end;
end;

Place the above code in the OnMouseDown and OnMouseMove events.
Then add this to OnMouseMove:

  iX := ImageEnView1.Layers[ImageEnView1.LayersCurrent].ConvXScr2Bmp(X);
  iY := ImageEnView1.Layers[ImageEnView1.LayersCurrent].ConvYScr2Bmp(Y);
  ALastX := iX;
  ALastY := iY;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
w2m Posted - Feb 09 2017 : 09:18:24
Also see this third party demo:
https://www.imageen.com/ieforum/attach/spetric/2016122217524_delphi_spe_demo.zip

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
xequte Posted - Feb 06 2017 : 22:51:59
Sure, please see:

https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=2578
https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=31

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com