arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TFImage.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     8-8-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 /// TFImage.cpp
00019 
00020 #include "TFImage.h"
00021 #include "TFParams.h"
00022 #include <nrro/nrroUtil.h>
00023 #include <nrro/nrroTypeInfo.h>
00024 #include <mathGutz.h>
00025 
00026 
00027 using namespace gutz;
00028 
00029 TFImage::TFImage(int type, int format, int sx, int sy)
00030 : NrroImage(type, format, sx, sy)
00031 {
00032 
00033 }
00034 
00035 void TFImage::clear(const DVecType cv)
00036 {
00037 
00038    ///since we are counted an using a smartptr to ourself, we need to 
00039    /// increment the counter so we are not accidentally deleted
00040    this->_incCount(); 
00041    {
00042       nrroSet(NrroSP(this), cv.v);
00043    }
00044    this->_decCount(); 
00045 }
00046 
00047 void TFImage::clear(int kind)
00048 {
00049    //// initiallize the nrro to default values
00050    DVecType ninit(0.0);
00051    int i;
00052    /// pick the default values in the right order
00053    /// from STF::TF_4MAP_KINDS
00054    switch(kind)
00055    {
00056    case STF::TF_RGBA:
00057       for(i = 0; i <STF::TF_MAX_R; ++i) 
00058          ninit[i] = (double)STF::tfRangeType_default[STF::tfRGBA_idx[i]];
00059       break;
00060    }
00061 
00062    /// adjust them if they are integral types
00063    if(NrroType[getType()]->isIntegral()) /// integral type, use full range
00064    {
00065       for(int i=0; i<dim(0); ++i)
00066          ninit[i] = g_affine(0.0,ninit[i],1.0,
00067                              NrroType[getType()]->min(), NrroType[getType()]->max());
00068    }
00069 
00070    clear(ninit);
00071 }
00072 
00073 

Send questions, comments, and bug reports to:
jmk