@@ -1637,106 +1637,6 @@ var FILTER = exports['FILTER'] = {
16371637
16381638} ( FILTER ) ; /**
16391639*
1640- * Filter Loader Class(es)
1641- * @package FILTER.js
1642- *
1643- **/
1644- ! function ( FILTER , undef ) {
1645- "use strict" ;
1646-
1647- var FilterImage = FILTER . Image , Class = FILTER . Class , ON = 'addEventListener' ;
1648-
1649- var Loader = FILTER . Loader = Class ( {
1650- name : "Loader" ,
1651-
1652- constructor : function Loader ( ) {
1653- if ( ! ( this instanceof Loader ) )
1654- return new Loader ( ) ;
1655- } ,
1656-
1657- // override in sub-classes
1658- load : function ( url , onLoad , onProgress , onError ) {
1659- return null ;
1660- } ,
1661-
1662- _crossOrigin : null ,
1663- _responseType : null ,
1664-
1665- responseType : function ( value ) {
1666- if ( arguments . length )
1667- {
1668- this . _responseType = value ;
1669- return this ;
1670- }
1671- return this . _responseType ;
1672- } ,
1673-
1674- crossOrigin : function ( value ) {
1675- if ( arguments . length )
1676- {
1677- this . _crossOrigin = value ;
1678- return this ;
1679- }
1680- return this . _crossOrigin ;
1681- }
1682- } ) ;
1683-
1684- var XHRLoader = FILTER . XHRLoader = Class ( Loader , {
1685- name : "XHRLoader" ,
1686-
1687- constructor : function XHRLoader ( ) {
1688- if ( ! ( this instanceof XHRLoader ) )
1689- return new XHRLoader ( ) ;
1690- } ,
1691-
1692- load : function ( url , onLoad , onProgress , onError ) {
1693- var scope = this , request = new XMLHttpRequest ( ) ;
1694- request . open ( 'GET' , url , true ) ;
1695- request [ ON ] ( 'load' , function ( event ) {
1696- if ( onLoad ) onLoad ( this . response ) ;
1697- } , false ) ;
1698- if ( 'function' === typeof onProgress ) request [ ON ] ( 'progress' , onProgress , false ) ;
1699- if ( 'function' === typeof onError ) request [ ON ] ( 'error' , onError , false ) ;
1700- if ( scope . _crossOrigin ) request . crossOrigin = scope . _crossOrigin ;
1701- if ( scope . _responseType ) request . responseType = scope . _responseType ;
1702- request . send ( null ) ;
1703- return scope ;
1704- }
1705- } ) ;
1706-
1707- FILTER . BinaryLoader = Class ( Loader , {
1708- name : "BinaryLoader" ,
1709-
1710- constructor : function BinaryLoader ( ) {
1711- if ( ! ( this instanceof BinaryLoader ) )
1712- return new BinaryLoader ( ) ;
1713- } ,
1714-
1715- _parser : null ,
1716-
1717- load : function ( url , onLoad , onProgress , onError ) {
1718- var scope = this , loader ,
1719- image = new FilterImage ( )
1720- ;
1721-
1722- if ( 'function' === typeof scope . _parser )
1723- {
1724- loader = new XHRLoader ( )
1725- . responseType ( scope . _responseType || 'arraybuffer' )
1726- . load ( url , function ( buffer ) {
1727- var imData = scope . _parser ( buffer ) ;
1728- if ( ! imData ) return ;
1729- image . setImage ( imData ) ;
1730- if ( 'function' === typeof onLoad ) onLoad ( image , imData ) ;
1731- } , onProgress , onError )
1732- ;
1733- }
1734- return image ;
1735- }
1736-
1737- } ) ;
1738- } ( FILTER ) ; /**
1739- *
17401640* Image Canvas Class
17411641* @package FILTER.js
17421642*
@@ -2579,6 +2479,106 @@ var FILTER = exports['FILTER'] = {
25792479
25802480} ( FILTER ) ; /**
25812481*
2482+ * Filter Loader Class(es)
2483+ * @package FILTER.js
2484+ *
2485+ **/
2486+ ! function ( FILTER , undef ) {
2487+ "use strict" ;
2488+
2489+ var FilterImage = FILTER . Image , Class = FILTER . Class , ON = 'addEventListener' ;
2490+
2491+ var Loader = FILTER . Loader = Class ( {
2492+ name : "Loader" ,
2493+
2494+ constructor : function Loader ( ) {
2495+ if ( ! ( this instanceof Loader ) )
2496+ return new Loader ( ) ;
2497+ } ,
2498+
2499+ // override in sub-classes
2500+ load : function ( url , onLoad , onProgress , onError ) {
2501+ return null ;
2502+ } ,
2503+
2504+ _crossOrigin : null ,
2505+ _responseType : null ,
2506+
2507+ responseType : function ( value ) {
2508+ if ( arguments . length )
2509+ {
2510+ this . _responseType = value ;
2511+ return this ;
2512+ }
2513+ return this . _responseType ;
2514+ } ,
2515+
2516+ crossOrigin : function ( value ) {
2517+ if ( arguments . length )
2518+ {
2519+ this . _crossOrigin = value ;
2520+ return this ;
2521+ }
2522+ return this . _crossOrigin ;
2523+ }
2524+ } ) ;
2525+
2526+ var XHRLoader = FILTER . XHRLoader = Class ( Loader , {
2527+ name : "XHRLoader" ,
2528+
2529+ constructor : function XHRLoader ( ) {
2530+ if ( ! ( this instanceof XHRLoader ) )
2531+ return new XHRLoader ( ) ;
2532+ } ,
2533+
2534+ load : function ( url , onLoad , onProgress , onError ) {
2535+ var scope = this , request = new XMLHttpRequest ( ) ;
2536+ request . open ( 'GET' , url , true ) ;
2537+ request [ ON ] ( 'load' , function ( event ) {
2538+ if ( onLoad ) onLoad ( this . response ) ;
2539+ } , false ) ;
2540+ if ( 'function' === typeof onProgress ) request [ ON ] ( 'progress' , onProgress , false ) ;
2541+ if ( 'function' === typeof onError ) request [ ON ] ( 'error' , onError , false ) ;
2542+ if ( scope . _crossOrigin ) request . crossOrigin = scope . _crossOrigin ;
2543+ if ( scope . _responseType ) request . responseType = scope . _responseType ;
2544+ request . send ( null ) ;
2545+ return scope ;
2546+ }
2547+ } ) ;
2548+
2549+ FILTER . BinaryLoader = Class ( Loader , {
2550+ name : "BinaryLoader" ,
2551+
2552+ constructor : function BinaryLoader ( ) {
2553+ if ( ! ( this instanceof BinaryLoader ) )
2554+ return new BinaryLoader ( ) ;
2555+ } ,
2556+
2557+ _parser : null ,
2558+
2559+ load : function ( url , onLoad , onProgress , onError ) {
2560+ var scope = this , loader ,
2561+ image = new FilterImage ( )
2562+ ;
2563+
2564+ if ( 'function' === typeof scope . _parser )
2565+ {
2566+ loader = new XHRLoader ( )
2567+ . responseType ( scope . _responseType || 'arraybuffer' )
2568+ . load ( url , function ( buffer ) {
2569+ var imData = scope . _parser ( buffer ) ;
2570+ if ( ! imData ) return ;
2571+ image . setImage ( imData ) ;
2572+ if ( 'function' === typeof onLoad ) onLoad ( image , imData ) ;
2573+ } , onProgress , onError )
2574+ ;
2575+ }
2576+ return image ;
2577+ }
2578+
2579+ } ) ;
2580+ } ( FILTER ) ; /**
2581+ *
25822582* Filter (HTML)ImageLoader Class
25832583* @package FILTER.js
25842584*
0 commit comments