diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2017-01-25 19:45:45 -0200 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2017-01-25 19:45:45 -0200 |
commit | 9f17be8af02011f04d188ce991921f6eb0ecf792 (patch) | |
tree | 16ee4a2ef24b55af7dfb02a50d57acc384c48526 /Project/TransferFunction.cpp | |
parent | bdb0625280d827ba7333b6fc9d6c6534e0720100 (diff) | |
download | PSP.git-9f17be8af02011f04d188ce991921f6eb0ecf792.tar.gz PSP.git-9f17be8af02011f04d188ce991921f6eb0ecf792.tar.xz PSP.git-9f17be8af02011f04d188ce991921f6eb0ecf792.zip |
Several graphic tools implemented, tf start
Diffstat (limited to 'Project/TransferFunction.cpp')
-rw-r--r-- | Project/TransferFunction.cpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/Project/TransferFunction.cpp b/Project/TransferFunction.cpp index 514ca9c..6bb03ae 100644 --- a/Project/TransferFunction.cpp +++ b/Project/TransferFunction.cpp @@ -2,9 +2,60 @@ TransferFunction::TransferFunction() { + // Superscript unicode numbers + m_supNumber[0] = L'\u2070'; + m_supNumber[1] = L'\u00B9'; + m_supNumber[2] = L'\u00B2'; + m_supNumber[3] = L'\u00B3'; + m_supNumber[4] = L'\u2074'; + m_supNumber[5] = L'\u2075'; + m_supNumber[6] = L'\u2076'; + m_supNumber[7] = L'\u2077'; + m_supNumber[8] = L'\u2078'; + m_supNumber[9] = L'\u2079'; + + wxString str = ""; + for(int i = 0; i < 10; i++) { + str += "0,1s" + wxString(m_supNumber[i]) + " "; + } + SetText(str, ""); + + m_width = 100; + m_height = 50; + SetPosition(m_position); // Update rect; } -TransferFunction::~TransferFunction() +TransferFunction::~TransferFunction() {} + +void TransferFunction::Draw(wxPoint2DDouble translation, double scale) const { + if(m_selected) { + glColor4dv(m_selectionColour.GetRGBA()); + double borderSize = (m_borderSize * 2.0 + 1.0) / scale; + DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); + } + glColor4d(1.0, 1.0, 1.0, 1.0); + DrawRectangle(m_position, m_width, m_height); + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); + + glEnable(GL_TEXTURE_2D); + glColor4d(0.0, 0.0, 0.0, 1.0); + m_glStringNum->bind(); + m_glStringNum->render(m_position.m_x, m_position.m_y); + glDisable(GL_TEXTURE_2D); } +void TransferFunction::SetText(wxString numerator, wxString denominator) +{ + wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); + wxScreenDC dc; + + if(m_glStringNum) { + delete m_glStringNum; + m_glStringNum = NULL; + } + m_glStringNum = new wxGLString(numerator); + m_glStringNum->setFont(font); + m_glStringNum->consolidate(&dc); +} |