meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

Add Text in canvas #74

Closed alezala closed 11 years ago

alezala commented 11 years ago

I'm using caman to insert filters to my images, is that when I try to insert language in the canvas the same does not appear, how I can fix this?, Thanks!

meltingice commented 11 years ago

Because Caman works directly with the pixels in the image, this currently isn't officially supported. I haven't tested this, but in the meantime, try doing this after you've added the text to the canvas:

// Say you already have a reference to the initialized Caman object
caman = Caman("#my-image");

// You add your text to the canvas now
context.fillText(/* ... */);

// Now call this
caman.finishInit();

I'm not 100% sure if that will work, but give it a shot. This is something that should be officially supported soon.

meltingice commented 11 years ago

There is a cleaner and more formal way to do this now using the reloadCanvasData() function. Check out this test for an example on how it's used.