Skip to content

Commit baa82ed

Browse files
authored
Access DataBuffer directly
1 parent 2e34ad4 commit baa82ed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src_java/com/grimpirate/BufferedImageTranscoder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
public class BufferedImageTranscoder extends ImageTranscoder
1818
{
1919
private BufferedImage image;
20+
private DataBufferByte buffer;
2021

2122
public BufferedImageTranscoder(Document svg, float width, float height) throws TranscoderException
2223
{
@@ -37,7 +38,7 @@ public BufferedImage createImage(int width, int height)
3738
Transparency.OPAQUE,
3839
DataBuffer.TYPE_BYTE),
3940
Raster.createInterleavedRaster(
40-
DataBuffer.TYPE_BYTE,
41+
new DataBufferByte(with * 4 * height),
4142
width,
4243
height,
4344
width * 4,
@@ -71,6 +72,6 @@ public BufferedImage getBufferedImage() throws TranscoderException
7172
*/
7273
public byte[] getImageData()
7374
{
74-
return ((DataBufferByte) image.getData().getDataBuffer()).getData();
75+
return buffer.getData();
7576
}
7677
}

0 commit comments

Comments
 (0)