5
#include <gdk-pixbuf/gdk-pixdata.h>
7
#include "../imagesource/imagesource_cms.h"
10
#include "ppeffect_temperature.h"
11
#include "ppeffect_temperature_icon.cpp"
13
PPEffect_Temperature::PPEffect_Temperature(PPEffectHeader &header,enum PPEFFECT_STAGE stage)
14
: PPEffect(header,stage), tempchange(0), transform(NULL)
19
PPEffect_Temperature::~PPEffect_Temperature()
26
void PPEffect_Temperature::MakeTransform(IS_TYPE type)
28
CMSRGBGamma RGBGamma(2.2,2.2,2.2);
29
CMSGamma GreyGamma(2.2);
30
CMSWhitePoint srcwp(6500+tempchange);
31
CMSWhitePoint dstwp(6500);
33
switch(STRIP_ALPHA(type))
36
source=new CMSProfile(CMSPrimaries_Rec709,RGBGamma,srcwp);
39
source=new CMSProfile(GreyGamma,srcwp);
42
throw "Only RGB and Greyscale images are currently supported";
45
throw "Can't create source profile";
47
CMSProfile dest(CMSPrimaries_Rec709,RGBGamma,dstwp);
48
transform=new CMSTransform(source,&dest,LCMSWRAPPER_INTENT_ABSOLUTE_COLORIMETRIC);
53
ImageSource *PPEffect_Temperature::Apply(ImageSource *source)
56
MakeTransform(source->type);
58
if(transform->GetInputColourSpace()!=STRIP_ALPHA(source->type))
62
MakeTransform(source->type);
64
return(new ImageSource_CMS(source,transform));
68
void PPEffect_Temperature::SetTempChange(int tempchange)
73
this->tempchange=tempchange;
77
GdkPixbuf *PPEffect_Temperature::icon=NULL;
79
GdkPixbuf *PPEffect_Temperature::GetIcon_static()
86
if(!gdk_pixdata_deserialize(&pd,sizeof(PPEffect_Temperature_Icon),PPEffect_Temperature_Icon,&err))
89
if(!(icon=gdk_pixbuf_from_pixdata(&pd,false,&err)))