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...
View ArticleMFC 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...
View ArticleMFC 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...
View ArticleMFC Support for DirectWrite – Part 1
A previous article shows how easy is to make an image viewer with MFC by enabling Direct2D support and using MFC wrappers over Direct2D interfaces. Now let’s discover MFC wrapper classes for...
View ArticleMFC Support for DirectWrite – Part 2: Text Block Formatting
Beside the font attributes which can be set in the CD2DTextFormat MFC class constructor, DirectWrite supports more formatting for a block of text, e.g. text alignment, word wrapping, line spacing and...
View ArticleMFC Support for DirectWrite – Part 3: Text Range Format
Once having a CD2DTextLayout object containing a formatted block of text and before drawing in the render target, we can change the formatting for particular ranges of text. For that purpose, call...
View ArticleMFC Support for DirectWrite (Part 4) – Inline Images
DirectWrite allows inserting objects in a block of text, e.g. images, as shown in the picture. MFC Support for DirectWrite (Part 4) – Inline Images Let’s see how can be done! Implement...
View ArticleMFC Support for DirectWrite (Part 5) – Typography
Some fonts like Microsoft’s Gabriola support a number of typographic features which allow users to control how they look, e.g by enabling some fancy stylistic text rendering. With DirectWrite we can do...
View ArticleMFC Support for DirectWrite (Part 6) – Effects
We can change the color of a text range by passing a brush object to IDWriteTextLayout::SetDrawingEffect. Here is a simple example. An example of using IDWriteTextLayout::SetDrawingEffect LRESULT...
View ArticleCodexpert – 2015 Articles Summary
Microsoft Libraries and C++ Programming Language Using Lambdas in MFC Applications – Part 1: Sorting Arrays Presents how to sort MFC arrays using lambda expressions (C++11 and next). Using Lambdas in...
View ArticleEasy PNG Resource Loading with MFC
If ask Internet about how to “load PNG from resource” it gives in return a lot of examples using a bunch of code. We can use some stuff found there, but once using MFC and enabling Direct2D support,...
View ArticleMFC Static Control Using Direct2D and DirectWrite – version 1.0
While doing some refactoring on sample source code presented in MFC Support for DirectWrite series, I had the idea to make a control easy to be used for rendering text. It could be a custom MFC control...
View ArticleMFC Static Control Using Direct2D and DirectWrite (updated)
I have update the MFC static control presented in the previous articles by adding methods for setting text range color, typography and inline images. Code samples Setting text range color void...
View ArticleMFC Support for DirectWrite – Part 7: A Step to Custom Rendering
The previous articles from this series show how to format the text layout using built-in DirectWrite methods. However, as said earlier, we can do more custom formatting (e.g. draw double/triple...
View ArticleGetting 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...
View ArticleCodexpert – 2016 Articles Summary
C++ Programming Language Guidelines Support Library Review: span<T> Guidelines Support Library Review: string_span<T> Microsoft Libraries Easy PNG Resource Loading with MFC – Part 1 MFC...
View ArticleMFC Support for DirectWrite – Part 8: Trimming
When using “classic” GDI functions i.e. CDC::DrawText, it’s no sweat to trim with ellipsis a single-line text when that text does not fit in the drawing rectangle width, by specifying DT_WORDBREAK...
View ArticleMFC Support for Direct2D – Part 3: Multithreading
As shown in previous articles, we can enable MFC Direct2D support for a window by a call of CWnd::EnableD2DSupport. Example:int CSlideShowWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if...
View ArticleMFC Support for DirectWrite – Part 9: Hit-Test
DirectWrite has hit-testing support that can be useful for showing a caret, making a selection, doing some action if the user chicks in a given text range, and so on. The hit-test methods of...
View ArticleMFC Support for Direct2D – Part 4: Built-in Effects
Direct2D has built-in support for image processing like changing brightness or contrast, blurring, creating drop shadows, and so on. Basically, we can use for this purpose the CreateEffect and...
View Article