Class: PostcardImageObject

PostcardImageObject

new PostcardImageObject(url, ctx, options)

Represents an internal object that deals with images
Parameters:
Name Type Argument Description
url String URL to the image (relative or absolute)
ctx CanvasRenderingContext2D context in which to draw the object
options Object <optional>
Defines placement and content.
Properties
Name Type Argument Default Description
keepOriginal Object <optional>
true Maintains a copy of the image so it can be reverted.
crop Object <optional>
false Will crop the image.
cropX Object <optional>
0 Crop X value
cropY Object <optional>
0 Crop Y value
cropW Object <optional>
0 Crop width value.
cropH Object <optional>
0 Crop height value.
Source:

Extends

Methods

changeURL(newUrl)

Change the source URL of the ImageObject
Parameters:
Name Type Description
newUrl String the new URL
Source:

contains() → {Boolean}

Generic contains method for PostcardObject.
Inherited From:
Source:
Returns:
if the coordinate is within the object's bounds
Type
Boolean

draw()

Draw method for the image object. Only applies after image data is loaded via proxy
Source:

getCurrentImageData() → {ImageData|Error}

Get the current image data
Source:
Returns:
Type
ImageData | Error

getOriginalImageData() → {ImageData|Error}

Get the original image data
Source:
Returns:
Type
ImageData | Error

getRotation()

Get rotation of the image object.
Source:

hide()

Set opacity on the PostcardObject to 0.0
Inherited From:
Source:

onImageLoaded(callback)

Set a callback function to be called when an image is done loading
Parameters:
Name Type Description
callback function Callback function. Applied to `this`
Source:

revert()

Revert any changes made to the image
Source:

setImageData(newImageData)

Set the new image data
Parameters:
Name Type Description
newImageData ImageData new ImageData object to set
Source:

setRotation(angle)

Set rotation of the image object.
Parameters:
Name Type Description
angle Number Angle of rotation, in degrees;
Source:

show()

Set opacity on the PostcardObject to 1.0
Inherited From:
Source:

update(newOptions)

Generic update method for PostcardObject.
Parameters:
Name Type Description
newOptions Object any options to update
Inherited From:
Source:

<private, inner> applyImage()

Takes raw image data (from the proxy or cache) and sets it to the ImageObject, using an HTMLImageElement as a shell
Source:

<private, inner> loadImage()

Method to get image data via proxy. Uses the JSONP library to get the raw image data, then adds it to the cache of images and makes a call to applyImage()
Source:

<private, inner> onImageRefresh()

Happens whenever image.src changes
Source: