1 |
/* Copyright (C) 2000, 2002 Free Software Foundation |
/* Copyright (C) 2000, 2002, 2003 Free Software Foundation |
2 |
|
|
3 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
4 |
|
|
88 |
return new SinglePixelPackedSampleModel(dataType, w, h, bitMasks); |
return new SinglePixelPackedSampleModel(dataType, w, h, bitMasks); |
89 |
} |
} |
90 |
|
|
91 |
|
|
92 |
|
/** |
93 |
|
* Creates a DataBuffer for holding pixel data in the format and |
94 |
|
* layout described by this SampleModel. The returned buffer will |
95 |
|
* consist of one single bank. |
96 |
|
*/ |
97 |
public DataBuffer createDataBuffer() |
public DataBuffer createDataBuffer() |
98 |
{ |
{ |
99 |
// Important: use scanlineStride here, not width! |
int size; |
100 |
int size = scanlineStride*height; |
|
101 |
|
// We can save (scanlineStride - width) pixels at the very end of |
102 |
|
// the buffer. The Sun reference implementation (J2SE 1.3.1 and |
103 |
|
// 1.4.1_01) seems to do this; tested with Mauve test code. |
104 |
|
size = scanlineStride * (height - 1) + width; |
105 |
|
|
106 |
return Buffers.createBuffer(getDataType(), size); |
return Buffers.createBuffer(getDataType(), size); |
107 |
} |
} |
108 |
|
|
109 |
|
|
110 |
public int[] getSampleSize() |
public int[] getSampleSize() |
111 |
{ |
{ |
112 |
return sampleSize; |
return sampleSize; |