Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

PathGradientBrush not working properly #720

@Piripe

Description

@Piripe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions