drawing

Is it possible to use OpenGL in a window that is already using GDI+ ?

Basically I am being called to render to an offscreen DC which is set up (I'm not sure how) to use GDI+. When I try to associate an OpenGL context with the DC, it just fails (i.e. returns zero but no error). SetPixelFormat also fails (probably because it is already set up?), again by returning zero, not an error. Anyone know whether i...

how to draw rectangle on java applet using mouse drag event

hi, i am using java. i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates. i have the following code. in the following code i am using [b]SelectionArea[/b] class which extends a canvas on which i am performing drawi...

Need a function to limit a line (known by its coordinates) in its length

Hello! I need a function which takes a line (known by its coordinates) and return a line with same angle, but limited to certain length. My code gives correct values only when the line is turned 'right' (proven only empirically, sorry). Am I missing something? public static double getAngleOfLine(int x1, int y1, int x2, int y2) { do...

How Windows (or other OSes) update client's background area?

Or to ask it another way, how OnEraseBkgnd() works? I'm building a custom control and I hit on this problem. Childs are rectangles, as usual. I had to disable OnEraseBkgnd() and I use only the OnPaint(). What I need is to efficiently clear the area behind the childs and without flickering. Techniques like using back buffers are not an o...

Drawing Unicode characters on iPhone

Why is it so hard to figure out how to draw Unicode characters on the iPhone, deriving simple font metrics along the way, such as how wide each imaged glyph is going to be in the font of choice? It looks like it'd be easy with NSLayoutManager, but that API apparently isn't available on the phone. It appears the way people are doing this...

Freeform drawing canvas (with shapes) in Java

Hello! I'm working on an GMF (RCP/EMF/GEF) application that allows users to create design diagrams. As part of that application, we have to allow the user to create their own custom shapes to add in diagrams. We are thinking of using SVG as the storage format for shapes. I'm looking for a Java library that creates such canvases and all...

How can I tell if a point is nearby a certain line ?

Hi there, I asked "How can I tell if a point belongs to a certain line?" before and I found a suitable answer so thank you very much. Now, I would like to know how to tell if a certain point is close to my line. ...

Empty UIView with minimal drawRect: overhead

Hi, I have an application that has three nested views that are mechanically important, but have no visual elements: A vanila UIView that doesn't have any content of its own, and is simply used as a host for CALayers. A UIScrollView (that is queried for it's origin and used to position CALayers in 3d: I really only use this view to fai...

Overriding paint of combobox using WndProc

Hi, I've overriden the WndProc of the ComboBox and I am drawing my own combo box, a code snippet is below: Protected Overrides Sub WndProc(ByRef m As Message) MyBase.WndProc(m) Select Case m.Msg Case &HF Dim g As Graphics = Me.CreateGraphics If ComboBoxRenderer.IsSupported Then ...

Drawing using DrawingContext over elements on canvas

I'm drawing a selection box when I click and drag on my canvas object (which extends Canvas). I have overridden the OnRender method like so: protected override void OnRender(DrawingContext dc) { base.OnRender(dc); DrawGrid(dc); DrawSelector(dc); } private void DrawSelector(DrawingContext dc) { if (Selecting) { dc.Dra...

Haskell graph drawing on Windows

Hi I'm using the Haskell platform on Windows and I'd like to write a small program which can draw graphs. The graph should be exported to any image format (or even PDF). What is the easiest way to accomplish this? (By graph I mean plot.) ...

Frame behavior in Delphi application issue

I have an application that uses a frame extensively and needs to hide/show certain buttons depending on which form is active at the time. In order to keep the buttons neat and organized appropriately, I have put them on panels and show or hide the panels as needed for each form. My problem is when each form is initially created, the pa...

Smooth animation in javascript

Is there a way to draw smooth animation in javascript? In directx I'm using the vertical synchronisation. Can I achieve this in a html canvas? ...

mouse followed drawing in C#

hey, I want to to make a shared drawing board in C#. This means that two people connected via a TCP connection can draw on this board. The idea (for now) is that people can click on the screen and draw. What do you think is the best method for this? It's easy enough to draw a dot when the user clicks on a certain spot, but it gets a lit...

How do I build a diagramming application in .NET?

I want to write a GUI seating application that allows users to draw and annotate simple "maps" of seating areas. The end result would probably look something a little like Visio, but specifically for manipulating my "seating" data model rather than producing files. In Java-land, there's the Graphical Editing Framework (GEF) -- is there...

what kind of software do you use to draw diagram for your presentation and report?

What kind of software do you use to draw diagram for your presentation and report? Suppose you want to draw a diagram to illustrate the TCP hand shake. I use visio, but the outcome is too plain. Is there any free software out there can draw diagrams better? Which can also have some 3D shapes or shadows? ...

WPF bug or am I going crazy?

I am seeing the weirdest bug with the following code. I have a PathGeometry to which I added a PathFigure so that I can add LineSegments to it. This is what I do: _pathGeometry.Figures.Add(_pathFigure); _pathFigure.StartPoint = new Point(4, 0); LineSegment lineSegment1 = new LineSegment(new Point(4, -10), true); LineSegment lineSegme...

What is the best way to change the color "pixel by pixel" on iPhone?

Hi, I have a game which is an iPhone adaptation of this game. Here my ship makes paths and then the enclosed path gets filled if there is no enemy present in that enclosed area. I have taken the playField as a 2D array (int playField[300][300]). When the color of the enclosed path needs to be changed to show that it is filled, the p...

In WPF how can you draw a line over a WindowsFormsHost?

Here is my XAML <Grid Name="grid"> <TextBlock Text="Some Label" /> <WindowsFormsHost Name="winFormsHost"> </WindowsFormsHost> </Grid> On the load of the form I execute the following method protected void OnLoad(object sender, RoutedEventArgs e) { // Create a line on the fly Line line = new Lin...

Does the dot Directed Graph allow for subgraphs with a different rankdir?

Using the dot directed graph language, is it possible to create subgraphs with a different rankdir? I tried the following, which didn't work. Both graphs were left to right, despite the presence of rankdir="TB" in the subgraph. digraph g { rankdir="LR"; LEFT->RIGHT; clusterrank="local"; subgraph cluster1 { rankdir="TB"; ...