00001 #include "TransferFunktionPunkt.h"
00002
00003 TransferFunktionPunkt::TransferFunktionPunkt()
00004 {
00005 color = new Color(0,0,0,0);
00006 dichte =0;
00007 }
00008
00009 TransferFunktionPunkt::TransferFunktionPunkt(TransferFunktionPunkt *left, TransferFunktionPunkt *right, int dichte,unsigned char a)
00010 {
00011
00012 this->dichte=dichte;
00013 float deltaL=dichte-left->dichte;
00014 float deltaR=right->dichte-dichte;
00015 float delataSum =(deltaL+deltaR);
00016 deltaL/=delataSum;
00017 deltaR/=delataSum;
00018
00019 float leftRed=(float)left->color->GetRed();
00020 float leftGreen=(float)left->color->GetGreen();
00021 float leftBlue=(float)left->color->GetBlue();
00022
00023
00024 float rightRed=(float)right->color->GetRed();
00025 float rightGreen=(float)right->color->GetGreen();
00026 float rightBlue=(float)right->color->GetBlue();
00027
00028
00029 float newRed = leftRed*deltaR+rightRed*deltaL;
00030 float newGreen = leftGreen*deltaR+rightGreen*deltaL;
00031 float newBlue = leftBlue*deltaR+rightBlue*deltaL;
00032
00033
00034 color=new Color((const int)newRed,(const int)newGreen,(const int)newBlue, (const int)a);
00035 }
00036 TransferFunktionPunkt::~TransferFunktionPunkt()
00037 {
00038 delete color;
00039 }
00040 int TransferFunktionPunkt::getDichte()
00041 {
00042 return dichte;
00043 }
00044 void TransferFunktionPunkt::setDichte(int dichte)
00045 {
00046 this->dichte=dichte;
00047 }
00048
00049 void TransferFunktionPunkt::setAlfa(unsigned char a)
00050 {
00051 color->SetAlpha(a);
00052 }
00053 unsigned char TransferFunktionPunkt::getAlfa()
00054 {
00055 return color->GetAlpha();
00056 }
00057 void TransferFunktionPunkt::setColor()
00058 {
00059 Color::chooseColor(*this->color);
00060 }
00061 void TransferFunktionPunkt::setColor(Color * color)
00062 {
00063 this->color = color;
00064 }
00065 Color* TransferFunktionPunkt::getColor()
00066 {
00067 return color;
00068 }
00069
00070