v02i027: generic bitmap to Impress converter, Patch1
Mike Wexler
mikew at wyse.wyse.com
Sat Dec 3 05:19:08 AEST 1988
Submitted-by: dana at thumper.bellcore.com (Dana A. Chee)
Posting-number: Volume 2, Issue 27
Archive-name: bitimp/patch1
This is a patch to the contributed package bitimp on the R3 tape
(contrib/clients/bitimp). It removes the extra droppings on the right
edges of windows.
Dana Chee, Bellcore, dana at thumper.bellcore.com
*** /u/dana/Xr3/contrib/clients/xipr/bitimp.c Fri Aug 12 09:17:51 1988
--- ./bitimp.c Tue Nov 22 12:24:56 1988
***************
*** 697,703 ****
--- 697,705 ----
int i,
j,
k,
+ l,
slop;
+ unsigned char tail;
unsigned nbytes;
register char *cp;
char *raster;
***************
*** 706,726 ****
if ((i = XReadDumpFP (BitIn, &xwd, (char **) 0, &raster)) <= 0)
adios (NULLCP, "window dump file is in bad format");
! slop = (i = xwd.pixmap_width % PSIZE) ? PSIZE - i : 0;
! imPbegin (PixPerIn, PixPerIn, xwd.pixmap_width + slop, xwd.pixmap_height);
! k = xwd.bytes_per_line;
!
! if (slop)
! slop = (xwd.pixmap_width + slop) / 8 - k;
!
cp = raster;
for (i = xwd.pixmap_height; i > 0; i--) {
! for (j = k; j > 0; j--)
imPmap ((unsigned char) (*cp++));
! for (j = slop; j > 0; j--) /* Imagen pads to PSIZE boundaries */
imPmap ((unsigned char) 0x00);
}
--- 708,734 ----
if ((i = XReadDumpFP (BitIn, &xwd, (char **) 0, &raster)) <= 0)
adios (NULLCP, "window dump file is in bad format");
! k = xwd.bytes_per_line; /* # of stored bytes per line */
! l = (xwd.pixmap_width + 7) / 8; /* # of useful bytes per line */
!
! slop = (i = k % PBYTES) ? PBYTES - i : 0; /* how many more bytes needed*/
! imPbegin (PixPerIn, PixPerIn, (k + slop)*8, xwd.pixmap_height);
! tail = (i = xwd.pixmap_width % 8) ? 8 - i : 0;
! tail = (unsigned)0xff << tail;
!
cp = raster;
for (i = xwd.pixmap_height; i > 0; i--) {
! for (j = l; j > 1; j--)
imPmap ((unsigned char) (*cp++));
! imPmap((unsigned char) (*cp++ & tail)); /* clip the last byte */
!
! for (j = (k - l); j > 0; j--) /* put out extra bytes */
! imPmap((unsigned char) (*cp++ & 0x00));
!
! for (j = slop; j > 0; j--) /* Imagen pads to PBYTES boundaries */
imPmap ((unsigned char) 0x00);
}
--
Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
Moderator of comp.sources.x
More information about the Comp.sources.x
mailing list