Example #1
0
// TLIBMAIN
void initImageIo(bool lightVersion) {
  if (!lightVersion) {
    TLevelWriter::define("pli", TLevelWriterPli::create, false);
    TLevelReader::define("pli", TLevelReaderPli::create);
    TFileType::declare("pli", TFileType::VECTOR_LEVEL);

    TLevelReader::define("svg", 0, TLevelReaderSvg::create);
    TFileType::declare("svg", TFileType::VECTOR_LEVEL);
    TLevelWriter::define("svg", TLevelWriterSvg::create, false);
    Tiio::defineWriterProperties("svg", new Tiio::SvgWriterProperties());

    TLevelWriter::define("tzl", TLevelWriterTzl::create, false);
    TLevelReader::define("tzl", TLevelReaderTzl::create);
    TFileType::declare("tzl", TFileType::RASTER_LEVEL);

    TLevelWriter::define("tlv", TLevelWriterTzl::create, false);
    TLevelReader::define("tlv", TLevelReaderTzl::create);
    TFileType::declare("tlv", TFileType::CMAPPED_LEVEL);

    Tiio::defineReaderMaker("tzp", Tiio::makeTzpReader);
    Tiio::defineWriterMaker("tzp", Tiio::makeTzpWriter, false);
    TFileType::declare("tzp", TFileType::CMAPPED_IMAGE);

    Tiio::defineReaderMaker("tzu", Tiio::makeTzpReader);
    Tiio::defineWriterMaker("tzu", Tiio::makeTzpWriter, false);
    TFileType::declare("tzu", TFileType::CMAPPED_IMAGE);

    Tiio::defineReaderMaker("tzi", Tiio::makeTziReader);
    TFileType::declare("tzi", TFileType::RASTER_IMAGE);

    Tiio::defineReaderMaker("plt", Tiio::makePltReader);
    Tiio::defineWriterMaker("plt", Tiio::makePltWriter, false);
    TFileType::declare("plt", TFileType::RASTER_IMAGE);

    Tiio::defineReaderMaker("nol", Tiio::makePngReader);
    Tiio::defineWriterMaker("nol", Tiio::makePngWriter, true);
    TFileType::declare("nol", TFileType::RASTER_IMAGE);

    TLevelWriter::define("psd", TLevelWriterPsd::create, false);
    TLevelReader::define("psd", TLevelReaderPsd::create);
    TFileType::declare("psd", TFileType::RASTER_LEVEL);

    TLevelWriter::define("mesh", TLevelWriterMesh::create, false);
    TLevelReader::define("mesh", TLevelReaderMesh::create);
    TFileType::declare("mesh", TFileType::MESH_IMAGE);

  }  // !lightversion

  TFileType::declare("tpl", TFileType::PALETTE_LEVEL);

  Tiio::defineReaderMaker("png", Tiio::makePngReader);
  Tiio::defineWriterMaker("png", Tiio::makePngWriter, true);
  TFileType::declare("png", TFileType::RASTER_IMAGE);
  Tiio::defineWriterProperties("png", new Tiio::PngWriterProperties());

  Tiio::defineReaderMaker("tga", Tiio::makeTgaReader);
  Tiio::defineWriterMaker("tga", Tiio::makeTgaWriter, true);
  TFileType::declare("tga", TFileType::RASTER_IMAGE);
  Tiio::defineWriterProperties("tga", new Tiio::TgaWriterProperties());

  Tiio::defineReaderMaker("tif", Tiio::makeTifReader);
  Tiio::defineWriterMaker("tif", Tiio::makeTifWriter, true);
  TFileType::declare("tif", TFileType::RASTER_IMAGE);
  Tiio::defineWriterProperties("tif", new Tiio::TifWriterProperties());

  Tiio::defineReaderMaker("tiff", Tiio::makeTifReader);
  Tiio::defineWriterMaker("tiff", Tiio::makeTifWriter, true);
  TFileType::declare("tiff", TFileType::RASTER_IMAGE);
  Tiio::defineWriterProperties("tiff", new Tiio::TifWriterProperties());

  Tiio::defineReaderMaker("sgi", Tiio::makeSgiReader);
  Tiio::defineWriterMaker("sgi", Tiio::makeSgiWriter, true);
  TFileType::declare("sgi", TFileType::RASTER_IMAGE);
  Tiio::defineWriterProperties("sgi", new Tiio::SgiWriterProperties());

  Tiio::defineReaderMaker("rgb", Tiio::makeSgiReader);
  Tiio::defineWriterMaker("rgb", Tiio::makeSgiWriter, true);
  TFileType::declare("rgb", TFileType::RASTER_IMAGE);
  Tiio::defineWriterProperties("rgb", new Tiio::SgiWriterProperties());

  TLevelWriter::define("spritesheet", TLevelWriterSprite::create, true);
  TFileType::declare("spritesheet", TFileType::RASTER_LEVEL);
  Tiio::defineWriterProperties("spritesheet",
                               new Tiio::SpriteWriterProperties());

// ffmpeg
#if !defined(_WIN32) || defined(x64)
  if (Ffmpeg::checkFfmpeg()) {
    bool ffprobe = Ffmpeg::checkFfprobe();
    if (Ffmpeg::checkFormat("webm")) {
      TLevelWriter::define("webm", TLevelWriterWebm::create, true);
      if (ffprobe) TLevelReader::define("webm", TLevelReaderWebm::create);
      TFileType::declare("webm", TFileType::RASTER_LEVEL);
      Tiio::defineWriterProperties("webm", new Tiio::WebmWriterProperties());
    }
    if (Ffmpeg::checkFormat("gif")) {
      TLevelWriter::define("gif", TLevelWriterGif::create, true);
      if (ffprobe) TLevelReader::define("gif", TLevelReaderGif::create);
      TFileType::declare("gif", TFileType::RASTER_LEVEL);
      Tiio::defineWriterProperties("gif", new Tiio::GifWriterProperties());
    }
    if (Ffmpeg::checkFormat("mp4")) {
      TLevelWriter::define("mp4", TLevelWriterMp4::create, true);
      if (ffprobe) TLevelReader::define("mp4", TLevelReaderMp4::create);
      TFileType::declare("mp4", TFileType::RASTER_LEVEL);
      Tiio::defineWriterProperties("mp4", new Tiio::Mp4WriterProperties());
    }
  }
#endif
  // end ffmpeg

  if (!lightVersion) {
#ifdef _WIN32

    TLevelWriter::define("avi", TLevelWriterAvi::create, true);
    TLevelReader::define("avi", TLevelReaderAvi::create);
    TFileType::declare("avi", TFileType::RASTER_LEVEL);
    Tiio::defineWriterProperties("avi", new Tiio::AviWriterProperties());

#endif  // _WIN32

    if (IsQuickTimeInstalled()) {
      TLevelWriter::define("mov", TLevelWriterMov::create, true);
      TLevelReader::define("mov", TLevelReaderMov::create);
      TFileType::declare("mov", TFileType::RASTER_LEVEL);
      Tiio::defineWriterProperties("mov", new Tiio::MovWriterProperties());

      TLevelWriter::define("3gp", TLevelWriter3gp::create, true);
      TLevelReader::define("3gp", TLevelReader3gp::create);
      TFileType::declare("3gp", TFileType::RASTER_LEVEL);
      Tiio::defineWriterProperties("3gp", new Tiio::MovWriterProperties());
    }

    /*
#if (defined(_WIN32) && !defined(x64))

TLevelWriter::define("pct", TLevelWriterPicPct::create, true);
TLevelReader::define("pct", TLevelReaderPicPct::create);
TFileType::declare("pct", TFileType::RASTER_LEVEL);
Tiio::defineWriterProperties("pct", new Tiio::PctWriterProperties());
TLevelWriter::define("pic", TLevelWriterPicPct::create, true);
TLevelReader::define("pic", TLevelReaderPicPct::create);
TFileType::declare("pic", TFileType::RASTER_LEVEL);

TLevelWriter::define("pict", TLevelWriterPicPct::create, true);
TLevelReader::define("pict", TLevelReaderPicPct::create);
TFileType::declare("pict", TFileType::RASTER_LEVEL);
Tiio::defineWriterProperties("pict", new Tiio::PctWriterProperties());

#endif    // _WIN32 && 32-bit
*/
  }
}
Example #2
0
int main( void )
{
	long	result = 0;
	
	// initialize for carbon & QuickTime
	InitCursor();
	if ( IsQuickTimeInstalled() )
		EnterMovies();
	else
		goto bail;
		
	GetQDGlobalsScreenBits( &screenBits );
	
	Gestalt(gestaltMenuMgrAttr, &result);
	if (result & gestaltMenuMgrAquaLayoutMask) {
		// Mmmmmm...X
		SetMenuBar(GetNewMBar(129));
		if (AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(doAEQuit), 0, false))
			goto bail;
	} else {
		SetMenuBar(GetNewMBar(128));
	}
	DrawMenuBar();
	
	while (gDone == false) {
		EventRecord theEvent;
		WindowPtr pWhichWindow;		
		short windowPart;
        Boolean SIOUXHandledEvent = false;
		
		WaitNextEvent(everyEvent, &theEvent, 0, NULL);
		
        #ifndef __MACH__
            SIOUXHandledEvent = SIOUXHandleOneEvent(&theEvent);
        #endif
        
		if ( !SIOUXHandledEvent ) {
		
			switch (theEvent.what) {
				case updateEvt:
					pWhichWindow = (WindowPtr)theEvent.message;
					
					// we don't do anything for this simple sample
					BeginUpdate(pWhichWindow);
					EndUpdate(pWhichWindow);
					break;
				
				case keyDown:
					if (theEvent.modifiers & cmdKey) {
						doMenu(MenuKey(theEvent.message & charCodeMask));
					}
					break;
				
				case mouseDown:
					windowPart = FindWindow(theEvent.where, &pWhichWindow);

					switch (windowPart) {
						case inDrag:
							DragWindow(pWhichWindow, theEvent.where, &screenBits.bounds);
							break;

						case inGoAway:
							if (TrackGoAway(pWhichWindow, theEvent.where))
								DisposeWindow( pWhichWindow );
								//gDone = true;
							break;

						case inContent:
							SelectWindow(pWhichWindow);
							break;

						case inMenuBar:
							doMenu(MenuSelect(theEvent.where));
							break;
					}
					break;
			}
		}
	}
	
bail:

	return 0;	
}