Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QRadialGradient is pixelated
Forum Updated to NodeBB v4.3 + New Features

QRadialGradient is pixelated

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goocreations
    wrote on last edited by
    #1

    I've been experimenting with QRadialGradient and noticed that the gradient shows up as rectangles (pixelated). I guess this was implemented like this to reduce the intensity of the computation (it looks something like bilinear interpolation or cubic convolution), after all, it is easier to draw rectangles than circles.

    My problem is that this pixelation gets well visible at smaller circles (eg: 80, 80). Is there any way I can reduce this pixelation?
    I've added the code I'm using and the results of the drawing. I've also tried to use QPainter::HighQualityAntialiasing and QPainter::SmoothPixmapTransform, but without much change.

    @ QImage::Format format = QImage::Format_ARGB32;
    QImage buffer(qCeil(width), qCeil(height), format);
    buffer.fill(qRgba(255, 255, 255, 0));

    QPainter painter(&buffer);
    painter.setPen(Qt::NoPen);
    painter.setRenderHint(QPainter::Antialiasing, true);

    QRadialGradient radialGradient(QPointF(width / 2, height /2), qMax(width, height) / 2);
    QColor color = ViThemeManager::color(14);
    color.setAlpha(150);
    radialGradient.setColorAt(1, Qt::transparent);
    radialGradient.setColorAt(0.8, ViThemeManager::color(14));
    radialGradient.setColorAt(0.7, color);
    radialGradient.setColorAt(0, color);

    painter.setBrush(radialGradient);
    painter.drawRect(0, 0, width, height);

    painter.end();@

    !http://visore.org/other/1.png(Image 1)!

    !http://visore.org/other/2.png(Image 2)!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved