MFC Support for Direct2D – Saving to files

Once have enabled Direct2D support in an MFC application, there is no sweat to load an image from a file, by using one of CD2DBitmap constructors. Unfortunately, we cannot find a CD2DBitmap method to save it into a image file (something similar to CImage::Save or Gdiplus::Image::Save). No problem, we can try to do it ourselves. … Read more

Read IFD and EXIF Metadata with WIC and MFC

A graphic file can store additional information abaout image (camera model, camera manufacturer, date and time, etc). Windows Imaging Component (WIC) provides interfaces which allow dealing with image metadata. Basically, for reading metadata we need an IWICMetadataQueryReader instance to call its GetMetadataByName method. The first argument of GetMetadataByName is based in Metadata Query Language and is composed by … Read more

Getting Direct2D, DirectWrite and WIC Factories in MFC

MFC library offers a series of wrapper classes over Direct2D and DirectWrite interfaces (see CRenderTarget and CD2D classes). That’s pretty cool because allows to easily load and render images and draw texts, without care too much of direct dealing with COM interfaces. However, let’s say we have to implemented something different so we need to … Read more

MFC Support for Direct2D – Part 2

A previous article shows how to use D2D MFC classes for easily make a simple image viewer. As said there, it can be made even easier. Enabling D2D support in MFC In the WM_CREATE message handler call CWnd::EnableD2DSupport. int CDemoView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CScrollView::OnCreate(lpCreateStruct) == -1) return -1; EnableD2DSupport(); // Enable D2D support for this window: … Read more

MFC Support for Direct2D – Part 1

A few time ago, I begun writing a series of wrapper classes to make easier the using of Direct2D interfaces. Meanwhile, I discovered that MFC Library, beginning with Visual Studio 2010 SP1, offers an excelent built-in support. That’s pretty cool! So, let’s use Direct2D (D2D) MFC classes for making a simple image viewer. Image viewer … Read more

Using Direct2D for Rendering WIC Bitmap Sources

Once having a WIC (Windows Imaging Component) source, we can render it by using GDI, GDI+ or Direct2D. There are many examples over the internet including MSDN Library that describes how to perform this. This article describes how to use WIC Wrapper Library, which is designed for using WIC without worrying about directly deal with COM interfaces. … Read more

WIC File Open Dialog Using IFileOpenDialog Interface

A previoius article extends CFileDialog MFC class, in order to make a File Open or a File Save dialog that automatically filters files, according to available WIC (Windows Imaging Component) codecs. This article presents how to show a similar File Open dialog using IFileOpenDialog interface. This way, it can be used not only in an … Read more

WIC Wrapper Library – Version 1.1

WIC Wrapper Library v1.1 has the following: new and completed methods for existing wrapper classes in the previous version; new classes: wic::Bitmap and wic::Palette; a new header containg enums, WicWrapEnums.h. Download: Example 2: Using wic::ImagingFactory::CreateBitmapFromHICON and wic::Bitmap The following example is close to the previous one, except that it uses wic::ImagingFactory::CreateBitmapFromHICON to display an icon … Read more

WIC Wrapper Library – Version 1.0

I’ve begun writing a series of wrapper classes over WIC (Windows Imaging Component) interfaces, that can easily be used in MFC, ATL, or Win32 applications without worry about directly dealing with COM interfaces. This first version contains basic operation for loading, scaling and converting source image formats that are supported by WIC. Download: WIC Wrapper … Read more