Examples of NinePatchDrawable


Examples of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable

    background.setSize( width, height );

    // panel background
    NinePatch np = new NinePatch( ResourceFactory.newTexture( "brushed.png", false ), 0, 0, 0, 0 );
    np.setColor( new Color( 0.3f, 0.3f, 0.3f, 1f ) );
    NinePatchDrawable npBack = new NinePatchDrawable( np );

    // build the top panel and add all of its widgets
    Table topPanel = buildTopPanel( npBack, width, height );
    topPanel.add( buildGlobalSettingsWidgets() );
    topPanel.add( buildBloomWidgets() );
View Full Code Here

Examples of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable

    try {
      TextureRegion textureRegion = getRegion(name);
      if (textureRegion instanceof AtlasRegion) {
        AtlasRegion region = (AtlasRegion)textureRegion;
        if (region.splits != null)
          drawable = new NinePatchDrawable(getPatch(name));
        else if (region.rotate || region.packedWidth != region.originalWidth || region.packedHeight != region.originalHeight)
          drawable = new SpriteDrawable(getSprite(name));
      }
      if (drawable == null) drawable = new TextureRegionDrawable(textureRegion);
    } catch (GdxRuntimeException ignored) {
    }

    // Check for explicit registration of ninepatch, sprite, or tiled drawable.
    if (drawable == null) {
      NinePatch patch = optional(name, NinePatch.class);
      if (patch != null)
        drawable = new NinePatchDrawable(patch);
      else {
        Sprite sprite = optional(name, Sprite.class);
        if (sprite != null)
          drawable = new SpriteDrawable(sprite);
        else
View Full Code Here

Examples of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable

  }

  /** Returns a copy of the specified drawable. */
  public Drawable newDrawable (Drawable drawable) {
    if (drawable instanceof TextureRegionDrawable) return new TextureRegionDrawable((TextureRegionDrawable)drawable);
    if (drawable instanceof NinePatchDrawable) return new NinePatchDrawable((NinePatchDrawable)drawable);
    if (drawable instanceof SpriteDrawable) return new SpriteDrawable((SpriteDrawable)drawable);
    throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass());
  }
View Full Code Here

Examples of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable

        sprite = new Sprite(region);
      sprite.setColor(tint);
      return new SpriteDrawable(sprite);
    }
    if (drawable instanceof NinePatchDrawable) {
      NinePatchDrawable patchDrawable = new NinePatchDrawable((NinePatchDrawable)drawable);
      patchDrawable.setPatch(new NinePatch(patchDrawable.getPatch(), tint));
      return patchDrawable;
    }
    if (drawable instanceof SpriteDrawable) {
      SpriteDrawable spriteDrawable = new SpriteDrawable((SpriteDrawable)drawable);
      Sprite sprite = spriteDrawable.getSprite();
View Full Code Here

Examples of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable

  }

  /** Creates an image stretched, and aligned center.
   * @param patch May be null. */
  public Image (NinePatch patch) {
    this(new NinePatchDrawable(patch), Scaling.stretch, Align.center);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.