#include "HxColor.h"
#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxColorSpace (HxImageRep im, HxColorModel fromColorSpace, HxColorModel toColorSpace) |
Color space conversion. More... |
|
Color space conversion. The function transforms the color model (see Color operations on pixel values) of all pixels in the input image via a unary pixel operation (see Images). Implementation specifics : The pixel functor : HxUpoColSpace. The image functor instantiator : HxInstantiatorColSpace.
00014 { 00015 HxString fname("HxColorSpace"); 00016 00017 if (im.isNull()) 00018 { 00019 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID); 00020 return HxImageRep(); 00021 } 00022 if (im.signature().pixelDimensionality() != 3) 00023 { 00024 HxGlobalError::instance()->reportError(fname, "ColorSpace conversions are only valid for Vec3 images", HxGlobalError::HX_GE_INVALID); 00025 return HxImageRep(); 00026 } 00027 00028 HxTagList tags; 00029 HxAddTag<HxColorModel>(tags, "fromColorSpace", fromColorSpace); 00030 HxAddTag<HxColorModel>(tags, "toColorSpace", toColorSpace); 00031 return im.unaryPixOp("colorSpace", tags); 00032 } |