graphics

GDI+: How do I draw a line that's one inch in length on any device it's drawn on?

I need to draw a line one inch long on any device given a Graphics reference to it. I need it to be an inch long regardless of what Transform is set to. Let's assume that the scaling factor of the transform is given by scale in both horizontal and vertical directions. Some C++/CLI code: g->DrawLine(Pens::Black, 50.0f, 50.0f, 50.0f + on...

Rasterizing a 2D polygon

I need to create a binary bitmap from a closed 2D polygon represented as a list of points. Could you please point me to efficient and sufficiently simple algorithms to do that, or, even better, some C++ code? Thanks a lot! PS: I would like to avoid adding a dependency to my project. However if you suggest an open-source library, I can ...

How to Draw Two Detached Rectangles in DirectX using the D3DPT_TRIANGLESTRIP Primitive Type

I am new to DirectX and I am trying to draw two rectangles in one scene using D3DPT_TRIANGLESTRIP. One Rectangle is no problem but two Rectangles is a whole different ball game. Yes i could draw them using four triangles drawn with the D3DPT_TRIANGLELIST primitive type. My curiosity is on the technic involved using D3DPT_TRIANGLESTRIP. P...

Double buffering in BlackBerry?

Do we need to do double buffering in BlackBerry while rendering our paint code or does BlackBerry handle that? If we need to do that ourselves, how do we do that? ...

Graphical interface buttons in Cocoa

Sitution: Newbie with interface for a music app. I have 2 large images, one the master 'up' or normal view, the other the complete 'down' view. (Buttons all pressed, lit, etc, LED's on, etc). Might have a couple smaller images as well to copy over. In Carbon, and old Mac OS, I would load up 2 GWorlds with each image, then use Copybits t...

How to set Anti Aliasing in Blackberry Storm?

I m drawing in a bitmap like.. bitmap[i] = new Bitmap(60, 60); Graphics g = new Graphics(bitmap[i]); g.setColor(Color.BLACK); g.drawLine(....); Now how to set Anti-Aliasing on before g.drawLine()? ...

Creating SVGs using Python

I'm building a set of SVG files that include an unfortunate number of hardcoded values (they must print with some elements sized in mm, while others must be scaled as a percent, and most of the values are defined relative to each other). Rather than managing those numbers by hand (heaven forbid I want to change something), I thought I mi...

Making pictures look inset.

Hi, I wonder if anyone has an idea how you have to transform an image such that it looks "inset" to the context? I need the effect for an application I am writing, but I am not sure what the exact workflow is to achieve the effect mentioned above. Best regards, heinrich ...

Qt jpg image display

I want to display .jpg image in an Qt UI. I checked it online and found http://doc.trolltech.com/4.2/widgets-imageviewer.html. I thought Graphics View will do the same, and also it has codec to display video. How to display images using Graphics View? I went through the libraries, but because I am a totally newbie in Qt, I can't find a c...

Newell's Method to Calculate Plane Equation of Concave Polygon - Improvements?

3 points are needed to define a plane. Newell's method is known to fail if the 3 points are chosen around a concave corner - the normal of the resulting plane will point in the direction opposite to the expected one. Are there any improvements to Newell's method that help in choosing a valid starting point? Or is there an alternative ...

WPF 3-D performance for head-tracking app

I’m working on creating a full-screen 3-D app (based on Johnny Lee's Wii head tracking app) with some augmented reality features, and it seems that WPF is too slow to render even the simple models I’m using at a reasonable frame rate. I think the problem is that I need to change both the view and projection of the camera on just about ev...

NSBezierPath / Line Intersection / flatten

Hello, I'm currently porting my jruby/java2d Graph Drawing/Layouting application to macruby/cocoa. Therefore I need to get the intersection point of an open NSBezierPath with an closed NSBezierPath. In java2d I used the following trick. I flattened both paths and did a simple line intersection test for each segment. So is there a sim...

Java howto paint on a graphic in an order I want

Hello In C# I saw already the SpriteBatch class (In the XNA plugin for XBOX games). In that class is it posible to paint in layers. Now I want to do the same in Java because I'm making braid (See my other questions) and I have an ArrayList from all the GameObjects and that list is not made in the correct paintoreder. For exemple: I ha...

Opengl Selective glClipPlane

I have a scene drawn in openGL (openGl 1.1 win32). I use glClipPlane to hide foreground objects to allow the user to see/edit distance parts. The selection is done natively without using openGL. But the glClipPlane applies to all openGL elements - coordinate icons, gridlines etc and even elements drawn in gluOrtho2D on top - scale bars...

Allocation memory for display

I am trying to create a graphics library... i need to int NewDisplay(Display **display, DisplayClass dispClass, int xRes, int yRes) { /* create a display: -- allocate memory for indicated class and resolution -- pass back pointer to Display object in display */ return SUCCESS; } How can i allocate memory to class and to t...

What resolution should my iPhone app ICON be?

What image resolution can/should be used as the icon.png file for an iphone app? I know the size is 57 x 57 but what about the resolution? Links to specific documentation relating to iphone app icon design would also be helpful. ...

how to make java JPanel and graphics2d transparent?

Hi all, Well the title is quite self explanatory. I want to build two panels one on-top of each other in layers using java. I want the top layer to contain a JPanel which will contain a graphics2d object. I'd like both the JPanel and graphics2d to have transparent background (I still want the content drawn by the graphics2d visible). Do...

How can I find the intersecting point of three planes?

I'm trying to build render the raw data from a Quake 3 .map file with Java. The .map format stores brush (shape) information as a series of planes, but I'd like to convert them to points of the form (x,y,z). The math involved is a bit beyond me at this point, so does anyone have any advice on how I can do this? I'm fine with using ext...

Easy way to display a continuously updating image in C/Linux

Hi, I'm a scientist who is quite comfortable with C for numerical computation, but I need some help with displaying the results. I want to be able to display a continuously updated bitmap in a window, which is calculated from realtime data. I'd like to be able to update the image quite quickly (e.g. faster than 1 frame/second, preferab...

Is it possible to break axis labels into 2 lines in base graphics?

I am trying to have the x-axis labels to be split into two lines. I would also like the labels to be rotated 45 degrees. How can I do this? What I have so far: N <- 10 dnow <- data.frame(x=1:N, y=runif(N), labels=paste("This is observation ",1:N)) with(dnow, plot(x,y, xaxt="n", xlab="")) atn <- seq(1,N,3) axis(1, at=atn, labels=labels[...