[comp.graphics] Smooth Scaling of Bitmap Fonts and other Graphics Inquiries

misha@nsc.nsc.com (Michael Umansky) (10/24/87)

Hi.
I have several bitmapped fonts in small sizes, mostly a 7 by 9 character
in a 9 by 12 box.  When I scale this font UP via bit replication in X
and/or Y direction I get very ugly characters the bigger they get.

Is there a way to dynamically scale up a bitmapped character with
smoothing of all rough corners?

I have got the Hershey fonts but they are vector fonts and I don't
have the hershey.doc that was supposed to have come with the distribution.
Can anyone mail it to me?  Thanks.

Also.  If I have a color pallette of 256 entries, is there a 
standard/good order in which different colors can be assigned
to each entry.  This especially applies to mandelbrot type
images, I need to know which colors need to be assigned to which entry.
(A pixel in the graphics bitmap is an index into color pallette table).
I would also like to take an image generated by posted 'tracer' program
and dither its 8 bit per pixel output to 4 bit per pixel output and
again I need to know which colors to assign to which of 16 entries.

Any help on above is appreciated.
Thank you.
--
		NAME:   Michael Umansky (misha)
		E-MAIL:
			 	sun! ----\
				hplabs! --\
				pyramid! --+----> nsc!misha
				decwrl! --/
				amdahl! -/
		WORK:
			National Semiconductor Corporation
			1135 Kern Avenue,  Mail Stop - 7C266
			Sunnyvale, CA  94086
			(408) 721-8109 (work)
		HOME:
			4331 Lincoln Way
			San Francisco, CA  94122
			(415) 564-3921 (home)

garyo@masscomp.UUCP (Gary Oberbrunner) (10/26/87)

In article <4721@nsc.nsc.com> misha@nsc.nsc.com (Michael Umansky) writes:
>
>is there a standard/good order in which different colors can be assigned
>to each entry?  This especially applies to mandelbrot type
>images...
>I would also like to take an image generated by posted 'tracer' program
>and dither its 8 bit per pixel output to 4 bit per pixel output and
>again I need to know which colors to assign to which of 16 entries.

For mandelbrots you are on your own, but a connected path through color
space is often used, sometimes with jumps to accent certain contours.

	    index---.
	    color-. |
		  | |
		  v v
I.e.: ramp dark-red 0 yellow 20 blue 40 white 60 black 61 vivid-red 127 ...
						       ^
						       |
					         jump -:

Where ramp interpolates in ihs space between the named CNS colors.
RGB-space interpolation is ok too, it's just harder to get proper rainbows.

For real images using small colormaps, the easiest method is to allocate
the colors as follows: 1 plane red, two green, and one blue.  Then dither
r,g and b independently.  Eight bits is usually done 3, 3 and 2 (r,g,b).
You get better gray scales if you use an ihs mapping, as in 3 planes for
intensity, 3 planes hue, 2 planes saturation.

Of course the BEST way is to histogram the input image and build the color
map using a weighted least-squares metric, and then dither among those
colors, but this is a lot of work (especially dealing with those nasty
few pixels that are far away for all the others...)

The upshot is there are as many different ways to do it as there are images.
Good luck!  It's a lot of fun.
-- 
Remember,		       -Truth is not beauty;
Information is not knowledge; /	Beauty is not love;	  Gary Oberbrunner
Knowledge is not wisdom;     /	Love is not music;	  ...!masscomp!garyo
Wisdom is not truth;    ----/	Music is the best. - FZ