1 /** 2 * The MIT License (MIT) 3 * 4 * Copyright (c) 2016 DeNA Co., Ltd. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 25 /// <reference path="base.js"/> 26 /// <reference path="object.js"/> 27 /// <reference path="rectangle.js"/> 28 29 /** 30 * A base class for all filters. (This library uses a shader program to apply 31 * filters and this class is just for emulating CreateJS.) 32 * @param {number} type 33 * @extends {createjs.Object} 34 * @constructor 35 */ 36 createjs.Filter = function(type) { 37 /// <param type="number" name="type"/> 38 createjs.Object.call(this); 39 40 /** 41 * The type of this filter. 42 * @const {number} 43 * @private 44 */ 45 this.type_ = type; 46 }; 47 createjs.inherits('Filter', createjs.Filter, createjs.Object); 48 49 /** 50 * Known filters. 51 * @enum {number} 52 */ 53 createjs.Filter.Type = { 54 ALPHA_MAP: 0, 55 ALPHA_MASK: 1, 56 BLUR: 2, 57 COLOR: 3, 58 COLOR_MATRIX: 4 59 }; 60 61 /** 62 * Returns the type of this filter. 63 * @return {number} 64 */ 65 createjs.Filter.prototype.getType = function() { 66 /// <returns type="number"/> 67 return this.type_; 68 }; 69 70 /** 71 * Returns a rectangle required to draw this filter or null. (This library does 72 * not use this method.) 73 * @return {createjs.Rectangle} 74 */ 75 createjs.Filter.prototype.getBounds = function() { 76 /// <returns type="createjs.Rectangle"/> 77 createjs.notReached(); 78 return null; 79 }; 80 81 /** 82 * Applies this filter to the specified context. (This library does not use this 83 * method.) 84 * @param {CanvasRenderingContext2D} context 85 * @param {number} x 86 * @param {number} y 87 * @param {number} width 88 * @return {boolean} 89 */ 90 createjs.Filter.prototype.applyFilter = function(context, x, y, width, height) { 91 /// <param type="CanvasRenderingContext2D" name="context"/> 92 /// <param type="number" name="x"/> 93 /// <param type="number" name="y"/> 94 /// <param type="number" name="width"/> 95 /// <returns type="boolean"/> 96 createjs.notReached(); 97 return false; 98 }; 99 100 // Export the createjs.Filter class to the global namespace. 101 createjs.exportObject('createjs.Filter', createjs.Filter, { 102 // createjs.Filter methods 103 'getBounds': createjs.Filter.prototype.getBounds, 104 'applyFilter': createjs.Filter.prototype.applyFilter 105 106 // createjs.Object methods 107 }); 108