ImgUtil 函数和 colorAt

ImgUtil functions and colorAt

我该如何解决这个问题?

使用 ImgUtil 函数和 colorAt 创建函数 makePicture: string -> figure -> int -> int -> unit 这样名称 makePicture filename figure b h 创建一个名为 filename.png 的图像文件,其中包含宽度为 b 和高度为 h 的图形图像。 在没有颜色的点(参见 colorAt),颜色必须为灰色(由 RGB 值 (128,128,128) 定义)。 您可以使用此功能来测试您的任务。

let makePicture filename figur b h = let bmp =
//bmp = 位图 ImgUtil.init b h (fun (x,y) -> //x,y = 地图中的位置 let c = match colourAt (x,y) figur with | None -> (128,128,128) | Some c -> c in ImgUtil.fromRgb c) //c = canvas

let target = Filename + ".png" do ImgUtil.toPngFile target bmp do printfn "Wrote filbe: %s" target