Im trying to create a WIC codec in c. As far as i am concerned, the functions that the different interfaces implement, are recognized and called by them having a specific name.
In this case i am trying to implement the function GetPixelFormat from the IWICBitmapSource interface. This i am trying to do by initializing the function in a header, then defining the body in a source file, and implementing this into an interface with the DECLARE_INTERFACE_ macro.
The problem being that the GetPixelFormat function from the BitmapSource interface shares it's name with the function GetPixelFormat from the wingdi.h file, which is an include in wincodec.h, which is an include i need to create the function in the first place.
So to sum up my question:
Do the functions to be included in the codec interfaces require the same name as the names of the functions in the original WIC interfaces, e.g. does my GetPixelFormat function need to have this name to be recognized as the WIC function GetPixelFormat?
and
if yes : How do i implement this in a way that wont be disturbed by the original implementation?
if no : How do i implement the function into an interface in such a way that WIC will recognize the function as being the GetPixelFormat function?
Example of implementation in headerfile:
#undef INTERFACE
#define INTERFACE MgfFrameDecoder
DECLARE_INTERFACE_(INTERFACE, IUnknown) {
BEGIN_INTERFACE
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
STDMETHOD(CopyPalette) (THIS_ IWICPalette* pIPalette) PURE;
STDMETHOD(CopyPixels) (THIS_ const WICRect* prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) PURE;
STDMETHOD(GetPixelFormat) (THIS_ WICPixelFormatGUID* pPixelFormat) PURE;
STDMETHOD(GetResolution) (THIS_ double* pDpiX, double* pDpiY) PURE;
STDMETHOD(GetSize) (THIS_ UINT* puiWidth, UINT* puiHeight) PURE;
STDMETHOD(GetColorContexts) (THIS_ UINT cCount, IWICColorContext** ppIColorContexts, UINT* pcActualCount) PURE;
STDMETHOD(GetMetadataQueryReader) (THIS_ IWICMetadataQueryReader * *ppIMetadataQueryReader) PURE;
STDMETHOD(GetThumbnail) (THIS_ IWICBitmapSource * *ppIThumbnail) PURE;
END_INTERFACE
};
Example of implementation in source file:
static HRESULT STDMETHODCALLTYPE GetPixelFormat(WICPixelFormatGUID* pPixelFormat) {
pPixelFormat = &GUID_WICPixelFormat32bppBGRA;
return S_OK;
}