home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / gdi / mandel / jtypes.h < prev    next >
Text File  |  1997-10-05  |  5KB  |  122 lines

  1. /******************************Module*Header*******************************\
  2. * Module Name: jtypes.h
  3. *
  4. * Contains the INFO structure and handy macros
  5. *
  6. * Created: 10-Jan-1992 13:21:01
  7. * Author: Petrus Wong
  8. *
  9. * Copyright (C) 1993-1997 Microsoft Corporation
  10. *
  11. * The INFO structure is allocated dynmamically when the MDI child is
  12. * created and freed when the window is about to be destroyed.  The pointer
  13. * to this data structure is stored in the LONG user data window structure.
  14. * This data structure stores the per-window's info.
  15. *
  16. * Dependencies:
  17. *
  18. *   #include windows.h
  19. *
  20. \**************************************************************************/
  21. //
  22. // Handy macros for the transformations used in fractal generations
  23. //
  24. #define Xform(Pt, SrcFrom, SrcTo, DestFrom, DestTo) \
  25.          (((Pt-SrcFrom)/(SrcTo-SrcFrom)*(DestTo-DestFrom))+DestFrom)
  26. #define Xform2(Pt, SrcFrom, SrcTo, DestFrom, DestTo) \
  27.          ((int) ((Pt-SrcFrom)/(SrcTo-SrcFrom)*(DestTo-DestFrom)+DestFrom))
  28. #define XformFix(Pt, SrcFrom, SrcTo, DestFrom, DestTo) \
  29.          (lMul(lDiv(Pt-SrcFrom,SrcTo-SrcFrom), DestTo-DestFrom)+DestFrom)
  30.  
  31. #define SIZEOFCAPTIONTEXT    20
  32. #define MAX_FRAME           800
  33. #define MAX_FILE            800
  34.  
  35. typedef struct _FileInfo{
  36.     HANDLE      hFile;
  37.     HANDLE      hMapFile;
  38.     LPVOID      lpvMapView;
  39. } FILEINFO, *PFILEINFO;
  40.  
  41. typedef struct _RLEDATA{
  42.     ULONG           ulFiles;
  43.     ULONG           ulFrames;
  44.     HPALETTE        hPal;
  45.     LPBITMAPINFO    pbmi;
  46.     FILEINFO        rgFileInfo[MAX_FILE];
  47.     PBYTE           rgpjFrame[MAX_FRAME];
  48.     ULONG           ulSize[MAX_FRAME];
  49.     PBITMAPINFO     rgpbmi[MAX_FRAME];
  50. } RLEDATA, *PRLEDATA;
  51.  
  52. typedef struct _PerWndInfo {
  53.     char    CaptionBarText[SIZEOFCAPTIONTEXT];
  54.     HWND    hwnd;               // hJulia or hView, the drawing surface
  55.     HWND    hParent;            // ghwndClient, the client area of main frame
  56.     HWND    hTextWnd;           // hTextWnd, the status window
  57.     RECT    rcClient;           // hJulia & hTextWnd's parent rc
  58.     HDC     hdcClient;          // DC handle of client area of main frame
  59.     HRGN    hRgnPath;           // Region handle for the drawing surface
  60.     HANDLE  hThrd;              // handle to drawing thread or play thread
  61.     HANDLE  hThrd0;
  62.     BOOL    bDrawing;           // curently drawing?
  63.     DWORD   dwThreadId;         // drawing thread or play thread ID
  64.     DWORD   dwElapsed;          // elapsed time for the drawing operation
  65.     double  xFrom;              // drawing range in floating points
  66.     double  xTo;                //
  67.     double  yFrom;              //         Floating Points
  68.     double  yTo;                //
  69.     double  c1;                 // C = c1 + i c2 where c1, c2 are reals
  70.     double  c2;                 // the C value corresponding to the Julia set
  71.     LONG    lxFrom;             // drawing range in fix points
  72.     LONG    lxTo;               //
  73.     LONG    lyFrom;             //         Fix Points
  74.     LONG    lyTo;               //
  75.     LONG    lc1;                // C = c1 + i c2 where c1, c2 are reals
  76.     LONG    lc2;                // the C value corresponding to the Julia set
  77.     HBITMAP hBmpSaved;          // saved bitmap for the drawing
  78.     BOOL    bSizeChng;          //        not used
  79.     BOOL    bMandel;            // Drawing is a Mandelbrot or Julia set?
  80.     int     iIteration;         // number of computations done on each pixel
  81.     int     iStep;              // drawn on every one, two or three line(s)?
  82.     BOOL    bStretch;           // stretching bitmaps
  83.     int     iStretchMode;       // stretching mode to use
  84.     BOOL    bSetDIBsToDevice;   // SetDIBsToDevice reather than BitBlt?
  85.     BOOL    bFill;              // FloodFill mode presently?
  86.     HBRUSH  hBrush;             // handle to brush
  87.     HANDLE  hQuitEvent;         // Event for quiting color cycling thread
  88.     HANDLE  hCycleThrd;         // Color cycling thread
  89.     DWORD   dwCycleThrdID;      // Color cycling thread ID
  90.     BOOL    bClrCycle;          // For suspending and resuming color cycle thrd
  91.     BOOL    bFirstTime;         // Creating color cycling thrd only once
  92.     DWORD   dwSuspend;          // Store return result of suspend/resume cycle thrd
  93.     HBITMAP hBmpMono;           // Monochrome bitmap
  94.     BOOL    bUseMono;           // Display monochrome bitmap instead
  95.     HANDLE  hPrtThrd;           // Print thread
  96.     DWORD   dwPrtThrdID;        // Print thread ID
  97.     HPALETTE    hPal;           // The palette used for the drawing
  98.     HPALETTE    hHTPal;         // The halftone palette used for the drawing
  99.     HPALETTE    hCyclePal;
  100.     RLEDATA RleData;            // RLE data for RLE viewer
  101.     BOOL    bPlayRleCont;       // Playing RLE continuously
  102.     PVOID   *prghPen;           // Pointer to array of hPen
  103.     INT     iPen;               // number of Pens
  104.     INT     iPriority;          // thread priority
  105.     BOOL    bUseDIB;            // Should we use the DIB for stretch?
  106.     BOOL    bCoreHdr;           // used in bDrawDIB
  107. } INFO, *PINFO;
  108.  
  109. typedef struct _PrtData{
  110.     INFO        info;
  111.     int         index;
  112.     BOOL        bUseDefault;
  113.     DEVMODE     DevMode;
  114. } PRTDATA, *PPRTDATA;
  115.  
  116. typedef struct _FileHdr{
  117.     DWORD       bfSize;
  118.     WORD        bfReserved1;
  119.     WORD        bfReserved2;
  120.     DWORD       bfOffbits;
  121. } FILEHDR;
  122.