#include <transfuncfile.h>
Public Methods | |
INDEXLIST * | LoadPresets (int &numPresets) |
INDEXLIST | LoadTransferFunc (const char *filename, bool &success) |
void | SaveTransferFunc (INDEXLIST &indexList, string filename) |
Private Attributes | |
struct { | |
BYTE m_pcName [10] | |
BYTE m_bNumber | |
} | m_sTransHeader |
struct { | |
int m_dBegin | |
int m_dEnd | |
BYTE m_pcAlpha | |
COLORREF m_pColor | |
} | m_sTransData |
|
INDEXLIST *CTransfuncFile::LoadPresets(int &numPresets) lädt die bis zu 10 preset transferfunktionen die direkt im menü angezeigt werden diese werden aus dem verzeichnis "transferfunctions" mit den namen "presetX.tff" wobei X für die zahlen 0 - 9 steht geladen Definition at line 45 of file transfuncfile.cpp. References INDEXLIST, and LoadTransferFunc(). Referenced by CMy3dvisApp::InitInstance().
00045 { 00046 string filename = "transferfunctions/preset_.tff"; 00047 00048 INDEXLIST *templist = new INDEXLIST[10]; 00049 INDEXLIST temp; 00050 00051 bool success; 00052 00053 numPresets = 0; 00054 for (int i = 0; i < 10; i++) { 00055 filename[24] = i + '0'; 00056 temp = LoadTransferFunc(filename.c_str(), success); 00057 if (success) 00058 templist[numPresets++] = temp; 00059 } 00060 return templist; 00061 } |
|
INDEXLIST CTransfuncFile::LoadTransferFunc(const char *filename, bool &success) lädt eine transferfunktion aus einer datei Definition at line 12 of file transfuncfile.cpp. References INDEXLIST, INDICES::m_scColor, INDICES::m_sdBegin, INDICES::m_sdEnd, and INDICES::m_ucAlpha. Referenced by LoadPresets(), and transferfuncform::OnButtonTransferImport().
00012 { 00013 success = false; 00014 FILE *file; 00015 if ((file = fopen(filename, "rb")) == NULL) { 00016 success = false; 00017 return NULL; 00018 } 00019 00020 00021 fread(&m_sTransHeader, sizeof(m_sTransHeader), 1, file); 00022 00023 INDEXLIST temp; 00024 INDICES tempInd; 00025 00026 for (int i = 0; i < m_sTransHeader.m_bNumber; i++) { 00027 fread(&m_sTransData, sizeof(m_sTransData), 1, file); 00028 tempInd.m_sdBegin = m_sTransData.m_dBegin; 00029 tempInd.m_sdEnd = m_sTransData.m_dEnd; 00030 tempInd.m_ucAlpha = m_sTransData.m_pcAlpha; 00031 tempInd.m_scColor = m_sTransData.m_pColor; 00032 temp.push_back(tempInd); 00033 } 00034 00035 fclose(file); 00036 00037 success = true; 00038 return temp; 00039 } |
|
void CTransfuncFile::SaveTransferFunc(INDEXLIST &indexList, string filename) speichert die transferfunktion in einer datei Definition at line 66 of file transfuncfile.cpp. References INDICES::m_scColor, INDICES::m_sdBegin, INDICES::m_sdEnd, m_sTransData, m_sTransHeader, and INDICES::m_ucAlpha. Referenced by transferfuncform::OnButtonTransferExport().
00066 { 00067 m_sTransHeader.m_pcName; 00068 m_sTransHeader.m_bNumber = indexList.size(); 00069 FILE *file; 00070 00071 if ((file = fopen(filename.c_str(), "wb")) == NULL) 00072 return; 00073 00074 INDICES tempInd; 00075 00076 fwrite(&m_sTransHeader, sizeof(m_sTransHeader), 1, file); 00077 for (int i = 0; i < indexList.size(); i++) { 00078 tempInd = indexList[i]; 00079 m_sTransData.m_dBegin = tempInd.m_sdBegin; 00080 m_sTransData.m_dEnd = tempInd.m_sdEnd; 00081 m_sTransData.m_pcAlpha = tempInd.m_ucAlpha; 00082 m_sTransData.m_pColor = tempInd.m_scColor; 00083 fwrite(&m_sTransData, sizeof(m_sTransData), 1, file); 00084 } 00085 00086 fclose(file); 00087 } |
|
Definition at line 18 of file transfuncfile.h. |
|
Definition at line 24 of file transfuncfile.h. |
|
Definition at line 25 of file transfuncfile.h. |
|
Definition at line 26 of file transfuncfile.h. |
|
Definition at line 17 of file transfuncfile.h. |
|
Definition at line 27 of file transfuncfile.h. |
|
Referenced by SaveTransferFunc(). |
|
Referenced by SaveTransferFunc(). |