use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class FactoryGraphicAwt method createImageBuffer.
@Override
public ImageBuffer createImageBuffer(int width, int height) {
final BufferedImage image = ToolsAwt.createImage(width, height, java.awt.Transparency.OPAQUE);
final ImageBuffer buffer = new ImageBufferAwt(image);
final Graphic g = buffer.createGraphic();
g.setColor(ColorRgba.BLACK);
g.drawRect(0, 0, width, height, true);
g.dispose();
return buffer;
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class TextAwtTest method testAlignUnknown.
/**
* Test align unknown.
*/
@Test
public void testAlignUnknown() {
final Text text = Graphics.createText(Constant.FONT_DIALOG, 12, TextStyle.NORMAL);
try {
final Graphic g = Graphics.createGraphic();
g.setGraphic(ToolsAwt.createImage(1, 1, java.awt.Transparency.OPAQUE).createGraphics());
text.draw(g, 0, 0, UtilEnum.make(Align.class, "FAIL"), Constant.EMPTY_STRING);
Assert.fail();
} catch (final LionEngineException exception) {
Assert.assertNotNull(exception);
}
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class ImageTest method testRender.
/**
* Test the render.
*/
@Test
public void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
try {
final Image image = new ImageImpl(Graphics.createImageBuffer(64, 32));
image.render(g);
} finally {
g.dispose();
}
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SpriteAnimatedTest method testRender.
/**
* Test render.
*/
@Test
public void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
try {
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
sprite.render(g);
sprite.setFrame(1);
sprite.setMirror(Mirror.HORIZONTAL);
sprite.render(g);
sprite.setMirror(Mirror.VERTICAL);
sprite.render(g);
} finally {
g.dispose();
}
}
use of com.b3dgs.lionengine.graphic.Graphic in project lionengine by b3dgs.
the class SpriteFontTest method testRender.
/**
* Test render.
*/
@Test
public void testRender() {
final Graphic g = Graphics.createImageBuffer(100, 100).createGraphic();
try {
final SpriteFont sprite = new SpriteFontImpl(media, font, 6, 7);
sprite.render(g);
sprite.setMirror(Mirror.HORIZONTAL);
sprite.setAlign(Align.RIGHT);
sprite.setText("az%");
sprite.setLocation(1.5, 2.5);
sprite.render(g);
sprite.setMirror(Mirror.VERTICAL);
sprite.setLineHeight(5);
sprite.render(g);
} finally {
g.dispose();
}
}
Aggregations