Changeset 7195 in orxonox.OLD for trunk/src/lib/util/color.cc
- Timestamp:
- Mar 7, 2006, 11:12:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/color.cc
r5494 r7195 17 17 18 18 #include "color.h" 19 #include "vector.h"19 #include <stdio.h> 20 20 21 21 using namespace std; 22 22 23 23 24 25 26 #include <stdio.h>27 28 24 /** 29 * transforms from RGB to HSVtoRGB30 * @param RGB the RGB-color [0-1]25 * @brief transforms from RGB to HSVtoRGB 26 * @param RGB: the RGB-color [0-1] 31 27 * @returns HSV: with values (h[0-360(degree)],s[0,1],v[0,1]) 32 28 */ 33 29 Vector Color::RGBtoHSV(const Vector& RGB) 30 { 31 Vector HSV; 32 RGBtoHSV(RGB, HSV); 33 return HSV; 34 } 35 36 /** 37 * @brief transforms from RGB to HSVtoRGB 38 * @param RGB: the RGB-color [0-1] 39 * @param HSV: with values (h[0-360(degree)],s[0,1],v[0,1]) 40 */ 41 void Color::RGBtoHSV(const Vector& RGB, Vector& HSV) 34 42 { 35 43 float r = RGB.x; … … 70 78 h += 360.0; 71 79 } 72 returnVector(h, s, v);80 HSV = Vector(h, s, v); 73 81 } 74 82 75 83 /** 76 * converts a Color from HSV to RGBtoHSV84 * @brief converts a Color from HSV to RGBtoHSV 77 85 * @param HSV: Vector with values (h[0-360(degree)],s[0,1],v[0,1]) 78 86 * @returns RGB: Vector [0-1] 79 87 */ 80 88 Vector Color::HSVtoRGB(const Vector& HSV) 89 { 90 Vector RGB; 91 HSVtoRGB(HSV, RGB); 92 return RGB; 93 } 94 95 /** 96 * @brief converts a Color from HSV to RGBtoHSV 97 * @param HSV: Vector with values (h[0-360(degree)],s[0,1],v[0,1]) 98 * @param RGB: Vector [0-1] 99 */ 100 void Color::HSVtoRGB(const Vector& HSV, Vector& RGB) 81 101 { 82 102 float h = HSV.x; … … 141 161 } 142 162 } 143 returnVector(r,g,b);163 RGB = Vector(r,g,b); 144 164 } 145 165
Note: See TracChangeset
for help on using the changeset viewer.