GdiPlusInit.h
上传用户:jinlangri
上传日期:2022-07-17
资源大小:10774k
文件大小:3k
源码类别:

GDI/图象编程

开发平台:

Visual C++

  1. /**************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. *   Gdiplus init
  8. *
  9. * Abstract:
  10. *
  11. *   GDI+ startup/shutdown API's
  12. *
  13. * Created:
  14. *
  15. *   09/02/2000 agodfrey
  16. *      Created it.
  17. *
  18. **************************************************************************/
  19. #ifndef _GDIPLUSINIT_H
  20. #define _GDIPLUSINIT_H
  21. // Used for debug event notification (debug builds only)
  22. enum DebugEventLevel
  23. {
  24.     DebugEventLevelFatal,
  25.     DebugEventLevelWarning
  26. };
  27. // Callback function that GDI+ can call, on debug builds, for assertions
  28. // and warnings.
  29. typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message);
  30. // Notification functions which the user must call appropriately if
  31. // "SuppressBackgroundThread" (below) is set.
  32. typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token);
  33. typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token);
  34. // Input structure for GdiplusStartup()
  35. struct GdiplusStartupInput
  36. {
  37.     UINT32 GdiplusVersion;             // Must be 1
  38.     DebugEventProc DebugEventCallback; // Ignored on free builds
  39.     BOOL SuppressBackgroundThread;     // FALSE unless you're prepared to call 
  40.                                        // the hook/unhook functions properly
  41.     BOOL SuppressExternalCodecs;       // FALSE unless you want GDI+ only to use
  42.                                        // its internal image codecs.
  43.     
  44.     GdiplusStartupInput(
  45.         DebugEventProc debugEventCallback = NULL,
  46.         BOOL suppressBackgroundThread = FALSE,
  47.         BOOL suppressExternalCodecs = FALSE)
  48.     {
  49.         GdiplusVersion = 1;
  50.         DebugEventCallback = debugEventCallback;
  51.         SuppressBackgroundThread = suppressBackgroundThread;
  52.         SuppressExternalCodecs = suppressExternalCodecs;
  53.     }
  54. };
  55. // Output structure for GdiplusStartup()
  56. struct GdiplusStartupOutput
  57. {
  58.     // The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
  59.     // Otherwise, they are functions which must be called appropriately to
  60.     // replace the background thread.
  61.     //
  62.     // These should be called on the application's main message loop - i.e.
  63.     // a message loop which is active for the lifetime of GDI+.
  64.     // "NotificationHook" should be called before starting the loop,
  65.     // and "NotificationUnhook" should be called after the loop ends.
  66.     
  67.     NotificationHookProc NotificationHook;
  68.     NotificationUnhookProc NotificationUnhook;
  69. };
  70. // GDI+ initialization. Must be called before GDI+ API's are used.
  71. //
  72. // token  - may not be NULL - accepts a token to be passed in the corresponding
  73. //          GdiplusShutdown call.
  74. // input  - may not be NULL
  75. // output - may be NULL only if input->SuppressBackgroundThread is FALSE.
  76. extern "C" Status WINAPI GdiplusStartup(
  77.     OUT ULONG_PTR *token,
  78.     const GdiplusStartupInput *input,
  79.     OUT GdiplusStartupOutput *output);
  80. // GDI+ termination. Must be called before GDI+ is unloaded. GDI+ API's may not
  81. // be called after this.
  82. extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
  83. #endif