Author |
Topic  |
|
adisonx

Thailand
29 Posts |
Posted - Mar 22 2016 : 02:29:04
|
I want to draw the on pictures with mouse,but when move the mouse the line isn't continuous when compare with paint program.
Here is the sample from ImageEn Paint Demo.  Here is image from paint program.

Please give me some advice.Thank you. |
|
w2m
   
USA
1990 Posts |
Posted - Mar 22 2016 : 10:43:12
|
Drawing pixels (one pixel at a time) with ImageEn is quite fast but drawing ellipse or rectangles with a brush (more than 1 pixel with IECanvas.Ellipse or IECanvas.Rectangle) is quite slow. Brush painting with ImaqeEn produces "jagged" drawing result when the mouse is moved quicker than the drawing methods can paint. I know of no way to increase the painting speed with ImageEn other than possibly drawing in a thread. My attempts to speed up brush drawing by using a thread with ImageEn has not been successful to date.
The only alternative you may have is to use third party drawing tools some of which are faster than the ImageEn canvas drawing. The only third party tools that I have tried is Paint Engine by NeWest Software and RKBrush by Roy M Klever. The Paint Engine (http://www.nwscomps.com/pe.html) is much faster than ImageEn and allows the drawing that you are looking for. I find Paint Engine quite good, but somewhat difficult to use. The Paint Engine ships with a demo.
The drawing tool that I use for brush drawing when I need very fast brush with ImageEn is RKBrush by Roy M Klever (http://rmklever.com/). The copy of RKBrush component that I have is quite old, but works well even with the lastest version of Delphi and ImageEn.
Unfortunately RkBrush is not listed on Roy's website that I can find, but you may contact him here http://rmklever.com/?page_id=71. RkBrush has a demo drawing demo.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
wesleybobato
  
Brazil
367 Posts |
Posted - Mar 22 2016 : 11:25:41
|
Hi William
Please Share with us RKBrush component
To be able to test in Our Projects Thank you |
 |
|
w2m
   
USA
1990 Posts |
Posted - Mar 22 2016 : 11:27:08
|
Wesley,
I can not share my copy. Please contact Roy directly.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
xequte
    
38944 Posts |
Posted - Mar 22 2016 : 13:25:50
|
Hi
The other possibility, is simply to remember the last mouse position and instead of painting a single pixel, draw from the last position to the current position (if mouse was down at both times). This will allow drawing of continuous lines.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
xequte
    
38944 Posts |
Posted - Mar 22 2016 : 13:36:54
|
Here is a version of painter where I draw lines from the last point to the current point rather than paint pixels:

Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
w2m
   
USA
1990 Posts |
Posted - Mar 22 2016 : 14:01:11
|
Nigel,
Nice work... Please post your OnMouseDown and OnMouseMove event code for the revised ImageEn Painter demo. I have mine working and I added a pen color to the draw tab so the color and width can be controlled easier. We should probably post this revised demo to show users how to do "faster brush like" drawing. I also added a brush button on the upper draw tab along with a backbuffer event that draws an ellipse to show the "brush ellipse" in OnMouseMove.
I guess MoveTo and LineTo is just faster than drawing to an IECnavas?
Thanks
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
xequte
    
38944 Posts |
Posted - Mar 22 2016 : 15:16:16
|
Hi Bill
I only made a quick change to test the theory, so it is not well tested (particularly the alpha code, which I did not test at all).
procedure TFrmMain.ImageEnView1MouseDown ( Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer );
begin
...
if ( PageControl2.ActivePage = DrawTab2 ) and PaintPoint.Down then
begin
// Paint Point
with ImageENView1 do
begin
Proc.SaveUndo ( ieuImage );
X := XScr2Bmp ( X );
Y := YScr2Bmp ( Y );
fLastPointX := X;
fLastPointY := Y;
Transparency := ( ( StrToInt ( Opacity1.Text ) * 255 ) div 100 );
IEBitmap.Canvas.Pixels [ X, Y ] := PaintColor.Color;
IEBitmap.Alpha [ X, Y ] := Transparency;
Update;
end;
UpdateUndoMenu;
end
...
end;
procedure TFrmMain.ImageEnView1MouseMove ( Sender: TObject; Shift: TShiftState; X, Y: Integer );
begin
if ( PageControl2.ActivePage = DrawTab2 ) and PaintPoint.Down and ImageEnView1.MouseCapture then
begin
// Paint Point
with ImageENView1 do
begin
X := XScr2Bmp ( X );
Y := YScr2Bmp ( Y );
Transparency := ( ( StrToInt ( Opacity1.Text ) * 255 ) div 100 );
if chkContinuous.checked then
begin
IEBitmap.Canvas.Pen.Color := PaintColor.Color;
IEBitmap.Canvas.MoveTo( X, Y ) ;
IEBitmap.Canvas.LineTo( fLastPointX, fLastPointY );
// HAVE NOT TESTED THIS ALPHA CODE
IEBitmap.AlphaChannel.CanvasCurrentAlpha := Transparency;
IEBitmap.AlphaChannel.Canvas.MoveTo( X, Y ) ;
IEBitmap.AlphaChannel.Canvas.LineTo( fLastPointX, fLastPointY );
end
else
begin
IEBitmap.Canvas.Pixels [ X, Y ] := PaintColor.Color;
IEBitmap.Alpha [ X, Y ] := Transparency;
end;
fLastPointX := X;
fLastPointY := Y;
Update;
end;
end
...
end;
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
xequte
    
38944 Posts |
Posted - Mar 22 2016 : 15:21:24
|
Hi Bill
You could use IECanvas instead. It may improve performance.
Also, there have been some improvements to Alpha support since the original Painter demo, so I am using CanvasCurrentAlpha in the code above.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
w2m
   
USA
1990 Posts |
|
xequte
    
38944 Posts |
|
w2m
   
USA
1990 Posts |
Posted - Mar 23 2016 : 14:52:22
|
I just sent you two demos. The first uses IEBitmap and Alphachannel which works well including drawing alpha values. The second uses IEGDIPlus canvas but it has several problems...
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
xequte
    
38944 Posts |
Posted - Mar 25 2016 : 14:50:21
|
Hi Bill
I don't seem to have received them. If they include exe files please use my nigel at xequte.biz address.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
w2m
   
USA
1990 Posts |
Posted - Mar 25 2016 : 15:14:29
|
Plus... I sent you several updates... anyway I'll post them here.
Brush Paint With IEBitmap Canvas And Alpha Channel This one works quite well and is fast and is biased on your IEBitmap.Canvas and IEBitmap.Alpha channel code. attach/w2m/2016325151555_PaintBrush.zip 65.86 KB
Brush Paint With GDIPLus This one is producing poor results... Possibly GDIPlus is just to slow... or I messed it up. attach/w2m/201632515227_PaintBrushGDIPlus.zip 107.56 KB
Brush Paint With IEBitmap IECanvas And IEBitmap Alpha Channel This one is similar to the IEBitmap.Canvas project except I changed from IEBitmap.Canvas to IEBitmap.IECanvas. Unfortunately it does not draw at all. attach/w2m/2016325153325_PaintBrush2.zip 108.7 KB
Should IECanvasCurrentAlpha be added? IEBitmap.AlphaChannel.IECanvasCurrentAlpha := iTransparency which would be similar to IEBitmap.AlphaChannel.CanvasCurrentAlpha := iTransparency?
I just sent you an email about Twain support... Please let me know if you get it. I originally sent it yesterday.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
xequte
    
38944 Posts |
Posted - Mar 27 2016 : 21:46:03
|
Hi Bill
Didn't receive the Twain email (your last email was October 2015). Did it bounce back to you or is it something at my end?
The Brush Paint demo works well, but I'm not sure I should replace the ImageEnPainter demo in the ImageEn distribution.
I'm not sure that using IECanvas, rather than TCanvas for transparency work would add much benefit. Let me discuss it with Fabrizio.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
w2m
   
USA
1990 Posts |
Posted - Mar 28 2016 : 07:57:27
|
No bounce back... about 3 messages sent in last several days to .biz. I just sent you 2 messages.... one to .biz and one to .com.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
xequte
    
38944 Posts |
Posted - Mar 28 2016 : 20:25:09
|
Hi Bill
Sorry, looks like we're having some issues with the biz address. I've received the messages now and will respond shortly.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
|
Topic  |
|