@pixi/filter-adjustment
Advanced tools
Comparing version 4.2.0 to 5.0.0
@@ -1,9 +0,50 @@ | ||
/*! | ||
* @pixi/filter-adjustment - v4.2.0 | ||
* Compiled Fri, 05 Aug 2022 19:53:35 UTC | ||
"use strict";/*! | ||
* @pixi/filter-adjustment - v5.0.0 | ||
* Compiled Fri, 23 Sep 2022 20:48:56 UTC | ||
* | ||
* @pixi/filter-adjustment is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/ | ||
var __filters=function(t,r){"use strict";var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])})(t,r)};Object.create;Object.create;var e=function(t){function r(r){var n=t.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n")||this;return n.gamma=1,n.saturation=1,n.contrast=1,n.brightness=1,n.red=1,n.green=1,n.blue=1,n.alpha=1,Object.assign(n,r),n}return function(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}(r,t),r.prototype.apply=function(t,r,n,e){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,r,n,e)},r}(r.Filter);return t.AdjustmentFilter=e,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI);Object.assign(PIXI.filters,__filters); | ||
*/Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/core"),a=`attribute vec2 aVertexPosition; | ||
attribute vec2 aTextureCoord; | ||
uniform mat3 projectionMatrix; | ||
varying vec2 vTextureCoord; | ||
void main(void) | ||
{ | ||
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); | ||
vTextureCoord = aTextureCoord; | ||
}`,o=`varying vec2 vTextureCoord; | ||
uniform sampler2D uSampler; | ||
uniform float gamma; | ||
uniform float contrast; | ||
uniform float saturation; | ||
uniform float brightness; | ||
uniform float red; | ||
uniform float green; | ||
uniform float blue; | ||
uniform float alpha; | ||
void main(void) | ||
{ | ||
vec4 c = texture2D(uSampler, vTextureCoord); | ||
if (c.a > 0.0) { | ||
c.rgb /= c.a; | ||
vec3 rgb = pow(c.rgb, vec3(1. / gamma)); | ||
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast); | ||
rgb.r *= red; | ||
rgb.g *= green; | ||
rgb.b *= blue; | ||
c.rgb = rgb * brightness; | ||
c.rgb *= c.a; | ||
} | ||
gl_FragColor = c * alpha; | ||
} | ||
`;class s extends e.Filter{constructor(r){super(a,o),this.gamma=1,this.saturation=1,this.contrast=1,this.brightness=1,this.red=1,this.green=1,this.blue=1,this.alpha=1,Object.assign(this,r)}apply(r,t,n,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,r.applyFilter(this,t,n,i)}}exports.AdjustmentFilter=s; | ||
//# sourceMappingURL=filter-adjustment.js.map |
@@ -1,2 +0,2 @@ | ||
import type { CLEAR_MODES } from '@pixi/constants'; | ||
import type { CLEAR_MODES } from '@pixi/core'; | ||
import { Filter } from '@pixi/core'; | ||
@@ -9,3 +9,3 @@ import type { FilterSystem } from '@pixi/core'; | ||
* This is a faster and much simpler to use than | ||
* {@link http://pixijs.download/release/docs/PIXI.filters.ColorMatrixFilter.html ColorMatrixFilter} | ||
* {@link http://pixijs.download/release/docs/ColorMatrixFilter.html ColorMatrixFilter} | ||
* because it does not use a matrix.<br> | ||
@@ -16,3 +16,2 @@ * ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/adjustment.png) | ||
* @extends PIXI.Filter | ||
* @memberof PIXI.filters | ||
* @see {@link https://www.npmjs.com/package/@pixi/filter-adjustment|@pixi/filter-adjustment} | ||
@@ -19,0 +18,0 @@ * @see {@link https://www.npmjs.com/package/pixi-filters|pixi-filters} |
{ | ||
"name": "@pixi/filter-adjustment", | ||
"version": "4.2.0", | ||
"main": "dist/filter-adjustment.cjs.js", | ||
"bundle": "dist/filter-adjustment.js", | ||
"version": "5.0.0", | ||
"main": "./dist/filter-adjustment.js", | ||
"description": "PixiJS filter to adjust gamma, contrast, saturation, brightness or color channels", | ||
"author": "finscn <finscn@gmail.com>", | ||
"module": "dist/filter-adjustment.esm.mjs", | ||
"module": "./dist/filter-adjustment.mjs", | ||
"exports": { | ||
".": { | ||
"import": "./dist/filter-adjustment.esm.mjs", | ||
"require": "./dist/filter-adjustment.cjs.js", | ||
"import": "./dist/filter-adjustment.mjs", | ||
"require": "./dist/filter-adjustment.js", | ||
"types": "./index.d.ts" | ||
} | ||
}, | ||
"types": "index.d.ts", | ||
"types": "./index.d.ts", | ||
"homepage": "http://pixijs.com/", | ||
@@ -33,11 +32,9 @@ "bugs": "https://github.com/pixijs/filters/issues", | ||
"peerDependencies": { | ||
"@pixi/constants": "^6.0.0", | ||
"@pixi/core": "^6.0.0" | ||
"@pixi/core": "^7.0.0-X" | ||
}, | ||
"devDependencies": { | ||
"@pixi/constants": "^6.0.0", | ||
"@pixi/core": "^6.0.0", | ||
"@tools/fragments": "4.1.3" | ||
"@pixi/core": "^7.0.0-X", | ||
"@tools/fragments": "5.0.0" | ||
}, | ||
"gitHead": "dc16782d00fffb8c02d30cc32146d9c6a40599cb" | ||
"gitHead": "2bec8c5024e4086e5aada8e471820bddc8ede687" | ||
} |
@@ -23,2 +23,2 @@ # AdjustmentFilter | ||
See https://pixijs.github.io/pixi-filters/docs | ||
See https://filters.pixijs.download/main/docs/AdjustmentFilter.html |
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
2
16539
8
148
1
23
1