处理as3中bitmapData和bitmap类中的反转像素
我正在使用 bitmapData 和位图类在显示屏上渲染鼠标光标。位图数据由一个区域组成,其颜色应根据背景颜色反转。这是一个非常基本的事情,当在文本区域上移动时,可以通过文本光标(顶部和底部有两个小水平线的垂直线)观察到。
我希望能够对位图数据中的像素执行相同的操作,有没有办法有效地找出背景颜色并反转颜色值?
在此过程中,我将重新绘制整个像素,是否有其他有效的方法可以做到这一点?
I am using bitmapData and bitmap classes to render a mouse cursor on the display screen. The bitmapData consists of an area whose colors should be inverted according to the background color. This is a very basic thing which could be observed with text cursor(the vertical line with two small horizontals on top and bottom), when moved over the text area.
I want to be able to do the same with the pixels in my bitmapData, is there a way to find out the background color effectively and invert the color values?
In this process i will be redrawing the whole pixels, is there any other efficient way to do that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绘制光标
您可以使用 BlendMode.INVERT http ://livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html#draw()
或者只需将光标显示对象放在位图上并将其混合模式设置为反转。
You can draw your cursor using BlendMode.INVERT
http://livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html#draw()
or simply put your cursor display object over your bitmap and set it's blendMode to INVERT.