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
 Create a Clone Brush

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
John@Field Posted - Mar 10 2014 : 13:55:57
I would like to copy one part of an image to another part of the image
in the same way that it is done with the clone brush in PaintshopPro.

Any suggestions would be much appreciated.

JWA
7   L A T E S T    R E P L I E S    (Newest First)
John@Field Posted - Mar 14 2014 : 14:03:51
Thanks again spectric,

I am not sure how to copy one selection to another Yet as I am new to
ImageEn.

The method I am using is similar, I think, to the low level byte
routines you mention.

I am selecting an area using a right mouse click then move the
mouse to where I want to place the copy. Then pressing the left
mouse button, pick up one area and place it in another several
pixels at a time. This is continues while I drag the mouse over
the new area.

The pixel copying is done using the following Function.

iRad = Radius
S & P Select & Place Points
Image1 the image to be cloned.

Call the function.

ImageEnView1 := CopySelection(1, Sel, Place, ImageEnView1);

function TCloneForm.CopySelection(iRad: Integer; S, P: TPoint;
Image1: TImageEnview): TImageEnview;
var
Rad, x, xx, yy, y : integer; { x is the column y is the row }
Horz, Vert : Integer;
ItemRad : Double;
begin
xx := iRad * 2; { The Radius x 2}
yy := iRad * 2;
Rad := iRad;

for y := 0 to yy do
begin
for x := 0 to xx do
begin
{This Calculates the radius to Keep the Pixels within the circle}
Horz := sqr(Rad - X);
Vert := sqr(Rad - Y);
ItemRad := Sqrt(Horz + Vert); { is it in the circle }
{ PixColour : array[0..100] of array[0..100] of TColor; }
{ If the pixel is within the radius then copy it }
if (ItemRad <= Rad) then
begin
PixColour[y, x] := Image1.Bitmap.Canvas.Pixels[S.X + x - Rad, S.Y + y - Rad];
Image1.Bitmap.canvas.pixels[P.X + x - Rad, P.Y + y - Rad] := PixColour[y, x];
end;
end;
end;

Result := Image1;
end;


JWA
spetric Posted - Mar 13 2014 : 16:06:02
That's a good idea to use selection as brush tip and then move selection across the image(s).

Are you using two identical selections on both images?
John@Field Posted - Mar 13 2014 : 15:49:27
Thanks spectric

I have managed to clone an area using a technique similar to the one you suggested. I am now working on the feathering.

JWA
spetric Posted - Mar 11 2014 : 07:32:38
The best way to do this task is to determine region of interest (ROI/bounding rectangle) over cloning image with the same size as your cloning brush. Then, while you're moving your mouse over some image (we will call it Image1), you need to copy region of interest from cloning image (Image2) to to Image1 using gray-scale mask that represents your brush tip.

Actually, you have two mouse positions: real on Image1 and calculated (virtual) on Image2.

It can be also done using off-screen bitmap with same size as your cloning brush tip.

Also, you need to take care when position of your brush tip exceeds Image2 width/height (wrapping may be performed).

I do this task using low-level byte access routines, but it can be achieved using ImageEn methods.
John@Field Posted - Mar 11 2014 : 03:14:30
Thanks I will look into it.

JWA
w2m Posted - Mar 10 2014 : 15:20:15
http://www.nwscomps.com/pe.html

William Miller
John@Field Posted - Mar 10 2014 : 13:58:22
I would also like to add a feather effect to the result

JWA