Split parameter in a texture atlas file?

纵饮孤独 提交于 2020-01-15 08:00:27

问题


How exactly works the split parameter in a skin.atlas file. Libgdx texture packer creates these from 9-patches I believe. I need to manually add these sometimes (when using the texturepacker in the linked tag or when manually inserting/editing a texture) and cant seem to figure it out how they exactly work. Sometimes a single pixel makes my elements disappear or does not fill the split.

Here is a example files:

roundtext138.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
button
  rotate: false
  xy: 0, 0
  size: 46, 46
  split: 22, 22, 22, 22
  orig: 46, 46
  offset: 0, 0
  index: -1

回答1:


The Libgdx texture packer should generate the split/padding parameters you see in the atlas from the metadata in the .9.png file. Those numbers represent the startX, endX, startY, endY of the stretchable area (the middle section of the 9-element grid). See the source code that generates the splits array for more details. (You can see the splits information being written out to the atlas in TexturePacker.java.)




回答2:


I hope this image could solve your problems ! a,b,c,d are the 4 parameters



来源:https://stackoverflow.com/questions/26203545/split-parameter-in-a-texture-atlas-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!