1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-14 23:46:10 +00:00
freebsd-ports/japanese/vfghostscript5/files/gdevmjc.c.patch

493 lines
15 KiB
Diff
Raw Normal View History

From root Fri Nov 22 01:20:20 1996
Received: from theta.iis.u-tokyo.ac.jp by daikon.fujita3.iis.u-tokyo.ac.jp (AIX 3.2/UCB 5.64/3.4W2)
id AA18127; Fri, 22 Nov 1996 01:20:20 +0900
Received: from contura.sail.t.u-tokyo.ac.jp by theta.iis.u-tokyo.ac.jp (8.7.5+2.6Wbeta6/3.4W4) with ESMTP id BAA07053; Fri, 22 Nov 1996 01:20:12 +0900 (JST)
Received: (from kurosawa@localhost) by contura.sail.t.u-tokyo.ac.jp (8.7.6/3.4Wbeta6/Sail961016) id BAA11954; Fri, 22 Nov 1996 01:19:56 +0900 (JST)
Date: Fri, 22 Nov 1996 01:19:56 +0900 (JST)
Message-Id: <199611211619.BAA11954@contura.sail.t.u-tokyo.ac.jp>
To: mita@iis.u-tokyo.ac.jp
Subject: mjc-patch
From: kurosawa@sail.t.u-tokyo.ac.jp (KUROSAWA Takahiro)
X-Mailer: mnews [version 1.19PL2] 1996-01/26(Fri)
$B9uBt$G$9(B.
$B$h$&$d$/$G$-$^$7$?(B, $B$?$V$s(B. $B$?$@$G$5$(F,$,2u$l$.$_$@$H8@$o$l$F$$$k$N$K(B
$B$5$i$K$A$g$C$H:#F|(B($B:rF|$+(B)$B$O$D$+$l$F$F(B, $BF,$,AjEvJQ$@$C$?$_$?$$$G$9(B.
$B:rF|J,$N%a!<%k$OL5;k$7$A$c$C$F$/$@$5$$(B.
# $B$5$C$-=P$7$?!V%(%i!<$,$G$k$h!A!W%a!<%k$N860x$G$9$1$I!$C1$K%U%)%s%H$r%$(B
# $B%s%9%H!<%k$7$F$J$+$C$?$s$G$9(B. $B$4$a$s$J$5$$(B....
$B!V=PNO%U%!%$%k$K=P$J$$!W$N7o$G$9$1$I(B, $B$A$g$C$H$7$?%1%"%l%9%_%9$H$$$&$+(B,
$B9uBt$,$h$/(B gs $B$NFbIt9=B$$rM}2r$7$F$J$$$N$,860x$G$7$?(B. $B<B$O$"$N>u67$G$O(B
/tmp $B$K%U%!%$%k$,$G$-$F$$$?$N$G$9(B.
$B$3$l$G?'$H$+%9%1!<%k$N<:GT$,$J$1$l$P$$$$$N$G$9$,(B, $B$"$^$j$=$&$&$^$/$O$$(B
$B$+$J$$$H$*$b$$$^$9(B. $B%9%1!<%k$NJ}$OLdBj$J$$$+$b$7$l$^$;$s$,(B, $B?'?t$r8:$i(B
$B$7$?$i$I$&$J$k$+$A$g$C$H?4G[$G$9(B.
$B$F$J$o$1$G(B, $B$*$?$a$7$/$@$5$$(B. $B%*%j%8%J%k$+$i$N%Q%C%A$G$9(B.
# $B%*%j%8%J%k$+$i$N%Q%C%A$K$7$?$O$:$G$9$1$I(B, $B:#F|$N>u67$@$H$A$g$C$H<+?.(B
# $B$r;}$F$J$$(B(^^;)
*** gdevmjc.c.org Fri Nov 22 00:27:16 1996
--- gdevmjc.c Fri Nov 22 00:35:20 1996
***************
*** 43,49 ****
#include <limits.h>
#include "gdevprn.h"
#include "gdevpcl.h"
! #include "gsprops.h"
/***
*** Note: Original driver gdevcdj.c for HP color printer was written
--- 43,50 ----
#include <limits.h>
#include "gdevprn.h"
#include "gdevpcl.h"
! #include "gsparam.h"
! #include "gsstate.h"
/***
*** Note: Original driver gdevcdj.c for HP color printer was written
***************
*** 139,145 ****
--- 140,148 ----
/* Undefined macros expected to be defined in gdevpcl.h */
#define PAPER_SIZE_A3_NOBI 28
+ #ifndef PAPER_SIZE_A2
#define PAPER_SIZE_A2 29
+ #endif
#define PAPER_SIZE_B4 30
#define PAPER_SIZE_B5 31
***************
*** 179,193 ****
private dev_proc_print_page(mjc720_print_page);
private dev_proc_print_page(mj500c_print_page);
! private dev_proc_get_props(mj_get_props);
! private dev_proc_put_props(mj_put_props);
private void expand_line(word *, int, int, int);
! private int put_prop_float(gs_prop_item *, float *, float, float, int);
! private int put_prop_int(gs_prop_item *, int *, int, int, int);
!
! private void set_bpp(gx_device *, int);
private uint gdev_prn_rasterwidth(const gx_device_printer *, int );
--- 182,194 ----
private dev_proc_print_page(mjc720_print_page);
private dev_proc_print_page(mj500c_print_page);
! private dev_proc_get_params(mj_get_params);
! private dev_proc_put_params(mj_put_params);
private void expand_line(word *, int, int, int);
! private int mj_put_param_int(P6(gs_param_list *, gs_param_name, int *, int, int, int));
! private void mj_set_bpp(P2(gx_device *, int));
private uint gdev_prn_rasterwidth(const gx_device_printer *, int );
***************
*** 214,220 ****
#define mj ((gx_device_mj *) pdev)
#define prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page)\
! prn_device_body(gx_device_printer, procs, dev_name,\
WIDTH_10THS, HEIGHT_10THS, x_dpi, y_dpi, 0, 0, 0, 0, 0,\
bpp, 0, 0, 0, 0, print_page)
--- 215,221 ----
#define mj ((gx_device_mj *) pdev)
#define prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page)\
! prn_device_body(gx_device_mj, procs, dev_name,\
WIDTH_10THS, HEIGHT_10THS, x_dpi, y_dpi, 0, 0, 0, 0, 0,\
bpp, 0, 0, 0, 0, print_page)
***************
*** 226,234 ****
}
! #define mj_colour_procs(proc_colour_open, proc_get_props, proc_put_props) {\
proc_colour_open,\
! gdev_pcl_get_initial_matrix,\
gx_default_sync_output,\
gdev_prn_output_page,\
gdev_prn_close,\
--- 227,235 ----
}
! #define mj_colour_procs(proc_colour_open, proc_get_params, proc_put_params) {\
proc_colour_open,\
! gx_default_get_initial_matrix,\
gx_default_sync_output,\
gdev_prn_output_page,\
gdev_prn_close,\
***************
*** 240,247 ****
NULL, /* copy_color */\
NULL, /* draw_line */\
gx_default_get_bits,\
! proc_get_props,\
! proc_put_props\
}
private int mjc_open(gx_device *);
--- 241,248 ----
NULL, /* copy_color */\
NULL, /* draw_line */\
gx_default_get_bits,\
! proc_get_params,\
! proc_put_params\
}
private int mjc_open(gx_device *);
***************
*** 249,255 ****
private gx_device_procs mj_procs =
! mj_colour_procs(mjc_open, mj_get_props, mj_put_props);
gx_device_mj far_data gs_mjc180_device =
mj_device(mj_procs, "mjc180", 180, 180, BITSPERPIXEL,
--- 250,256 ----
private gx_device_procs mj_procs =
! mj_colour_procs(mjc_open, mj_get_params, mj_put_params);
gx_device_mj far_data gs_mjc180_device =
mj_device(mj_procs, "mjc180", 180, 180, BITSPERPIXEL,
***************
*** 305,311 ****
/* Set up colour params if put_props has not already done so */
if (pdev->color_info.num_components == 0)
! set_bpp(pdev, pdev->color_info.depth);
paper_size = gdev_mjc_paper_size(pdev);
if (paper_size == PAPER_SIZE_A2 ) {
--- 306,312 ----
/* Set up colour params if put_props has not already done so */
if (pdev->color_info.num_components == 0)
! mj_set_bpp(pdev, pdev->color_info.depth);
paper_size = gdev_mjc_paper_size(pdev);
if (paper_size == PAPER_SIZE_A2 ) {
***************
*** 324,333 ****
m = mj_letter;
}
! pdev->l_margin = m[0];
! pdev->b_margin = m[1];
! pdev->r_margin = m[2];
! pdev->t_margin = m[3];
switch (mj->colorcomp) {
case 1:
--- 325,331 ----
m = mj_letter;
}
! gx_device_set_margins(pdev, m, true);
switch (mj->colorcomp) {
case 1:
***************
*** 352,430 ****
* and control over the bits-per-pixel used in output rendering */
/* Added properties for DeskJet 5xxC */
- private const gs_prop_item props_mj[] = {
- /* Read-write properties. */
- prop_def("Density", prt_int),
- prop_def("Cyan", prt_int),
- prop_def("Magenta", prt_int),
- prop_def("Yellow", prt_int),
- prop_def("Black", prt_int),
- prop_def("Dither", prt_int),
- prop_def("ColorComponent", prt_int),
- prop_def("Direction", prt_int),
- prop_def("MicroWeave", prt_int),
- prop_def("DotSize", prt_int),
- };
-
private int
! mj_get_props(gx_device *pdev, gs_prop_item *plist)
! { int start = gdev_prn_get_props(pdev, plist);
! if ( plist != 0 ) {
! register gs_prop_item *pi = plist + start;
! memcpy(pi, props_mj, sizeof(props_mj));
! pi[0].value.i = mj->density;
! pi[1].value.i = mj->cyan;
! pi[2].value.i = mj->magenta;
! pi[3].value.i = mj->yellow;
! pi[4].value.i = mj->black;
! pi[5].value.i = mj->dither;
! pi[6].value.i = mj->colorcomp;
! pi[7].value.i = mj->direction;
! pi[8].value.i = mj->microweave;
! pi[9].value.i = mj->dotsize;
! }
! return start + sizeof(props_mj) / sizeof(gs_prop_item);
}
/* Put properties. */
private int
! mj_put_props(gx_device *pdev, gs_prop_item *plist, int count)
{
- static const argn = 10;
- gs_prop_item *known[argn];
int old_bpp = mj->color_info.depth;
int bpp = 0;
int code = 0;
!
! props_extract(plist, count, props_mj, argn, known, 0);
! code = gdev_prn_put_props(pdev, plist, count);
! if ( code < 0 ) return code;
!
! code = put_prop_int(known[0], &mj->density, 0, INT_MAX, code);
! code = put_prop_int(known[1], &mj->cyan, 0, INT_MAX, code);
! code = put_prop_int(known[2], &mj->magenta, 0, INT_MAX, code);
! code = put_prop_int(known[3], &mj->yellow, 0, INT_MAX, code);
! code = put_prop_int(known[4], &mj->black, 0, INT_MAX, code);
! code = put_prop_int(known[5], &mj->dither, 0, 1, code);
! code = put_prop_int(known[6], &mj->colorcomp, 1, 4, code);
! code = put_prop_int(known[7], &mj->direction, 1, 2, code);
! code = put_prop_int(known[8], &mj->microweave, 0, 1, code);
! code = put_prop_int(known[9], &mj->dotsize, 0, 1, code);
if ( code < 0 )
! return_error(code);
! if (bpp != 0) {
! set_bpp(pdev, bpp);
!
! /* Close the device; gs_putdeviceprops will reopen it. */
if ( bpp != old_bpp && pdev->is_open )
! { int ccode = gs_closedevice(pdev);
! if ( ccode < 0 ) return ccode;
! }
}
!
! return code;
}
/* ------ Internal routines ------ */
--- 350,427 ----
* and control over the bits-per-pixel used in output rendering */
/* Added properties for DeskJet 5xxC */
private int
! mj_get_params(gx_device *pdev, gs_param_list *plist)
! { int code = gdev_prn_get_params(pdev, plist);
! if ( code < 0 ||
! (code = param_write_int(plist, "Density", &mj->density)) < 0 ||
! (code = param_write_int(plist, "Cyan", &mj->cyan)) < 0 ||
! (code = param_write_int(plist, "Magenta", &mj->magenta)) < 0 ||
! (code = param_write_int(plist, "Yellow", &mj->yellow)) < 0 ||
! (code = param_write_int(plist, "Black", &mj->black)) < 0 ||
! (code = param_write_int(plist, "Dither", &mj->dither)) < 0 ||
! (code = param_write_int(plist, "ColorComponent", &mj->colorcomp)) < 0 ||
! (code = param_write_int(plist, "Direction", &mj->direction)) < 0 ||
! (code = param_write_int(plist, "MicroWeave", &mj->microweave)) < 0 ||
! (code = param_write_int(plist, "DotSize", &mj->dotsize)) < 0
! )
! return code;
!
! return code;
}
/* Put properties. */
private int
! mj_put_params(gx_device *pdev, gs_param_list *plist)
{
int old_bpp = mj->color_info.depth;
int bpp = 0;
int code = 0;
! int density = mj->density;
! int cyan = mj->cyan;
! int magenta = mj->magenta;
! int yellow = mj->yellow;
! int black = mj->black;
! int dither = mj->dither;
! int colorcomp = mj->colorcomp;
! int direction = mj->direction;
! int microweave = mj->microweave;
! int dotsize = mj->dotsize;
!
! code = mj_put_param_int(plist, "Density", &density, 0, INT_MAX, code);
! code = mj_put_param_int(plist, "Cyan", &density, 0, INT_MAX, code);
! code = mj_put_param_int(plist, "Magenta", &density, 0, INT_MAX, code);
! code = mj_put_param_int(plist, "Yellow", &density, 0, INT_MAX, code);
! code = mj_put_param_int(plist, "Black", &density, 0, INT_MAX, code);
! code = mj_put_param_int(plist, "Dither", &density, 0, 1, code);
! code = mj_put_param_int(plist, "ColorComponent", &density, 1, 4, code);
! code = mj_put_param_int(plist, "Direction", &density, 1, 2, code);
! code = mj_put_param_int(plist, "MicroWeave", &density, 0, 1, code);
! code = mj_put_param_int(plist, "DotSize", &density, 0, 1, code);
! code = mj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
if ( code < 0 )
! return code;
! mj->density = density;
! mj->cyan = cyan;
! mj->magenta = magenta;
! mj->yellow = yellow;
! mj->black = black;
! mj->dither = dither;
! mj->colorcomp = colorcomp;
! mj->direction = direction;
! mj->microweave = microweave;
! mj->dotsize = dotsize;
! if ( bpp != 0 ) {
! mj_set_bpp(pdev, bpp);
! gdev_prn_put_params(pdev, plist);
if ( bpp != old_bpp && pdev->is_open )
! return gs_closedevice(pdev);
! return 0;
}
! else
! return gdev_prn_put_params(pdev, plist);
}
/* ------ Internal routines ------ */
***************
*** 947,953 ****
/* Send each scan line in turn */
{
! long int lend = pdev->height - (pdev->t_margin + pdev->b_margin) * y_dpi;
int cErr, mErr, yErr, kErr;
int this_pass, i;
long int lnum;
--- 944,951 ----
/* Send each scan line in turn */
{
! long int lend = pdev->height -
! (dev_t_margin_points(pdev) + dev_b_margin_points(pdev));
int cErr, mErr, yErr, kErr;
int this_pass, i;
long int lnum;
***************
*** 1323,1361 ****
}
private int
! put_prop_int(gs_prop_item *pi, int *property, int minval, int maxval, int code)
! {
! if ( pi == 0 )
! return (code);
!
! if ( pi->value.i < minval || pi->value.i > maxval )
! { pi->status = pv_rangecheck;
! return (gs_error_rangecheck);
! }
! else
! { *property = pi->value.i;
! return (code ? code : 1);
! }
! }
!
! private int
! put_prop_float(gs_prop_item *pi, float *property, float minval, float maxval, int code)
! {
! if ( pi == 0 )
! return (code);
!
! if ( pi->value.f < minval || pi->value.f > maxval )
! { pi->status = pv_rangecheck;
! return (gs_error_rangecheck);
! }
! else
! { *property = pi->value.f;
! return (code ? code : 1);
! }
}
private void
! set_bpp(gx_device *pdev, int bits_per_pixel)
{ gx_device_color_info *ci = &pdev->color_info;
/* Only valid bits-per-pixel are 1, 3, 8, 16, 24, 32 */
int bpp = bits_per_pixel < 3 ? 1 : bits_per_pixel < 8 ? 3 :
--- 1321,1345 ----
}
private int
! mj_put_param_int(gs_param_list *plist, gs_param_name pname, int *pvalue,
! int minval, int maxval, int ecode)
! { int code, value;
! switch ( code = param_read_int(plist, pname, &value) )
! {
! default:
! return code;
! case 1:
! return ecode;
! case 0:
! if ( value < minval || value > maxval )
! param_signal_error(plist, pname, gs_error_rangecheck);
! *pvalue = value;
! return (ecode < 0 ? ecode : 1);
! }
}
private void
! mj_set_bpp(gx_device *pdev, int bits_per_pixel)
{ gx_device_color_info *ci = &pdev->color_info;
/* Only valid bits-per-pixel are 1, 3, 8, 16, 24, 32 */
int bpp = bits_per_pixel < 3 ? 1 : bits_per_pixel < 8 ? 3 :
***************
*** 1363,1371 ****
ci->num_components = ((bpp == 1) || (bpp == 8) ? 1 : 3);
ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
ci->max_gray = (bpp >= 8 ? 255 : 1);
! ci->max_rgb = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
! ci->dither_gray = (bpp >= 8 ? 5 : 2);
! ci->dither_rgb = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
}
/* This returns either the number of pixels in a scan line, or the number
--- 1347,1355 ----
ci->num_components = ((bpp == 1) || (bpp == 8) ? 1 : 3);
ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
ci->max_gray = (bpp >= 8 ? 255 : 1);
! ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
! ci->dither_grays = (bpp >= 8 ? 5 : 2);
! ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
}
/* This returns either the number of pixels in a scan line, or the number
***************
*** 1374,1380 ****
gdev_prn_rasterwidth(const gx_device_printer *pdev, int pixelcount)
{
word raster_width =
! pdev->width - pdev->x_pixels_per_inch * (pdev->l_margin + pdev->r_margin);
return (pixelcount ?
(uint)raster_width :
(uint)((raster_width * pdev->color_info.depth + 7) >> 3));
--- 1358,1364 ----
gdev_prn_rasterwidth(const gx_device_printer *pdev, int pixelcount)
{
word raster_width =
! pdev->width - (pdev->HWMargins[0] + pdev->HWMargins[2]);
return (pixelcount ?
(uint)raster_width :
(uint)((raster_width * pdev->color_info.depth + 7) >> 3));