Skip to content

Commit

Permalink
fix bug in gradient interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Oct 30, 2024
1 parent 3b45704 commit 2c28b9e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Consolonia.Core/Drawing/ConsoleBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static Color InterpolateColor(IGradientBrush brush, double relativePosit
{
before = stop;
}
if (stop.Offset >= relativePosition)
else if (stop.Offset >= relativePosition)
{
after = stop;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
d:DesignHeight="450"
x:Class="Consolonia.Gallery.Gallery.GalleryViews.GalleryColors">
<UserControl.Resources>
<LinearGradientBrush x:Key="ColorGalleryBackgroundBrush" EndPoint="0%,100%" StartPoint="0%,100%">
<LinearGradientBrush x:Key="ColorGalleryBackgroundBrush" EndPoint="0%,0%" StartPoint="0%,100%">
<GradientStop Color="Black" Offset="0" />
<GradientStop Color="DarkRed" Offset="1" />
</LinearGradientBrush>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
d:DesignHeight="450"
x:Class="Consolonia.Gallery.Gallery.GalleryViews.GalleryGradientBrush">

<Grid x:Name="MyGrid" RowDefinitions="Auto *" Margin="1">
<Grid x:Name="MyGrid" RowDefinitions="Auto *">
<Grid.Background>
<LinearGradientBrush EndPoint="0%,100%" StartPoint="0%,100%">
<GradientStop Color="Black" Offset="0" />
<GradientStop Color="White" Offset="1" />
<LinearGradientBrush EndPoint="0%,0%" StartPoint="0%,100%">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="Red" Offset="1" />
</LinearGradientBrush>
</Grid.Background>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void Linear_Click(object sender, Avalonia.Interactivity.RoutedEventArgs
GradientStops = new GradientStops
{
new GradientStop { Color = Colors.White, Offset = 0 },
new GradientStop { Color = Colors.Black, Offset = 1 }
new GradientStop { Color = Colors.Red, Offset = 1 }
}
};
}
Expand All @@ -45,8 +45,8 @@ private void Radial_Click(object sender, Avalonia.Interactivity.RoutedEventArgs
Radius = 0.5,
GradientStops = new GradientStops
{
new GradientStop { Color = Colors.White, Offset = 0 },
new GradientStop { Color = Colors.Black, Offset = 1 }
new GradientStop { Color = Colors.Black, Offset = 0 },
new GradientStop { Color = Colors.Red, Offset = 1 }
}
};
}
Expand Down

0 comments on commit 2c28b9e

Please sign in to comment.