mirror of https://github.com/GNOME/gimp.git
49 lines
2.0 KiB
Plaintext
49 lines
2.0 KiB
Plaintext
refract: A plug-in for the GIMP 0.99
|
|
by Kevin Turner <kevint@poboxes.com>
|
|
http://www.poboxes.com/kevint/gimp/refract.html
|
|
|
|
Refract distorts an image by passing it through the lens. The side of
|
|
the lens towards the image is flat, the shape the other side is
|
|
determined by a height map; a grayscale image where white pixels are
|
|
high, black pixels are low, and anything between is somewhere
|
|
inbetween. (Refract will accept an RGB image as a lens map, but will
|
|
only use the first channel.)
|
|
|
|
The thickness of the lens is determined by the "Thickness"
|
|
paramater. The "Distance" parameter is the distance between the
|
|
bottom of the lens and the image. (The distance between the observer
|
|
and the image is fixed at somewhere around infinity minus one.
|
|
Fortunately, there are no perspective effects.)
|
|
|
|
The two indicies of refraction describe what substances you're
|
|
looking through. Index A is for the substance between you and the
|
|
lens, index B is that of the material the lens is crafted from. So
|
|
when looking from air in to water, index A would be about 1 and index
|
|
B is 1.333. These indicies are physical constants and can be obtained
|
|
by looking in your copy of the CRC, or using the samples provided.
|
|
|
|
The X and Y offsets move the position of the lens. Sorry,
|
|
a preview image is on the TO DO list, but it ain't here yet. The
|
|
resulting image can be placed on a new layer by checking the "New
|
|
layer" checkbox.
|
|
|
|
Read the code and the aformentioned web page for more
|
|
information. Questions, comments, reservations, and bug reports are
|
|
always welcome.
|
|
|
|
* * *
|
|
|
|
I'm not a very expirenced C programmer, so questions, comments, and
|
|
reservations on code and style are more than welcome. This plug-in
|
|
was developed on Linux and I will be the first to admit that I'm
|
|
rather inexpirenced (okay, ignorant) with other operating systems.
|
|
If I do wrong, educate me.
|
|
|
|
Credits:
|
|
Pixel fetcher routines are from Quartic's whirlpinch plug-in. Thanks,
|
|
Quartic[1]!
|
|
|
|
1: Quartic, AKA Federico Mena-Quintero
|
|
federico@nuclecu.unam.mx
|
|
http://www.nuclecu.unam.mx/~federico
|