/*------------------------------------------------------------------------------
 src/lib/djImage/imageApp.cxx
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

//#define DJ_DBG
#include "djImageApp.h"
#include <djImageOp.h>
#include <djImageOpCore.h>
#include <djImageOpGen.h>
#include <djImageOpColor.h>
#include <djImageOpXform.h>
#include <djImageOpComp.h>
#include <djImageIo.h>
#include <djImageIoTga.h>
#include <djImageIoSgi.h>
#include <djImageIoPpm.h>
#include <djImageIoDpx.h>

namespace dj {

ImageApp::ImageApp(const Str & name, int & argc, char ** argv) :
  AppBase(name, argc, argv)
{
  DJ_DBG_FNC("dj::ImageApp::ImageApp");
  
  // Plugin factories.
  //
  _imageOpFactory.set(searchPathList());
  _imageLoadFactory.set(searchPathList());
  _imageSaveFactory.set(searchPathList());
  imageFactoryInit();
}

ImageApp::~ImageApp()
{
  DJ_DBG_FNC("dj::ImageApp::~ImageApp");
}

void ImageApp::imageFactoryInit()
{
  DJ_DBG_FNC("dj::ImageApp::imageFactoryInit");
  
  _imageOpFactory.pluginAdd(imageOpCoreList());
  _imageOpFactory.pluginAdd(imageOpGenList());
  _imageOpFactory.pluginAdd(imageOpColorList());
  _imageOpFactory.pluginAdd(imageOpXformList());
  _imageOpFactory.pluginAdd(imageOpCompList());
  
  List<ImageLoad *> loadList;
  loadList += new ImageIoTga::Load;
  loadList += new ImageIoSgi::Load;
  loadList += new ImageIoPpm::Load;
  loadList += new ImageIoDpx::Load;
  _imageLoadFactory.pluginAdd(loadList);

  List<ImageSave *> saveList;
  saveList += new ImageIoTga::Save;
  saveList += new ImageIoSgi::Save;
  saveList += new ImageIoPpm::Save;
  saveList += new ImageIoDpx::Save;
  _imageSaveFactory.pluginAdd(saveList);
}

}
