int main(int argc, char *argv[])
{
screen(256, 256, 0, "The XOR Texture");
for(int y = 0; y < h; y++)
for(int x = 0; x < w; x++)
{
Uint8 c = x ^ y;
pset(x, y, ColorRGB(c, c, c));
}
redraw();
sleep();
return 0;
}
|
XOR |
||
Bit_a |
Bit_b |
Result |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
int main(int argc, char *argv[])
{
screen(256, 256, 0, "The XOR Texture");
ColorRGB color;
for(int y = 0; y < h; y++)
for(int x = 0; x < w; x++)
{
Uint8 c = (x ^ y);
color.r = 255 - c;
color.g = c;
color.b = c % 128;
pset(x, y, color);
}
redraw();
sleep();
return 0;
}
|
int main(int argc, char *argv[])
{
screen(256, 256, 0, "The XOR Texture");
ColorRGB color;
for(int y = 0; y < h; y++)
for(int x = 0; x < w; x++)
{
Uint8 c = (x ^ y);
color = HSVtoRGB(ColorHSV(c, 255, 255));
pset(x, y, color);
}
redraw();
sleep();
return 0;
}
|
XOR |
||
Bit_a |
Bit_b |
Result |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
AND |
||
Bit_a |
Bit_b |
Result |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
OR |
||
Bit_a |
Bit_b |
Result |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |