[comp.sys.next] Window Caching Question

araftis@polyslo.CalPoly.EDU (Alex Raftis) (04/09/91)

I'm trying to make a program to convert postscript pictures to pbm
pictures. I've been able to convet postscripts to bitmaps before,
and I wrote a program to convert NeXT images into pnm format pictures,
bit I can't seem to get the program to work properly. It falls apart
when I try to create an offscreen cache to image the postscript data
into. Below is the code I'm using. Basically, it never reaches the 
line that prints 3. Is there something special I need to do first 
before I open up the cache if I'm not within the context of an NXApp?
Being outside of this context is the only difference between the code
below and some code I use in an application.

Any help would be appreciated.

Alex


--- code below ---

#include <appkit/Window.h>
#include <appkit/View.h>
#include <appkit/nextstd.h>
#include <appkit/graphics.h>
#include <dpsclient/wraps.h>
#include <stdio.h>

void main(void)
{
   char     *n; 
   float    w = 100.0; 
   float    h = 100.0; 
   int      rx; 
   int      ry;
   id       cache;
   NXRect   cacher;

   fprintf(stderr, "1\n");
   cacher.origin.x = cacher.origin.y = 0.0;
   cacher.size.width = w;
   cacher.size.height = h;
   fprintf(stderr, "2\n");
   cache = [Window newContent: &cacher
               style: NX_PLAINSTYLE
               backing: NX_RETAINED
               buttonMask: 0
               defer: NO];
   fprintf(stderr, "3\n");

   [[cache contentView] lockFocus];
      PSsetgray(1);
      PSnewpath();
         PSmoveto(0.0, 0.0);
         PSlineto(  w, 0.0);
         PSlineto(  w,   h);
         PSlineto(0.0,   h);
         PSlineto(0.0, 0.0);
         PSlineto(  w,   h);
         PSmoveto(0.0,   h);
         PSlineto(  w, 0.0);
      PSclosepath();
      PSstroke();
   [[cache contentView] unlockFocus];

   [cache free];
}

--- sig follows ---

-- 
               -------------------------------------------------- 
                     Internet: alex@cosmos.ACS.CalPoly.EDU
                  or araftis@data.ACS.CalPoly.EDU for NeXTmail