using System;
using Windows.UI;
namespace OwlCore.WinUI.ColorExtractor.ColorSpaces
{
///
/// A Color in RGB colorspace.
///
public struct RGBColor : IEquatable
{
///
/// Gets a from a .
///
/// The to convert.
/// The resulting .
public static RGBColor FromColor(Color color)
{
float r = color.R / 255f;
float g = color.G / 255f;
float b = color.B / 255f;
return new RGBColor(r, g, b);
}
///
/// Initializes a new instance of the struct.
///
public RGBColor(float r, float g, float b)
{
R = r;
G = g;
B = b;
}
///
/// The Red channel of the RGB color.
///
///
/// Values range from 0-1.
///
public float R { get; set; }
///
/// The Green channel of the RGB color.
///
///
/// Values range from 0-1.
///
public float G { get; set; }
///
/// The Blue channel of the RGB color.
///
///
/// Values range from 0-1.
///
public float B { get; set; }
///
public bool Equals(RGBColor other)
{
return R == other.R &&
G == other.G &&
B == other.B;
}
}
}