File: dcgraph.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (112 lines) | stat: -rw-r--r-- 3,946 bytes parent folder | download | duplicates (4)
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
/////////////////////////////////////////////////////////////////////////////
// Name:        dcgraph.h
// Purpose:     interface of wxGCDC
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxGCDC

    wxGCDC is a device context that draws on a wxGraphicsContext.

    wxGCDC does its best to implement wxDC API, but the following features are
    not (fully) implemented because wxGraphicsContext doesn't support them:

    - GetPixel() method is not implemented and always returns @false because
      modern graphics layers don't support retrieving the contents of the drawn
      pixels.

    - FloodFill() method is not, and can't be, implemented, as its
      functionality relies on reading the pixels from wxGraphicsContext too.

    - SetLogicalFunction() method only works with @c wxCOPY, @c wxOR,
      @c wxNO_OP, @c wxCLEAR and @c wxXOR functions, attempts to use any other
      function (including @c wxINVERT) don't do anything.

    - Similarly, ::wxRasterOperationMode parameter of Blit() and StretchBlit()
      can only be one of the supported logical functions listed above, using
      any other function will result in an assertion failure and not drawing
      anything.

    - For Direct2D-based wxGraphicsContext, only true-type fonts can be used
      in the font-related functions.

    @library{wxcore}
    @category{dc}

    @see wxDC, wxGraphicsContext
*/

class wxGCDC: public wxDC
{
public:
    /**
       Constructs a wxGCDC from a wxWindowDC.
    */
    wxGCDC( const wxWindowDC& windowDC );

    /**
       Constructs a wxGCDC from a wxMemoryDC.
    */
    wxGCDC( const wxMemoryDC& memoryDC );

    /**
       Constructs a wxGCDC from a wxPrinterDC.
    */
    wxGCDC( const wxPrinterDC& printerDC );

    /**
       Construct a wxGCDC from an existing graphics context.

       Note that this object takes ownership of @a context and will delete it
       when it is destroyed or when SetGraphicsContext() is called with a
       different context object.

       Also notice that @a context will continue using the same font, pen and
       brush as before until SetFont(), SetPen() or SetBrush() is explicitly
       called to change them. This means that the code can use this
       wxDC-derived object to work using pens and brushes with alpha component,
       for example (which normally isn't supported by wxDC API), but it also
       means that the return values of GetFont(), GetPen() and GetBrush() won't
       really correspond to the actually used objects because they simply can't
       represent them anyhow. If you wish to avoid such discrepancy, you need
       to call the setter methods to bring wxDC and wxGraphicsContext font, pen
       and brush in sync with each other.
    */
    wxGCDC(wxGraphicsContext* context);

    /**
       Constructs a wxGCDC from a wxEnhMetaFileDC.

       This constructor is only available in wxMSW port and when @c
       wxUSE_ENH_METAFILE build option is enabled, i.e. when wxEnhMetaFileDC
       class itself is available.

       @since 2.9.3
    */
    wxGCDC( const wxEnhMetaFileDC& emfDC );

    wxGCDC();
    virtual ~wxGCDC();

    /**
       Retrieves associated wxGraphicsContext
    */
    wxGraphicsContext* GetGraphicsContext() const;

    /**
       Set the graphics context to be used for this wxGCDC.

       Note that this object takes ownership of @a context and will delete it when
       it is destroyed or when SetGraphicsContext() is called again.

       Also, unlike the constructor taking wxGraphicsContext, this method will
       reapply the current font, pen and brush, so that this object continues
       to use them, if they had been changed before (which is never the case
       when constructing wxGCDC directly from wxGraphicsContext).
    */
    void SetGraphicsContext(wxGraphicsContext* context);

};