[GUI] Remove dark fringe around letters (#21536)

Closes #12394

Co-authored-by: Kacper Donat <kacper@kadet.net>
This commit is contained in:
xtemp09
2025-06-23 09:24:51 +07:00
committed by GitHub
parent b9b57f8c02
commit 0a9a16ffe3
3 changed files with 6 additions and 3 deletions

View File

@@ -134,6 +134,7 @@ SoDatumLabel::SoDatumLabel()
SO_NODE_ADD_FIELD(name, ("Helvetica"));
SO_NODE_ADD_FIELD(size, (10.F));
SO_NODE_ADD_FIELD(lineWidth, (2.F));
SO_NODE_ADD_FIELD(sampling, (2.F));
SO_NODE_ADD_FIELD(datumtype, (SoDatumLabel::DISTANCE));
@@ -187,7 +188,8 @@ void SoDatumLabel::drawImage()
QColor front;
front.setRgbF(t[0],t[1], t[2]);
QImage image(w, h,QImage::Format_ARGB32_Premultiplied);
QImage image(w * sampling.getValue(), h * sampling.getValue(), QImage::Format_ARGB32_Premultiplied);
image.setDevicePixelRatio(sampling.getValue());
image.fill(0x00000000);
QPainter painter(&image);
@@ -1165,7 +1167,7 @@ void SoDatumLabel::getDimension(float scale, int& srcw, int& srch)
srch = imgsize[1];
float aspectRatio = (float) srcw / (float) srch;
this->imgHeight = scale * (float) (srch);
this->imgHeight = scale * (float) (srch) / sampling.getValue();
this->imgWidth = aspectRatio * (float) this->imgHeight;
}

View File

@@ -85,6 +85,7 @@ public:
SoSFVec3f norm;
SoSFImage image;
SoSFFloat lineWidth;
SoSFFloat sampling;
bool useAntialiasing;
protected: