Skip to main content

[JAVA2D] SampleModel.getDataElements()

1 reply [Last post]
Anonymous

I'm debugging some code that gets the sample values for pixels within a
given rectangle, using

SampleModel.getDataElements(int x, int y, int w, int h, Object obj,
DataBuffer db)

The API documentation is unclear on one point (or I'm missing it): the
result is always pixel interleaved, regardless of the way the given
DataBuffer is laid out. Perhaps this is exactly the purpose of this
method, I have to admit that I haven't used it before, and I'm only
reviewing code written by someone else.

My question is just to clarify: getDataElements() as defined above will
always return the interleaved samples for each pixel, correct? If so, in
my case I think I should use DataBuffer methods instead.

Just checking, thanks,

Mike Nidel

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jim Graham

I submitted bug 6369452:

SampleModel and Raster methods do not specify the order
of data in the array for multiple pixels

to track this issue. It should appear in the bug parade in a day or two.

Note that you can access the data a band at a time using the
get/setSamples methods if that works better for you...

...jim

Nidel, Mike wrote:
> I'm debugging some code that gets the sample values for pixels within a
> given rectangle, using
>
> SampleModel.getDataElements(int x, int y, int w, int h, Object obj,
> DataBuffer db)
>
>
> The API documentation is unclear on one point (or I'm missing it): the
> result is always pixel interleaved, regardless of the way the given
> DataBuffer is laid out. Perhaps this is exactly the purpose of this
> method, I have to admit that I haven't used it before, and I'm only
> reviewing code written by someone else.
>
> My question is just to clarify: getDataElements() as defined above will
> always return the interleaved samples for each pixel, correct? If so, in
> my case I think I should use DataBuffer methods instead.
>
> Just checking, thanks,
>
> Mike Nidel
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".