Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn authored Apr 26, 2017
1 parent 05937fb commit 9e918b1
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,36 @@ plus the ability to create own filters via shaders.

Right now, this module only supports applying built-in filters to a still image:
```js
var GPUImage = require('ti.gpuimage');
var image = GPUImage.filteredImage({
image: 'myImage.png',
filter: GPUImage.FILTER_SEPIA // or the filter class name, e.g. `GPUImageHueFilter`
var GPUImage = require('ti.imagefilters');
var imageName = 'test.jpg'

var win = Ti.UI.createWindow({
backgroundColor: 'white'
});

var btn = Ti.UI.createButton({
title: 'Apply Sepia Filter',
top: 50
});

var img = Ti.UI.createImageView({
image: imageName
});

btn.addEventListener('click', function() {
var image = GPUImage.filteredImage({
image: imageName,
filter: GPUImage.FILTER_SEPIA, // or the filter class name, e.g. `GPUImageHueFilter`
callback: function(e) {
img.setImage(e.image);
}
});
});

win.add(img);
win.add(btn);

win.open();
```
You cannot specify filter properies by now, so I am thinking about moving the filter to
an own class that does KVO to check and supply the used properties dynamically.
Expand Down

0 comments on commit 9e918b1

Please sign in to comment.