[Java mapscript] int imageObj.getSize() does not work

rich.fromm nospam420 at YAHOO.COM
Mon Dec 17 18:07:58 EST 2007


if i have a valid image in an imageObj object:
- int imageObj.getWidth() returns the expected value
- int imageObj.getHeight() returns the expected value
- void imageObj.save(String, null) successfully writes the image to a file
- byte[] imageObj.getBytes() successfully returns a byte array (whose length
  matches the size of the file above), containing the proper contents of the
  image (i can subsequently dump it to a file and verify).
however:
- int imageObj.getSize() always returns 0

this turns out to not be a big deal.  at first i thought i would have to
query
the size with getSize(), then allocate a byte[] of the appropriate size,
then
populate the byte[] with getBytes().

however, it is sufficient to just write code like:

  byte[] bytes = img.getBytes();

if img is the imageObj containing the image.  it's not necessary to directly
query the size, and if i really want to know it, bytes.length will return
the
proper value.

nevertheless, if i'm properly guessing the intention of imageObj.getSize()
[maybe i'm wrong], this seems like a bug to me.

i do notice the following in mapscript/doc/mapscript.txt within the
mapserver-5.0.0 distribution:

--- begin ---
imageObj Attributes
-------------------

<...>

size : int
    I don't see where this is used.  Anyone?  --SG

<...>

imageObj Methods
----------------

[getSize() is not listed here]
--- end ---

so maybe it's just deprecated.

- rich

-- 
View this message in context: http://www.nabble.com/-Java-mapscript--int-imageObj.getSize%28%29-does-not-work-tp14375813p14375813.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list