Tag: 位图位图

从像素数据的字节数组创build位图

这个问题是关于如何读/写,分配和pipe理位图的像素数据。 以下是如何为像素数据分配字节数组(pipe理内存)并使用它创build位图的示例: Size size = new Size(800, 600); PixelFormat pxFormat = PixelFormat.Format8bppIndexed; //Get the stride, in this case it will have the same length of the width. //Because the image Pixel format is 1 Byte/pixel. //Usually stride = "ByterPerPixel"*Width //但这并不总是如此。 更多信息在bobpowell 。 int stride = GetStride(size.Width, pxFormat); byte[] data = new byte[stride * size.Height]; GCHandle […]