Example for drawing a chessboard in an image
- Author
- MIP
#include <iostream>
#include <Base/Image/ImageBase.hh>
#include <Base/Image/ImageConvert.hh>
#include <Base/Image/ImageIO.hh>
using namespace BIAS;
using namespace std;
int main()
{
unsigned int size=2048;
unsigned int chess_field_size=128;
unsigned int x=0, y=0, c=0, r=0;
unsigned char color=0;
for (y=chess_field_size; y<=im.
GetHeight(); y+=chess_field_size){
for (x=chess_field_size; x<=im.
GetHeight(); x+=chess_field_size){
if (y==chess_field_size)
color = (color==0) ? (unsigned char)255 : (unsigned char)0;
else
color = (ida[y-chess_field_size-1][x-1]==0) ?
(unsigned char)255 : (unsigned char)0;
for (r=1; r<=chess_field_size; r++){
for (c=1; c<=chess_field_size; c++){
ida[y-r][x-c]=color;
}
}
}
}
BIASERR("error writing image ");
return -2;
}
BIASERR("error exporting image ");
return -2;
}
return 0;
}