# psd_tools.psd.patterns

Patterns structure.

## Patterns

class psd_tools.psd.patterns.Patterns(items=NOTHING)

  List of Pattern structure. See `Pattern`.

## Pattern

class psd_tools.psd.patterns.Pattern(version: int = 1, image_mode=ColorMode.RGB, point: tuple[int, int] = (0, 0), name: str = '', pattern_id: str = '', color_table: list[tuple[int, int, int]] = NOTHING, data: VirtualMemoryArrayList = None)

  Pattern structure.

  version
  image_mode

    See `ColorMode`

  point

    Size in tuple.

  name

    str name of the pattern.

  pattern_id

    ID of this pattern.

  color_table

    Color table if the mode is INDEXED.

  data

    See `VirtualMemoryArrayList`

## VirtualMemoryArrayList

class psd_tools.psd.patterns.VirtualMemoryArrayList(version: int = 3, rectangle: tuple[int, int, int, int] = (0, 0, 0, 0), channels: list[VirtualMemoryArray] = NOTHING)

  VirtualMemoryArrayList structure. Container of channels.

  version
  rectangle

    Tuple of int

  channels

    List of `VirtualMemoryArray`

## VirtualMemoryArray

class psd_tools.psd.patterns.VirtualMemoryArray(is_written: int = 0, depth: int | None = None, rectangle: tuple[int, int, int, int] | None = None, pixel_depth: int | None = None, compression=Compression.RAW, data: bytes = b'')

  VirtualMemoryArrayList structure, corresponding to each channel.

  is_written
  depth
  rectangle
  pixel_depth
  compression
  data
  get_data() → bytes | None

    Get decompressed bytes.

  set_data(size: tuple[int, int], data: bytes, depth: int, compression: int = 0) → None

    Set bytes.