-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
487cc9e
commit 2180e23
Showing
6 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#nullable enable | ||
|
||
using SkiaSharp; | ||
using Windows.UI; | ||
|
||
namespace Uno.UI.Composition.Composition; | ||
|
||
/// <summary> | ||
/// Captures the state of drop shadow for a visual. | ||
/// </summary> | ||
internal class ShadowState | ||
{ | ||
private SKPaint? _paint; | ||
|
||
public ShadowState(float dx, float dy, float sigmaX, float sigmaY, Color color) | ||
{ | ||
Dx = dx; | ||
Dy = dy; | ||
SigmaX = sigmaX; | ||
SigmaY = sigmaY; | ||
Color = color; | ||
} | ||
|
||
public float Dx { get; } | ||
|
||
public float Dy { get; } | ||
|
||
public float SigmaX { get; } | ||
|
||
public float SigmaY { get; } | ||
|
||
public Color Color { get; } | ||
|
||
public SKPaint Paint => | ||
_paint ??= new SKPaint() | ||
{ | ||
ImageFilter = SKImageFilter.CreateDropShadow(Dx, Dy, SigmaX, SigmaY, Color) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using SkiaSharp; | ||
|
||
namespace Windows.UI; | ||
|
||
public partial struct Color : IFormattable | ||
{ | ||
public static implicit operator SKColor(Color color) => new SKColor(color.R, color.G, color.B, color.A); | ||
|
||
public static implicit operator Color(SKColor color) => FromArgb(color.Alpha, color.Red, color.Green, color.Blue); | ||
} |