Exemple #1
0
void SyImageBase::loadQImage(const QImage &imageIn)
  {
  SProfileFunction
  int width = imageIn.width();
  int height = imageIn.height();

  XVector<float> data;
  data.resize(width * height);

  xsize bytesPerPixel = imageIn.depth()/8;
  const quint8 *pixel = imageIn.bits();
  for(int i = 0; i < height; ++i )
    {
    xsize rowPos = i * width;
    for(int j = 0; j < width; ++j)
      {
      data[rowPos+j] = (float)*pixel/255.0f;
      pixel += bytesPerPixel;
      }
    }

  image.set(width, height, data);

  postSet();
  }