home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_02 / HTMLDrv / Device.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.3 KB  |  67 lines

  1. //-----------------------------------------------------------------------------------//
  2. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  3. //                             ISBN  0-13-086985-6                                   //
  4. //                                                                                   //
  5. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  6. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  7. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  8. //                                                                                   //
  9. //  FileName   : device.h                                                             //
  10. //  Description: KDevice class, HTML/BMP driver, Chapter 2                           //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. typedef struct 
  15. {
  16.     DWORD        index;
  17.     const char * name;
  18. }    PAIR;
  19.  
  20. class KDevice
  21. {
  22.     int         nNesting;    // document, page
  23.     int      nPages;    // no of pages printed
  24.  
  25.     void     Write(const char * pStr);
  26.     void     WriteW(const WCHAR * pwStr);
  27.     void     WriteHex(unsigned val);
  28.     void     Writeln(const char * pStr = NULL);
  29.  
  30.     void     Write(DWORD index, const PAIR * pTable);
  31.  
  32.     char   * CopyBlock(char * pDest, void * pData, int size);
  33.     void     CopySurface(char * pDest, const SURFOBJ * pso);
  34.     
  35.     void     LogCall(int index, const void * para, int parano);
  36.  
  37. public:
  38.     int         width;        // width in inch * 10
  39.     int         height;    // height in inch * 10    
  40.  
  41.     HPALETTE hPalette;    // GDI need a palette even for 24 bpp
  42.     HSURF    hSurface;    // Device managed standard surface
  43.     HDEV     hDevice;    // GDI device handle.
  44.     HANDLE   hSpooler;  // Spooler handle
  45.     
  46.     int         nImage;
  47.  
  48. public:
  49.  
  50.     void Create(void)
  51.     {
  52.         nNesting  = 0;
  53.         nPages    = 0;
  54.         nImage    = 0;
  55.     }
  56.     
  57.     void     DumpSurface(const SURFOBJ * psoBM);
  58.  
  59.     BOOL     CallEngine(int index, const void * para, int parano);
  60.  
  61.     BOOL     StartDoc(LPCWSTR pszDocName, const void * firstpara, int parano);
  62.     BOOL     EndDoc(const void * firstpara, int parano);
  63.     BOOL     StartPage(const void * firstpara, int parano);
  64.     BOOL     SendPage(const void * firstpara, int parano);
  65. };
  66.  
  67.