canvas

Embed external images for use in HTML canvas?

I'm using JavaScript to load an image into my Canvas element in Firefox. This works fine for local images, but throws a security exception for external images. Is there any way to avoid this security exception, one that does not involve my server having to act as proxy to load the image locally (because that would stress my server)? PS:...

Help: Android paint/canvas issue; drawing smooth curves

How do I get smooth curves instead of dots or circles, when I draw with my finger on the touch screen, in Android? I am using the following code- public class DrawView extends View implements OnTouchListener { private static final String TAG = "DrawView"; List<Point> points = new ArrayList<Point>(); Paint paint = new Paint(); public D...

How to extend WPF hit testing zone for a Path object.

Wpf hit testing is pretty good but the only method I found to extend the hit zone is to put a transparent padding area around your object. I can't find any method to add a transparent area arround a Path object. The path is very thin and I would like to enable hit testing if the user clicks near the path. I can't find any method to exten...

Android: how to place a button at an x,y position over top of Canvas

Is it possible to place buttons at an X,Y position over the top of a Canvas? For example, on the opening screen of my game, I would like to place buttons for "Play Now", "Instructions", etc, right on top of the canvas. Right now, I'm looking at Touch locations on the Canvas and comparing them to various X,Y bounds. It works, but add...

How to get HTML5 canvas text to show html entity?

I'm parsing an xml file that stores image/caption data both of which I need to display on my canvas. However occasionally there's an entity in the file and when drawing the text to the canvas it interprets it as flat text. How can i get &copy; to show up as on the canvas? Is this even possible, or does anyone know of a good work arou...

Android Canvas.drawText

Hi All, I have a view, I'm drawing with the Canvas object in the onDraw(Canvas canvas) method. My code is: Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStyle(Style.FILL); canvas.drawPaint(paint); paint.setColor(android.R.color.black); paint.setTextSize(20); canvas.drawText("Some Text", 10, 25, paint); The problem...

HTML 5 Canvas performance

I'm just started on playing around with the canvas HTML5-object. For the sake of performance tests, I have made a little ping pong game. Are there any performance improvements I could use? The ball seems to be blue with a touch of red, but my declaration it should be yellow. How can I fix this? ...

Scrolling a canvas as a shape you're moving approaches its edges

Hi, I develop a Python-based drawing program, Whyteboard. I have tools that the user can create new shapes on the canvas, such as text/images/rectangles/circles/polygons. I also have a Select tool that allows the users to modify these shapes - for example, moving a shape's position, resizing, or editing polygon's points' positions. I'm ...

WPF: Focus on a Border in a Canvas

Hello, I have a Canvas and in it a Border. Now I want to give focus to this Border. Can somebody please tell me how do do this? Seems like it's not that easy ): Thanks for any hint! ...

Are all canvas tag dimensions in pixels?

Are all canvas tag dimensions in pixels? I am asking because I understood them to be. But my math is broken or I am just not grasping something here. I have been doing python mostly and just jumped back into Java Scripting. If I am just doing something stupid let me know. For a game I am writing, I wanted to have a blocky gradient. I ...

Canvas Image Smoothing

What is ctx.mozImageSmoothingEnabled = false; for webkit(or other browsers)? I need it to remove anti-aliasing because i am trying to get a pixelized effect to an image. With anti-aliasing, it looks bad-quality but with no sharp edges. ...

Dynamic size canvas with Scroll bars

Hi, I am developing a simple WPF application without any auto layout. The goal is when a user clicks (mouse down) a element (say textBlock) will appear at the location of the mouse click. For this I am using canvas panel embedded in a Grid of 1 row, 1 column and scrollviewer (visible). The issues are: 1. when the application window is re...

Can I use Data URLs in Android 2.1's Webkit-based browser?

Hi all, I am writing a tutorial about the HTML5 Canvas for mobile and did some basic tests. While I can call the getDataURL() Method on an iPhone's HTML5 Canvas Element, it does not seem to return the data URL on Android 2.1 (Google Nexus One) and it's webkit-based default browser. Here is the sample: var dataURL = canvas.toDataURL();...

Canvas and HTML5: Supported Browsers?

I am looking at using HTML5 Canvas element for my upcoming project. I want to know what all major browsers (including the versions!, cos i know that the latest builds do support canvas) support the Canvas tag. I don't give a damn about IE. So don't bother reporting IE. :) In this tutorial Drawing shapes - MDC, the quadraticCurveTo secti...

How do I rotate a single object on an html 5 canvas?

I'm trying to figure out how to rotate a single object on an html 5 canvas. For example: http://screencast.com/t/NTQ5M2E3Mzct - I want each one of those cards to be rotated at a different degree. So far, all I've seen are articles and examples that demonstrate ways to rotate the entire canvas. Right now, I'm guessing I'll have to rota...

import pictures from the iphone photos storage to the canvas within uiwebview

I am currently experimenting with canvas drawing function in a uiwebview.Its a simple app that allows you to finger paint on the Iphone.Can someone point me in the rite direction on a problem I'm having.I need to be able to import pictures from the photos storage to the canvas within the uiwebview.Its built on Html,javascript and css.Wou...

Resizing canvas, where's the problem?

I'll post a link since theres to much to post here: http://hem.bredband.net/noor/canvas.htm My goal is to make the picture fit inside the window with the width of the image being the same as the window, even after resize. If the pictures height becomes to big for the window then the picture should resize itself according to the height ...

How to obtain the facebook uid of a user in php

Hey, I'm writing a canvas app for facebook. I use the command: $user_id = $facebook->require_login(); To get the userid, but at the first few pages of my app I don't want to require login, but if the user's logged in, I'd like to know what the userid is. Basically I need a get_login() command that perhaps returns 0 or null if the user...

How do i tint an image with HTML5 Canvas ?

My question is, what is the best way to tint an image that is drawn using the drawImage method. The target useage for this is advanced 2d particle-effects (game development) where particles change colors over time etc. I am not asking how to tint the whole canvas, only the current image i am about to draw. I have concluded that the glob...

ImageData of an externally loaded Image?

I load an external image and draw it on the Canvas element like so: var canvas = document.getElementById('canvas1'); var context = canvas.getContext('2d'); var image = new Image(); image.onload = function(evt) { context.drawImage(evt.target, 0, 0); } image.src = "test.jpg"; But I want to get the ImageData. So after calling context.dra...