Bitmap/Write a PPM file: Difference between revisions
Content added Content deleted
(→{{header|C++}}: static not needed, C++ after C#) |
(→{{header|C++}}: put method) |
||
Line 266: | Line 266: | ||
ofs << "P6" << endl << dimx << ' ' << dimy << endl << "255" << endl; |
ofs << "P6" << endl << dimx << ' ' << dimy << endl << "255" << endl; |
||
char color[3]; |
|||
for (auto j = 0u; j < dimy; ++j) |
for (auto j = 0u; j < dimy; ++j) |
||
for (auto i = 0u; i < dimx; ++i) { |
for (auto i = 0u; i < dimx; ++i) { |
||
ofs.put(i % 256); // red |
|||
ofs.put(j % 256); // green |
|||
ofs.put((i * j) % 256); // blue |
|||
ofs.write(color, sizeof(color)); |
|||
} |
} |
||