INPStarfall / Starfall

Starfall Processor for Garry's Mod + Wiremod
http://www.wiremod.com/forum/developers-showcase/22739-starfall-processor.html
Other
17 stars 15 forks source link

Adding hsv to rgb #427

Open ZyOjV opened 7 years ago

ZyOjV commented 7 years ago

I wanted to use the HSVToColor() native Lua function. Then i noticed that the toHsv() function is not doing the right Operation for me so i wanted to add the HSVToColor.

awilliamson commented 7 years ago

@Kronos9247 The reason this wasn't added to the Colour type originally is that the colour type is expressed as RGB underlying. Having a method on the Colour Type to convert to HSV is fine, as it takes a Colour and returns a table of HSV. However, adding a function which takes HSV, and returns RGB doesn't make sense when attached to the colour Type methods. It might make sense as a library utility function, or if you were to create a HSV type ( similar to colour ) and use that as a method.

Would you be able to elaborate on your issue about it not doing the right operation for you? HSVToColor takes HSV, and produces it in RGB colour space. our toHSV() takes RGB Colour and produces a HSV Colour space representation. I hope this helps :)

EDIT: I would like to add, thank you for taking the time out to present this PR; You've clearly read, understood, and adhered to the Codestyle guidelines. Many people seem to gloss over that important document. We wish to encourage you to contribute in the future :)