Comments (12)
Hey Ian, thanks for this. I will work on it soon.
from filtrr.
Hey @iandevlin, I just pushed 0.5 which contains a reset()
method. Does that work for you? I updated the readme documentation and created an example as well.
from filtrr.
Hi Alec, fast response! Many thanks for that! I won't be able to try it for a bit, but if you've tested it I suspect it works :-) I'll let you know of course. Thanks again.
from filtrr.
Hi Alec! Just had a chance to test it, works like a charm. Many thanks!
from filtrr.
Hmm, I spoke too soon. If I change the image in the canvas dynamically, the image in the filtrr2 still remains as the previous image.
from filtrr.
What do you mean dynamically? Can you give me some example code?
from filtrr.
Sorry, I should have been clear. I mean if I draw something to the canvas and apply a filter - all is well. If, while the same image is in the canvas and I apply a new filter (calling reset() beforehand) all works well.
But if I change the image in the canvas, call reset() and apply a filter, the filter is applied to the previous image that was in the canvas and not the new one.
from filtrr.
Hm, so this is happening because each Filtrr2 object is designed to work with the image that it is applied on. Internally it stores the canvas image data and writes it back on render()
. When you change the image, the image data do not change hence you get the old image. reset()
just sets the image data to a "clean" copy of the original image. The Filtrr2 constructor also caches instances and returns the same one for the same selector.
from filtrr.
Yeah, I understand why it's happening but it's not what I need I'm afraid. Any chance of adding a boolean to the reset() function, which when true, also clears the image cache? Default would of course be false.
from filtrr.
Yeah that's not a bad idea - either that or add a new method reinit()
or something so that it's more explicit. I will work on it as soon as I find some free time.
from filtrr.
Sounds like a plan, and thanks again for the speedy feedback.
from filtrr.
Hey @iandevlin,
Sorry for taking ages to fix this.
I've just pushed a fix that allows options to be passed in the constructor. The only option available for now is 'store'. Setting it to false will allow you to create new Filtrr2 instances on the same elements, hence once you change the canvas image you can actually create a new instance to override your previous one. Remember to use store=false for all your instances if this is a comming occurence, for example:
var f = Filtrr2("#id", function() {..}, {
store: false
});
from filtrr.
Related Issues (20)
- Implement fisheye.
- Investigate glfx.js
- Implement a bias effect. HOT 1
- Improve brightness and contrast algorithm HOT 1
- Improve "softLight" HOT 1
- Canvas id is filtrr-undefined if img has no id.
- Website filtrr.me not working HOT 3
- css width and height of image is overriden by actual image width and height
- Save image to server HOT 1
- Node.js HOT 1
- Use Filtrr on server-side
- Security issue when using dup() and images on external domain.
- Filtrr2 not executing on realtime
- Website is Down
- Filtrr.me is down.
- Implement pseudo-nonblocking rendering.
- Implement a vignette effect.
- Blending modes API HOT 1
- Exporting method.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filtrr.