use of com.b3dgs.lionengine.graphic.Raster in project lionengine by b3dgs.
the class RasterImage method loadRasters.
/**
* Load rasters.
*
* @param imageHeight The local image height.
* @param save <code>true</code> to save generated (if) rasters, <code>false</code> else.
* @param prefix The folder prefix, if save is <code>true</code> (must not be <code>null</code>).
* @throws LionEngineException If the raster data from the media are invalid.
*/
public void loadRasters(int imageHeight, boolean save, String prefix) {
Check.notNull(prefix);
final Raster raster = Raster.load(rasterFile);
final int max = UtilConversion.boolToInt(rasterSmooth) + 1;
for (int m = 0; m < max; m++) {
for (int i = 1; i <= RasterColor.MAX_RASTERS; i++) {
final String folder = prefix + Constant.UNDERSCORE + UtilFile.removeExtension(rasterFile.getName());
final String file = String.valueOf(i + m * RasterColor.MAX_RASTERS) + Constant.DOT + ImageFormat.PNG;
final Media rasterMedia = Medias.create(rasterFile.getParentPath(), folder, file);
final ImageBuffer rasterBuffer = createRaster(rasterMedia, raster, m, i, imageHeight, save);
rasters.add(rasterBuffer);
}
}
}
Aggregations