MCPcopy Create free account
hub / github.com/axmolengine/axmol / fromRgba

Method fromRgba

core/math/Color.cpp:182–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void HSV::fromRgba(const Color4F& rgba)
183{
184 float fcmax = MAX(MAX(rgba.r, rgba.g), rgba.b);
185 float fcmin = MIN(MIN(rgba.r, rgba.g), rgba.b);
186 float fdel = fcmax - fcmin;
187
188 if (fdel > 0)
189 {
190 if (fcmax == rgba.r)
191 {
192 h = 60 * (fmod(((rgba.g - rgba.b) / fdel), 6));
193 }
194 else if (fcmax == rgba.g)
195 {
196 h = 60 * (((rgba.b - rgba.r) / fdel) + 2);
197 }
198 else if (fcmax == rgba.b)
199 {
200 h = 60 * (((rgba.r - rgba.g) / fdel) + 4);
201 }
202
203 if (fcmax > 0)
204 {
205 s = fdel / fcmax;
206 }
207 else
208 {
209 s = 0;
210 }
211
212 v = fcmax;
213 }
214 else
215 {
216 h = 0;
217 s = 0;
218 v = fcmax;
219 }
220
221 if (h < 0)
222 {
223 h = 360 + h;
224 }
225
226 this->a = rgba.a;
227}
228
229Color4F HSV::toRgba() const
230{

Callers 1

updateParticleQuadsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected