阅读C++代码CreateFrame函数(来自C#的预期)

Rel*_*lla 1 c c# c++ creation frame

// Create test video frame
void CreateFrame(char * buffer, int w, int h, int bytespan)
{
  int wxh = w * h;
  static float seed = 1.0;
  for (int i = 0; i < h; i ++)
  {
    char* line = buffer + i * bytespan;
    for (int j = 0; j < w; j ++)
    {
      // RGB
      line[0] = 255 * sin(((float)i / wxh * seed) * 3.14);
      line[1] = 255 * cos(((float)j / wxh * seed) * 3.14);
      line[2] = 255 * sin(((float)(i + j) / wxh * seed) * 3.14);
      line += 3;
    }
  }
  seed = seed + 2.2;
}
Run Code Online (Sandbox Code Playgroud)

任何人都可以高举我的意思line += 3;吗?

以及如何在C#中创建这样的函数模拟?

Dim*_*ima 5

line += 3将指针递增line3个字节,使其指向下一个像素. line这是一个指向3字节像素的指针,所以它应该被称为其他东西,比如pPixel.