freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bg-color?


From: Pavel Kankovsky
Subject: Re: bg-color?
Date: Fri, 10 Mar 2000 01:53:55 +0100 (MET)

On Wed, 8 Mar 2000, Thomas Lang wrote:

> I tried to use the script provided by Pavel Kankovsky in the
> online-demo section. Is there a way to tell one of the ft-bins which
> bg-color or image to use for rendering-background? (I think it is
> possible with a selfmade c-script but I try to avoid this!)

Someone has already modified ftstrpnm to make textcolor configurable (get
the latest snapshot). Changing background color would be trivial. On the
other hand, putting an image to background is not that easy, and it would
not be very elegant to bloat any ft-program with this...what you need is a
program that takes two images and "alpha-blends" them according to a
third, grayscale image. The effect can be accomplished, in a rather
inefficient way, using several netpbm commands...

ftstrpnm .... > mask.ppm
dimensions="`head -2 < mask.ppm | tail -1`"
pnminvert mask.ppm > invm.ppm
pnmcut 0 0 $dimensions foreground.ppm > temp-fg.ppm
pnmcut 0 0 $dimensions background.ppm > temp-bg.ppm
pnmarith -multiply mask.ppm temp-fg.ppm > temp-fg2.ppm
pnmarith -multiply invm.ppm temp-bg.ppm > temp-bg2.ppm
pnmarith -add temp-fg.ppm temp-bg.ppm > result.ppm

(I assume foreground.ppm and background.ppm are big enough.)

--Pavel Kankovsky aka Peak  [ Boycott Microsoft--http://www.vcnet.com/bms ]
"Resistance is futile. Open your source code and prepare for assimilation."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]