KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

631 lines
21KB

  1. /*
  2. * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #include "config.h"
  20. #ifdef HAVE_SYS_TYPES_H
  21. #include <sys/types.h>
  22. #endif
  23. #include <sys/types.h>
  24. #include <netinet/in.h>
  25. #include <tqstring.h>
  26. #include <tqfile.h>
  27. #include <tqimage.h>
  28. #include <tqradiobutton.h>
  29. #include <tqgroupbox.h>
  30. #include <tqbuttongroup.h>
  31. #include <tqpushbutton.h>
  32. #include <tqlabel.h>
  33. #include <tqcheckbox.h>
  34. #include <tqapplication.h>
  35. #include <tqcursor.h>
  36. #include <tqeventloop.h>
  37. #include <tqprogressdialog.h>
  38. #include <tqtimer.h>
  39. #include <kglobal.h>
  40. #include <tdeconfig.h>
  41. #include <knuminput.h>
  42. #include <kgenericfactory.h>
  43. #include <kdialogbase.h>
  44. #include <kdialog.h>
  45. #include <kmessagebox.h>
  46. #include <klocale.h>
  47. #include <kprocess.h>
  48. #include <KoDocument.h>
  49. #include <KoFilterChain.h>
  50. #include "imageviewer.h"
  51. #include "kis_config.h"
  52. #include "kis_cmb_idlist.h"
  53. #include "kis_types.h"
  54. #include "kis_raw_import.h"
  55. #include "kis_doc.h"
  56. #include "kis_image.h"
  57. #include "kis_meta_registry.h"
  58. #include "kis_layer.h"
  59. #include "kis_annotation.h"
  60. #include "kis_profile.h"
  61. #include "kis_colorspace_factory_registry.h"
  62. #include "kis_iterators_pixel.h"
  63. #include "kis_abstract_colorspace.h"
  64. #include "kis_paint_device.h"
  65. #include "kis_paint_layer.h"
  66. #include "wdgrawimport.h"
  67. typedef KGenericFactory<KisRawImport, KoFilter> KisRawImportFactory;
  68. K_EXPORT_COMPONENT_FACTORY(libchalk_raw_import, KisRawImportFactory("kofficefilters"))
  69. KisRawImport::KisRawImport(KoFilter *, const char *, const TQStringList&)
  70. : KoFilter()
  71. , m_data(0)
  72. , m_process(0)
  73. , m_progress(0)
  74. , m_err(false)
  75. {
  76. m_dialog = new KDialogBase();
  77. m_dialog->enableButtonApply(false);
  78. m_page = new WdgRawImport(m_dialog);
  79. m_dialog -> setMainWidget(m_page);
  80. connect(m_page->bnPreview, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUpdatePreview()));
  81. connect(m_page->grpColorSpace, TQT_SIGNAL(clicked( int )), this, TQT_SLOT(slotFillCmbProfiles()));
  82. connect(m_page->grpChannelDepth, TQT_SIGNAL(clicked( int )), this, TQT_SLOT(slotFillCmbProfiles()));
  83. KisConfig cfg;
  84. TQString monitorProfileName = cfg.monitorProfile();
  85. m_monitorProfile = KisMetaRegistry::instance()->csRegistry()->getProfileByName(monitorProfileName);
  86. slotFillCmbProfiles();
  87. }
  88. KisRawImport::~KisRawImport()
  89. {
  90. delete m_dialog;
  91. delete m_process;
  92. }
  93. KoFilter::ConversionStatus KisRawImport::convert(const TQCString& from, const TQCString& to)
  94. {
  95. if (from != "image/x-raw" || to != "application/x-chalk") {
  96. return KoFilter::NotImplemented;
  97. }
  98. if (m_err) {
  99. return KoFilter::CreationError;
  100. }
  101. kdDebug(41008) << "Chalk importing from Raw\n";
  102. KisDoc * doc = dynamic_cast<KisDoc*>(m_chain -> outputDocument());
  103. if (!doc) {
  104. return KoFilter::CreationError;
  105. }
  106. doc -> prepareForImport();
  107. TQString filename = m_chain -> inputFile();
  108. if (filename.isEmpty()) {
  109. return KoFilter::FileNotFound;
  110. }
  111. slotUpdatePreview();
  112. // Show dialog
  113. m_dialog->setCursor(TQt::ArrowCursor);
  114. TQApplication::setOverrideCursor(TQt::ArrowCursor);
  115. TDEConfig * cfg = TDEGlobal::config();
  116. cfg->setGroup("rawimport");
  117. m_page->radioGray->setChecked(cfg->readBoolEntry("gray", false));
  118. m_page->radioRGB->setChecked(cfg->readBoolEntry("rgb", true));
  119. m_page->radio8->setChecked(cfg->readBoolEntry("8bit", false));
  120. m_page->radio16->setChecked(cfg->readBoolEntry("16bit", true));
  121. m_page->chkFourColorRGB->setChecked( cfg->readBoolEntry("four_color_rgb", false));
  122. m_page->chkCameraColors->setChecked( cfg->readBoolEntry("camera_colors", false));
  123. m_page->chkBrightness->setChecked( cfg->readBoolEntry("do_brightness", false));
  124. m_page->chkBlackpoint->setChecked( cfg->readBoolEntry("do_blackpoint", false));
  125. m_page->chkRed->setChecked( cfg->readBoolEntry("do_red", false));
  126. m_page->chkBlue->setChecked( cfg->readBoolEntry("do_blue", false));
  127. m_page->radioFixed->setChecked( cfg->readBoolEntry("fixed_wb", true));
  128. m_page->radioAutomatic->setChecked( cfg->readBoolEntry("automatic_wb", false));
  129. m_page->radioCamera->setChecked( cfg->readBoolEntry("camera_wb", false));
  130. m_page->chkClip->setChecked( cfg->readBoolEntry("clip", true));
  131. m_page->chkProfile->setChecked(cfg->readBoolEntry("useprofile", false));
  132. m_page->dblBrightness->setValue(cfg->readDoubleNumEntry("brightness", 1.0));
  133. m_page->dblBlackpoint->setValue(cfg->readDoubleNumEntry("blackpoint", 0));
  134. m_page->dblRed->setValue(cfg->readDoubleNumEntry("red", 1.0));
  135. m_page->dblBlue->setValue(cfg->readDoubleNumEntry("blue", 1.0));
  136. if (m_dialog->exec() == TQDialog::Accepted) {
  137. cfg->writeEntry("gray", m_page->radioGray->isChecked());
  138. cfg->writeEntry("rgb", m_page->radioRGB->isChecked());
  139. cfg->writeEntry("8bit", m_page->radio8->isChecked());
  140. cfg->writeEntry("16bit", m_page->radio16->isChecked());
  141. cfg->writeEntry("four_color_rgb", m_page->chkFourColorRGB -> isChecked());
  142. cfg->writeEntry("camera_colors", m_page->chkCameraColors -> isChecked());
  143. cfg->writeEntry("do_brightness", m_page->chkBrightness -> isChecked());
  144. cfg->writeEntry("do_blackpoint", m_page->chkBlackpoint -> isChecked());
  145. cfg->writeEntry("do_red", m_page->chkRed -> isChecked());
  146. cfg->writeEntry("do_blue", m_page->chkBlue -> isChecked());
  147. cfg->writeEntry("fixed_wb", m_page->radioFixed -> isChecked());
  148. cfg->writeEntry("automatic_wb", m_page->radioAutomatic -> isChecked());
  149. cfg->writeEntry("camera_wb", m_page->radioCamera -> isChecked());
  150. cfg->writeEntry("clip", m_page->chkClip->isChecked());
  151. cfg->writeEntry("useprofile", m_page->chkProfile->isChecked());
  152. cfg->writeEntry("brightness", m_page->dblBrightness->value());
  153. cfg->writeEntry("blackpoint", m_page->dblBlackpoint->value());
  154. cfg->writeEntry("red", m_page->dblRed->value());
  155. cfg->writeEntry("blue", m_page->dblBlue->value());
  156. TQApplication::setOverrideCursor(TQt::waitCursor);
  157. // Create a busy indicator to show that we didn't die or so
  158. m_progress = new TQProgressDialog();
  159. m_progress -> setTotalSteps(0);
  160. m_progress -> setCancelButton(0);
  161. TQTimer timer;
  162. connect(&timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(incrementProgress()));
  163. timer.start(200);
  164. doc -> undoAdapter() -> setUndo(false);
  165. getImageData(createArgumentList(false));
  166. KisImageSP image = 0;
  167. KisPaintLayerSP layer = 0;
  168. KisPaintDeviceSP device = 0;
  169. TQApplication::restoreOverrideCursor();
  170. delete m_progress;
  171. m_progress = 0;
  172. if (m_page->radio8->isChecked()) {
  173. // 8 bits
  174. TQImage img;
  175. img.loadFromData(*m_data);
  176. KisColorSpace * cs = 0;
  177. if (m_page->radioGray->isChecked()) {
  178. cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace( KisID("GRAYA"), profile() );
  179. }
  180. else {
  181. cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace( KisID("RGBA"), profile() );
  182. }
  183. if (cs == 0) { kdDebug() << "No CS\n"; return KoFilter::InternalError; }
  184. image = new KisImage(doc->undoAdapter(), img.width(), img.height(), cs, filename);
  185. if (image == 0) return KoFilter::CreationError;
  186. image->blockSignals(true); // Don't send out signals while we're building the image
  187. layer = dynamic_cast<KisPaintLayer*>( image->newLayer(image -> nextLayerName(), OPACITY_OPAQUE).data() );
  188. if (layer == 0) return KoFilter::CreationError;
  189. device = layer->paintDevice();
  190. if (device == 0) return KoFilter::CreationError;
  191. device->convertFromTQImage(img, "");
  192. } else {
  193. // 16 bits
  194. TQ_UINT32 startOfImagedata = 0;
  195. TQSize sz = determineSize(startOfImagedata);
  196. kdDebug(41008) << "Total bytes: " << m_data->size()
  197. << "\n start of image data: " << startOfImagedata
  198. << "\n bytes for pixels left: " << m_data->size() - startOfImagedata
  199. << "\n total pixels: " << sz.width() * sz.height()
  200. << "\n total pixel bytes: " << sz.width() * sz.height() * 6
  201. << "\n total necessary bytes: " << (sz.width() * sz.height() * 6) + startOfImagedata
  202. << "\n";
  203. char * data = m_data->data() + startOfImagedata;
  204. KisColorSpace * cs = 0;
  205. if (m_page->radioGray->isChecked()) {
  206. cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace( KisID("GRAYA16"), profile() );
  207. }
  208. else {
  209. cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace( KisID("RGBA16"), profile() );
  210. }
  211. if (cs == 0) return KoFilter::InternalError;
  212. image = new KisImage( doc->undoAdapter(), sz.width(), sz.height(), cs, filename);
  213. if (image == 0)return KoFilter::CreationError;
  214. layer = dynamic_cast<KisPaintLayer*> (image->newLayer(image -> nextLayerName(), OPACITY_OPAQUE).data());
  215. if (layer == 0) return KoFilter::CreationError;
  216. device = layer->paintDevice();
  217. if (device == 0) return KoFilter::CreationError;
  218. // Copy the colordata to the pixels
  219. int pos = 0;
  220. for (int line = 0; line < sz.height(); ++line) {
  221. KisHLineIterator it = device->createHLineIterator(0, line, sz.width(), true);
  222. while (!it.isDone()) {
  223. if (m_page->radioGray->isChecked()) {
  224. TQ_UINT16 d = (TQ_INT16)*(data + pos);
  225. d = ntohs(d);
  226. memcpy(it.rawData(), &d, 2);
  227. pos += 2;
  228. }
  229. else {
  230. // Red
  231. TQ_UINT16 d = (TQ_INT16)*(data + pos);
  232. d = ntohs(d);
  233. memcpy(it.rawData() + 4, &d, 2);
  234. // Green
  235. pos += 2;
  236. d = (TQ_INT16)*(data + pos );
  237. d = ntohs(d);
  238. memcpy(it.rawData() + 2, &d, 2);
  239. // Blue
  240. pos += 2;
  241. d = (TQ_INT16)*(data + pos );
  242. d = ntohs(d);
  243. memcpy(it.rawData(), &d, 2);
  244. pos += 2;
  245. }
  246. cs->setAlpha(it.rawData(), OPACITY_OPAQUE, 1);
  247. ++it;
  248. }
  249. }
  250. }
  251. layer->setDirty();
  252. kdDebug() << "going to set image\n";
  253. doc -> setCurrentImage(image);
  254. doc -> undoAdapter() -> setUndo(true);
  255. doc -> setModified(false);
  256. kdDebug() << "everything ok\n";
  257. TQApplication::restoreOverrideCursor();
  258. return KoFilter::OK;
  259. }
  260. TQApplication::restoreOverrideCursor();
  261. return KoFilter::UserCancelled;
  262. }
  263. void KisRawImport::incrementProgress()
  264. {
  265. m_progress -> setProgress(m_progress -> progress() + 10);
  266. }
  267. void KisRawImport::slotUpdatePreview()
  268. {
  269. TQApplication::setOverrideCursor(TQt::waitCursor);
  270. getImageData(createArgumentList(true));
  271. kdDebug(41008) << "Retrieved " << m_data->size() << " bytes of image data\n";
  272. if (m_data->isNull()) return;
  273. TQImage img;
  274. if (m_page->radio8->isChecked()) {
  275. // 8 bits
  276. img.loadFromData(*m_data);
  277. } else {
  278. // 16 bits
  279. TQ_UINT32 startOfImagedata = 0;
  280. TQSize sz = determineSize(startOfImagedata);
  281. kdDebug(41008) << "Total bytes: " << m_data->size()
  282. << "\n start of image data: " << startOfImagedata
  283. << "\n bytes for pixels left: " << m_data->size() - startOfImagedata
  284. << "\n total pixels: " << sz.width() * sz.height()
  285. << "\n total pixel bytes: " << sz.width() * sz.height() * 6
  286. << "\n total necessary bytes: " << (sz.width() * sz.height() * 6) + startOfImagedata
  287. << "\n";
  288. char * data = m_data->data() + startOfImagedata;
  289. KisColorSpace * cs = 0;
  290. if (m_page->radioGray->isChecked()) {
  291. cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace( KisID("GRAYA16"), profile() );
  292. }
  293. else {
  294. cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace( KisID("RGBA16"), profile() );
  295. }
  296. KisPaintDevice * dev = new KisPaintDevice(cs, "preview");
  297. // Copy the colordata to the pixels
  298. int pos = 0;
  299. for (int line = 0; line < sz.height(); ++line) {
  300. KisHLineIterator it = dev->createHLineIterator(0, line, sz.width(), true);
  301. while (!it.isDone()) {
  302. if (m_page->radioGray->isChecked()) {
  303. TQ_UINT16 d = (TQ_INT16)*(data + pos);
  304. d = ntohs(d);
  305. memcpy(it.rawData(), &d, 2);
  306. pos += 2;
  307. }
  308. else {
  309. // Red
  310. TQ_UINT16 d = (TQ_INT16)*(data + pos);
  311. d = ntohs(d);
  312. memcpy(it.rawData() + 4, &d, 2);
  313. // Green
  314. pos += 2;
  315. d = (TQ_INT16)*(data + pos );
  316. d = ntohs(d);
  317. memcpy(it.rawData() + 2, &d, 2);
  318. // Blue
  319. pos += 2;
  320. d = (TQ_INT16)*(data + pos );
  321. d = ntohs(d);
  322. memcpy(it.rawData(), &d, 2);
  323. pos += 2;
  324. }
  325. cs->setAlpha(it.rawData(), OPACITY_OPAQUE, 1);
  326. ++it;
  327. }
  328. }
  329. img = dev->convertToTQImage(m_monitorProfile);
  330. }
  331. m_page->lblPreview->setImage(img);
  332. TQApplication::restoreOverrideCursor();
  333. }
  334. void KisRawImport::getImageData( TQStringList arguments )
  335. {
  336. // delete m_process;
  337. delete m_data;
  338. kdDebug(41008) << "getImageData " << arguments.join(" ") << "\n";
  339. TDEProcess process (this);
  340. m_data = new TQByteArray(0);
  341. for (TQStringList::iterator it = arguments.begin(); it != arguments.end(); ++it) {
  342. process << *it;
  343. }
  344. process.setUseShell(true);
  345. connect(&process, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), this, TQT_SLOT(slotReceivedStdout(TDEProcess *, char *, int)));
  346. connect(&process, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), this, TQT_SLOT(slotReceivedStderr(TDEProcess *, char *, int)));
  347. connect(&process, TQT_SIGNAL(processExited(TDEProcess *)), this, TQT_SLOT(slotProcessDone()));
  348. kdDebug(41008) << "Starting process\n";
  349. if (!process.start(TDEProcess::NotifyOnExit, TDEProcess::AllOutput)) {
  350. KMessageBox::error( 0, i18n("Cannot convert RAW files because the dcraw executable could not be started."));
  351. }
  352. while (process.isRunning()) {
  353. //kdDebug(41008) << "Waiting...\n";
  354. tqApp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput);
  355. //process.wait(2);
  356. }
  357. if (process.normalExit()) {
  358. kdDebug(41008) << "Return value of process: " << process.exitStatus() << "\n";
  359. }
  360. else {
  361. kdDebug(41008) << "Process did not exit normally. Exit signal: " << process.exitSignal() << "\n";
  362. m_err = true;
  363. }
  364. }
  365. void KisRawImport::slotProcessDone()
  366. {
  367. kdDebug(41008) << "process done!\n";
  368. }
  369. void KisRawImport::slotReceivedStdout(TDEProcess *, char *buffer, int buflen)
  370. {
  371. //kdDebug(41008) << "stdout received " << buflen << " bytes on stdout.\n";
  372. //kdDebug(41008) << TQString::fromAscii(buffer, buflen) << "\n";
  373. int oldSize = m_data->size();
  374. m_data->resize(oldSize + buflen, TQGArray::SpeedOptim);
  375. memcpy(m_data->data() + oldSize, buffer, buflen);
  376. }
  377. void KisRawImport::slotReceivedStderr(TDEProcess *, char *buffer, int buflen)
  378. {
  379. TQByteArray b(buflen);
  380. memcpy(b.data(), buffer, buflen);
  381. kdDebug(41008) << TQString(b) << "\n";
  382. KMessageBox::error(0, i18n("Error: Dcraw cannot load this image. Message: ") + TQString(b));
  383. m_err = true;
  384. }
  385. TQStringList KisRawImport::createArgumentList(bool forPreview)
  386. {
  387. TQStringList args;
  388. args.append("dcraw"); // XXX: Create a chalkdcraw so we can count on it being available
  389. //args.append("-v"); // Verbose
  390. args.append("-c"); // Write to stdout
  391. if (forPreview) {
  392. args.append("-h"); // Fast, half size image
  393. }
  394. if (m_page->radio8->isChecked()) {
  395. args.append("-2"); // 8 bits
  396. }
  397. else {
  398. args.append("-4"); // 16 bits
  399. }
  400. if (m_page->radioGray->isChecked()) {
  401. args.append("-d"); // Create grayscale image
  402. }
  403. if (m_page->chkCameraColors->isChecked()) {
  404. args.append("-m"); // Use camera raw colors instead of sRGB
  405. }
  406. if (m_page->radioAutomatic->isChecked()) {
  407. args.append("-a"); // Automatic white balancing
  408. }
  409. if (m_page->radioCamera->isChecked()) {
  410. args.append("-w"); // Use camera white balance, if present
  411. }
  412. if (m_page->chkFourColorRGB->isChecked()) {
  413. args.append("-f"); // Interpolate RGB as four colors
  414. }
  415. if (!m_page->chkClip->isChecked()) {
  416. args.append("-n"); // Do not clip colors
  417. }
  418. if (m_page->chkBrightness->isChecked()) {
  419. args.append("-b " + TQString::number(m_page->dblBrightness->value()));
  420. }
  421. if (m_page->chkBlackpoint->isChecked()) {
  422. args.append("-k " + TQString::number(m_page->dblBlackpoint->value()));
  423. }
  424. if (m_page->chkRed->isChecked()) {
  425. args.append("-r " + TQString::number(m_page->dblRed->value()));
  426. }
  427. if (m_page->chkBlue->isChecked()) {
  428. args.append("-l " + TQString::number(m_page->dblBlue->value()));
  429. }
  430. KisProfile * pf = profile();
  431. if (m_page->chkProfile->isChecked()) {
  432. if (!pf->filename().isNull()) {
  433. // Use the user-set profile, if it's not an lcms internal
  434. // profile. This does not add the profile to the image, we
  435. // need to do that later.
  436. args.append("-p \"" + pf->filename() + "\"");
  437. }
  438. }
  439. // Don't forget the filename
  440. args.append("\"" + m_chain -> inputFile() + "\"");
  441. return args;
  442. }
  443. TQSize KisRawImport::determineSize(TQ_UINT32& startOfImageData)
  444. {
  445. if (m_data->isNull() || m_data->size() < 2048) {
  446. startOfImageData = 0;
  447. return TQSize(0,0);
  448. }
  449. TQString magick = TQString::fromAscii(m_data->data(), 2);
  450. if (magick != "P6") {
  451. kdDebug(41008) << " Bad magick! " << magick << "\n";
  452. startOfImageData = 0;
  453. return TQSize(0,0);
  454. }
  455. // Find the third newline that marks the header end in a dcraw generated ppm.
  456. TQ_UINT32 i = 0;
  457. TQ_UINT32 counter = 0;
  458. while (true) {
  459. if (counter == 3) break;
  460. if (m_data->data()[i] == '\n') {
  461. counter++;
  462. }
  463. ++i;
  464. }
  465. TQString size = TQStringList::split("\n", TQString::fromAscii(m_data->data(), i))[1];
  466. kdDebug(41008) << "Header: " << TQString(TQString::fromAscii(m_data->data(), i)) << "\n";
  467. TQStringList sizelist = TQStringList::split(" ", size);
  468. TQ_INT32 w = sizelist[0].toInt();
  469. TQ_INT32 h = sizelist[1].toInt();
  470. startOfImageData = i;
  471. return TQSize(w, h);
  472. }
  473. KisProfile * KisRawImport::profile()
  474. {
  475. if (m_page->chkProfile->isChecked()) {
  476. return KisMetaRegistry::instance()->csRegistry()->getProfileByName(m_page->cmbProfile->currentText());
  477. }
  478. else
  479. return 0;
  480. }
  481. void KisRawImport::slotFillCmbProfiles()
  482. {
  483. KisID s = getColorSpace();
  484. KisColorSpaceFactory * csf = KisMetaRegistry::instance()->csRegistry() -> get(s);
  485. m_page -> cmbProfile -> clear();
  486. TQValueVector<KisProfile *> profileList = KisMetaRegistry::instance()->csRegistry()->profilesFor( csf );
  487. TQValueVector<KisProfile *> ::iterator it;
  488. for ( it = profileList.begin(); it != profileList.end(); ++it ) {
  489. m_page -> cmbProfile -> insertItem((*it) -> productName());
  490. }
  491. }
  492. KisID KisRawImport::getColorSpace()
  493. {
  494. if (m_page->radioRGB->isChecked()) {
  495. if (m_page->radio16->isChecked()) {
  496. return KisID( "RGBA16" );
  497. }
  498. }
  499. else {
  500. if (m_page->radio16->isChecked()) {
  501. return KisID( "GRAYA16" );
  502. }
  503. else {
  504. return KisID( "GRAYA" );
  505. }
  506. }
  507. return KisID("RGBA");
  508. }
  509. #include "kis_raw_import.moc"