如何给有形状的图像着色?
我知道边界填充是可能的,但已经尝试了 Objective C 中的所有方法,但仍然没有成功。 任何有关代码的帮助将不胜感激。
此代码返回触摸像素的颜色:
unsigned char* data = CGBitmapContextGetData (cgctx);
if (data != NULL) {
offset = 4*((w*round(point.y))+round(point.x));
alpha = data[offset];
red = data[offset+1];
green = data[offset+2];
blue = data[offset+3];
color = [UIColor colorWithRed:(red/255.0f) green:(green/255.0f) blue:(blue/255.0f) alpha:(alpha/255.0f)];}
我无法为像素着色,有时此代码会在同一像素上返回不同的颜色。
I know its possible with boundary fill, but have tried everything in Objective C and I'm still not successful. Any help with code will be highly appreciated.
This code returns the color of the touched pixel:
unsigned char* data = CGBitmapContextGetData (cgctx);
if (data != NULL) {
offset = 4*((w*round(point.y))+round(point.x));
alpha = data[offset];
red = data[offset+1];
green = data[offset+2];
blue = data[offset+3];
color = [UIColor colorWithRed:(red/255.0f) green:(green/255.0f) blue:(blue/255.0f) alpha:(alpha/255.0f)];}
I am not able to color the pixel, sometimes this code returns different color on the same pixel.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论