mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-20 03:11:52 +00:00
parent
9b383628e8
commit
3544b727be
13 changed files with 32 additions and 8 deletions
|
|
@ -58,6 +58,8 @@
|
|||
* Applies filter to canvas element
|
||||
* @memberOf fabric.Image.filters.Resize.prototype
|
||||
* @param {Object} canvasEl Canvas element to apply filter to
|
||||
* @param {Number} scaleX
|
||||
* @param {Number} scaleY
|
||||
*/
|
||||
applyTo: function(canvasEl, scaleX, scaleY) {
|
||||
|
||||
|
|
@ -85,6 +87,15 @@
|
|||
canvasEl.getContext('2d').putImageData(imageData, 0, 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter sliceByTwo
|
||||
* @param {Object} canvasEl Canvas element to apply filter to
|
||||
* @param {Number} width
|
||||
* @param {Number} height
|
||||
* @param {Number} newWidth
|
||||
* @param {Number} newHeight
|
||||
* @returns {ImageData}
|
||||
*/
|
||||
sliceByTwo: function(canvasEl, width, height, newWidth, newHeight) {
|
||||
var context = canvasEl.getContext('2d'), imageData,
|
||||
multW = 0.5, multH = 0.5, signW = 1, signH = 1,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {String} key
|
||||
* @param {Any} value
|
||||
* @param {*} value
|
||||
* @return {fabric.Ellipse} thisArg
|
||||
*/
|
||||
_set: function(key, value) {
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@
|
|||
/**
|
||||
* Returns requested property
|
||||
* @param {String} prop Property to get
|
||||
* @return {Any}
|
||||
* @return {*}
|
||||
*/
|
||||
get: function(prop) {
|
||||
if (prop in _lockProperties) {
|
||||
|
|
|
|||
|
|
@ -337,6 +337,9 @@
|
|||
* Applies filters assigned to this image (from "filters" array)
|
||||
* @method applyFilters
|
||||
* @param {Function} callback Callback is invoked when all filters have been applied and new image is generated
|
||||
* @param {Array} filters to be initialized
|
||||
* @param {fabric.Image} imgElement
|
||||
* @param {Boolean} forResizing
|
||||
* @return {fabric.Image} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
|
|
@ -397,6 +400,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
_render: function(ctx, noTransform) {
|
||||
var x, y, imageMargins = this._findMargins(), elementToDraw;
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@
|
|||
* @private
|
||||
* @param {String} method
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Number} line
|
||||
* @param {String} line Content of the line
|
||||
* @param {Number} left
|
||||
* @param {Number} top
|
||||
* @param {Number} lineIndex
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
_render: function(ctx, noTransform) {
|
||||
ctx.beginPath();
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
/**
|
||||
* Sets certain property to a certain value
|
||||
* @param {String} prop
|
||||
* @param {Any} value
|
||||
* @param {*} value
|
||||
* @return {fabric.PathGroup} thisArg
|
||||
*/
|
||||
_set: function(prop, value) {
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
_render: function(ctx, noTransform) {
|
||||
if (!this.commonRender(ctx, noTransform)) {
|
||||
|
|
@ -148,6 +149,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
commonRender: function(ctx, noTransform) {
|
||||
var point, len = this.points.length;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
_render: function(ctx, noTransform) {
|
||||
if (!fabric.Polygon.prototype.commonRender.call(this, ctx, noTransform)) {
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
_render: function(ctx, noTransform) {
|
||||
|
||||
|
|
|
|||
|
|
@ -559,6 +559,7 @@
|
|||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {String} method Method name ("fillText" or "strokeText")
|
||||
*/
|
||||
_renderTextCommon: function(ctx, method) {
|
||||
|
||||
|
|
@ -858,6 +859,7 @@
|
|||
/**
|
||||
* Renders text instance on a specified context
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
* @param {Boolean} noTransform
|
||||
*/
|
||||
render: function(ctx, noTransform) {
|
||||
// do not render if object is not visible
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
if (!Array.prototype.indexOf) {
|
||||
/**
|
||||
* Finds index of an element in an array
|
||||
* @param {Any} searchElement
|
||||
* @param {*} searchElement
|
||||
* @return {Number}
|
||||
*/
|
||||
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
/**
|
||||
* Returns "folded" (reduced) result of iterating over elements in an array
|
||||
* @param {Function} fn Callback to invoke for each element
|
||||
* @return {Any}
|
||||
* @return {*}
|
||||
*/
|
||||
Array.prototype.reduce = function(fn /*, initial*/) {
|
||||
var len = this.length >>> 0,
|
||||
|
|
@ -188,7 +188,7 @@
|
|||
* @memberOf fabric.util.array
|
||||
* @param {Array} array Array to iterate over
|
||||
* @param {String} byProperty
|
||||
* @return {Any}
|
||||
* @return {*}
|
||||
*/
|
||||
function max(array, byProperty) {
|
||||
return find(array, byProperty, function(value1, value2) {
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
* @memberOf fabric.util.array
|
||||
* @param {Array} array Array to iterate over
|
||||
* @param {String} byProperty
|
||||
* @return {Any}
|
||||
* @return {*}
|
||||
*/
|
||||
function min(array, byProperty) {
|
||||
return find(array, byProperty, function(value1, value2) {
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@
|
|||
* Converts from attribute value to pixel value if applicable.
|
||||
* Returns converted pixels or original value not converted.
|
||||
* @param {Number|String} value number to operate on
|
||||
* @param {Number} fontSize
|
||||
* @return {Number|String}
|
||||
*/
|
||||
parseUnit: function(value, fontSize) {
|
||||
|
|
@ -348,6 +349,7 @@
|
|||
* @memberOf fabric.util
|
||||
* @param {Array} elements SVG elements to group
|
||||
* @param {Object} [options] Options object
|
||||
* @param {String} path Value to set sourcePath to
|
||||
* @return {fabric.Object|fabric.PathGroup}
|
||||
*/
|
||||
groupSVGElements: function(elements, options, path) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue