Skip to content

Commit ef5947d

Browse files
committed
Change color conversion.
1 parent ef9ba79 commit ef5947d

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/ImageSharp.Drawing/Processing/PathGradientBrush.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ public PathGradientBrushApplicator(
281281
Vector4 pointColor = ((1 - u - v) * this.edges[0].StartColor) + (u * this.edges[0].EndColor) +
282282
(v * this.edges[2].StartColor);
283283

284-
return new Color(pointColor).ToPixel<TPixel>();
284+
TPixel px = default;
285+
px.FromScaledVector4(pointColor);
286+
return px;
285287
}
286288

287289
var direction = Vector2.Normalize(point - this.center);
@@ -302,9 +304,9 @@ public PathGradientBrushApplicator(
302304

303305
var color = Vector4.Lerp(edgeColor, this.centerColor, ratio);
304306

305-
// Using this conversion because pixel.FromVector4(pointColor)
306-
// doesn't correctly convert some types (see ImageSharp issue 1412).
307-
return new Color(color).ToPixel<TPixel>();
307+
TPixel pixel = default;
308+
pixel.FromScaledVector4(color);
309+
return pixel;
308310
}
309311
}
310312

112 Bytes
Loading

0 commit comments

Comments
 (0)