Class: PhotoEditorSDK

PhotoEditorSDK

The main SDK class which handles rendering and manages operations.

new PhotoEditorSDK(preferredRenderer, options)

sdk/sdk.js, line 34

Creates a PhotoEditorSDK instance

Name Type Default Description
preferredRenderer String webgl optional

webgl or canvas

options Object
Name Type Default Description
apiKey String

Your API key

image Image optional

The image that should be rendered

renderMode String dynamic optional

dynamic or export

versionCheck Boolean true optional

Should a version check be performed?

displayWelcomeMessage Boolean true optional

Should a welcome message be printed in the console?

transparent Boolean false optional

Should the canvas background be transparent?

canvas HTMLCanvasElement optional

The canvas element the SDK should render to

zoom Number 1 optional

The zoom level. Only available in dynamic mode

spriteScale Number 1 optional

The output sprite's scale. Only available in dynamic mode

logLevel String warn optional

trace, info, warn, error or log

pixelRatio Number 1 optional

If none is given, PhotoEditorSDK automatically detects the current device's pixel ratio

smoothDownscaling Boolean false optional

Toggles smooth downscaling

smoothUpscaling Boolean false optional

Toggles smooth upscaling

Classes

Color
Configurable
EventEmitter
Filter
Operation
Operations.AdjustmentsOperation
OperationsStack

Namespaces

Engine
FilterPrimitives
Filters
Math
Operations
UI

Members

static,constantPhotoEditorSDK.EventsString

Events used by the UI

static,constantPhotoEditorSDK.ImageFormatString

The available image types

static,constantPhotoEditorSDK.OptionTypeString

The available option types for classes inheriting PhotoEditorSDK.Configurable

static,constantPhotoEditorSDK.RendererTypeString

The available renderer types

static,constantPhotoEditorSDK.RenderTypeString

The available render types

static,constantPhotoEditorSDK.UniformTypeString

The available uniform types for WebGL shaders

staticPhotoEditorSDK.version

The current version of the SDK

Methods

addOperation(operation)

sdk/sdk.js, line 416

Adds the given operation to the operations stack

Name Type Description
operation PhotoEditorSDK.Operation

createOperation(identifier, options, addToStack){PhotoEditorSDK.Operation}

sdk/sdk.js, line 399

Creates an operation with the given identifier

Name Type Default Description
identifier String
options Object {} optional
addToStack Boolean true optional
Returns:
Type Description
PhotoEditorSDK.Operation

dispose()

sdk/sdk.js, line 908

Disposes the SDK

export(renderType, imageFormat, quality){Promise}

sdk/sdk.js, line 229

Exports the image with the given options. Result of the Promise is the exported image or data url.

Name Type Default Description
renderType PhotoEditorSDK.RenderType PhotoEditorSDK.RenderType.DATAURL optional

The output type

imageFormat PhotoEditorSDK.ImageFormat PhotoEditorSDK.ImageFormat.PNG optional

The output image format

quality Number 0.8 optional

The image quality, between 0 and 1

Returns:
Type Description
Promise

getCanvas(){HTMLCanvasElement}

sdk/sdk.js, line 679

Returns the canvas

Returns:
Type Description
HTMLCanvasElement

getContainer(){PhotoEditorSDK.Engine.Container}

sdk/sdk.js, line 703

Returns the container

Returns:
Type Description
PhotoEditorSDK.Engine.Container

getExif(){PhotoEditorSDK.Exif}

sdk/sdk.js, line 858

Returns the Exif instance

Returns:
Type Description
PhotoEditorSDK.Exif [description]

getFinalDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

sdk/sdk.js, line 445

Returns the final dimensions that the input image would have after all existing operations have been applied

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getImage(){Image}

sdk/sdk.js, line 628

Returns the image

Returns:
Type Description
Image

getInputDimensions(){PhotoEditorSDK.Math.Vector2}

sdk/sdk.js, line 434

Returns the initial image dimensions

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getInputTexture(){PhotoEditorSDK.Engine.Texture}

sdk/sdk.js, line 874

Returns the input texture

Returns:
Type Description
PhotoEditorSDK.Engine.Texture

getOffset(){PhotoEditorSDK.Math.Vector2}

sdk/sdk.js, line 748

Returns the rendering offset

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOperations(){Array.<Operation>}

