Package ch.blackspirit.graphics

Examples of ch.blackspirit.graphics.GraphicsListener


public class ImageTest extends JoglTestBase {
  @Test
  public void drawImage() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(image, image.getWidth(), image.getHeight());
      }
      public void init(View view, Graphics renderer) {}
View Full Code Here


    context.draw()
  }
  @Test
  public void drawImageFlipped() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(image, image.getWidth(), image.getHeight(), Flip.BOTH);
      }
      public void init(View view, Graphics renderer) {}
View Full Code Here

  }
 
  @Test
  public void drawImageNotFlipped() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(image, image.getWidth(), image.getHeight(), Flip.NONE);
      }
      public void init(View view, Graphics renderer) {}
View Full Code Here

  }

  @Test
  public void drawSubImage() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(image, image.getWidth(), image.getHeight(),
            image.getWidth() / 4, image.getHeight() / 4, image.getWidth() / 2, image.getHeight() / 2);
      }
View Full Code Here

    context.draw()
  }
  @Test
  public void drawSubImageFlipped() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(image, image.getWidth(), image.getHeight(),
            image.getWidth() / 4, image.getHeight() / 4, image.getWidth() / 2, image.getHeight() / 2, Flip.BOTH);
      }
View Full Code Here

  }
 
  @Test
  public void drawSubImageNotFlipped() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(image, image.getWidth(), image.getHeight(),
            image.getWidth() / 4, image.getHeight() / 4, image.getWidth() / 2, image.getHeight() / 2, Flip.NONE);
      }
View Full Code Here

  }
 
  @Test
  public void drawImageColored() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.setColor(new Color4f(1, 0, 0, 1));
        graphics.drawImage(image, image.getWidth(), image.getHeight());
      }
View Full Code Here

  }

  @Test
  public void drawSubImageColored() throws IOException {
    final ch.blackspirit.graphics.Image image = imageFactory.createImage(this.getClass().getResource("/player1.png"), true);
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.setColor(new Color4f(1, 0, 0, 1));
        graphics.drawImage(image, image.getWidth(), image.getHeight(),
            image.getWidth() / 4, image.getHeight() / 4, image.getWidth() / 2, image.getHeight() / 2);
View Full Code Here

    context.draw()
  }
 
  @Test (expected=IllegalArgumentException.class)
  public void drawImageNull() throws IOException {
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(null, 640, 480);
      }
      public void init(View view, Graphics renderer) {}
View Full Code Here

    });
    context.draw()
  }
  @Test (expected=IllegalArgumentException.class)
  public void drawFlippedImageNull() throws IOException {
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.drawImage(null, 640, 480, Flip.BOTH);
      }
      public void init(View view, Graphics renderer) {}
View Full Code Here

TOP

Related Classes of ch.blackspirit.graphics.GraphicsListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.