System.Drawing.Graphics.Transform在Ubuntu下的Mono中无效

System.Drawing.Graphics.Transform在Ubuntu下的Mono中无效,graphics,mono,system.drawing,Graphics,Mono,System.drawing,我有一个非常简单的代码,在位图上绘制图像,图像必须绘制在右下角。我使用TranslateTransform移动图像。这在Windows下运行时效果很好,但是,在Linux下的Mono中运行TranslateTransform时没有效果 byte[] imageBytes = File.ReadAllBytes(@"/home/alexey/Downloads/test.png"); using (Bitmap bmp = new Bitmap(500, 500)) { using (Gr

我有一个非常简单的代码,在位图上绘制图像,图像必须绘制在右下角。我使用TranslateTransform移动图像。这在Windows下运行时效果很好,但是,在Linux下的Mono中运行TranslateTransform时没有效果

byte[] imageBytes = File.ReadAllBytes(@"/home/alexey/Downloads/test.png");
using (Bitmap bmp = new Bitmap(500, 500))
{
    using (Graphics gr = Graphics.FromImage(bmp))
    {
        ImageAttributes attr = null;

        using (Image image = Image.FromStream(new MemoryStream(imageBytes)))
        {
            GraphicsUnit srcGU = GraphicsUnit.Pixel;
            RectangleF srcRect = image.GetBounds(ref srcGU);
            RectangleF bounds = new RectangleF(0, 0, 100, 100);

            // Destination points specify the bounding parallelogram.
            PointF[] dstPoints = new PointF[]
                { bounds.Location,
                  new PointF(bounds.X + bounds.Width, bounds.Y),
                  new PointF(bounds.X, bounds.Y + bounds.Height) };

            // Image must be in the in the lower right corner and it is if run the code under Windows.
            // But is run code under linux, the image is in the upper left corner.
            gr.TranslateTransform(400,400);

            gr.DrawImage(image, dstPoints, srcRect, srcGU, attr);
        }
    }
    bmp.Save(@"/home/alexey/Downloads/out.png", ImageFormat.Png);
}

当然,该代码是真实代码的简化版本,必须在windows和Linux环境下工作。我缩小了代码范围,发现linux下出现问题是因为Graphics.Transform在linux下的Mono中没有效果。有什么想法吗

我认为最简单的解决方案是简单地在dstPoints的X和Y分量中添加400。

是:)或简单地变换dstPoints,但这并不适用于所有情况,例如文本旋转。所以我需要让转换以某种方式发挥作用。有人能帮我解决上述问题吗?