Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor micojade's Avatar
    Join Date
    Jul 2008
    Posts
    50
    Gurus,

    For the following API call when writing a drawRGB,
    drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha)

    If we give -1 or -2 such kind of negative value to the parameter heigth in above API call, what should be the result? Should we get some exception or no exception at all???

    Please kindly help me!!!! No such info from the document spec?!

  2. #2
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    There is no defined behaviour for the circumstance you describe. You might get an exception. Then again, you might not.

    I suggest you never pass a negative value for height...

    Graham.

  3. #3
    Regular Contributor micojade's Avatar
    Join Date
    Jul 2008
    Posts
    50
    Thanks for your reply. But no defined behaviour is not a good way. Normal flow is what we usually do, but hacker can use the attacking way to make it a mess. Because it did not say people cannot give a negative value that is the problem.... A bit confused here.

  4. #4
    Regular Contributor micojade's Avatar
    Join Date
    Jul 2008
    Posts
    50
    so this way, how to solve this kind of issue?

  5. #5
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Well if you are making a call to the asked method so simply you can also test the same and in turn you can also know the results, here one has to write the code and then has to test the same. AFIK you must get an exception.

    Why don't you go ahead and test the same.?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  6. #6
    Regular Contributor micojade's Avatar
    Join Date
    Jul 2008
    Posts
    50
    Just want to know what should be the defined behaviour. For the testing done here, it did not throw exception

  7. #7
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Quote Originally Posted by micojade View Post
    Just want to know what should be the defined behaviour. For the testing done here, it did not throw exception
    Parameters:
    rgbData - an array of ARGB values in the format 0xAARRGGBB
    offset - the array index of the first ARGB value
    scanlength - the relative array offset between the corresponding pixels in consecutive rows in the rgbData array
    x - the horizontal location of the region to be rendered
    y - the vertical location of the region to be rendered
    width - the width of the region to be rendered
    height - the height of the region to be rendered
    processAlpha - true if rgbData has an alpha channel, false if all pixels are fully opaque
    Throws:
    ArrayIndexOutOfBoundsException - if the requested operation will attempt to access an element of rgbData whose index is either negative or beyond its length
    NullPointerException - if rgbData is null
    As you can read the above thrown exception which are both realated to the rgb data only and hence that verify the tesrting you have done.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  8. #8
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    Quote Originally Posted by micojade View Post
    so this way, how to solve this kind of issue?
    Solve it by not passing inappropriate values. What exactly is the problem?

    Graham.

Similar Threads

  1. drawRGB with negative value
    By tomsoft in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2008-10-31, 15:28
  2. N73 and drawRGB
    By jimmy_anttila in forum Mobile Java General
    Replies: 0
    Last Post: 2006-09-29, 14:43
  3. N70 BUG: drawrgb() after Graphics.translate()
    By Nitrooo84 in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2006-03-28, 21:04
  4. Graphics.copyArea() vs Image.getRGB() / Graphics.drawRGB() ?
    By akokchai in forum Mobile Java General
    Replies: 1
    Last Post: 2004-06-23, 04:47
  5. Replies: 2
    Last Post: 2004-06-08, 10:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved