当前位置:网站首页>QT color extraction
QT color extraction
2022-06-13 01:21:00 【Zhao_| adult】
int x = QCursor::pos().x();
int y = QCursor::pos().y();
QWindow window;
QPixmap pixmap=window.screen()->grabWindow(QApplication::desktop()->winId(),x,y,1,1);
qDebug()<<pixmap<<endl;
int red, green, blue;
if(!pixmap.isNull())
{
QImage image = pixmap.toImage();
if(!image.isNull())
{
QColor color = image.pixel(0,0);
red = color.red();
green = color.green();
blue = color.blue();
// Output 16 The color of the base
//QString hRed = QString::number(red,16).toUpper();
//QString hGreen = QString::number(green,16).toUpper();
//QString hBlue = QString::number(blue,16).toUpper();
// In this way, you can set the post conversion 16 The number of decimal digits : Less than digits 0 Add ;
QString hRed = QString("%1").arg(red,2,16,QLatin1Char('0')).toUpper();//value by int Type or char Both types are acceptable
QString hGreen = QString("%1").arg(green,2,16,QLatin1Char('0')).toUpper();
QString hBlue = QString("%1").arg(blue,2,16,QLatin1Char('0')).toUpper();
qDebug()<<red<<" "<<green<<" "<<blue<<endl;
qDebug()<<hRed+hGreen+hBlue<<endl;
}
}
Refer to the connection : Heart like ten years
Refer to the connection :blueshaw
边栏推荐
- Stack and queue practice (C language): Demon King's language
- Downloading wiki corpus and aligning with multilingual wikis
- redis
- Leetcode-15- sum of three numbers (medium)
- MySQL performance analysis - explain
- Common skills of quantitative investment -- Drawing Part 1: Drawing stock closing price curve and ochl candle chart
- MySQL performance optimization
- leetcode 206. Reverse linked list
- Ecological convergence NFT attacks, metaverse ape leads the new paradigm revolution of Web 3.0 meta universe
- Common skills for quantitative investment - drawing 3: drawing the golden section line
猜你喜欢
【斯坦福計網CS144項目】Lab1: StreamReassembler
Introduction to convolutional neural network
A problem discovery and attempted solution to the strange stop of server script
Five classic articles worth reading
軟件測試的幾種分類,一看就明了
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of DBCD, ROC, vroc, Cr and psy index strategy income
数学知识整理:极值&最值,驻点,拉格朗日乘子
生态聚合NFT来袭,Metaverse Ape引领Web 3.0元宇宙新范式革命
Common skills of quantitative investment - index part 2: detailed explanation of BOL (Bollinger line) index, its code implementation and drawing
MySQL index
随机推荐
[projet cs144 de Stanford Computing Network] lab1: Stream reassembler
Unity calls alertdialog
Key point detection data preparation and model design based on u-net Network -- detection model of four key points of industrial components
FLIP动画实现思路
Rasa对话机器人之HelpDesk (三)
How the ET framework uses it to develop games
论文笔记:STMARL: A Spatio-Temporal Multi-AgentReinforcement Learning Approach for Cooperative Traffic
ArrayList underlying source code
Tkinter library installation
MySQL transaction
C language implementation of the classic eight queens problem
软件测试的几种分类,一看就明了
[latex] insert picture
np. Understanding of axis in concatenate
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of BBI, MTM, obv, CCI and priceosc indicators
五篇经典好文,值得一看
Pysmb usage
Three paradigms of database
Introduction to common activation functions
Five classic articles worth reading