c++winapidirectxgdiwic

Is it WIC (Windows Imaging Component) and DirectX part of the Winapi?


Im confused about what is Winapi and what is not.

For me, anything developed by Microsoft should be winapi, makes sense to me. But Im not sure.

I have to load images using Winapi only, its is a homework, I found LoadImage is part of the GDI, and i know GDI is part of Winapi, but it only works with BMP, so there is GDI+ and it seems to work with other formats.

During my research i found other methods like using DirectX because is faster, or WIC wich what i understand is a COM (i guess it stands for COMponent) OLeLoadPicture and IShellImageDataFactory wich could help me load a JPG

Are all of them part of Win32?

I have read in a forum https://www.gamedev.net/forums/topic/385330-does-directx-just-wrap-the-win32-api/ that DirectX is not part of win32, it works on a close level with the Hardware and that there would be no meaning of using Directx if win32 would do already the work. it also says that DirectX wraps some Win32 function but just for some dialogs and window handlers, nothing to do with image processing, someone also said that Win32 uses some of DXD9 API. DirectX was designed for windows, so it makes sense to categorize it as a Winapi for me.

Are COM Components part of Win32?

My question is, how can you know what is and what is not part of Win32 api?

enter image description here

As you can see, in the breadcrumbs there is no WinApi section but the same happens with WIC

enter image description here

But if you look into WinApi MSDN List https://learn.microsoft.com/en-us/windows/desktop/apiindex/windows-api-list you found in the API List which also states that it is called Winapi or Win32, scroll down and you will see there is Listed DirectX, Shell and also COM objects

enter image description here

Im asking this because reading different answers make me very confused, based on the API List i think DirectX, COM and Shell are Wrapped By/Part Of Win32 API.

Also because i want to use DirectX for better image processing performance, and i don't want my professor to say something like... "Oh you did not use Win32 API, you will have to repeat the course", because I'm pretty sure it will happen, and i don't like when someone states something as true when it is not and if that happens i want to be confident enough to prove that I'm still using Win32 API.

At the moment using GDI+ seems to be the safer path for me i think, but if i can use DirectX i rather use it.


Solution

  • Probably the best answer you are going to get here is comes down to answering this question: Is the API included with the Windows OS, or is it something you have to install before you can use it?

    Every version of Windows since Windows XP Service Pack 2 (and the associated Windows Server 2003 Service Pack 1) has included "DirectX" as part of the operating system, although exactly what components comprise "DirectX" has changed over time. Windows Imaging Component (WIC) has been in the operating system since Windows Vista (and the associated Windows Server 2008).

    See Not So Direct Setup

    The headers for WIC have been in the Windows SDK since the Windows SDK version 6. The headers for Direct2D have been in the Windows SDK since Windows SDK version 7. All the rest of DirectX was put into the Windows SDK version 8.

    See Where is the DirectX SDK?

    FWIW, GDI+ is pretty ancient and the recommended API is definitely to use Direct2D and WIC instead. You can use these as COM interfaces directly, or you can use a wrapper helper library like Win2D.

    As to that referenced forum question, it's a lot of speculation about the internal architecture. The basic answer is that DirectX has always been a system component, but in the old days Microsoft shipped it as a giant patch via the DirectX Runtime. In fact, it was a very invasive patch that had to update many different versions of the operating system. As of Windows XP SP2, it's just another system component in the operating system.

    As a little historic footnote, WIC was created precisely because GDI+ was a huge security problem back in the early days of Windows XP. Many OS components and Microsoft application now use WIC to do all bitmap loading to centralize the fuzz-testing and security servicing. For example, the old D3DX9 helper library included it's own copy of various bitmap codecs, while D3DX10 and D3DX11 helper libraries just use WIC--as do the more modern replacements.