貌似是KIO1大神写的,aardio用来录制视频短片的
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=647;bottom=394) winform.add( button={cls="button";text="录制";left=516;top=81;right=608;bottom=116;z=2}; button2={cls="button";text="播放";left=520;top=194;right=612;bottom=229;z=3}; plus={cls="plus";left=10;top=11;right=503;bottom=384;z=1}; static={cls="static";text="录制质量";left=520;top=17;right=576;bottom=35;transparent=1;z=4}; static2={cls="static";text="录制状态";left=521;top=139;right=634;bottom=157;transparent=1;z=6}; static3={cls="static";text="播放状态";left=522;top=247;right=635;bottom=265;transparent=1;z=7}; trackbar2={cls="trackbar";left=512;top=40;right=611;bottom=70;max=100;min=30;z=5} ) /*}}*/ winform.button2.oncommand = function(id,event){ play() } winform.button.oncommand = function(id,event){ if(owner.text = "录制"){ owner.text = "停止" thrdHandle,thrdId = thread.create(record,{winform.trackbar2.pos;winform.hwnd}) }else { ::PostThreadMessage(thrdId,0x12/*_WM_QUIT*/,0,0) owner.text = "录制" } } winform.show() import console play = function(){ import crypt.bin import aPLib var ap = aPLib() var date = string.load("/123.dat") var tab = string.splitEx(date,"\|y") for(i=1;#tab-1;1){ winform.plus.setBackground( ap.safeDepack( crypt.bin.decodeBase64(tab[i]))) winform.static3.text = "已播放"+i+"帧" win.delay(100) } winform.static3.text = "播放完毕" } winform.plus.setBackground("\res\3.png") winform.trackbar2.setFrequency(10) //console.open() winform.showrecord = function(ci){ winform.static2.text = "已录制"+ci+"帧" } record = function(...){ import win import soImage import crypt.bin import aPLib import mouse var ctab = ... var zl = ctab[1] var whwnd = ctab[2] var width,height = win.getScreen() var sm = soImage() var sm2 = soImage() sm.init(,,,"*.jpg") sm2.load("\res\1.png") var ap = aPLib() var mx,my var tmpdate = io.open("/123.dat","w+") var i = 1 while(win.delay(100)){ sm.capture(,0,0,width,height) sm.setJpegQuality(zl) mx,my = mouse.getPos() sm.mix(sm2,mx,my,6/*_MIX_SCREEN*/) datetmp = crypt.bin.encodeBase64(ap.safePack( sm.getBytes("*.jpg")))+"|y" tmpdate.seek("end") tmpdate.write(datetmp) thread.callWnd(whwnd,"showrecord",i) i++ } sm.delete() sm2.delete() tmpdate.close() } win.loopMessage();
发表评论