graphics

Drawing a bezier from multiple points

I have a set with 50 points in x,y. I need to draw the smoothest bezier that passes in all points, or in other words, the bezier that will best fit the points. How do I do that? thanks ...

What resolutions should iOS graphics be?

What pixels per inch settings do iOS 4 graphics need to be to support the high resolution display? Should I just use the standard 72, or should I specifically make images that are 320x480@163ppi and 640x960@326ppi? Or, should I just make images those dimensions and not worry about the resolution (i.e. leave it at the default 72)? I'm no...

Taking a Screenshot of an iPhone app mixing UIKit and OpenGL

So, I know how to take a screenshot with UIKit: UIWindow *window = [[[UIApplication sharedApplication] delegate] window]; UIGraphicsBeginImageContext(window.bounds.size); [window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteTo...

Adding blink to the color but its not blinking

The text should blink in red color but its not blinking #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void main(void) { int driver=DETECT,mode,mx,my,x1,y1,x2,y2; initgraph(&driver,&mode,"C:\\tc\\bgi"); cleardevice(); mx=getmaxx(); my=getmaxy(); settextstyle(0,HORIZ_DIR,6); setcolor(RED+BLIN...

how to pick up mouse in 3d world.

Hi, everyone, i have some questions about how to pick up mouse in 3d world. Now i have several points in 3d world,by using these points i can draw curve i want to choose a point on this curve using mouse, the viewport of the 3d world can be changed, so i want to know at any viewport when i chick mouse button near the curve, which po...

Creating a 'timeline' style graphic in MATLAB

At the end of some data processing in MATLAB, I want to create a plot which shows colored timeline bars for a series of data. I have a number of processes which each go through similar steps, and start and stop and different at different times. Ideally it'd end up looking something like this (forgive the ASCII art): | ###***$$$$$$...

Help me understand Java Polygon Fill oddness

I am working with drawing polygons based on a given line. I have the logic working out well except in cases where it appears that the polygon intersects itself. However, it doesn't seem to be 100% consistent, nor does it make sense based on what I'm reading. Below are two images created using the same code. The yellow polygons are the on...

How do I use gluLookAt properly?

I don't want to get into complex trigonometry to calculate rotations and things like that for my 3D world so gluLookAt seems like a nice alternative. According to the documentation all I need to do is place 3 coordinates for the cameras position, three for what I should be looking at and an "up" position. The last made no sense until I a...

Help with this problem?

I'm working on implementing bezier handles into my application. I have points and I need to figure out weather the current direction of the new point is clockwise or counter clockwise. This is because my bezier interpolation algorithm calculates the handles from right to left. Therefore no matter what it interpolates: P1 P1.righthandle ...

drawing multiple rectangles with Cairo graphics

I'm trying to write a Cairo program to black-fill the entire image and then draw another rectangle inside of it a different color. Eventually, I'm going to make this a program that generates a .png of the current time that looks like a digital clock. For now, this is where I'm getting hung up. Here's my code: #include <stdio.h> #includ...

linker error in mouse interfacing

The linker gives error that overflow at initgraph and close graph #include<dos.h> #define DETECT 0 union REGS in,out; void detectmouse()//no declaration(prototype)? { in.x.ax=0; int86(0x33,&in,&out); if(out.x.ax==0) { printf("Fail to initialize the mouse."); } else { printf("Mouse succesfully init...

mouse not taking input

I am trying to implement mouse interfecing but somethings wrong with the input function.It should tell me that wheater i have made a left click or a right click but its not printing anything.Have a look: #include<graphics.h> #include<dos.h> union REGS in,out; void Graphics(void); void DetectMouse(void); void ShowMouse(void); void HideMo...

OpenGL equivalent of SetROP2(R2_NOT)

Considering QGLWidget (or OpenGL in general), what can be the easiest solution to draw pixels in the inverse color of the screen / frame buffer? In Win32 / MFC environment, I used to use the SetROP2(R2_NOT) with zero pain. ...

Differences and advantages of SurfaceView vs GLSurfaceView on Android?

I'm currently playing around with 2D graphics in android and have been using a plain old SurfaceView to draw Drawables and Bitmaps to the screen. This has been working alright, but there's a little stutter in the sprite movement, and I'm wondering the feasibility to do a real time (but not terrible fast) game with this. I know GLSurfac...

Is there a way to access DHR on the Apple 2 from Applesoft Basic

When using Applesoft Basic on the Apple 2 with an 80 column card, is there a way to create DHR graphics using only POKE? I have found a number of solutions using third party extensions such as Beagle Graphics, but I really want to implement it myself. I've searched my Nibble magazine collection, and basic books, but have been unable to...

Image Cropping Path and Manipulation Library

I am looking to see if there is a library that would let me get a cropping path and then manipulate that path. Here is what I am thinking of: Take a gray scale image and find the crop path to remove the white background. Have a threshold to help ignore artifacts. Display the crop path. Allow the user to manipulate the crop path by movi...

Using a System.Drawing.Image as the centered part of a larger image?

I have a System.Drawing.Image that I would like to use as the centered portion for a new, larger image. I’m given the dimensions of the (always) larger image and the idea is to make that image all white and overlay its center with the first image. Is there a way to do this using GDI+? Some combination of TextureBrush and the Graphic c...

How to draw a moving laser beam?

I'm looking to draw a laser beam which can possibly bounce around a box. Basically the laser beam is of variable length and when it bounces off a surface it will reflect at the angle that it collides. I can handle the collision stuff myself (probably, haven't tried it yet though), but I'm confused about how the actual drawing would work...

rightrotate without bitwise operators

How can I implement the rightrotate (and leftrotate) operations on 32 bit integers without using any bitwise operations? I need this because High Level Shader Language (HLSL) does not allow bitwise oeprations upon numbers, and I need rightrotate for a specific shader I'm trying to implement. ...

Need Help Moving An Object

Hi Guys, I need ideas about how to move an object (a circle which represents a robot in my application). The surface the object will be moving on consists of Tiles of BufferedImage of 3 rows and 3 columns ( represented in arrays). All the Tiles are equal in sizes (160 X 160).The 3rd row and the 3rd column are the track rails on which t...