Export (0) Print
Expand All

ColorDrawingEffect.cpp



#include "DrawingEffect.h"

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::ColorDrawingEffect                         *
*                                                                 *
*                                                                 *
*                                                                 *
******************************************************************/

ColorDrawingEffect::ColorDrawingEffect()
{
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::ColorDrawingEffect                         *
*                                                                 *
*                                                                 *
*                                                                 *
******************************************************************/

ColorDrawingEffect::ColorDrawingEffect(const D2D1_COLOR_F &color) :
    color_(color)
{
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::~ColorDrawingEffect                        *
*                                                                 *
*                                                                 *
*                                                                 *
******************************************************************/


ColorDrawingEffect::~ColorDrawingEffect()
{
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::GetColor                                   *
*                                                                 *
*                                                                 *
*                                                                 *
******************************************************************/

STDMETHODIMP ColorDrawingEffect::GetColor(D2D1_COLOR_F *color)
{
    *color = color_;

    return S_OK;
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::SetColor                                   *
*                                                                 *
*                                                                 *
*                                                                 *
******************************************************************/

STDMETHODIMP ColorDrawingEffect::SetColor(const D2D1_COLOR_F &color)
{
    color_ = color;

    return S_OK;
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::AddRef                                     *
*                                                                 *
*  Increments the ref count                                       *
*                                                                 *
******************************************************************/

STDMETHODIMP_(unsigned long) ColorDrawingEffect::AddRef()
{
    return InterlockedIncrement(&cRefCount_);
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::Release                                    *
*                                                                 *
*  Decrements the ref count and deletes the instance if the ref   *
*  count becomes 0                                                *
*                                                                 *
******************************************************************/

STDMETHODIMP_(unsigned long) ColorDrawingEffect::Release()
{
    unsigned long newCount = InterlockedDecrement(&cRefCount_);
    
    if (newCount == 0)
    {
        delete this;
        return 0;
    }

    return newCount;
}

/******************************************************************
*                                                                 *
*  ColorDrawingEffect::QueryInterface                             *
*                                                                 *
*  Query interface implementation                                 *
*                                                                 *
******************************************************************/

STDMETHODIMP ColorDrawingEffect::QueryInterface(
    IID const& riid,
    void** ppvObject
    )
{
    if (__uuidof(ColorDrawingEffect) == riid)
    {
        *ppvObject = this;
    }
    else if (__uuidof(IUnknown) == riid)
    {
        *ppvObject = this;
    }
    else
    {
        *ppvObject = NULL;
        return E_FAIL;
    }

    AddRef();

    return S_OK;
}



 

 

Community Additions

ADD
Show:
© 2014 Microsoft