# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.

module color;

atom color:int;

command tostr() address color_tostr;
command fromstr() address color_fromstr;

command str(s:color):str
address CLRstr
comment "Converts color to string ";

command color(s:str):color
address CLRcolor
comment "Converts string to color";

command rgb(r:int, g:int, b:int):color
address CLRrgb
comment	"Converts an RGB triplets to a color atom";

command red  (c:color) :int
address CLRred
comment	"Extracts red component from a color atom";

command green(c:color) :int
address CLRgreen
comment	"Extracts green component from a color atom";

command blue (c:color) :int
address CLRblue
comment	"Extracts blue component from a color atom";

command hue(c:color) :int
address CLRhueInt
comment	"Extracts hue component from a color atom";

command saturation(c:color) :int
address CLRsaturationInt
comment	"Extracts saturation component from a color atom";

command value(c:color) :int
address CLRvalueInt
comment	"Extracts value component from a color atom";

command hsv(h:flt,s:flt, v:flt) :color
address CLRhsv
comment	"Converts an HSV triplets to a color atom";

command hue(c:color) :flt
address CLRhue
comment	"Extracts hue component from a color atom";

command saturation(c:color) :flt
address CLRsaturation
comment	"Extracts saturation component from a color atom";

command value(c:color) :flt
address CLRvalue
comment	"Extracts value component from a color atom";

command ycc(y:int,cr:int,cb:int) :color
address CLRycc
comment	"Converts an YCC triplets to a color atom";

command luminance (c:color) :int
address CLRluminance
comment	"Extracts Y(luminance) component from a color atom";

command cr(c:color) :int
address CLRcr
comment	"Extracts Cr(red color) component from a color atom";

command cb(c:color) :int
address CLRcb
comment	"Extracts Cb(blue color) component from a color atom";

