lepsai hat geschrieben:hm...
Für wen ist denn das gedacht? Den Text, den Du dazu geschrieben hast, dauert es länger zu lesen, als diese Funktionalität zu implementieren.
Motz .... motz ....
dieses eine QWidget ist ja auch ein teil von einer applikation ... um ein viereck mit der maus zu zeichen && ziehen das crop selber geht ja einfach won statten....
Code: Alles auswählen
original = original2.copy(TagliaPoi); /* QRect TagliaPoi; QPixmap original2; */
TmpSave();
Was ich seit laenger auch gesucht habe un niee gefunden ist der sepia effekt auf einen bild...
Code: Alles auswählen
void Interface::populateFilter(QComboBox *comboBox)
{
QPixmap pix(22, 22);
QStringList colorNames = QColor::colorNames();
comboBox->addItem(tr("Select a filter.."));
pix.fill(QColor("grey"));
comboBox->addItem(pix,tr("GreyScale"));
comboBox->addItem(tr("RGB Swapped"));
comboBox->addItem(tr("InvertPixels color"));
pix.fill(QColor(162,128,101));
comboBox->addItem(pix,tr("Colorize")+QString(" color="sepia""));
comboBox->addItem(tr("Colorize")+QString(" color="mycolor""));
foreach (QString name, colorNames) {
pix.fill(QColor(name));
comboBox->addItem(pix,tr("Colorize")+QString(" color="%1"").arg(name));
}
}
void Interface::applyFilter( QString filtername )
{
QImage income(origImageFilename);
QImage base = income.convertToFormat(QImage::Format_RGB32);
int newlarge = (original.width()/cento)*ratio; /* % darstellung im ziel widged */
int largeful = base.width();
QPixmap result;
if (base.isNull()) {
return;
}
if (filtername == tr("Select a filter..")) {
//////qDebug() << "### return " << filtername;
return;
}
QColor gtr;
comboBox_2->setCurrentIndex(0);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
qDebug() << "### filtername " << filtername;
/* start to pray filter */
if (filtername.contains(tr("Colorize"))) {
const QString colorn = BraketName(filtername);
if (colorn == "sepia") {
gtr = QColor(162,128,101);
} else if (colorn == "mycolor") {
QApplication::restoreOverrideCursor();
QColor col = QColorDialog::getColor(QColor("red"), this);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
gtr = col;
} else {
gtr = QColor(colorn);
}
///////////qDebug() << "### colorn " << colorn;
int sepiaH, sepiaS, sepiaL;
///////QColor(162,128,101).getHsv( &sepiaH, &sepiaS, &sepiaL );
gtr.getHsv( &sepiaH, &sepiaS, &sepiaL );
//iterate over each selected scanline
int x, y, pixelLuminance;
QRgb* rgb;
QColor sepiaColor;
uchar* scanLine;
for( y=0; y<base.height(); y++) {
scanLine = base.scanLine(y);
for( x=0; x<base.width(); x++)
{
rgb = ((QRgb*)scanLine+x);
pixelLuminance = (int) (0.2125*qRed(*rgb) + 0.7154*qGreen(*rgb) + 0.0721*qBlue(*rgb));
sepiaColor.setHsv( sepiaH, sepiaS, pixelLuminance );
*rgb = sepiaColor.rgb();
}
}
qDebug() << "### base.isNull() 1111 must see false! " << base.isNull();
result = QPixmap::fromImage(base);
} else if (filtername == tr("GreyScale")) {
result = QPixmap::fromImage(GreyScale(base));
} else if (filtername == tr("RGB Swapped")) {
base.rgbSwapped();
result = QPixmap::fromImage(base);
} else if (filtername == tr("InvertPixels color")) {
base.invertPixels();
result = QPixmap::fromImage(base);
} else {
return;
}
original = result;
qDebug() << "### base.isNull() 333 must see false! " << result.isNull();
display = result.scaledToWidth(newlarge,Qt::FastTransformation);
wrapper->paint(display);
UpdateNow();
QApplication::restoreOverrideCursor();
}
extern inline QImage GreyScale( QImage income )
{
QImage base = income.convertToFormat(QImage::Format_RGB32);
for (int y = 0; y < base.height(); ++y) {
for (int x = 0; x < base.width(); ++x) {
int pixel = base.pixel(x, y);
int gray = qGray(pixel);
int alpha = qAlpha(pixel);
base.setPixel(x, y, qRgba(gray, gray, gray, alpha));
}
}
return base;
}
.........................
speack português italiano deutsch english castellà qt