Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3834

RGB vs HSV

From Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand>
Newsgroups comp.lang.java.programmer
Subject RGB vs HSV
Followup-To comp.lang.java.programmer
Date 2011-05-09 13:58 +1200
Organization Geek Central
Message-ID <iq7ho7$sv1$1@lust.ihug.co.nz> (permalink)

Followups directed to: comp.lang.java.programmer

Show all headers | View raw


Most graphics APIs seem to want colours specified in RGB space. But RGB is a 
poor choice for doing colour manipulations; for example, if you want a 
lighter or darker version of a given colour, naive manipulations directly on 
the RGB components are likely to lead to hue shifts.

A better space to work in is HSV. This way, you can, say, tweak the 
saturation or brightness, and leave the hue unchanged. It is also easier to 
predict what colour you are likely to get from a given set of HSV values. 
Even if your graphics API doesn’t support it directly, you can still convert 
to HSV, do your manipulations there, then convert back to RGB.

Wikipedia has formulas for the conversion. Or you can use code like the HSVA 
class here 
<https://github.com/ldo/ti5x_android/blob/master/src/GraphicsUseful.java>.

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

RGB vs HSV Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-09 13:58 +1200
  Re: RGB vs HSV markspace <-@.> - 2011-05-08 21:22 -0700
    Re: RGB vs HSV Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-10 10:16 +1200
  Re: RGB vs HSV "Gavino" <invalid@invalid.invalid> - 2011-05-10 20:18 +0200
    Re: RGB vs HSV Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-11 13:59 +1200
      Re: RGB vs HSV "John B. Matthews" <nospam@nospam.invalid> - 2011-05-11 00:59 -0400
        Re: RGB vs HSV Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-11 17:25 +1200

csiph-web