Sha256: bbf5e4f1cf64a110ac9418f3d35391f5a5cb40dc4a77477ef5182b54898f58ae

Contents?: true

Size: 1.62 KB

Versions: 8

Compression:

Stored size: 1.62 KB

Contents

// -*- c++ -*-
#pragma once
#ifndef __RAYS_COLOR_H__
#define __RAYS_COLOR_H__


#include <xot/util.h>
#include <rays/defs.h>
#include <rays/coord.h>


namespace Rays
{


	class ColorSpace;


	struct Color : public Coord4
	{

		typedef Color This;

		typedef Coord4 Super;

		Color (float gray = 0,                     float alpha = 1);

		Color (float red, float green, float blue, float alpha = 1);

		Color (void* pixel, const ColorSpace& cs);

		Color dup () const;

		Color& reset (float gray = 0,                     float alpha = 1);

		Color& reset (float red, float green, float blue, float alpha = 1);

		Color& reset8 (int gray = 0,                 int alpha = 255);

		Color& reset8 (int red, int green, int blue, int alpha = 255);

		Color& reset (const void* pixel, const ColorSpace& cs);

		void     get (      void* pixel, const ColorSpace& cs) const;

		operator bool () const;

		bool operator ! () const;

		friend bool operator == (const This& lhs, const This& rhs);

		friend bool operator != (const This& lhs, const This& rhs);

		static uchar float2uchar (float value)
		{
			return (uchar) Xot::clip(0.f, 255.f, value * 255);
		}

		static float uchar2float (int value)
		{
			return value / 255.f;
		}

	};// Color


	Color gray  (float gray, float alpha = 1);

	Color gray8 (int   gray, int   alpha = 255);

	Color rgb  (float red, float green, float blue, float alpha = 1);

	Color rgb8 (int   red, int   green, int   blue, int   alpha = 255);

	Color    hsv (float  hue, float  saturation, float  value, float alpha = 1);

	void get_hsv (float* hue, float* saturation, float* value, const Color& color);


}// Rays


#endif//EOH

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rays-0.3.4 include/rays/color.h
rays-0.3.3 include/rays/color.h
rays-0.3.2 include/rays/color.h
rays-0.3.1 include/rays/color.h
rays-0.3 include/rays/color.h
rays-0.2.1 include/rays/color.h
rays-0.2 include/rays/color.h
rays-0.1.49 include/rays/color.h