graphics

How do I intialize a Graphics object in Java?

this is the code: import java.awt.*; import java.applet.*; public class anim1 extends Applet{ public void paint (Graphics g) { g.drawString("",400,300); } public static void main(String ad[]) { anim1 a=new anim1(); Graphics g1; a.paint(g1); } } It says that g1 is not initializ...

Content of a WPF button - unable to put anything but text

I designed a nice STOP graphic with red bg and gradient and all that in Expression Design - just like it'll look on a real taperecorder or something. I exported it as a XAML WPF Resource dictionary and got the XAML code. I want this graphic to appear inside the button along with the text "STOP". If I directly paste the XAML inside the...

Java image display

I am trying to create a GUI that will coexist with several images. There is one background image that will take up the most room. On top of the background image several other images will be displayed in varying locations. These locations will be updated every 5 seconds or so, so speed is not a huge factor. So all I need is the ability ...

Plotting a large number points / lines with zoom

I need to display a graph with thousands of nodes so that the user can scroll and zoom to view it. The nodes need to behave like dimensionless points, and the edges, like one-dimensional lines. That is, zooming in, the circles representing the nodes move farther apart but each one stays the same size, and the lines connecting them get ...

Overlapping System.Drawing.Graphics objects

I have a WinForms control on which I want to display two things: An underlying image painstakingly loaded bit-by-bit from an external input device; and A series of DrawLine calls that create a visual pattern over that image. Thing #1, for our purposes, doesn't change, and I'd rather not have to redraw it. Thing #2 has to be redrawn ...

How to draw a circle in Flex MXML file?

In my MXML file, I have a tab navigator with three vboxes. <mx:TabNavigator width="624" height="100%"> <mx:VBox label="Currents Quote" width="100%"> </mx:VBox> <mx:VBox label="Quote Comparison" width="100%"> </mx:VBox> <mx:VBox label="Reports" ...

Drawing graphics in java (netbeans ide)

I created a new JApplet form in netbeans: public class UI extends javax.swing.JApplet { //generated code... } And a jpanel in design mode named panou: // Variables declaration - do not modify private javax.swing.JPanel panou; How do I get to draw a line on "panou"? I've been searching for this for 5 hours n...

Scale an image nicely in Delphi?

I'm using Delphi 2009 and I'd like to scale an image to fit the available space. the image is always displayed smaller than the original. the problem is TImage Stretch property doesn't do a nice job and harms the picture's readability. I'd like to see it scaled like this instead: Any suggestions how best to do this? Tried JVCL, ...

Flex Panel not being updated

I am drawing a cellular automaton simulation on a Flex Canvas. I alternate computing the state of the automaton with updating the graphics on the Panel. However, the updating of the Panel does not seem to be "keeping up" with the update of the CA state. I'm wondering whether I am doing something wrong with my handling of the graphics ...

How to draw a JPanel on a canvas?

Hi, is there a possibility to draw a JPanel on a specific location op a Graphics (or Graphics2D) object? I override the paint method of my canvas, and call panel.paint(g) in there, but it does not work the way I woul hope. @Override public void paint(Graphics g){ Dimension size = panel.getPreferredSize(); panel.setBounds(pos.x, pos...

Glossy buttons in Flex 3

Any ideas how to create a button class that looks something like this: Taken from this tutorial page. I'm struggling to figure out what combination of filters I need to use to achieve the glossy effect. The rounded corners and bevel/glow effect are simple enough. But how can I add a gloss gradient over only the top half of the button...

What's a good pixelation algorithm in C# .NET?

What is a good algorithm for pixelating an image in C# .NET? ...

How do I get access to an image of the desktop buffer in .NET ?

I am making a very simple app in C# with Visual Studio, so I'm using that Forms package. I need to get access to an image of everything below it, so that I can manipulate the image. How can I do this? It doesn't have to be real time very much, since I'll probably be polling it not more than say 10fps. ...

Simulate 3D space in 2D

I'm starting to code my first game and I want to make simple 2D sprite game. However I want to simulate 3D space & physics and am searching for some tutorial/guide/algorithms that would teach me the basics... but so far without luck. Do you have any recommendations? Books? I don't care about programming language, any language will do as...

WPF / XAML - Can text be auto sized?

For a fixed size wrappable text area, is there any way to make the font size as large as possible based on the amount of text? For example, if you have a 500x500 area with the text "Hello", the font size would be really big. But if you have a paragraph of text the font size would be smaller to fit into the area. I have looked at Viewb...

c# wpf 2d graphics - Looking for tutorial / examples

Hello ! Could you please point me to a good C# tutorial for drawing 2d graphics like Ellipse and Rectangle (that inherit from Shape) on a Canvas using WPF ? I'm also interested later to click on shapes and identify which shape was clicked, and also to drag and drop shapes on the canvas. Thank you ! ...

Turning system.drawing.drawing2d.graphics into .avi file?

I have a .NET program that does some displaying by drawing on a system.drawing.drawing2d.graphics object. I'd like to be able to turn each "frame" drawn into a frame in an .avi file. Are there AVI classes in .NET? Some simple way to get the bitmap that must underlie the graphics object? Thanks in advance. ...

WPF 3D Hollow Cube With Painted Edges

Hello, I'm am trying to draw a cube which only the edges are shown. I followed this example: http://stuff.seans.com/2008/08/13/drawing-a-cube-in-wpf/ but I couldn't modify it to create a transparent cube with painted edges. Any ideas how to do so? Thanks, Ronny ...

How to change the stroke style ?

Hi, Consider this code: Ellipse myCircle = new Ellipse(); myCircle.Width = 400; myCircle.Height = 400; myCircle.Stroke = Brushes.PeachPuff; myCircle.StrokeThickness = 25; myCircle.ToolTip = "Bold Circle"; Canvas.SetTop(myCircle, 0); Canvas.SetLeft(myCircle, 0); canvas.Children.Add(myCircle); Ellipse myCircle2 = new Ellipse(); myCircle...

Drag & Drop Shapes on Canvas

Hi, I put several shapes (like Ellipse and Rectangle) on a Canvas. Now, I want user to be able to drag & drop these shapes. Is there some predefined functionality that I can use, or I should implement the drag & drop myself using the mouse events ? Thanks ! ...