Thread View: net.graphics
3 messages
3 total messages
Started by The Doctor
Wed, 17 Sep 1986 22:03
jaggie remover
Author: The Doctor
Date: Wed, 17 Sep 1986 22:03
Date: Wed, 17 Sep 1986 22:03
56 lines
1780 bytes
1780 bytes
Ok, here is a snippet of code to smooth out all jaggies in an image
#define VERTRES some integer
#define HORZRES some integer
struct attr {
/* whatever you need to define a pixel */
}
smooth()
{
register int x, y;
struct attr average[3][HORZRES], avgpix();
for (y = 0; y < VERTRES + 2; y++) {
for (x = 0; x < HORZRES; x++) {
if (y>2) {
/* change pixel only after its out of range */
diddle(average[(y - 2) % 3][x], x, y);
}
if (y < VERTRES) {
/* save pixel average only while on screen */
average[y % 3][x] = avgpix(x, y);
}
}
}
}
stuct attr avgpix(x, y)
int x, y;
{
/* this routine should average all the attributes of the 8
* pixels around x,y and x,y
* and return the averages.
*/
}
diddle(avg, x, y)
struct attr avg;
int x, y;
{
/* this routine should get the attributes for the pixel at x,y
* and change them according some function of their difference.
*/
struct attr curr_pixel;
curr_pixel = get_attr(x, y);
/* diddle it here */
set_attr(curr_pixel, x, y);
}
That's it. It should work very well on objects with plain backgrounds.
On very complex pictures it will probably give the effect of going out of focus.
Steve Hawley
joevax!sdh
Re: jaggie remover
Author: Robert Reed
Date: Fri, 26 Sep 1986 19:05
Date: Fri, 26 Sep 1986 19:05
44 lines
2447 bytes
2447 bytes
Steve Hawley in <281@joevax.UUCP> provides what he calls a "jaggie remover".
This is a very crude algorithm which I would not recommend to anyone
seriously interested in anti-aliasing. Ignoring the blantant programming
errors in his sample, his technique is a blending algorithm which averages
the aliased samples around and including the pixel. I think it is intended
to avoid smearing by staggaring the changes behind the leading edge of the
averager, but suffers the problems of filtering without oversampling. This
algorithm will:
o Give believable effects on the edges of large solid polygons.
o Wash out thin lines and text
o Generally destroy textures.
The problem is that the equal weighted sample does NOT take into account the
underlying structure of the picture. Consider what it will do to this image
of a horizontal line, where we have pixel with 4 levels of brightness.
(o = off, + = dim, * = semi-bright, # = bright)
before "jaggie removal":
oooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooo
########################################
oooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooo
after:
oooooooooooooooooooooooooooooooooooooooo
++++++++++++++++++++++++++++++++++++++++
****************************************
++++++++++++++++++++++++++++++++++++++++
oooooooooooooooooooooooooooooooooooooooo
The line has been expanded to three rows and dimmed.
Once again I emphasize, this is NOT a topic for novice speculation. Much
reseearch has been done on this topic, and if you are really interested,
consult one of a number of texts which have been mentioned in this
newsgroup. Please do not inflict off-the-cuff schemes on this audience.
Robert Reed, Tektronix CAE Systems Division, bobr@zeus.TEK
Re: I NEED EGA ROUTINES!!!
Author: Mike Godawski
Date: Thu, 09 Oct 1986 03:17
Date: Thu, 09 Oct 1986 03:17
12 lines
1122 bytes
1122 bytes
I am working on a thesis that requires the use of an EGA's different modes. There is little software out there that uses the capabilities of the EGA, and anybody who has either C, Pascal, or ASSEMBLER routines who would send me copies would be greatly appreciated. Also, if you've got NANSI.SYS for an EGA, please send it to me, and I'd also greatly appreciate it too! Thank you in advance. mike godawski @ university of S. Carolina.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads