mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
329 stars 171 forks source link

When DrawPath in linux, right border and bottom border not complete #664

Open li-zhixin opened 3 years ago

li-zhixin commented 3 years ago

I'm using gdiplus to draw the button in a bitmap. The same code behaves differently on windows and linux. image image The core code is shown below.


        public static Graphics GetHighQualityGraphic(this Bitmap bitmap)
        {
            var result = Graphics.FromImage(bitmap);
            result.CompositingQuality = CompositingQuality.AssumeLinear;
            result.SmoothingMode = SmoothingMode.AntiAlias;
            result.PixelOffsetMode = PixelOffsetMode.HighQuality;
            result.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            result.InterpolationMode = InterpolationMode.HighQualityBicubic;
            return result;
        }

        protected void DrawRoundRectangle(Graphics graphics, Pen pen, RectangleF rectangle, float radiusX,
            float radiusY = 0)
        {
            var mode = graphics.SmoothingMode;
            graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            graphics.DrawPath(pen, GetRoundRectangle(rectangle, radiusX, radiusY));
        }

Is there anything I can offer or any helpful advice?Thanks.