summaryrefslogtreecommitdiffstats
path: root/src/datavis3d
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-04-12 12:48:57 +0300
committerMika Salmela <mika.salmela@digia.com>2013-04-12 17:53:24 +0300
commitbc6b83691901e4fa897e61182acf9b2ddaddc804 (patch)
treeaef06ad48c1f9c16db4c363974dd177d7a7ae984 /src/datavis3d
parent7dedf74c6be8c23bd1a5640cbe0c960a36c6b9db (diff)
Improved label drawing and font size adjustment
Change-Id: I3421b6f6774b44b02aecef87afc1ceaafebc9fbe Change-Id: I3421b6f6774b44b02aecef87afc1ceaafebc9fbe Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavis3d')
-rw-r--r--src/datavis3d/engine/meshes/plane.obj14
-rw-r--r--src/datavis3d/engine/q3dbars.cpp70
-rw-r--r--src/datavis3d/engine/q3dbars.h12
-rw-r--r--src/datavis3d/engine/q3dbars_p.h2
-rw-r--r--src/datavis3d/engine/theme.cpp24
-rw-r--r--src/datavis3d/utils/texturehelper.cpp4
-rw-r--r--src/datavis3d/utils/utils.cpp71
-rw-r--r--src/datavis3d/utils/utils_p.h8
8 files changed, 132 insertions, 73 deletions
diff --git a/src/datavis3d/engine/meshes/plane.obj b/src/datavis3d/engine/meshes/plane.obj
index 0483285b..96ac0dd7 100644
--- a/src/datavis3d/engine/meshes/plane.obj
+++ b/src/datavis3d/engine/meshes/plane.obj
@@ -1,15 +1,15 @@
# Blender v2.66 (sub 0) OBJ File: 'plane.blend'
# www.blender.org
o Plane
-v -1.000000 1.000000 0.000000
-v -1.000000 -1.000000 0.000001
-v 1.000000 1.000000 -0.000001
+v -1.000000 -1.000000 -0.000001
+v -1.000000 1.000000 -0.000000
v 1.000000 -1.000000 0.000000
+v 1.000000 1.000000 0.000001
vt 0.003058 1.000000
+vt 0.000000 0.003058
vt 1.000000 0.996942
vt 0.996942 0.000000
-vt 0.000000 0.003058
-vn 0.000001 0.000001 1.000000
+vn -0.000001 -0.000001 1.000000
s off
-f 2/1/1 4/2/1 3/3/1
-f 1/4/1 2/1/1 3/3/1
+f 2/1/1 1/2/1 4/3/1
+f 1/2/1 3/4/1 4/3/1
diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp
index 81a46fb9..2ee69338 100644
--- a/src/datavis3d/engine/q3dbars.cpp
+++ b/src/datavis3d/engine/q3dbars.cpp
@@ -447,26 +447,29 @@ void Q3DBars::drawZoomScene()
#ifndef USE_PAINTER_TEXT
// Draw labels (or values of bars)
- const bool transparentLabel = false;
d_ptr->m_labelShader->bind();
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
- if (transparentLabel) {
+ if (d_ptr->m_labelTransparency > TransparencyNone) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
for (int col = 0; col < d_ptr->m_zoomSelection->d_ptr->row().size(); col++) {
+ //
// TODO: Optimize! Create textures only when zoomselection changes! Store the texture id's into zoomselection
+ //
QDataItem *item = d_ptr->m_zoomSelection->d_ptr->getItem(col);
// Create labels
// Print label into a QImage using QPainter
QImage label = Utils::printTextToImage(item->d_ptr->valueStr()
, d_ptr->m_theme->m_textBackgroundColor
, d_ptr->m_theme->m_textColor
- , transparentLabel);
+ , d_ptr->m_labelTransparency);
// Insert text texture into label
- GLuint labelTexture = d_ptr->m_textureHelper->create2DTexture(label, false, false);
+ GLuint labelTexture = d_ptr->m_textureHelper->create2DTexture(label, true, true);
+
+ // TODO: Fix drawing of labels when in ZoomColumn -mode
// Draw label
QMatrix4x4 modelMatrix;
@@ -484,10 +487,13 @@ void Q3DBars::drawZoomScene()
// Rotate
modelMatrix.rotate(-45.0f, 0.0f, 0.0f, 1.0f);
- // TODO: Calculate uniform scaling from font height
+ // Calculate scale factor to get uniform font size
+ float scaledFontSize = 0.05f + d_ptr->m_fontSize / 500.0f;
+ float scaleFactor = scaledFontSize / (float)label.height();
+
// Scale label based on text size
- modelMatrix.scale(QVector3D((float)label.width() / 450.0f
- , (float)label.height() / 450.0f
+ modelMatrix.scale(QVector3D((float)label.width() * scaleFactor
+ , scaledFontSize
, 0.0f));
MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
@@ -532,7 +538,7 @@ void Q3DBars::drawZoomScene()
}
glDisable(GL_TEXTURE_2D);
- if (transparentLabel)
+ if (d_ptr->m_labelTransparency > TransparencyNone)
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
@@ -581,9 +587,8 @@ void Q3DBars::drawScene()
// Calculate drawing order
//qDebug() << "viewMatrix z" << viewMatrix.row(0).z(); // jos negatiivinen, käännä bar -piirtojärjestys
//qDebug() << "viewMatrix x" << viewMatrix.row(0).x(); // jos negatiivinen, käännä row -piirtojärjestys
- // TODO: Needs more tuning unless we get depth test working correctly
- // TODO: If depth test gets fixed, the draw order should be reversed for best performance (ie. draw front objects first)
- if (viewMatrix.row(0).x() < 0) {
+ // Draw order is reversed to optimize amount of drawing (ie. draw front objects first, depth test handles not needing to draw objects behind them)
+ if (viewMatrix.row(0).x() > 0) {
startRow = 0;
stopRow = d_ptr->m_sampleCount.y();
stepRow = 1;
@@ -592,7 +597,7 @@ void Q3DBars::drawScene()
stopRow = -1;
stepRow = -1;
}
- if (viewMatrix.row(0).z() > 0) {
+ if (viewMatrix.row(0).z() < 0) {
startBar = 0;
stopBar = d_ptr->m_sampleCount.x();
stepBar = 1;
@@ -703,35 +708,8 @@ void Q3DBars::drawScene()
glEnable(GL_DITHER);
// Read color under cursor
- // TODO: Move into a separate function?
if (Q3DBarsPrivate::MouseOnScene == d_ptr->m_mousePressed) {
-#ifndef USE_HAX0R_SELECTION
- glBindFramebuffer(GL_FRAMEBUFFER, d_ptr->m_framebufferSelection);
-#endif
- // This is the only one that works with ANGLE (ES 2.0)
- // Item count will be limited to 256*256*256
- GLubyte pixel[4];
- glReadPixels(d_ptr->m_mousePos.x(), height() - d_ptr->m_mousePos.y(), 1, 1,
- GL_RGBA, GL_UNSIGNED_BYTE, (void *)pixel);
-
- // These work with desktop OpenGL
- // They offer a lot higher possible object count and a possibility to use object id's
- //GLuint pixel2[3];
- //glReadPixels(d_ptr->m_mousePos.x(), height() - d_ptr->m_mousePos.y(), 1, 1,
- // GL_RGB, GL_UNSIGNED_INT, (void *)pixel2);
-
- //GLfloat pixel3[3];
- //glReadPixels(d_ptr->m_mousePos.x(), height() - d_ptr->m_mousePos.y(), 1, 1,
- // GL_RGB, GL_FLOAT, (void *)pixel3);
-
- //qDebug() << "rgba" << pixel[0] << pixel[1] << pixel[2];// << pixel[3];
- //qDebug() << "rgba2" << pixel2[0] << pixel2[1] << pixel2[2];
- //qDebug() << "rgba3" << pixel3[0] << pixel3[1] << pixel3[2];
- selection = QVector3D(pixel[0], pixel[1], pixel[2]);
- //qDebug() << selection;
-#ifndef USE_HAX0R_SELECTION
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-#endif
+ selection = Utils::getSelection(d_ptr->m_mousePos, height());
}
// Release selection shader
@@ -1317,6 +1295,16 @@ void Q3DBars::setWindowTitle(const QString &title)
setTitle(title);
}
+void Q3DBars::setFontSize(float fontsize)
+{
+ d_ptr->m_fontSize = fontsize;
+}
+
+void Q3DBars::setLabelTransparency(LabelTransparency transparency)
+{
+ d_ptr->m_labelTransparency = transparency;
+}
+
void Q3DBars::addDataRow(const QVector<float> &dataRow, const QString &labelRow
, const QVector<QString> &labelsColumn)
{
@@ -1460,6 +1448,8 @@ Q3DBarsPrivate::Q3DBarsPrivate(Q3DBars *q)
, m_zoomViewPort(0, 0, q->width(), q->height())
, m_zoomActivated(false)
, m_textureHelper(new TextureHelper())
+ , m_labelTransparency(Q3DBars::TransparencyNone)
+ , m_fontSize(10.0f)
{
}
diff --git a/src/datavis3d/engine/q3dbars.h b/src/datavis3d/engine/q3dbars.h
index bb5eb48e..f2a978a4 100644
--- a/src/datavis3d/engine/q3dbars.h
+++ b/src/datavis3d/engine/q3dbars.h
@@ -98,6 +98,12 @@ public:
ThemeLight
};
+ enum LabelTransparency {
+ TransparencyNone = 0, // Full solid, using colors from theme
+ TransparencyFromTheme, // Use colors and transparencies from theme
+ TransparencyNoBackground // Draw just text on transparent background
+ };
+
// TODO: Implement modes for "zooming" into selected row/column, ie. display only selected row/column
// in full window and 3d chart in a small viewport
enum SelectionMode {
@@ -183,6 +189,12 @@ public:
// Set window title
void setWindowTitle(const QString &title);
+ // Font size adjustment (should it be in enum (smallest, smaller, small, normal, large, larger, largest), or just float?
+ void setFontSize(float fontsize);
+
+ // Label transparency adjustment
+ void setLabelTransparency(LabelTransparency transparency);
+
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
diff --git a/src/datavis3d/engine/q3dbars_p.h b/src/datavis3d/engine/q3dbars_p.h
index fcec1304..1a611915 100644
--- a/src/datavis3d/engine/q3dbars_p.h
+++ b/src/datavis3d/engine/q3dbars_p.h
@@ -137,6 +137,8 @@ public:
QRect m_zoomViewPort;
bool m_zoomActivated;
TextureHelper *m_textureHelper;
+ Q3DBars::LabelTransparency m_labelTransparency;
+ float m_fontSize;
};
QTCOMMERCIALDATAVIS3D_END_NAMESPACE
diff --git a/src/datavis3d/engine/theme.cpp b/src/datavis3d/engine/theme.cpp
index 99628021..fecb2498 100644
--- a/src/datavis3d/engine/theme.cpp
+++ b/src/datavis3d/engine/theme.cpp
@@ -55,7 +55,7 @@ Theme::Theme()
, m_backgroundColor(QColor(Qt::gray))
, m_windowColor(QColor(Qt::gray))
, m_textColor(QColor(Qt::white))
- , m_textBackgroundColor(QColor(Qt::black))
+ , m_textBackgroundColor(QColor(0x00, 0x00, 0x00, 0x80))
, m_highlightBarColor(QColor(Qt::red))
, m_highlightRowColor(QColor(Qt::darkRed))
, m_highlightColumnColor(QColor(Qt::darkMagenta))
@@ -95,7 +95,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
GetGValue(colorWindow),
GetBValue(colorWindow));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(QRgb(0xe2e2e2));
m_highlightRowColor = QColor(QRgb(0xf2f2f2));
m_highlightColumnColor = QColor(QRgb(0xf2f2f2));
@@ -110,7 +110,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xffffff));
m_windowColor = QColor(QRgb(0xffffff));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(QRgb(0xe2e2e2));
m_highlightRowColor = QColor(QRgb(0xf2f2f2));
m_highlightColumnColor = QColor(QRgb(0xf2f2f2));
@@ -125,7 +125,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xffffff));
m_windowColor = QColor(QRgb(0xffffff));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(QRgb(0xe2e2e2));
m_highlightRowColor = QColor(QRgb(0xf2f2f2));
m_highlightColumnColor = QColor(QRgb(0xf2f2f2));
@@ -140,7 +140,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xffffff));
m_windowColor = QColor(QRgb(0xffffff));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(QRgb(0xe2e2e2));
m_highlightRowColor = QColor(QRgb(0xf2f2f2));
m_highlightColumnColor = QColor(QRgb(0xf2f2f2));
@@ -159,7 +159,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0x056189));
m_windowColor = QColor(QRgb(0x101a31));
m_textColor = QColor(QRgb(0xffffff));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(Qt::blue);
m_highlightRowColor = QColor(Qt::darkBlue);
m_highlightColumnColor = QColor(Qt::darkBlue);
@@ -177,7 +177,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xffffff));
m_windowColor = QColor(QRgb(0xffffff));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(Qt::white);
m_highlightRowColor = QColor(Qt::lightGray);
m_highlightColumnColor = QColor(Qt::lightGray);
@@ -195,7 +195,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xffffff));
m_windowColor = QColor(QRgb(0xffffff));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(Qt::lightGray);
m_highlightRowColor = QColor(Qt::gray);
m_highlightColumnColor = QColor(Qt::gray);
@@ -213,7 +213,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xf3ece0));
m_windowColor = QColor(QRgb(0xf3ece0));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xb5b0a7));
+ m_textBackgroundColor = QColor(0xb5, 0xb0, 0xa7, 0x80);
m_highlightBarColor = QColor(Qt::yellow);
m_highlightRowColor = QColor(Qt::darkYellow);
m_highlightColumnColor = QColor(Qt::darkYellow);
@@ -231,7 +231,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0x2e303a));
m_windowColor = QColor(QRgb(0x121218));
m_textColor = QColor(QRgb(0xffffff));
- m_textBackgroundColor = QColor(QRgb(0x86878c));
+ m_textBackgroundColor = QColor(0x86, 0x87, 0x8c, 0x80);
m_highlightBarColor = QColor(Qt::gray);
m_highlightRowColor = QColor(Qt::darkGray);
m_highlightColumnColor = QColor(Qt::darkGray);
@@ -249,7 +249,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xeeeeee));
m_windowColor = QColor(QRgb(0x000000));
m_textColor = QColor(QRgb(0x181818));
- m_textBackgroundColor = QColor(QRgb(0x8c8c8c));
+ m_textBackgroundColor = QColor(0x8c, 0x8c, 0x8c, 0x80);
m_highlightBarColor = QColor(Qt::black);
m_highlightRowColor = QColor(Qt::white);
m_highlightColumnColor = QColor(Qt::white);
@@ -267,7 +267,7 @@ void Theme::useTheme(Q3DBars::ColorTheme theme)
m_backgroundColor = QColor(QRgb(0xffffff));
m_windowColor = QColor(QRgb(0xffffff));
m_textColor = QColor(QRgb(0x404044));
- m_textBackgroundColor = QColor(QRgb(0xd6d6d6));
+ m_textBackgroundColor = QColor(0xd6, 0xd6, 0xd6, 0x80);
m_highlightBarColor = QColor(Qt::white);
m_highlightRowColor = QColor(Qt::lightGray);
m_highlightColumnColor = QColor(Qt::lightGray);
diff --git a/src/datavis3d/utils/texturehelper.cpp b/src/datavis3d/utils/texturehelper.cpp
index f6308ea6..0cccc5e7 100644
--- a/src/datavis3d/utils/texturehelper.cpp
+++ b/src/datavis3d/utils/texturehelper.cpp
@@ -87,8 +87,8 @@ GLuint TextureHelper::createCubeMapTexture(const QImage &image, bool useTrilinea
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureId);
QImage glTexture = convertToGLFormat(image);
- glTexImage2D(GL_TEXTURE_CUBE_MAP, 0, GL_RGB, glTexture.width(), glTexture.height()
- , 0, GL_RGB, GL_UNSIGNED_BYTE, glTexture.bits());
+ glTexImage2D(GL_TEXTURE_CUBE_MAP, 0, GL_RGBA, glTexture.width(), glTexture.height()
+ , 0, GL_RGBA, GL_UNSIGNED_BYTE, glTexture.bits());
if (useTrilinearFiltering) {
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
diff --git a/src/datavis3d/utils/utils.cpp b/src/datavis3d/utils/utils.cpp
index f7138602..770e24f6 100644
--- a/src/datavis3d/utils/utils.cpp
+++ b/src/datavis3d/utils/utils.cpp
@@ -142,50 +142,101 @@ void Utils::printText(QPainter *painter, const QString &text, const QPoint &posi
}
QImage Utils::printTextToImage(const QString &text, const QColor &bgrColor, const QColor &txtColor
- , bool noBackground)
+ , Q3DBars::LabelTransparency transparency)
{
// Calculate text dimensions
- QFont valueFont = QFont(QStringLiteral("Arial"), 11);
+ QFont valueFont = QFont(QStringLiteral("Arial"), 30);
valueFont.setBold(true);
QFontMetrics valueFM(valueFont);
int valueStrWidth = valueFM.width(text);
int valueStrHeight = valueFM.height();
QSize labelSize;
- if (noBackground)
+ if (Q3DBars::TransparencyNoBackground == transparency)
labelSize = QSize(valueStrWidth, valueStrHeight);
else
- labelSize = QSize(valueStrWidth + 10, valueStrHeight + 10);
+ labelSize = QSize(valueStrWidth + 30, valueStrHeight + 30);
// Create image
QImage image = QImage(labelSize, QImage::Format_ARGB32);
+ image.fill(Qt::transparent);
// Init painter
QPainter painter(&image);
// Paint text
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setCompositionMode(QPainter::CompositionMode_Source);
- if (noBackground) {
- painter.setBackgroundMode(Qt::OpaqueMode);
- painter.setBackground(Qt::transparent);
- painter.setBrush(Qt::transparent);
+ switch (transparency) {
+ case Q3DBars::TransparencyNoBackground:
+ {
painter.setFont(valueFont);
painter.setPen(txtColor);
painter.drawText(0, 0
, valueStrWidth, valueStrHeight
, Qt::AlignCenter | Qt::AlignVCenter
, text);
- } else {
+ break;
+ }
+ case Q3DBars::TransparencyFromTheme:
+ {
+ painter.setBrush(QBrush(bgrColor));
+ painter.setPen(bgrColor);
+ painter.drawRoundedRect(0, 0, labelSize.width(), labelSize.height(), 10.0, 10.0f);
+ painter.setFont(valueFont);
+ painter.setPen(txtColor);
+ painter.drawText(15, 15
+ , valueStrWidth, valueStrHeight
+ , Qt::AlignCenter | Qt::AlignVCenter
+ , text);
+ break;
+ }
+ case Q3DBars::TransparencyNone:
+ {
painter.setBrush(QBrush(bgrColor));
painter.setPen(bgrColor);
painter.drawRect(0, 0, labelSize.width(), labelSize.height());
painter.setFont(valueFont);
painter.setPen(txtColor);
- painter.drawText(5, 5
+ painter.drawText(15, 15
, valueStrWidth, valueStrHeight
, Qt::AlignCenter | Qt::AlignVCenter
, text);
+ break;
+ }
}
return image;
}
+QVector3D Utils::getSelection(QPoint mousepos, int height)
+{
+ QVector3D selectedColor;
+#ifndef USE_HAX0R_SELECTION
+ //glBindFramebuffer(GL_FRAMEBUFFER, d_ptr->m_framebufferSelection);
+#endif
+ // This is the only one that works with ANGLE (ES 2.0)
+ // Item count will be limited to 256*256*256
+ GLubyte pixel[4];
+ glReadPixels(mousepos.x(), height - mousepos.y(), 1, 1,
+ GL_RGBA, GL_UNSIGNED_BYTE, (void *)pixel);
+
+ // These work with desktop OpenGL
+ // They offer a lot higher possible object count and a possibility to use object id's
+ //GLuint pixel2[3];
+ //glReadPixels(d_ptr->m_mousePos.x(), height() - d_ptr->m_mousePos.y(), 1, 1,
+ // GL_RGB, GL_UNSIGNED_INT, (void *)pixel2);
+
+ //GLfloat pixel3[3];
+ //glReadPixels(d_ptr->m_mousePos.x(), height() - d_ptr->m_mousePos.y(), 1, 1,
+ // GL_RGB, GL_FLOAT, (void *)pixel3);
+
+ //qDebug() << "rgba" << pixel[0] << pixel[1] << pixel[2];// << pixel[3];
+ //qDebug() << "rgba2" << pixel2[0] << pixel2[1] << pixel2[2];
+ //qDebug() << "rgba3" << pixel3[0] << pixel3[1] << pixel3[2];
+ selectedColor = QVector3D(pixel[0], pixel[1], pixel[2]);
+ //qDebug() << selection;
+#ifndef USE_HAX0R_SELECTION
+ //glBindFramebuffer(GL_FRAMEBUFFER, 0);
+#endif
+ return selectedColor;
+}
+
QTCOMMERCIALDATAVIS3D_END_NAMESPACE
diff --git a/src/datavis3d/utils/utils_p.h b/src/datavis3d/utils/utils_p.h
index 028cd716..45de673e 100644
--- a/src/datavis3d/utils/utils_p.h
+++ b/src/datavis3d/utils/utils_p.h
@@ -43,6 +43,7 @@
#define UTILS_P_H
#include "qdatavis3dglobal.h"
+#include "q3dbars.h"
class QVector3D;
class QColor;
@@ -59,8 +60,11 @@ public:
static QVector3D vectorFromColor(const QColor &color);
static void printText(QPainter *painter, const QString &text, const QPoint &position
, bool absoluteCoords = true, qreal rotation = 0, qreal scale = 1.0f);
- static QImage printTextToImage(const QString &text, const QColor &bgrColor
- , const QColor &txtColor, bool noBackground = false);
+ static QImage printTextToImage(const QString &text
+ , const QColor &bgrColor
+ , const QColor &txtColor
+ , Q3DBars::LabelTransparency transparency);
+ static QVector3D getSelection(QPoint mousepos, int height);
};
QTCOMMERCIALDATAVIS3D_END_NAMESPACE