Brand credential provider with La Salle mascot

This commit is contained in:
2026-09-04 15:20:05 -06:00
parent b3e40fabb5
commit b5f526e244
4 changed files with 28 additions and 23 deletions
+11 -16
View File
@@ -1,35 +1,30 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
namespace SGU.CredentialProvider;
internal static class ProviderTileIcon
{
public const int Size = 72;
private const string MascotResourceName = "SGU.CredentialProvider.Branding.LaSalleMascot.png";
public static Bitmap Create()
{
Bitmap bitmap = new(Size, Size, PixelFormat.Format32bppArgb);
using Graphics graphics = Graphics.FromImage(bitmap);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.Clear(Color.Transparent);
using SolidBrush background = new(Color.FromArgb(0, 83, 155));
graphics.FillEllipse(background, 1, 1, Size - 2, Size - 2);
using Pen key = new(Color.White, 5.5f)
{
StartCap = LineCap.Round,
EndCap = LineCap.Round,
LineJoin = LineJoin.Round
};
graphics.DrawEllipse(key, 14, 14, 25, 25);
graphics.DrawLine(key, 35, 35, 57, 57);
graphics.DrawLine(key, 47, 47, 55, 39);
graphics.DrawLine(key, 53, 53, 61, 45);
using Stream sourceStream = typeof(ProviderTileIcon).Assembly.GetManifestResourceStream(MascotResourceName)
?? throw new InvalidOperationException($"The branded Credential Provider logo '{MascotResourceName}' is unavailable.");
using Bitmap mascot = new(sourceStream);
using GraphicsPath circularMask = new();
circularMask.AddEllipse(0, 0, Size, Size);
graphics.SetClip(circularMask);
graphics.DrawImage(mascot, new Rectangle(0, 0, Size, Size));
return bitmap;
}