code: private ImageBuffer createRaster(Media rasterMedia, Raster raster, int i, boolean save)
      {
          final ImageBuffer rasterBuffer;
          if (rasterMedia.exists())
          {
              rasterBuffer = Graphics.getImageBuffer(rasterMedia);
              rasterBuffer.prepare();
          }
          else
          {
              final double fr = getRasterFactor(i, raster.getRed());
              final double fg = getRasterFactor(i, raster.getGreen());
              final double fb = getRasterFactor(i, raster.getBlue());
  
              rasterBuffer = Graphics.getRasterBuffer(surface, fr, fg, fb);
  
              if (save)
              {
                  Graphics.saveImage(rasterBuffer, rasterMedia);
              }
          }
          return rasterBuffer;
      }
docs: Create raster from data or load from cache.
  
  @param rasterMedia The raster media.
  @param raster The raster data.
  @param i The raster index.
  @param save <code>true</code> to save generated raster, <code>false</code> else.
  @return The created raster.