canvas

Simple graphics API with transparency, polygons, reading image pixels?

I need a simple graphics library that supports the following functionality: Ability to draw polygons (not just rectangles!) with RGBA colors (i.e., partially transparent), Ability to load bitmap images, Ability to read current color of pixel in a given coordinate. Ideally using JavaScript or Python. Seems like HTML 5 Canvas can hand...

Image to Canvas / HTML5 Conversion

Are there software/services for automated conversion of a typical image format (png, bmp, jpg/gif even) to Canvas / HTML5? ...

Checking for multiple images loaded

Hi, I'm using the canvas feature of html5. I've got some images to draw on the canvas and I need to check that they have all loaded before I can use them. I have declared them inside an array, I need a way of checking if they have all loaded at the same time but I am not sure how to do this. Here is my code: var color = new Array(); ...

Where can I find an infinite canvas control for Silverlight?

Are there any Silverlight controls available to perform this dynamic DeepZoom trick that Canvas for OneNote does? By trick I mean hosting the interactive UserControls in DeepZoom, and allowing them to be independently resized. http://www.officelabs.com/projects/canvasforonenote/Pages/default.aspx ...

How to rotate particular image among multiple images drawn to canvas in android ?

Hi All, I need a small help on rotating one image around its center of axis among multiple images which are drawn to canvas in android. I am loading images to canvas like below. canvas.drawBitmap(mMachineBackground, 0, 0, null); canvas.drawBitmap(mMachineRotator, 0, 0, null); I want to rotate only the second bitmap around its center...

moving an image across a html canvas

I am trying to move an image from the right to the center and I am not sure if this is the best way. var imgTag = null; var x = 0; var y = 0; var id; function doCanvas() { var canvas = document.getElementById('icanvas'); var ctx = canvas.getContext("2d"); var imgBkg = document.getElementById(...

Sprite-Sheet BLIT with HTML 5 Canvas?

Looking for an example of someone doing a a sprite sheet BLIT with javascript and the HTML 5 Canvas tag. I've been looking at Processing.js a bit, but I haven't found a clear cut example of how to do it there. ...

ScrollBars are not visible after changing positions of controls inside a Canvas

Hi, I created a custom canvas control inheriting from WPF Canvas. I am using it like this in main window - <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <RTD:RTDesignerCanvas Margin="5" Background="White" x:Name="canvas1" Focusable="True" Allow...

Animated GIF in HTML5 canvas

Hello,In HTML5...how can i draw easily (no too much complex code please) an animated GIF in a canvas that works (with drawImage only first frame is shown in the canvas) ...

Canvas clipping rect - right/bottom edge inclusive?

Hi all, on Android, there's a Canvas class that represents a drawing surface. It has a clipping rect. Question - are the rect's right and bottom borders inclusive or exclusive? In other words - if the rect is (0, 0)-(10, 10), will the Canvas allow drawing in pixels at coordinates 10? ...

How to place images on top of each other in java

Hi, I have a background image of a road, which I have displayed on a JFrame using an ImageIcon. I want to put a car on top of that background image at a certain (x,y) location. I tried using another ImageIcon and the background does not appear when I run the program , however the car does. import javax.swing.ImageIcon; import javax.s...

HTML5 canvas click event

I made an array of squares ctx.fillStyle = "rgb(0,0,0)"; for(x=0;x<=25;x++){ for(y=0;y<=25;y++){ ctx.fillRect(x, y, 20, 20); } } and I want a square to change its colour when clicked. How can I do that? I don't know much HTML5 and need some help. Thanks. ...

jQuery Drawing Plugin

Camarades, You'd know me identify good libraries (preferably in jQuery) to work with "Canvas" and drawings in javascript / html. I want to make my page more interesting, especially in some registries (registry of cars) and would like to draw a car and be able to go changing the number of wheels for example. Many thanks for any help. Su...

<canvas> in greasemonkey

I've created a <canvas>, in the variable canvas, but I can't seem to draw to it. I can see the blank canvas on the page, but it's blank. alert(ctx); ctx.fillStyle = "rgb(50,50,50)"; ctx.fillRect(10,10, 55,50); alert("done"); The first alert says [object CanvasRenderingContext2D], and I do see the "done" alert, but the canvas is still ...

How to compute the intersection points of a line and an arbitrary shape?

Is there a way to geometrically compute the intersection points of a line and an arbitrary graphics path? I know where all of the lines and curves are in the path, and I am using the HTML5 canvas element if that helps any. Basically, I have access to all of the canvas drawing commands and their arguments. For instance, if the API was c...

canvas draw text problem

If I execute the following code the text is shown bad (it seems not aliased) and not right aligned why? context.textBaseline = "top"; context.textAlign = "right"; context.fillStyle = "#F00"; context.font = "italic 30tpx sans-serif"; context.fillText("Lorem ipsum dolor sit amet", 50, 50); I'm using FF 3.6... ...

HTML5 Canvas Error

when i try to run this javascript it says that theres an error "INDEX_SIZE_ERR: DOM Exception 1" Javascript: blocksize=50; ctx=document.getElementById('wizard1').getContext('2d'); ctx.drawImage(document.getElementById('wizard.png'),0,0,105,105,0,0,3/7*blocksize,blocksize); HTML: <canvas id='wizard1'></canvas> <img id='wizard.png' sr...

How to tell what's causing slow HTML5 Canvas performance?

How can I tell if the canvas's slow performance is caused by the drawing itself, or the underlying logic that calculates what should be drawn and where? The second part of my question is: how to calculate canvas fps? Here's how I did it, seems logical to me, but I can be absolutely wrong too. Is this the right way to do it? var fps = ...

[JavaScript, Canvas] Create a buffer and work on it

Is it possible to create a buffer of arbitrary size and work on that just like on a canvas element? I would like to create a graphic (> 10'000 x 10'000 pixel) and use methods like drawImage() on that. After everything is done a part should be copied over to the canvas element. createImageData() can make a buffer but there's no way to us...

Dynamic area painting.

I have such drawing (It can be in a vector format): It is necessary for me to place it on a site and dynamically to paint it. The user chooses colour (of walls and roof)and both the wall and a roof on a picture change the colour (according to a choice of the user). The set of colours is not limited. What technology to use for the ...