Sfoglia il codice sorgente

[Core] Added ColorFromNormalized which is the reverse of ColorNormalize. (#1011)

pull/1013/head
ChrisDill 5 anni fa
committed by Ray
parent
commit
00c611a5fb
2 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. +13
    -0
      src/core.c
  2. +1
    -0
      src/raylib.h

+ 13
- 0
src/core.c Vedi File

@ -1616,6 +1616,19 @@ Vector4 ColorNormalize(Color color)
return result;
}
// Returns color from normalized values [0..1]
Color ColorFromNormalized(Vector4 normalized)
{
Color result;
result.r = normalized.x*255.0f;
result.g = normalized.y*255.0f;
result.b = normalized.z*255.0f;
result.a = normalized.w*255.0f;
return result;
}
// Returns HSV values for a Color
// NOTE: Hue is returned as degrees [0..360]
Vector3 ColorToHSV(Color color)

+ 1
- 0
src/raylib.h Vedi File

@ -924,6 +924,7 @@ RLAPI double GetTime(void); // Returns ela
// Color-related functions
RLAPI int ColorToInt(Color color); // Returns hexadecimal value for a Color
RLAPI Vector4 ColorNormalize(Color color); // Returns color normalized as float [0..1]
RLAPI Color ColorFromNormalized(Vector4 normalized); // Returns color from normalized values [0..1]
RLAPI Vector3 ColorToHSV(Color color); // Returns HSV values for a Color
RLAPI Color ColorFromHSV(Vector3 hsv); // Returns a Color from HSV values
RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value

Caricamento…
Annulla
Salva