C#GDI+画png图片

dyiajure 2009-06-23 05:28:15
有一个二维数组float[,] data,想用里面的数据画一个png图片,谁能给我个例子啊?高分求,如果分不够可以加
...全文
412 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cpio 2009-06-24
  • 打赏
  • 举报
回复
光有三维坐标不行啊,颜色没有画出来不一样的色了吗

而且,对于2维的,那个z根本没有用

不知道你想弄出什么效果
Harvey_He 2009-06-24
  • 打赏
  • 举报
回复

Color c = new Color();
Bitmap box = new Bitmap(x,y);
int rr=0;
for(int i=0;i<x;i++)
{
for(int j=0;j<y;j++)
{
rr = (int)float[i,j];
c= Color.FromArgb(rr,rr,rr)
box.setPixel(i,j,c);
}
}
pictureBox1.Refresh();
PictureBox1.Image = box;

wjq 2009-06-24
  • 打赏
  • 举报
回复
Bitmap b=new Bitmap(data.GetLength(0),data.GetLength(1));
for(int i=0;i<b.Width;i++)
{
for(int j=0;j<b.Height;j++)
{
//假设你的data数组里的float数都是在颜色允许的范围内的。
b.SetPixel(i,j,Color.FromArgb((int)data[i,j]));
}
}
dyiajure 2009-06-23
  • 打赏
  • 举报
回复
要画的点都是三维坐标点,flota[x,y]=z
我画的时候怎么定位点啊?怎么设置分辨率?
能不能详细点?
zgke 2009-06-23
  • 打赏
  • 举报
回复
Graphics _Graphics =Graphics.FormImage(_PngImage);

_Graphics.DrawImage(???,0,0);

使用Graphics就可以

110,539

社区成员

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

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

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