• Post Reply Bookmark Topic Watch Topic
  • New Topic

Opaque pixels

 
Ariel Ortiz
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sprite class API for MIDP 2.0 has three overridden methods called collidesWith that use the term "opaque pixels". I imagine that this term refers to non-transparent pixels that are available in PNG and GIF images. Can anyone tell me if this is correct?

...Ariel
 
Bert Bates
author
Sheriff
Posts: 8919
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... Ariel,

I'd have to go poke around in the specs...have you done that? What have you found?
 
Ariel Ortiz
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd have to go poke around in the specs...have you done that? What have you found?


Hi Bert. I appreciate your response.

I tried to look for an answer directly from the MIDP 2.0 API javadocs, but unfortunately I've found nothing so far.

I�ve been searching other Web pages and some authors talk about opaque and transparent pixels, thus I think my original assumption is correct.
[ December 16, 2005: Message edited by: Ariel Ortiz ]
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding is that the term 'opaque pixel' refers to a pixel having an alpha value of (2 ^ Display.numAlphaLevels() - 1).

So, it is considered a collision if two pixels having an alpha value of 'opaque' to ensure that collision among transparent pixels are not taken into account.

Since an image may be non-rectangular, there will be some transparent pixels around the image (like around the head) to cover the rest of the bounding rectangle. In a game-like application, you want to ensure that a collision occurs only when the image (say, the head) hits something and not the bounding rectangle.

Look at the Alpha Processing section of the Image class for more example.

http://www.j2medev.com/api/midp/javax/microedition/lcdui/Image.html
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!