我希望将System.Drawing.Bitmap对象转换为postscript将能够呈现的格式。
我尝试使用的格式是指定宽度,高度,每像素位数和转换矩阵的位置。有没有简单的方法可以从位图图像中获取像素?
当前像素深度设置为每像素1位。
我想要的输出是这样的:
ffffffffffffffffffffffffffffffffffffffffffffffffffff
ff000000000000000000000000000000000000ffffffffffffff
ff00efefefefefefefefefefefefefefefef0000ffffffffffff
ff00efefefefefefefefefefefefefefefef00ce00ffffffffff
ff00efefefefefefefefefefefefefefefef00cece00ffffffff
ff00efefefefefefefefefefefefefefefef00cecece00ffffff
ff00efefefefefefefefefefefefefefefef00cececece00ffff
ff00efefefefefefefefefefefefefefefef00000000000000ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efef000000ef000000ef000000ef0000ef0000efefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efef000000ef00000000ef00000000ef000000efefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efef0000ef00000000000000ef000000ef0000efefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff00efefefefefefefefefefefefefefefefefefefefefef00ff
ff000000000000000000000000000000000000000000000000ff
ffffffffffffffffffffffffffffffffffffffffffffffffffff
使用以下方法管理上述工作:
for (int iii = 0; iii < bitmap.Height*bitmap.Width; iii++)
{
int row = iii/bitmap.Width;
int col = iii%bitmap.Width;
Color pixel = bitmap.GetPixel(col, row);
sb.Append(pixel.R.ToString("X2") + pixel.G.ToString("X2") + pixel.B.ToString("X2"));
if (iii > 0 && iii%bitmap.Width == 0)
{
sb.AppendLine();
}
}
然而,似乎每页无法绘制超过1张图像。如果在图像i inser showpage之后,附加内容将显示在下一页上。但如果没有显示页面,则不会添加任何页面。
在图像结束后,我需要放入任何类型的关闭,此时它以
结束 false 3 colorimage
我想我可能已经解决了这个问题,如果我在任何图像绘制命令之前做gsave
然后在grestore
之后,一切似乎都没问题。我不知道这是否是首选方法。