Hit testing method and apparatus
AssigneeTencent Technology (Shenzhen) Company Limited
InventorYang Yu
Life of this patent
Estimating the term…
Abstract
Embodiments of the present invention provide a hit testing method and apparatus. The method includes: replacing color values of pixels of objects displayed on the screen with corresponding identifier (ID) values of the objects; storing the ID values in a bitmap array, wherein each element of the bitmap array corresponds to one or more pixels of a respective object; in response to capturing a hit event, acquiring a hit coordinate on the screen corresponding to the hit event; determining a bitmap array element corresponding to the hit coordinate; and identifying an object related to the hit event, according to the ID value associated with the bitmap array element.
Claims12
A hit testing method to identify a hit on an object displayed on a screen of a computing device, the method comprising:
- replacing color values of pixels of objects displayed on the screen with corresponding identifier (ID) values of the objects;
- storing the ID values in a bitmap array, wherein each element of the bitmap array corresponds to a plurality of pixels of a respective object;
- in response to capturing a hit event, acquiring a hit coordinate on the screen corresponding to the hit event;
- determining a bitmap array element corresponding to the hit coordinate;
- and
- identifying an object related to the hit event, according to the ID value associated with the bitmap array element,
- wherein the steps of replacing color values of pixels of objects displayed on the screen with corresponding ID values of the objects and storing the ID values in a bitmap array further comprise:
- replacing color values of pixels of an object to be the identifier (ID) value of the object;
- disabling at least one color characteristic rendering attribute of the pixels of the object;
- storing the ID value of the pixels in the bitmap array;
- and
- initiating only processes related to alpha channel operation during texture mapping to prevent the ID value of the object from being modified.
A hit testing apparatus, comprising:
- one or more processors;
- memory;
- and
- one or more program units stored in the memory and to be executed by the one or more processors, the one or more program units including an identifier (ID) value setting unit, a hit event capturing unit, and a hit testing unit, wherein
- the ID value setting unit is configured to replace color values of pixels of objects displayed on a screen with corresponding identifier (ID) values of the objects and store the ID values in a bitmap array, wherein each element of the bitmap array corresponds to a plurality of pixels of a respective object;
- the hit event capturing unit is configured to capture a hit event and acquire a hit coordinate corresponding to the hit event;
- and
- the hit testing unit is configured to determine a bitmap array element corresponding to the hit coordinate and identify an object related to the hit event, according to the ID value associated with the bitmap array element,
- wherein the ID value setting unit is configured to replace color values of pixels of an object to be the identifier (ID) value of the object, disable at least one color characteristic rendering attribute of the pixels of the object, and store the ID value of the pixels in the bitmap array and the rending unit is configured to initiate only processes related to alpha channel operation during texture mapping to prevent the ID value of the object from being modified.
A non-transitory computer readable medium in connection with a computing device, the computer readable medium storing one or more programs to be executed by the computing device to identify a hit on an object displayed on a screen of the computing device, the one or more programs comprising instructions for:
- replacing color values of pixels of objects displayed on the screen with corresponding identifier (ID) values of the objects;
- storing the ID values in a bitmap array, wherein each element of the bitmap array corresponds to a plurality of pixels of a respective object;
- in response to capturing a hit event, acquiring a hit coordinate on the screen corresponding to the hit event;
- determining a bitmap array element corresponding to the hit coordinate;
- and
- identifying an object related to the hit event, according to the ID value associated with the bitmap array element,
- wherein the instructions for replacing color values of pixels of objects displayed on the screen with corresponding ID values of the objects and storing the ID values in a bitmap array further comprise instructions for:
- replacing color values of pixels of an object to be the identifier (ID) value of the object;
- disabling at least one color characteristic rendering attribute of the pixels of the object;
- storing the ID value of the pixels in the bitmap array;
- and
- initiating only processes related to alpha channel operation during texture mapping to prevent the ID value of the object from being modified.
Dependencies are inferred from the claim text.