ImageFactory_IPicture.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) =USTC= Fu Li
  3. *
  4. * Author : Fu Li
  5. * Create : 2005-9-12
  6. * Home : http://www.crazy-bit.com/
  7. * Mail : crazybit@263.net
  8. * History :
  9. */
  10. #ifndef __FOO_IMAGEFACTORY_IPICTURE__2005_09_12__H__
  11. #define __FOO_IMAGEFACTORY_IPICTURE__2005_09_12__H__
  12. #include "ImageFactory_Mini.h"
  13. #ifdef WIN32
  14. #include "ImageHandle_IPicture.h"
  15. //class FCImageHandleFactory ;
  16. class FCImageHandleFactory_IPicture ;
  17. //=============================================================================
  18. /**
  19. * Read/Write image via WIN32 IPicture (<B>All WIN32</B>).
  20. @verbatim
  21. BMP TGA Jpg Gif
  22. Read O O O O
  23. Write O O X X
  24. @endverbatim
  25. */
  26. class FCImageHandleFactory_IPicture : public FCImageHandleFactory
  27. {
  28. virtual FCImageHandleBase* CreateImageHandle (IMAGE_TYPE imgType)
  29. {
  30. switch (imgType)
  31. {
  32. case IMG_BMP : return new FCImageHandle_Bmp ;
  33. case IMG_TGA : return new FCImageHandle_Tga ;
  34. case IMG_JPG :
  35. case IMG_GIF : return new FCImageHandle_IPicture ;
  36. }
  37. return 0 ;
  38. }
  39. virtual ~FCImageHandleFactory_IPicture() {}
  40. };
  41. #endif // end WIN32
  42. inline FCImageHandleFactory* FCObjImage::__ManageImageHandleFactory (bool bGet, FCImageHandleFactory* pFactory)
  43. {
  44. #ifdef WIN32
  45. static std::auto_ptr<FCImageHandleFactory> s_pFactory (new FCImageHandleFactory_IPicture) ;
  46. #else
  47. static std::auto_ptr<FCImageHandleFactory> s_pFactory (new FCImageHandleFactory_Mini) ;
  48. #endif
  49. if (!bGet && pFactory)
  50. s_pFactory = std::auto_ptr<FCImageHandleFactory>(pFactory) ;
  51. return s_pFactory.get() ;
  52. }
  53. #endif