private void CreatePrint() { _bmp = BitmapFactory.New(_x.Length, _y.Length); var px = new byte[_x.Length * _y.Length * 4]; InitializeBorder(); for (var i = 0; i < _y.Length; i++) { for (var j = 0; j < _x.Length; j++) { var z = _data[xx[j], yy[i]]; var j2 = Viewport.HorizontalAxis.IsReversed ? _x.Length - 1 - j : j; var i2 = Viewport.VerticalAxis.IsReversed ? _y.Length - 1 - i : i; // превратить в цвет px[4 * (_x.Length * (i2) + (j2))] = _colorScale.Blue(z); px[4 * (_x.Length * (i2) + (j2)) + 1] = _colorScale.Green(z); px[4 * (_x.Length * (i2) + (j2)) + 2] = _colorScale.Red(z); px[4 * (_x.Length * (i2) + (j2)) + 3] = _colorScale.Alpha(z); } } var rect = new Int32Rect(0, 0, _x.Length, _y.Length); int stride = rect.Width * _bmp.Format.BitsPerPixel / 8; _bmp.WritePixels(rect, px, stride, 0); }
private byte[] CreateByteArray(float[] data, int thickness) { var px = new byte[4 * thickness * data.Length]; for (int i = 0; i < data.Length; i++) { var b = _colorScale.Blue(data[i]); var g = _colorScale.Green(data[i]); var r = _colorScale.Red(data[i]); var a = _colorScale.Alpha(data[i]); for (int j = 0; j < thickness; j++) { px[4 * (i + data.Length * j)] = b; px[4 * (i + data.Length * j) + 1] = g; px[4 * (i + data.Length * j) + 2] = r; px[4 * (i + data.Length * j) + 3] = a; } } return(px); }