chiark / gitweb /
Faster, by more in-bulk processing of incoming pixels
[ypp-sc-tools.main.git] / pctb / rgbimage.c
index c4fd11d470c9a06ea39cbf81eb647a4fe26b0698..720e5dce78d398ed7f8fdfc8f1dde353a1532cf4 100644 (file)
@@ -115,6 +115,17 @@ static int identify(const RgbImage *base, Rect portion,
          identify1(base,portion,result,what, "local");
 }
 
+void fwrite_ppmraw(FILE *f, const RgbImage *ri) {
+  fprintf(f,
+         "P6\n"
+         "%d %d\n"
+         "255\n", ri->w, ri->h);
+  int count= ri->w * ri->h * 3;
+  sysassert( fwrite(ri->data, 1, count, f) == count );
+  sysassert(!ferror(f));
+  sysassert(!fflush(f));
+}
+
 static void fwrite_ppm(FILE *f, const RgbImage *base, Rect portion) {
   int x,y,i;
   fprintf(f,"P3\n%d %d\n255\n", RECT_W(portion), RECT_H(portion));