gdi+图像裁剪
来源:互联网 发布:轰炸商务印书馆知乎 编辑:程序博客网 时间:2024/05/16 14:19
一、实现图像裁剪
CImage image1;//不知道为什么,没有这两句不能正常显示,哪位大神知道告诉我一下image1.Load(L"");//不知道为什么,没有这两句不能正常显示,哪位大神知道告诉我一下CDC* pDC = GetDC();Graphics graph(pDC->GetSafeHdc());Bitmap *image = new Bitmap(_T("d://2.jpg"));graph.DrawImage(image, 0, 0);Image* pScaledImage = FixedSize(image, 200, 200);graph.DrawImage(pScaledImage, 600, 0);
二、FixedSize函数的实现
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, 100,0, Width,Height, UnitPixel);//关键代码,实现裁剪return bmPhoto;}
三、运行结果
阅读全文
0 0
- gdi+图像裁剪
- 使用gdi+裁剪圆形图像
- GDI+图像的显示、裁剪、缩放、转置…
- GDI+图像的显示、裁剪、缩放、转置…
- 裁剪(Clipping)-Window GDI
- 裁剪(Clipping)-Window GDI
- GDI+裁剪图片
- gdi+ 裁剪圆形图片
- 图像裁剪
- 图像裁剪
- 图像裁剪
- GDI+图像的显示、裁剪、缩放、转置、镜像、旋转、变形
- html5使用图像-图像裁剪
- 插件15:图像裁剪
- Android 裁剪图像
- 【php】图像裁剪
- WPF Image图像裁剪
- 图像压缩(裁剪)
- netty源码分析之-ServerBootstrap启动流程分析(3)
- 量刑辅助系统项目(1)——python删选文件
- 关于JavaTamcat的配置
- hibernate使用session操作数据库
- 橘子洲游记
- gdi+图像裁剪
- 大端 小端模式
- linux下删除包含特殊符号的文件或目录
- 坚持#第207天~慕课网的云计算了解完了,接下来是腾讯课堂
- SRAM和SDRAM的区别
- 在浏览器中输入www.baidu.com后执行的全部过程
- 简单排序
- OPENCV数据结构体系和常用函数
- 深度对抗学习在图像分割和超分辨率中的应用