canvas

canvas updatelayout method in WPF

Hello All, I am trying to arrange the shapes in canvas control before changing it to a bmp file. I am calling Measure, Arrange and updatelayout methods subsequently and opening the bmp file in documentviewer for printpreview functionatliy. but, my shapes are connected by line with arrow head, which is not properly arranged (the arrowhe...

Fast pixel plotting using SWT?

I'm looking for a fast and easy way to plot arbitrarily colored pixels in an SWT Canvas. So far I'm using something like that: // initialization: GC gc = new GC(canvas); // inside the drawing loop: Color cc = new Color(display, r, g, b); gc.setForeground(cc); gc.drawPoint(x, y); cc.dispose(); This is horribly horribly slow. it takes ...

How do you draw text on a <canvas> tag in Safari

I've been experimenting with using the <canvas> tag for drawing simple diagrams and charts, and so far it's pretty easy to work with. I have one issue thought. I can't figure out how to draw text on a <canvas> in Safari. In Firefox 3.0, I can do this: Chart.prototype.drawTextCentered = function(context, text, x, y, font, color) { i...

JavaScript Charting library - Google Analytics Style

I'm searching for a Javascript library to create line charts like the ones of Google Analytics. When the mouse is over a point, a box shows you the data. An example is at http://wikirank.com/en No Flash or Air, only JS and client-side Canvas... Better if Free... ...

In Flex, how can I get the dimensions of a childless canvas component at runtime?

One of my components looks like this: <mx:Canvas id="grid" width="100%" height="100%"></mx:Canvas> On creationComplete, I load some spirte that I want to scale and position based on the dimensions of the canvas to create a custom grid layout, but when I access the dimensions of 'grid' I get 0 and 0. Is there any way to get the dimensi...

WPF: Canvas Z-Index Bug

So I made my own carousel control in WPF. I have stumbled upon a bug and was wondering if anyone knew how I could fix this like a method call or a series of methods calls or some work-around. Here is a print screen of my carousel: As you can CLEARLY see with this image, my mouse pointer is OVER the button with 16 written on it. But th...

How to erase the content on a graphics in GDI+?

I am using gdi+, in c++. Bitmap canvasImg = new Bitmap(400, 300, PixelFormat32bppARGB); Graphics canvas = new Graphics(&canvasImg ); canvas.DrawImage(XXXX); There are two problems. 1. I find the canvasImg is black. How can I change the color to white? I mean I want an white canvas. 2. If I have drawn some thing on the canvas, How c...

How does Javascript CANVAS works?

Javascript CANVAS is amazing: it allows us to draw something like lines, polygons on the browser screen. I wonder how does Javascript CANVAS works. For example to draw a line, does it use a series aligned tiny images to simulate the line or some other approach? Thanks in advance. ...

How can I find out when a new UIElement is added in Silverlight

I am designing a user control in sliverlight that inherits from canvas. It is necessary for me to find out when a new UIELement is added to Children property of MyBase but there is no event like "ItemAdded". Since I want to animate the children of my canvas, I can not use LayoutUpdated event (It is hit a million times). ...

Javascript Canvas Serialization/Deserialization?

Can you serialize/deserialize a canvas object in javascript? ...

Limit modal size of a "PopUp" in Flex?

I have this : private function tileList_itemClick2(evt:ListEvent):void { img = new Image(); img.maintainAspectRatio = true; img.addEventListener(Event.COMPLETE, image_complete); img.addEventListener(ResizeEvent.RESIZE, image_resize); img.addEven...

How to make canvas with Swing?

Hi, I'm trying to make a paint editor with Java in which I have a toolbar with the objects that I would like to paste in the canvas. I'm using swing components to make the GUI, but when I looked for the way of making the canvas, I only found the class canvas from awt. Is there any way to make something similar to canvas with swing? (f...

Limite the size of the modal of a “PopUp” in Flex ?

private function tileList_itemClick2(evt:ListEvent):void { img = new Image(); img.maintainAspectRatio = true; img.addEventListener(Event.COMPLETE, image_complete); img.addEventListener(ResizeEvent.RESIZE, image_resize); img.addEventListener(Mo...

MVVM in a canvas with usercontrols

I have a MVVM WPF application that basically wants to be a single line diagram designer for an electrical distribution network. I have a canvas that must contains transformers, circuit breaker, lines and cables. My big problem is the design... How can i start? I think about a DesignerView, DesignerViewModel that contains an Observable...

Flex Bipmapdata and Scrolled Canvas

Hello, I have a canvas wich is a drawing area. This canvas can be scrolled horizontally and vertically. I am trying to make a screenshot of the whole canvas, this include visible and scrolled parts. var bmd:BitmapData = new BitmapData(board.width, board.height, false, 0xffffff); bmd.draw(board); This would only show me the visible ...

Flex Child Canvas insise a Canvas and resizing question

Hi, I have a Canvas A with scrollpolicy on, A has one unique Child canvas B which has no scrolling. A is the container of B which is a whiteboard like tool. If i dont set width and height of B, he will resize accordingly to A size, up to a certain point where A has scrollbars which is the good Behavior. However since B canvas seems t...

Is there a test suite for HTML/JavaScript canvas element?

I'm developing an alternate backend for the canvas interface. I started setting up test cases, and then it occurred to me that there may already by a set of tests, but google isn't forthcoming. ...

What is the best way to draw text on an HTML canvas element?

The canvas element unfortunately doesn't handle text well. There are a bunch of approaches (see e.g. http://canvaspaint.org/blog/2006/12/rendering-text/ ), but they mostly seem like hacks. What can I do that is cross-platform and gives me the most flexibility to make my fonts like how I want? ...

WPF Canvas: Children.Add() hanging on background thread?

...or... "What evil in the depths of WPF have I awoken?" I'm creating a Canvas on a background thread and rendering it to a bitmap. I've had this working in production code for over a year now without problems. I do the following: create a Canvas object create a new NameScope object assign that NameScope to the Canvas draw whatever I...

Draw arrow on canvas tag

Hello, I want to draw an arrow using the canvas tag, javascript. I've made it using the quadratic function, but I'm having problems to calculate the angle of rotation of the arrow... Anyone have a clue on this? Thank you ...