Home Reference Source
import {Image} from './api/Image.js'
public class | source

Image

Extends:

WrappedObjectLayer → Image

Represents an image layer.

Static Method Summary

Static Public Methods
public static

tests(): dictionary

Return a list of tests to run for this class.

Constructor Summary

Public Constructor
public

constructor(layer: MSBitmapLayer, document: Document)

Make a new image layer object.

Member Summary

Public Members
public set

imageURL(url: NSURL): *

Set the layer's image to the contents of the image file at a given URL.

public get

isImage: bool: boolean

Is this an image layer?

Inherited Summary

From class WrappedObject
public static

tests(): dictionary

Return a list of tests to run for this class.

public get

id: string: *

Returns the object ID of the wrapped Sketch model object.

public get

Returns the wrapped Sketch object.

From class Layer
public static

tests(): dictionary

Return a list of tests to run for this class.

public get

Return the parent container of this layer.

public get

The frame of the layer.

public set

frame(frame: Rectangle): *

Set the frame of the layer.

public get

Return the index of this layer in it's container. The layer at the back of the container (visualy) will be layer 0. The layer at the front will be layer n - 1 (if there are n layers).

public get

Is this an artboard?

public get

isGroup: bool: boolean

Is this a group?

public get

isImage: bool: boolean

Is this an image layer?

public get

isPage: bool: boolean

Is this a page?

public get

isShape: bool: boolean

Is this a shape layer?

public get

isText: bool: boolean

Is this a text layer?

public get

name: string: *

The name of the layer.

public set

name(name: string): *

Set the name of the layer.

public

Add this layer to the selected layers.

public

Deselect this layer.

public

Duplicate this layer.

public

export(options: dictionary)

Export this layer (and the ones below it), using the options supplied.

public

Returns a list of export options with any missing ones replaced by default values.

public

Convert a rectangle in the coordinates that this layer uses to absolute (page) coordinates.

public

Convert a rectangle in the coordinates that this layer uses to it's parent's coordinates.

public

Move this layer backwards in its container.

public

Move this layer forward in its container.

public

Move this layer to the back of its container.

public

Move this layer to the front of its container.

public

remove()

Remove this layer from its parent.

public

select()

Select the layer.

Static Public Methods

public static tests(): dictionary source

Return a list of tests to run for this class.

Override:

Layer#tests

Return:

dictionary

A dictionary containing the tests to run. Each key is the name of a test, each value is a function which takes a Tester instance.

Public Constructors

public constructor(layer: MSBitmapLayer, document: Document) source

Make a new image layer object.

Params:

NameTypeAttributeDescription
layer MSBitmapLayer

The underlying model object from Sketch.

document Document

The document that the bitmap layer belongs to.

Public Members

public set imageURL(url: NSURL): * source

Set the layer's image to the contents of the image file at a given URL.

public get isImage: bool: boolean source

Is this an image layer?

All Layer objects respond to this method, but only image layers return true.

Override:

Layer#isImage

Return:

bool

true for instances of Image, false for any other layer type.

See something wrong or incomplete? Improve this page.