home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OWLSRC.PAK / WING.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  3.1 KB  |  128 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.11  $
  6. //
  7. // Implementation of TWinGDll, a WinG dll wrapper
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_WING_H)
  11. # include <owl/wing.h>
  12. #endif
  13.  
  14. OWL_DIAGINFO;
  15.  
  16. #if defined(BI_PLAT_WIN32)
  17.   static char WinGDllName[] = "WinG32.DLL";
  18. #else
  19.   static char WinGDllName[] = "WinG.DLL";
  20. #endif
  21.  
  22.  
  23. HDC      
  24. TWinGDll::CreateDC()
  25. {
  26.   static TModuleProc0<HDC> createDC(WinGModule(), "WinGCreateDC");
  27.   return createDC();
  28. }
  29.  
  30. BOOL     
  31. TWinGDll::RecommendDIBFormat(BITMAPINFO* p1)
  32. {
  33.   static TModuleProc1<BOOL, BITMAPINFO*> 
  34.   recommendDIBFormat(WinGModule(), "WinGRecommendDIBFormat");
  35.   return recommendDIBFormat(p1);
  36. }
  37.  
  38. HBITMAP  
  39. TWinGDll::CreateBitmap(HDC p1, BITMAPINFO const* p2, void** p3)
  40. {
  41.   static TModuleProc3<HBITMAP,HDC,BITMAPINFO const*,void**>
  42.   createBitmap(WinGModule(), "WinGCreateBitmap");
  43.   return createBitmap(p1, p2, p3);
  44. }
  45.  
  46. void*    
  47. TWinGDll::GetDIBPointer(HBITMAP p1, BITMAPINFO* p2)
  48. {
  49.   static TModuleProc2<void*,HBITMAP,BITMAPINFO*> 
  50.   getDIBPointer(WinGModule(), "WinGGetDIBPointer");
  51.   return getDIBPointer(p1, p2);
  52. }
  53.  
  54. uint     
  55. TWinGDll::GetDIBColorTable(HDC p1, uint p2, uint p3, RGBQUAD* p4)
  56. {
  57.   static TModuleProc4<uint,HDC,uint,uint,RGBQUAD*> 
  58.   getDIBColorTable(WinGModule(), "WinGGetDIBColorTable");
  59.   return getDIBColorTable(p1, p2, p3, p4);
  60. }
  61.  
  62. uint     
  63. TWinGDll::SetDIBColorTable(HDC p1, uint p2, uint p3, RGBQUAD const* p4)
  64. {
  65.   static TModuleProc4<uint,HDC,uint,uint,RGBQUAD const far*> 
  66.   setDIBColorTable(WinGModule(), "WinGSetDIBColorTable");
  67.   return setDIBColorTable(p1, p2, p3, p4);
  68. }
  69.  
  70. HPALETTE 
  71. TWinGDll::CreateHalftonePalette()
  72. {
  73.   static TModuleProc0<HPALETTE> 
  74.   createHalftonePalette(WinGModule(), "WinGCreateHalftonePalette");
  75.   return createHalftonePalette();
  76. }
  77.  
  78. HBRUSH   
  79. TWinGDll::CreateHalfToneBrush(HDC p1, COLORREF p2, WING_DITHER_TYPE p3)
  80. {
  81.   static TModuleProc3<HBRUSH,HDC,COLORREF,WING_DITHER_TYPE> 
  82.   createHalftoneBrush(WinGModule(), "WinGCreateHalftoneBrush");
  83.   return createHalftoneBrush(p1, p2, p3);
  84. }
  85.  
  86. BOOL     
  87. TWinGDll::BitBlt(HDC p1, int p2, int p3, int p4, int p5, HDC p6, int p7, int p8)
  88. {
  89.   static TModuleProc8<BOOL,HDC,int,int,int,int,HDC,int,int> 
  90.   bitBlt(WinGModule(), "WinGBitBlt");
  91.   return bitBlt(p1, p2, p3, p4, p5, p6, p7, p8);
  92. }
  93.  
  94. BOOL     
  95. TWinGDll::StretchBlt(HDC p1, int p2, int p3, int p4, int p5, HDC p6, int p7, int p8, int p9, int p10)
  96. {
  97.   static TModuleProc10<BOOL,HDC,int,int,int,int,HDC,int,int,int,int> 
  98.   stretchBlt(WinGModule(), "WinGStretchBlt");
  99.   return stretchBlt(p1, p2 , p3, p4, p5, p6, p7, p8, p9, p10);
  100. }
  101.  
  102. TModule& 
  103. TWinGDll::WinGModule()
  104. {
  105.   static TModule wingModule(WinGDllName, true, true);
  106.   return wingModule;
  107. }
  108.  
  109. bool     
  110. TWinGDll::IsAvailable()
  111. {
  112.   return WinGModule().IsLoaded();
  113. }
  114.  
  115. bool       
  116. TWinG::IsAvailable()
  117. {
  118.   return TWinGDll::IsAvailable();
  119. }
  120.  
  121. TWinGDll*  
  122. TWinG::Dll()
  123. {
  124.   static TWinGDll wingDLL;
  125.   return &wingDLL;
  126. }
  127.  
  128.