graphics

How to move a Shape on Canvas in WPF ?

Hi, I added a Rectangle to a Canvas like this: Canvas.SetTop(myRectangle, 150); Canvas.SetLeft(myRectangle, 80); canvas.Children.Add(myRectangle); Now I want to move the rectangle to other place, say (100, 100). What is the best way to do this ? Thanks ! ...

Hit Testing in WPF

Hi, I have an Ellipse on a Canvas and I'm doing a Hit Testing on it. Every time I click the stroke of the Ellipse, the test pass. If I click in the middle of the Ellipse, the test fails. This is good ! After I fill the ellipse like this: myEllipse.Fill = new SolidColorBrush(Colors.Blue); the test pass also when I click in the middle of t...

Drawing lines in win32/GDI with a custom pen style?

I have a need to do some drawing using win32/GDI (Native, not .NET), and I've run into the following problem: I need to draw lines that are "styled." For example, in the attached image, the line marked "A" is a straight line as far as my application data is concerned, it just needs to be drawn with the additional zigzag as a style. Of c...

Constructive solid geometry mesh

If I construct a shape using constructive solid geometry techniques, how can I construct a wireframe mesh for rendering? I'm aware of algorithms for directly rendering CSG shapes, but I want to convert it into a wireframe mesh just once so that I can render it "normally" To add a little more detail. Given a description of a shape such a...

Free or Open Source Diagramming Component for Winforms

I need to be able to generate dependency diagrams programmatically. I'd like it to be able to generate a bunch of boxes with labels and connectors linking them, and ideally the component would position them automatically onto a design surface which could then be manually rearranged. I'm using Winforms and C# 2.0 (VS2005). EDIT: Howeve...

Ogre material scripts; how do I give a technique multiple lod_indexes?

I have an Ogre material script that defines 4 rendering techniques. 1 using GLSL shaders, then 3 others that just use textures of different resolutions. I want to use the GLSL shader unconditionally if the graphics card supports it, and the other 3 textures depending on camera distance. At the moment my script is; material foo { lod_...

Draw text with a stroke onto an image in .Net

I am currently using the System.Drawing.Graphics.DrawString() method in .Net to draw text on top of an image, and then save it to a new file: // define image file paths string sourceImagePath = HttpContext.Current.Server.MapPath("~/img/sourceImage.jpg"); string destinationImagePath = HttpContext.Current.Server.MapPath("~/img/") + "final...

GraphViz - How to connect subgraphs?

In the DOT language for GraphViz, I'm trying to represent a dependency diagram. I need to be able to have nodes inside a container and to be able to make nodes and/or containers dependent on other nodes and/or containers. I'm using subgraph to represent my containers. Node linking works just fine, but I can't figure out how to connect s...

Generate vector EMF/WMF (Windows Metafile) clipboard content from Qt 4.5

We are moving a large codebase from GDI to QPainter. One thing we used to get on Windows easily was the EMF clipboard format, which enabled customers to manipulate their pasted output in other programs (like Office) in a vector format. It's easy for us to produce bitmaps from Qt into EMF, but that really doesn't give us back the editabi...

SetWorldTransform() and font rotation

I'm trying to display text on a Windows control, rotated by 90 degrees, so that it reads from 'bottom to top' so to speak; basically it's the label on the Y axis of a graph. I got my text to display vertically by changing my coordinate system for the DC by using SetGraphicsMode(GM_ADVANCED) and then using XFORM transform; const double ...

Android - ClipDrawable, ScaleDrawable, how does it work?

I'm having quite a problem here and I hope for someone here to able to help me. let's go. Let's say, I have quite a big image ( 1500x2000 ), i load it as a drawable, fine so far. Now I have a SurfaceView and I want to draw a certain region ( lets say the top-left-most region ) onto a canvas, in a non-scaled version. I thought using Cli...

Cross Platform C library for GUI Apps?

Free of charge, simple to learn/use, Cross Platform C library for GUI Apps? Am I looking for Qt? Bonus question: Can I develop with the said library/toolkit on Mac then recompile on PC/Linux? Super Bonus Question: Link to tutorial and/or download of said library. (RE)EDIT: The truth is that I'm in the process of catching up on the C...

How to make form rounded rectangle or round or triangle

I am developing an application in C# and there is a requirement of the form of the main window in rounded rectangle or some times triangle type or round shape. so, how can I achieve this kind of features in C# 2008 ...

How to generate events from graphics generated by Java2D

I have made an Ellipse with the help of java.awt.geom.Ellipse2D Now, I want that whenever user clicks on that ellipse, an event is generated so that I can listen to that event and peform subsequent tasks based on the ellipse which generated that event. ...

The legacy device context is too coarse.

Hi. I have a Process Control system. It has a huge 2D workspace where all the logic is laid out. The 2D workspace is a coordinate system. You usually do not see the whole workspace at once, but rather some in-zoomed part of it focusing on some part of the controlled process. Such subsystem views are bookmarked into predefined named ima...

Where is the Shape located on Canvas ?

Hi, Say I put a Shape on a Canvas like this: Canvas.SetLeft(myShape, 50); Canvas.SetTop(myShape, 30); canvas.Children.Add(myShape); After that, myShape was drag & dropped on this Canvas. How can I determine the current myShape coordinates ? For example, before the drag & drop I would like to get (50,30). Thanks ! ...

beamer includegraphics with screenshots

Hi, I'm using the LaTeX-Beamer class for making presentations. Every once in a while I need to include screenshots. Those graphics are pixel-based, of course. I use includegraphics like this: \begin{figure} \includegraphics[width= \paperwidth]{img/analyzer.png} \end{figure} or usually something like this: \begin{figure} \incl...

Line Drawing Algorithm

I wrote a line drawing algorithm using the wu technique. It works but has issues. See below. What I'm wondering is if anyone has tackled the problem of drawing anti-aliased lines? Suprisingly, a google search results in no satisfactory algorithms. Lots of discusions, but not a single complete, robust algorithm, independent of any dep...

If window spans multiple monitors, I can't draw to it.

If I have a window that spans both monitors on a multimonitor system, I can't seem to erase (paint black) the entire window. Instead, only the primary window is drawn black. The secondary remains the original white color. Has anyone seen this behavior? wxwidgets: wxClientDC dc(this); Erase(dc); void SpriteWindowFrame::Erase(wxDC& d...

Problem in generating the border of a rectangle in Java?

I am using java.awt.geom.Rectangle2D.Double class to generate a rectangle. I want to generate a rectangle which is filled with a color (say green) and have a border (outline). Now the problem is if I call g2.draw(new Rectangle2D.Double(....)); // g2 is an instance of Graphics2D then it doesn't fill the rectangle and when I call g2.f...