本文整理汇总了C++中QColor::black方法的典型用法代码示例。如果您正苦于以下问题:C++ QColor::black方法的具体用法?C++ QColor::black怎么用?C++ QColor::black使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColor
的用法示例。
在下文中一共展示了QColor::black方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateBlackValues
void SlidersController::updateBlackValues(QColor color) {
slidersView->ui->kSlider->setK(color);
blackSpinManualEdit = false;
slidersView->ui->spBlack->setValue(color.black());
slidersView->ui->cSlider->changeBlack(color);
slidersView->ui->mSlider->changeBlack(color);
slidersView->ui->ySlider->changeBlack(color);
}
示例2: add
void ContinuousColorRange::add(const QVariant &v)
{
if ( contains(v))
return;
QColor clr = toColor(v, defaultColorModel());
if ( !clr.isValid())
return;
if ( defaultColorModel() == ColorRangeBase::cmRGBA){
_limit1.setRed(std::min(_limit1.red(), clr.red()));
_limit1.setGreen(std::min(_limit1.green(), clr.green()));
_limit1.setBlue(std::min(_limit1.blue(), clr.blue()));
_limit1.setAlpha(std::min(_limit1.alpha(), clr.alpha()));
_limit2.setRed(std::max(_limit2.red(), clr.red()));
_limit2.setGreen(std::max(_limit2.green(), clr.green()));
_limit2.setBlue(std::max(_limit2.blue(), clr.blue()));
_limit2.setAlpha(std::max(_limit2.alpha(), clr.alpha()));
}else if (defaultColorModel() == ColorRangeBase::cmHSLA) {
_limit1.setHsl(std::min(_limit1.hue(), clr.hue()),
std::min(_limit1.saturation(), clr.saturation()),
std::min(_limit1.lightness(), clr.lightness()));
_limit1.setAlpha(std::min(_limit1.alpha(), clr.alpha()));
_limit2.setHsl(std::max(_limit2.hue(), clr.hue()),
std::max(_limit2.saturation(), clr.saturation()),
std::max(_limit2.lightness(), clr.lightness()));
_limit2.setAlpha(std::max(_limit2.alpha(), clr.alpha()));
}
else if ( defaultColorModel() == ColorRangeBase::cmCYMKA){
_limit1.setCmyk(std::min(_limit1.cyan(), clr.cyan()),
std::min(_limit1.magenta(), clr.magenta()),
std::min(_limit1.yellow(), clr.yellow()),
std::min(_limit1.black(), clr.black()));
_limit1.setAlpha(std::min(_limit1.alpha(), clr.alpha()));
_limit2.setCmyk(std::max(_limit2.cyan(), clr.cyan()),
std::max(_limit2.magenta(), clr.magenta()),
std::max(_limit2.yellow(), clr.yellow()),
std::max(_limit2.black(), clr.black()));
_limit2.setAlpha(std::max(_limit2.alpha(), clr.alpha()));
}
}
示例3: transform
PNM* HoughRectangles::transform()
{
PNM* img = CornerHarris(image).transform();
for (int i = 0; i < img->width(); i++)
{
for (int j = 0; j < img->height(); j++)
{
QColor color = QColor::fromRgb(img->pixel(i, j));
if (color.black() != 255)
{
img = remove(i, j, i, j, img);
}
}
}
std::vector<std::pair<int, int>> points;
for (int i = 0; i < img->width(); i++)
{
for (int j = 0; j < img->height(); j++)
{
QColor color = QColor::fromRgb(img->pixel(i, j));
if (color.black() != 255)
{
points.push_back(std::make_pair(i, j));
}
}
}
for (int i = 0; i < points.size(); i++)
{
std::vector<std::pair<int, int>> corners = check_quadrat(points.at(i), img);
if (corners.size() == 4)
{
img = drawQuadrat(corners, img);
}
}
return img;
}
示例4: Mat
void Predspracovanie::PixMap2Mat(const QPixmap &img){ //funkcia nutná na konverziu 8bit obrazu z povodnej QPixmap
//ktoru vyuziva QT Creator, vystupom je Maticu obrazu na pracu v OpenCV
QImage image = img.toImage();
QColor rgb;
this->mat= Mat(image.height(),image.width(),CV_8UC1);
for(int i=0;i<this->mat.rows;i++){
for(int j=0;j<this->mat.cols;j++){
rgb=image.pixel(j,i);
this->mat.at<uchar>(i,j)=abs(rgb.black()-255);
}
}
}
示例5: storeColor
void ColorRangeBase::storeColor(const QColor& clr, QDataStream &stream)
{
switch (defaultColorModel()){
case ColorRangeBase::cmRGBA:
stream << clr.red() << clr.green() << clr.blue() << clr.alpha();
break;
case ColorRangeBase::cmHSLA:
stream << clr.hue() << clr.saturation() << clr.lightness() << clr.alpha();
break;
case ColorRangeBase::cmCYMKA:
stream << clr.yellow() << clr.magenta() << clr.cyan() << clr.black();
break;
case ColorRangeBase::cmGREYSCALE:
stream << clr.red();
default:
break;
}
}
示例6: genScale
void MainWindow::genScale()
{
QColor tempColor;
int grayColor;
for (int i = 0; i< Img->width(); i++)
{
for (int j = 0; j < Img->height(); j++)
{
tempColor = Img->pixel(i, j);
grayColor = (255 - tempColor.black());
grayScale[grayColor]++;
grayCumulativeScale[grayColor]++;
average += grayColor;
}
}
average /= (float)(Img->width() * Img->height());
}
示例7: setCmyk
//.........这里部分代码省略.........
QCOMPARE(a2, a);
}
}
for (int C = 0; C <= USHRT_MAX; ++C) {
{
// 0-255
int c = C >> 8;
color.setCmyk(c, 0, 0, 0, 0);
QCOMPARE(color.cyan(), c);
int c2, m, y, k, a;
color.getCmyk(&c2, &m, &y, &k, &a);
QCOMPARE(c2, c);
}
{
// 0.0-1.0
qreal c = C / qreal(USHRT_MAX);
color.setCmykF(c, 0.0, 0.0, 0.0, 0.0);
QCOMPARE(color.cyanF(), c);
qreal c2, m, y, k, a;
color.getCmykF(&c2, &m, &y, &k, &a);
QCOMPARE(c2, c);
}
}
for (int M = 0; M <= USHRT_MAX; ++M) {
{
// 0-255
int m = M >> 8;
color.setCmyk(0, m, 0, 0, 0);
QCOMPARE(color.magenta(), m);
int c, m2, y, k, a;
color.getCmyk(&c, &m2, &y, &k, &a);
QCOMPARE(m2, m);
}
{
// 0.0-1.0
qreal m = M / qreal(USHRT_MAX);
color.setCmykF(0.0, m, 0.0, 0.0, 0.0);
QCOMPARE(color.magentaF(), m);
qreal c, m2, y, k, a;
color.getCmykF(&c, &m2, &y, &k, &a);
QCOMPARE(m2, m);
}
}
for (int Y = 0; Y <= USHRT_MAX; ++Y) {
{
// 0-255
int y = Y >> 8;
color.setCmyk(0, 0, y, 0, 0);
QCOMPARE(color.yellow(), y);
int c, m, y2, k, a;
color.getCmyk(&c, &m, &y2, &k, &a);
QCOMPARE(y2, y);
}
{
// 0.0-1.0
qreal y = Y / qreal(USHRT_MAX);
color.setCmykF(0.0, 0.0, y, 0.0, 0.0);
QCOMPARE(color.yellowF(), y);
qreal c, m, y2, k, a;
color.getCmykF(&c, &m, &y2, &k, &a);
QCOMPARE(y2, y);
}
}
for (int K = 0; K <= USHRT_MAX; ++K) {
{
// 0-255
int k = K >> 8;
color.setCmyk(0, 0, 0, k, 0);
QCOMPARE(color.black(), k);
int c, m, y, k2, a;
color.getCmyk(&c, &m, &y, &k2, &a);
QCOMPARE(k2, k);
}
{
// 0.0-1.0
qreal k = K / qreal(USHRT_MAX);
color.setCmykF(0.0, 0.0, 0.0, k, 0.0);
QCOMPARE(color.blackF(), k);
qreal c, m, y, k2, a;
color.getCmykF(&c, &m, &y, &k2, &a);
QCOMPARE(k2, k);
}
}
}
示例8: aplicar
void processar::aplicar(QImage tempImg, int brilho, bool isImage){
if(isImage)
{
QColor tempColor;
QRgb cor;
//int r, g, b;
int cinza;
//if (tempImg.isGrayscale()){
for(int i = 0; i < tempImg.width(); i++){
for(int j = 0; j < tempImg.height(); j++){
tempColor = tempImg.pixel(i,j);
cinza = 255 - (brilho + tempColor.black());
if (cinza > 255)
cinza = 255;
else if(cinza < 0)
cinza = 0;
cor = qRgb(cinza, cinza, cinza);
tempImg.setPixel(i, j, cor);
} //Final For Altura
} //Final For Largura
imgFinal -> setPixmap(QPixmap::fromImage(tempImg));
imgFinal -> adjustSize();
imgFinalCopy = tempImg.copy();
processado = true;
//} //Final do If greyScale
/*for(int i = 0; i < tempImg.width(); i++){
for(int j = 0; j < tempImg.height(); j++){
tempColor = tempImg.pixel(i,j);
r = brilho + tempColor.red();
g = brilho + tempColor.green();
b = brilho + tempColor.blue();
if (r > 255)
r = 255;
else if (r < 0)
r = 0;
if (g > 255)
g = 255;
else if (g < 0)
g = 0;
if (b > 255)
b = 255;
else if (b < 0)
b = 0;
cor = qRgb(r, g, b);
tempImg.setPixel(i, j, cor);
}
imgFinal -> setPixmap(QPixmap::fromImage(tempImg));
imgFinal -> adjustSize();
imgFinalCopy = tempImg.copy();
processado = true;
} */
}
}
示例9: orthoRectifyAsImage
//.........这里部分代码省略.........
corners[7] = (b0+b1*xi+b2*yi)/qi;
if (realCorners)
memcpy(realCorners,corners,8*sizeof(double));
//we look for min and max bounding box
double minC[2] = {corners[0],corners[1]};
double maxC[2] = {corners[0],corners[1]};
for (unsigned k=1;k<4;++k)
{
const double* C = corners+2*k;
if (minC[0] > C[0])
minC[0] = C[0];
else if (maxC[0] < C[0])
maxC[0] = C[0];
if (minC[1] > C[1])
minC[1] = C[1];
else if (maxC[1] < C[1])
maxC[1] = C[1];
}
//output 3D boundaries (optional)
if (minCorner)
{
minCorner[0]=minC[0];
minCorner[1]=minC[1];
}
if (maxCorner)
{
maxCorner[0]=maxC[0];
maxCorner[1]=maxC[1];
}
double dx = maxC[0]-minC[0];
double dy = maxC[1]-minC[1];
double _pixelSize = pixelSize;
if (_pixelSize<=0.0)
{
unsigned maxSize = std::max(m_width,m_height);
_pixelSize = std::max(dx,dy)/(double)maxSize;
}
unsigned w = (unsigned)((double)dx/_pixelSize);
unsigned h = (unsigned)((double)dy/_pixelSize);
QImage orthoImage(w,h,QImage::Format_ARGB32);
if (orthoImage.isNull()) //not enough memory!
return 0;
QColor color;
int blackValue = color.black();
for (unsigned i=0;i<w;++i)
{
double xip = minC[0]+(double)i*_pixelSize;
for (unsigned j=0;j<h;++j)
{
double yip = minC[1]+(double)j*_pixelSize;
double q = (c2*xip-a2)*(c1*yip-b1)-(c2*yip-b2)*(c1*xip-a1);
double p = (a0-xip)*(c1*yip-b1)-(b0-yip)*(c1*xip-a1);
double yi = p/q;
yi += halfHeight;
int y = (int)yi;
if (y>=0 && y<(int)m_height)
{
q = (c1*xip-a1)*(c2*yip-b2)-(c1*yip-b1)*(c2*xip-a2);
p = (a0-xip)*(c2*yip-b2)-(b0-yip)*(c2*xip-a2);
double xi = p/q;
xi += halfWidth;
int x = (int)xi;
if (x>=0 && x<(int)m_width)
{
QRgb rgb = m_image.pixel(x,y);
//pure black pixels are treated as transparent ones!
if (rgb != blackValue)
orthoImage.setPixel(i,h-1-j,rgb);
else
orthoImage.setPixel(i,h-1-j,qRgba(qRed(rgb),qGreen(rgb),qBlue(rgb),0));
}
else
{
orthoImage.setPixel(i,h-1-j,qRgba(0,0,0,0)); //black by default
}
}
else
{
orthoImage.setPixel(i,h-1-j,qRgba(0,0,0,0)); //black by default
}
}
}
//output pixel size (auto)
pixelSize = _pixelSize;
return new ccImage(orthoImage,getName());
}