File:Schachbrett-bw.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Schachbrett-bw.png (445 × 445 pixels, file size: 1 KB, MIME type: image/png)
File information
Structured data
Captions
File:5x5checkerboard.svg is a vector version of this file. It should be used in place of this PNG file when not inferior.
File:Schachbrett-bw.png → File:5x5checkerboard.svg
For more information, see Help:SVG.
|
Summary
[edit]DescriptionSchachbrett-bw.png |
Deutsch: Schachbrettmuster schwarz-weiss |
Date | |
Source | Own work |
Author | User:BigBen666, src code by User:Adam majewski |
Licensing
[edit]Public domainPublic domainfalsefalse |
I, the copyright holder of this work, release this work into the public domain. This applies worldwide. In some countries this may not be legally possible; if so: I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. |
cpp source code
[edit]/*
[[:File:XOR_texture.png]]
*/
#include <fstream>
// http://fraktal.republika.pl/grid.html
int f( int x, int y, int Width){
int g;
int bx = (x / Width) % 2; // check if odd
int by = (y / Width) % 2;
if (bx == by )
g= 0;
else g= 255;
return g;
}
int main()
{
const int side = 445;
int xMax = side;
int yMax = side;
int rows = 5;
int width = side / rows;
std::ofstream file;
file.open("checkerboard.ppm");
file << "P2" << xMax << ' ' << yMax << ' ' << " 255\n";
for (int x = 0; x < xMax; x++)
for (int y = 0; y < yMax; y++)
file << f(x,y, width) << ' ';
file.close();
return 0;
}
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 12:24, 12 December 2005 | 445 × 445 (1 KB) | BigBen666 (talk | contribs) | Schachbrettmuster schwarz-weiss |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.