回 帖 发 新 帖 刷新版面

主题:关于画图的一下小问题

我现在想根据浓度来画两种物质在一个体系中的分布情况
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的参数个数不对,那要画灰度图该怎么画呢?

回复列表 (共1个回复)

沙发

RGB 宏要三个参数的,第一个是 blue 参数,第二个是 green 参数,第三个是 red

我来回复

您尚未登录,请登录后再回复。点此登录或注册