Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
updated filters
Browse files Browse the repository at this point in the history
  • Loading branch information
adireddy committed Feb 22, 2018
1 parent 25f3fc3 commit 4cb670a
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pixi/core/renderers/SystemRenderer.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package pixi.core.renderers;

import pixi.core.math.shapes.Rectangle;
import haxe.extern.EitherType;
import js.html.CanvasElement;
import pixi.core.Pixi.RendererType;
Expand Down Expand Up @@ -138,9 +139,10 @@ extern class SystemRenderer extends EventEmitter {
* @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from
* @param {ScaleModes} scaleMode - Should be one of the scaleMode consts
* @param {Float} resolution - The resolution / device pixel ratio of the texture being generated
* @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered, if no region is specified, defaults to the local bounds of the displayObject.
* @return {PIXI.Texture} a texture of the graphics object
*/
function generateTexture(displayObject:DisplayObject, scaleMode:ScaleModes, resolution:Float):Texture;
function generateTexture(displayObject:DisplayObject, scaleMode:ScaleModes, resolution:Float, ?region:Rectangle):Texture;


/**
Expand Down
38 changes: 38 additions & 0 deletions src/pixi/filters/alpha/AlphaFilter.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package pixi.filters.alpha;

import pixi.core.renderers.webgl.filters.Filter;

@:native("PIXI.filters.AlphaFilter")
extern class AlphaFilter extends Filter {

/**
* Simplest filter - applies alpha
*
* Use this instead of Container's alpha property to avoid visual layering of individual elements.
* AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.
* If elements are not opaque, they will blend with each other anyway.
*
* Very handy if you want to use common features of all filters:
*
* 1. Assign a blendMode to this filter, blend all elements inside display object with background.
*
* 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.
*
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
*/

/**
* @param {Float} [alpha=1] Amount of alpha from 0 to 1, where 0 is transparent
*/
function new(?alpha:Float);

/**
* Coefficient for alpha multiplication
*
* @member {Float}
* @default 1
*/
var alpha:Float;
}
42 changes: 42 additions & 0 deletions src/pixi/filters/noise/NoiseFilter.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package pixi.filters.noise;

import pixi.core.renderers.webgl.filters.Filter;

@:native("PIXI.filters.NoiseFilter")
extern class NoiseFilter extends Filter {


/**
* @author Vico @vicocotea
* original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js
*/

/**
* A Noise effect filter.
*
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
*/

/**
* @param {Float} noise - The noise intensity, should be a normalized value in the range [0, 1].
* @param {Float} seed - A random seed for the noise generation. Default is `Math.random()`.
*/
function new(?noise:Float, ?seed:Float);

/**
* The amount of noise to apply, this value should be in the range (0, 1].
*
* @member {Float}
* @default 0.5
*/
var noise:Float;

/**
* A seed value to apply to the random noise generation. `Math.random()` is a good value to use.
*
* @member {Float}
*/
var seed:Float;
}

0 comments on commit 4cb670a

Please sign in to comment.