Getting the location of non-transperant pixels in an image

Hello everybody,
I'm not really new into java, but I am new at working with images... and since I'm making this game i simply have to ^^, anyway here's my problem:
I'm trying to test for collosion (if a part of a character/player hits an object (enemy, wall, ground) in a level) and to do that i came up with the following idea:
I'll make this special class called ImagePixels, so when i get/create a new image testImage (in an other class, for example the class player or levelobject) I can also create a new ImagePixel object, like this:
private Image characterStandRight;
private void getImages()
          MediaTracker tracker = new MediaTracker(this);
          characterStandRight = getImage(getCodeBase(), "Images/"+player.getCharacterName()+"/standright.gif");
          tracker.addImage(characterStandRight, 1);
          test = new ImagePixels(characterStandRight);
          test.returnPixelLocation();
          try
               tracker.waitForAll();
          catch (Exception exception)
     }  But i simply don't know an effecient way of getting these locations :( (i tried the ComponentColorModel class and some more)....
and I'm not even sure if this is the best way to test for collosion... :( any1 can help me??
Patrick,

O noes, nobody answers :(

Similar Messages

  • How to get the location of a jarfile in the java 1.6 cache

    In 1.5 i am using getResource() to get the location of the jarfile i need, but in 1.6 this does not work anymore. I found a webpage with a workaround for this, but unfortunately i did not bookmark it and i can't find it again. Does anybody know how to get a file url instead of an http url to the jar file?
    I need the location to this jarfile. There is no other workaround and please DO NOT respond and tell me, that i don't need the location in the cache! I read all threads on the java forums to this issue and i didn't find a good answer.

    java.io.File class can be used.
    File f = new File("filename");
    S.O.P(f.canRead());
    S.O.P(f.canWrite());You can set the attribute using Runtime class.
    Runtime r = Runtime.getRuntime();
    Process p =r.exec("attrib -r file");If you are working with unix,
    r.exec("chmod -permissionoptions file");

  • How can we get the location from location area code?

    Hi All,
    i have an application which successfully runs on Motorola L6 and it gives me the cell-id, Location area code, and Mobile Network Code, and Mobile Country Code. Now I want to know how can I get the location ( I mean the name of the location) through location area code. And one more thing can we get current MNC and current MCC through j2me because I have written a code for getting this information for sony ericsson cells but dont have a handset to try out. Anyway if anyone has the information then please let me know
    Thanks in advance
    Sunil

    I donot think you have a direct blog..
    check this blog for java proxies ..
    /people/prasad.ulagappan2/blog/2005/06/27/asynchronous-inbound-java-proxy
    AND CONFIGURE A RFC..

  • How Can we get the data from Non-SAP to SAP in WebDynpro

    Hi,
    I hope u understand my query, How can we get the data from Non-SAP to SAP thru WebDynpro Programming.
    Help out with the steps for getting the data or procedure.
    Regards,
    Mutyapu

    You can expose the APIs in the Non-SAP backend as Web Services, and consume them in SAP by creating an Enterprise Proxy. Then these can be called just like normal class methods from Web Dynpro.
    Regards,
    Nithya

  • How to get the Location of the Device

    hi all,
    I want to find out the Location of the MObile device.
    I am trying to find out with the help of the Location API which was available in the CLDC 1.1.I am using the following code to get the Location
    try{
         Criteria cr = new Criteria();
         cr.setHorizontalAccuracy(500);
         LocationProvider lp = LocationProvider.getInstance(cr);
         Location l = lp.getLocation(60);
         Coordinates c = l.getQualifiedCoordinates();
         if(c!=null)
         double lat = c.getLatitude();
         double alt = c.getAltitude();
         double lon = c.getLongitude();
         locate = c.convert(alt,1);
    }catch(Exception e){System.out.println(e);}
    I used a seperate thread to get the Location.The thread was running it was not diaplying any value(in the Emulator).Can anybody tell me the possible output when we use the Emulator.
    Please help me,Thanks in advance
    Lakshman

    hi,
    Even though the Nokia was the leaders of the JSR 179.but the Specification were developed by the sun.So to my knowledge the device which will support CLDC 1.1 will support my code.
    at present i had a Blackberry 7100t,I have to check whether the device support the CLDC 1.1
    can anybody please tell me what are the mobile devices that support the CLDC1.1?
    lakshman

  • How to get the location of a pageitem when there are pageitems with same UID?

    There are two text frames with same UID but on different pages( also defferent spreads ). What I want to know is how I can get the location of them both.
    The following code can only get the location of the first frame because the second frame has the same UIDRef with the first one(because they are in one document with same UID) .
        InterfacePtr<IGeometry> splineGeo(ItemRef, IID_IGEOMETRY);
        PMMatrix itemPMMatrix = ::InnerToPasteboardMatrix( splineGeo );
        PMRect  itemPMRect = itemGeo->GetStrokeBoundingBox( itemPMMatrix );
    Is there any way I can get the second frame location?
    Thanks a lot.

    No.
    Just copy the pageitems from master page to document page.

  • How to get the location of the browser?(pt_BR, en_US, es_ES...)

    How to get the location of the browser?
    example: pt_BR, en_US, es_ES...

    Hi Eduardo Cordeiro,
    Sorry in reaching you late...I was out on a trip...
    You need to put the javascript in your Flex application html wrapper file ...in which your  Flex application SWF is embedded.
    Write the Javascript function in your html file as below :
    function getBrowserLanguage()
      var browserLanguage = navigator.browserLanguage;
      return browserLanguage;
    //In your mxml File you can access the JavaScript function in your MXML as below:
    var browserLang:String  = ExternalInterface.call('getBrowserType');
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • How to get the location of the last click.

    What I can't seem to figure out how to do is get the location of the last click. I'm not setting anything by using the click im using the click to test boundaries. Basically if I click within this area this happens if i click within this other area something
    happens, etc. Thanks for your help! Also feel free to say an easier way to do this if you know one.

    Your description about your issue is very vague but you could for example handle the MouseLeftButtonDown event for the "area" and then use the MouseEventArgs.GetPosition method to determine the coordinates of the mouse click relative to some element,
    e.g.:
    private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    Canvas canvas = sender as Canvas;
    Point p = e.GetPosition(canvas);
    double x = p.X;
    double y = p.Y;
    <Canvas Height="100" Width="100" Background="Red" MouseLeftButtonDown="Canvas_MouseLeftButtonDown">
    </Canvas>
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • How to get the location of the JMenuItem on the screen in actionPerformed

    How can I get the location of the JMenuItem on the screen in actionPerformed.
    When I use the function getLocationOnScreen() on JMenuItem or the object retruned by getComponent() I get IllegalComponentStateException.
    I have figured out that inside actionPerformed the parent of the JMenuItem which is JPopupMenu (that contains the JMenuItem) is not visible anymore (its isVisble() function returns false).
    Then how can I get the location on the screen of the JMenuItem or it�s popup menu such that I can use it in subsequent call to SwingUtilities.convertPoint(JMenuItem, int x, int y,frame), as I need to display a modal dialog box relative to the position of the popup menu in it�s frame.
    Regards,
    Janusz

    Thanks for reply.
    Unfortunately I have to figure out the location of the menu from within actionPerformed handler. At that point of time it is too late to overwrite JMenuItem. I probably could do some severe surgery in the code to implement my own JMenuItem derived class & overwrite processMouseEvent and pass the location attribute somehow to actionPerformed handler � but I am looking for some solution that would not require changes to the code outside actionPerformed handler.

  • How to get the location of the caret?

    Hello
    I want to get the location of the caret. Not the offset of the document.
    I have tried the Caret.getMagicCaretPosition(), but I think it gives me a point in viewport.
    How can I get the absoult location of the caret(the location on screen ,not in viewport)?
    Thank you very much.
    Best wishes

    Thankyou ,You reply seems to help me ,but I am still confused that this method returns void ,how can I get the result of the point on screen?
    When I want the caret location (the caret belongs to a JTextPane) on screen, I invoke :
    SwingUtilities.convertPointToScreen(textPane.getCaret().getMagicCaretPositon(),textPane);
    but how can I get the result of the convertion?
    Thank you!

  • HOW CAN I GET THE LOCATION OF MY CALLER

    HOW CAN I GET THE LOCATION OF MY CALLER pls its urgent

    HOW CAN I GET THE LOCATION OF MY CALLER pls its urgent

  • HT1918 How do you solve an issue with the card? I don't get the option of 'none' :(

    How do you solve an issue with the card? I don't get the option of 'none'

    I had this exact same problem with the new iPhone I bought on 1/4/13. The walk through they provide on how to do this is useless because it fails to explain that if you are already having the problem of not getting the "None" payment option with an Apple ID then you will need to create a completely new Apple ID.
    I had to do this 7 times since I bought my iPhone on Friday until this morning to figure out how to finally be able to use the Home Sharing option in iTunes to put my music collection on my brand new $500.00 iPhone. Pretty pathetic if you ask me but since it made me so angry I want to make sure other know how to do this so you don't get as upset as I did.
    #1 If your current or soon to be "old" Apple ID is not providing the option for "None" as a payment option then you need to make a brand new one. But you have to make it specifically how I tell you.
    #2 You will need to use an email address that has not already been used for anything related to a previous Apple ID. You might need to make a brand new email address.
    #3 Open iTunes, then open iTunes Store (upper right corner of iTunes).
    #4 Click on App Store (upper center of screen).
    #5 Scroll down the screen page until you see Top Free Apps on the right side.
    #6 Choose any one of the FREE apps.
    #7 You should either get the option to create a new Apple ID box, either that, or it will pop up with some kind of disclaimer and then it does the create new Apple ID.
    Either way just create a new Apple ID when it gives you the option to and then when you get to the page that looks like the payment page the "None" payment option will finally be available.
    Note: You will still have to fill out the information on the payment page. As long as you choose the "None" option it will not request any credit card information.
    #8 You will be sent a confirmation email to the new email account. Just follow through with what ever it tells you and viola now you can use your Apple Device.
    What a pain in the keester, eh?

  • HT2731 I am using ipad2 with the latest version. While trying to make a apple Id, In the payment information  cannot get the option of "none" what will I do. Please help.

    I am using ipad2 with the latest version. While trying to make a apple Id, In the payment information  cannot get the option of "none" what will I do. Please help.

    You are following the instructions on this page for creating a new account : http://support.apple.com/kb/HT2534 e.g. selecting a free app in the store and tapping on 'create Apple id' when 'buying' the app ? I've just tried it and it works for me

  • When I import my photos from my iPhone 4S into iPhoto the location does not appear.  I have to open the info button on the photo click "photo place" then "find on map" and then the location appears.  How to I get the location to appear automatically?

    When I import my photos from my iPhone 4S into iPhoto the location does not appear.  I have to open the info button on the photo click "photo place" then "find on map" and then the location appears. How to I get the location to appear automatically when I import my photos from my iPhone?

    in your iPhoto preferences is look up location set to "automaticaly"?
    LN

  • HT2513 How do I get the location to print in the monthly view?

    Is there a way to get the location to show as well as print in the monthly view?  The events that I'm concerned about are 'all day' events in a separate calendar.

    Rich media in PDF isn't designed for print workflows so you cannot control what appears - you should just get a bitmap 'screenshot' of whatever the viewport was displaying at the time.

Maybe you are looking for

  • No Service on 7290 with working SIM

    I'm having trouble connecting a BlackBerry 7290 to AT&T's cellular network in Indianapolis, IN, and have had no luck after a few hours of working on the problem over the space of a few weeks. This is kind of a last-ditch effort to find a solution to

  • How to save a scan in Image Capture?

    How do I save my scan in image capture? What option to I go to save it as a JPEG or PNG to my computer?

  • 2.93 MBP - Problems before I even opened the box.

    Well. My new MBP arrived about 20 minutes ago. The shipping box was double taped on the top. I peeled the top layer off, and the tape below was slit, so the box was opened and then resealed. Fine... I took out the box that houses the computer, and lo

  • Load balancing among multiple CPU

    I am using a java based application on windows server 2008 r2 64bit and JRE 6u17.The server has multiple processor.But when we run the application only one cpu takes the 100% load and cant balance the load.But if we run the application on windows xp

  • Can't get Listener to use the Correct listener.ora file

    I am on a Windows 2003 Server. I have copied the 10gR2 ORACLE_HOME from a diffent Windows 2003 server on to this one. I want to start the Oracle Listener on this server. I have: set TNS_ADMIN = E:\oracle\product\10.2.0\network\admin\EBIZBLK_nvciebizd