CxImage笔记

Introduction
CxImage is a C++ class to manage almost any kind of images. It can load, save, display, transform images in a very simple and fast way. 
Why another image library? Around there are many good libraries (OpenIL, FreeImage, PaintLib …), these are powerful, complete, and constantly updated. However if you ever try to use them, you may find some difficulties; because these libraries are mainly platform independent, written in C, sometimes with a basic C++ wrapper and with tons of compiler switch declarations. Now with the new GDI+ classes on the scene, maybe CxImage isn’t so useful, but at least here you have the source code. It is not a MFC library, altogether it’s a windows library, because of some particular constructors and the painting functions, but the backbone is platform independent.

CxImage类库介绍
CxImage类库是一个几乎可以管理所有的图象文件的C++类库。它可以快捷地存取、显示、转换各种图像。
其他的图形库?有那么多优秀的图形库,如OpenIL,FreeImage,PaintLib等等,它们是功能强大,齐全,而且是经常更新的。然而,如果你要使用他们,你可能会遇到一些麻烦,,因为它们大部分是平台无关的,用C语言写成,有的还夹杂着基本的C++ wrapper和大量的编译选项的声明需要你去处理。现在,一个新的GDI+类库来了,或许CxImage不是最有用的,但是至少你是有源代码的。这个类库不是MFC类库,完全是一个windows类库,因为一些特殊的构造和绘图函数,但是基础是平台无关的。

一.在你的程序中使用CxImage(Using MFC in Shared DLL + Debug 模式)

1.下载CxImage类库
地址:http://www.codeproject.com/bitmap/cximage.asp (需要注册) 
下载Download full source files (full) – 2.10 Mb

2.解压压缩包,并编译Demo2/Console.dsw,这个过程可能比较慢,中间文件为60M

3.编译完成后搜索*.lib文件,一共搜索出10个文件,把它们复制到你的工程目录中(任意)
它们分别为:CxImage.lib Jpeg.lib png.lib Tiff.lib jbig.lib zlib.lib j2k.lib cximagecrtd.lib(最后一个为静态MFC库时使用)

4.找到压缩包中的CxImage文件夹,把它里面的所有.h头文件,复制到你的工程目录中(任意)

5.在StdAfx.h文件中,添加这些文件

6.这样就可以在你的程序中使用CxImage类了

7.演示程序

其他说明
1.所支持的格式(in Doc)

formats#definerequired librariessize [Kbyte]
BMP 
GIF 
ICO 
TGA 
PCX 
WBMP 
WMF
CXIMAGE_SUPPORT_BMP 
CXIMAGE_SUPPORT_GIF 
CXIMAGE_SUPPORT_ICO 
CXIMAGE_SUPPORT_TGA 
CXIMAGE_SUPPORT_PCX 
CXIMAGE_SUPPORT_WBMP 
CXIMAGE_SUPPORT_WMF
built in24
JPEGCXIMAGE_SUPPORT_JPGjpeg88
PNGCXIMAGE_SUPPORT_PNGpng, zlib104
MNGCXIMAGE_SUPPORT_MNGmng, zlib, jpeg148
TIFFCXIMAGE_SUPPORT_TIFtiff, zlib, jpeg124
JBIGCXIMAGE_SUPPORT_JBGjbig28
PNM,PPM,PGM 
RAS
CXIMAGE_SUPPORT_PNM 
CXIMAGE_SUPPORT_RAS
jasper176
JPEG-2000CXIMAGE_SUPPORT_JP2 
CXIMAGE_SUPPORT_JPC 
CXIMAGE_SUPPORT_PGX
jasper176

2.格式转换示例

3.使用CxImage(In Doc),至今未弄懂….也没按这个弄好过…不知道为什么

二.使用CxImage(Using MFC in a Static Library + Debug 模式)
1.解压压缩包,打开Demo2/Console.dsw,设置如下:
Project -> Setting -> Using MFC in a Static Library(注意是所有的项目都设置成这个)
2.确保c/c++ -> Code Generation -> Using run-time library 为 Mutithreaded
3.Debug模式下编译,搜索*.lib文件,复制到工程目录,包含进工程(当前工程也必须是Using MFC in a Static Library + Debug 模式),即可,包含方法同上
注意:生成的LIB文件,比上面要少一个….不知道为什么…少了consoled.lib,但并无大碍,不包含它即可

三.使用CxImage(Using MFC in a Static Library + Realese 模式)
1.解压压缩包,打开Demo2/Console.dsw,设置如下:
Project -> Setting -> Using MFC in a Static Library(注意是所有的项目都设置成这个)
2.确保c/c++ -> Code Generation -> Using run-time library 为 Mutithreaded
3.Realese模式下编译,搜索*.lib文件,复制到工程目录,包含进工程(当前工程也必须是Using MFC in a Static Library + Realese模式),即可,包含方法同上
注意:生成的LIB文件,同样是少一个,不包含它即可

参考:
Open the CxImage workspace with all the libraries. Select Project->Properties. Select each project in the list and make sure they all have the same settings for the MFC library (Not Using MFC for a static library). Then select the C/C++ tab and select Code Generation in the combo box. In the Use Run-time Library combo box, make sure all of them are set to Single-Threaded (or multi threaded depending on your settings). Then remake all the libraries and try to recompile your project
Thanks Kelly. It works! Thanks again!:) It turns out that CxImage static lib projects, in my case, are not set uniformly the same; some uses MFC shared library while some uses MFC static library

原文地址:http://www.codeguru.com/forum/archive/index.php/t-261681.html

原文

==================================================

 _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h

警告报告:
_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
 
处理办法:
第一步:
" #define _WIN32_WINNT 0x0502 "
在StdAfx.h中添加上述宏定义。
备注:必须在stdafx.h中所有#include 文件之前添加此代码。
第二步:
在StdAfx.h头文件里面加上#include <SDKDDKVer.h>有关于平台的定义
备注:如果StdAfx.h里面有了就不用加 #include <SDKDDKVer.h>了!
 //Including SDKDDKVer.h defines the highest available Windows platform.
 //If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
 //set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
 原文

======================

在VS工程中,添加c/c++工程中外部头文件及库的基本步骤:


    1、添加工程的头文件目录:工程---属性---配置属性---c/c++---常规---附加包含目录:加上头文件存放目录。


    2、添加文件引用的lib静态库路径:工程---属性---配置属性---链接器---常规---附加库目录:加上lib文件存放目录。
         然后添加工程引用的lib文件名:工程---属性---配置属性---链接器---输入---附加依赖项:加上lib文件名。


    3、添加工程引用的dll动态库:把引用的dll放到工程的可执行文件所在的目录下。

CXimage

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值