Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathGradientBrush not working properly #720

Open
Piripe opened this issue Oct 10, 2021 · 0 comments
Open

PathGradientBrush not working properly #720

Piripe opened this issue Oct 10, 2021 · 0 comments

Comments

@Piripe
Copy link

Piripe commented Oct 10, 2021

I think the PathGradientBrush is not supported by libgdiplus

At the left libgdiplus on Ubuntu 20.04 | At the right GDI+ of Windows 10
Screenshot 2021-10-11 002712

The code I used

Public Function MonoShadow() As Image
        Dim flag As New Bitmap(500, 500)
        Using g = Graphics.FromImage(flag)
            Dim path As New GraphicsPath
            path.AddArc(New Rectangle(0, 0, 100, 100), 90, 180)
            path.AddLine(50, 0, 350, 0)
            path.AddArc(New Rectangle(300, 0, 100, 100), -90, 180)
            path.AddLine(50, 100, 350, 100)

            Dim shadowpath As New GraphicsPath()
            shadowpath.AddPath(path, False)
            Dim Matrix = New Matrix()

            Matrix.Translate(10, 10)

            shadowpath.Transform(Matrix)

            Using Brush As PathGradientBrush = New PathGradientBrush(shadowpath)
                Brush.WrapMode = WrapMode.Clamp

                Dim ColorBlend = New ColorBlend(3)

                ColorBlend.Colors = New Drawing.Color() {Drawing.Color.Transparent, Drawing.Color.FromArgb(96, 0, 0, 0), Drawing.Color.FromArgb(96, 0, 0, 0)}
                ColorBlend.Positions = New Single() {0F, 0.1F, 1.0F}

                Brush.InterpolationColors = ColorBlend

                g.FillPath(Brush, shadowpath)
            End Using
        End Using
        Return flag
    End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant