public void drawToMap(ColorTable colorTable, GridCalculator gridF, GridCalculator gridCol, int[] mapdata, int ofs, int width) { for (int i = 0; i < width; i++) { double f = gridF.getAbsolutePos(i + gridF.low); int idx = (int)Math.Floor(f / fmax * size + 0.5); if (idx < 0) { idx = 0; } if (idx >= size) { idx = size - 1; } double cv = gridCol.getRelativePos(data[idx]); int col = colorTable.col(cv).ToArgb(); mapdata[ofs + i] = col; } }