“范例->标准库->mouse->鼠标画线”
快手v0.54.2支持
//鼠标画渐开线
import mouse.draw;
import key;
import win.gdi;
SetPixel := ::Gdi32.api("SetPixel","int(int hdc,int x,int y,int crColor)")
//自定义此函数,每移动到一个点,画线函数会自动调用此函数
//mouse.draw库所有函数遵守约定:返回值为true表示继续,返回false表示停止画线
mouse.draw.move = function(x,y){
hdc = ::GetDC(0)
SetPixel(hdc ,x,y,255 )
::ReleaseDC(0,hdc);
if(key.getState("ESC"))
return false; //按ESC键退出;
mouse.move(x,y,true)
sleep(1)
return true;
}
//画直线
mouse.draw.line(23,100,23,300);
//画矩形
mouse.draw.rect(23,32,200,100);
// 画正弦曲线
mouse.draw.sin()
// 画渐开线
mouse.draw.involute();
// 画方形仿渐开线,步进为5,中间忽略的正方形边长为50
mouse.draw.rect_inv(5,50);
//这是真正的渐开线,第三个参数指定基圆的半径
mouse.draw.involute2(1024/2,768/2,0.1,10);
阅读(1422) | 评论(0) | 转发(1) |