graphics

Problem in Drag And Move Forms in .Net

I Write a Windows Application By C Sharp. I Use a Picture in Background of my Form (MainForm) And I Use Many Picture in Buttons in This Form,And also I Use Some Panel And Label with Transparent Background Color. My Forms,Panels And Buttons has flicker. I solve this problem by a method in this thread. But Still when other Forms Start ove...

Simple graphics import and manipulation

What do I need to do something like this? User builds a diagram and tags certain boxes and circles with text. User imports diagram into my program. My program processes the tagged boxes and circles and fills them with different colors. My program exports color-filled diagram. So the questions are... What graphics format supports ta...

Dynamically Rendering in a Scrollable Area

What is the generic algorithm or process that is commonly used to dynamically render portions of a scrolling area? For example, in Google Maps, when the user scrolls past the bounds of the currently rendered area, a grey checkerboard pattern is displayed within the not-yet-rendered portions while the application loads and renders those ...

How do I translate a point from one rect to a point in a scaled rect?

I have an image (i) that's been scaled from its original size (rectLarge) to fit a smaller rectangle (rectSmall). Given a point p in rectSmall, how can I translate this to a point in rectLarge. To make this concrete, suppose I have a 20x20 image that's been scaled to a 10x10 rect. The point (1, 1) in the smaller rect should be scaled ...

Given a set of points, find if any of the three points are collinear

Hi, What is the best algorithm to find if any three points are collinear in a set of points say n. Please also explain the complexity if it is not trivial. Thanks Bala ...

Closest point on a cubic Bezier curve?

How can I find the point B(t) along a cubic Bezier curve that is closest to an arbitrary point P in the plane? ...

How can I determine if a function generates a graph

Is there a way to determine if a function generates a figure in R? For example, if we have functions f and g f = function(x,y){plot(x,y)} g = function(x,y){mean(x*y)} I would like able to run createFigure(f(x,y))#Returns TRUE createFigure(g(x,y))#Returns FALSE Thanks ...

Pixel Perfect Collision Detection in HTML5 Canvas

Hi, I want to check a collision between two Sprites in HTML5 canvas. So for the sake of the discussion, let's assume that both sprites are IMG objects and a collision means that the alpha channel is not 0. Now both of these sprites can have a rotation around the object's center but no other transformation in case this makes this any e...

Drawing an image in Java, slow as hell on a netbook.

In follow-up to my previous questions (especially this one : http://stackoverflow.com/questions/2684123/java-volatileimage-slower-than-bufferedimage), i have noticed that simply drawing an Image (it doesn't matter if it's buffered or volatile, since the computer has no accelerated memory*, and tests shows it's doesn't change anything), t...

Java Graphics not displaying on successive function calls, why?

Hi, I'm making a visualization for a BST implementation (I posted another question about it the other day). I've created a GUI which displays the viewing area and buttons. I've added code to the BST implementation to recursively traverse the tree, the function takes in coordinates along with the Graphics object which are initially pas...

Generate texture from polygon (openGL)

I have a quad and I would like to use the gradient it produces as a texture for another polygon. glPushMatrix(); glTranslatef(250,250,0); glBegin(GL_POLYGON); glColor3f(255,0,0); glVertex2f(10,0); glVertex2f(100,0); glVertex2f(100,100); glVertex2f(50,50); glVertex2f(0,100); glEnd(); //End quadrilateral coordinates gl...

Fast rectangle to rectangle intersection

What's a fast way to test if 2 rectangles are intersecting? A search on the internet came up with this one-liner (WOOT!), but I don't understand how to write it in Javascript, it seems to be written in an ancient form of C++. struct { LONG left; LONG top; LONG right; LONG bottom; } RECT; bool IntersectRe...

Efficiently draw a grid in Windows Forms

I'm writing an implementation of Conway's Game of Life in C#. This is the code I'm using to draw the grid, it's in my panel_Paint event. g is the graphics context. for (int y = 0; y < numOfCells * cellSize; y += cellSize) { for (int x = 0; x < numOfCells * cellSize; x += cellSize) { g.DrawLine(p, x, 0, x, y + numOfCe...

BlackBerry - How can i show a Label with emoticons??

I need to show a Label with emoticons included already in the blackbery interface, with flags, etc. ...

A dynamic array of a class, inside another separate class?

I'm working on a robot localization simulator and I created a class called "landmark". The end result is going to be a robot that is always centered and always faces the top of the screen. As it turns, the birds eye view map will rotate around the robot. To accomplish this, I'm assuming I can rotate one class and have all elements i...

Image Transformation on iPhone, how to?

Since I cannot pre-render all the images in PNGs and real-time image transformation functions are required, namely: skew perspective (like the transform action found in Photoshop) Which API (CoreAnimation? OpenGL ES?) should I look into? Even better, is there any sample code around? Thanks! ...

Does OpenGL stencil test happen before or after fragment program runs?

When I set glStencilFunc( GL_NEVER, . . . ) effectively disabling all drawing, and then run my [shader-bound] program I get no performance increase over letting the fragment shader run. I thought the stencil test happened before the fragment program. Is that not the case, or at least not guaranteed? Replacing the fragment shader with one...

Are border lines in the Flash drawing API drawn inside or outside a shape?

When I draw rectangles etc in ActionScript, using the Flash Player's drawing API (i. e. the Graphics class), is the border line of that shape drawn on the outside or the inside of the shape? I. e., which of the following diagrams correctly depicts a rectangle drawn a the border of a content area in a custom component? I looked at the ...

Navigation graphics overlayed over video

Hey, Imagine I have a video playing.. Can I have some sort of motion graphics being played 'over' that video.. Like say the moving graphics is on an upper layer than the video, which would be the lower layer.. I am comfortable in a C++ and Python, so a solution that uses these two will be highly appreciated.. Thank you in advance, Ri...

Simple 3D Editor/Viewer

I'm looking for an application, which could be able to load bunch of points in space, render them and be able to simple 3D operations (select such point, rotate & move viewport). The source has to be available, as I want to use it as basis for my own application. ...