Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf:Color float form  (Read 3803 times)

0 Members and 1 Guest are viewing this topic.

LA

  • Newbie
  • *
  • Posts: 5
    • View Profile
sf:Color float form
« on: September 03, 2012, 06:21:10 pm »
nothing special, just float form for sf::Color clamped to 0..1

sf::Color ( 1.0f, 1.0f, 1.0f ) == sf::Color ( 255, 255, 255 );

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf:Color float form
« Reply #1 on: September 03, 2012, 07:20:17 pm »
Why?

And how (new constructor? new class? ...)?
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: sf:Color float form
« Reply #2 on: September 03, 2012, 07:39:13 pm »
Why?
Probably because of some old habit. Otherwise I don't really see a benefit either, since there would always be some strange converting...

And how (new constructor? new class? ...)?
Or more specific, do you just want the constructor to make the convertion for your, or would you then also expect that the porperties (i.e. red, green, blue, alpha) would be of a float value?

I don't really see any advantages in this 'feature' for SFML. It just makes the API more complex. Percentages of colors isn't really a describtion of a color, so it doesn't make that much sense.
And on top of this, if you need such a convertion functionality it's quite easy to create a factory class with additional convertion functions, or similar constructs which can be placed on top of the sf::Color class. ;)

So tell us more what your use case would be and what you'd exactly expect from sf::Color to handle your idea. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

LA

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: sf:Color float form
« Reply #3 on: September 03, 2012, 08:26:29 pm »
I understand that SMFL is not graphics engine. But of course, all of you knows, that videocard store all values in float. Not in unsigned chars :)

So even if you dont mess up with OpenGL 3+ deprecated stuff, users may store values in float.
Yes, convert is simple:
sf:Color ( (int)(MyFloatColor_R * 255.0f), ... );

But converting can be done in constructor, taking float values.

Nevermind. Its not important )
« Last Edit: September 03, 2012, 08:31:18 pm by LA »

 

anything