Class fabric.Image
Extends
fabric.Object.
Image
Defined in: image.class.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
fabric.Image.CSS_CANVAS
Default CSS class name for canvas
|
- Fields borrowed from class fabric.Object:
- FX_DURATION, FX_TRANSITION, includeDefaultValues, MIN_SCALE_LIMIT, NUM_FRACTION_DIGITS, options, rotate, stateProperties
Method Attributes | Method Name and Description |
---|---|
clone(callback)
Returns a clone of an instance
|
|
Returns complexity of an instance
|
|
<static> |
fabric.Image.fromObject(object, callback)
Creates an instance of fabric.Image from its object representation
|
<static> |
fabric.Image.fromURL(url, callback, imgOptions)
Creates an instance of fabric.Image from an URL string
|
Returns image element which this instance if based on
|
|
getNormalizedSize(oImg, maxwidth, maxheight)
Resizes an image depending on whether maxwidth and maxheight are set up;
Width and height have to mantain the same proportion in the final image as it was in the initial one.
|
|
Returns original size of an image
|
|
getSrc()
Returns source of an image
|
|
initialize(element, options)
Constructor
|
|
render(ctx, noTransform)
Renders image on a specified context
|
|
setBorderVisibility(visible)
Sets border visibility
|
|
setCornersVisibility(visible)
Sets corner visibility
|
|
setElement(element)
Sets image element for this instance to a specified one
|
|
toGrayscale(callback)
Makes image grayscale
|
|
toObject()
Returns object representation of an instance
|
|
toString()
Returns string representation of an instance
|
- Methods borrowed from class fabric.Object:
- callSuper, cloneAsImage, drawBorders, drawCorners, fxRemove, fxStraighten, get, getAngle, getCenter, getHeight, getWidth, hasStateChanged, intersectsWithObject, intersectsWithRect, isActive, isContainedWithinRect, isType, saveState, scale, scaleToHeight, scaleToWidth, set, setActive, setAngle, setCoords, setOpacity, setOptions, setSourcePath, straighten, toDatalessObject, toDataURL, toggle, toJSON, transform
Field Detail
{Boolean}
active
{Boolean}
bordervisibility
{Boolean}
cornervisibility
<static>
{String}
fabric.Image.CSS_CANVAS
Default CSS class name for canvas
{Number}
maxheight
{Number}
maxwidth
{String}
type
Method Detail
clone(callback)
Returns a clone of an instance
- Parameters:
- {Function} callback
- Callback is invoked with a clone as a first argument
{Number}
complexity()
Returns complexity of an instance
- Returns:
- {Number} complexity
<static>
fabric.Image.fromObject(object, callback)
Creates an instance of fabric.Image from its object representation
- Parameters:
- object
- {Object}
- callback
- {Function} optional
<static>
fabric.Image.fromURL(url, callback, imgOptions)
Creates an instance of fabric.Image from an URL string
- Parameters:
- {String} url
- URL to create an image from
- {Function} callback Optional
- Callback to invoke when image is created (newly created image is passed as a first argument)
- {Object} imgOptions Optional
- Options object
{HTMLImageElement}
getElement()
Returns image element which this instance if based on
- Returns:
- {HTMLImageElement} image element
getNormalizedSize(oImg, maxwidth, maxheight)
Resizes an image depending on whether maxwidth and maxheight are set up;
Width and height have to mantain the same proportion in the final image as it was in the initial one.
- Parameters:
- {Object} oImg
- {Number} maxwidth
- maximum width of the image (in px)
- {Number} maxheight
- maximum height of the image (in px)
{Object}
getOriginalSize()
Returns original size of an image
- Returns:
- {Object} object with "width" and "height" properties
{String}
getSrc()
Returns source of an image
- Returns:
- {String} Source of an image
initialize(element, options)
Constructor
- Parameters:
- {HTMLImageElement | String} element
- Image element
- {Object} options
- optional
render(ctx, noTransform)
Renders image on a specified context
- Parameters:
- {CanvasRenderingContext2D} ctx
- Context to render on
- noTransform
setBorderVisibility(visible)
Sets border visibility
- Parameters:
- {Boolean} visible
- When true, border is set to be visible
setCornersVisibility(visible)
Sets corner visibility
- Parameters:
- {Boolean} visible
- When true, corners are set to be visible
{fabric.Image}
setElement(element)
Sets image element for this instance to a specified one
- Parameters:
- {HTMLImageElement} element
- Returns:
- {fabric.Image} thisArg
toGrayscale(callback)
Makes image grayscale
- Parameters:
- {Function} callback
{Object}
toObject()
Returns object representation of an instance
- Returns:
- {Object} Object representation of an instance
{String}
toString()
Returns string representation of an instance
- Returns:
- {String} String representation of an instance