2个回答
推荐于2016-11-02
展开全部
Image* FixedSize(Image *imgSrc, int Width, int Height)
{
int w,h;
w = imgSrc->GetWidth ();
h = imgSrc->GetHeight ();
if (w<h) //图片是竖着的 交换Width和Height
{
Width = Width + Height;
Height = Width - Height;
Width = Width - Height;
}
Bitmap *bmPhoto = new Bitmap(Width, Height);
bmPhoto->SetResolution(imgSrc->GetHorizontalResolution(),imgSrc->GetVerticalResolution());
Graphics grPhoto(bmPhoto);
grPhoto.Clear((ARGB)Color::White);
grPhoto.SetInterpolationMode(InterpolationModeHighQualityBicubic);
grPhoto.DrawImage(imgSrc,0,0,Width,Height);
return bmPhoto;
}int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes ImageCodecInfo* pImageCodecInfo = NULL; GetImageEncodersSize(&num, &size);
if(size == 0)
return -1; // Failure pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
return -1; // Failure GetImageEncoders(num, size, pImageCodecInfo); for(UINT j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
free(pImageCodecInfo);
return j; // Success
}
} free(pImageCodecInfo);
return -1; // Failure
}
{
int w,h;
w = imgSrc->GetWidth ();
h = imgSrc->GetHeight ();
if (w<h) //图片是竖着的 交换Width和Height
{
Width = Width + Height;
Height = Width - Height;
Width = Width - Height;
}
Bitmap *bmPhoto = new Bitmap(Width, Height);
bmPhoto->SetResolution(imgSrc->GetHorizontalResolution(),imgSrc->GetVerticalResolution());
Graphics grPhoto(bmPhoto);
grPhoto.Clear((ARGB)Color::White);
grPhoto.SetInterpolationMode(InterpolationModeHighQualityBicubic);
grPhoto.DrawImage(imgSrc,0,0,Width,Height);
return bmPhoto;
}int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes ImageCodecInfo* pImageCodecInfo = NULL; GetImageEncodersSize(&num, &size);
if(size == 0)
return -1; // Failure pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
return -1; // Failure GetImageEncoders(num, size, pImageCodecInfo); for(UINT j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
free(pImageCodecInfo);
return j; // Success
}
} free(pImageCodecInfo);
return -1; // Failure
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
2013-05-14
展开全部
VC6可以使用GDI+的,但是要用VC6自己的GDI+ 的头和库而且第一句还需要
#include <windows.h> 因为GDI实际上用到了大量的Windows的API的图像函数
#include <windows.h> 因为GDI实际上用到了大量的Windows的API的图像函数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询