void Viewportal::updatePixmap() { pixmap = QPixmap::grabWindow(QApplication::desktop()->winId (), 0, 51, screenX/2, screenY); setSimulation(false); QImage image = daltonize(pixmap.toImage(), getColorblindType()); pixmap = QPixmap::fromImage(image); setPixmap (pixmap); }
void ColorSchemeGraphicsItem::updateBrushes() { const auto parent = dynamic_cast<QWidget*>(parentWidget()); const auto penWidthF = 1.0 / DpiAware::devicePixelRatio(parent); for (uint i = 0; i < m_classes; ++i) { auto rect(m_rects[i]); auto color = m_scheme.colors(m_classes)[m_classes - i - 1]; color = daltonize(color, m_deficiency); auto brush = RGBABrush(color); // this aligns the brush pattern with the rect (since there is no way to directly set the brush origin similar to a painter) brush.setTransform(QTransform::fromTranslate( // who cares ... :P m_margin + 1, (m_padding + penWidthF) * static_cast<qreal>(i) + m_margin + 1)); rect->setBrush(brush); } }