//+-------------------------------------------------------------------------- // // 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. // // Copyright (c) Microsoft Corporation. All rights reserved. // // Abstract: // Implementation of CDeviceModelPluginSample methods // //---------------------------------------------------------------------------- #include "stdafx.h" #include "DeviceModelPluginSample.h" #include "PluginSampleObject.h" #include // // The sample produces 3-channel sRGB // #define PLUGIN_CHANNELS 3 //+--------------------------------------------------------------------------- // // Member: // CDeviceModelPluginSample::Initialize // // Synopsis: // Implementation of IDeviceModelPlugIn::Initialize. This method // does nothing in this sample. // //---------------------------------------------------------------------------- STDMETHODIMP CDeviceModelPluginSample::Initialize( BSTR bstrXML, UINT cNumModels, UINT iModelPosition ) { if ( !bstrXML ) { return E_INVALIDARG; } m_hr = S_OK; return m_hr; } //+--------------------------------------------------------------------------- // // Member: // CDeviceModelPluginSample::GetNumChannels // // Synopsis: // Implementation of IDeviceModelPlugIn::GetNumChannels. // //---------------------------------------------------------------------------- STDMETHODIMP CDeviceModelPluginSample::GetNumChannels( UINT *pNumChannels ) { if ( FAILED( m_hr ) ) { return m_hr; } if ( !pNumChannels ) { return E_INVALIDARG; } *pNumChannels = PLUGIN_CHANNELS; return m_hr; } //+--------------------------------------------------------------------------- // // Member: // CDeviceModelPluginSample::DeviceToColorimetricColors // // Synopsis: // Implementation of IDeviceModelPlugIn::DeviceToColorimetricColors. // //---------------------------------------------------------------------------- STDMETHODIMP CDeviceModelPluginSample::DeviceToColorimetricColors( UINT cColors, UINT cChannels, const FLOAT *pDeviceValues, XYZColorF *pXYZColors ) { if ( FAILED( m_hr ) ) { return m_hr; } if ( !pDeviceValues || !pXYZColors || ( PLUGIN_CHANNELS !=cChannels) ) { return E_INVALIDARG; } // // Convert sRGB colors to CIEXYZ // for ( ULONG i=0; iQueryInterface( IID_ISampleDeviceModelPrivateInterface, (void**)&m_pOtherDeviceModel ); if ( SUCCEEDED( hrQueryInterface ) ) { // // For demonstration, call private interface method // m_hr = m_pOtherDeviceModel->SamplePrivateMethod(); } } return m_hr; } //+--------------------------------------------------------------------------- // // Member: // CDeviceModelPluginSample::SamplePrivateMethod // // Synopsis: // Implementation of IDeviceModelPlugIn::SamplePrivateMethod. // //---------------------------------------------------------------------------- STDMETHODIMP CDeviceModelPluginSample::SamplePrivateMethod() { // Empty method for demonstration return S_OK; }