Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/filter-adjustment

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/filter-adjustment - npm Package Compare versions

Comparing version 2.7.0 to 3.0.0

dist/filter-adjustment.js

127

lib/filter-adjustment.esm.js
/*!
* @pixi/filter-adjustment - v2.7.0
* Compiled Sun, 13 Jan 2019 22:51:52 UTC
* Compiled Fri, 10 May 2019 22:56:42 UTC
*

@@ -8,3 +8,126 @@ * @pixi/filter-adjustment is licensed under the MIT License.

*/
import{Filter as r}from"pixi.js";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}",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",o=function(r){function o(o){r.call(this,t,n),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},o)}return r&&(o.__proto__=r),o.prototype=Object.create(r&&r.prototype),o.prototype.constructor=o,o.prototype.apply=function(r,t,n,o){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,o)},o}(r);export{o as AdjustmentFilter};
import { Filter } from '@pixi/core';
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 = "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";
/**
* The ability to adjust gamma, contrast, saturation, brightness, alpha or color-channel shift. This is a faster
* and much simpler to use than {@link http://pixijs.download/release/docs/PIXI.filters.ColorMatrixFilter.html ColorMatrixFilter}
* because it does not use a matrix.<br>
* ![original](../tools/screenshots/dist/original.png)![filter](../tools/screenshots/dist/adjustment.png)
*
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
* @see {@link https://www.npmjs.com/package/@pixi/filter-adjustment|@pixi/filter-adjustment}
* @see {@link https://www.npmjs.com/package/pixi-filters|pixi-filters}
*
* @param {object|number} [options] - The optional parameters of the filter.
* @param {number} [options.gamma=1] - The amount of luminance
* @param {number} [options.saturation=1] - The amount of color saturation
* @param {number} [options.contrast=1] - The amount of contrast
* @param {number} [options.brightness=1] - The overall brightness
* @param {number} [options.red=1] - The multipled red channel
* @param {number} [options.green=1] - The multipled green channel
* @param {number} [options.blue=1] - The multipled blue channel
* @param {number} [options.alpha=1] - The overall alpha amount
*/
var AdjustmentFilter = /*@__PURE__*/(function (Filter) {
function AdjustmentFilter(options) {
Filter.call(this, vertex, fragment);
Object.assign(this, {
/**
* The amount of luminance
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
gamma: 1,
/**
* The amount of saturation
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
saturation: 1,
/**
* The amount of contrast
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
contrast: 1,
/**
* The amount of brightness
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
brightness: 1,
/**
* The amount of red channel
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
red: 1,
/**
* The amount of green channel
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
green: 1,
/**
* The amount of blue channel
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
blue: 1,
/**
* The amount of alpha channel
* @member {number}
* @memberof PIXI.filters.AdjustmentFilter#
* @default 1
*/
alpha: 1,
}, options);
}
if ( Filter ) AdjustmentFilter.__proto__ = Filter;
AdjustmentFilter.prototype = Object.create( Filter && Filter.prototype );
AdjustmentFilter.prototype.constructor = AdjustmentFilter;
/**
* Override existing apply method in PIXI.Filter
* @private
*/
AdjustmentFilter.prototype.apply = function apply (filterManager, input, output, clear) {
this.uniforms.gamma = Math.max(this.gamma, 0.0001);
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;
filterManager.applyFilter(this, input, output, clear);
};
return AdjustmentFilter;
}(Filter));
export { AdjustmentFilter };
//# sourceMappingURL=filter-adjustment.esm.js.map

16

package.json
{
"name": "@pixi/filter-adjustment",
"version": "2.7.0",
"main": "lib/filter-adjustment.js",
"description": "PixiJS v4 filter to adjust gamma, contrast, saturation, brightness or color channels",
"version": "3.0.0",
"main": "lib/filter-adjustment.cjs.js",
"bundle": "dist/filter-adjustment.js",
"description": "PixiJS filter to adjust gamma, contrast, saturation, brightness or color channels",
"author": "finscn <finscn@gmail.com>",

@@ -21,11 +22,12 @@ "module": "lib/filter-adjustment.esm.js",

"lib",
"dist",
"types.d.ts"
],
"peerDependencies": {
"pixi.js": ">=4.5.0"
"dependencies": {
"@pixi/core": "^5.0.0-X"
},
"devDependencies": {
"@tools/fragments": "^2.0.0"
"@tools/fragments": "^3.0.0"
},
"gitHead": "a1329fadd2910c48842c92f254be77d971a823ca"
"gitHead": "0902eca3fe476dd7dacc9330f504d8e2ade6c9bd"
}
# AdjustmentFilter
PixiJS v4 filter to adjust gamma, contrast, saturation, brightness or color channels.
PixiJS filter to adjust gamma, contrast, saturation, brightness or color channels.

@@ -5,0 +5,0 @@ ## Installation

/// <reference types="pixi.js" />
declare namespace PIXI.filters {
class AdjustmentFilter extends PIXI.Filter<{}> {
declare module "@pixi/filter-adjustment" {
export class AdjustmentFilter extends PIXI.Filter {
constructor(options?: AdjustmentOptions);

@@ -14,3 +14,3 @@ gamma: number;

}
interface AdjustmentOptions {
export interface AdjustmentOptions {
gamma?: number;

@@ -26,5 +26,1 @@ contrast?: number;

}
declare module "@pixi/filter-adjustment" {
export = PIXI.filters;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc