#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 |
|
Definition at line 36 of file transfuncfile.cpp. References INDEXLIST, and LoadTransferFunc(). Referenced by CMy3dvisApp::InitInstance().
00036 { 00037 string filename = "transferfunctions/preset_.tff"; 00038 00039 INDEXLIST *templist = new INDEXLIST[10]; 00040 INDEXLIST temp; 00041 00042 bool success; 00043 00044 numPresets = 0; 00045 for (int i = 0; i < 10; i++) { 00046 filename[24] = i + '0'; 00047 temp = LoadTransferFunc(filename.c_str(), success); 00048 if (success) 00049 templist[numPresets++] = temp; 00050 } 00051 return templist; 00052 } |
|
Definition at line 6 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().
00006 { 00007 success = false; 00008 FILE *file; 00009 if ((file = fopen(filename, "rb")) == NULL) { 00010 success = false; 00011 return NULL; 00012 } 00013 00014 00015 fread(&m_sTransHeader, sizeof(m_sTransHeader), 1, file); 00016 00017 INDEXLIST temp; 00018 INDICES tempInd; 00019 00020 for (int i = 0; i < m_sTransHeader.m_bNumber; i++) { 00021 fread(&m_sTransData, sizeof(m_sTransData), 1, file); 00022 tempInd.m_sdBegin = m_sTransData.m_dBegin; 00023 tempInd.m_sdEnd = m_sTransData.m_dEnd; 00024 tempInd.m_ucAlpha = m_sTransData.m_pcAlpha; 00025 tempInd.m_scColor = m_sTransData.m_pColor; 00026 temp.push_back(tempInd); 00027 } 00028 00029 fclose(file); 00030 00031 success = true; 00032 return temp; 00033 } |
|
Definition at line 55 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().
00055 { 00056 m_sTransHeader.m_pcName; 00057 m_sTransHeader.m_bNumber = indexList.size(); 00058 FILE *file; 00059 00060 if ((file = fopen(filename.c_str(), "wb")) == NULL) 00061 return; 00062 00063 INDICES tempInd; 00064 00065 fwrite(&m_sTransHeader, sizeof(m_sTransHeader), 1, file); 00066 for (int i = 0; i < indexList.size(); i++) { 00067 tempInd = indexList[i]; 00068 m_sTransData.m_dBegin = tempInd.m_sdBegin; 00069 m_sTransData.m_dEnd = tempInd.m_sdEnd; 00070 m_sTransData.m_pcAlpha = tempInd.m_ucAlpha; 00071 m_sTransData.m_pColor = tempInd.m_scColor; 00072 fwrite(&m_sTransData, sizeof(m_sTransData), 1, file); 00073 } 00074 00075 fclose(file); 00076 } |
|
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(). |