In XAML, colors are typically referenced using their named values, or with hexadecimal: ToHsl converts a Color to HSL float values that are passed as out arguments.ToRgba converts a Color to RGBA byte values that are returned as out arguments.ToRgb converts a Color to RGB byte values that are returned as out arguments.ToUint returns an ARGB uint representation of a Color.ToInt returns an ARGB int representation of a Color.ToRgbaHex returns an RGBA hexadecimal string representation of a Color.ToArgbHex returns an ARGB hexadecimal string representation of a Color.ToHex returns a hexadecimal string representation of a Color.AsPaint returns a SolidPaint object whose Color property is set to the color.The following instance methods convert a Color to an alternative representation: WithSaturation returns a Color, replacing the saturation value with the supplied float value.WithLuminosity returns a Color, replacing the luminosity value with the supplied float value. WithHue returns a Color, replacing the hue value with the supplied float value.WithAlpha returns a Color, replacing the alpha value with the supplied float value.MultiplyAlpha returns a Color by multiplying the alpha value by the supplied float value.GetComplementary returns the complementary Color.AddLuminosity returns a Color by adding the luminosity value to the supplied delta value.The following instance methods modify an existing color to create a new color: The Colors class defines 148 public static read-only fields for common colors, such as AntiqueWhite, MidnightBlue, and YellowGreen. GetLuminosity, which returns a float that represents the luminosity channel of the color.GetSaturation, which returns a float that represents the saturation channel of the color.GetHue, which returns a float that represents the hue channel of the color.In addition, the characteristics of the color can be obtained from the following methods: Alpha, which represents the alpha channel of the color.Blue, which represents the blue channel of the color.Green, which represents the green channel of the color.Red, which represents the red channel of the color.The characteristics of the color can be obtained from the following float fields, that range from 0 to 1: Once created, a Color object is immutable. In addition to the methods listed above, the Color class also has Parse and TryParse methods that create Color objects from string arguments. Color.FromArgb from a string-based hexadecimal value in the form "#AARRGGBB" or "#RRGGBB" or "#ARGB" or "RGB", where each letter corresponds to a hexadecimal digit for the alpha, red, green, and blue channels.Color.FromUint from a uint value calculated as (B + 256 * (G + 256 * (R + 256 * A))).Color.FromInt from an int value calculated as (B + 256 * (G + 256 * (R + 256 * A))).Color.FromHsv from int HSV values that range from 0 to 255.Color.FromHsv from float HSV values that range from 0 to 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |