Limited
2
0
Files

36 lines
1.3 KiB
C#
Raw Permalink Normal View History

namespace BuyMeCofee.Maui.Helpers;
internal static class BmcBrandAssets
{
// Embedded PNG resource name — travels with the NuGet package assembly
private const string EmbeddedLogoName = "BuyMeCofee.Maui.Resources.Images.bmc_logo.png";
/// <summary>
/// Returns the cup logo as an ImageSource for MAUI Image controls.
/// Loads from embedded PNG resource so it works in consuming NuGet projects.
/// </summary>
internal static ImageSource GetCupLogo()
{
return ImageSource.FromStream(() =>
{
var assembly = typeof(BmcBrandAssets).Assembly;
return assembly.GetManifestResourceStream(EmbeddedLogoName)!;
});
}
/// <summary>
/// Returns the cup logo as a raw stream for SkiaSharp rendering (QR code overlay).
/// Falls back to embedded PNG resource.
/// </summary>
internal static Stream? GetCupLogoStream()
{
// Try embedded resource first (for QR code SkiaSharp rendering)
var assembly = typeof(BmcBrandAssets).Assembly;
var stream = assembly.GetManifestResourceStream(EmbeddedLogoName);
if (stream != null) return stream;
// If embedded PNG was removed, return null (QR code will render without logo)
return null;
}
}