MantisBT - VTK
View Issue Details
0001402VTK(No Category)public2004-12-07 14:432016-08-12 09:54
Denis Shamonin 
Kitware Robot 
lowfeaturealways
closedmoved 
 
 
0001402: Converting color RGB/HSV from int to double and double to int
Some multiplatform GUI toolkits provides colors based on int RGB or HSV values (Qt for example)
http://doc.trolltech.com/3.3/qcolor.html [^]
It will be nice to have converter color RGB/HSV from int to double and double to int inside vtkMath.
Example:

  // Description:
  // Convert color RGB from int to double and double to int.
  // The input color is not modified.
  static void RGBTorgb(int RGB[3], double rgb[3])
    {
    RGBTorgb(RGB[0], RGB[1], RGB[2], rgb, rgb+1, rgb+2);
    }
  static void RGBTorgb(int R, int G, int B, double *r, double *g, double *b);
                                                                                                              
  static void rgbToRGB(double rgb[3], int RGB[3])
    {
    rgbToRGB(rgb[0], rgb[1], rgb[2], RGB, RGB+1, RGB+2);
    }
  static void rgbToRGB(double r, double g, double b, int *R, int *G, int *B);

  // Description:
  // Convert color HSV from int to double and double to int.
  // The input color is not modified.
  static void HSVTohsv(int HSV[3], double hsv[3])
    {
    HSVTohsv(HSV[0], HSV[1], HSV[2], hsv, hsv+1, hsv+2);
    }
  static void HSVTohsv(int H, int S, int V, double *h, double *s, double *v);
                                                                                                              
  static void hsvToHSV(double hsv[3], int HSV[3])
    {
    hsvToHSV(hsv[0], hsv[1], hsv[2], HSV, HSV+1, HSV+2);
    }
  static void hsvToHSV(double h, double s, double v, int *H, int *S, int *V);
No tags attached.
Issue History
2008-11-30 09:24Mathieu MalaterreAssigned ToMathieu Malaterre => François Bertel
2008-11-30 20:22François BertelAssigned ToFrançois Bertel =>
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036755
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved
2016-08-12 09:54Kitware RobotAssigned To => Kitware Robot

Notes
(0001790)
Mathieu Malaterre   
2004-12-09 18:47   
I quickly browse through the page but I don't understand why we should be using int instead of unsigned char. Since the value will always be within 0-255.

Any opinion ?
(0001792)
Denis Shamonin   
2004-12-10 05:23   
Agree, unsigned char looks more logical.
Also FLTK color model based on unsigned char
http://www.fltk.org/doc-1.1/drawing.html#colors [^]
(0036755)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.