主题:关于画图的一下小问题
我现在想根据浓度来画两种物质在一个体系中的分布情况
void TForm1::draw_color_map()
{
int cw,cb;
ImageColor->Width=LX*2;
ImageColor->Height=LY*2;
Image4s->Width=LX*2*2;
Image4s->Height=LY*2*2;
ImageColor->Picture->Bitmap->Width=LX*2;
ImageColor->Picture->Bitmap->Height=LY*2;
Image4s->Picture->Bitmap->Width=LX*2*2;
Image4s->Picture->Bitmap->Height=LY*2*2;
for(int y=0;y<LY;y++)
for(int x=0;x<LX;x++)
{
cb=fa[x+1][y+1]*256>255?255:fa[x+1][y+1]*256;
cb=fa[x+1][y+1]*256<0?0:fa[x+1][y+1]*256;
cw=fb[x+1][y+1]*256>255?255:fb[x+1][y+1]*256;
cw=fb[x+1][y+1]*256<0?0:fb[x+1][y+1]*256;
ImageColor->Canvas->Pixels[2*x][2*y]=TColor(RGB(cb,cw));
ImageColor->Canvas->Pixels[2*x+1][2*y]=TColor(RGB(cb,cw));
ImageColor->Canvas->Pixels[2*x][2*y+1]=TColor(RGB(cb,cw));
ImageColor->Canvas->Pixels[2*x+1][2*y+1]=TColor(RGB(cb,cw));
}
}
这好象有问题,它说RGB的参数个数不对,那要画灰度图该怎么画呢?
void TForm1::draw_color_map()
{
int cw,cb;
ImageColor->Width=LX*2;
ImageColor->Height=LY*2;
Image4s->Width=LX*2*2;
Image4s->Height=LY*2*2;
ImageColor->Picture->Bitmap->Width=LX*2;
ImageColor->Picture->Bitmap->Height=LY*2;
Image4s->Picture->Bitmap->Width=LX*2*2;
Image4s->Picture->Bitmap->Height=LY*2*2;
for(int y=0;y<LY;y++)
for(int x=0;x<LX;x++)
{
cb=fa[x+1][y+1]*256>255?255:fa[x+1][y+1]*256;
cb=fa[x+1][y+1]*256<0?0:fa[x+1][y+1]*256;
cw=fb[x+1][y+1]*256>255?255:fb[x+1][y+1]*256;
cw=fb[x+1][y+1]*256<0?0:fb[x+1][y+1]*256;
ImageColor->Canvas->Pixels[2*x][2*y]=TColor(RGB(cb,cw));
ImageColor->Canvas->Pixels[2*x+1][2*y]=TColor(RGB(cb,cw));
ImageColor->Canvas->Pixels[2*x][2*y+1]=TColor(RGB(cb,cw));
ImageColor->Canvas->Pixels[2*x+1][2*y+1]=TColor(RGB(cb,cw));
}
}
这好象有问题,它说RGB的参数个数不对,那要画灰度图该怎么画呢?