私は、次の機能があります。画像をトリミングすることになっていますGraphics.RotateTransform()が適用されないのはなぜですか?
static private Image CropRotate(Image wholeImage, Rectangle cropArea)
{
Bitmap cropped = new Bitmap(cropArea.Width, cropArea.Height);
using(Graphics g = Graphics.FromImage(cropped))
{
g.DrawImage(wholeImage, new Rectangle(0, 0, cropArea.Width, cropArea.Height), cropArea, GraphicsUnit.Pixel);
g.RotateTransform(180f);
}
return cropped as Image;
}
は、その結果のサブ画像を回転させます。実際には、作物のみを実行します。
なぜRotateTransform()
が適用されないのですか?
奇妙なことに、これは空白の画像になります。 –
私はちょうどこの1つを推測していますが、画像の回転元はどこですか?それが(0,0)にある場合、空のイメージが正しいでしょう。原点を(cropped.Width/2、cropped.Height/2)に設定する必要があります – wangburger
g.RenderingOriginを設定してこれを行うと仮定しますが、まだ空白の画像が表示されます。他のアイデア? –