|
|
|
#include "modgmt_func.h"
|
|
|
|
|
|
|
|
ObjectBase* GMT_Header(const ObjectList* input)
|
|
|
|
{
|
|
|
|
return new ObjectString(header);
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectBase* GMT_Footer(const ObjectList* input)
|
|
|
|
{
|
|
|
|
return new ObjectString(footer);
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectBase* GMT_ColorGray(const ObjectList* input)
|
|
|
|
{
|
|
|
|
struct gmt_color c;
|
|
|
|
bool suc=true;
|
|
|
|
Base2RGB g(input,0);
|
|
|
|
Base2Transp t(input,1);
|
|
|
|
|
|
|
|
c.model=gmt_color::GRAY;
|
|
|
|
c.gray=g(&suc);
|
|
|
|
c.transparency=t(&suc);
|
|
|
|
|
|
|
|
if(suc) return new ObjectGMTColor(c);
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectBase* GMT_ColorRGB(const ObjectList* input)
|
|
|
|
{
|
|
|
|
struct gmt_color c;
|
|
|
|
bool suc=true;
|
|
|
|
Base2RGB r(input,0),g(input,1),b(input,2);
|
|
|
|
Base2Transp t(input,3);
|
|
|
|
|
|
|
|
c.model=gmt_color::RGB;
|
|
|
|
c.r=r(&suc);
|
|
|
|
c.g=g(&suc);
|
|
|
|
c.b=b(&suc);
|
|
|
|
c.transparency=t(&suc);
|
|
|
|
|
|
|
|
if(suc) return new ObjectGMTColor(c);
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectBase* GMT_ColorHSV(const ObjectList* input)
|
|
|
|
{
|
|
|
|
struct gmt_color c;
|
|
|
|
bool suc=true;
|
|
|
|
Base2Hue h(input,0);
|
|
|
|
Base2SV s(input,1),v(input,2);
|
|
|
|
Base2Transp t(input,3);
|
|
|
|
|
|
|
|
c.model=gmt_color::HSV;
|
|
|
|
c.hue=h(&suc);
|
|
|
|
c.saturation=s(&suc);
|
|
|
|
c.value=v(&suc);
|
|
|
|
c.transparency=t(&suc);
|
|
|
|
|
|
|
|
if(suc) return new ObjectGMTColor(c);
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectBase* GMT_ColorCMYK(const ObjectList* input)
|
|
|
|
{
|
|
|
|
struct gmt_color c;
|
|
|
|
bool suc=true;
|
|
|
|
Base2CMYK cyan(input,0),m(input,1),y(input,2),k(input,3);
|
|
|
|
Base2Transp t(input,4);
|
|
|
|
|
|
|
|
c.model=gmt_color::CMYK;
|
|
|
|
c.cyan=cyan(&suc);
|
|
|
|
c.magenta=m(&suc);
|
|
|
|
c.yellow=y(&suc);
|
|
|
|
c.black=k(&suc);
|
|
|
|
c.transparency=t(&suc);
|
|
|
|
|
|
|
|
if(suc) return new ObjectGMTColor(c);
|
|
|
|
else return 0;
|
|
|
|
}
|