Brand credential provider with La Salle mascot
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
<ProjectReference Include="..\SGU.AuthBroker.Core\SGU.AuthBroker.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\assets\branding\lasalle-mascot-provider.png"
|
||||
LogicalName="SGU.CredentialProvider.Branding.LaSalleMascot.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
|
||||
<_Parameter1>SGU.CredentialProvider.Tests</_Parameter1>
|
||||
|
||||
Reference in New Issue
Block a user