Skip to content

Commit e314a63

Browse files
author
David Gillen
committed
documentation accuracy update
1 parent 43420c1 commit e314a63

File tree

4 files changed

+36
-23
lines changed

4 files changed

+36
-23
lines changed

src/easeljs/display/StageGL.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ this.createjs = this.createjs||{};
152152
this.vocalDebug = false;
153153

154154
/**
155-
* Specifies whether this instance is slaved to a {{#crossLink "BitmapCache"}}{{/crossLink}} or is its own master.
156-
* Controls whether final rendering output of a {{#crossLink "cacheDraw"}}{{/crossLink}} command is to the canvas
157-
* or a render texture. See the {{#crossLink "cache"}}{{/crossLink}} function documentation and read the code for
158-
* full implications and details of necessity. Enabled by default when BitmapCache's `useGL` is true.
159-
* NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
155+
* Specifies whether this instance is slaved to a {{#crossLink "BitmapCache"}}{{/crossLink}} or draws independantly.
156+
* Necessary to control texture outputs and behaviours when caching. StageGL cache outputs will only render
157+
* properly for the StageGL that made them. See the {{#crossLink "cache"}}{{/crossLink}} function documentation
158+
* for more information. Enabled by default when BitmapCache's `useGL` is true.
159+
* NOTE: This property is mainly for internal use, though it may be useful for advanced uses.
160160
* @property isCacheControlled
161161
* @type {Boolean}
162162
* @default false

src/easeljs/filters/AberrationFilter.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,21 @@
3636

3737
// constructor:
3838
/**
39-
* Seperates and pushes the different colour channels apart.
39+
* Separates and pushes each of the colour channels apart. I.E. shift the red channel slightly left.
40+
* Allows specifying the direction and the ammount it affects each channel. Great for computer glitches and VCR like
41+
* effects.
4042
*
4143
* See {{#crossLink "Filter"}}{{/crossLink}} for an more information on applying filters.
4244
* @class AberrationFilter
4345
* @extends Filter
4446
* @constructor
45-
* @param {Number} [xDir=0] Movement in x, specified in pixels.
46-
* @param {Number} [yDir=0] Movement in y, specified in pixels.
47-
* @param {Number} [redMultiplier=0] Multiplier for movement of the Red channel. Negative values allowed.
48-
* @param {Number} [greenMultiplier=0] Multiplier for movement of the Green channel. Negative values allowed.
49-
* @param {Number} [blueMultiplier=0] Multiplier for movement of the Blue channel. Negative values allowed.
47+
* @param {Number} [xDir=0] Movement in x at a multiplier of 1, specified in pixels.
48+
* @param {Number} [yDir=0] Movement in y at a multiplier of 1, specified in pixels.
49+
* @param {Number} [redMultiplier=0] Multiplier for the movement of the Red channel. Negative values allowed.
50+
* @param {Number} [greenMultiplier=0] Multiplier for the movement of the Green channel. Negative values allowed.
51+
* @param {Number} [blueMultiplier=0] Multiplier for the movement of the Blue channel. Negative values allowed.
5052
* @param {Number} [originalMix=0] Amount of original image to keep, 0-1.
51-
* @param {Boolean} [alphaMax=false] Calculate combined alpha using maximum value available.
53+
* @param {Boolean} [alphaMax=false] Calculate combined alpha using maximum alpha available. Creates a stronger image.
5254
**/
5355
function AberrationFilter(xDir, yDir, redMultiplier, greenMultiplier, blueMultiplier, originalMix, alphaMax) {
5456
this.Filter_constructor();

src/easeljs/filters/BitmapCache.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ this.createjs = this.createjs||{};
5353
* Caching is also a co-requisite for applying filters to prevent expensive filters running constantly without need,
5454
* and to physically enable some effects. The BitmapCache is also responsible for applying filters to objects and
5555
* reads each {{#crossLink "Filter"}}{{/crossLink}} due to this relationship. Real-time Filters are not recommended
56-
* performance wise when dealing with a Context2D canvas. For best performance and to still allow for some visual
57-
* effects use a compositeOperation when possible.
56+
* performance wise when dealing with a Context2D canvas. On a StageGL performance is better so the presence of a
57+
* filter will automatically create a cache if one is not made manually.
58+
*
59+
* Some visual effects can be achieved with a {{#crossLink "DisplayObject/compositeOperation:property"}}{{/crossLink}}
60+
* so check out that setting before settling on a filter.
5861
* @class BitmapCache
5962
* @constructor
6063
**/
@@ -352,8 +355,8 @@ this.createjs = this.createjs||{};
352355
* specifics of how to use the options object.
353356
*
354357
* - If options.useGL is set to "new" a StageGL is created and contained on this for use when rendering the cache.
355-
* - If options.useGL is set to "stage" if the current stage is a StageGL it will be used. If not then it will default to "new".
356-
* - If options.useGL is a StageGL instance it will not create one but use the one provided.
358+
* - If options.useGL is set to "stage" if the current stage is a StageGL it will be used. Must be added to a stage first to work.
359+
* - If options.useGL is a StageGL instance then it will use it to cache. Warning, caches made on one StageGL will not render on any other StageGL.
357360
* - If options.useGL is undefined a Context 2D cache will be performed.
358361
*
359362
* This means you can use any combination of StageGL and 2D with either, neither, or both the stage and cache being
@@ -382,16 +385,21 @@ this.createjs = this.createjs||{};
382385
*
383386
* var stageGL = new createjs.StageGL();
384387
* var bmp = new createjs.Bitmap(src);
385-
* bmp.cache(0, 0, bmp.width, bmp.height, 1, {gl: "stage"}); // use our StageGL to cache
388+
*
389+
* // option 1
390+
* stageGL.addChild(bmp);
391+
* bmp.cache(0, 0, bmp.width, bmp.height, 1, {gl: "stage"}); // when added to the display list we can look it up
392+
* // option 2
393+
* bmp.cache(0, 0, bmp.width, bmp.height, 1, {gl: stageGL}); // we can specify it explicitly if we add it later
394+
* stageGL.addChild(bmp);
386395
*
387396
* var shape = new createjs.Shape();
388397
* shape.graphics.clear().fill("red").drawRect(0,0,20,20);
389398
* shape.cache(0, 0, 20, 20, 1); // cannot use WebGL cache
390399
*
391400
* You may wish to create your own StageGL instance to control factors like clear color, transparency, AA, and
392-
* others. If you do, pass a new instance in instead of "true", the library will automatically set the
393-
* {{#crossLink "StageGL/isCacheControlled"}}{{/crossLink}} to true on your instance. This will trigger it to behave
394-
* correctly, and not assume your main context is WebGL.
401+
* others. If the specified stage is not rendering content and just the cache set{{#crossLink "StageGL/isCacheControlled"}}{{/crossLink}}
402+
* to true on your instance. This will trigger it to behave correctly for rendering your output.
395403
*
396404
* @public
397405
* @method BitmapCache.cache

src/easeljs/filters/Filter.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ this.createjs = this.createjs||{};
3939

4040
// constructor:
4141
/**
42-
* Base class that all filters should inherit from. Filters need to be applied to objects that have been cached using
43-
* the {{#crossLink "DisplayObject/cache"}}{{/crossLink}} method. If an object changes, please cache it again, or use
44-
* {{#crossLink "DisplayObject/updateCache"}}{{/crossLink}}. Note that the filters must be applied before caching.
42+
* Base class that all filters should inherit from. Appli
43+
*
44+
* When on a regular Stage apply the Filters and then cache the object using the {{#crossLink "DisplayObject/cache"}}{{/crossLink}} method.
45+
* When a cached object changes, please use {{#crossLink "DisplayObject/updateCache"}}{{/crossLink}}.
46+
* When on a StageGL simply setting content in the `.filters` array will trigger an automatic and constantly updated cache.
4547
*
4648
* <h4>Example</h4>
4749
*
@@ -58,6 +60,7 @@ this.createjs = this.createjs||{};
5860
* Any filter that consumes an external image stretches the image to cover the cached bounds. If this is an undesired
5961
* visual result, then use an intermediary cache to properly size and layout your data before passing it to a filter.
6062
*
63+
*
6164
* <h4>EaselJS Filters</h4>
6265
* EaselJS comes with a number of pre-built filters:
6366
* <ul>

0 commit comments

Comments
 (0)