+ ImageFileArrayConst v = m_rImageFile.getArray();
+ int xBase = m_nxGraph;
+ int yBase = 0;
+ if (m_nyGraph > m_nyImage)
+ yBase = (m_nyGraph - m_nyImage) / 2;
+ double minValue = v[0][0];
+ double maxValue = v[0][0];
+ for (int ix = 0; ix < m_nxImage; ix++) {
+ for (int iy = 0; iy < m_nyImage; iy++) {
+ double dPixel = v[ix][iy];
+ if (dPixel < minValue)
+ minValue = dPixel;
+ else if (dPixel > maxValue)
+ maxValue = dPixel;
+ }
+ }
+ unsigned char* imageData = new unsigned char [m_nxImage * m_nyImage * 3];
+ double dScale = 255 / (maxValue - minValue);
+ for (int ix = 0; ix < m_nxImage; ix++) {
+ for (int iy = 0; iy < m_nyImage; iy++) {
+ double dPixel = v[ix][iy];
+ dPixel = (dPixel - minValue) * dScale;
+ int intensity = nearest<int>(dPixel);
+ intensity = clamp (intensity, 0, 255);
+ int baseAddr = ((m_nyImage - 1 - iy) * m_nxImage + ix) * 3;
+ imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
+ }
+ }
+ wxImage image (m_nxImage, m_nyImage, imageData, true);
+ wxBitmap bitmap = image.ConvertToBitmap();
+ m_pSGP->getDriver().idWX()->DrawBitmap(bitmap, xBase, yBase, false);
+ delete imageData;
+