Class: Descriptor

Defined in: lib/psd/descriptor.coffee

Overview

A descriptor is a block of data that describes a complex data structure of some kind. It was added sometime around Photoshop 5.0 and it superceded a few legacy things such as layer names and type data. The benefit of the Descriptor is that it is self-contained, and allows us to dynamically define data of any size. It's always represented by an Object at the root.

Variables Summary

data =
{}

The object that will store the resulting data.

Instance Method Summary

Constructor Details

# (void) constructor(file)

Creates a new Descriptor.

Parameters:

  • The ( File ) PSD file.

Instance Method Details

# (void) parse()

Parses the Descriptor at the current location in the file.

# (void) parseClass() Private

Parses a class representation, which consists of a name and a unique ID.

# (void) parseId() Private

Parses an ID, which is a unique String.

# (void) parseKeyItem() Private

Parses a key/item value, which consists of an ID and an Item of any type.

# (void) parseItem(type = null) Private

Parses an Item, which can be one of many types of data, depending on the key.

# (void) parseBoolean() Private

# (void) parseDouble() Private

# (void) parseInteger() Private

# (void) parseLargeInteger()

# (void) parseIdentifier() Private

An identifier is an Integer.

# (void) parseIndex() Private

An index is an Integer.

# (void) parseOffset() Private

An office is an Integer.

# (void) parseProperty() Private

Parses a Property, which consists of a class and a unique ID.

# (void) parseEnum() Private

Parses an enumerator, which consists of 2 IDs, one of which is the type, and the other is the value.

# (void) parseEnumReference() Private

Parses an enumerator reference, which consists of a class and 2 IDs: a type and value.

# (void) parseAlias() Private

Parses an Alias, which is a string of arbitrary length.

# (void) parseFilePath() Private

Parses a file path, which consists of a 4 character signature and a path.

# (void) parseList() Private

Parses a list/array of Items.

# (void) parseObjectArray()

TODO: Not documented anywhere and unsure of the data format. Luckily,

seems to be incredibly rare.

# (void) parseRawData() Private

Parses raw byte data of arbitrary length.

# (void) parseReference() Private

Parses a Reference, which is an array of items of multiple types.

# (void) parseUnitDouble() Private

Parses a double with a unit, such as angle, percent, pixels, etc. Returns an object with an ID, a unit, and a value.

# (void) parseUnitFloat() Private

Parses a float with a unit, such as angle, percent, pixels, etc. Returns an object with an ID, a unit, and a value.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: