Nine-Patch

ox ix ix2 ox2 v v v v ---------------------- < oy |A | | | | | | | | | | |

| |B | | < iy | | | | | | C| | < iy2

| | | | | | | | | | | D| ---------------------- < oy2

A: Pixel of outerX and outerY It is the pixel top/left. On a full image it is 0,0

B: Pixel of innerX and innerY It is the pixel top/left of the middle part

C: Pixel of innerX2 and innerY2 It is the pixel bottom/right of the middle part Can be the same as B if the middle part is only one pixel in size

D: Pixel of outerX and outerY It is the right/bottom pixel of the outer part. On a full image it is image.width-1, image.height-1

Hierarchy

Constructors

Properties

_cacheId: string
enabled: boolean = true
mixColor: Color = ...
ninePatch: {
    ix: number;
    ix2: number;
    iy: number;
    iy2: number;
    ox: number;
    ox2: number;
    oy: number;
    oy2: number;
} = ...

Type declaration

  • ix: number
  • ix2: number
  • iy: number
  • iy2: number
  • ox: number
  • ox2: number
  • oy: number
  • oy2: number
onPaddingSpace: boolean = false

Set to true so the style will be rendered on Padding space.

_globalCacheId: number = 0

Methods

  • Option1: explicit data (for spritesheet)

    ninePatch = { outerX: 1, outerY: 1, innerX: 3, innerY: 3, innerX2: 6 innerY2: 6, outerX2: 10, outerY2: 10 }

    Option2: explicit array (for spritesheet)

    ninePatch = [ 1, 1, // outer X/Y 3, 3, // inner X/Y 6, 6, // inner X2/Y2 10, 10 // outer X2/Y2 ]

    Option3: implicit outer data (for full image)

    ninePatch = { innerX: 3, innerY: 3, innerX2: 6 innerY2: 6, }

    outerX/Y will be both 0 outerX2 => image.width - 1, outerY2 => image.height - 1

    Option 4: implicit outer data array (for full image)

    ninePatch = [ 3, 3, // inner X/Y 6, 6, // inner X2/Y2 ]

    outerX2 => image.width - 1, outerY2 => image.height - 1

    Option 5: implicit inner data as easelJS rectangle (to be compatible ScaleBitmap)

    ninePatch = new Rect( 3, 3, // inner X/Y 3, 3 // inner width, inner height );

    Parameters

    Returns void

Generated using TypeDoc