void AdjustLevelsPopup::hideEvent(QHideEvent *he) { Dialog::hideEvent(he); TSelectionHandle *selectionHandle = TApp::instance()->getCurrentSelection(); disconnect(selectionHandle, SIGNAL(selectionChanged(TSelection *)), this, SLOT(onSelectionChanged())); m_inputRas = TRasterP(); m_viewer->raster() = TRasterP(); }
void BrightnessAndContrastPopup::hideEvent(QHideEvent *he) { TApp *app = TApp::instance(); disconnect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(setCurrentSampleRaster())); disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(setCurrentSampleRaster())); disconnect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()), this, SLOT(setCurrentSampleRaster())); Dialog::hideEvent(he); m_viewer->raster() = TRasterP(); m_startRas = TRasterP(); }
void CleanupSwatch::enable(bool state) { m_enabled = state; if (!m_enabled) { m_resampledRaster = TRasterP(); //m_lastRasCleanupped = TRasterP(); m_origRaster = TRasterP(); m_viewAff = TAffine(); m_resampleAff = TAffine(); m_leftSwatch->updateRaster(); m_rightSwatch->updateRaster(); } }
//------------------------------------------------------------ void CleanupSwatch::setRaster(TRasterP rasLeft, const TAffine &aff, TRasterP ras) { if (!isVisible()) { m_resampledRaster = TRasterP(); m_origRaster = TRasterP(); //m_lastRasCleanupped = TRasterP(); return; } m_resampledRaster = ras; m_origRaster = rasLeft; m_resampleAff = aff; m_leftSwatch->updateRaster(); m_rightSwatch->updateRaster(); }
void AntialiasPopup::hideEvent(QHideEvent *he) { TApp *app = TApp::instance(); disconnect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(setCurrentSampleRaster())); disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(setCurrentSampleRaster())); disconnect(app->getCurrentColumn(), SIGNAL(columnIndexSwitched()), this, SLOT(setCurrentSampleRaster())); Dialog::hideEvent(he); m_viewer->setImage(TImageP()); m_startRas = TRasterP(); }
void AdjustLevelsPopup::acquireRaster() { //Retrieve current selection TApp *app = TApp::instance(); TSelection *selection = app->getCurrentSelection()->getSelection(); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(selection); TFilmstripSelection *filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection); //Retrieve the input raster m_inputRas = TRasterP(); if (cellSelection) { TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrameIndex(), app->getCurrentColumn()->getColumnIndex()); TRasterImageP rasImage = cell.getImage(true); if (rasImage && rasImage->getRaster()) m_inputRas = rasImage->getRaster(); } else if (filmstripSelection) { TXshSimpleLevel *simpleLevel = app->getCurrentLevel()->getSimpleLevel(); if (simpleLevel) { TRasterImageP rasImage = (TRasterImageP)simpleLevel->getFrame(app->getCurrentFrame()->getFid(), true); if (rasImage && rasImage->getRaster()) m_inputRas = rasImage->getRaster(); } } if (m_inputRas) { m_threshold = m_inputRas->getLx() * m_inputRas->getLy() * m_thresholdD; m_okBtn->setEnabled(true); } else { m_inputRas = TRasterP(); m_okBtn->setEnabled(false); } //Build histograms m_histogram->setRaster(m_inputRas); //Update the corresponding processed image in the viewer updateProcessedImage(); }
void BinarizePopup::setSample(const TRasterP &sampleRas) { m_inRas = sampleRas; if (m_inRas) { m_okBtn->setEnabled(true); } else { m_okBtn->setEnabled(false); } m_outRas = TRasterP(); m_previewChk->setChecked(false); m_viewer->raster() = m_inRas; m_viewer->update(); }
void BrightnessAndContrastPopup::setCurrentSampleRaster() { TRasterP sampleRas; m_startRas = TRasterP(); TSelection *selection = TApp::instance()->getCurrentSelection()->getSelection(); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(selection); TFilmstripSelection *filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection); if (cellSelection) { TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrameIndex(), app->getCurrentColumn()->getColumnIndex()); TRasterImageP rasImage = cell.getImage(true); if (rasImage && rasImage->getRaster()) sampleRas = rasImage->getRaster()->clone(); } else if (filmstripSelection) { TApp *app = TApp::instance(); TXshSimpleLevel *simpleLevel = app->getCurrentLevel()->getSimpleLevel(); if (simpleLevel) { TRasterImageP rasImage = (TRasterImageP)simpleLevel->getFrame(app->getCurrentFrame()->getFid(), true); if (rasImage && rasImage->getRaster()) sampleRas = rasImage->getRaster()->clone(); } } if (!sampleRas) { m_viewer->raster() = TRasterP(); m_viewer->update(); m_okBtn->setEnabled(false); return; } m_okBtn->setEnabled(true); m_startRas = sampleRas->clone(); onChange(m_startRas, sampleRas, m_contrastField->getValue(), m_brightnessField->getValue()); m_viewer->raster() = sampleRas; m_viewer->update(); }
bool TImageReader::load(const TFilePath &path, TRasterP &raster) { raster = TRasterP(); TImageReaderP ir(path); if (!ir) return false; TImageP img = ir->load(); if (!img) return false; TRasterImageP ri(img); if (!ri) return false; raster = ri->getRaster(); return true; }
void AntialiasPopup::setCurrentSampleRaster() { TRasterP sampleRas; m_startRas = TRasterP(); TSelection *selection = TApp::instance()->getCurrentSelection()->getSelection(); TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(selection); TFilmstripSelection *filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection); TImageP image; if (cellSelection) { TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrameIndex(), app->getCurrentColumn()->getColumnIndex()); TImageP aux = cell.getImage(true); if (aux) image = aux->cloneImage(); } else if (filmstripSelection) { TApp *app = TApp::instance(); TXshSimpleLevel *simpleLevel = app->getCurrentLevel()->getSimpleLevel(); if (simpleLevel) { TImageP imageAux = simpleLevel->getFrame(app->getCurrentFrame()->getFid(), true); if (imageAux) image = imageAux->cloneImage(); } } if (!image || !(sampleRas = image->raster())) { m_viewer->setImage(TImageP()); m_viewer->update(); m_okBtn->setEnabled(false); return; } m_okBtn->setEnabled(true); m_startRas = sampleRas->clone(); onChange(m_startRas, sampleRas, m_thresholdField->getValue(), m_softnessField->getValue()); m_viewer->setImage(image); m_viewer->update(); }
void BinarizePopup::fetchSample() { TApp *app = TApp::instance(); TImageP img; if (app->getCurrentFrame()->isEditingLevel()) { TXshLevel *xshLevel = app->getCurrentLevel()->getLevel(); if (xshLevel && xshLevel->getSimpleLevel()) { TXshSimpleLevel *sl = xshLevel->getSimpleLevel(); img = sl->getFrame(app->getCurrentFrame()->getFid(), false); } } else { TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet(); TXshCell cell = xsh->getCell(app->getCurrentFrame()->getFrame(), app->getCurrentColumn()->getColumnIndex()); img = cell.getImage(false); } TRasterImageP ri = img; if (ri) { setSample(ri->getRaster()); } else { setSample(TRasterP()); } }
void AdjustLevelsPopup::updateProcessedImage() { if (!m_inputRas) { m_viewer->raster() = TRasterP(); m_viewer->update(); return; } //Allocate a conformant output, if necessary TRasterP &outRas = m_viewer->raster(); if (!outRas || outRas->getPixelSize() != m_inputRas->getPixelSize() || outRas->getSize() != m_inputRas->getSize()) outRas = m_inputRas->create(m_inputRas->getLx(), m_inputRas->getLy()); //Perform the operation preview int in0[5], in1[5], out0[5], out1[5]; getParameters(in0, in1, out0, out1); TRop::rgbmAdjust(outRas, m_inputRas, in0, in1, out0, out1); //Update the swatch m_viewer->update(); }
void FullColorBrushTool::onDeactivate() { m_workRaster = TRaster32P(); m_backUpRas = TRasterP(); }