graphics

How to render text into a box and replace excess with three dots

I render text with a custom table cell renderer and I want to trim the text drawn if it would exceed the current cell width, switching to a "This text is to long..." kind of representation, where the three dots at the end never leaves the bounding box. My current algorithm is the following: FontMetrics fm0 = g2.getFontMetrics(); int h ...

How Scanline based 2d rendering engines works?

Will you please provide me a reference to help me understand how scanline based rendering engines works? I want to implement a 2D rendering engine which can support region-based clipping, basic shape drawing and filling with anti aliasing, and basic transformations (Perspective, Rotation, Scaling). I need algorithms which give priority t...

How do I find rotation transformed 2D coordinates in XNA?

I'm making an XNA game and have run into a small problem figuring out a bit of vector math. I have a class representing a 2D object with X and Y integer coordinates and a Rotation float. What I need is to have a Vector2 property for Position that gets and sets X and Y as a Vector2 that has been transformed using the Rotation float. This...

Picking my next graphics engine (Java vs. C#)

Requirements I am developing a music game that requires access to the audio line-in and classes to help me analyze a MIDI file (playing the MIDI is NOT necessary for me). Secondly, I need a graphics engine that allows easy and quick development (within reason). The game's focus is not cutting edge graphics - think along the lines of Aud...

Draw transparent arcs, not images, in J2ME?

Hi all, I've been happily coding an opensource game for fun, but i just realized that Graphics.setColor() doesn't understand 0xAARRGGBB... I want to get a more and more transparent colour, in which I'd draw some arcs (discs). My goal was to make them shine though each other like in this image: http://kenai.com/projects/xplode (the logo ...

Getting the active form caption color

How can i get the color of the caption of the active form in winforms? (Without Api) ...

What graphical software is used to design for web?

Until now I have always used Photoshop to create certain effects. But sometimes, no, actually, quite often I find that I can't easily create certain effects. For example, shadows of equal size around a squared bar (I get them slightly narrower on two of four sides), or maybe this Vista-like bar effects. I know I can achieve the results m...

Scala, animations and graphical user interface

Hi, I want to be able to do graphics with Scala programming language. Need to be able to do animations and attractive user interface, where to start? ...

Aspect ratios - how to go about them? (D3D viewport setup)

Allright - seems my question was as cloudy as my head. Lets try again. I have 3 properties while configuring viewports for a D3D device: - The resolution the device is running in (full-screen). - The physical aspect ratio of the monitor (as fraction and float:1, so for ex. 4:3 & 1.33). - The aspect ratio of the source resolution (source...

how do I create a line of arbitrary thickness using Bresenham?

I am currently using Bresenham's algorithm to draw lines but they are (of course) one pixel in thickness. My question is what is the most efficient way to draw lines of arbitrary thickness? The language I am using is C. ...

Combine multiple images into a single image for later painting, with alpha blending

I have a graphics system for Java which allows objects to be "wallpapered" by specifying multiple images, which can have (relatively) complex alignment and resizing options applied. In order to perform adequately (esp. on very low powered devices), I do the image painting to an internal image when the wallpaper is first painted, and the...

Algorithm for Polygon Image Fill.

Hi All, I want an efficient algorithm to fill polygon with an Image, I want to fill an Image into Trapezoid. currently I am doing it in two steps 1) First Perform StretchBlt on Image, 2) Perform Column by Column vertical StretchBlt, Is there any better method to implement this? Is there any Generic and Fast algorithm which can fil...

Drawing a dot grid

I'm new to graphics programming. I'm trying to create a program that allows you to draw directed graphs. For a start I have managed to draw a set of rectangles (representing the nodes) and have made pan and zoom capabilities by overriding the paint method in Java. This all seems to work reasonably well while there aren't too many node...

Check if a point is in a rotated rectangle (C#)

Hello. I have a program in C# (Windows Forms) which draws some rectangles on a picturebox. They can be drawn at an angle too (rotated). I know each of the rectangles' start point (upper-left corner), their size(width+height) and their angle. Because of the rotation, the start point is not necessarely the upper-left corner, but that does...

How can I access the palette of a TPicture.Graphic?

I have searched the web for hours but I can not find anything about how to get the palette from a TPicture.Graphic. I also need to get the color values so I can pass these values to a TStringList for filling cells in a colorpicker. Here is the code that I currently have: procedure TFormMain.OpenImage1Click( Sender: TObject ); var i: ...

Overall Title for Plotting Window

If I create a plotting window in R with m rows and n columns, how can I give the "overall" graphic a main title? For example, I might have three scatterplots showing the relationship between GPA and SAT score for 3 different schools. How could I give one master title to all three plots, such as, "SAT score vs. GPA for 3 schools in CA"? ...

Inside clipping with Java Graphics

I need to draw a line using java.awt.Graphis, but only the portion of the line that lies outside a rectangle should be rendered. Is it possible to use the Graphics clipping support? Or do I need to calculate the intersection and clip the line myself? ...

Favorite technique for hand gesture recognition

There is a lot of research going on about gesture recognition. I figured I would narrow this down to the topic of hand gesture recognition (i.e. stationary hand positions, up to as complex and dynamic as sign language recognition). Considering the image processing techniques available in real-time, such as blob detection, edge detection...

IE8 button graphics

Hi, Where does IE and windows store its graphics components, like the minimize, maximize, close buttons? I want to use them in a custom project and have done all the usual searches but can't find the graphics store. Thanks, R. ...

Given an Array, is there an algorithm that can allocate memory out of it?

Hi, I'm doing some graphics programming and I'm using Vertex pools. I'd like to be able to allocate a range out of the pool and use this for drawing. Whats different from the solution I need than from a C allocator is that I never call malloc. Instead I preallocate the array and then need an object that wraps that up and keeps track of ...