0.99.31 fun

updated print plugin

-Yosh
This commit is contained in:
Manish Singh 1998-05-17 07:16:50 +00:00
parent 8e3b756cd4
commit 0820b13c74
10 changed files with 666 additions and 156 deletions

View File

@ -1,3 +1,9 @@
Sun May 17 00:15:40 PDT 1998 Manish Singh <yosh@gimp.org>
* Made 0.99.29 release
* updated print plugin
Fri May 15 23:35:43 PDT 1998 Manish Singh <yosh@gimp.org>
* app/fileops.c: made url plugin autodetect work again

4
NOTES
View File

@ -1,7 +1,7 @@
Some notes on GIMP-0.99.29:
Some notes on GIMP-0.99.31:
Please remove everything from your old plugins dir before upgrading to
0.99.28. Some plugins are no longer in the dist and will not be updated.
0.99.31. Some plugins are no longer in the dist and will not be updated.
-- Federico Mena <federico@nuclecu.unam.mx>
-- Christoph Hoegl <darkwing@bsddmail.franken.de>

4
README
View File

@ -1,12 +1,12 @@
The GIMP: the GNU Image Manipulation Program
--------------------------------------------
This is version 0.99.29 of the GIMP. For the most part it contains all
This is version 0.99.31 of the GIMP. For the most part it contains all
of the features that will be in version 1.0 of the GIMP. It does,
however, lack a) documentation, b) robustness and c) some of the
plug-ins found in the 0.54 version.
The main difference between v0.99.29 and much earlier versions is the
The main difference between v0.99.31 and much earlier versions is the
use of a tile based memory management for images. This allows the GIMP
to work with images much larger than physical memory in a usable
fashion. Before such memory management, the GIMP was nearly unusable

View File

@ -7,7 +7,7 @@ GIMP_MAJOR_VERSION=0
dnl $Format: "GIMP_MINOR_VERSION=$ReleaseMinorVersion$" $
GIMP_MINOR_VERSION=99
dnl $Format: "GIMP_MICRO_VERSION=$ReleaseMicroVersion$" $
GIMP_MICRO_VERSION=29
GIMP_MICRO_VERSION=31
GIMP_VERSION=$GIMP_MAJOR_VERSION.$GIMP_MINOR_VERSION.$GIMP_MICRO_VERSION

View File

@ -1,4 +1,4 @@
%define ver 0.99.29
%define ver 0.99.31
%define rel SNAP
Summary: The GNU Image Manipulation Program

View File

