graphics

Resizing gif images

I have a gif image 720 * 40 pixels used as a footer on a website. I need to extend the height of the gif by 10 pixels. I was unable to resize to this, using Office Picture Manager. What is the best way to achieve this? ...

correcting fisheye distortion programmatically

BOUNTY STATUS UPDATE: I discovered how to map a linear lens, from destination coordinates to source coordinates. I actually struggle to reverse it, and to map source coordinates to destination coordinates. What is the inverse, in code in the style of the converting functions I posted? I also see that my undistortion is imperfect ...

How can I modify the icon on a treenode in C#, such as reducing opacity, etc?

I want to be able to dynamically modify the image in a c# treeview. Specifically, I would like to reduce the opacity in certain cases of certain images. I know that I can add extra icons to the imagelist that is bound to the treeview, but as cases like this add up, the extra icons will get to be too much. Is there a way to access the ...

line is erasing in java

I make an Application in java and draw rectangle. When I search from combobox the rectangle is under the combobox and when I close combobox some parts of the rectangle which was under the combobox is deleted. How can I make rectangle to be visible after the combobox was closed. ...

deleting HBITMAP causes an access violation at runtime.

Hi, I have the following code to take a screenshot of a window, and get the colour of a specific pixel in it: void ProcessScreenshot(HWND hwnd){ HDC WinDC; HDC CopyDC; HBITMAP hBitmap; RECT rt; GetClientRect (hwnd, &rt); WinDC = GetDC (hwnd); CopyDC = CreateCompatibleDC (WinDC); //Create a bitmap compatible with the DC hBitmap = Cre...

Why does this thumbnail generation code throw OutOfMemoryException on large files?

This code works great for generating thumbnails, but when given a very large (100MB+) TIFF file, it throws OutOfMemoryExceptions. When I do it manually in Paint.NET on the same machine, it works fine. How can I improve this code to stop throwing on very large files? In this case I'm loading a 721MB TIF on a machine with 8GB RAM. The Ta...

Millions of 3D points: How to find the 10 of them closest to a given point?

A point in 3-d is defined by (x,y,z). Distance d between any two points (X,Y,Z) and (x,y,z) is d= Sqrt[(X-x)^2 + (Y-y)^2 + (Z-z)^2]. Now there are a million entries in a file, each entry is some point in space, in no specific order. Given any point (a,b,c) find the nearest 10 points to it. How would you store the million points and how w...

How do I create a "jumping" circle in Java GUI?

I would like to have a red filled circle at some place in my window. After the click on the circle, the circle should jump from the original place to a new one (disappear from the old place and appear on the new one). What would be the best way to do it? I also would like to know how to draw a filled circle in Java. Are there any simple...

Why do my buttons stay pressed?

In my activity I respond to an onClick() by replacing the current view with a new one (setContentView()). For some reason when I do this and then go back to the original view later the button I originally pressed still looks like it is pressed. If you 'refresh' it somehow (e.g. scroll over it with the trackball) then it reverts to the u...

Java Graphics disable xor mode

Hello, I know that g.setXORMode(Color c) enables XOR mode drawing. But how to disable this mode after setXORMode call? ...

pyopengl: Could it replace c++ ?

Hi everyone. I'm starting a computer graphics course, and I have to choose a language. Choices are between C++ and Python. I have no problem with C++, python is a work in progress. So i was thinking to go down the python road, using pyopengl for graphics part. I have heard though, that performance is an issue. Is python / pyopengl ma...

Flex: Why is line obscured by canvas' background

I want MyCanvas to draw lines on itself, but they seem to be drawn behind the background. What's going on and how should I do this? Main.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:my="*"> <my:MyCanvas width="300" height="300" id="myCanvas"></my:MyCanvas> <mx:Butto...

How to scan convert right edges and slopes less than one?

I'm writing a program which will use scan conversion on triangles to fill in the pixels contained within the triangle. One thing that has me confused is how to determine the x increment for the right edge of the triangle, or for slopes less than or equal to one. Here is the code I have to handle left edges with a slope greater than one...

context.scale() with non-aspect ratio preserving parameters screws effective lineWith

I am trying to apply some natural transformations whereby the x axis is remapped to some very small domain, like from 0 to 1, whereas y is remapped to some small, but substantially larger domain, like 0 to 30. This way, drawing code can be nice and clean and only care about the model space. However, if I apply a scale, then lines are a...

Graphics library used by Windows Vista Freecell and Solitaire

What graphics library is used to create the graphics in the Solitaire and Freecell games included with Windows Vista (e.g. XNA, GDI, WPF)? A good answer would include the name of the library and evidence. I looked at solitaire.exe with dependency walker and it shows many calls to gdi32.dll and gdiplus.dll, but also a call to Direct3DCr...

Unexplained crashs with coregraphic

Hello there, i'm on this bug for a week now, and i can't solve it. I have some crash with coregraphic calls, it happen randomly (sometimes after 2 mn, or just at the start), but often at the same places in the code. I have a class that just wrap a CGContext, it have a CGContextRef as member. This Object is re-created each time DrawRect(...

Interpolating height for a point inside a grid based on a discrete height function.

Hi, I have been wracking my brain to come up with a solution to this problem. I have a lookup table that returns height values for various points (x,z) on the grid. For instance I can calculate the height at A, B, C and D in Figure 1. However, I am looking for a way to interpolate the height at P (which has a known (x,z)). The lookup...

What is the simplest algorithm for mesh generation of an arbitrary quadrilateral?

What is the simplest algorithm for decomposing a quadrilateral into an arbitrary number of triangles? ...

What would you recommend to do simple 2D Graphics?

I want to build a program that will (as part of what it's doing) display lines organically growing and interacting horizontally across the screen. Here's a sample image, just imagine the lines sprouting from the left and growing to the right: The lines would look like the lines used on Google Maps Transit Overlay or OnNYTurf's transi...

Draw 2 parallel lines

How can I calculate the points to draw 2 parallel lines. I know the start and end points for the centre of the parallel lines. To makes thing a little bit harder, it needs to support straight and Bezier curved lines. ...