void gr_stdcalproc(const char *fname){ TGraphErrors *gg1 =(TGraphErrors*)gr3(fname); TGraphErrors *gg2= (TGraphErrors*)gr_revert(gg1); TGraphErrors *gg3 =(TGraphErrors*)gr_fitpol(gg2,"pol1"); gPad->Clear(); gg3->SetMarkerStyle(22); gg3->Draw("pawl"); }
void ColorRing::paintEvent(QPaintEvent *event) { Q_UNUSED(event); QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); QRect r = contentsRect(); r.moveTo(-r.width()/2, -r.height()/2); painter.translate(r.width()/2, r.height()/2); //painter.fillRect(r, QApplication::palette().window().color()); QConicalGradient gr(0, 0, 360); for(int i = 0; i< 12; i++) { gr.setColorAt(float(i)/12, QColor::fromHsvF(float(i)/12, 1.f, 1.f)); } painter.setBrush(QBrush(gr)); painter.setPen(Qt::NoPen); painter.drawPie(r, 0, 5760); painter.scale(RING, RING); painter.setBrush(QApplication::palette().window().color()); painter.drawPie(r, 0, 5760); painter.rotate(-col.hueF() * 360); painter.scale(r.width()*.5f, r.height()*.5f); painter.setPen(Qt::SolidLine); painter.setPen(QPen(QColor("white"))); painter.setBrush(QBrush(QColor(0,0,0,0))); painter.drawEllipse(QPointF(1.12f, .0f), 0.1f, 0.1f); painter.setPen(Qt::NoPen); if(triangleMode) { QConicalGradient gr2(points[2], 270.f); gr2.setColorAt(.0f, QColor::fromHsvF(col.hueF(), .0f, 1.f)); gr2.setColorAt(1.f/6.f, QColor::fromHsvF(col.hueF(), 1.f, 1.f)); painter.setBrush(QBrush(gr2)); painter.drawPolygon(points, 3); //painter.setCompositionMode(QPainter::CompositionMode_Multiply); QLinearGradient gr3(points[2], (points[0]+points[1])*.5f); gr3.setColorAt(.0f, QColor::fromRgbF(.0f, .0f, .0f, 1.f)); gr3.setColorAt(1.f, QColor::fromRgbF(.0f, .0f, .0f, 0.f)); painter.setBrush(QBrush(gr3)); painter.drawPolygon(points, 3); //painter.setCompositionMode(QPainter::CompositionMode_SourceOver); QPointF p1 = points[0] * col.saturationF() + points[1] * (1.f - col.saturationF()); QPointF p2 = p1 * col.valueF() + points[2] * (1.f - col.valueF()); painter.setPen(Qt::SolidLine); painter.setPen(QPen(QColor("white"))); painter.setBrush(QBrush(QColor(0,0,0,0))); painter.drawEllipse(p2, 0.1f, 0.1f); } else { // box mode QLinearGradient gr2(points2[0], points2[1]); gr2.setColorAt(.0f, QColor::fromHsvF(col.hueF(), 1.f, 1.f)); gr2.setColorAt(1.f, QColor::fromHsvF(col.hueF(), .0f, 1.f)); painter.setBrush(QBrush(gr2)); painter.drawPolygon(points2, 4); QLinearGradient gr3(points2[1], points2[2]); gr3.setColorAt(.0f, QColor::fromRgbF(.0f, .0f, .0f, 1.f)); gr3.setColorAt(1.f, QColor::fromRgbF(.0f, .0f, .0f, 0.f)); painter.setBrush(QBrush(gr3)); painter.drawPolygon(points2, 4); QPointF p1 = points2[0] * col.saturationF() + points2[1] * (1.f - col.saturationF()); QPointF p2 = p1 + (points2[2] - points2[1]) * col.valueF(); painter.setPen(Qt::SolidLine); painter.setPen(QPen(QColor("white"))); painter.setBrush(QBrush(QColor(0,0,0,0))); painter.drawEllipse(p2, 0.1f, 0.1f); } }