What Does It Mean To Get Raster DataBuffer

Aug 14, 2014

I've been trying to practice some active rendering involving triple buffering and manipulating a BufferedImage's raster. however, as I was watching some videos and reading articles, I noticed programers using this method invocation hierarchy to get the raster's pixels

((DataBufferInt) BufferedImage.getRaster().getDataBuffer()).getData()

I know what does the method getRaster() return, but I'm confused about the other ones especially the getDataBuffer(). What is a data buffer exactly, and what is happening when invoking those methods?

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: Double Drawing Pixels When Manipulating DataBuffer Of BufferedImage

Feb 9, 2014

I've been working my way through a tutorial to build a simple 2D tile-based engine that also allows the code to manipulate the colour of pixels on the screen based on a monochrome map read from a file. I've got the code right line for line, but I seem to have a bug when it comes to draw to the screen! At regular intervals, despite what is held in the pixel array of ints (which I have confirmed to be correct when debugging), I get the same row of pixels being draw twice in a row. I figured there was some loop issue somewhere, but after attempting to debug this for some time, I haven't come up with the answer.

Original tilesheet:As rendered:

Game.java:
package igg.engine.game;
import igg.engine.game.gfx.Screen;
import igg.engine.game.gfx.SpriteSheet;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;

[Code] ....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved