/** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */ public Drawable newDrawable (Drawable drawable, Color tint) { Drawable newDrawable; if (drawable instanceof TextureRegionDrawable) newDrawable = ((TextureRegionDrawable)drawable).tint(tint); else if (drawable instanceof NinePatchDrawable) newDrawable = ((NinePatchDrawable)drawable).tint(tint); else if (drawable instanceof SpriteDrawable) newDrawable = ((SpriteDrawable)drawable).tint(tint); else throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); if (newDrawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)newDrawable; if (drawable instanceof BaseDrawable) named.setName(((BaseDrawable)drawable).getName() + " (" + tint + ")"); else named.setName(" (" + tint + ")"); } return newDrawable; }
/** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */ public Drawable newDrawable (Drawable drawable, Color tint) { Drawable newDrawable; if (drawable instanceof TextureRegionDrawable) newDrawable = ((TextureRegionDrawable)drawable).tint(tint); else if (drawable instanceof NinePatchDrawable) newDrawable = ((NinePatchDrawable)drawable).tint(tint); else if (drawable instanceof SpriteDrawable) newDrawable = ((SpriteDrawable)drawable).tint(tint); else throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); if (newDrawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)newDrawable; if (drawable instanceof BaseDrawable) named.setName(((BaseDrawable)drawable).getName() + " (" + tint + ")"); else named.setName(" (" + tint + ")"); } return newDrawable; }
/** Creates a new empty drawable with the same sizing information as the specified drawable. */ public BaseDrawable (Drawable drawable) { if (drawable instanceof BaseDrawable) name = ((BaseDrawable)drawable).getName(); leftWidth = drawable.getLeftWidth(); rightWidth = drawable.getRightWidth(); topHeight = drawable.getTopHeight(); bottomHeight = drawable.getBottomHeight(); minWidth = drawable.getMinWidth(); minHeight = drawable.getMinHeight(); }
/** Creates a new empty drawable with the same sizing information as the specified drawable. */ public BaseDrawable (Drawable drawable) { if (drawable instanceof BaseDrawable) name = ((BaseDrawable)drawable).getName(); leftWidth = drawable.getLeftWidth(); rightWidth = drawable.getRightWidth(); topHeight = drawable.getTopHeight(); bottomHeight = drawable.getBottomHeight(); minWidth = drawable.getMinWidth(); minHeight = drawable.getMinHeight(); }
/** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */ public Drawable newDrawable (Drawable drawable, Color tint) { Drawable newDrawable; if (drawable instanceof TextureRegionDrawable) newDrawable = ((TextureRegionDrawable)drawable).tint(tint); else if (drawable instanceof NinePatchDrawable) newDrawable = ((NinePatchDrawable)drawable).tint(tint); else if (drawable instanceof SpriteDrawable) newDrawable = ((SpriteDrawable)drawable).tint(tint); else throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); if (newDrawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)newDrawable; if (drawable instanceof BaseDrawable) named.setName(((BaseDrawable)drawable).getName() + " (" + tint + ")"); else named.setName(" (" + tint + ")"); } return newDrawable; }
/** Creates a new empty drawable with the same sizing information as the specified drawable. */ public BaseDrawable (Drawable drawable) { if (drawable instanceof BaseDrawable) name = ((BaseDrawable)drawable).getName(); leftWidth = drawable.getLeftWidth(); rightWidth = drawable.getRightWidth(); topHeight = drawable.getTopHeight(); bottomHeight = drawable.getBottomHeight(); minWidth = drawable.getMinWidth(); minHeight = drawable.getMinHeight(); }