不显示删除回复显示所有回复显示星级回复显示得分回复 图片处理问题-仿(PS)图片放大效果(二)

aaxsvbgasdf 2010-11-15 06:19:49


该文章紧接http://topic.csdn.net/u/20101105/15/8e582e7f-79ff-4f05-8041-f81443e0c58d.html
以下代码由gomoku用户提供,不过出现了顶部和左边少了,以下参数中scale为30,正确结果应该左和顶部(最边缘)应该也和其他地方一样有30像素!但实际只有15像素,少了一半,帮忙解决!没分了先给20

static Bitmap Mosaic(Bitmap original, int scale)
{
Bitmap result = new Bitmap(original.Width * scale, original.Height * scale);
using (Graphics g = Graphics.FromImage(result))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; //<---
g.DrawImage(original, 0, 0, result.Width, result.Height);
}
return result;
}
...全文
157 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
gomoku 2010-11-16
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 s8855516 的回复:]
抱歉,我自己解决了!
...
[/Quote]
谢谢反馈:)
aaxsvbgasdf 2010-11-16
  • 打赏
  • 举报
回复
抱歉,我自己解决了!
static Bitmap Mosaic(Bitmap original, int scale)
{
Bitmap result = new Bitmap(original.Width * scale, original.Height * scale);
using (Graphics g = Graphics.FromImage(result))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; //<---
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half; //新增加的浮点处理
g.DrawImage(original, 0, 0, result.Width, result.Height);
}
return result;
}

111,119

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