|
|
|
@ -19,13 +19,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
string path = TestEnvironment.CreateOutputDirectory("Fill", "LinearGradientBrush"); |
|
|
|
using (var image = new Image<Rgba32>(10, 10)) |
|
|
|
{ |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
new LinearGradientBrush<Rgba32>( |
|
|
|
new SixLabors.Primitives.Point(0, 0), |
|
|
|
new SixLabors.Primitives.Point(10, 0), |
|
|
|
new LinearGradientBrush<Rgba32>.ColorStop(0, Rgba32.Red), |
|
|
|
new LinearGradientBrush<Rgba32>.ColorStop(1, Rgba32.Red)); |
|
|
|
|
|
|
|
|
|
|
|
image.Mutate(x => x.Fill(unicolorLinearGradientBrush)); |
|
|
|
image.Save($"{path}/UnicolorGradient.png"); |
|
|
|
|
|
|
|
@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void HorizontalLinearGradientBrushReturnsUnicolorColumns() |
|
|
|
{ |
|
|
|
@ -49,13 +49,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
string path = TestEnvironment.CreateOutputDirectory("Fill", "LinearGradientBrush"); |
|
|
|
using (var image = new Image<Rgba32>(width, height)) |
|
|
|
{ |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
new LinearGradientBrush<Rgba32>( |
|
|
|
new SixLabors.Primitives.Point(0, 0), |
|
|
|
new SixLabors.Primitives.Point(500, 0), |
|
|
|
new LinearGradientBrush<Rgba32>.ColorStop(0, Rgba32.Red), |
|
|
|
new LinearGradientBrush<Rgba32>.ColorStop(1, Rgba32.Yellow)); |
|
|
|
|
|
|
|
|
|
|
|
image.Mutate(x => x.Fill(unicolorLinearGradientBrush)); |
|
|
|
image.Save($"{path}/horizontalRedToYellow.png"); |
|
|
|
|
|
|
|
@ -64,13 +64,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
Rgba32 columnColor23 = sourcePixels[23, 0]; |
|
|
|
Rgba32 columnColor42 = sourcePixels[42, 0]; |
|
|
|
Rgba32 columnColor333 = sourcePixels[333, 0]; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < height; i++) |
|
|
|
{ |
|
|
|
// check first and last column, these are known:
|
|
|
|
Assert.Equal(Rgba32.Red, sourcePixels[0, i]); |
|
|
|
Assert.Equal(Rgba32.Yellow, sourcePixels[lastColumnIndex, i]); |
|
|
|
|
|
|
|
|
|
|
|
// check the random colors:
|
|
|
|
Assert.Equal(columnColor23, sourcePixels[23, i]); |
|
|
|
Assert.Equal(columnColor42, sourcePixels[42, i]); |
|
|
|
@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
{ |
|
|
|
int width = 20; |
|
|
|
int height = 10; |
|
|
|
|
|
|
|
|
|
|
|
// ensure the input data is valid
|
|
|
|
Assert.True(pattern.Length > 0); |
|
|
|
|
|
|
|
@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
string path = TestEnvironment.CreateOutputDirectory("Fill", "LinearGradientBrush"); |
|
|
|
using (var image = new Image<Rgba32>(width, height)) |
|
|
|
{ |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
new LinearGradientBrush<Rgba32>( |
|
|
|
new SixLabors.Primitives.Point(0, 0), |
|
|
|
new SixLabors.Primitives.Point(width, 0), |
|
|
|
@ -138,7 +138,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
string path = TestEnvironment.CreateOutputDirectory("Fill", "LinearGradientBrush"); |
|
|
|
using (var image = new Image<Rgba32>(width, height)) |
|
|
|
{ |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
new LinearGradientBrush<Rgba32>( |
|
|
|
new SixLabors.Primitives.Point(0, 0), |
|
|
|
new SixLabors.Primitives.Point(0, 500), |
|
|
|
@ -182,7 +182,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
string path = TestEnvironment.CreateOutputDirectory("Fill", "LinearGradientBrush"); |
|
|
|
using (var image = new Image<Rgba32>(size, size)) |
|
|
|
{ |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
new LinearGradientBrush<Rgba32>( |
|
|
|
new SixLabors.Primitives.Point(startX, startY), |
|
|
|
new SixLabors.Primitives.Point(endX, endY), |
|
|
|
@ -239,7 +239,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing |
|
|
|
string path = TestEnvironment.CreateOutputDirectory("Fill", "LinearGradientBrush"); |
|
|
|
using (var image = new Image<Rgba32>(size, size)) |
|
|
|
{ |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
LinearGradientBrush<Rgba32> unicolorLinearGradientBrush = |
|
|
|
new LinearGradientBrush<Rgba32>( |
|
|
|
new SixLabors.Primitives.Point(startX, startY), |
|
|
|
new SixLabors.Primitives.Point(endX, endY), |
|
|
|
|