import console;
import godking.paint
var p = godking.paint.fromBitmap("\电影.png")
var picw,pich = p.width,p.height;
var rects = p.splitRect(15,10,0,0,0,0)
if #rects {
var ew = ..math.min(rects[1].width()/5,rects[1].height()/5);
for(i=1;#rects;1){
var pic = godking.paint(picw,pich);
var path = pic.path(1/*0:交叉填充 1:全填充*/);
path.addRect(rects[i]);
if rects[i].top>0 {
path.addEllipse( (rects[i].left+rects[i].right)/2-ew/*x*/,rects[i].top-ew/*y*/,ew*2/*宽*/,ew*2/*高*/);
}
if rects[i].right<picw {
path.addEllipse( rects[i].right-ew/*x*/,(rects[i].top+rects[i].bottom)/2-ew/*y*/,ew*2/*宽*/,ew*2/*高*/);
}
pic.clip.set(path);
pic.drawImage(0 /*x1*/,0/*y1*/,/*x2*/,/*y2*/,p.bitmap/*图片*/,/*透明度或图片属性*/,/*保持比例*/);
var bounds = path.getBounds();
path.delete();
var path = pic.path(1/*0:交叉填充 1:全填充*/);
if rects[i].bottom<pich {
path.addEllipse( (rects[i].left+rects[i].right)/2-ew/*x*/,rects[i].bottom-ew/*y*/,ew*2/*宽*/,ew*2/*高*/);
}
if rects[i].left>0 {
path.addEllipse( rects[i].left-ew/*x*/,(rects[i].top+rects[i].bottom)/2-ew/*y*/,ew*2/*宽*/,ew*2/*高*/);
}
pic.clip.set(path);
pic.clear();
path.delete();
//保存为小图片
var buf = pic.getBuffer("*.png",100/*JPG质量*/,bounds/*截取区域RECT或RECTF*/,/*宽度*/,/*高度*/,/*按比例*/,/*参数*/);
string.save("\图片_"++i++".png",buf);
//保存为大图片
//pic.saveToFlie("C\图片_"++i++".png" /*文件名*/,100/*JPG质量*/)
pic.close();
}
}
p.close();
console.pause();