-
-
Notifications
You must be signed in to change notification settings - Fork 15
fix border and opacity lightshadow #10
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,7 +162,7 @@ protected virtual void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEve | |
| if (drawOuterShadow) | ||
| DrawOuterShadow(context); | ||
|
|
||
| SetPaintColor(context); | ||
| //SetPaintColor(context); | ||
| DrawControl(context); | ||
|
|
||
| if (drawInnerShadow) | ||
|
|
@@ -186,6 +186,8 @@ protected virtual void DrawInnerShadow(RenderContext context) | |
| { | ||
| var fShadowDistance = Convert.ToSingle(ShadowDistance); | ||
| var darkShadow = Color.FromRgba(DarkShadowColor.R, DarkShadowColor.G, DarkShadowColor.B, Elevation); | ||
| var lightShadow = Color.FromRgba(LightShadowColor.R, LightShadowColor.G, LightShadowColor.B, Elevation); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interessante, imaginei que o light Shadow precisaria ser sempre solido, pois no neomorfismo temos esse efeito de "continuidade" entre o fundo e o controle. Porém, faz sentido alterar a "força" dessa sombra com relação à elevação.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A verdade é que precisamos diferencia-la, porque caso o fundo seja estilo dark, precisamos de mais escuro e menos claro, e caso o fundo seja light, precisamos justamente do contrário, menos intensidade no preto, e mais intensidade no branco
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sim, mas para isso está aberta a possibilidade de alterar a cor, podendo utilizar um hexa decimal por exemplo. O Elevation é a aplicação da opacidade em cima dessa cor ja definida, para dar ao programador uma ferramenta que possa utilizar nesse sentido. Criando efeitos de diferentes relevos ou animações. Acredito que não seja o caso aplicado ao LightShadow |
||
|
|
||
| var drawPadding = ShadowDrawMode == ShadowDrawMode.InnerOnly ? | ||
| 0 : Convert.ToSingle(ShadowBlur * 2); | ||
|
|
||
|
|
@@ -201,7 +203,7 @@ protected virtual void DrawInnerShadow(RenderContext context) | |
| context.Paint.Style = SKPaintStyle.Stroke; | ||
| context.Paint.StrokeWidth = fShadowDistance; | ||
|
|
||
| context.Paint.ImageFilter = LightShadowColor.ToSKDropShadow(-fShadowDistance); | ||
| context.Paint.ImageFilter = lightShadow.ToSKDropShadow(-fShadowDistance); | ||
| context.Canvas.DrawPath(path, context.Paint); | ||
|
|
||
| context.Paint.ImageFilter = darkShadow.ToSKDropShadow(fShadowDistance); | ||
|
|
@@ -213,6 +215,7 @@ protected virtual void DrawOuterShadow(RenderContext context) | |
| { | ||
| var fShadowDistance = Convert.ToSingle(ShadowDistance); | ||
| var darkShadow = Color.FromRgba(DarkShadowColor.R, DarkShadowColor.G, DarkShadowColor.B, Elevation); | ||
| var lightShadow = Color.FromRgba(LightShadowColor.R, LightShadowColor.G, LightShadowColor.B, Elevation); | ||
| var drawPadding = Convert.ToSingle(ShadowBlur * 2); | ||
|
|
||
| context.Paint.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Normal, Convert.ToSingle(ShadowBlur)); | ||
|
|
@@ -226,7 +229,7 @@ protected virtual void DrawOuterShadow(RenderContext context) | |
| context.Paint.ImageFilter = darkShadow.ToSKDropShadow(fShadowDistance); | ||
| context.Canvas.DrawPath(path, context.Paint); | ||
|
|
||
| context.Paint.ImageFilter = LightShadowColor.ToSKDropShadow(-fShadowDistance); | ||
| context.Paint.ImageFilter = lightShadow.ToSKDropShadow(-fShadowDistance); | ||
| context.Canvas.DrawPath(path, context.Paint); | ||
| } | ||
| } | ||
|
|
@@ -247,4 +250,4 @@ private static void OnInnerViewChanged(BindableObject bindable, object oldValue, | |
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Porque precisou remover a busca pelo paint color?
Eu criei essa parte para garantir que a cor de Background seria aplicada no controle, pois como o paint é passado por referencia, muitas vezes alteramos alguns parametros.
Um exemplo disso é a NeoProgressView
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vou refazer alguns testes, achei que ele estava redundante, reaplicando o efeito duas vezes