canvas

Why is putImageData so slow?

I am working with a relatively large Canvas where various (complex) stuff is drawn to. I then want to save the Canvas' state, so I can quickly reset it to the state it now is at a later point. I use getImageData for this and store the data in a variable. I then draw some more stuff to the canvas and will later reset the Canvas to where i...

Rotation of div containing html5 elemets (e.g. SVG, canvas) in ie9 doesn't show div properly

I've tried using the filter attribute to rotate a div, this works well until the div is comprised of an SVG element, which results in a rotated div with the SVG not being shown (with the exception of images). e.g. style="filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.86602540, M12=0.50000000, M21=-0.50000000,M22=0.86602540,sizin...

Detecting shape coordinates in Canvas

I'm writing drag & drop functionality in my HTML5 Canvas application and am wondering how to detect if I'm clicking on a shape other than a rectangle or square, in which case I would do something like this inside of my 'mousedown' event handler: if (evt._x > 13 && evt._x < 202 .... ) {} I don't see how to easily do something like that...

Calculate the visible area of the image in WPF

Hi, I have implemented a custom canvas in WPF with c#. The canvas will be keeping custom drawing shapes. I have also added a zooming functionality to it. When the canvas is zoomed at very high level, I want to calculate the visible part of the canvas so that I can perform operation on that much portion of the canvas keeping the best per...

HTML5 Tile Engine

What is some good tile engine for the HTML5 <canvas> (for writing 2D games)? ...

Mouse event not reaching UIElement.

Hello smart people. I'm just getting into C# and some unfamiliar piece of code so apologies if my question is not well asked. The problem in short - I have a six by eight grid of System.Windows.Controls.Canvas objects. The top left canvas does not receive mouse events while all the others do (I tried OnMouseMove and OnMouseClick events...

Has anyone got a basic example of HTML5 <canvas> animation?

I am looking for a basic example of HTML5 <canvas> animation. For example, making a ball bounce, etc. If someone has one I would be very grateful. ...

Canvas scroll in wpf when scaled transformed

Hi, I have customized a canvas to support the zooming. I am doing this by scale transformation. I have scroll viewer wrapped around canvas but scroll bars are not visible when canvas is zoomed. I came to know that scale transformation does not changes the actual size of the UIElement that is why scroll bars are not visible when canvas ...

TextView on Canvas

Is it possible to add TextView and ImageView on canvas? ...

How can I retrieve the current transformation in an HTML5 Canvas?

I've got a long sequence of canvas .scale(), .translate(), .save(), and .restore() commands in my code. Is there any way to retrieve some representation of the current transformation, short of logging everything myself, such that I can find out where a screen coordinate maps to a transformed coordinate. Is this possible? ...

HTML/Canvas - drawImage performance with another canvas

I'm working on a game and having some performance problems drawing one canvas onto another with drawImage. According to Chrome's Profiler, I'm spending 60% of my time in just this one drawImage call and 10% in the clearRect above it... The source canvas is about 3000x3000 for now (which is pretty small, I'd say) and the destination canv...

Visual drawing to canvas javascript code

Hi, Is there any solution to generate code for the canvas element by visually drawing, as many svg application can? ...

text based countdown on canvas.

Hi, I would like to run a text countdown on canvas but last I checked there was no way to write text to a canvas. I would like to know if anyone else has come-across an implementation where I could do a numerical countdown from 60 to 0 on the canvas. ...

Problem in Javascript colors and canvas.

I have used this code to exactly try to have the RGB code of color: var huePixel = HueCanvas.css('background-color').match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);//["rgb(0, 70, 255", "0", "70", "255"] var svPixel = SVCanvas.get(0).getContext("2d").getImageData(satPos,valPos,1,1).data; //opacity*original + (1-opacity)*background = resulting...

show bitmap on a regular interval on canvas

I am using android and i have an array of bitmap and i want to show these bitmaps on a regular interval on canvas one after another at the same place/position. can anyone suggesting me the road map to do this ? Note: My canvas has multiple bitmaps & later on i will set this canvas a wallpaper. i am free to use animation to change bitm...

Displaying a <div> over a <canvas>

The problem, which exists in both Firefox and Chrome, is that I have a canvas with a solid background, and a div with a solid background color/image. The div is margined up over top of the canvas. The div does not display over the canvas. An interesting note is that if there is text inside the div it will properly get displayed. This wou...

Find out which object was clicked on a html5 Canvas

Suppose i have a html5/canvas application in which i can place objects on a drawing-canvas. Some kind of diagram editor, something like Visio (but much simpler) Is there a framework which helps me find which object is clicked/draged? An option is to capture the click-event and iterate over all my objects (in a semi-smart way) and che...

Canvas too small to display Image in SWT

I'm trying to use a Canvas to display an animated gif. I have the animation working, but the canvas is too small to see the entire image, and I cannot get it to resize. I can't even get it to be the right size for the first frame, so the animation/threading code is being omitted. My code looks like: Composite comp = new Composite(paren...

How do I use one canvas element as the backdrop for another canvas element?

I am working through the HTML5 canvas tutorial on the following website: Mozilla Developers. In this tutorial, they say that you can use a canvas element as the backdrop of another canvas element. I have tried to do exactly that with the following html page. Unfortunately, the debugger in chrome says failed to load resource. Am I referen...

javascript + asp.net - Calling javascript functions from c# and passing an object

I'm fairly new to web development. Basically I'm using a HTML5 canvas to render content, and javascript functions which clear and render to the canvas. I'm hoping to call a web service to get data that would affect content, which I believe is most easily done from C#, and was wondering how I could use this to periodically call a javasc...