/// <summary> /// Static helper method converts this <paramref name="alphaLevel"/> /// to a <see cref="double"/> opacity value, in <c>[0.0, 1.0]</c>. /// </summary> /// <param name="alphaLevel">This level to convert.</param> /// <returns>Opacity value, in <c>[0.0, 1.0].</returns> public static double Opacity(this AlphaLevel alphaLevel) => (double)alphaLevel / 255D;
/// <summary> /// Returns an alpha level for a Color based on a constant identifier. /// The return value is bound to [0, 255]. /// </summary> public int Alpha(AlphaLevel alpha) => SystemMath.Max(0, SystemMath.Min(255, (int)(AlphaScale * (double)alpha)));
/// <summary> /// Sets the <see cref="AlphaLevel"/> of the given <paramref name="entity"/>. /// </summary> /// <param name="entity">Instance of an <see cref="Entity"/>.</param> /// <param name="level">Desired <see cref="AlphaLevel"/>.</param> public static void SetAlpha(this Entity entity, AlphaLevel level) { Function.Call(Hash.SET_ENTITY_ALPHA, entity, (int)level); }