AGG lesson 8 Application of AGG in MFC Engineering
Preface
With the exception of the pure_api example, everything else is developed on top of agg::platform_support. These examples hide the details of how to create a render cache buffer and associate agg::rendering_buffer by calling agg::platform_support. In a word, by inheriting from agg::platform_support, you can directly call rbuf_window () to get the rendered cache. And pure_api is the most primitive program, by calling the system API function to build a most complete and detailed example program, and these things have been encapsulated in agg::platform_support. In the wx chapter, there is a detailed description of how to apply AGG for rendering.
Request
The original intention is to get the render cache of the current bitmap, pass it to agg::rendering_bufer, and then start rendering AGG.
Result
After querying a lot of information, you can only create a compatible DC, then create a compatible bitmap, then select a bitmap to get the rendering cache, and then map it to the current compatible DC.
HDC mem_dc =:: CreateCompatibleDC (hdc); / / create compatible DC
Void* buf = 0
HBITMAP bmp =:: CreateDIBSection (/ / create compatible bitmap and get cache
Mem_dc
& bmp_info
DIB_RGB_COLORS
& buf
0
0
);
/ / Selecting the object before doing anything allows you
/ / to use AGG together with native Windows GDI.
HBITMAP temp = (HBITMAP):: SelectObject (mem_dc, bmp)
/ / Map to the current DC, minus 100. you don't want to cover a small area on the right.
:: BitBlt (
Hdc
Rt.left
Rt.top
Width-100
Height
Mem_dc
0
0
SRCCOPY
);
Summary
For a detailed process, please refer to examples in the source directory for complete test cases.