Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Xamarin.Forms.NeoControls/NeoFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected virtual void DrawBorder(RenderContext renderContext, SKPath path)
{
renderContext.Paint.Style = SKPaintStyle.Stroke;
renderContext.Paint.Color = BorderColor.ToSKColor();
renderContext.Paint.Shader = null;
renderContext.Paint.StrokeWidth = Convert.ToSingle(BorderWidth);
renderContext.Canvas.DrawPath(path, renderContext.Paint);
}
Expand Down
11 changes: 7 additions & 4 deletions Xamarin.Forms.NeoControls/NeoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected virtual void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEve
if (drawOuterShadow)
DrawOuterShadow(context);

SetPaintColor(context);
//SetPaintColor(context);
Copy link
Owner

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

Copy link
Author

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

DrawControl(context);

if (drawInnerShadow)
Expand All @@ -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);
Copy link
Owner

@felipebaltazar felipebaltazar May 5, 2020

Choose a reason for hiding this comment

The 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.
Seria interessante uma imagem para visualizar o efeito com alteração dessa opacidade.

Copy link
Author

Choose a reason for hiding this comment

The 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

Copy link
Owner

Choose a reason for hiding this comment

The 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);

Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -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);
}
}
Expand All @@ -247,4 +250,4 @@ private static void OnInnerViewChanged(BindableObject bindable, object oldValue,
}
}
}
}
}
6 changes: 0 additions & 6 deletions Xamarin.Forms.NeoControls/Xamarin.Forms.NeoControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
<PackageReference Include="Xamarin.Forms" Version="4.5.0.356" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="NeoView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Include="..\Images\Icon.png">
<Pack>True</Pack>
Expand Down