Skip to content

Commit

Permalink
chore: Bump ImageSharp
Browse files Browse the repository at this point in the history
  • Loading branch information
EbiseLutica committed Jan 24, 2024
1 parent 325000f commit 8b6de92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
6 changes: 0 additions & 6 deletions Promete/Exceptions/ObjectDestroyedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,4 @@ public ObjectDestroyedException(string message) : base(message)
public ObjectDestroyedException(string message, System.Exception inner) : base(message, inner)
{
}

protected ObjectDestroyedException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context)
{
}
}
4 changes: 0 additions & 4 deletions Promete/Exceptions/TextureDisposedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public TextureDisposedException() : base("You can not use the disposed texture."
{
}

protected TextureDisposedException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}

public TextureDisposedException(string? message) : base(message)
{
}
Expand Down
10 changes: 5 additions & 5 deletions Promete/Graphics/GlyphRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Text CreateElement(string content, Font font, SDColor? color)
public ITexture Generate(string text, Font font, SDColor? color, SDColor? borderColor, int borderThickness)
{
var f = ResolveFont(font);
var size = TextMeasurer.Measure(text, new RendererOptions(f));
var size = TextMeasurer.MeasureBounds(text, new TextOptions(f));
using var img = new Image<Rgba32>((int)size.Width + 8, (int)size.Height + 8);
var col = color ?? System.Drawing.Color.Black;
var isColor = Color.FromRgba(col.R, col.G, col.B, col.A);
Expand All @@ -45,7 +45,7 @@ public ITexture Generate(string text, Font font, SDColor? color, SDColor? border
{
var bc = borderColor.Value;
var isBorderColor = Color.FromRgba(bc.R, bc.G, bc.B, bc.A);
img.Mutate(ctx => ctx.DrawText(text, f, new SolidBrush(isColor), new Pen(isBorderColor, borderThickness),
img.Mutate(ctx => ctx.DrawText(text, f, new SolidBrush(isColor), new SolidPen(isBorderColor, borderThickness),
PointF.Empty));
}
else
Expand All @@ -65,16 +65,16 @@ private SixLabors.Fonts.Font ResolveFont(Font f)
}
else if (f.Path != null && File.Exists(f.Path))
{
family = fontCollection.Install(f.Path);
family = fontCollection.Add(f.Path);
}
else if (f.Path != null)
{
family = SystemFonts.Find(f.Path);
family = SystemFonts.Get(f.Path);
}
else if (f.Stream != null)
{
f.Stream.Position = 0;
family = fontCollection.Install(f.Stream);
family = fontCollection.Add(f.Stream);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Promete/Promete.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
<PackageReference Include="NVorbis" Version="0.10.5" />
<PackageReference Include="Silk.NET" Version="2.20.0" />
<PackageReference Include="Silk.NET.OpenAL.Soft.Native" Version="1.21.1.2" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.1" />
</ItemGroup>
</Project>

0 comments on commit 8b6de92

Please sign in to comment.