postscript

Thomas Pfenning a0096 at DK0RRZK0.BITNET
Tue Mar 7 14:38:44 AEST 1989


Following the discussion about postscript I picked up the files from a
comp.sources archive and installed the patch provided by steve beaty in
v7i158. With the fix installed all but one of the demo files ran fine on
our 386i. The raygun2 file produced a garbled picture as mentioned in the
Pixrect Reference Manual. The following patch fixes the bitorder problem
with a 8bit color monitor when loading postscript bitmaps. I can't give
you a diff because BITNET corrupts all files, so I list the function with
the lines between #ifdef 386 and #endif added.


struct hardware *HardwareFromString (s, width, height)
unsigned char *s;
int width, height;
{
    int words = (width + 15) / 16;
    Pixrect *pr = mem_create (width, height, 1);
    short *d = mpr_d (pr)->md_image;
    int odd = ((width + 7) / 8) & 1;
    int i, j;

    for (i = 0; i < height; i++) {
        for (j = 0; j < words - odd; j++) {
                short word = *s++;
                *d++ = (word << 8)  *s++;
        }
        if (odd) *d++ = *s++ << 8;
    }
#ifdef sun386
    mpr_d (pr) -> md_flags &= |MP_I386;   /* pixrect is in 68000 style bitorder
*/
    pr_flip(pr);                          /* revert to 80386 */
#endif
    return NewHardware (pr, NewDevicePoint (width, height), 0);
}

Hope this helps .

Thomas Pfenning, University of Cologne, Institute for Theoretical Physics



More information about the Comp.sys.sun mailing list