void PrefAdvanced::getData(Preferences * pref) { requires_restart = false; clearing_background_changed = false; colorkey_changed = false; monitor_aspect_changed = false; if (pref->monitor_aspect != monitorAspect()) { pref->monitor_aspect = monitorAspect(); monitor_aspect_changed = true; requires_restart = true; } if (pref->always_clear_video_background != clearBackground()) { pref->always_clear_video_background = clearBackground(); clearing_background_changed = true; } TEST_AND_SET(pref->use_mplayer_window, useMplayerWindow()); TEST_AND_SET(pref->mplayer_additional_options, mplayerAdditionalArguments()); TEST_AND_SET(pref->mplayer_additional_video_filters, mplayerAdditionalVideoFilters()); TEST_AND_SET(pref->mplayer_additional_audio_filters, mplayerAdditionalAudioFilters()); if (pref->color_key != colorKey()) { pref->color_key = colorKey(); colorkey_changed = true; requires_restart = true; } pref->log_mplayer = logMplayer(); pref->log_smplayer = logSmplayer(); pref->log_filter = logFilter(); TEST_AND_SET(pref->rx_endoffile, endOfFileText()); TEST_AND_SET(pref->rx_novideo, noVideoText()); }
void PrefAdvanced::getData(Preferences * pref) { requires_restart = false; #if REPAINT_BACKGROUND_OPTION repaint_video_background_changed = false; #endif monitor_aspect_changed = false; #if USE_COLORKEY colorkey_changed = false; #endif pref->prefer_ipv4 = preferIpv4(); TEST_AND_SET(pref->use_idx, useIdx()); TEST_AND_SET(pref->use_correct_pts, useCorrectPts()); pref->actions_to_run = actionsToRun(); //TEST_AND_SET(pref->show_tag_in_window_title, showTagInTitle()); pref->show_tag_in_window_title = showTagInTitle(); // TODO: detect change and apply if (pref->monitor_aspect != monitorAspect()) { pref->monitor_aspect = monitorAspect(); monitor_aspect_changed = true; requires_restart = true; } #if REPAINT_BACKGROUND_OPTION if (pref->repaint_video_background != repaintVideoBackground()) { pref->repaint_video_background = repaintVideoBackground(); repaint_video_background_changed = true; } #endif TEST_AND_SET(pref->use_mplayer_window, useMplayerWindow()); TEST_AND_SET(pref->mplayer_additional_options, mplayerAdditionalArguments()); TEST_AND_SET(pref->mplayer_additional_video_filters, mplayerAdditionalVideoFilters()); TEST_AND_SET(pref->mplayer_additional_audio_filters, mplayerAdditionalAudioFilters()); #if USE_COLORKEY if (pref->color_key != colorKey()) { pref->color_key = colorKey(); colorkey_changed = true; requires_restart = true; } #endif pref->log_mplayer = logMplayer(); TEST_AND_SET( pref->verbose_log, mplayerLogVerbose() ); pref->log_smplayer2 = logSmplayer(); pref->log_filter = logFilter(); pref->autosave_mplayer_log = saveMplayerLog(); pref->mplayer_log_saveto = mplayerLogName(); pref->save_smplayer2_log = saveSmplayerLog(); }
void KQtTester::testImageEffects() { QString report = QString("execute %1 times:\n").arg(g_nTimes); report += QString("none:\t%1\tms\n").arg(none()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("gray:\t%1\tms\n").arg(gray()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("watermark:\t%1\tms\n").arg(watermark()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("bilevel:\t%1\tms\n").arg(bilevel()); m_pPainter->resetMatrix(); m_pPainter->translate(0, g_img.height() + 10); report += QString("lightBlue:\t%1\tms\n").arg(lightBlue()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("darkBlue:\t%1\tms\n").arg(darkBlue()); m_pPainter->resetMatrix(); m_pPainter->translate(0, (g_img.height() + 10) * 2); report += QString("colorKey:\t%1\tms\n").arg(colorKey()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("brightness:\t%1\tms\n").arg(brightness()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("contrast:\t%1\tms\n").arg(contrast()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("brown:\t%1\tms\n").arg(brown()); drawReport(report); }
void Color::init(uchar r, uchar g, uchar b, uchar a) { uint32 key = colorKey(r, g, b, a); auto i = colorsMap.constFind(key); if (i == colorsMap.cend()) { i = colorsMap.insert(key, new ColorData(r, g, b, a)); } ptr = i.value(); }
//______________________________________________________________________________ const QColor& DecoHelper::inactiveButtonTextColor( const QPalette& palette ) { const quint32 key( colorKey( palette.color(QPalette::Active, QPalette::Window) ) ); QColor* out( _buttonTextColorCache.object( key ) ); if( !out ) { // todo: reimplement cache const QColor ab = palette.color(QPalette::Active, QPalette::Button); const QColor af = palette.color(QPalette::Active, QPalette::ButtonText); const QColor nb = palette.color(QPalette::Inactive, QPalette::Button); const QColor nf = palette.color(QPalette::Inactive, QPalette::ButtonText); out = new QColor( reduceContrast(nb, nf, qMax(qreal(2.5), KColorUtils::contrastRatio(ab, KColorUtils::mix(ab, af, 0.4)))) ); _buttonTextColorCache.insert( key, out ); } return *out; }
void NegativeProcessor::setDNGPropertiesFromRaw() { libraw_image_sizes_t *sizes = &m_RawProcessor->imgdata.sizes; libraw_iparams_t *iparams = &m_RawProcessor->imgdata.idata; // ----------------------------------------------------------------------------------------- // Raw filename std::string file(m_RawImage->io().path()); size_t found = std::min(file.rfind("\\"), file.rfind("/")); if (found != std::string::npos) file = file.substr(found + 1, file.length() - found - 1); m_negative->SetOriginalRawFileName(file.c_str()); // ----------------------------------------------------------------------------------------- // Model dng_string makeModel; makeModel.Append(iparams->make); makeModel.Append(" "); makeModel.Append(iparams->model); m_negative->SetModelName(makeModel.Get()); // ----------------------------------------------------------------------------------------- // Orientation switch (sizes->flip) { case 180: case 3: m_negative->SetBaseOrientation(dng_orientation::Rotate180()); break; case 270: case 5: m_negative->SetBaseOrientation(dng_orientation::Rotate90CCW()); break; case 90: case 6: m_negative->SetBaseOrientation(dng_orientation::Rotate90CW()); break; default: m_negative->SetBaseOrientation(dng_orientation::Normal()); break; } // ----------------------------------------------------------------------------------------- // ColorKeys (this needs to happen before Mosaic - how about documenting that in the SDK???) m_negative->SetColorChannels(iparams->colors); m_negative->SetColorKeys(colorKey(iparams->cdesc[0]), colorKey(iparams->cdesc[1]), colorKey(iparams->cdesc[2]), colorKey(iparams->cdesc[3])); // ----------------------------------------------------------------------------------------- // Mosaic if (iparams->colors == 4) m_negative->SetQuadMosaic(iparams->filters); else switch(iparams->filters) { case 0xe1e1e1e1: m_negative->SetBayerMosaic(0); break; case 0xb4b4b4b4: m_negative->SetBayerMosaic(1); break; case 0x1e1e1e1e: m_negative->SetBayerMosaic(2); break; case 0x4b4b4b4b: m_negative->SetBayerMosaic(3); break; default: break; // not throwing error, because this might be set in a sub-class (e.g., Fuji) } // ----------------------------------------------------------------------------------------- // Default scale and crop/active area m_negative->SetDefaultScale(dng_urational(sizes->iwidth, sizes->width), dng_urational(sizes->iheight, sizes->height)); m_negative->SetActiveArea(dng_rect(sizes->top_margin, sizes->left_margin, sizes->top_margin + sizes->height, sizes->left_margin + sizes->width)); uint32 cropWidth, cropHeight; if (!getRawExifTag("Exif.Photo.PixelXDimension", 0, &cropWidth) || !getRawExifTag("Exif.Photo.PixelYDimension", 0, &cropHeight)) { cropWidth = sizes->width - 16; cropHeight = sizes->height - 16; } int cropLeftMargin = (cropWidth > sizes->width ) ? 0 : (sizes->width - cropWidth) / 2; int cropTopMargin = (cropHeight > sizes->height) ? 0 : (sizes->height - cropHeight) / 2; m_negative->SetDefaultCropOrigin(cropLeftMargin, cropTopMargin); m_negative->SetDefaultCropSize(cropWidth, cropHeight); // ----------------------------------------------------------------------------------------- // CameraNeutral //TODO/CHECK/FORK: what does this actually do? dng_vector cameraNeutral(iparams->colors); for (int i = 0; i < iparams->colors; i++) cameraNeutral[i] = 1.0 / m_RawProcessor->imgdata.color.cam_mul[i]; m_negative->SetCameraNeutral(cameraNeutral); // ----------------------------------------------------------------------------------------- // BlackLevel & WhiteLevel libraw_colordata_t *colors = &m_RawProcessor->imgdata.color; for (int i = 0; i < 4; i++) m_negative->SetWhiteLevel(static_cast<uint32>(colors->maximum), i); if ((m_negative->GetMosaicInfo() != NULL) && (m_negative->GetMosaicInfo()->fCFAPatternSize == dng_point(2, 2))) m_negative->SetQuadBlacks(colors->black + colors->cblack[0], colors->black + colors->cblack[1], colors->black + colors->cblack[2], colors->black + colors->cblack[3]); else m_negative->SetBlackLevel(colors->black + colors->cblack[0], 0); // ----------------------------------------------------------------------------------------- // Fixed properties m_negative->SetBaselineExposure(0.0); // should be fixed per camera m_negative->SetBaselineNoise(1.0); m_negative->SetBaselineSharpness(1.0); // default m_negative->SetAntiAliasStrength(dng_urational(100, 100)); // = no aliasing artifacts m_negative->SetLinearResponseLimit(1.0); // = no non-linear sensor response m_negative->SetAnalogBalance(dng_vector_3(1.0, 1.0, 1.0)); m_negative->SetShadowScale(dng_urational(1, 1)); }
//______________________________________________________________________________ QPixmap DecoHelper::windecoButton(const QColor &color, const QColor& glow, bool sunken, int size) { Oxygen::Cache<QPixmap>::Value* cache( _windecoButtonCache.get( color ) ); const quint64 key( ( colorKey(glow) << 32 ) | (sunken << 23 ) | size ); QPixmap *pixmap = cache->object( key ); if( !pixmap ) { pixmap = new QPixmap(size, size); pixmap->fill(Qt::transparent); QPainter p( pixmap ); p.setRenderHints(QPainter::Antialiasing); p.setPen(Qt::NoPen); p.setWindow( 0, 0, 21, 21 ); // button shadow if( color.isValid() ) { p.save(); p.translate( 0, -1.4 ); drawShadow( p, calcShadowColor( color ), 21 ); p.restore(); } // button glow if( glow.isValid() ) { p.save(); p.translate( 0, -1.4 ); drawOuterGlow( p, glow, 21 ); p.restore(); } // button slab p.setWindow( 0, 0, 18, 18 ); if( color.isValid() ) { p.translate( 0, (0.5-0.668) ); const QColor light( calcLightColor(color) ); const QColor dark( calcDarkColor(color) ); { //plain background QLinearGradient lg( 0, 1.665, 0, (12.33+1.665) ); if( sunken ) { lg.setColorAt( 1, light ); lg.setColorAt( 0, dark ); } else { lg.setColorAt( 0, light ); lg.setColorAt( 1, dark ); } const QRectF r( 0.5*(18-12.33), 1.665, 12.33, 12.33 ); p.setBrush( lg ); p.drawEllipse( r ); } { // outline circle const qreal penWidth( 0.7 ); QLinearGradient lg( 0, 1.665, 0, (2.0*12.33+1.665) ); lg.setColorAt( 0, light ); lg.setColorAt( 1, dark ); const QRectF r( 0.5*(18-12.33+penWidth), (1.665+penWidth), (12.33-penWidth), (12.33-penWidth) ); p.setPen( QPen( lg, penWidth ) ); p.setBrush( Qt::NoBrush ); p.drawEllipse( r ); } } p.end(); cache->insert( key, pixmap ); } return *pixmap; }