@ -30,13 +30,16 @@
* Revision History:
*
* $Log$
* Revision 1.8 1998/05/14 00:32:46 yosh
* Revision 1.9 1998/05/17 07:16:45 yosh
* 0.99.31 fun
*
* updated print plugin
*
* stubbed out nonworking frac code
*
* -Yosh
*
* Revision 1.11 1998/05/15 21:01:51 mike
* Updated image positioning code (invert top and center left/top independently)
*
* Revision 1.10 1998/05/08 21:18:34 mike
* Now enable microweaving in 720 DPI mode.
*
@ -396,11 +399,13 @@ escp2_print(int model, /* I - Model */
left = x;
};
if (top < 0 || left < 0)
{
left = (page_width - out_width) / 2;
top = (page_height + out_height) / 2;
};
if (left < 0)
left = (page_width - out_width) / 2 + page_left;
if (top < 0)
top = (page_height + out_height) / 2 + page_bottom;
else
top = page_height - top + page_bottom;
/*
* Let the user know what we're doing...
@ -491,7 +496,7 @@ escp2_print(int model, /* I - Model */
out_width = xdpi * out_width / 72;
out_height = ydpi * out_height / 72;
left = ydpi * left / 72;
left = ydpi * (left - page_left) / 72;
/*
* Allocate memory for the raster data...

View File

@ -25,19 +25,28 @@
* parameter.
* pcl_imageable_area() - Return the imageable area of the page.
* pcl_print() - Print an image to an HP printer.
* dither_black4() - Dither grayscale pixels to 4 levels of black.
* dither_cmyk4() - Dither RGB pixels to 4 levels of cyan, magenta,
* yellow, and black.
* pcl_mode0() - Send PCL graphics using mode 0 (no) compression.
* pcl_mode2() - Send PCL graphics using mode 2 (TIFF) compression.
*
* Revision History:
*
* $Log$
* Revision 1.8 1998/05/14 00:32:48 yosh
* Revision 1.9 1998/05/17 07:16:46 yosh
* 0.99.31 fun
*
* updated print plugin
*
* stubbed out nonworking frac code
*
* -Yosh
*
* Revision 1.12 1998/05/16 18:27:59 mike
* Added support for 4-level "CRet" mode of 800/1100 series printers.
*
* Revision 1.11 1998/05/15 21:01:51 mike
* Updated image positioning code (invert top and center left/top independently)
*
* Revision 1.10 1998/05/08 21:22:00 mike
* Added quality mode command for DeskJet printers (high quality for 300
* DPI or higher).
@ -84,13 +93,28 @@
#include "print.h"
/*
* Constants for 4-level dithering functions...
*/
#define LEVEL_3 255
#define LEVEL_2 213
#define LEVEL_1 127
#define LEVEL_0 0
/*
* Local functions...
*/
static void dither_black4(guchar *, int, int, int, unsigned char *);
static void dither_cmyk4(guchar *, int, int, int, unsigned char *,
unsigned char *, unsigned char *, unsigned char *);
static void pcl_mode0(FILE *, unsigned char *, int, int);
static void pcl_mode2(FILE *, unsigned char *, int, int);
extern int error[2][4][14*720+4];
/*
* 'pcl_parameters()' - Return the parameter values for the given parameter.
@ -336,9 +360,6 @@ pcl_print(int model, /* I - Model */
colorfunc = rgb_to_rgb;
else
colorfunc = indexed_to_rgb;
if (model == 800)
xdpi = ydpi = 300;
}
else
{
@ -473,11 +494,13 @@ pcl_print(int model, /* I - Model */
left = x;
};
if (top < 0 || left < 0)
{
left = (page_width - out_width) / 2;
top = (page_height + out_height) / 2;
};
if (left < 0)
left = (page_width - out_width) / 2 + page_left;
if (top < 0)
top = (page_height + out_height) / 2 + page_bottom;
else
top = page_height - top + page_bottom;
#ifdef DEBUG
printf("page_width = %d, page_height = %d\n", page_width, page_height);
@ -593,6 +616,48 @@ pcl_print(int model, /* I - Model */
putc(0, prn);
putc(2, prn); /* # of yellow levels */
}
else if (xdpi == 300 && model == 800) /* 300 DPI CRet */
{
/*
* Send 26-byte configure image data command with horizontal and
* vertical resolutions as well as a color count...
*/
fputs("\033*g26W", prn);
putc(2, prn); /* Format 2 */
if (output_type == OUTPUT_COLOR)
putc(4, prn); /* # output planes */
else
putc(1, prn); /* # output planes */
putc(xdpi >> 8, prn); /* Black resolution */
putc(xdpi, prn);
putc(ydpi >> 8, prn);
putc(ydpi, prn);
putc(0, prn);
putc(4, prn); /* # of black levels */
putc(xdpi >> 8, prn); /* Cyan resolution */
putc(xdpi, prn);
putc(ydpi >> 8, prn);
putc(ydpi, prn);
putc(0, prn);
putc(4, prn); /* # of cyan levels */
putc(xdpi >> 8, prn); /* Magenta resolution */
putc(xdpi, prn);
putc(ydpi >> 8, prn);
putc(ydpi, prn);
putc(0, prn);
putc(4, prn); /* # of magenta levels */
putc(xdpi >> 8, prn); /* Yellow resolution */
putc(xdpi, prn);
putc(ydpi >> 8, prn);
putc(ydpi, prn);
putc(0, prn);
putc(4, prn); /* # of yellow levels */
}
else
{
fprintf(prn, "\033*t%dR", xdpi); /* Simple resolution */
@ -617,7 +682,7 @@ pcl_print(int model, /* I - Model */
out_width = xdpi * out_width / 72;
out_height = ydpi * out_height / 72;
fprintf(prn, "\033&a%dH", 10 * left); /* Set left raster position */
fprintf(prn, "\033&a%dH", 10 * left - 180); /* Set left raster position */
fprintf(prn, "\033&a%dV", 10 * top); /* Set top raster position */
fprintf(prn, "\033*r%dS", out_width); /* Set raster width */
fprintf(prn, "\033*r%dT", out_height); /* Set raster height */
@ -629,6 +694,8 @@ pcl_print(int model, /* I - Model */
*/
length = (out_width + 7) / 8;
if (xdpi == 300 && model == 800)
length *= 2;
if (output_type == OUTPUT_GRAY)
{
@ -687,21 +754,55 @@ pcl_print(int model, /* I - Model */
(*colorfunc)(in, out, drawable->height, drawable->bpp, lut, cmap);
if (output_type == OUTPUT_GRAY)
if (xdpi == 300 && model == 800)
{
dither_black(out, x, drawable->height, out_width, black);
(*writefunc)(prn, black, length, 1);
/*
* 4-level (CRet) dithers...
*/
if (output_type == OUTPUT_GRAY)
{
dither_black4(out, x, drawable->height, out_width, black);
(*writefunc)(prn, black, length / 2, 0);
(*writefunc)(prn, black + length / 2, length / 2, 1);
}
else
{
dither_cmyk4(out, x, drawable->height, out_width, cyan, magenta,
yellow, black);
(*writefunc)(prn, black, length / 2, 0);
(*writefunc)(prn, black + length / 2, length / 2, 0);
(*writefunc)(prn, cyan, length / 2, 0);
(*writefunc)(prn, cyan + length / 2, length / 2, 0);
(*writefunc)(prn, magenta, length / 2, 0);
(*writefunc)(prn, magenta + length / 2, length / 2, 0);
(*writefunc)(prn, yellow, length / 2, 0);
(*writefunc)(prn, yellow + length / 2, length / 2, 1);
};
}
else
{
dither_cmyk(out, x, drawable->height, out_width, cyan, magenta,
yellow, black);
/*
* Standard 2-level dithers...
*/
if (black != NULL)
(*writefunc)(prn, black, length, 0);
(*writefunc)(prn, cyan, length, 0);
(*writefunc)(prn, magenta, length, 0);
(*writefunc)(prn, yellow, length, 1);
if (output_type == OUTPUT_GRAY)
{
dither_black(out, x, drawable->height, out_width, black);
(*writefunc)(prn, black, length, 1);
}
else
{
dither_cmyk(out, x, drawable->height, out_width, cyan, magenta,
yellow, black);
if (black != NULL)
(*writefunc)(prn, black, length, 0);
(*writefunc)(prn, cyan, length, 0);
(*writefunc)(prn, magenta, length, 0);
(*writefunc)(prn, yellow, length, 1);
};
};
errval += errmod;
@ -742,21 +843,55 @@ pcl_print(int model, /* I - Model */
(*colorfunc)(in, out, drawable->width, drawable->bpp, lut, cmap);
if (output_type == OUTPUT_GRAY)
if (xdpi == 300 && model == 800)
{
dither_black(out, y, drawable->width, out_width, black);
(*writefunc)(prn, black, length, 1);
/*
* 4-level (CRet) dithers...
*/
if (output_type == OUTPUT_GRAY)
{
dither_black4(out, y, drawable->width, out_width, black);
(*writefunc)(prn, black, length / 2, 0);
(*writefunc)(prn, black + length / 2, length / 2, 1);
}
else
{
dither_cmyk4(out, y, drawable->width, out_width, cyan, magenta,
yellow, black);
(*writefunc)(prn, black, length / 2, 0);
(*writefunc)(prn, black + length / 2, length / 2, 0);
(*writefunc)(prn, cyan, length / 2, 0);
(*writefunc)(prn, cyan + length / 2, length / 2, 0);
(*writefunc)(prn, magenta, length / 2, 0);
(*writefunc)(prn, magenta + length / 2, length / 2, 0);
(*writefunc)(prn, yellow, length / 2, 0);
(*writefunc)(prn, yellow + length / 2, length / 2, 1);
};
}
else
{
dither_cmyk(out, y, drawable->width, out_width, cyan, magenta,
yellow, black);
/*
* Standard 2-level dithers...
*/
if (black != NULL)
(*writefunc)(prn, black, length, 0);
(*writefunc)(prn, cyan, length, 0);
(*writefunc)(prn, magenta, length, 0);
(*writefunc)(prn, yellow, length, 1);
if (output_type == OUTPUT_GRAY)
{
dither_black(out, x, drawable->width, out_width, black);
(*writefunc)(prn, black, length, 1);
}
else
{
dither_cmyk(out, x, drawable->width, out_width, cyan, magenta,
yellow, black);
if (black != NULL)
(*writefunc)(prn, black, length, 0);
(*writefunc)(prn, cyan, length, 0);
(*writefunc)(prn, magenta, length, 0);
(*writefunc)(prn, yellow, length, 1);
};
};
errval += errmod;
@ -803,6 +938,340 @@ pcl_print(int model, /* I - Model */
}
/*
* 'dither_black4()' - Dither grayscale pixels to 4 levels of black.
*/
static void
dither_black4(guchar *gray, /* I - Grayscale pixels */
int row, /* I - Current Y coordinate */
int src_width, /* I - Width of input row */
int dst_width, /* I - Width of output rows */
unsigned char *black) /* O - Black bitmap pixels */
{
int x, /* Current X coordinate */
xerror, /* X error count */
xstep, /* X step */
xmod, /* X error modulus */
length; /* Length of output bitmap in bytes */
unsigned char bit, /* Current bit */
*kptr; /* Current black pixel */
int k, /* Current black value */
ditherk, /* Next error value in buffer */
*kerror0, /* Pointer to current error row */
*kerror1; /* Pointer to next error row */
int ditherbit; /* Random dither bitmask */
xstep = src_width / dst_width;
xmod = src_width % dst_width;
length = (dst_width + 7) / 8;
kerror0 = error[row & 1][3];
kerror1 = error[1 - (row & 1)][3];
memset(black, 0, length * 2);
for (x = 0, bit = 128, kptr = black, xerror = 0, ditherbit = rand(),
ditherk = kerror0[0];
x < dst_width;
x ++, kerror0 ++, kerror1 ++)
{
k = 255 - *gray + ditherk / 8;
if (k > ((LEVEL_2 + LEVEL_3) / 2))
{
kptr[0] |= bit;
kptr[length] |= bit;
k -= LEVEL_3;
}
else if (k > ((LEVEL_1 + LEVEL_2) / 2))
{
kptr[length] |= bit;
k -= LEVEL_2;
}
else if (k > ((LEVEL_0 + LEVEL_1) / 2))
{
kptr[0] |= bit;
k -= LEVEL_1;
};
if (ditherbit & bit)
{
kerror1[0] = 5 * k;
ditherk = kerror0[1] + 3 * k;
}
else
{
kerror1[0] = 3 * k;
ditherk = kerror0[1] + 5 * k;
};
if (bit == 1)
{
kptr ++;
bit = 128;
ditherbit = rand();
}
else
bit >>= 1;
gray += xstep;
xerror += xmod;
if (xerror >= dst_width)
{
xerror -= dst_width;
gray ++;
};
};
}
/*
* 'dither_cmyk4()' - Dither RGB pixels to 4 levels of cyan, magenta, yellow,
* and black.
*/
static void
dither_cmyk4(guchar *rgb, /* I - RGB pixels */
int row, /* I - Current Y coordinate */
int src_width, /* I - Width of input row */
int dst_width, /* I - Width of output rows */
unsigned char *cyan, /* O - Cyan bitmap pixels */
unsigned char *magenta, /* O - Magenta bitmap pixels */
unsigned char *yellow, /* O - Yellow bitmap pixels */
unsigned char *black) /* O - Black bitmap pixels */
{
int x, /* Current X coordinate */
xerror, /* X error count */
xstep, /* X step */
xmod, /* X error modulus */
length; /* Length of output bitmap in bytes */
int c, m, y, k, /* CMYK values */
divk, /* Inverse of K */
diff; /* Average color difference */
unsigned char bit, /* Current bit */
*cptr, /* Current cyan pixel */
*mptr, /* Current magenta pixel */
*yptr, /* Current yellow pixel */
*kptr; /* Current black pixel */
int ditherc, /* Next error value in buffer */
*cerror0, /* Pointer to current error row */
*cerror1; /* Pointer to next error row */
int dithery, /* Next error value in buffer */
*yerror0, /* Pointer to current error row */
*yerror1; /* Pointer to next error row */
int ditherm, /* Next error value in buffer */
*merror0, /* Pointer to current error row */
*merror1; /* Pointer to next error row */
int ditherk, /* Next error value in buffer */
*kerror0, /* Pointer to current error row */
*kerror1; /* Pointer to next error row */
int ditherbit; /* Random dither bitmask */
xstep = 3 * (src_width / dst_width);
xmod = src_width % dst_width;
length = (dst_width + 7) / 8;
cerror0 = error[row & 1][0];
cerror1 = error[1 - (row & 1)][0];
merror0 = error[row & 1][1];
merror1 = error[1 - (row & 1)][1];
yerror0 = error[row & 1][2];
yerror1 = error[1 - (row & 1)][2];
kerror0 = error[row & 1][3];
kerror1 = error[1 - (row & 1)][3];
memset(cyan, 0, length * 2);
memset(magenta, 0, length * 2);
memset(yellow, 0, length * 2);
memset(black, 0, length * 2);
for (x = 0, bit = 128, cptr = cyan, mptr = magenta, yptr = yellow,
kptr = black, xerror = 0, ditherbit = rand(), ditherc = cerror0[0],
ditherm = merror0[0], dithery = yerror0[0], ditherk = kerror0[0];
x < dst_width;
x ++, cerror0 ++, cerror1 ++, merror0 ++, merror1 ++, yerror0 ++,
yerror1 ++, kerror0 ++, kerror1 ++)
{
/*
* First compute the standard CMYK separation color values...
*/
c = 255 - rgb[0];
m = 255 - rgb[1];
y = 255 - rgb[2];
k = MIN(c, MIN(m, y));
/*
* Since we're printing black, adjust the black level based upon
* the amount of color in the pixel (colorful pixels get less black)...
*/
diff = 255 - (abs(c - m) + abs(c - y) + abs(m - y)) / 3;
diff = diff * diff * diff / 65025; /* diff = diff^3 */
k = diff * k / 255;
divk = 255 - k;
if (divk == 0)
c = m = y = 0; /* Grayscale */
else
{
/*
* Full color; update the CMY values for the black value and reduce
* CMY as necessary to give better blues, greens, and reds... :)
*/
c = (255 - rgb[1] / 4) * (c - k) / divk;
m = (255 - rgb[2] / 4) * (m - k) / divk;
y = (255 - rgb[0] / 4) * (y - k) / divk;
};
k += ditherk / 8;
if (k > ((LEVEL_2 + LEVEL_3) / 2))
{
kptr[0] |= bit;
kptr[length] |= bit;
k -= LEVEL_3;
}
else if (k > ((LEVEL_1 + LEVEL_2) / 2))
{
kptr[length] |= bit;
k -= LEVEL_2;
}
else if (k > ((LEVEL_0 + LEVEL_1) / 2))
{
kptr[0] |= bit;
k -= LEVEL_1;
};
if (ditherbit & bit)
{
kerror1[0] = 5 * k;
ditherk = kerror0[1] + 3 * k;
}
else
{
kerror1[0] = 3 * k;
ditherk = kerror0[1] + 5 * k;
};
c += ditherc / 8;
if (c > ((LEVEL_2 + LEVEL_3) / 2))
{
cptr[0] |= bit;
cptr[length] |= bit;
c -= LEVEL_3;
}
else if (c > ((LEVEL_1 + LEVEL_2) / 2))
{
cptr[length] |= bit;
c -= LEVEL_2;
}
else if (c > ((LEVEL_0 + LEVEL_1) / 2))
{
cptr[0] |= bit;
c -= LEVEL_1;
};
if (ditherbit & bit)
{
cerror1[0] = 5 * c;
ditherc = cerror0[1] + 3 * c;
}
else
{
cerror1[0] = 3 * c;
ditherc = cerror0[1] + 5 * c;
};
m += ditherm / 8;
if (m > ((LEVEL_2 + LEVEL_3) / 2))
{
mptr[0] |= bit;
mptr[length] |= bit;
m -= LEVEL_3;
}
else if (m > ((LEVEL_1 + LEVEL_2) / 2))
{
mptr[length] |= bit;
m -= LEVEL_2;
}
else if (m > ((LEVEL_0 + LEVEL_1) / 2))
{
mptr[0] |= bit;
m -= LEVEL_1;
};
if (ditherbit & bit)
{
merror1[0] = 5 * m;
ditherm = merror0[1] + 3 * m;
}
else
{
merror1[0] = 3 * m;
ditherm = merror0[1] + 5 * m;
};
y += dithery / 8;
if (y > ((LEVEL_2 + LEVEL_3) / 2))
{
yptr[0] |= bit;
yptr[length] |= bit;
y -= LEVEL_3;
}
else if (y > ((LEVEL_1 + LEVEL_2) / 2))
{
yptr[length] |= bit;
y -= LEVEL_2;
}
else if (y > ((LEVEL_0 + LEVEL_1) / 2))
{
yptr[0] |= bit;
y -= LEVEL_1;
};
if (ditherbit & bit)
{
yerror1[0] = 5 * y;
dithery = yerror0[1] + 3 * y;
}
else
{
yerror1[0] = 3 * y;
dithery = yerror0[1] + 5 * y;
};
if (bit == 1)
{
cptr ++;
mptr ++;
yptr ++;
kptr ++;
bit = 128;
ditherbit = rand();
}
else
bit >>= 1;
rgb += xstep;
xerror += xmod;
if (xerror >= dst_width)
{
xerror -= dst_width;
rgb += 3;
};
};
}
/*
* 'pcl_mode0()' - Send PCL graphics using mode 0 (no) compression.
*/

View File

@ -32,13 +32,18 @@
* Revision History:
*
* $Log$
* Revision 1.8 1998/05/14 00:32:49 yosh
* Revision 1.9 1998/05/17 07:16:47 yosh
* 0.99.31 fun
*
* updated print plugin
*
* stubbed out nonworking frac code
*
* -Yosh
*
* Revision 1.13 1998/05/15 21:01:51 mike
* Updated image positioning code (invert top and center left/top independently)
* Updated ps_imageable_area() to return a default imageable area when no PPD
* file is available.
*
* Revision 1.12 1998/05/11 23:56:56 mike
* Removed unused outptr variable.
*
@ -270,7 +275,13 @@ ps_imageable_area(int model, /* I - Printer model */
*left = *right = *bottom = *top = 0;
}
else
*left = *right = *bottom = *top = 0;
{
default_media_size(model, ppd_file, media_size, right, top);
*left = 18;
*right -= 18;
*top -= 36;
*bottom = 36;
};
}
@ -486,11 +497,13 @@ ps_print(int model, /* I - Model (Level 1 or 2) */
curtime = time(NULL);
if (top < 0 || left < 0)
{
if (left < 0)
left = (page_width - out_width) / 2 + page_left;
if (top < 0)
top = (page_height + out_height) / 2 + page_bottom;
};
else
top = page_height - top + page_bottom;
#ifdef DEBUG
printf("out_width = %d, out_height = %d\n", out_width, out_height);

View File

@ -34,13 +34,16 @@
* Revision History:
*
* $Log$
* Revision 1.9 1998/05/14 00:32:50 yosh
* Revision 1.10 1998/05/17 07:16:49 yosh
* 0.99.31 fun
*
* updated print plugin
*
* stubbed out nonworking frac code
*
* -Yosh
*
* Revision 1.14 1998/05/16 18:27:59 mike
* Cleaned up dithering functions - unnecessary extra data in dither buffer.
*
* Revision 1.13 1998/05/13 17:00:36 mike
* Minor change to CMYK generation code - now cube black difference value
* for better colors.
@ -118,7 +121,7 @@
* (currently 720) to avoid problems...
*/
int error[2][4][14*720+4] =
int error[2][4][14*720+1] =
{
{ { 0 }, { 0 }, { 0 } , { 0 } },
{ { 0 }, { 0 }, { 0 } , { 0 } }
@ -154,10 +157,8 @@ dither_black(guchar *gray, /* I - Grayscale pixels */
xmod = src_width % dst_width;
length = (dst_width + 7) / 8;
kerror0 = error[row & 1][3] + 1;
kerror1 = error[1 - (row & 1)][3] + 1;
kerror1[0] = 0;
kerror1[1] = 0;
kerror0 = error[row & 1][3];
kerror1 = error[1 - (row & 1)][3];
memset(black, 0, length);
@ -167,6 +168,7 @@ dither_black(guchar *gray, /* I - Grayscale pixels */
x ++, kerror0 ++, kerror1 ++)
{
k = 255 - *gray + ditherk / 8;
if (k > 127)
{
*kptr |= bit;
@ -250,25 +252,17 @@ dither_cmyk(guchar *rgb, /* I - RGB pixels */
xmod = src_width % dst_width;
length = (dst_width + 7) / 8;
cerror0 = error[row & 1][0] + 2;
cerror1 = error[1 - (row & 1)][0] + 2;
cerror1[0] = 0;
cerror1[1] = 0;
cerror0 = error[row & 1][0];
cerror1 = error[1 - (row & 1)][0];
merror0 = error[row & 1][1] + 2;
merror1 = error[1 - (row & 1)][1] + 2;
merror1[0] = 0;
merror1[1] = 0;
merror0 = error[row & 1][1];
merror1 = error[1 - (row & 1)][1];
yerror0 = error[row & 1][2] + 2;
yerror1 = error[1 - (row & 1)][2] + 2;
yerror1[0] = 0;
yerror1[1] = 0;
yerror0 = error[row & 1][2];
yerror1 = error[1 - (row & 1)][2];
kerror0 = error[row & 1][3] + 2;
kerror1 = error[1 - (row & 1)][3] + 2;
kerror1[0] = 0;
kerror1[1] = 0;
kerror0 = error[row & 1][3];
kerror1 = error[1 - (row & 1)][3];
memset(cyan, 0, length);
memset(magenta, 0, length);
@ -276,8 +270,8 @@ dither_cmyk(guchar *rgb, /* I - RGB pixels */
if (black != NULL)
memset(black, 0, length);
for (x = 0, bit = 128, cptr = cyan, mptr = magenta, yptr = yellow, kptr=black,
xerror = 0, ditherbit = rand(), ditherc = cerror0[0],
for (x = 0, bit = 128, cptr = cyan, mptr = magenta, yptr = yellow,
kptr = black, xerror = 0, ditherbit = rand(), ditherc = cerror0[0],
ditherm = merror0[0], dithery = yerror0[0], ditherk = kerror0[0];
x < dst_width;
x ++, cerror0 ++, cerror1 ++, merror0 ++, merror1 ++, yerror0 ++,

View File

@ -39,13 +39,29 @@
* Revision History:
*
* $Log$
* Revision 1.9 1998/05/14 00:32:51 yosh
* Revision 1.10 1998/05/17 07:16:50 yosh
* 0.99.31 fun
*
* updated print plugin
*
* stubbed out nonworking frac code
*
* -Yosh
*
* Revision 1.21 1998/05/16 18:51:16 mike
* Updated LaserJet and PostScript profiles.
*
* Revision 1.20 1998/05/16 18:27:59 mike
* Updated brightness LUT generation for correct calibration values.
* Updated Stylus Color density - a little too high.
*
* Revision 1.19 1998/05/16 16:45:24 mike
* Added RGB/Grayscale gamma correction using the brightness (as well as the
* CMY[K] gamma correction for each printer)
*
* Revision 1.18 1998/05/15 21:01:51 mike
* Top/left need to be in points.
* All code in preview_motion_callback() was still commented out...
* Updated DeskJet and Stylus color calibration values.
*
* Revision 1.17 1998/05/11 23:56:05 mike
* Miscellaneous portability changes.
*
@ -298,53 +314,53 @@ printer_t printers[] = /* List of supported printer types */
ps_parameters, ps_media_size, ps_imageable_area, ps_print },
{ "PostScript Level 2", "ps2", 1, 1, 1.000, 1.000,
ps_parameters, ps_media_size, ps_imageable_area, ps_print },
{ "HP DeskJet 500, 520", "pcl-500", 0, 500, 0.541, 0.548,
{ "HP DeskJet 500, 520", "pcl-500", 0, 500, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP DeskJet 500C, 540C", "pcl-501", 1, 501, 0.541, 0.548,
{ "HP DeskJet 500C, 540C", "pcl-501", 1, 501, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP DeskJet 550C, 560C", "pcl-550", 1, 550, 0.541, 0.548,
{ "HP DeskJet 550C, 560C", "pcl-550", 1, 550, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP DeskJet 600 series", "pcl-600", 1, 600, 0.541, 0.548,
{ "HP DeskJet 600 series", "pcl-600", 1, 600, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP DeskJet 800 series", "pcl-800", 1, 800, 0.541, 0.548,
{ "HP DeskJet 800 series", "pcl-800", 1, 800, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP DeskJet 1100C, 1120C", "pcl-1100", 1, 1100, 0.541, 0.548,
{ "HP DeskJet 1100C, 1120C", "pcl-1100", 1, 1100, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP DeskJet 1200C, 1600C", "pcl-1200", 1, 1200, 0.541, 0.548,
{ "HP DeskJet 1200C, 1600C", "pcl-1200", 1, 1200, 0.818, 0.786,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet II series", "pcl-2", 0, 2, 0.563, 0.596,
{ "HP LaserJet II series", "pcl-2", 0, 2, 1.000, 0.596,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet III series", "pcl-3", 0, 3, 0.563, 0.596,
{ "HP LaserJet III series", "pcl-3", 0, 3, 1.000, 0.596,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet 4 series", "pcl-4", 0, 4, 0.599, 0.615,
{ "HP LaserJet 4 series", "pcl-4", 0, 4, 1.000, 0.615,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet 4V, 4Si", "pcl-4v", 0, 5, 0.599, 0.615,
{ "HP LaserJet 4V, 4Si", "pcl-4v", 0, 5, 1.000, 0.615,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet 5 series", "pcl-5", 0, 4, 0.599, 0.615,
{ "HP LaserJet 5 series", "pcl-5", 0, 4, 1.000, 0.615,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet 5Si", "pcl-5si", 0, 5, 0.599, 0.615,
{ "HP LaserJet 5Si", "pcl-5si", 0, 5, 1.000, 0.615,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "HP LaserJet 6 series", "pcl-6", 0, 4, 0.599, 0.615,
{ "HP LaserJet 6 series", "pcl-6", 0, 4, 1.000, 0.615,
pcl_parameters, default_media_size, pcl_imageable_area, pcl_print },
{ "EPSON Stylus Color", "escp2", 1, 0, 0.325, 0.478,
{ "EPSON Stylus Color", "escp2", 1, 0, 0.597, 0.568,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color Pro", "escp2-pro", 1, 1, 0.325, 0.478,
{ "EPSON Stylus Color Pro", "escp2-pro", 1, 1, 0.597, 0.631,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color Pro XL","escp2-proxl", 1, 1, 0.325, 0.478,
{ "EPSON Stylus Color Pro XL","escp2-proxl", 1, 1, 0.597, 0.631,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 1500", "escp2-1500", 1, 2, 0.325, 0.478,
{ "EPSON Stylus Color 1500", "escp2-1500", 1, 2, 0.597, 0.631,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 400", "escp2-400", 1, 1, 0.530, 0.482,
{ "EPSON Stylus Color 400", "escp2-400", 1, 1, 0.585, 0.646,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 500", "escp2-500", 1, 1, 0.530, 0.482,
{ "EPSON Stylus Color 500", "escp2-500", 1, 1, 0.597, 0.631,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 600", "escp2-600", 1, 3, 0.530, 0.482,
{ "EPSON Stylus Color 600", "escp2-600", 1, 3, 0.585, 0.646,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 800", "escp2-800", 1, 4, 0.530, 0.482,
{ "EPSON Stylus Color 800", "escp2-800", 1, 4, 0.585, 0.646,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 1520", "escp2-1520", 1, 5, 0.530, 0.482,
{ "EPSON Stylus Color 1520", "escp2-1520", 1, 5, 0.585, 0.646,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print },
{ "EPSON Stylus Color 3000", "escp2-3000", 1, 5, 0.530, 0.482,
{ "EPSON Stylus Color 3000", "escp2-3000", 1, 5, 0.585, 0.646,
escp2_parameters, default_media_size, escp2_imageable_area, escp2_print }
};
@ -384,8 +400,8 @@ query(void)
{ PARAM_INT32, "brightness", "Brightness (0-200%)" },
{ PARAM_FLOAT, "scaling", "Output scaling (0-100%, -PPI)" },
{ PARAM_INT32, "orientation", "Output orientation (-1 = auto, 0 = portrait, 1 = landscape)" },
{ PARAM_INT32, "left", "Left offset (10ths inches, -1 = centered)" },
{ PARAM_INT32, "top", "Top offset (10ths inches, -1 = centered)" }
{ PARAM_INT32, "left", "Left offset (points, -1 = centered)" },
{ PARAM_INT32, "top", "Top offset (points, -1 = centered)" }
};
static int nargs = sizeof(args) / sizeof(args[0]);
@ -422,8 +438,11 @@ run(char *name, /* I - Name of print program. */
GRunModeType run_mode; /* Current run mode */
FILE *prn; /* Print file/command */
printer_t *printer; /* Printer driver entry */
int i, j; /* Looping vars */
float brightness; /* Computed brightness */
int i; /* Looping var */
float brightness, /* Computed brightness */
screen_gamma, /* Screen gamma correction */
print_gamma, /* Printer gamma correction */
pixel; /* Pixel value */
guchar lut[256]; /* Lookup table for brightness */
guchar *cmap; /* Colormap (indexed images only) */
int ncolors; /* Number of colors in colormap */
@ -576,18 +595,23 @@ run(char *name, /* I - Name of print program. */
* Got an output file/command, now compute a brightness lookup table...
*/
printer = printers + current_printer;
brightness = 25500.0 * printer->density / vars.brightness;
printer = printers + current_printer;
brightness = 100.0 / vars.brightness;
screen_gamma = gimp_gamma() * brightness / 1.7;
print_gamma = 1.0 / printer->gamma;
for (i = 0; i < 256; i ++)
{
j = 255.5 - brightness * (1.0 - pow((float)i / 255.0, printer->gamma));
if (j < 0)
lut[i] = 0;
else if (j < 255)
lut[i] = j;
else
lut[i] = 255;
pixel = 1.0 - pow((float)i / 255.0, screen_gamma);
pixel = 255.5 - 255.0 * printer->density *
pow(brightness * pixel, print_gamma);
if (pixel <= 0.0)
lut[i] = 0;
else if (pixel >= 255.0)
lut[i] = 255;
else
lut[i] = (int)pixel;
};
/*
@ -1385,23 +1409,12 @@ plist_callback(GtkWidget *widget, /* I - Driver option menu */
};
};
if (p->ppd_file[0] != '\0')
strcpy(vars.ppd_file, p->ppd_file);
if (p->media_size[0] != '\0')
strcpy(vars.media_size, p->media_size);
if (p->media_type[0] != '\0')
strcpy(vars.media_type, p->media_type);
if (p->media_source[0] != '\0')
strcpy(vars.media_source, p->media_source);
if (p->resolution[0] != '\0')
strcpy(vars.resolution, p->resolution);
if (p->command[0] != '\0')
strcpy(vars.output_to, p->command);
strcpy(vars.ppd_file, p->ppd_file);
strcpy(vars.media_size, p->media_size);
strcpy(vars.media_type, p->media_type);
strcpy(vars.media_source, p->media_source);
strcpy(vars.resolution, p->resolution);
strcpy(vars.output_to, p->command);
if (p->output_type == OUTPUT_GRAY)
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(output_gray), TRUE);
@ -1843,24 +1856,36 @@ preview_update(void)
width, length);
if (vars.left < 0 || vars.top < 0)
gdk_draw_rectangle(preview->widget.window, gc, 1,
(PREVIEW_SIZE - print_width) / 2,
(PREVIEW_SIZE - print_height) / 2,
print_width, print_height);
if (vars.left < 0)
left = (page_width - print_width) / 2;
else
{
if (vars.left > (page_width - print_width))
vars.left = page_width - print_width;
if (vars.top > (page_height - print_height))
vars.top = page_height - print_height;
left = 10 * vars.left / 72;
gdk_draw_rectangle(preview->widget.window, gc, 1,
page_left + vars.left,
page_top + vars.top,
print_width, print_height);
if (left > (page_width - print_width))
{
left = page_width - print_width;
vars.left = 72 * left / 10;
};
};
if (vars.top < 0)
top = (page_height - print_height) / 2;
else
{
top = 10 * vars.top / 72;
if (top > (page_height - print_height))
{
top = page_height - print_height;
vars.top = 72 * top / 10;
};
};
gdk_draw_rectangle(preview->widget.window, gc, 1,
page_left + left, page_top + top,
print_width, print_height);
gdk_flush();
}
@ -1878,15 +1903,14 @@ static void
preview_motion_callback(GtkWidget *w,
GdkEventMotion *event)
{
#if 0
if (vars.left < 0 || vars.top < 0)
{
vars.left = (page_width - print_width) / 2;
vars.top = (page_height - print_height) / 2;
vars.left = 72 * (page_width - print_width) / 20;
vars.top = 72 * (page_height - print_height) / 20;
};
vars.left += event->x - mouse_x;
vars.top += event->y - mouse_y;
vars.left += 72 * (event->x - mouse_x) / 10;
vars.top += 72 * (event->y - mouse_y) / 10;
if (vars.left < 0)
vars.left = 0;
@ -1898,7 +1922,6 @@ preview_motion_callback(GtkWidget *w,
mouse_x = event->x;
mouse_y = event->y;
#endif /* 0 */
}