I'm currently using MFC/GDI and Stingray to display bitmaps in my application and am looking for a better solutio开发者_运维问答n. Specifically;
- Faster drawing speed - My current solution is slow, based on StretchDIBits
- Better rendering quality - StretchDIBits rendering quality is awful when scaling a bitmap
- Support for rotated bitmaps
- Support for loading / saving in all popular formats
- Support for large bitmaps - I'm regularly using aerial photographs that are ~64mb as 12,000x12,000 jpegs. GeoTIFF support would also be useful
- Compatible with MFC document/view, including printing (e.g. must be able render to a CDC)
- Access to source code is good but not necessary
- Easy to use / port existing GDI code
While free is always nice, I don't mind spending a reasonable amount on a decent library, though no run time royalty costs. Googling suggests the following;
- CImg
- Graphics Magick
- Lead Tools imaging SDK
Anyone got experience of these or can recommend an good alternative?
GDI+ is available on any Windows machine since early XP. It has codecs for all popular image formats, JPEG is included. Very nice filters for high-quality image rescaling. Unrestricted image rotation. Draws to a CDC through the Graphics class. Source code for the C++ wrappers are available in the SDK gdiplusXxx.h header files. Speed is likely to be equivalent however, rendering is software based to ensure compatibility.
You can #include <gdiplus.h>
and use the C++ wrappers directly. The SDK docs are here. The CImage class is available in MFC, it doesn't expose all capabilities however.
I think it's unlikely you'll find something that performs faster than GDI on windows since it has kernel-level support which is something open source solutions will not have.
You might want to also look into OpenGL or Direct2D/Direct3D since these too have direct access to the frame buffer. With 3D APIs, texture size would probably be an issue since most standards limit to something like 4096x4096.
I have used CxImage in the past which is one to add to your evaluation list.
精彩评论