graphics

Getting a very annoying segmentation fault... mallocing 2d array in C.

Hi, I'm having a little trouble with this. First of all, this is for a simple graphics library that I was writing. What I'm doing is making it possible to declare multiple "virtual screens", with dimensions of the programmer's choice. For this, I need to dynamically allocate enough memory based on the number of pixels the screen will c...

CGContextSetRGBFillColor is not setting the good color.

My problem : the color of the fill in square go from black to full blue (255) with no transition color (darkest blue, dark blue, blue...). It seems that the CGContextSetRGBStroke is additive (WTF Oo) . like if the blue was 14 and the next update I put 140 the blue will be 154 and not 140 has I set. Is someone get that problem ? in the ...

Android: how to combine the paths of two shapes and remove overlap?

Hi all, I want to create a speech balloon type shape, where there is a rectangle or ellipse with a triangular shape jutting out of it. How I'm attempting to do this is to create a Path object that combines the triangle with the other shape (round rect). I'm doing it as follows: Path path = new Path(); // Create triangular segment Po...

Scaling/Translating a Shape to a given Rectangle using AffineTransform

Hi all, I'm trying to scale/translate a java.awt.Shape with AffineTransform in order to draw it in a defined bounding Rectangle. Moreover, I want to paint it in a drawing Area having a 'zoom' parameter. I tried various concatenations of AffineTransform but I couldn't find the correct sequence. For example, the following solution was w...

problem displaying mouse coordinates on the screen in java

Hi, I'm trying to display mouse coordinates (math coordinates) in my JPanel , but i get each coordinates on top of the other ,can' figure out why . here's my code : import java.awt.*; import java.awt.event.MouseEvent; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.applet.*; import javax.swing.JPanel; import java...

Cartesian coordinates in Java

I'm trying to draw a function's curve, so I need a method to convert my curve points coordinates to screen coordinates but I can't get it to work. Here's the method I use to convert: public Point tradPoint(Point P){ Point Ptd = new Point(); Ptd.x=getWidth()/2 + P.x*getWidth()/20; Ptd.y=getHeight()/2 - P.y*getHeight()/20; ...

Reproducing images with primitive shapes. (Graphics optimization problem)

Based on this original idea, that many of you have probably seen before: http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/ I wanted to try taking a different approach: You have a target image. Let's say you can add one triangle at a time. There exists some triangle (or triangles in case of a tie) that maxi...

Displaying real-time graphics (.net 2.0)

This puzzles me for years, since MFC. We all know DC limitations in Windows, and I really want to break free from it this time. What I need is to be able to draw at some hWnd, i.e. control, at any time - from any thread, even using direct bit manipulation! Is there anybody that can shed some light to it. I prefer that question should...

Advice on using vector graphics on the iPhone

A question for the seasoned iPhone developers, what is your preference for graphics in an iPhone app? I have turned to PNGs because I read that is the preferred image format and they are the most efficient format for the OS in terms of performance. However I had read you should try to use svg graphics so they scale up on the iPad. I star...

VTK (visualization toolkit) versus OSG (OpenSceneGraph) , other?

Does anyone have experience to fairly compare VTK and OpenSceneGraph? I'm more familiar with VTK, but I'm curious as to whether anyone has tried both extensively. I have both built, 5.6 vtk and 2.9.9 osg, can run the examples... at first glance OSG seems more 'rough', but maybe that's OK. In particular I worry about being able to fidd...

Differentiate table line from big letters

I'm doing some graphics processing and I have a logic where in I have a bitmap with edges and I disregard all table edges from the letters E.g. 0000000000 0111111110 0100000010 0102220010 0100200010 0100200010 0100000010 0111111110 0000000000 0 - background color 1 - ignored edges 2 - edges I need My logic is just simple, if a number...

Draw a User Defined Rectangle

Hi, My current code allows me to draw rectangles from a user defined spot but not in the way in whihc i desire. I need it to be like you would do it in paint, here is my current code: namespace SimpleDraw2 { /// /// Description of MainForm. /// public partial class MainForm : Form { bool IsMouseDown = fals...

What is the fastest way of edge detection?

I am thinking of implement a image processing based solution for industrial problem. The image is consists of a Red rectangle. Inside that I will see a matrix of circles. The requirement is to count the number of circles under following constraints. (Real application : Count the number of bottles in a bottle casing. Any missing bottles?...

Image Dithering: How would I calculate quantization error and nearest colour to implement in a Floyd-Steinburg algorithm?

I intend to display (4, 8 or 16 bit per channel - no alpha) images on a 1 bit display in an embedded system. Images are stored in RGB tuples. My intention is to use Floyd-Steinburg, as it looks reasonably good, is more than quick enough and concise in code. In reference to the WikiPedia article, I have two questions. What would the b...

Determining 3D "contour-esque" shapes out of 3 dimension matrix of samples

I am trying to calculate 3D shapes out of a 3 dimensional matrix of samples. My idea is that I would have a 3 dimensional matrix of data points, with each corresponding location in (X, Y, Z) space, and from this I would determine a set of 3 dimensional shapes in the (X, Y, Z) space that each outline data points of similar values. Somethi...

Web Graphics newbie - Adobe Fireworks, Photoshop, or Illustrator?

All, My partner is dipping her toes into the world of web design. The goal is for her to be good specifically at web graphics and CSS/HTML. We’re not sure what the best way forward is with learning how to create high quality web graphics (icons and other web page art). There is Adobe Photoshop which is probably more relevant for media/p...

Apache PDFBox Java library - Is there an API for creating tables?

Hello all, I am using the Apache PDFBox java library to create PDFs. Is there a way to create a data-table using pdfbox? If there is no such API to do it, I would require to manually draw the table using drawLine etc., Any suggestions on how to go about this? Thanks -Keshav ...

how to transform a sphere to a hemisphere, smoothly

Hi all, I am using a 3rd-party "rotator" object, which is providing a smooth, random rotation along the surface of a sphere. The rotator is used to control a camera (see rotator.h/c in source code for xscreensaver). The output of the rotator is latitude and longitude. What I want is for the camera to stay above the "equator" - thus lim...

Adobe Photoshop/cs

hey some one can help me for adobephotoshop ? i am new user and i want to learn adobe photoshop ? tell me best sites of the photoshop where i can easily learn? ...

Calculating the coordinates of the third point of a triangle

OK, I know this sounds like it should be asked on math.stackoverflow.com, but this is embarrassingly simple maths that I've forgotten from high-school, rather than advanced post-graduate stuff! I'm doing some graphics programming, and I have a triangle. Incidentally, two of this triangle's sides are equal, but I'm not sure if that's rel...