Sha256: 72c1fb3ba4f318c575228cf9aaa48b21642adad877cb664639e9fdf24621d7d1

Contents?: true

Size: 1.53 KB

Versions: 35

Compression:

Stored size: 1.53 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);


}// Rays


#endif//EOH

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
rays-0.1.27 include/rays/color.h
rays-0.1.26 include/rays/color.h
rays-0.1.25 include/rays/color.h
rays-0.1.24 include/rays/color.h
rays-0.1.23 include/rays/color.h
rays-0.1.22 include/rays/color.h
rays-0.1.21 include/rays/color.h
rays-0.1.20 include/rays/color.h
rays-0.1.19 include/rays/color.h
rays-0.1.18 include/rays/color.h
rays-0.1.17 include/rays/color.h
rays-0.1.16 include/rays/color.h
rays-0.1.15 include/rays/color.h
rays-0.1.14 include/rays/color.h
rays-0.1.13 include/rays/color.h