Example usage for com.badlogic.gdx.graphics.g2d NinePatch scale

List of usage examples for com.badlogic.gdx.graphics.g2d NinePatch scale

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d NinePatch scale.

Prototype

public void scale(float scaleX, float scaleY) 

Source Link

Document

Multiplies the top/left/bottom/right sizes and padding by the specified amount.

Usage

From source file:com.o2d.pkayjava.editor.plugins.ninepatch.PreviewWidget.java

License:Apache License

private Image fitNinePatch(NinePatch horizontalPatch, float width, float height, float scl) {
    horizontalPatch.scale(scl, scl);

    Image img = new Image(horizontalPatch);
    img.setScaleX(width / horizontalPatch.getTotalWidth());
    img.setScaleY(height / horizontalPatch.getTotalHeight());

    return img;//from   w  ww  .  j  a  v a  2 s  .  com
}

From source file:headmade.arttag.assets.Assets.java

License:Apache License

/**
 * // enable texture filtering for pixel smoothing
 *
 * @param atlas/*from w  w w. j av a  2s . com*/
 * @param typeOfFilter
 */
private void setTextureFilter(TextureAtlas atlas, TextureFilter typeOfFilter) {
    Gdx.app.log(TAG, "setting filter for textures " + atlas.getTextures().size);
    for (final Texture t : atlas.getTextures()) {
        t.setFilter(typeOfFilter, typeOfFilter); // min=mag
    }

    final Skin skin = assetsManager.get(AssetTextures.skin, Skin.class);
    final BitmapFont font = skin.getFont("default-font");
    for (int i = 0; i < font.getRegions().size; i++) {
        font.getRegion(i).getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    }

    NinePatch ninepatch = skin.get(AssetTextures.frame, NinePatch.class);
    ninepatch.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    ninepatch.scale(ArtTag.UNIT_SCALE * 0.75f, ArtTag.UNIT_SCALE * 0.75f);

    ninepatch = skin.get(AssetTextures.frame2, NinePatch.class);
    ninepatch.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    ninepatch.scale(ArtTag.UNIT_SCALE / 3, ArtTag.UNIT_SCALE / 3);
}