diff --git a/main.nim b/main.nim index dd592d4..1683237 100644 --- a/main.nim +++ b/main.nim @@ -1,15 +1,14 @@ -import mandelbrot, colors +import mandelbrot, colors, nimBMP -echo mandelbrot.generateImage(800, 600, 150'f64, 32, 570)[0][0] +let img = mandelbrot.generateImage(800, 600, 150'f64, 32, 570) +var raw:seq[uint8] -import stb_image/write as stbiw +for y in img: + for x in y: + let rgb = x.extractRGB() + raw.add(rgb.r.uint8) + raw.add(rgb.g.uint8) + raw.add(rgb.b.uint8) -# Stuff some pixels -var data: seq[uint8] = @[] -data.add(0x00) -data.add(0x80) -data.add(0xFF) - -# save it (as monochrome) -stbiw.writeBMP("three.bmp", 3, 1, stbiw.Y, data) +saveBMP24("mandelbrot.bmp", raw, 800, 600) diff --git a/mandelbrot.bmp b/mandelbrot.bmp new file mode 100644 index 0000000..5ab43cb Binary files /dev/null and b/mandelbrot.bmp differ diff --git a/mandelbrot.nimble b/mandelbrot.nimble index a304274..9153001 100644 --- a/mandelbrot.nimble +++ b/mandelbrot.nimble @@ -11,3 +11,4 @@ bin = @["main"] requires "nim >= 0.19.9" requires "stbimage >= 2.3" +requires "nimbmp >= 0.1.6" diff --git a/three.bmp b/three.bmp deleted file mode 100644 index 7c5a72e..0000000 Binary files a/three.bmp and /dev/null differ