# ImageStim

## visual ImageStim

Image Stimulus.

## Constructor

#### new ImageStim(options)

Source:
  - visual/ImageStim.js, line 24
Mixes In:
  - ColorMixin

##### Parameters:

Name | Type | Description
--- | --- | ---

`options`

Object

###### Properties

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | String |  |  | the name used when logging messages from this stimulus
`win` | Window |  |  | the associated Window
`image` | string | HTMLImageElement |  |  | the name of the image resource or the HTMLImageElement corresponding to the image
`mask` | string | HTMLImageElement |  |  | the name of the mask resource or HTMLImageElement corresponding to the mask
`units` | string | <optional> | `"norm"` | the units of the stimulus (e.g. for size, position, vertices)
`pos` | Array.<number> | <optional> | `[0, 0]` | the position of the center of the stimulus
`units` | string | <optional> | `'norm'` | the units of the stimulus vertices, size and position
`ori` | number | <optional> | `0.0` | the orientation (in degrees)
`size` | number | <optional> |  | the size of the rendered image (the size of the image will be used if size is not specified)
`color` | Color | <optional> | `'white'` | the background color
`opacity` | number | <optional> | `1.0` | the opacity
`contrast` | number | <optional> | `1.0` | the contrast
`depth` | number | <optional> | `0` | the depth (i.e. the z order)
`texRes` | number | <optional> | `128` | the resolution of the text
`interpolate` | boolean | <optional> | `false` | whether or not the image is interpolated
`flipHoriz` | boolean | <optional> | `false` | whether or not to flip horizontally
`flipVert` | boolean | <optional> | `false` | whether or not to flip vertically
`autoDraw` | boolean | <optional> | `false` | whether or not the stimulus should be automatically drawn on every frame flip
`autoLog` | boolean | <optional> | `false` | whether or not to log

### Extends

- VisualStim

### Methods

#### (protected) _estimateBoundingBox()

Source:
  - visual/ImageStim.js, line 242

Estimate the bounding box.

#### (protected) _getDisplaySize() → {Array.<number>}

Source:
  - visual/ImageStim.js, line 373

Get the size of the display image, which is either that of the ImageStim or that of the image it contains.

##### Returns:

the size of the displayed image

Type
  Array.<number>

#### (protected) _updateIfNeeded()

Source:
  - visual/ImageStim.js, line 263

Update the stimulus, if necessary.

#### setImage(image, logopt)

Source:
  - visual/ImageStim.js, line 112

Setter for the image attribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`image` | HTMLImageElement | string |  |  | the name of the image resource or HTMLImageElement corresponding to the image
`log` | boolean | <optional> | `false` | whether of not to log

#### setInterpolate(interpolate, logopt)

Source:
  - visual/ImageStim.js, line 228

Whether to interpolate (linearly) the texture in the stimulus.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`interpolate` | boolean |  | `false` | interpolate or not.
`log` | boolean | <optional> | `false` | whether or not to log

#### setMask(mask, logopt)

Source:
  - visual/ImageStim.js, line 180

Setter for the mask attribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`mask` | HTMLImageElement | string |  |  | the name of the mask resource or HTMLImageElement corresponding to the mask
`log` | boolean | <optional> | `false` | whether of not to log