use of com.b3dgs.lionengine.graphic.RasterColor in project lionengine by b3dgs.
the class RasterImage method createRaster.
/**
* Create raster from data or load from cache.
*
* @param rasterMedia The raster media.
* @param raster The raster data.
* @param m The smooth index.
* @param i The raster index.
* @param imageHeight The image height.
* @param save <code>true</code> to save generated raster, <code>false</code> else.
* @return The created raster.
*/
private ImageBuffer createRaster(Media rasterMedia, Raster raster, int m, int i, int imageHeight, boolean save) {
final ImageBuffer rasterBuffer;
if (rasterMedia.exists()) {
rasterBuffer = Graphics.getImageBuffer(rasterMedia);
rasterBuffer.prepare();
} else {
final RasterColor red = RasterColor.load(raster.getRed(), m, i, rasterSmooth);
final RasterColor green = RasterColor.load(raster.getGreen(), m, i, rasterSmooth);
final RasterColor blue = RasterColor.load(raster.getBlue(), m, i, rasterSmooth);
rasterBuffer = Graphics.getRasterBuffer(surface, red.getStart(), green.getStart(), blue.getStart(), red.getEnd(), green.getEnd(), blue.getEnd(), imageHeight);
if (save) {
Graphics.saveImage(rasterBuffer, rasterMedia);
}
}
return rasterBuffer;
}
Aggregations