当前位置:首页 » 服务器技术
开发技术指南» 文章正文
    引言: 使用GDI+在内存中转换图片类
 

 

    摘要:3.2 aop容器的详细设计: a. xml文件:记录配置信息。文件映射类:负责读入xml文件并将文件映射成配置类。(xmldataloader,aopdefinitionloader,) public interface aopdefinitionloader extends xmldefinitionloader{ arraylist getjoinpoints(); } b. 配置类:aop概念映射。(joinpoi......
 ·把金额类型转换成大写和英文    »显示摘要«
    摘要:using system; namespace changemoney{ /// <summary> /// changemanage 的摘要说明。 /// </summary> public class changemoneyclass { public static string moneytoeng(string n) { // string result=""; string m=getfloat(n)......


使用GDI+在内存中转换图片类型
使用gdi+在内存中转换图片类型

微软新推出的gdi+功能强大,本文仅对图片转换加以讨论,不足之处请大家指出,本人qq: 394777271 。 【相关文章:使用.NET读取XML文件

作者:卢伟 【扩展阅读:着色器和效果——3.1 多纹理化概览

以下是详细步骤。 【扩展信息:将人民币的数字表示转化成大写表示(C#版

图片类型的转换支持:bmp、dib、png、gif、jpeg/jpg、tiff、emf等

首先在stdafx.h中静态调用diplus.lib,即由编译系统完成对dll的加载,应用程序结束时卸载dll的编码。如下:

#ifndef ulong_ptr

#define ulong_ptr unsigned long*

#include "gdiplus.h"

using namespace gdiplus;

#pragma comment(lib, "gdiplus.lib")

#endif

 

在类的头文件中定义,以下成员变量,用来初始化gdi+的使用与结束使用。

gdiplusstartupinput m_gdiplusstartupinput;

       ulong_ptr m_gdiplustoken;

 

然后在oncreate()函数中加入初始化gdi+的函数:

gdiplusstartup(&m_gdiplustoken, &m_gdiplusstartupinput, null);     

在ondestroy()函数中加入结束gdi+使用的函数:

       gdiplusshutdown(m_gdiplustoken);

 

接着定义转换函数

bool mbmptomimage(cmemfile& cbfbmp, cmemfile& cbfimage, cstring strtype)

其中:

cmemfile& cbfbmp表示原位图文件;

cmemfile& cbfimage表示转换后的图形文件;

cstring strtype表示转换的图片类型。

该函数中主要的处理为以下几步:

1、将原位图文件转换为istream;

2、定义image类实例,并使用第1步获得的istream初始化;

3、获取转换的图片类型的clsid;

4、将image以转换的图片类型保存到istream中;

5、将istream转换为cmemfile内存文件(也可为cfile)。

详细代码如下:

 

 

bool mbmptomimage(cmemfile& cbfbmp, cmemfile& cbfimage, cstring strtype)

{

       int ibmpsize = cbfbmp.getlength();


...   下一页
 ·大数阶乘的计算(六)    »显示摘要«
    摘要:前些时间写的关于大整数的阶乘计算,效率总是再难以提高:(http://dev.csdn.net/develop/article/28/28306.shtm,http://dev.csdn.net/develop/article/28/28308.shtm,http://dev.csdn.net/develop/article/28/28432.shtm,http://dev.csdn.net/develop/article/28/28641.shtm) ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE