.NET的Graphics不能绘制其他索引格式的图形,可以先绘制一个真彩的图形然后转换成索引的图形例如 1位 4位 8位色的图形
效果图
使用方法
pictureBox1.Image = Image.FromFile(@"c:/temp/1.jpg");
pictureBox2.Image = Zgke.MyImage.Panit.MyConvert.Convert((Bitmap)pictureBox1.Image, PixelFormat.Format8bppIndexed, true);
pictureBox3.Image = Zgke.MyImage.Panit.MyConvert.Convert((Bitmap)pictureBox1.Image, PixelFormat.Format4bppIndexed, true);
pictureBox4.Image = Zgke.MyImage.Panit.MyConvert.Convert((Bitmap)pictureBox1.Image, PixelFormat.Format1bppIndexed, true);
下面是全部的类