Exemplo n.º 1
0
  @Override
  public boolean drawImage(
      Image img,
      int dx1,
      int dy1,
      int dx2,
      int dy2,
      int sx1,
      int sy1,
      int sx2,
      int sy2,
      Color bgcolor,
      ImageObserver observer) {
    Texture texture = getTexture(img, observer);
    if (texture == null) {
      return false;
    }

    float height = texture.getHeight();
    float width = texture.getWidth();
    begin(texture, null, bgcolor);
    applyTexture(texture, dx1, dy1, dx2, dy2, sx1 / width, sy1 / height, sx2 / width, sy2 / height);
    end(texture);

    return true;
  }
Exemplo n.º 2
0
  protected void applyTexture(Texture texture) {
    int width = texture.getWidth();
    int height = texture.getHeight();
    TextureCoords coords = texture.getImageTexCoords();

    applyTexture(
        texture, 0, 0, width, height, coords.left(), coords.top(), coords.right(), coords.bottom());
  }