graphics

How do you create an off-center PerspectiveCamera in WPF?

I'm trying to more or less recreate Johnny Lee's Wii head tracking app, but using an augmented reality toolkit for the tracking, and WPF for graphics. To do this, I need to create a perspective camera using the top, bottom, right, and left parameters to create my viewing frustum, instead of field of view and aspect ratio (to those famili...

How does GraphicsPath.AddArc use the startAngle and sweepAngle parameters?

I am trying to use System.Drawing.Drawing2D.GraphicsPath.AddArc to draw an arc of an ellipse starting at 0 degrees and sweeping to 135 degrees. The issue I am running in to is that for an ellipse, the arc drawn does not match up with what I would expect. For example, the following code generates the image below. The green circles are w...

Flipping a gui Component in the x-z plane

I would like to know the respective graphics transformations ..in creating a flipping effect of a ui component about the x-z plane. It needs to be done only using 2d since the swing toolkit only supports 2d affine transformations. http://www.verysimple.com/flex/flipcard/ .... is an example of the effect to be achieved . ...

bgi graphics linux

I need to know whether there is any bgi library for graphics in linux.can anyone help??please do not suggest any library other than bgi coz I want to use it using C and I am comfortable with it.Thank you in anticipation ...

Rendering 2D primitives in scrollable view

What is the best approach to render a large number of 2D graphical elements (lines, text, shapes, etc.) in a scrollable view on windows using C#? ...

Drawing over a JPanel and adding the JPanel to JFrame

I need to draw a graph over a JPanel by overriding the JPanel's paintComponent() method. While designing gui using netbeans when i drag/drop a JPanel over JFrame it generates code by creating a private variable, JPanel object. In such a case how can i override its method to draw over it... or else if i write code for a class by exten...

How do I use a shape to define a clipping region?

I am still simulating a radar (or attempting to) and through trial and error managed to draw a pie on top of my picturebox's background the more or less covers the target area I wish to draw to. Now I'm trying to make that area my clipping region. How do I achieve this? I haven't come across anything that explains this clearly. I have th...

How do I display an image within a region defined in a Picturebox?

As a follow on to my previous question I have gotten my region but spent the last two hours trying to display tiny pictures wihing that region alone; with the end goal being to be able to arbitarily display any number of images I choose. so far this is my code: void OnPaintRadar(Object sender, PaintEventArgs e) { Graphics g = e....

Graphics.Save vs Graphics.BeginContainer

How is Graphics.Save different from Graphics.BeginContainer? ...

Anchor point of x,y in JavaFX nodes

Some sprite applications (namely pulpcore) allows you to define an anchor point for an object. For example if the anchor point of a rectangle is 0,0 and it's coordinates are x:0,y:0 the top left point of the rectangle would be displayed on the top left point of the screen. If however the anchor point of the rectangle is 50,50 and it's ...

Compact Framework Picture Box Image Problem

I have two picture boxes on a .net compact framework form. Both picture boxes have their image set to a .png. My problem is that when I compile or run the application, one of the images appears "greyed-out" or like a shadow of the actual image. What might be causing this? ...

Is it smart building an OpenGL C# application to replace GDI

Hello, I have developed a quite large application using MFC. Naturaly, I used GDI for drawing, CCmdTarget for event routing, and the document-view architecture. It was a convenient development path. Now, the client is interested in converting this application to .Net. I would prefer (and they too) writing the new product in C#. The ...

How to implement high speed animation?

I'm trying to write an application (winforms) that can demonstrate how two oscillating colors will result in a third color. For this I need to be able to switch between two colors very fast (at >50 fps). I'm really hoping to do this in managed code. Right now I'm drawing two small rectangular bitmaps with solid colors on top of each ot...

Blackberry setting a clipping region/area

In J2ME we have the clipRect() and setClip() to clip a region in the Graphics area. What is the equivalent apis available in BlackBerry and how do we use it? ...

How to rotate an object in Java 3D?

I have a Cone I drew in Java 3D with the following code: Cone cone = new Cone(2f, 3f); Transform3D t3d = new Transform3D(); TransformGroup coneTransform = new TransformGroup(t3d); coneTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); t3d.setTranslation(new Vector3f(0f,0f,0f); coneTransform.setTransform(t3d); coneTransform...

Combined re-scaling and color reduction of an image in Java?

Given a rectangular input image I'd like to create an output image of size 40x40 pixels using a maximum of 10 colors. Hence, the two operatons needed are re-scaling and color reduction. The following ImageMagick command does the trick: convert input.png -scale 40x40 -colors 10 output.png How would you achieve the corresponding result...

Is understanding computer graphics necessary to become a good programmer?

I'm a self taught programmer that has tried to cover as many CS bases as possible: learning erlang to understand concurrency, lisp to understand functional programming, C & some assembly to understand hardware, etc. The one arena I've constantly avoided is computer graphics (other than using pre-made packages such as lattice in R). Do yo...

FillRectangle has no effect on Graphics from Bitmap?

I have code: using (Graphics g = control.CreateGraphics()) { Bitmap bm = new Bitmap(r.Width, r.Height, g); using (Graphics gbm = Graphics.FromImage(bm)) { gbm.FillRectangle(Brushes.Green, r); form.BackgroundImage = bm; form.BackgroundImageLayout = ImageLayout.Zoom; } } But that FillRectangle doe...

Auto scrolling or shifting a bitmap in .NET

I have a .NET GDI+ bitmap object (or if it makes the problem easier a WPF bitmap object) and what I want to to is shift the whole lot by dx,dy (whole pixels) and I would ideally like to do it using .NET but API calls are ok. It has to be efficient bacause its going to be called 10,000 times say with moderately large bitmaps. I have imp...

How might I convert a Rectangle to a RectangleF?

What is the easiest way to convert a Rectangle to a RectangleF in .NET? Edit: This sounds trivial and it is, but I was trying to save some typing. The best I could come up with: RectangleF rdest(rsrc.Location, rsrc.Size); // C++/CLI ...or... RectangleF rdest = new RectangleF(rsrc.Location, rsrc.Size) // C# ...