graphics

C#: Graphics DrawString to Exactly Place Text on a System.Label

I have overridden the OnPaint method of my Label control in VS2008: void Label_OnPaint(object sender, PaintEventArgs e) { base.OnPaint(e); Label lbl = sender as Label; if (lbl != null) { string Text = lbl.Text; e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; if (myShowShadow) { // draw the ...

Optimally place a pie slice in a rectangle.

Given a rectangle (w, h) and a pie slice with a radius less or equal to the smaller of both sides (w, h), a start angle and an end angle, how can I place the slice optimally in the rectangle so that it fills the room best (from an optical point of view, not mathematically speaking)? I'm currently placing the pie slice's center in the ce...

(C#) graphics.drawImage has a size limit? How to deal with it?

I am attempting to display a very large graphical representation of some data. I am using a bitmap for persistent storage of the image and e.Graphics.DrawImage(myBitmap, new Point(0,0)) in the onPaint of a PictureBox control on my form. I have noticed (and heard mentioned on other sites) that if my image has a height or width greater t...

Coding self similar fractals in computer graphics using C

Can anyone help me with the programming code for self similar fractals in computer graphics using c language? ...

How can I tell if a closed path contains a given point?

In Android, I have a Path object which I happen to know defines a closed path, and I need to figure out if a given point is contained within the path. What I was hoping for was something along the lines of path.contains(int x, int y) but that doesn't seem to exist. The specific reason I'm looking for this is because I have a collecti...

Is there a way to capture a bitmap from a WPF window using native C++?

Imagine a document window in a MDI application which contains a child WPF window, say a sidebar for example. How can one get a bitmap containing both the WPF pixels AND the GDI (non-wpf) pixels? I've discovered that when making my thumbnail preview for the Win7 taskbar app icon hover, I get black in the parts of the preview where the WP...

rendering an antialiased spiral

I have looked at this example using php and GD to piecewise-render a spiral with small arcs. What I would like to do is render an approximation to a spiral that is as mathematically accurate as possible. Inkscape has a spiral tool that looks pretty good, but I would like to do the spiral generation programmatically (preferably in Python...

Displaying a rotated string - DataGridView.RowPostPaint

I want to display a lengthy rotated string in the background of one of my rows in a DataGridView. However, this: private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { if (e.RowIndex == 0) { ... //Draw the string Graphics g = dataGridView1.CreateGraphics(); ...

How do I prevent jagged edges alongside the surfaces of my 3d model?

Lets say I've implemented in openGL a crude model viewer with shading which renders a series of blocks, such that I have something that looks like this. http://i.imgur.com/TsF7K.jpg Whenever I rotate my model to the side, it causes an unwanted jagged effect along any surface with a steep viewing angle. http://i.imgur.com/Bgl9o.jpg I'...

How to generate irregular ball shapes?

What kind of algorithms would generate random "goo balls" like those in World of Goo. I'm using Proccesing, but any generic algorithm would do. I guess it boils down to how to "randomly" make balls that are kind of round, but not perfectly round, and still looking realistic? Thanks in advance! ...

OpenGL Video RAM Limits

I have been trying to make a Cross-platform 2D Online Game, and my maps are made of tiles. My tileset, which I render the tiles from, is quite huge. I wanted to know how can I disable hardware rendering, or at least making it more capable. Hence, I wanted to know what are the basic limits of the video ram, as far as I know, Direct3D has ...

Tips for efficient GLSL code

Are there any guidelines for writing efficient shaders in GLSL? Does the compiler handle most of the optimization? ...

".OFF" descriptions

I'd like to make a scene that uses meshes and primitives (such as spheres, cylinders, boxes, etc). I was wondering if there are any recommendations with regard to where I can go to find .off files that describes complex meshes, such as mountains, rocks, trees, animals, etc. ...

Is there any HTML code that would display an ellipse or a rounded rectangle?

Hello, I am not sure if it's possible at all in HTML, but I would still ask it here: Is there any HTML code that would stand for an ellipse or a rounded rectangle? ...

How to blit() in android?

I'm used to handle graphics with old-school libraries (allegro, GD, pygame), where if I want to copy a part of a bitmap into another... I just use blit. I'm trying to figure out how to do that in android, and I got very confused. So... we have these Canvas that are write-only, and Bitmaps that are read-only? It seems too stupid to be re...

Does the iPhone 3G/3Gs camera put metadata in its images? (and how do you get it?)

I've been trying to figure how whether the iPhone (either 3G or 3Gs) camera puts metadata into it's images. Anecdotally, it appears that it does (e.g., I've seen images posted on the web that included a bunch of metadata), but I can't find reference to it anywhere in the SDK documentation. So....does anyone have a definitive answer? A...

Cooresponding CopyResource method in D3D9

Hi, guys, I know it's easy to copy vertex/index buffer in D3D10 with IDirect3D10::CopyResource(...) interface. How to do the same work in D3D9? Is there any similar API for this? ...

Cast Graphics to Image in C#

I have a pictureBox on a Windows Form. I do the following to load a PNG file into it. Bitmap bm = (Bitmap)Image.FromFile("Image.PNG", true); Bitmap tmp; public Form1() { InitializeComponent(); this.tmp = new Bitmap(bm.Width, bm.Height); } private void pictureBox1_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawIma...

How does the "Unlimited Detail" graphics technology work?

So I stumbled upon this "new" graphics engine/technology called Unlimited Detail. This seems to be pretty interesting granted it's real and not a fake. They have some videos explaining the technology but they only scratch the surface. What do you think about it? Is it programmatically possible? Or is it just a scam for investors? U...

When should a uniform be used in shader programming?

In a vertex shader, I calculate a vector using only uniforms. Therefore, the outcome of this calculation is the same for all instantiations of the vertex shader. Should I just do this calculation on the CPU and upload it as a uniform? What if I have ten such calculations? If I upload a lot of uniforms in this way, does CPU-GPU communicat...