[英]How do I test for the color of a pixel in my Java Applet?
I have been doing some searching, and I have not found anything that suits my needs. 我一直在进行搜索,但没有找到适合自己需求的内容。 I have a small game applet I am writing in Java.
我有一个用Java编写的小游戏小程序。 I am curious if there is a way for me to obtain the color value (preferably RGB format) of a pixel on the Applet Viewer screen.
我很好奇我是否有办法在Applet Viewer屏幕上获得像素的颜色值(最好是RGB格式)。 I am planning on using this to detect collisions.
我正计划使用它来检测冲突。 Is there a way to get the color values of a pixel on the Java Applet screen?
有没有办法在Java Applet屏幕上获取像素的颜色值?
BTW, Andrew Thompson is probably right when he says that this must be an ineffective way of calculating collisions. 顺便说一句,安德鲁·汤普森(Andrew Thompson)可能是正确的,他说这肯定是计算碰撞的无效方法。 Probably you should be looking into the intersects method of Rectangle.
可能您应该研究Rectangle的相交方法。 Or for best results use a game engine, they have support for collision detection.
为了获得最佳效果,请使用游戏引擎,它们支持碰撞检测。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.