This commit is contained in:
parent
2c12f05517
commit
f4d01ab5a8
|
@ -1465,18 +1465,12 @@ void HGImgView::mouseMoveEvent(QMouseEvent* e)
|
||||||
|
|
||||||
if (m_showColorInfo)
|
if (m_showColorInfo)
|
||||||
{
|
{
|
||||||
HGByte *data = nullptr;
|
HGImagePixel pixel;
|
||||||
HGBase_GetImageData(m_image, &data);
|
HGBase_GetImagePixel(m_image, xImg, yImg, &pixel);
|
||||||
HGByte *pixel = data + yImg * info.widthStep + xImg * 3;
|
|
||||||
|
|
||||||
HGByte r = pixel[0];
|
|
||||||
HGByte g = pixel[1];
|
|
||||||
HGByte b = pixel[2];
|
|
||||||
//qDebug("colorInfo, r=%d, g=%d, b=%d", r, g, b);
|
|
||||||
|
|
||||||
char colorInfo[1024];
|
char colorInfo[1024];
|
||||||
sprintf(colorInfo, "X: %d, Y: %d\nRGB(%d, %d, %d)\nHTML(#%02X%02X%02X)",
|
sprintf(colorInfo, "X: %d, Y: %d\nRGB(%d, %d, %d)\nHTML(#%02X%02X%02X)",
|
||||||
xImg, yImg, r, g, b, r, g, b);
|
xImg, yImg, pixel.r, pixel.g, pixel.b, pixel.r, pixel.g, pixel.b);
|
||||||
QToolTip::showText(e->globalPos(), colorInfo, this);
|
QToolTip::showText(e->globalPos(), colorInfo, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue