Permalink
Browse files

- the hardinvert filter no-longer inverts the alpha channel.

   http://rt.cpan.org/Ticket/Display.html?id=30002

 - the hardinvert filter now supports large samples
  • Loading branch information...
1 parent 678a9a6 commit bea65b1f6ad3f9da94294b33b0235f894734dd9d Tony Cook committed Dec 3, 2007
Showing with 85 additions and 14 deletions.
  1. +5 −0 Changes
  2. +2 −1 MANIFEST
  3. +1 −1 apidocs.perl
  4. +13 −10 filters.c → filters.im
  5. +1 −0 imager.h
  6. +1 −0 imext.h
  7. +33 −0 immacros.h
  8. +28 −1 lib/Imager/APIRef.pod
  9. +1 −1 lib/Imager/LargeSamples.pod
View
@@ -16,6 +16,11 @@ Bug fixes:
- work around Module::Depends::Intrusive bug #21229
http://rt.cpan.org/Ticket/Display.html?id=30520
+ - the hardinvert filter no-longer inverts the alpha channel.
+ http://rt.cpan.org/Ticket/Display.html?id=30002
+
+ - the hardinvert filter now supports large samples
+
Imager 0.61_02 - 28 November 2007
==============
View
@@ -102,7 +102,7 @@ feat.c
feat.h
fills.c Generic fills
filterlist.perl
-filters.c
+filters.im
font.c
fontfiles/ExistenceTest.afm please edit ExistenceTest.sfd in CVS
fontfiles/ExistenceTest.pfb to change these files, edited and
@@ -133,6 +133,7 @@ imexif.h
img16.c
imgdouble.c Implements double/sample images
imio.h
+immacros.h
imperl.h
imrender.h Buffer rending engine function declarations
imtoc.perl Sample size adapter pre-processor
View
@@ -162,7 +162,7 @@ =head1 SEE ALSO
sub make_func_list {
- my @funcs = qw(i_img i_color i_fcolor i_fill_t mm_log);
+ my @funcs = qw(i_img i_color i_fcolor i_fill_t mm_log i_img_color_channels i_img_has_alpha);
open FUNCS, "< imexttypes.h"
or die "Cannot open imexttypes.h: $!\n";
my $in_struct;
View
@@ -7,7 +7,7 @@
/*
=head1 NAME
-filters.c - implements filters that operate on images
+filters.im - implements filters that operate on images
=head1 SYNOPSIS
@@ -107,27 +107,30 @@ Inverts the pixel values of the input image.
void
i_hardinvert(i_img *im) {
int x, y;
- unsigned char ch;
+ int ch;
+ int color_channels = i_img_color_channels(im);
+
+ mm_log((1,"i_hardinvert(im %p)\n", im));
- i_color *row, *entry;
+#code im->bits <= 8
+ IM_COLOR *row, *entry;
- mm_log((1,"i_hardinvert(im %p)\n", im));
-
/* always rooms to allocate a single line of i_color */
- row = mymalloc(sizeof(i_color) * im->xsize); /* checked 17feb2005 tonyc */
+ row = mymalloc(sizeof(IM_COLOR) * im->xsize); /* checked 17feb2005 tonyc */
for(y = 0; y < im->ysize; y++) {
- i_glin(im, 0, im->xsize, y, row);
+ IM_GLIN(im, 0, im->xsize, y, row);
entry = row;
for(x = 0; x < im->xsize; x++) {
- for(ch = 0; ch < im->channels; ch++) {
- entry->channel[ch] = 255 - entry->channel[ch];
+ for(ch = 0; ch < color_channels; ch++) {
+ entry->channel[ch] = IM_SAMPLE_MAX - entry->channel[ch];
}
++entry;
}
- i_plin(im, 0, im->xsize, y, row);
+ IM_PLIN(im, 0, im->xsize, y, row);
}
myfree(row);
+#/code
}
View
@@ -573,5 +573,6 @@ void malloc_state(void);
#endif /* IMAGER_MALLOC_DEBUG */
#include "imrender.h"
+#include "immacros.h"
#endif
View
@@ -2,6 +2,7 @@
#define IMAGER_IMEXT_H_
#include "imexttypes.h"
+#include "immacros.h"
extern im_ext_funcs *imager_function_ext_table;
View
@@ -0,0 +1,33 @@
+/*
+ Imager "functions" implemented as macros
+
+ I suppose these could go in imdatatypes, but they aren't types.
+*/
+#ifndef IMAGER_IMMACROS_H_
+#define IMAGER_IMMACROS_H_
+
+/*
+=item i_img_has_alpha(im)
+
+=category Image Information
+
+Return true if the image has an alpha channel.
+
+=cut
+*/
+
+#define i_img_has_alpha(im) ((im)->channels == 2 || (im)->channels == 4)
+
+/*
+=item i_img_color_channels(im)
+
+=category Image Information
+
+The number of channels holding color information.
+
+=cut
+*/
+
+#define i_img_color_channels(im) (i_img_has_alpha(im) ? (im)->channels - 1 : (im)->channels)
+
+#endif
View
@@ -63,6 +63,8 @@ Imager::APIRef - Imager's C API.
# Image Implementation
+ # Image Information
+
# Image quantization
# Logging
@@ -616,7 +618,7 @@ Creates a new general fill which fills with a fountain fill.
=for comment
-From: File filters.c
+From: File filters.im
=item i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
@@ -905,6 +907,31 @@ From: File image.c
=back
+=head2 Image Information
+
+=over
+
+=item i_img_color_channels(im)
+
+
+The number of channels holding color information.
+
+
+=for comment
+From: File immacros.h
+
+=item i_img_has_alpha(im)
+
+
+Return true if the image has an alpha channel.
+
+
+=for comment
+From: File immacros.h
+
+
+=back
+
=head2 Image quantization
=over
@@ -94,7 +94,7 @@ of the image, using filled => 1 and color works at 8-bits/sample
fountain Yes
gaussian Yes
gradgen No
- hardinvert No
+ hardinvert Yes
mosaic No
postlevels No
radnoise No

0 comments on commit bea65b1

Please sign in to comment.