graphics

How to force Mac window to foreground?

How can I programmatically force a mac window to be the front window? I have the window handle, and want to ensure that my window is displayed above all other windows. I can use both Carbon & Cocoa for this. ...

Drawing line graphics leads Flash to spiral out of control!

Hi, I'm having problems with some AS3 code that simply draws on a Sprite's Graphics object. The drawing happens as part of a larger procedure called on every ENTER_FRAME event of the stage. Flash neither crashes nor returns an error. Instead, it starts running at 100% CPU and grabs all the memory that it can, until I kill the process ma...

Sprite array list never works! Need help understanding how to create arrays of class instances in JAVA

// Particle Stuct Instance private Sprite[] mParticles = new Sprite[10]; /// Particle emitter Properties private Context mContext; private int mPositionX, mPositionY, mWidth, mHeight, mNumParticles; private Rect srcRect, dstRect; /*** Constructor ! ***/ public ParticleEmitter(Context c, Sprite spriteImage, int num_particles) { ...

Binding scattered/overlapping images to a WPF Canvas

I am porting a GDI application over to WPF, where I displayed several dozen images onto Form, then drew polygons, circles, rectangles, etc over the top of these images using GDI Pens and Brushes. I'm starting to get the hang of WPF binding and would like to store all of these images and markup graphics in my ViewModel. My VM contains a...

How to delete Drawn Line in java?

Hello Folks, well this is my code: import javax.swing.*; import javax.*; import java.awt.*; import java.awt.Color; import java.awt.Graphics.*; import java.awt.event.*; import javax.swing.UIManager; public class SimpleGUI extends JFrame{ public SimpleGUI(){ this.setDefaultCloseOperation(JFrame.EXIT_O...

Android drawCircle's are not always 360 degrees

When I call drawCircle (ex. canvas.drawCircle(x, y, r, mPaint);) and I use Paint Style STROKE to initialize param #4 mPaint, the result doesn't quite make a full 360 degree (2*PI radian) circle in all cases. Sometimes you get a full circle (as I would expect) and sometimes only an arc. Does someone have an idea what would cause this t...

Built in colormaps in Matlab

I want a lighter version of the "cyan" color, using the function colormap('cyan'). How do you do this? ...

Evaluating and graphing functions in MATLAB

I am trying to graph the following Gaussian function in MATLAB (should graph in 3 dimensions) but I am making some mistakes somewhere. What is wrong? sigma = 1 for i = 1:20 for j = 1:20 z(i,j) = (1/(2*pi*sigma^2))*exp(-(i^2+j^2)/(2*sigma^2)); end end surf(z) ...

Using my custom colormap in Java for images

Hi everyone! I've got a question concering a colormapping via index. I tried this code found on http://www.podgoretsky.pri.ee/ftp/Docs/Java/Tricks%20of%20the%20Java%20Programming%20Gurus/ch12.htm // Gradient.java // Imports import java.applet.Applet; import java.awt.*; import java.awt.image.*; public class Gradient extends Appl...

Is it possible to dither a gradient drawable?

I'm using the following drawable: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:startColor="@color/content_background_gradient_start" android:endColor="@color/content_background_gradient_end" ...

How do I change the Unit:Characters in Matlab?

For portability, I set the units of my GUIs to 'characters'. Now I have a user who wants to use Matlab on his netbook, and the GUI window is larger than the screen (and thus cropped at the top). I think I could try and write something in the openingFcn of the GUI that measures screen size and then adjusts the GUI accordingly, but I'd r...

How to keep text inside a circle using Cairo?

I a drawing a graph using Cairo (pycairo specifically) and I need to know how can I draw text inside a circle without overlapping it, by keeping it inside the bounds of the circle. I have this simple code snippet that draws a letter "a" inside the circle: ''' Created on May 8, 2010 @author: mrios ''' import cairo, math WIDTH, HEIGHT =...

Tracking object entries when "playing" a Windows Enhanced Metafile

One of my current projects requires that I work out what colours are being used in an EMF file. I have been able to successfully whip up a file parser in C# that notes all references to colours... but haven't had any luck tracking which objects are in use across the entire file so I can apart colours that are referenced from colours tha...

Generate 2D cross-section polygon from 3D mesh

I'm writing a game which uses 3D models to draw a scene (top-down orthographic projection), but a 2D physics engine to calculate response to collisions, etc. I have a few 3D assets for which I'd like to be able to automatically generate a hitbox by 'slicing' the 3D mesh with the X-Y plane and creating a polygon from the resultant edges. ...

How do I keep from running out of memory on graphics for an Android app?

I've been working on an Android app in Eclipse, and so far, my program hasn't really grown past midget size. However I've already run into an issue with an Out of Memory error. You see, I've been using graphics comprised solely of bitmaps and PNGs in this program, and recently, when I tried to add a little bit more functionality to the...

DirectX capabilities on different graphics cards

I'm writing a Direct3D application, using DirectX 9. Although it works on my PC, I need to make it work on a wide range of systems. I need to know what capabilities I can expect to see on other systems. Is there a list of the DirectX capabilities that graphics cards support? I've found one site, which I'll post as an answer, but it's...

Where do you find images and graphics designers for your softwares ?

Possible Duplicate: Where can one find free software icons / images? Hi, As a programmer, I'm sure some of you already experienced the same problem: You create a good software (free, open-source, or for friend-only diffusion, whatever) relying on good code and good ideas but since you're a programmer and not an image designe...

Why should "miter" joints be slower than others?

I'm having a graphics problem on drawing lines in Flash Player, where two lines drawn on top of each other with different thickness don't align properly if I use any other JointStyle than MITER. For pictures of the effect, and for the graphics oriented part of the question, see my post over on doctype. However, there's also a second ang...

Screenshot of the Nexus One from adb?

My goal is to be able to type a one word command and get a screenshot from a rooted Nexus One attached by USB. So far, I can get the framebuffer which I believe is a 32bit xRGB888 raw image by pulling it like this: adb pull /dev/graphics/fb0 fb0 From there though, I'm having a hard time getting it converted to a png. I'm trying with ...

Rotate an image around the Y-Axis in Java?

I need to rotate a 2d sprite about the y axis. E.g., I have a 2d top-view sprite of an aircraft. When the user turns the aircraft the wings should tilt into (or out of) the screen to show that it is turning. Is there a way to put the image into java3d, rotate it, and then put it back into a buffered image? Or maybe somehow knows how t...