graphics

Fastest approach for rotating an image on the iPhone

I need to rotate a UIImage in response to user input. I'd like this to be as slick as possible and therefore would like to know which is the quickest way to perform the transformation and render. Ideally I'd like to stay within the UIKit or Quartz frameworks. The properties of the image are as follows: Size approximately 250x300 pixels...

Displaying SVG in OpenGL without intermediate raster

I have some simple SVG artwork (icon and glyph kind of things) which I want to display in an OpenGL app (developing in C++ on Debian, using Qt). The obvious solution is to use the ImageMagick libs to convert the SVGs to raster images and texture map them onto some suitable polygons (or just use good old glDrawPixels). However, I'm wond...

What's a simple/fast way to display half-star ratings in an iphone view

I have a (float) rating value as a percentage from 0..100 (where 50 = Just OK, 0 = terrible and 100=best). What's a simple way to display this as a 5 star rating on the iphone, with the following requirements: simple (ideally just using drawing operations based on a png of a single star or five of them, and without needing to resort t...

.NET pie chart: how to add text to slices and rotate chart

The code below creates a 24 slice pie chart. How do I: Add text labels to each slice a la "Wheel of Fortune". Rotate the pie chart? I want it to spin like "Wheel of Fortune". private void DrawPieChart() { Graphics g = this.CreateGraphics(); g.Clear(this.BackColor); Rectangle rect = new Rectangle(0, 0, 300, 300); float...

(Simple?) Label Placement for Line Graphs

I'm drawing elevation profiles showing the elevation gain/loss along a trail, similar to the one below: This is basically a line graph with distance from the start on the x-axis and elevation on the y-axis. I'd like to provide fancy labels with spot elevations at interesting points along the trail, like the ones I have added by hand ...

Collapse/Expand Images

Ok so this is super basic. I just got done implementing the collapsible panel using the MS AJAX Toolkit and was wondering if anyone knew where to get the collapse and expand images that they use in their demo? One would think these images would be distributed with the toolkit...if so - where are they found? Any recommendations for colla...

What exactly is a surface in OpenGL ES or Direct3D?

I did not find a good definition of the concept of a drawing surface. What properties are associated with a surface? In the context of pure OpenGL there is no surface, since OpenGL has no notion of window system specific things. In OpenGL ES though you have the EGL API, which introduces the concept of a drawing surface, without defining ...

Creating SVG graphics using javascript?

How can I create SVG graphics using Javascript? Do all browsers support SVG? ...

How do I visualize audio data?

I would like to have something that looks something like this. Two different colors are not nessesary. I already have the audio data (one sample/millisecond) from a stereo wav in two int arrays, one each for left and right channel. I have made a few attempts but they don't look anywhere near as clear as this, my attempts get to spikey...

CGAffineTransform from two lines - each represented by a pair of CGPoints

You can probably see where I am going with this - but is there any easy way to generate a CGAffineTransform from two lines - each represented by a pair of CGPoints: A[(a1x,a1y), (a2x,a2y)], B[(b1x,b1y), (b2x,b2y)] The resultant CGAffineTransform when applied to line A would of course produce line B. It potentially could involve a tran...

Image Optimization

I want to know like converting an image (gif or jpeg) to png8 using yslow smushit will increase the speed of the site performance? Will that work in ie6? webdevelopertut ...

d3dxcompileshaderfromfile versus d3dxcreatetexturefromfile

Hi all, I can use D3DXCreateTextureFromFile fine but was wondering what D3DXCompileTextureFromFile is and its purpouses, it seems to be basically the same thing? However I"m unsure how to use it properly... ...

How to create a rounded rectangle at runtime in Windows Forms with VB.NET/C#?

Hello, I woud like to create a filled rounded rectangle at run-time and assign it as content of a PictureBox (already created and hidden) in Windows Forms. Do you have an idea how can I implement it? thank you in advance ...

Percentage Error for 2 sets of 3D points

I have a reference set of n points, and another set which 'approximates' each of those points. How do I find out the absolute/percentage error between the approximation and my reference set. Put in other words, I have a canned animation and a simulation. How do I know how much is the 'drift' between the 2 in terms of a single number? Th...

In terms of OO design, can two-d and the three-d point classes be derived from single base class?

I`m currently working out the design for simple graphic editor, who support trivial operations for two-dimensional and three-d shapes. The point is, I want to render prototype of these shapes, as MsPaint does. And at the moment it is rendering I need to store somewhere pixels from the canvas which get covered by prototype, just in case w...

Drawing pies using PHP ImageMagick

Is there a way to get GD's function imagefilledarc()'s result in using PHP ImageMagick? I've looked around but haven't found a satisfying solution so far. I want it to support transparency, and use it to draw pies. ...

Z-Depth Testing in OpenGL

Hello, first time here. Sitting down today and teaching myself OpenGL. But I have run into a question I can't seem to find the answer to. I'm wondering why depth testing seems to be incompatible with semi-transparent objects in OpenGL. The documentation seems to suggest that you must turn off depth-testing, then draw objects in revers...

What is a dependent texture read?

I've been reading papers on computer graphics, and every so often I come across the term "dependent texture read" or "dependent texture fetch" used in the context of querying textures in shader code. What is a dependent texture read, and what is the difference between this and a "normal" texture read? ...

How do you draw a string centered vertically in Java?

I know it's a simple concept but I'm struggling with the font metrics. Centering horizontally isn't too hard but vertically seems a bit difficult. I've tried using the FontMetrics getAscent, getLeading, getXXXX methods in various combinations but no matter what I've tried the text is always off by a few pixels. Is there a way to measur...

How to represent 18bit color depth to 16bit color depth?

I'm porting a software that build from 16bit color depth to 18bit color depth. How can I convert the 16-bit colors to 18-bit colors? Thanks. ...