Permalink
Browse files

Ticket #369 - writing grayscale images to GIF

related change to support passing const channel arrays to i_gsamp()
  • Loading branch information...
1 parent 21aa4e1 commit 18accb2acf8562f8c69d23f7b9523f6194d641c9 Tony Cook committed Mar 25, 2002
Showing with 258 additions and 104 deletions.
  1. +4 −0 Changes
  2. +2 −2 datatypes.h
  3. +7 −7 image.c
  4. +1 −1 imagei.h
  5. +4 −4 img16.c
  6. +4 −4 imgdouble.c
  7. +4 −4 maskimg.c
  8. +2 −2 palimg.c
  9. +174 −79 quant.c
  10. +56 −1 t/t105gif.t
View
@@ -610,6 +610,10 @@ Revision history for Perl extension Imager.
- make t1log optional, defaulting to off. You can enable the log
with Imager::init(t1log=>1) (Ticket #369)
- quote a few hash key strings to prevent warnings on 5.004
+ - modify quantization code to handle 1 channel images
+ correctly (Ticket #365)
+ - make channel pointer to i_gsamp() const int * so we can pass
+ const arrays
=================================================================
View
@@ -85,9 +85,9 @@ typedef int (*i_f_glin_t)(i_img *im, int x, int r, int y, i_color *vals);
typedef int (*i_f_glinf_t)(i_img *im, int x, int r, int y, i_fcolor *vals);
typedef int (*i_f_gsamp_t)(i_img *im, int x, int r, int y, i_sample_t *samp,
- int *chans, int chan_count);
+ const int *chans, int chan_count);
typedef int (*i_f_gsampf_t)(i_img *im, int x, int r, int y, i_fsample_t *samp,
- int *chan, int chan_count);
+ const int *chan, int chan_count);
typedef int (*i_f_gpal_t)(i_img *im, int x, int r, int y, i_palidx *vals);
typedef int (*i_f_ppal_t)(i_img *im, int x, int r, int y, i_palidx *vals);
View
@@ -48,10 +48,10 @@ static int i_ppixf_d(i_img *im, int x, int y, i_fcolor *val);
static int i_gpixf_d(i_img *im, int x, int y, i_fcolor *val);
static int i_glinf_d(i_img *im, int l, int r, int y, i_fcolor *vals);
static int i_plinf_d(i_img *im, int l, int r, int y, i_fcolor *vals);
-static int i_gsamp_d(i_img *im, int l, int r, int y, i_sample_t *samps, int *chans, int chan_count);
-static int i_gsampf_d(i_img *im, int l, int r, int y, i_fsample_t *samps, int *chans, int chan_count);
-static int i_psamp_d(i_img *im, int l, int r, int y, i_sample_t *samps, int *chans, int chan_count);
-static int i_psampf_d(i_img *im, int l, int r, int y, i_fsample_t *samps, int *chans, int chan_count);
+static int i_gsamp_d(i_img *im, int l, int r, int y, i_sample_t *samps, const int *chans, int chan_count);
+static int i_gsampf_d(i_img *im, int l, int r, int y, i_fsample_t *samps, const int *chans, int chan_count);
+/*static int i_psamp_d(i_img *im, int l, int r, int y, i_sample_t *samps, int *chans, int chan_count);
+ static int i_psampf_d(i_img *im, int l, int r, int y, i_fsample_t *samps, int *chans, int chan_count);*/
/*
=item ICL_new_internal(r, g, b, a)
@@ -1508,7 +1508,7 @@ Returns the number of samples read (which should be (r-l) * bits_set(chan_mask)
static
int
i_gsamp_d(i_img *im, int l, int r, int y, i_sample_t *samps,
- int *chans, int chan_count) {
+ const int *chans, int chan_count) {
int ch, count, i, w;
unsigned char *data;
@@ -1566,7 +1566,7 @@ Returns the number of samples read (which should be (r-l) * bits_set(chan_mask)
static
int
i_gsampf_d(i_img *im, int l, int r, int y, i_fsample_t *samps,
- int *chans, int chan_count) {
+ const int *chans, int chan_count) {
int ch, count, i, w;
unsigned char *data;
for (ch = 0; ch < chan_count; ++ch) {
@@ -1728,7 +1728,7 @@ int i_glinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix) {
=cut
*/
int i_gsampf_fp(i_img *im, int l, int r, int y, i_fsample_t *samp,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
i_sample_t *work;
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
View
@@ -15,7 +15,7 @@ extern int i_gpixf_fp(i_img *im, int x, int y, i_fcolor *pix);
extern int i_plinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix);
extern int i_glinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix);
extern int i_gsampf_fp(i_img *im, int l, int r, int y, i_fsample_t *samp,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
/* wrapper functions that forward palette calls to the underlying image,
assuming the underlying image is the first pointer in whatever
View
@@ -32,9 +32,9 @@ static int i_gpixf_d16(i_img *im, int x, int y, i_fcolor *val);
static int i_glinf_d16(i_img *im, int l, int r, int y, i_fcolor *vals);
static int i_plinf_d16(i_img *im, int l, int r, int y, i_fcolor *vals);
static int i_gsamp_d16(i_img *im, int l, int r, int y, i_sample_t *samps,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
static int i_gsampf_d16(i_img *im, int l, int r, int y, i_fsample_t *samps,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
/*
=item IIM_base_16bit_direct
@@ -313,7 +313,7 @@ static int i_plinf_d16(i_img *im, int l, int r, int y, i_fcolor *vals) {
}
static int i_gsamp_d16(i_img *im, int l, int r, int y, i_sample_t *samps,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
int ch, count, i, w;
int off;
@@ -358,7 +358,7 @@ static int i_gsamp_d16(i_img *im, int l, int r, int y, i_sample_t *samps,
}
static int i_gsampf_d16(i_img *im, int l, int r, int y, i_fsample_t *samps,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
int ch, count, i, w;
int off;
View
@@ -32,9 +32,9 @@ static int i_gpixf_ddoub(i_img *im, int x, int y, i_fcolor *val);
static int i_glinf_ddoub(i_img *im, int l, int r, int y, i_fcolor *vals);
static int i_plinf_ddoub(i_img *im, int l, int r, int y, i_fcolor *vals);
static int i_gsamp_ddoub(i_img *im, int l, int r, int y, i_sample_t *samps,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
static int i_gsampf_ddoub(i_img *im, int l, int r, int y, i_fsample_t *samps,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
/*
=item IIM_base_16bit_direct
@@ -260,7 +260,7 @@ static int i_plinf_ddoub(i_img *im, int l, int r, int y, i_fcolor *vals) {
}
static int i_gsamp_ddoub(i_img *im, int l, int r, int y, i_sample_t *samps,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
int ch, count, i, w;
int off;
@@ -305,7 +305,7 @@ static int i_gsamp_ddoub(i_img *im, int l, int r, int y, i_sample_t *samps,
}
static int i_gsampf_ddoub(i_img *im, int l, int r, int y, i_fsample_t *samps,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
int ch, count, i, w;
int off;
View
@@ -43,9 +43,9 @@ static int i_gpixf_masked(i_img *im, int x, int y, i_fcolor *pix);
static int i_glin_masked(i_img *im, int l, int r, int y, i_color *vals);
static int i_glinf_masked(i_img *im, int l, int r, int y, i_fcolor *vals);
static int i_gsamp_masked(i_img *im, int l, int r, int y, i_sample_t *samp,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
static int i_gsampf_masked(i_img *im, int l, int r, int y, i_fsample_t *samp,
- int *chans, int chan_count);
+ int const *chans, int chan_count);
static int i_gpal_masked(i_img *im, int l, int r, int y, i_palidx *vals);
static int i_ppal_masked(i_img *im, int l, int r, int y, i_palidx *vals);
@@ -438,7 +438,7 @@ static int i_glinf_masked(i_img *im, int l, int r, int y, i_fcolor *vals) {
}
static int i_gsamp_masked(i_img *im, int l, int r, int y, i_sample_t *samp,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
i_img_mask_ext *ext = MASKEXT(im);
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
if (r > im->xsize)
@@ -452,7 +452,7 @@ static int i_gsamp_masked(i_img *im, int l, int r, int y, i_sample_t *samp,
}
static int i_gsampf_masked(i_img *im, int l, int r, int y, i_fsample_t *samp,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
i_img_mask_ext *ext = MASKEXT(im);
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
if (r > im->xsize)
View
@@ -26,7 +26,7 @@ static int i_ppix_p(i_img *im, int x, int y, i_color *val);
static int i_gpix_p(i_img *im, int x, int y, i_color *val);
static int i_glin_p(i_img *im, int l, int r, int y, i_color *vals);
static int i_plin_p(i_img *im, int l, int r, int y, i_color *vals);
-static int i_gsamp_p(i_img *im, int l, int r, int y, i_sample_t *samps, int *chans, int chan_count);
+static int i_gsamp_p(i_img *im, int l, int r, int y, i_sample_t *samps, int const *chans, int chan_count);
static int i_gpal_p(i_img *pm, int l, int r, int y, i_palidx *vals);
static int i_ppal_p(i_img *pm, int l, int r, int y, i_palidx *vals);
static int i_addcolors_p(i_img *im, i_color *color, int count);
@@ -353,7 +353,7 @@ static int i_plin_p(i_img *im, int l, int r, int y, i_color *vals) {
=cut
*/
static int i_gsamp_p(i_img *im, int l, int r, int y, i_sample_t *samps,
- int *chans, int chan_count) {
+ int const *chans, int chan_count) {
int ch;
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
int palsize = PALEXT(im)->count;
Oops, something went wrong. Retry.

0 comments on commit 18accb2

Please sign in to comment.