summaryrefslogtreecommitdiff
path: root/print/XPSDrvSmpl/src/inc/gdip.h
blob: 923c34301bc158b7c7ffad5cad150e77fb2ed70e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*++

Copyright (c) 2005 Microsoft Corporation

All rights reserved.

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

File Name:

   gdip.h

Abstract:

   Provides a wrapper class around GDIPlus that takes care of intialisation
   and shutdown. A class only need define this as a member variable to use
   GDIPlus - intialisation and shutdown are handled during construction and
   destruction.

Known issues:

    The class does not yet implement debug event handling.

--*/

#pragma once

class GDIPlus
{
public:
    /*++

    Routine Name:

        GDIPlus

    Routine Description:

        GDIPlus class constructor

    Arguments:

        None

    Return Value:

        None

    --*/
    GDIPlus() :
        m_pGDIPlusToken(NULL),
        m_GDIPlusStartStatus(GdiplusNotInitialized)
    {
        GdiplusStartupInput gdiPlusStartInput;

        m_GDIPlusStartStatus = GdiplusStartup(&m_pGDIPlusToken, &gdiPlusStartInput, NULL);
    }

    /*++

    Routine Name:

        ~GDIPlus

    Routine Description:

        GDIPlus class destructor

    Arguments:

        None

    Return Value:

        None

    --*/
    virtual ~GDIPlus()
    {
        GdiplusShutdown(m_pGDIPlusToken);
        m_pGDIPlusToken = NULL;
        m_GDIPlusStartStatus = GdiplusNotInitialized;
    }

    /*++

    Routine Name:

        GetGDIPlusStartStatus

    Routine Description:

        This routine returns the start status of GDI Plus

    Arguments:

        None

    Return Value:

        Gdiplus::Status
        Ok            - On success
        Gdiplus error - On Error

    --*/
    Status GetGDIPlusStartStatus(
        VOID
        )
    {
        return m_GDIPlusStartStatus;
    }

private:
    ULONG_PTR m_pGDIPlusToken;

    Status  m_GDIPlusStartStatus;
};