canvas

How to get default fonts properties on Android?

Hi there! I need to draw some text on my Canvas, and I'd really avoid hardcoding some particular text size. Is there some standard way to find a default text size (and other properties) used in the OS? So far I found only TextView.setTextAttributes(context, resId) to which I can pass R.android.attr.textAppearance. But the thing is th...

Tkinter Canvas Does Not Display

I'm attempting to learn some Python and Tkinter. The sample code below is intended to put two windows on the screen, a few buttons, and a Canvas with an image in it and some lines drawn on it. The windows and buttons appear just fine, however I'm not seeing either the canvas image or canvas lines. I'd appreciate some help to figure ou...

<Canvas> contents as data?

Hello everyone, Is there a way to save a canvas element's content to data such as binary? I'm looking to be able to redraw this data when needed. Not really sure on how to go about it.. Thanks so much!! ...

WPF Canvas: centered origin, scaled axes (and y inverted), responding to mouse events

In a simple code-only WPF application I'm writing, I would like to have a custom Canvas. I've found questions similar to this one here in StackOverflow, but couldn't find exactly this one, nor a simple way to adapt another answer to my specific problem (please note that I have not much experience in WPF). In my canvas, I'd like it to h...

WPF Canvas.Left / Canvas.Top are not quite the right coordinates when rotated, why?

Hi guys, I have a weird but big problem. I am trying to let the user move / rotate some Rectangles on a Canvas. I am basing my mechanism on manipulating Canvas.Left / Canvas.Top properties for move, and RenderTransform.Rotate for rotation. I only need rotation on 0/90/180/270 angles. The problem is that a rectangle, which is placed a...

Is it possible to create transparent canvas

I am developing a pain brush application in javascript using processing.js It is using cavas object. I want to keep an image at the background of canvas. Draw something in the foreground. And while saving i need to get only foreground data. For that we need to make canvas object transparent so that background image is visible. I don't ...

<canvas> VS DOM in javascript game dev

what are adventages and disadventages of creating games in 'pure' DOM and using canvas? ...

<canvas> javascript game frameworks

Do you know any except GameJS, which actualy isn't working on my pc, in FF3.5 i try to start attached jetris demo and i see nothing, even firebug console is clear. I tried something called GameQuery, looks nice but it's working on pure DOM, im interested in CANVAS. ...

Free Open Source In-browser image editors

I'm looking for a in-browser image editing solution to integrate with my project: http://code.google.com/p/django-ray/ I got it working with Pixlr quite easily and the editor is fantastic .. however it's a hosted service, which means I must be connected to Internet for it to work .. Is there any other solution like Pixlr but that are n...

How to determine Z-order when drawing in a one-point perspective?

I'm trying to make a simple javascript that draws rectangles on a canvas, then draws the side faces based on a one-point perspective. The problem is, the amount of rectangles and their positioning is arbitrary, so faces tend to overlap in a way that wouldn't happen in true 3D perspective. How can I determine the correct drawing order so ...

<canvas> Go/Baduk/Weiqi Game Board

I'm experimenting a bit with the new tag and I've already hit my first roadbump. I figured I'd start getting my feet wet by implementing a version of the classic board game Go/Baduk/Weiqi. I've drawn the xy grid using moveTo() and lineTo(), and I've drawn a wood background using fillRect() that needs to be "under" that XY grid of cours...

Resizing an image in an HTML5 canvas

I'm trying to create a thumbnail image on the client side using javascript and a canvas element, but when I shrink the image down, it looks terrible. It looks as if it was downsized in photoshop with the resampling set to 'Nearest Neighbor' instead of Bicubic. I know its possible to get this to look right, because this site can do it j...

Document height grows on resize when setting canvas dimensions dynamically

I'm trying to get a canvas element to take up the entirety of the document height and window width, so that when I resize the window, the canvas element stretches with it, in effect, giving me a full screen canvas. What is actually happening, though, is the document height(and consequently, the canvas height) increases no matter how the ...

How to print contents of a Python Tkinter.Canvas control?

How would i print contents of a Python Tkinter.Canvas control? I've read that it is possible to print to a postscript printer from this control but examples are hard to come by. So, any ideas how what is needed to print the contents (including images)? If you've got a cross-platform method all the better! ...

Best canvas for drawing in wxPython?

I have to draw a graph of elements composing a topological model of a physical network. There would be nodes and arches, and the latter could be unidirectional or bidirectional. I would like to capture the clicking events for the nodes and the arches (to select the element and show its properties somewhere), and the dragging events for ...

Drag-and-drop to canvas in wxPython

Do you know if there is an easy way to drag-and-drop elements (icons or buttons) into a canvas and create different drawings on it as a result? The idea is to have a set of objects and let the user drag them into a drawing space. In the worst case the user could just click on the icon/button, and then click on the canvas and draw the e...

Quickly repaint array of unicode symbols in JavaScript

I want to change background/foreground color of many symbols with the same CSS class. Right now I'm doing it with jQuery like $('back_COLORED').css('background-color', '#00FF00'), but this approach is slow when there are many elements with such class (>900). Seems it's because jQuery don't change CSS rules itself, but finds all element...

Saving a picture from a browser canvas.

Hello I'm currently developing a website in ASP .NET MVC and I require functionality for a user to be able to draw a picture on a canvas which can be saved in a database. What is the best method for doing this? preferably a very lightweight solution. I was thinking flash would be the most accessible platform and there may be some good f...

Wrapping long text on an Android Canvas

I have a custom control that is doing a lot of 2D drawing straight to the canvas. Some of this drawing is text, so I am using the Canvas.drawText() method. I want to draw the text within some bounds - a top-left, certain maximum width, and a maximum number of lines. After drawing the text, I want to know how many lines it took. Is th...

HTML5 Canvas compositing question (source-in)

I am trying to recreate a page flipping type animation in HTML5 using canvas. The animation is based on ideas from here: hxxp://oreilly.com/javascript/archive/flashhacks.html but thats not really important. The problem I am having is that using the 'source-in' composite operation is not giving me the results I expect and would like clari...