.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);
下面是全部的類