API Docs for: 6.0.1
Show:

window.scrawl_Images Class

window.scrawl

scrawlImages module adaptions to the Scrawl library object

New library sections

  • scrawl.image - for ScrawlImage objects
  • scrawl.img - linking to copies of DOM <img> elements - links to the original elements are stored in scrawl.object
  • scrawl.anim - for AnimSheet objects

Methods

doConvert

() private

Helper function for convert functions

Returns:

Picture entity object

Entity.convertToPicture

(
  • items
)

A factory function to convert a entity into a Picture entity

Argument attributes can include any entity positioning and styling values, alongside the following flag:

  • convert - when set to true, existing entity will be deleted; default: false

If no name attribute is supplied in the argument object, the new Picture entity will be given the name: SPRITENAME+'_picture'

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

Picture entity object

getImageById

(
  • idtag
  • [kill]
)

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:180

A general function to generate a Image wrapper object for an <img> or <svg> element identified by an id string

Note: if an <img> (or <picture>) element uses the srcset attribute some browsers (eg chrome) will attempt to reload the image during browser resize. For this reason it is good policy to set this function's second argument (kill) to false, particularly if it is being used within an image load event listener. By default, the kill argument is set to true.

Parameters:

  • idtag String

    Id string value of DOM object to be imported into the scrawl-canvas library

  • [kill] Boolean optional

    when set to true, the <img> element will be removed from the DOM when imported into the library

Returns:

true if image is identified; false otherwise

getImagesByClass

(
  • classtag
  • [kill]
)

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:143

A general function to generate Image wrapper objects for <img>, <video> or <svg> elements identified by class string

Parameters:

  • classtag String

    Class string value of DOM objects to be imported into the scrawl-canvas library

  • [kill] Boolean optional

    when set to true, the <img> elements will be removed from the DOM when imported into the library

Returns:

true if one or more images are identified; false otherwise

getImagesDeviceData

() private

Check if device supports various video functionalities

getVideoById

(
  • idtag
  • [stream]
)

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:226

A general function to generate a Video wrapper object for a <video> element identified by an id string

Parameters:

  • idtag String

    Id string value of DOM object to be imported into the scrawl-canvas library

  • [stream] Boolean optional

    defaults to 'raw'

Returns:

true if video is identified; false otherwise

getVideoCallback

() private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:215

Helper function

Group.convertGroupToPicture

(
  • items
)

A factory function to convert a group of entitys into a single Picture entity

Argument attributes can include any entity positioning and styling values, alongside the following flag:

  • convert - when set to true, existing entitys in the group will be deleted; default: false

If no name attribute is supplied in the argument object, the new Picture entity will be given the name: GROUPNAME+'_entity'

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

Picture entity object; false if no entitys contained in group

makeImage

(
  • items
)
private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:97

A factory function to generate new Image objects

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

Image object

makePattern

(
  • items
)

A factory function to generate new Pattern objects

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

Pattern object

makePicture

(
  • items
)

A factory function to generate new Picture entitys

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

Picture entity object

makeSpriteAnimation

(
  • items
)

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:107

A factory function to generate new SpriteAnimation objects

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

SpriteAnimation object

makeVideo

(
  • items
)
private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:116

A factory function to generate new Video objects

Parameters:

  • items Object

    Key:value Object argument for setting attributes

Returns:

Video object

newImage

() deprecated private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:71

Alias for makeImage()

newPattern

() deprecated

Alias for makePattern()

newPicture

() deprecated

Alias for makePicture()

newSpriteAnimation

() deprecated

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:80

Alias for makeSpriteAnimation()

prepareConvert

() private

Helper function for convert functions

Returns:

ImageData object

Properties

Device.video

Boolean

video support

False if device does not support the video element; true otherwise

Default: false

Device.videoAsCanvasSource

Boolean

video as canvas source

False if device does not permit video elements to be used as sources for canvas draw functions

Default: false

Device.videoAutoplay

Boolean

video autoplay support

False if device does not support video autoplay element; true otherwise

Default: false

Device.videoForceFullScreen

Boolean

video fullscreen restraint

False if device does not force videos to play in fullscreen mode; true otherwise

Default: false

scrawl.work.imageCanvas

CasnvasObject private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:55

Utility canvas - never displayed

scrawl.work.imageCvx

CasnvasContextObject private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:64

Utility canvas 2d context engine

scrawl.work.imageFragment

Object private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:48

DOM document fragment

scrawl.work.workimg

Vector private

Provided by the scrawlFrame module.

Defined in source\scrawlImageLoad.js:126

Work vector, for calculations