Example usage for com.badlogic.gdx.scenes.scene2d Group draw

List of usage examples for com.badlogic.gdx.scenes.scene2d Group draw

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Group draw.

Prototype

public void draw(Batch batch, float parentAlpha) 

Source Link

Document

Draws the group and its children.

Usage

From source file:es.eucm.ead.editor.view.builders.scene.draw.MeshHelper.java

License:Open Source License

/**
 * Initializes the mesh with the pixels of the given group.
 * /*ww  w. j a va 2 s  .c  o m*/
 * The result vectors must be in {@link #scaledView} coordinates.
 * 
 * @param toEdit
 * @param resultOrigin
 * @param resultSize
 */
public void show(Group toEdit, Vector2 resultOrigin, Vector2 resultSize) {
    int x = MathUtils.round(resultOrigin.x), y = MathUtils.round(resultOrigin.y), width = (int) resultSize.x,
            height = (int) resultSize.y;
    minX = x;
    minY = y;
    maxX = minX + width;
    maxY = minY + height;

    scaledView.localToStageCoordinates(temp.set(x, y));
    int stageX = MathUtils.round(temp.x), stageY = MathUtils.round(temp.y);

    Batch batch = controller.getPlatform().getBatch();
    batch.setProjectionMatrix(combinedMatrix);
    fbo.begin();
    batch.begin();
    toEdit.draw(batch, 1f);
    batch.end();
    currModifiedPixmap = new PixmapRegion(ScreenUtils.getFrameBufferPixmap(stageX, stageY, width, height),
            stageX, stageY);
    fbo.end();
}