我们通过 getImageData 获得具体的像素点的数据,不过还需要转换一下才能变成可用的数据。
getColor = () => { const { centerX, centerY } = this.centerPoint const { data } = this.imageCtx.getImageData(centerX, centerY, 1, 1) const color = transform2rgba(data) } const transform2rgba = (arr) => { arr[3] = parseFloat(arr[3] / 255) return `rgba(${arr.join(', ')})` }稿源:稀土掘金 (源链) | 关于稀土掘金 | 阅读提示
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
CanvasReact
Using the image to perform an action instead of the button in the iPhone application Issues #28 Dec 11, 2017
相关推荐
react 入门-JSX
JS 开发者:最喜欢 React,Vue.js 比 Angular 值得尝试
JS 开发者:最喜欢 React,Vue.js 比 Angular 值得尝试
React Newsletter – Issue 97 – Dec 14th 2017
Angular, React or Vue – Which Web Framework to Focus on for SPFx?
Manipulating HTML5 Canvas Using Konva: Part 4, Styling
Manipulating HTML5 Canvas Using Konva: Part 4, Styling
Manipulating HTML5 Canvas Using Konva: Part 4, Styling