so here is something I wanted to do
`TextureRegion region = new TextureRegion(new Texture("path to the file"));
region.flip(false, true);
NinePatch patch = new NinePatch(region, left, right, up, down);
NinePatchDrawable drawable = new NinePatchDrawable(patch);
Table table = new Table();
table.setBackground(drawable);
table.add(someLabel);
`
when I add table to the stage I can see the label,but there is no background, same works if textureRegion is not flipped, can someone explain to me why?
That happens because
TextureRegion.flip()alters the u/v and u2/v2 coordinates. Creating aNinePatchfrom aTextureRegionthe way you did it only used the texture and the x/y coodinates from that TextureRegion. The u/v/u2/v2 information is lost at this point.It looks like the
NinePatch(TextureRegion... patches)constructor probably preserves that information but I didn't try it.