怎样实现Photoshop里的套索功能(任意区域的选择)(100分)

  • 主题发起人 主题发起人 mrb
  • 开始时间 开始时间
M

mrb

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样实现Photoshop里的套索(任意区域的选择)功能,以及对一张图像中的长度差不多的图形进行区分选择出来。
 
我帮你找的源码 蚂蚁线形的
procedure TFormMarchingAnts.ImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
X := X + (Sender AS TImage).Left;
Y := Y + (Sender AS TImage).Top;

RemoveTheRect; // Erase any existing rectangle
X1 := X;
Y1 := Y;

X2 := X;
Y2 := Y;

// Force mouse movement to stay within TImage
RestrictCursorToDrawingArea( (Sender AS TImage) )
end;



procedure TFormMarchingAnts.ImageMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ssLeft in Shift
then begin
X := X + (Sender AS TImage).Left;
Y := Y + (Sender AS TImage).top;

RemoveTheRect; // Erase any existing rectangle
X2 := X; Y2 := Y; // Save the new corner where the mouse is
DrawTheRect; // Draw the Rect now... don't wait for the timer!
end;
end;


procedure TFormMarchingAnts.ImageMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
RemoveCursorRestrictions
end;
 
请高手指点。
 
To schheng:
你的源代码是可以任意形状的吗?
 
请高手指点!
救救小弟哦。
 
去年的程序员合订本里就专门说有这个,你去找来看看吧,很详细的
 
谢谢你:app2001
有没有例子看。
网上
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部