- minor problem in handling of canon option
- low-level bmp writing (moving it to laptop)
- Windows BMP reading and writing
+ - added OO interfaces for the mosaic, bumpmap, postlevels and
+ watermark filters
+ - added t/t61filters.t to test the filters
=================================================================
defaults => { },
callsub => sub { my %hsh = @_; i_gaussian($hsh{image}, $hsh{stddev}); },
};
+ $filters{mosaic} =
+ {
+ callseq => [ qw(image size) ],
+ defaults => { size => 20 },
+ callsub => sub { my %hsh = @_; i_mosaic($hsh{image}, $hsh{size}) },
+ };
+ $filters{bumpmap} =
+ {
+ callseq => [ qw(image bump elevation lightx lighty st) ],
+ defaults => { elevation=>0, st=> 2 },
+ callsub => sub {
+ my %hsh = @_;
+ i_bumpmap($hsh{image}, $hsh{bump}{IMG}, $hsh{elevation},
+ $hsh{lightx}, $hsh{lighty}, $hsh{st});
+ },
+ };
+ $filters{postlevels} =
+ {
+ callseq => [ qw(image levels) ],
+ defaults => { levels => 10 },
+ callsub => sub { my %hsh = @_; i_postlevels($hsh{image}, $hsh{levels}); },
+ };
+ $filters{watermark} =
+ {
+ callseq => [ qw(image wmark tx ty pixdiff) ],
+ defaults => { pixdiff=>10, tx=>0, ty=>0 },
+ callsub =>
+ sub {
+ my %hsh = @_;
+ i_watermark($hsh{image}, $hsh{wmark}{IMG}, $hsh{tx}, $hsh{ty},
+ $hsh{pixdiff});
+ },
+ };
$FORMATGUESS=\&def_guess_type;
}
Filter Arguments
autolevels lsat(0.1) usat(0.1) skew(0)
+ bumpmap bump elevation(0) lightx lighty st(2)
contrast intensity
conv coef
gaussian stddev
gradgen xo yo colors dist
hardinvert
noise amount(3) subtype(0)
+ postlevels levels(10)
radnoise xo(100) yo(100) ascale(17.0) rscale(0.02)
turbnoise xo(0.0) yo(0.0) scale(10.0)
+ watermark wmark pixdiff(10) tx(0) ty(0)
The default values are in parenthesis. All parameters must have some
value but if a parameter has a default value it may be omitted when
truncate the range by the specified fraction at the top and bottom of
the range respectivly..
+=item bumpmap
+
+uses the channel I<elevation> image I<bump> as a bumpmap on your
+image, with the light at (I<lightx>, I<lightty>), with a shadow length
+of I<st>.
+
=item contrast
scales each channel by I<intensity>. Values of I<intensity> < 1.0
(I<xo>, I<yo>), I<ascale> controls the angular scale of the noise ,
and I<rscale> the radial scale, higher numbers give more detail.
+=item postlevels
+
+alters the image to have only I<levels> distinct level in each
+channel.
+
=item turbnoise
renders Perlin turbulent noise. (I<xo>, I<yo>) controls the origin of
the noise, and I<scale> the scale of the noise, with lower numbers
giving more detail.
+=item watermark
+
+applies I<wmark> as a watermark on the image with strength I<pixdiff>,
+with an origin at (I<tx>, I<ty>)
+
=back
-A demonstration of the the filters can be found at:
+A demonstration of most of the filters can be found at:
http://www.develop-help.com/imager/filters.html
MANIFEST
README
Makefile.PL
-draw.c
-draw.h
+bmp.c
conv.c
convert.c
+draw.c
+draw.h
map.c
error.c
gaussian.c
t/t104ppm.t
t/t105gif.t
t/t106tiff.t
+t/t107bmp.t
t/t15color.t
t/t30t1font.t
t/t35ttfont.t
t/t58trans2.t
t/t59assem.t
t/t60dyntest.t
+t/t61filters.t
t/t65crop.t
t/t66paste.t
t/t69rubthru.t
t/t75polyaa.t
t/t90cc.t
testimg/bandw.gif
+testimg/comp4.bmp
+testimg/comp8.bmp
testimg/expected.gif
testimg/junk.ppm
testimg/loccmap.gif
#endif
"raw",
"pnm",
+ "bmp",
NULL};
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
void
i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure) {
undef_int i_writeppm_wiol(i_img *im, io_glue *ig);
extern int i_writebmp_wiol(i_img *im, io_glue *ig);
+extern i_img *i_readbmp_wiol(io_glue *ig);
i_img * i_scaleaxis(i_img *im, float Value, int Axis);
i_img * i_scale_nn(i_img *im, float scx, float scy);
--- /dev/null
+#!perl -w
+use strict;
+use Imager qw(:handy);
+
+# meant for testing the filters themselves
+my $imbase = Imager->new;
+$imbase->open(file=>'testout/t104.ppm') or die;
+my $im_other = Imager->new(xsize=>150, ysize=>150);
+$im_other->box(xmin=>30, ymin=>60, xmax=>120, ymax=>90, filled=>1);
+
+print "1..26\n";
+
+test($imbase, 1, {type=>'autolevels'}, 'testout/t61_autolev.ppm');
+
+test($imbase, 3, {type=>'contrast', intensity=>0.5},
+ 'testout/t61_contrast.ppm');
+
+# this one's kind of cool
+test($imbase, 5, {type=>'conv', coef=>[ -0.5, 1, -0.5, ], },
+ 'testout/t61_conv.ppm');
+
+test($imbase, 7, {type=>'gaussian', stddev=>5 },
+ 'testout/t61_gaussian.ppm');
+
+test($imbase, 9, { type=>'gradgen', dist=>1,
+ xo=>[ 10, 10, 120 ],
+ yo=>[ 10, 140, 60 ],
+ colors=> [ NC('#FF0000'), NC('#FFFF00'), NC('#00FFFF') ]},
+ 'testout/t61_gradgen.ppm');
+
+test($imbase, 11, {type=>'mosaic', size=>8}, 'testout/t61_mosaic.ppm');
+
+test($imbase, 13, {type=>'hardinvert'}, 'testout/t61_hardinvert.ppm');
+
+test($imbase, 15, {type=>'noise'}, 'testout/t61_noise.ppm');
+
+test($imbase, 17, {type=>'radnoise'}, 'testout/t61_radnoise.ppm');
+
+test($imbase, 19, {type=>'turbnoise'}, 'testout/t61_turbnoise.ppm');
+
+test($imbase, 21, {type=>'bumpmap', bump=>$im_other, lightx=>30, lighty=>30},
+ 'testout/t61_bumpmap.ppm');
+
+test($imbase, 23, {type=>'postlevels', levels=>3}, 'testout/t61_postlevels.ppm');
+
+test($imbase, 25, {type=>'watermark', wmark=>$im_other },
+ 'testout/t61_watermark.ppm');
+
+sub test {
+ my ($in, $num, $params, $out) = @_;
+
+ my $copy = $in->copy;
+ if ($copy->filter(%$params)) {
+ print "ok $num\n";
+ if ($copy->write(file=>$out)) {
+ print "ok ",$num+1,"\n";
+ }
+ else {
+ print "not ok ",$num+1," # ",$copy->errstr,"\n";
+ }
+ }
+ else {
+ print "not ok $num # ",$copy->errstr,"\n";
+ print "ok ",$num+1," # skipped\n";
+ }
+}