找區域面積和中心點
*獲取圖像
read_image (Image, 'fabrik')
*關閉窗口
dev_close_window ()
*打開窗口
dev_open_window (0, 0, 512, 512, 'black', WindowID)
*設置輸出字體,14號字,Courier字體,粗體
set_display_font (WindowID, 14, 'mono', 'true', 'false')
*設置輸出顏色
dev_set_colored (6)
*進行區域生長操作
regiongrowing (Image, Regions, 1, 1, 3, 200)
*顯示區域
dev_display (Regions)
*計算所有不相連區域的面積和中心點坐標
area_center (Regions, Area, Row, Column)
center:=|Area|
*獲取一個字符串的空間大小
* Ascent從基線到字符頂部的距離(上行高度)
* Descent從基線到字符底部的距離(下行高度)
get_string_extents (WindowID, 12345, Ascent, Descent, TxtWidth, TxtHeight)
*將面積計算結果以字符串形式顯示在窗口中
for I := 0 to center-1 by 1disp_message (WindowID, Area[I], 'image', Row[I] - TxtHeight / 2, Column[I] - TxtWidth / 2, 'white', 'false')
endfor
