List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Image draw
public void draw(Batch batch, float parentAlpha)
From source file:nl.basroding.director.views.actors.basic.ListDeluxe.java
License:Apache License
public void draw(SpriteBatch batch, float parentAlpha) { BitmapFont font = style.font;//from w ww . j a va 2 s . co m Drawable selectedDrawable = style.selection; Color fontColorSelected = style.fontColorSelected; Color fontColorUnselected = style.fontColorUnselected; Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); float x = getX(); float y = getY(); font.setColor(fontColorUnselected.r, fontColorUnselected.g, fontColorUnselected.b, fontColorUnselected.a * parentAlpha); float itemY = getHeight(); for (int i = 0; i < items.length; i++) { if (cullingArea == null || (itemY - itemHeight <= cullingArea.y + cullingArea.height && itemY >= cullingArea.y)) { if ((i & 1) != 0) batch.draw(pixmapTexture, x, y + itemY - tableStyle.rowHeight, getWidth(), tableStyle.rowHeight); if (selectedIndex == i) { font.setColor(fontColorSelected.r, fontColorSelected.g, fontColorSelected.b, fontColorSelected.a * parentAlpha); } if (items[i] instanceof String) { font.draw(batch, (String) items[i], x + textOffsetX + style.leftMargin, y + itemY - textOffsetY); } else if (items[i] instanceof Image) { Image image = (Image) items[i]; image.setPosition(x + textOffsetX, y + itemY - textOffsetY - (image.getHeight() * image.getScaleY()) / 2); image.draw(batch, parentAlpha); } if (selectedIndex == i) { font.setColor(fontColorUnselected.r, fontColorUnselected.g, fontColorUnselected.b, fontColorUnselected.a * parentAlpha); } } else if (itemY < cullingArea.y) { break; } itemY -= itemHeight; } }
From source file:org.catrobat.catroid.stage.PenActor.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { buffer.begin();// w ww. j a v a2 s. co m for (Sprite sprite : ProjectManager.getInstance().getSceneToPlay().getSpriteList()) { drawLinesAndStampsForSprite(sprite, batch, parentAlpha); } buffer.end(); batch.end(); TextureRegion region = new TextureRegion(buffer.getColorBufferTexture()); region.flip(false, true); Image image = new Image(region); image.setPosition(-buffer.getWidth() / 2, -buffer.getHeight() / 2); batch.begin(); image.draw(batch, parentAlpha); }