当前位置:网站首页>获取某一点的颜色
获取某一点的颜色
2022-04-22 23:52:00 【~废弃回忆 �༄】
@implementation UIView (****)
/** 获取某一点的颜色*/
- (UIColor *)colorWithPoint:(CGPoint)point
{
unsigned char pixel[4] = {
0};
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast);
CGContextTranslateCTM(context, -point.x, -point.y);
[self.layer renderInContext:context];
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
return [UIColor colorWithRed:pixel[0]/255.0 green:pixel[1]/255.0 blue:pixel[2]/255.0 alpha:pixel[3]/255.0];
}
@end
版权声明
本文为[~废弃回忆 �༄]所创,转载请带上原文链接,感谢
https://blog.csdn.net/eastWind1101/article/details/117434805
边栏推荐
- LabVIEW implements application stop or exit
- 【DVCon2020】采用先进 Save & Restore 技术加速仿真周转时间 (Simulation Turnaround Time)
- 51 single chip microcomputer learning_ 4-2 nixie tube dynamic display
- 【DVCon2020】基于多线程UVM测试平台的仿真加速方法
- Online fox U3D client game configuration loading failed couldn't connect to server
- Typora樣式調優
- [newcoder] week 20220422
- People's understanding of the industrial Internet is becoming clearer and closer to the industrial Internet
- matlab-day01
- 【leetcode】二叉树,226翻转二叉树,116填充二叉树节点的右侧指针,114将二叉树展开为链表
猜你喜欢

Vs-写汇编

【DVCon2020】基于多线程UVM测试平台的仿真加速方法

SystemVerilog verification - Test Platform writing guide learning notes (3): connecting design and test platform

The implementation principle and function of closure and memory leakage

Invite you to participate in the ume plug-in development competition

Detailed explanation of MySQL index

Thread pool (easy to understand)

“亿”点点技术情怀

浅谈LD_PRELOAD劫持
![FileNotFoundError: [Errno 2] No such file or directory: 'image/1.jpg'问题解决](/img/dd/d8068792911be2d04a04eb4c1a158c.png)
FileNotFoundError: [Errno 2] No such file or directory: 'image/1.jpg'问题解决
随机推荐
51 单片机学习_4-1 数码管显示
Online fox U3D client game configuration loading failed couldn't connect to server
51 single chip microcomputer learning_ 4-1 nixie tube display
[perseverance challenge] PCIe asks and answers every day (filed on March 2022)
【leetcode】二叉树,654最大二叉树,105根据前序与中序遍历构造二叉树,106根据中序与后序遍列构造二叉树,889根据前序和后序遍历构造二叉树
Interpretation of UVM source code, uvm-1.2 code review notes
FPGA(六)RTL代码之二(复杂电路设计1)
【leetcode】二叉树,226翻转二叉树,116填充二叉树节点的右侧指针,114将二叉树展开为链表
Django创建表结构及对数据库增删改查
Django creates table structure and adds, deletes, modifies and queries database
[Objective-C advanced programming] - GCD
On LD_ Preload hijacking
[annual summary] carry forward the past and forge ahead into the future: look back on the unreliable 2021 and hope for the reliable 2022
Install vs2017 plug-in glsl language integration V0 under Windows 7 10.120. Vsix reported an error: Microsoft visualc. redist. twelve
MPP architecture concept
Use example to add a sort invalidation problem when using PageHelper
Hello, I want to open an account for crude oil futures. How can I open an account for futures safely and reliably?
【Objective-C 高级编程】—— GCD
[leetcode] binary tree, 654 largest binary tree, 105 constructs binary tree according to preorder and inorder traversal, 106 constructs binary tree according to inorder and postorder traversal, and 88
字符集合(去重)