×

Discussion Board

Results 1 to 6 of 6

Thread: RE: getRGB(...)

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    10

    RE: getRGB(...)

    I am having problems with getting RGB data from an image which is loaded inside the package of the application. when the getRGB() method is called to get all the pixels of the image in to an array the 7610 crashes!!!!

    Can someone please help?

  2. #2
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: getRGB(...)

    Here are some basic reasons until you provide more details such as, the code you are using:
    1. Have you allocated some memory for the array you are reading the data in ? This could throw NullPointerException.
    2. Is the array of the same size as your image ? If image size is (W x L) pixels, then that array should be at least of size (W*L). Otherwise, you can get ArrayIndexOutOfBoundsException.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    10

    Re: getRGB(...)

    When i call the method like this:

    rgbData = new int[image.getWidth() * image.getHeight()];
    image.getRGB(rgbData, 0, image.getWidth(), 0,0,image.getWidth(), image.getHeight());


    This crashes the phone.. but works fine on the emulator. but if i replace the x,y from 0,0 to 1,1 i think it causes a exception which is understandable.
    But why does the phone crash with 0,0.

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: getRGB(...)

    At the moment i do not even have a N70 let even a phone to test this issue So, as soon as i do, i'll give it a shot and get back to you.

    BTW which emulator did it work on ?

  5. #5
    Registered User
    Join Date
    Dec 2005
    Posts
    10

    Re: getRGB(...)

    im using the java wireless toolkit with midp 2 and cldc1.0.. this is what the 7610 has.

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    10

    Re: getRGB(...)

    ok.. i ve found what the problem was. basically the 7610 cannot deal with PNG images with a BIT depth of 32. The PNG image must be saved with 24 BIT depth.

    so be carefull how your PNG images are saved!!!

    Zubair Mitha

Similar Threads

  1. Problem in graphics for NOKIA 6600
    By txavego in forum Mobile Java Media (Graphics & Sounds)
    Replies: 17
    Last Post: 2009-03-04, 15:18
  2. getRGB() and createRGBImage
    By mvk_best in forum Mobile Java General
    Replies: 1
    Last Post: 2005-12-12, 01:48
  3. getRGB doesnt work on my Nokia Series 60 Emulator
    By rj_cybersilver in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2005-09-19, 03:46
  4. Capturing pixels 3650 / 7650
    By blackjack75 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 7
    Last Post: 2005-04-30, 14:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×