Manual: TextureUtils Slicing

Documentation and discussion for Draconus Texture Utils available in the Unity Asset Store.
snlehton
Crew
Crew
Posts: 16
Joined: Tue Nov 04, 2014 1:59 pm

Manual: TextureUtils Slicing

Postby snlehton » Tue Nov 11, 2014 2:29 pm

Manual: TextureUtils Slicing
TextureUtils: Slicing | Pixel Operations |Normal Maps | Misc
AtlasGenerator | PSDReader |API Scripting Reference

SliceTexture (API ➔)

Slices a part of a texture.

Code: Select all

Texture2D slice = TextureUtils.SliceTexture(texture, IntRect.FromTopDown(33, 0, 34, 34, texture.height));

slice_tile.png
slice_tile.png (10.21 KiB) Viewed 670 times


SliceTextureGrid (API ➔)

Slices grid using even cell size with optional margin and offset. Note that the margin can be negative like in the example below. This allows you to slice overlapping textures. NOTE: this method operates in top-down pixel space.

Code: Select all

Texture2D[] slices = TextureUtils.SliceTextureGrid(texture, 34, 34, -1, -1, 0, 0);

slice_grid.png
slice_grid.png (15.55 KiB) Viewed 670 times


SliceTextureAuto (API ➔)

Slices a texture using auto slicing method. This method using key color to detect borders for texture slices inside the source texture. The key color can be detected from top-left corner, or specified as a parameter.
This method operates in top-down pixel space.

Useful for slicing irregular sized sprites such as bitmap fonts.

Code: Select all

Texture2D[] slices = TextureUtils.SliceTextureAuto(texture);

slice_auto.png
slice_auto.png (7.9 KiB) Viewed 670 times


SliceTextureAutoRects (API ➔)

Same as SliceTextureAuto, but doesn't do the actual slicing. Used for rendering previews of SliceTextureAuto in DTU (see DTUAtlasSourceEditor for an example)

Code: Select all

IntRect[] rects = TextureUtils.SliceTextureAutoRects(texture);


====================================================================================
TextureUtils: Slicing | Pixel Operations |Normal Maps | Misc
AtlasGenerator | PSDReader |API Scripting Reference

Return to “DTU - Draconus Texture Utils”

Who is online

Users browsing this forum: No registered users and 1 guest