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

[ShadowContainer] support complex shapes #1312

Open
3 of 17 tasks
kucint opened this issue Dec 19, 2024 · 1 comment
Open
3 of 17 tasks

[ShadowContainer] support complex shapes #1312

kucint opened this issue Dec 19, 2024 · 1 comment
Labels
control/shadows kind/bug Something isn't working kind/enhancement New feature or request.

Comments

@kucint
Copy link

kucint commented Dec 19, 2024

Current behavior

When adding a shadow to the line, a boundary rectangle is used to create a shadow

<Page x:Class="UnoShadowContainerApp.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:UnoShadowContainerApp"
      xmlns:utu="using:Uno.Toolkit.UI"
      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  <ScrollViewer>
    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="200" />
        <ColumnDefinition Width="200" />
      </Grid.ColumnDefinitions>

      <utu:ShadowContainer Grid.Column="0" HorizontalAlignment="Center">
        <utu:ShadowContainer.Shadows>
          <utu:Shadow
            BlurRadius="30"
            Spread="-1"
            Opacity="0.5"
            Color="lightGreen" />
        </utu:ShadowContainer.Shadows>
        <StackPanel
          HorizontalAlignment="Center"
          VerticalAlignment="Center">
          <Rectangle
            Width="100"
            Height="80"
            Stroke="Black"
            StrokeThickness="1"
            RadiusX="4"
            RadiusY="4"
            Fill="LightBlue" />
          <TextBlock
            Text="Hello Uno Platform!"
            HorizontalAlignment="Center" />
        </StackPanel>
      </utu:ShadowContainer>

      <utu:ShadowContainer Grid.Column="1" HorizontalAlignment="Center">
        <utu:ShadowContainer.Shadows>
          <utu:Shadow
            BlurRadius="50"
            Spread="-1"
            Opacity="0.5"
            Color="lightGreen" />
        </utu:ShadowContainer.Shadows>
          <Line
            X1="0"
            Y1="0"
            X2="100"
            Y2="100"
            Stroke="Black"
            StrokeThickness="1" />
      </utu:ShadowContainer>
    </Grid>
  </ScrollViewer>
</Page>

image

Expected behavior

I expect that line will be "shadowed" rather than its boundary rectangle.

Important

in my project I want to add a shadow to an object that is much more complex than a simple line. It could look like as follow:
image
The shadow shall be around the presented Path rather than around Path's boundary rectangle.

I yes, I know, this is not a trivial problem....
Any idea how to work around it?

How to reproduce it (as minimally and precisely as possible)

MINIMAL REPRO PROJECT: UnoShadowContainerApp.zip

Nuget Package:

"Uno.Sdk": "5.5.54"
<PackageVersion Include="Uno.Toolkit.Skia.WinUI" Version="6.3.6" />

Package Version(s):

Affected platform(s):

  • WebAssembly
  • Android
  • iOS
  • macOS (AppKit)
  • Mac Catalyst
  • Skia
    • WPF
    • GTK (Linux)
    • Linux Framebuffer
    • Tizen
  • Windows

IDE:

  • Visual Studio 2022
  • Visual Studio 2019
  • Visual Studio Code
  • Visual Studio for Mac
  • Rider Windows
  • Rider macOS

Relevant plugins:

Anything else we need to know?

@kucint kucint added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification. labels Dec 19, 2024
@Xiaoy312
Copy link
Contributor

Unfortunately, this is not supported at the moment.

Remarks

Currently, the control simply mimics the shape of its content by size and by corner radius. Complicated shapes, such as text or pictures with alpha, are not yet supported.
-- https://github.com/unoplatform/uno.toolkit.ui/blob/main/doc/controls/ShadowContainer.md#remarks

@Xiaoy312 Xiaoy312 added kind/enhancement New feature or request. control/shadows and removed triage/untriaged Indicates an issue requires triaging or verification. labels Dec 19, 2024
@Xiaoy312 Xiaoy312 changed the title ShadowContainer: shadows disrespect the shape of the object being shadowed [ShadowContainer] support complex shapes Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
control/shadows kind/bug Something isn't working kind/enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants