//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // //===========================================================================// #include #include #include #include #include #include "bitmap/float_bm.h" #include "vstdlib/vstdlib.h" #include "vstdlib/random.h" #include "tier1/strtools.h" void FloatBitMap_t::InitializeWithRandomPixelsFromAnotherFloatBM(FloatBitMap_t const &other) { for(int y=0;yPixel(x,y,c)=sum/sumweights; } } return newbm; } FloatImagePyramid_t::FloatImagePyramid_t(FloatBitMap_t const &src, ImagePyramidMode_t mode) { memset(m_pLevels,0,sizeof(m_pLevels)); m_nLevels=1; m_pLevels[0]=new FloatBitMap_t(&src); ReconstructLowerResolutionLevels(0); } void FloatImagePyramid_t::ReconstructLowerResolutionLevels(int start_level) { while( (m_pLevels[start_level]->Width>1) && (m_pLevels[start_level]->Height>1) ) { if (m_pLevels[start_level+1]) delete m_pLevels[start_level+1]; m_pLevels[start_level+1]=m_pLevels[start_level]->QuarterSizeWithGaussian(); start_level++; } m_nLevels=start_level+1; } float & FloatImagePyramid_t::Pixel(int x, int y, int component, int level) const { assert(levelPixel(x,y,component); } void FloatImagePyramid_t::WriteTGAs(char const *basename) const { for(int l=0;lWriteTGAFile(bname_out); } } FloatImagePyramid_t::~FloatImagePyramid_t(void) { for(int l=0;l