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.48 include/rays/color.h
rays-0.1.47 include/rays/color.h
rays-0.1.46 include/rays/color.h
rays-0.1.45 include/rays/color.h
rays-0.1.44 include/rays/color.h
rays-0.1.43 include/rays/color.h
rays-0.1.42 include/rays/color.h
rays-0.1.40 include/rays/color.h
rays-0.1.39 include/rays/color.h
rays-0.1.38 include/rays/color.h
rays-0.1.37 include/rays/color.h
rays-0.1.36 include/rays/color.h
rays-0.1.35 include/rays/color.h
rays-0.1.34 include/rays/color.h
rays-0.1.33 include/rays/color.h
rays-0.1.32 include/rays/color.h
rays-0.1.31 include/rays/color.h
rays-0.1.30 include/rays/color.h
rays-0.1.29 include/rays/color.h
rays-0.1.28 include/rays/color.h