for (int y = 1; y < oldpic.Height; y++)
{
for (int x = 1; x < oldpic.Width; x++)
{
newColor = oldpic.GetPixel(oldpic.Width - x , x);
newpic.SetPixel(x, y, newColor);
}
picShow.Image = newpic;
这样貌似不行~!请高手指点
...全文
80420打赏收藏
求一个图像旋转90°的算法
Bitmap newpic; Bitmap oldpic; for (int y = 1; y < oldpic.Height; y++) { for (int x = 1; x < oldpic.Width; x++) { newColor = oldpic.GetPixel(oldpic.Width - x , x); newpic.SetPixel(x, y, newColor); } picShow.Image = newpic; 这样貌似不行~!请高手指点
//set the InterpolationMode to HighQualityBicubic so to ensure a high
//quality image once it is transformed to the specified size
gfx.InterpolationMode = InterpolationMode.HighQualityBicubic;
//now draw our new image onto the graphics object
gfx.DrawImage(img, new Point(0, 0));
Graphics.TranslateTransform
string filePath =@"C:\a.jpg";
using (Bitmap bm = new Bitmap(500,500))
{
using (Graphics g = Graphics.FromImage(bm))
{
g.Clear(Color.Wheat);
g.TranslateTransform(0, 0, MatrixOrder.Prepend);
g.RotateTransform(45);
FontFamily ff = new FontFamily("宋体");
Font f =new Font(ff,10);
Brush b = new SolidBrush(Color.Black);
StringFormat sf = new StringFormat();
g.DrawString("", f, b, new PointF(10, 10), sf);
g.DrawString("", f, b, new PointF(10, 10 + 30 + 10), sf);
}
bm.Save(filePath, ImageFormat.Jpeg);
}