canvas

When using ItemsControl ItemsControl.ItemsPanel is set to Canvas, ContenPresenter comes in and break my Canvas properties on the children [WPF]

I am using an ItemsControl where the ItemsPanel is set to Canvas (see this question for more background information). The ItemsControl is performing as I want, and it works like a charm when adding a child element manually by putting it into ItemsControl.Items: <ItemsControl> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> ...

How can I override the canvas in my View?

I am using Android 2.1 and Eclipse. I have defined a LinearLayout with two components that have dimensions: 250 x 250. LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams llp = new llp.LayoutParams(250, 250); meter1View = new MeterView(this, "Meter 1"); ll.addView(meter1Vie...

Write to javascript array within php loop

I have a php loop that is echoing out geolocation values. How can I get it to write those values to a javascript array, so I can then use them to plot points on an HTML5 canvas? The php loop is as follows <ul id = "geo-list"> <?php foreach($data as $phrase) { ?> <li><?php if ($phrase->geo != false) { ...

Silverlight Grid Auto Size not working within canvas

How do you make a grid width 100% inside a canvas? Here's some simple XAML but it doesn't work as expected. <Canvas Background="MediumSlateBlue" Width="Auto" Height="Auto" > <Grid x:Name="LayoutRoot" MouseMove="MainPage_MouseMove" Background="Beige" > <TextBlock x:Name="lblDisplay" Height="24" HorizontalAlignment="Right" Ver...

Android View.onDraw() always has a clean Canvas

I am trying to draw an animation. To do so I have extended View and overridden the onDraw() method. What I would expect is that each time onDraw() is called the canvas would be in the state that I left it in and I could choose to clear it or just draw over parts of it (This is how it worked when I used a SurfaceView) but each time the ...

XAML get new width and height for Canvas

I have searched through many times but have not seen this before. Probably really simple question but can't wrap my head around it. Wrote a VSTO add-in for Excel that draws a Grid dynamically. Then launches a new window and replaces the contents of the Canvas with the generated Grid. The problem is with printing. When I call the print p...

How to run setInterval() on multiple canvases simultaneously?

I have a page which has several <canvas> elements. I am passing the canvas ID and an array of data to a function which then grabs the canvas info and passes the data onto a draw() function which in turn processes the given data and draws the results onto the canvas. So far, so good. Example data arrays; $(function() { setup($("#ca...

Simulate Pivot Rotate Using Transform In SVG

I have a rectangle in SVG that I need to rotate on a pivot from a specific point. The best way I can see to do this is transform to the xy of the pivot, rotate the degree, and then transform again. The problem is the xy of the second transform. I assume its going to take cos and sin to some extent, just not sure where or why. * | | | ...

When do I synchronize methods or use synchronized blocks in my methods in an Android game?

I'm looking into writing simple graphics code in Android and I've noticed some synchronized() blocks. What is the reasoning behind this and how do I know when I should be "synchronizing" my code? ...

WPF zoom canvas and maintain scroll position

I have a Canvas element, contained within a ScrollViewer, which I'm zooming using ScaleTransform. However, I want to be able to keep the scroll position of the viewer focused on the same part of the canvas after the zoom operation has finished. Currently when I zoom the canvas the scroll position of the viewer stays where it was and the ...

Javascript Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

The site is: http://www.clubloc.com/ And it works in firefox but not in google chrome. Internet explorer also has problems but thats pretty much a given when using HTML5 Canvas. Anyways I'm trying to figure out why it throws the error: Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1 When the arrays clearly have all those elements, I ...

Excanvas does not work in IE8 at all

I simply cannot get excanvas to work at all. I have tried everything I can think of. I am even uploading the examples that come with excanvas to my website and testing them and they do not even work. I don't know if it has something to do with my server or what, but I haven't seen a working excanvas image yet. for instance... I this exa...

Embed Javascript Module within Flex application

I have a large module written in JS which uses Canvas to draw and animate trees. This module was written for a product which is now being migrated to flex. Is there a way in flex to embed this JS module as is? Or would I have to rewrite the whole module in AS3 (shudder)? Further, if embedding is possible, would user interactions (mouse ...

How to check keyboard state while painting on HTML5 canvas?

I'm just mucking around a bit with HTML5 canvas and painting. I happened to find this article by Opera that describes well how to set up a simple application. I would like to extend it so that the user may set up a vanishing point (1 point perspective) that may be used to constrain painting. To allow this I need to figure out a way to d...

How to measure a canvas that has auto height and width

Hi Folks, I'm a beginner in silverlight so i hope i can get an answer that brings me some more light in the measure process of silverlight. I found an interessting flap out control from silverlight slide control and now I try to use it in my project. So that the slide out is working proper, I have to place the user control on a canvas....

python, tkinter,canvas - how to check if two object are overlapping?

Hi guys, Say I have objects within the canvas with a tags 'stopped' and 'flying'. How do I check if any of this objects overlap each other? Thanks! ...

Dynamically pixelate an html image element

I'm to take an image on a webpage, and then use javascript (or whatever would be best suited) to dynamically 'pixelate' it (e.g. into 20px squares). Then, as the user scrolls down the page, I need the image to gradually increase in resolution, till it is no longer pixelated. Any ideas how I could go about doing this? I realise I could ...

Load a canvas from a main class - Java

I have a MyCanvas class that extends JComponent. On this canvas I have drawn a couple of things and has its own main method. public static void main(String args[]) { JFrame mainFrame = new JFrame("Graphics demo"); mainFrame.getContentPane().add(new Canvas0_1()); mainFrame.pack(); mainFrame.setVisible(true); } Ho...

What is html5 canvas?

I'm a little confused to what html5 canvas is. I've been told it is javascript, but it seems to be a much bigger deal? What makes it different than javascript? Why is it so amazing? Does it do other things than javascript? Thanks, Dan ...

Flex: Why is line obscured by canvas' background

I want MyCanvas to draw lines on itself, but they seem to be drawn behind the background. What's going on and how should I do this? Main.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:my="*"> <my:MyCanvas width="300" height="300" id="myCanvas"></my:MyCanvas> <mx:Butto...