casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ColorConversion.h
Go to the documentation of this file.
00001 //# ColorConversion.h: utilities for converting between color spaces
00002 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_COLORCONVERSION_H
00029 #define TRIALDISPLAY_COLORCONVERSION_H
00030 
00031 // <summary>
00032 // Utilities for converting between color spaces
00033 // </summary>
00034 //
00035 // <synopsis>
00036 // provides vectorized and single color conversion between RGB and
00037 // HSV color spaces.  Operates using float type with the range of
00038 // 0.0 to 1.0 for all R,G,B,H,S,V values.
00039 // </synopsis>
00040 //
00041 // <motivation>
00042 // want to be able to create something that acts like an "HSV" colormap
00043 // </motivation>
00044 //
00045 // <group name="RGB/HSV Conversion Functions">
00046 
00047 
00048 /*
00049 
00050 
00051 #include <graphics/X11/X_enter.h>
00052 #include <X11/Xlib.h>
00053 #include <graphics/X11/X_exit.h>
00054 
00055 
00056 */
00057 #include <casa/aips.h>
00058 #include <casa/Arrays/Array.h>
00059 
00060 namespace casa { //# NAMESPACE CASA - BEGIN
00061 
00062 // map a single hsv value to an rgb value
00063 // assumes h, s, and v to be in range [0, 1]. Returns r, g, b in range [0, 1].
00064 void hsvToRgb(Float h, Float s, Float v,
00065               Float &red, Float &green, Float &blue);
00066 
00067 // map an array of hsv values to an array of rgb value
00068 void hsvToRgb(const Array<Float> & h, const Array<Float> & s,
00069               const Array<Float> & v,
00070               Array<Float> & r, Array<Float> & g, Array<Float> & b);
00071 
00072 // map a single rgb value to its hsv value
00073 //Assumes r, g, and b to be in range [0, 1]. Returns h, s, v in range [0, 1].
00074 void rgbToHsv(Float r, Float g, Float b, 
00075               Float &h, Float &s, Float &v);
00076 
00077 // map an array of rgb values to an array of hsv values
00078 void rgbToHsv(const Array<Float> & r, const Array<Float> & g,
00079               const Array<Float> & b,
00080               Array<Float> & h, Array<Float> & s, Array<Float> & v);
00081 
00082 
00083 // </group>
00084 
00085 
00086 } //# NAMESPACE CASA - END
00087 
00088 #endif