#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxReflect (HxImageRep img, int doX, int doY, int doZ=1) |
Reflection. More... |
|
Reflection.
00014 { 00015 HxString fname("HxReflect"); 00016 00017 if (img.isNull()) 00018 { 00019 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID); 00020 return HxImageRep(); 00021 } 00022 00023 if (img.dimensionality() == 2) { 00024 HxMatrix m = 00025 HxMatrix::translate2d(img.dimensionSize(1)/2 - 0.5, 00026 img.dimensionSize(2)/2 - 0.5) * 00027 HxMatrix::reflect2d(doX, doY) * 00028 HxMatrix::translate2d(-img.dimensionSize(1)/2 + 0.5, 00029 -img.dimensionSize(2)/2 + 0.5); 00030 return img.geometricOp2d(m, NEAREST, FORWARD, 0, HxValue(0)); 00031 } else { 00032 HxEnvironment::instance()->errorStream() 00033 << "3d reflection not implemented yet" << STD_ENDL; 00034 HxEnvironment::instance()->flush(); 00035 return HxImageRep(); 00036 } 00037 } |