use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class FactoryGraphicHeadless method createImageBufferAlpha.
@Override
public ImageBuffer createImageBufferAlpha(int width, int height) {
final ImageBuffer buffer = new ImageBufferHeadless(width, height, Transparency.TRANSLUCENT);
final Graphic g = buffer.createGraphic();
g.setColor(ColorRgba.TRANSPARENT);
g.drawRect(0, 0, width, height, true);
g.dispose();
return buffer;
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class FactoryGraphicHeadless method flipHorizontal.
@Override
public ImageBuffer flipHorizontal(ImageBuffer image) {
Check.notNull(image);
final ImageBuffer flip = new ImageBufferHeadless((ImageBufferHeadless) image);
final int height = flip.getHeight();
final int width = flip.getWidth();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int rgba = flip.getRgb(x, y);
flip.setRgb(width - x - 1, y, rgba);
}
}
return flip;
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class FactoryGraphicHeadless method applyMask.
@Override
public ImageBuffer applyMask(ImageBuffer image, ColorRgba maskColor) {
Check.notNull(image);
Check.notNull(maskColor);
final ImageBuffer mask = new ImageBufferHeadless((ImageBufferHeadless) image);
final int height = mask.getHeight();
final int width = mask.getWidth();
final int rgba = maskColor.getRgba();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int col = mask.getRgb(x, y);
final int flag = 0x00_FF_FF_FF;
if (col == rgba) {
mask.setRgb(x, y, col & flag);
}
}
}
return mask;
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class FactoryGraphicHeadless method flipVertical.
@Override
public ImageBuffer flipVertical(ImageBuffer image) {
Check.notNull(image);
final ImageBuffer flip = new ImageBufferHeadless((ImageBufferHeadless) image);
final int height = flip.getHeight();
final int width = flip.getWidth();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int rgba = flip.getRgb(x, y);
flip.setRgb(x, height - y - 1, rgba);
}
}
return flip;
}
use of com.b3dgs.lionengine.graphic.ImageBuffer in project lionengine by b3dgs.
the class FactoryGraphicHeadless method createImageBuffer.
@Override
public ImageBuffer createImageBuffer(int width, int height, ColorRgba transparency) {
Check.notNull(transparency);
final ImageBuffer buffer = new ImageBufferHeadless(width, height, Transparency.BITMASK);
final Graphic g = buffer.createGraphic();
g.setColor(transparency);
g.drawRect(0, 0, width, height, true);
g.dispose();
return buffer;
}
Aggregations