i'm attempting to create from scratch a red image.
Here the code:
Code: Select all
unsigned int width = 2550;
unsigned int height= 3300;
int bitCount = 24;
unsigned int m_bytesPerRow = ((width* bitCount + 31) / 32) * 4;
BYTE* data = new BYTE[height* m_bytesPerRow ];
memset(data,0,sizeof(unsigned char));
for(unsigned int i=0;i<=this-> height-1;i++)
{
for(unsigned int j=0;j<= m_bytesPerRow -1;j=j+9)
{
data[i*m_bytesPerRow+j]=255;
data[i*m_bytesPerRow+j+1]=0;
data[i*m_bytesPerRow+j+2]=0;
data[i*m_bytesPerRow+j+3]=255;
data[i*m_bytesPerRow+j+4]=0;
data[i*m_bytesPerRow+j+5]=0;
data[i*m_bytesPerRow+j+6]=255;
data[i*m_bytesPerRow+j+7]=0;
data[i*m_bytesPerRow+j+8]=0;
}
}
::Magick::Image *img = new Magick::Image();
img->resize(Geometrywidth,height));
img->depth(this->m_bitmapInfoHeader->biBitCount);
img->modifyImage();
img->read(width,height,"RGB",MagickCore::CharPixel,data);
img->syncPixels();
img->write("c:/a_red_image.bmp");
There is also a black diagonal line.
Why??
What i'm wrong?