graphics

How to resize text in svg dynamically?

Hello everybody, I'm working on a report that includes an embedded svg diagram. The diagram is drawn using relative coordinates, so when a browser window resizes the diagram resizes pretty well. The only exception there is text - it remains the same. Is it possible to draw text in svg that is resizable? ...

Why does a SolidBrush result in a patterned image?

I'm trying to dynamically generate a gif image of a specified size and color in an HttpHandler. For some reason, the image is being generated with a dithered color pattern rather than the solid color I expected the SolidBrush to create. The following code is the simplest I could find that exposes the problem. private void GenerateSqua...

What image-editor or library produces an easy-to-use 2D vector format describing areas / masks?

Step 1) Administrative / data entry worker opens ?, loads raster image, and using a 'lasso-like' tool (a la Photoshop 'magnetic' if possible) specifies areas of interest / masks. Step 2) ? Step 3) Profit! (i.e., application opens raster image, vector file describing masks, does interesting stuff to areas of interest based on runtime ...

Direct3D Geometry: Rotation Matrix from Two Vectors

Given two 3D vectors A and B, I need to derive a rotation matrix which rotates from A to B. This is what I came up with: Derive cosine from acos(A . B) Derive sine from asin(|A x B| / (|A| * |B|)) Use A x B as axis of rotation Use matrix given near the bottom of this page (axis angle) This works fine except for rotations of 0 (which...

Winforms .NET 2.0: How to draw a Png icon?

Note: Question http://stackoverflow.com/questions/220465/using-256-x-256-vista-icon-in-application deals with using a "Vista" icon as the application's icon. This question deals with manually painting a Vista icon. Note: Question http://stackoverflow.com/questions/281999/winforms-net-20-how-to-paint-with-the-proper-icon deals with paint...

Problem drawing graphics to user control

My application pops a form as a child of the main form. On the form is User Control with a Panel where Graphics are rendered. When executed from Visual Studio in debug mode the drawing is often rendered as expected, imagine a simply XY graph. If the panel's graphic aren't drawn then adding two or three break points to the drawing routine...

Calculating a boundary around several linked rectangles.

Hi,I am working on a project where I need to create a boundary around a group of rectangles. Let's use this picture as an example of what I want to accomplish. EDIT: Couldn't get the image tag to work properly, so here is the full link: http://www.flickr.com/photos/21093416@N04/3029621742/ We have rectangles A and C who are linked by...

How can you tell png8 from a png24

Hi guys, I'm working on a website that uses lots of png24 files, for transparency. I need to replace them with png8 files, as all the png fix style javascript workarounds for png24 cause IE6 to lock up randomly. See this link to get an idea of the symptoms IE6 displays - http://blogs.cozi.com/tech/2008/03/transparent-pngs-can-deadloc...

Fast Vector rendering library for C or Python

I'm looking for a library like Cairo, just far faster. It has to be a library that works with C or Python. It also would be nice if I could output to PNG, and SVG. I am looking at Qt's arthur, but that's C++, and I'm not a fan. Any suggestions? Edit: another precondition is that it has to run under Linux. ...

Algorithms for spacing objects visually

Hi, I am wondering if there are any well-known algorithms that I should be aware of for spacing objects visually. For instance, a LINQ to SQL diagram has many tables but automatically spaces them for readability. Is this pretty much a "place randomly and move if too close/overlap" type algorithm or is there more to this? Thanks for a...

Programming simple drawing application

Hello, to do some visualization of data I would like to include rectangles, circles and text within my graphs. Does anyone know a Java based framework (maybe similar to very basic Powerpoint functionality) that can export SVG graphics? ...

Drawing on top of an image in Javascript

I want to let the user draw on an image in a browser. In other words, I need both bitmapped graphics and drawing capabilities, whether vector or bitmapped. Canvas looks good, but is not supported by IE, and though there is ExCanvas, I wonder if ExCanvas is stable enough for consistent use in IE6 through 8. Or best of all, is there an o...

Searching for Graphic libraries to draw seismic data in C#

I am searching for graphic libraries that can draw seismic data; which is a large number of curves drawn vertically and gives you a shape like this: and I need it to do be able to: 1) select each curve with mouse and return a value that tells me which curve that I have selected. 2) label the scale with more than one value. thanx in...

Finding closest non-black pixel in an image fast

I have a 2D image randomly and sparsely scattered with pixels. given a point on the image, I need to find the distance to the closest pixel that is not in the background color (black). What is the fastest way to do this? The only method I could come up with is building a kd-tree for the pixels. but I would really want to avoid such ex...

nVidia SLI Tricks

I'm optimizing a directx graphics application to take advantage of nVidia's SLI technology. I'm currently investigating some of the techniques mentioned in their 'Best Practices' web page, but wanted to know what advice/experience any of you have had with this? Thanks! ...

PCL raster color graphics distorted. Code included: what am I missing?

The function below prints a color raster image to a PCL-5 printer. The function was adapted from a 2-color (1bpp) printing function we had that worked perfectly, except for the grainy 2-color printing. The problem is that the image comes out with a large black bar extending from the right of the image to the edge of the page like this:...

RayTracer project in C#

When I was at university, I took a subject in raytracing (graphics synthesis) and we got a chance to write a 3D ray tracer in C++. That was heaps of fun, except I long ago lost my code in the great hard drive crash of '04'....many files were lost... Is there a RayTracer I can play with in C# that isn't written in one line? Something tha...

Most efficient algorithm for mesh-level, optimal occlusion culling?

I am new to culling. On a first glance, it seems that most occlusion culling algorithms are object-level, not examining single meshes, which would be practical for game rendering. What I am looking for is an algorithm that culls all meshes within a single object that are occluded for a given viewpoint, with high accuracy. It needs to be...

Greatest linear dimension 2d set of points

Given an ordered set of 2D pixel locations (adjacent or adjacent-diagonal) that form a complete path with no repeats, how do I determine the Greatest Linear Dimension of the polygon whose perimeter is that set of pixels? (where the GLD is the greatest linear distance of any pair of points in the set) For my purposes, the obvious O(n^2) ...

Microsoft.DirectX.Vector3.Normalize() inconsistency

Two ways to normalize a Vector3 object; by calling Vector3.Normalize() and the other by normalizing from scratch: class Tester { static Vector3 NormalizeVector(Vector3 v) { float l = v.Length(); return new Vector3(v.X / l, v.Y / l, v.Z / l); } public static void Main(string[] args) { Vector3 ...