Skip to content

Commit ee126c3

Browse files
author
Nikos M
committed
v. 0.7-alpha, readme/reference/config/examples updates
1 parent 4e39556 commit ee126c3

24 files changed

+119
-5176
lines changed

api-reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Change the dependencies file(s) to include your own selection of filters and plu
1414
###Image Class
1515

1616
````javascript
17-
new FILTER.Image(uRLOrImageOrCanvasOrVideo);
17+
new FILTER.Image([ImageOrCanvasOrVideoOrFilterImageInstance]);
1818
````
1919

2020
This is a placeholder for an image, along with basic methods to access the image data
2121
and alter them.
2222

2323
__Methods:__
2424

25-
* _setImage(ImageOrCanvasOrVideoorFilterImageInstance)_ Sets/Alters the underlying image
25+
* _setImage(ImageOrCanvasOrVideoOrFilterImageInstance)_ Sets/Alters the underlying image
2626
* _select(x1, y1, x2, y2)_ set a rectangle as selected part of image (any filters will be applied only to that part)
2727
* _deselect()_ remove previous selection (selected part becomes whole image)
2828
* _store()_ store the current filtered/processed image as the original image
@@ -49,7 +49,7 @@ __Methods:__
4949
###ScaledImage Class
5050

5151
````javascript
52-
new FILTER.ScaledImage(scaleX, scaleY, ImageOrCanvasOrVideoorFilterImageInstance);
52+
new FILTER.ScaledImage(scaleX, scaleY [, ImageOrCanvasOrVideoOrFilterImageInstance]);
5353
````
5454

5555
This is a placeholder for an image, which is automatically up/down scaled (for faster processing). It is a subclass of FILTER.Image and shares the same common methods.
@@ -63,7 +63,7 @@ __Methods:__
6363
###Loader / ImageLoader Classes
6464

6565
````javascript
66-
filterImageInstance = new FILTER.ImageLoader().load(imageUrl [, onLoad, onProgres, onError]);
66+
filterImageInstance = new FILTER.ImageLoader().load(imageUrl [, onLoad, onProgress, onError]);
6767
````
6868

6969
Loads an image url into a FILTER.Image instance.

build/filter.bundle.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/filter.js

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*

build/filter.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config.custom

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ tasks =[{}]
2222
./src/FILTER.js
2323
./src/core/Filter.js
2424
./src/core/Color.js
25-
./src/core/Loader.js
2625
./src/core/Image.js
26+
./src/core/Loader.js
2727

28-
# image Loaders
28+
# image loaders for various image formats
2929
./src/loaders/ImageLoader.js
3030

3131
# generic Filters
@@ -46,9 +46,9 @@ tasks =[{}]
4646
# webgl generic Filters (TODO)
4747
#./src/filters/WebGLFilter.js
4848
#./src/filters/webgl/ColorMatrixFilter.js
49+
#./src/filters/webgl/ConvolutionMatrixFilter.js
4950
#./src/filters/webgl/DisplacementMapFilter.js
5051
#./src/filters/webgl/GeometricMapFilter.js
51-
#./src/filters/webgl/ConvolutionMatrixFilter.js
5252

5353
!tpl:umd-footer.tpl.js # include a umd-footer template
5454

examples/common/assets/RedStar.jpg

-14.3 KB
Binary file not shown.

examples/common/assets/che.jpg

-23 KB
Binary file not shown.
-30.6 KB
Binary file not shown.
-13.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)