我试图通过删除图像的底部像素线并在顶部添加一条新线来模拟声纳显示来构建模拟声纳瀑布显示。这导致LC存储器每秒扩展3meg。卡中的常规瀑布是:
on waterfall
set lockScreen to true
put "plot" into pImage
put 400 into pWidth
put 200 into pHeight
set the height of image pImage to pHeight
set the width of image pImage to pWidth
put the imageData of image pImage into iData
delete char -1600 to -1 of iData
put 1 into y
put "" into nData
repeat with x = 1 to pWidth
put random (10) into gry
put gry into r
put random (255) into g
put gry into b
put numToChar(255) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 1 of nData
put numToChar(r) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 2 of nData
put numToChar(g) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 3 of nData
put numToChar(b) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 4 of nData
end repeat
put nData before iData
set the imageData of image pImage to iData
set the rect of image pImage to the rect of graphic "BlackBack"
put "" into iData
put "" into nData
if the hilited of button "WaterFallon" is true then send waterFall to this card in .05 seconds
end waterFall
######## a checkbox button starts the display with this code:
on mouseUp
if the hilited of me is true then
put "BlackBack" into pGraphic
if there is a graphic pGraphic then delete graphic pGraphic
create graphic pGraphic
set the height of graphic pGraphic to 200
set the width of graphic pGraphic to 400
set the opaque of graphic pGraphic to true
set the backgroundColor of graphic pGraphic to black
set the topLeft of graphic pGraphic to 0,0
put "plot" into pImage
if there is an image pImage then delete image pImage
create image pImage
send waterFall to this card
end if
end mouseUp
答案 0 :(得分:0)
在重复循环结束时,在end repeat
:
wait 0 millisecs with messages
这为LiveCode提供了一点时间来更新GUI并丢弃旧版本的屏幕。