Skip to content

The shadow display doubled size when drawing shadow using the GraphicsView #4106

Closed

Description

@SuryaChinnadurai

Description

When drawing shadow using the GraphicsView, the shadow will be displayed doubled size in the iOS and Maccatalyst platforms.

Xaml:

<ContentPage.Resources>
        <ResourceDictionary>
            <local:GraphicsDrawable x:Key="GraphicsDrawable" />
        </ResourceDictionary>
    </ContentPage.Resources>

    <ContentPage.Content>
        <StackLayout WidthRequest="300" HeightRequest="300">
            <GraphicsView  x:Name="layout"
                HeightRequest="500"
                WidthRequest="500"
                Drawable="{StaticResource GraphicsDrawable}"></GraphicsView>
        </StackLayout>
    </ContentPage.Content>

Cs:

 public class GraphicsDrawable : IDrawable
    {
        public void Draw(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();
            canvas.FillColor = Colors.CornflowerBlue;
            canvas.SetShadow(new SizeF(10, 10), 4, Colors.Red);
            canvas.FillEllipse(50, 100, 100, 50);
            canvas.RestoreState();
        }
    }

Android:
image

iOS:
image

Steps to Reproduce

  1. Create a new Maui Application
  2. Add GraphicsView and set height and width as 500.
  3. Create a new class and extend the class from IDrawable
  4. Draw the custom shape and shadow using canvas in the draw method.
  5. Set the shadow offset as SizeF(10, 10), and blur as 4.
  6. Bind the new class to the GraphicsView drawable property.

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 14.2

Did you find any workaround?

No

Relevant log output

no

Activity

  1. added
    area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawing
    on Jan 13, 2022
  2. mattscheffer commented on Feb 12, 2022

    @mattscheffer

    Verified Repro with iPhone 13 IOs 15.2. Repro project available here:
    4106.zip

  3. added this to the 6.0.300-servicing milestone on Mar 23, 2022
  4. modified the milestones: 6.0-servicing, Backlog on Aug 30, 2022
  5. removed
    s/verifiedVerified / Reproducible Issue ready for Engineering Triage
    on Apr 5, 2023
  6. added
    s/triagedIssue has been reviewed
    s/verifiedVerified / Reproducible Issue ready for Engineering Triage
    on Apr 25, 2023
  7. jinxinjuan commented on Apr 25, 2023

    @jinxinjuan

    Repro on version 17.6.0 Preview 3.0 with the project 4106.zip

  8. locked and limited conversation to collaborators on Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions