Bitmap/Write a PPM file: Difference between revisions

Content added Content deleted
(→‎{{header|Ada}}: Blocked output for better performance)
(Vedit macro language added)
Line 81: Line 81:
flush oc;
flush oc;
;;</ocaml>
;;</ocaml>

=={{header|Vedit macro language}}==

This routine creates a RAW PPM file (binary).
Pixel data must be stored in edit buffer pointed by numeric register #10.
The data in the buffer is assumed to be in R,G,B order, which is the order used by PPM file.
<pre>
/////////////////////////////////////////////////////////////////////
//
// Save image as PPM file.
// @10 = filename. Buffer #10 contains the Pixel data.
//
:SAVE_PPM:
Buf_Switch(#10)
BOF
IT("P6") IN
Num_Ins(#11, LEFT) // width of image
Num_Ins(#12, LEFT) // height of image
Num_Ins(255, LEFT+NOCR) // maxval
IC(10)
File_Save_As(@10, OK)
Return
</pre>