【发布时间】:2009-05-20 12:24:08
【问题描述】:
我成功地从他们的原始像素数据中绘制了图像。(只有 8 位图像)。 这是做同样事情的代码。
PixelFormat format = PixelFormat.Format8bppIndexed;
Bitmap bmp = new Bitmap(Img_Width, Img_Height, format);
Rectangle rect = new Rectangle(0, 0, Img_Width, Img_Height);
BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, format);
Marshal.Copy(rawPixel, 0, bmpData.Scan0, rawPixel.Length);
bmp.UnlockBits(bmpData);
现在大家都知道 PixelFormat.format16bppGrayscale 不支持 c# 2.0 GDI+。 我用谷歌搜索并获得了 3.0/3.5 框架支持。 所以我两个都安装了。 支持的类是 System.windows.media.PixelFormats。 PixelFormats.Gray16
现在我的问题是如何通过传递此参数来创建位图并获取显示图像。
我在那里有一些 BitmapSource 类,但我在 C#3.0 中很新。
请帮帮我。
【问题讨论】:
标签: c# system.drawing