canvas

Algorithm for positioning rectangular and randomly sized objects inside a non-rectangular canvas.

. . Hi there, everybody. . . I have a canvas defined by many points (x,y)--it's not rectangular, but at least it will follow some almost-hexagonal shape (like a distorted hexagon, with angles that are always < 180 degrees). I also have a big collection of different rectangles (more or less 140 of them, with different widths and heights)...

Is there a way to get pixel data from Internet Explorer?

Excanvas.js allows IE to work with the canvas tag, but the getImageData method is not supported. Is there any way at all to get the value of a specified pixel in IE (img or VML or whatever other ways bitmaps from a server can be displayed in IE)? I'm assuming there's not. I'm trying to get rid of a server hit to improve responsiveness ...

Create reflected image with HTML Canvas?

I have the following code which tries to combine a vertical mirrored image with a transparent to background color gradient. When combining these two effects it fails, do I need to overlay a PNG gradient over the canvas instead of trying to get the canvas to perform both operations? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transition...

rendering web page as thumbnail

Hi, I asked this question earlier, since i am a little new to firefox extension development, the canvas thing for firefox went a little over my head. Apologies for reposting this again. with the first answer there was this code snippet: var path = this.getPref("path","string"); what are the path and string? yes i did look up for get...

How do I programmatically position a canvas in Silverlight?

I'm using Silverlight 3/C#, and I'm trying to create some XAML objects programatically in response to a user clicking on a button. However, I can't seem to position a Canvas object that I have created - when I call SetValue() on the new Canvas with the Canvas.LeftProperty value, the browser window clears to an empty screen. I have a si...

Render List<Canvas> as list items (or itemscontrol)

I've effectively got a List or a List, XAML that represents the canvas elements... as a return from some stuff I have no control of. I've been moderately successful rendering via stackpanel.children.add etc, however want to start having the list of canvas within a virtualizing panel or list. I've set itemssource and datacontext on the...

Clickable lines and circles with HTML Canvas

I'm thinking of making an application where at some points a graph is displayed that maps people over time and space. The vertical access is location, the horizontal access is time, and each person is identified by a line. At any point where the person did something of significance, there is a bigger dot on their line. Conceptually, clic...

Adobe AIR canvas dimensions messed up

I'm messing about with Canvas in Adobe Air. But their seems to be some issue with the mouse coordinates. The more I click towards the right, the difference between the draw position and actual click increases. My code is Wb.canvas.fillRect(evt.clientX-canvasTag.clientX, evt.clientY-canvasTag.clientY, 50, 50); ...

I just want to rotate and move the image!! (Javascript, <canvas>, html 5)

http://gist.github.com/232194 I know it's something wrong with my transformations in drawGuy. Can anyone help me figure out how to rotate just the image? Currently it rotates fine, but I something with the transforms is distorting it, so that it doesn't follow the mouse correctly. ...

Which has better rendering performance, Stackpanel or Canvas+TranslateTransform? WPF/Silverlight

I always use a Canvas when I'm laying out my visuals usually because I will need adjust the RenderTransform.TranslateTransform to animate in some way. A colleague recently told me that unless I explicitly need to animate I should always use the A Stackpanel because it is faster than a RenderTransform.TranslateTransform when laying out ob...

Ajax-ish updating of a canvas element

Ok this is more of general technology/approach question. We have a very simple web 'app' which is basically just a canvas element. We're using javascript to draw a 'fancy UI' on the canvas. We register a mouseclick event, get the coordinates and then try to figure out what widget they clicked on. My question is, what technology or fram...

JS/Canvas single line animation

Hello everyone, I'd like to make an animation of a single line using JavaScript and Canvas tag. I'm able to do it without any problems, except: it works fine if you're trying to do a straight line - I have an interval (10ms) adding 1px, so if it's going from 150px (x)/20px (Y) to 150px (X)/200px (Y) - everything looks cool. Problem is...

How can I tell if a javascript object is an Image or a Canvas?

I have a class with a property that can be an Image (i.e. an IMG element) or a Canvas. When I serialize it to JSON, I need to convert this to a text string. If it is a Canvas, then I can call Canvas#toDataURL. But if it is an Image, I first need to draw it to a Canvas with Canvas#drawImage, then serialize that canvas with toDataURL. So ...

Issues with re-rendering objects on a canvas - Java

Hi, guys. I'm having some serious problems with this, have been working on it for some time now - about 2 weeks - and I just can't see the issue I'm having here. I'm sure I'm making a dumb mistake somewhere. Anyhow, enough of my rambling. I'm having trouble with the code below, in that it doesn't want to update the world. WHat I mean is...

Bezier timed animation path

Hi, I'm trying to define a path of points. Each point has an x, y, and time. I then want to query this path and get the current position at that point in time. Let me share some pseudo code. point {x, y, time} function initialisePath(point[] path) { ... // Create Bezier Path } function getXYAtTime(time) { return ... // Ge...

Flash vs. (Ex)Canvas vs. SVG/VML

Hi Guys, If you were to design a graphics-heavy interactive web application (say a game like Mario Bros.) today, which of the three available technologies would you prefer - Flash, (Ex)Canvas or SVG/VML? What parameters would you consider and how would you rate these technologies on each parameter? I can think of the following: a) Spe...

Canvas Element and IE

Well not just IE, any browser that doesn't currently support it I want to start using the processing.js framework. It's used for making images with the canvas element. However I'm reluctant to use it due to the fact that it's not widely supported. So what's the best way for me to give the user an alternative image if they do not suppor...

Detecting drawn shapes in Canvas+Javascript?

I had an idea for a WebOS, but it requires detecting drawn shapes. Ie: I want a user to be able to draw an image, then draw a big box around the whole image. Then the user can drag that box by the grabbing the border, and moving the whole image around. This requires that I be able to detect when such a box has been drawn, and turn it int...

HTML Canvas element implemented in Flash?

Can the HTML 5 Canvas element be implemented in Flash to provide support for that element in older browsers? ExplorerCanvas can be included on a web page to allow emulation of Canvas in IE using VML. Since this is an IE-only solution, I would like to know if a similar replacement could be done using Flash, giving support for Canvas to a...

Java 2D Graphics Question

I'm attempting to make a Java Applet which will allow me to draw a graph data structure in a canvas by clicking where I want to create nodes, and clicking the nodes to connect them. The problem is I cannot get the paint() method to behave correctly. I add new nodes to the graph (and squares on the canvas) inside the mousePressed(MouseEve...