Bitmap/Write a PPM file: Difference between revisions

(→‎{{header|C++}}: static not needed, C++ after C#)
(→‎{{header|C++}}: put method)
Line 266:
ofs << "P6" << endl << dimx << ' ' << dimy << endl << "255" << endl;
 
char color[3];
for (auto j = 0u; j < dimy; ++j)
for (auto i = 0u; i < dimx; ++i) {
color[0] = ofs.put(i % 256); // red
color[1] = ofs.put(j % 256); // green
color[2] = ofs.put((i * j) % 256); // blue
ofs.write(color, sizeof(color));
}
 
Anonymous user