In my canvas I have an overlay image using setOverlayImage method from Fabric.js canvas library.
I have the need to place an IText object above my already set overlay image, but the IText object always appear behind my overlay image.
Is there some way to accomplish that using Fabric.js?
That's not possible. "OverlayImage" is an overlay over all other objects.
Why you need that?
Can you use "BackgroundImage" instead?
Related
I am stuck with a Flex 3 legacy application and I need to be able to dynamically apply generated Sprites containing different gradient fills as well as Embedded SVG images to the icon of a button. Can anybody help with how I cast the Sprite to the button icon? Do i have to copy the image data out of the DisplayObject and cast is as a Class somehow?
thanx,
is there a option to a animated resize with canvas in GWT? I use GWT 2.3. and plugins like GWTCanvas doesn't work with this version.
Btw.: I haven't found any tutorial or example on how to use canvas in GWT. Maybe someone has a good convas tutorial for gwt?
greetz, destiny
With GWT2.3 you don't need GWTCanvas, as the canvas support is present in GWT2.3.
Here are a few links
GWT's canvas Javadoc
http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/index.html?com/google/gwt/canvas/dom/client/package-summary.html
Sample application
http://code.google.com/p/gwtcanvasdemo/source/browse/#svn%2Ftrunk%2Fsrc%2Fcom%2Fgoogle%2Fgwt%2Fgwtcanvasdemo%253Fstate%253Dclosed
A tutorial
http://www.giantflyingsaucer.com/blog/?p=2338
There is no option to animate resize the image, you will have to implement your own function. To resize the image inside a canvas you need to use context.scale method, or context.drawImage(..) methods.
I am loading an image into an HTML 5 Canvas using drawImage method. How do I get a reference to that image later (maybe on some mouse-clicked event) so that I can do a transformation to the image (like rotation)?
Save a reference to the Image object you used to paint to the canvas.
Then,
Delete the canvas (clearRect)
Make the transformations using the canvas context
Draw the Image again
Go to 1 when you need to refresh the canvas
You can't. Once it's drawn on the canvas it's just pixels. No reference to the original source is retained by the canvas. If you want to maintain state information you have to do that yourself. Alternatively use SVG, that retains an internal DOM.
I want to add text on an image using HTML5. How can this be done?
You can load the image into a canvas (using drawImage()), then draw text on the canvas (using fillText()).
If you want to you can then take the image data from the canvas using toDataUrl() and post that data to the server for image persistence.
If you only need it for client side visibility you have a much simpler solution that doesn't use html5. just overlay a text over the image using absolute positioning.
I tried to draw on the image using canvas. Yes, of-course i did. But i need to merge the canvas drawing with the image instantly.
i.e My concept is, i have one image (#a) and i like to mark some places on the image (circle, rectangle, etc...), so i have just pick the canvas technique. (if any other technique is available please suggest me.)
So, after the canvas drawing, i want to merge the canvas image with my actual image (#a). Then, i'll get the marked image.
What i did before?.
I was set the background as my actual image(#a) to the canvas tag. (i.e canvas tag with some background image). I have done the drawing. Then, i have convert the canvas image as dataURI, then i will merge the actual image (#a) with canvas drawing using Linux command (imageMagic).
Can you tell me any other way, to draw directly on the image and save the drawing with image instantly.?
Thanks in advance.
Don't set the background of the canvas.
Instead, you want to use the drawImage() function of the canvas context to literally paint the image onto the canvas. Then do all your drawing operations.
Then you can save the image correctly. I'd also suggest looking in to Canvas2Image for that.
http://www.nihilogic.dk/labs/canvas2image/