@pixi/filter-convolution
Advanced tools
Comparing version 2.2.0 to 2.3.0
/*! | ||
* @pixi/filter-convolution - v2.2.0 | ||
* Compiled Wed, 18 Oct 2017 20:54:45 UTC | ||
* @pixi/filter-convolution - v2.3.0 | ||
* Compiled Tue, 31 Oct 2017 18:03:10 UTC | ||
* | ||
@@ -8,83 +8,3 @@ * pixi-filters is licensed under the MIT License. | ||
*/ | ||
if (typeof PIXI === 'undefined' || typeof PIXI.filters === 'undefined') { throw 'PixiJS is required'; } | ||
var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; | ||
var fragment = "precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"; | ||
/** | ||
* The ConvolutionFilter class applies a matrix convolution filter effect. | ||
* A convolution combines pixels in the input image with neighboring pixels to produce a new image. | ||
* A wide variety of image effects can be achieved through convolutions, including blurring, edge | ||
* detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array. | ||
* See http://docs.gimp.org/en/plug-in-convmatrix.html for more info. | ||
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/convolution.png) | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
* @param matrix {number[]} An array of values used for matrix transformation. Specified as a 9 point Array. | ||
* @param width {number} Width of the object you are transforming | ||
* @param height {number} Height of the object you are transforming | ||
*/ | ||
var ConvolutionFilter = (function (superclass) { | ||
function ConvolutionFilter(matrix, width, height) { | ||
superclass.call(this, vertex, fragment); | ||
this.matrix = matrix; | ||
this.width = width; | ||
this.height = height; | ||
} | ||
if ( superclass ) ConvolutionFilter.__proto__ = superclass; | ||
ConvolutionFilter.prototype = Object.create( superclass && superclass.prototype ); | ||
ConvolutionFilter.prototype.constructor = ConvolutionFilter; | ||
var prototypeAccessors = { matrix: {},width: {},height: {} }; | ||
/** | ||
* An array of values used for matrix transformation. Specified as a 9 point Array. | ||
* | ||
* @member {Array<number>} | ||
*/ | ||
prototypeAccessors.matrix.get = function () { | ||
return this.uniforms.matrix; | ||
}; | ||
prototypeAccessors.matrix.set = function (value) { | ||
this.uniforms.matrix = new Float32Array(value); | ||
}; | ||
/** | ||
* Width of the object you are transforming | ||
* | ||
* @member {number} | ||
*/ | ||
prototypeAccessors.width.get = function () { | ||
return 1/this.uniforms.texelSize[0]; | ||
}; | ||
prototypeAccessors.width.set = function (value) { | ||
this.uniforms.texelSize[0] = 1/value; | ||
}; | ||
/** | ||
* Height of the object you are transforming | ||
* | ||
* @member {number} | ||
*/ | ||
prototypeAccessors.height.get = function () { | ||
return 1/this.uniforms.texelSize[1]; | ||
}; | ||
prototypeAccessors.height.set = function (value) { | ||
this.uniforms.texelSize[1] = 1/value; | ||
}; | ||
Object.defineProperties( ConvolutionFilter.prototype, prototypeAccessors ); | ||
return ConvolutionFilter; | ||
}(PIXI.Filter)); | ||
// Export to PixiJS namespace | ||
PIXI.filters.ConvolutionFilter = ConvolutionFilter; | ||
export { ConvolutionFilter }; | ||
var vertex="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",fragment="precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n",ConvolutionFilter=function(e){function t(t,r,o){e.call(this,vertex,fragment),this.matrix=t,this.width=r,this.height=o}e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t;var r={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return r.matrix.get=function(){return this.uniforms.matrix},r.matrix.set=function(e){this.uniforms.matrix=new Float32Array(e)},r.width.get=function(){return 1/this.uniforms.texelSize[0]},r.width.set=function(e){this.uniforms.texelSize[0]=1/e},r.height.get=function(){return 1/this.uniforms.texelSize[1]},r.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(t.prototype,r),t}(PIXI.Filter);PIXI.filters.ConvolutionFilter=ConvolutionFilter;export{ConvolutionFilter}; | ||
//# sourceMappingURL=filter-convolution.es.js.map |
/*! | ||
* @pixi/filter-convolution - v2.2.0 | ||
* Compiled Wed, 18 Oct 2017 20:54:44 UTC | ||
* @pixi/filter-convolution - v2.3.0 | ||
* Compiled Tue, 31 Oct 2017 18:03:10 UTC | ||
* | ||
@@ -8,93 +8,3 @@ * pixi-filters is licensed under the MIT License. | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.__filter_convolution = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
if (typeof PIXI === 'undefined' || typeof PIXI.filters === 'undefined') { throw 'PixiJS is required'; } | ||
var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; | ||
var fragment = "precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"; | ||
/** | ||
* The ConvolutionFilter class applies a matrix convolution filter effect. | ||
* A convolution combines pixels in the input image with neighboring pixels to produce a new image. | ||
* A wide variety of image effects can be achieved through convolutions, including blurring, edge | ||
* detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array. | ||
* See http://docs.gimp.org/en/plug-in-convmatrix.html for more info. | ||
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/convolution.png) | ||
* | ||
* @class | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
* @param matrix {number[]} An array of values used for matrix transformation. Specified as a 9 point Array. | ||
* @param width {number} Width of the object you are transforming | ||
* @param height {number} Height of the object you are transforming | ||
*/ | ||
var ConvolutionFilter = (function (superclass) { | ||
function ConvolutionFilter(matrix, width, height) { | ||
superclass.call(this, vertex, fragment); | ||
this.matrix = matrix; | ||
this.width = width; | ||
this.height = height; | ||
} | ||
if ( superclass ) ConvolutionFilter.__proto__ = superclass; | ||
ConvolutionFilter.prototype = Object.create( superclass && superclass.prototype ); | ||
ConvolutionFilter.prototype.constructor = ConvolutionFilter; | ||
var prototypeAccessors = { matrix: {},width: {},height: {} }; | ||
/** | ||
* An array of values used for matrix transformation. Specified as a 9 point Array. | ||
* | ||
* @member {Array<number>} | ||
*/ | ||
prototypeAccessors.matrix.get = function () { | ||
return this.uniforms.matrix; | ||
}; | ||
prototypeAccessors.matrix.set = function (value) { | ||
this.uniforms.matrix = new Float32Array(value); | ||
}; | ||
/** | ||
* Width of the object you are transforming | ||
* | ||
* @member {number} | ||
*/ | ||
prototypeAccessors.width.get = function () { | ||
return 1/this.uniforms.texelSize[0]; | ||
}; | ||
prototypeAccessors.width.set = function (value) { | ||
this.uniforms.texelSize[0] = 1/value; | ||
}; | ||
/** | ||
* Height of the object you are transforming | ||
* | ||
* @member {number} | ||
*/ | ||
prototypeAccessors.height.get = function () { | ||
return 1/this.uniforms.texelSize[1]; | ||
}; | ||
prototypeAccessors.height.set = function (value) { | ||
this.uniforms.texelSize[1] = 1/value; | ||
}; | ||
Object.defineProperties( ConvolutionFilter.prototype, prototypeAccessors ); | ||
return ConvolutionFilter; | ||
}(PIXI.Filter)); | ||
// Export to PixiJS namespace | ||
PIXI.filters.ConvolutionFilter = ConvolutionFilter; | ||
exports.ConvolutionFilter = ConvolutionFilter; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.__filter_convolution={})}(this,function(e){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n",o=function(e){function o(o,i,n){e.call(this,t,r),this.matrix=o,this.width=i,this.height=n}e&&(o.__proto__=e),(o.prototype=Object.create(e&&e.prototype)).constructor=o;var i={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return i.matrix.get=function(){return this.uniforms.matrix},i.matrix.set=function(e){this.uniforms.matrix=new Float32Array(e)},i.width.get=function(){return 1/this.uniforms.texelSize[0]},i.width.set=function(e){this.uniforms.texelSize[0]=1/e},i.height.get=function(){return 1/this.uniforms.texelSize[1]},i.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(o.prototype,i),o}(PIXI.Filter);PIXI.filters.ConvolutionFilter=o,e.ConvolutionFilter=o,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=filter-convolution.js.map |
{ | ||
"name": "@pixi/filter-convolution", | ||
"version": "2.2.0", | ||
"main": "lib/filter-convolution.min.js", | ||
"version": "2.3.0", | ||
"main": "lib/filter-convolution.js", | ||
"description": "Display filter render as ASCII text", | ||
@@ -10,3 +10,3 @@ "author": "Mat Groves", | ||
], | ||
"module": "lib/filter-convolution.es.min.js", | ||
"module": "lib/filter-convolution.es.js", | ||
"types": "types.d.ts", | ||
@@ -24,5 +24,5 @@ "homepage": "http://pixijs.com/", | ||
"scripts": { | ||
"build:umd": "rollup -c -f umd && rollup -cp -f umd", | ||
"build:es": "rollup -c && rollup -cp", | ||
"build": "npm run build:umd && npm run build:es", | ||
"build:dev": "rollup -c && rollup -c -f umd", | ||
"build": "rollup -cp && rollup -cp -f umd", | ||
"watch": "rollup -cw", | ||
"postversion": "npm run build" | ||
@@ -38,6 +38,7 @@ }, | ||
"devDependencies": { | ||
"@tools/build": "^2.0.1", | ||
"@tools/build": "^2.3.0", | ||
"@tools/fragments": "^2.0.0", | ||
"rollup": "^0.45.2" | ||
"rollup": "^0.45.2", | ||
"rollup-watch": "^4.3.1" | ||
} | ||
} |
/// <reference types="pixi.js" /> | ||
declare namespace PIXI.filters { | ||
class ConvolutionFilter extends PIXI.Filter { | ||
class ConvolutionFilter extends PIXI.Filter<{}> { | ||
constructor(matrix:number[], width:number, height:number); | ||
@@ -5,0 +5,0 @@ height:number; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13939
4
8
46
1