sdk/sdk.js, line 732

Returns the available operations

Returns:
Type Description
Array.<Operation>

getOperationsStack(){PhotoEditorSDK.OperationsStack}

sdk/sdk.js, line 711

Returns the operation stack

Returns:
Type Description
PhotoEditorSDK.OperationsStack

getOptions(){Object}

sdk/sdk.js, line 866

Returns the options

Returns:
Type Description
Object

getOutputDimensions(incorporateSpriteScale){Vector2}

sdk/sdk.js, line 466

Returns the current sprite dimensions

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
Vector2

getOutputTextureDimensions(incorporateSpriteScale){Vector2}

sdk/sdk.js, line 477

Returns the dimensions of the output texture

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
Vector2

getPixelRatio(){Number}

sdk/sdk.js, line 850

Returns the pixel ratio

Returns:
Type Description
Number

getRenderer(){PhotoEditorSDK.Engine.BaseRenderer}

sdk/sdk.js, line 740

Returns the renderer

Returns:
Type Description
PhotoEditorSDK.Engine.BaseRenderer

getRenderMode(){String}

sdk/sdk.js, line 769

Returns the current render mode

Returns:
Type Description
String

getRotation()

sdk/sdk.js, line 899

Returns the current rotation

getSprite(){PhotoEditorSDK.Engine.Sprite}

sdk/sdk.js, line 695

Returns the sprite

Returns:
Type Description
PhotoEditorSDK.Engine.Sprite

getSpriteScale(){Number}

sdk/sdk.js, line 832

Returns the output sprite's scale

Returns:
Type Description
Number

getTextureQuality(){Number}

sdk/sdk.js, line 803

Returns the texture quality

Returns:
Type Description
Number

getZoom(){Number}

sdk/sdk.js, line 785

Returns the zoom level

Returns:
Type Description
Number

hasImage(){Boolean}

sdk/sdk.js, line 620

Checks if an image is provided

Returns:
Type Description
Boolean [description]

removeOperation(operation)

sdk/sdk.js, line 424

Removes the given operation from the operations stack

Name Type Description
operation PhotoEditorSDK.Operation

render(){Promise}

sdk/sdk.js, line 244

Renders the current image to the canvas

Returns:
Type Description
Promise

reset()

sdk/sdk.js, line 550

Resets all custom and selected operations

resizeTo(dimensions)

sdk/sdk.js, line 543

Resizes the renderer to the given dimensions

Name Type Description
dimensions PhotoEditorSDK.Math.Vector2

setAllOperationsToDirty(dimensionsChanged)

sdk/sdk.js, line 388

Sets all operations in the stack to dirty

Name Type Default Description
dimensionsChanged Boolean false

= false

setCanvas(canvas)

sdk/sdk.js, line 687

Sets the canvas

Name Type Description
canvas HTMLCanvasElement

setImage(image, exif, dimensions)

sdk/sdk.js, line 638

Sets the image and parses the exif data

Name Type Default Description
image Image
exif PhotoEditorSDK.Exif null optional
dimensions PhotoEditorSDK.Math.Vector2 null optional

setOffset(offset, y)

sdk/sdk.js, line 757

Sets the rendering offset

Name Type Description
offset PhotoEditorSDK.Math.Vector2 | Number
y Number

setOperationsStack(operationsStack)

sdk/sdk.js, line 719

Sets the operations stack

Name Type Description
operationsStack PhotoEditorSDK.OperationsStack

setRenderMode(renderMode)

sdk/sdk.js, line 777

Sets the render mode

Name Type Description
renderMode String

setRotation(rotation)

sdk/sdk.js, line 892

Sets the rotation to the given value

Name Type Description
rotation Number

setSmoothDownscaling(smoothDownscaling)

sdk/sdk.js, line 882

Sets the smooth downscaling flag for the output sprite

Name Type Description
smoothDownscaling Boolean

setSpriteScale(spriteScale)

sdk/sdk.js, line 840

Sets the sprite scale to the given value

Name Type Description
spriteScale Number

setTextureQuality(textureQuality)

sdk/sdk.js, line 815

Sets the texture quality

Name Type Description
textureQuality Number

setZoom(zoom)

sdk/sdk.js, line 793

Sets the zoom level

Name Type Description
zoom Number