summaryrefslogtreecommitdiff
path: root/avstream/avscamera/sys/XRGBSynthesizer.h
blob: 5e7ddd460e1eca20029f7efb532a993bab1c84a1 (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
/**************************************************************************

    A/V Stream Camera Sample

    Copyright (c) 2014, Microsoft Corporation.

    File:

        XRGBSynthesizer.h

    Abstract:

        This file contains the definition of CXRGBSynthesizer.

        CXRGBSynthesizer is derived from CSynthesizer.  It uses the RGB 
        color space and defines a Commit() function.  XRGB is known also
        known as RGB32.  It uses 8 bits per primary plus 8 bits of padding
        for 4 bytes per pixel in a single plane.

    History:

        created 4/14/2014

**************************************************************************/

/*************************************************

    CXRGBSynthesizer

    Image synthesizer for XRGB (aka RGB32) format.

*************************************************/

class CXRGBSynthesizer
    : public CSynthesizer
{
protected:
    BOOLEAN m_FlipVertical;

public:
    //
    // DEFAULT CONSTRUCTOR:
    //
    CXRGBSynthesizer (
        LONG Width=0,
        LONG Height=0
    ) :
        CSynthesizer("RGB32", CHANNEL_RGB, Width, ABS(Height))
        , m_FlipVertical(Height==ABS(Height))
    {
        m_OutputStride = Width * sizeof(KS_RGBQUAD);
    }

    //
    // DESTRUCTOR:
    //
    virtual
    ~CXRGBSynthesizer ()
    {}

    //
    //  Commit
    //
    //  Copy (and reformat, if necessary) pixels from the internal scratch
    //  buffer.  If the output format decimates chrominance, do it here.
    //
    virtual
    _Success_(return > 0)
    ULONG
    Commit(
        _Out_writes_bytes_(Size)
        PUCHAR  Buffer,
        _In_    ULONG   Size,
        _In_    ULONG   Stride
    );

    //
    // Initialize()
    //
    //  Initialize the Gradient bmp for RGB color space.
    //
    virtual
    BOOLEAN
    Initialize();

protected:
    //
    //  GetPalette
    //
    //  Get a pointer to an array of palette colors.  Used mostly to handle
    //  different color primaries.  Location of the primary must agree with
    //  Commit().
    virtual
    const UCHAR4 *
    GetPalette();
};