怎么根据每个像素点的(R,G,B)值生成UIImage

翅膀又硬了 2014-10-13 05:22:48
如题,我现在知道每个像素点的值了,怎么生成图片?

QT里面这样可以生成 不知道ios有没有类似的
QImage(uchar *data, int width, int height, Format format);
...全文
520 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
程老师2088 2014-11-12
  • 打赏
  • 举报
回复
画一个像素点,并生成图像是这么画 CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
翅膀又硬了 2014-11-12
  • 打赏
  • 举报
回复
翅膀又硬了 2014-11-12
  • 打赏
  • 举报
回复
引用 2 楼 chengzhf 的回复:
画一个像素点,并生成图像是这么画
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();


引用 6 楼 zhanglei5415 的回复:
引用 5 楼 yunchao630 的回复:
[quote=引用 4 楼 zhanglei5415 的回复:]
ios 中需要使用core graphic 框架来实现图形的绘制。2楼的方法可以先去试试。
没有根据每个像素点,直接生成UIImage的函数吗? Qt和MFC都有的

貌似没有这样的函数。[/quote]
找到方法了http://blog.csdn.net/devday/article/details/5199218
ReyZhang 2014-11-12
  • 打赏
  • 举报
回复
引用 5 楼 yunchao630 的回复:
引用 4 楼 zhanglei5415 的回复:
ios 中需要使用core graphic 框架来实现图形的绘制。2楼的方法可以先去试试。
没有根据每个像素点,直接生成UIImage的函数吗? Qt和MFC都有的
貌似没有这样的函数。
翅膀又硬了 2014-11-12
  • 打赏
  • 举报
回复
引用 4 楼 zhanglei5415 的回复:
ios 中需要使用core graphic 框架来实现图形的绘制。2楼的方法可以先去试试。
没有根据每个像素点,直接生成UIImage的函数吗? Qt和MFC都有的
ReyZhang 2014-11-12
  • 打赏
  • 举报
回复
ios 中需要使用core graphic 框架来实现图形的绘制。2楼的方法可以先去试试。
翅膀又硬了 2014-11-12
  • 打赏
  • 举报
回复
引用 2 楼 chengzhf 的回复:
画一个像素点,并生成图像是这么画 CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
额,谢谢

29,031

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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