internal Pixmap(byte[] data, int width, int height, bool toBgra = true) { this._pixelData = new PinnedByteArray(data); Width = width; Height = height; if (toBgra) { var pixelData = this._pixelData.data; for (int i = 0; i < Width * Height; ++i) { var idx = i * 4; byte r = pixelData[idx]; byte g = pixelData[idx + 1]; byte b = pixelData[idx + 2]; byte a = pixelData[idx + 3]; pixelData[idx] = b; pixelData[idx + 1] = g; pixelData[idx + 2] = r; pixelData[idx + 3] = a; } } }
internal Pixmap(int width, int height) { Width = width; Height = height; _pixelData = new PinnedByteArray(width * height * 4); }