From: ja_king@csd.brispoly.ac.uk (JA King)
Newsgroups: alt.toolkits.xview
Subject: Images/ Canvas and XVIew
Date: 10 Apr 92 10:43:24 GMT
Reply-To: ja_king@csd.bristol-poly.ac.uk
Organization: Bristol Polytechnic (The Magic Roundabout)


  I am currently writting an application that loads a Tiff  greyscale image, I have a
XView font end to it and I have opened a canvas. My load function loads the inage data to
memory. I then have the following Canvas Repaint Procedure :-


void
CanvasRepaintProc(canvas,pw,display,xwin,xrects)
Canvas         canvas;
Xv_Window      pw;
Display        *display;
Window         xwin;
Xv_xrectlist    *xrects;
{
GC           wingc;
XImage       *xImage;

wingc =  DefaultGC(display,DefaultScreen(display));

if(canvas == canvas1){
  if(im1 != NULL ) {
     xImage =  XCreateImage(display,xwin,image1.depth,
                           image1.depth == 1 ? XYBitmap : ZPixmap,
                           (char *)image1.imageData,
                           image1.width,
                           image1.height,
                           8,0);

  xv_set(canframe1,XV_WIDTH,image1.width,XV_HEIGHT,image1.height,NULL);

xv_set(canvas1,CANVAS_WIDTH,image1.width,CANVAS_HEIGHT,image1.height,NULL);
  } else  return;
}
else if(canvas == canvas2){
  if(im2 != NULL) {
     xImage =  XCreateImage(display,xwin,image2.depth,
                           image2.depth == 1 ? XYBitmap : ZPixmap,
                           (char *) image2.imageData,
                           image2.width,
                           image2.height,
                           8,0);
    xv_set(canframe2,XV_WIDTH,image2.width,XV_HEIGHT,image2.height,NULL);xv_set(canvas2,CANVAS_WIDTH,image2.width,CANVAS_HEIGHT,image2.height,NULL);
  } else  return;
}
else if(canvas == canvas3){
  if(im3 != NULL) {
     xImage =(XImage *) XCreateImage(display,xwin,image3.depth,
                           image3.depth == 1 ? XYBitmap : ZPixmap,
                           (char *) image3.imageData,
                           image3.width,
                           image3.height,
                           8,0);
  xv_set(canframe3,XV_WIDTH,image3.width,XV_HEIGHT,image3.height,NULL);

xv_set(canvas3,CANVAS_WIDTH,image3.width,CANVAS_HEIGHT,image3.height,NULL);
  } else  return;
}
else if(canvas == canvas4){
  if(im4 != NULL) {
     xImage =(XImage *) XCreateImage(display,xwin,image4.depth,
                           image4.depth == 1 ? XYBitmap : ZPixmap,
                           (char *) image4.imageData,
                           image4.width,
                           image4.height,
                           8,0);
  xv_set(canframe4,XV_WIDTH,image4.width,XV_HEIGHT,image4.height,NULL);

xv_set(canvas4,CANVAS_WIDTH,image4.width,CANVAS_HEIGHT,image4.height,NULL);
  } else  return;
}
else {
   printf(" ERROR: canvas repaint error");
   return;
}

xv_set(canvas,CANVAS_AUTO_SHRINK,TRUE,CANVAS_AUTO_EXPAND,TRUE,NULL);
XPutImage(display,xwin,wingc,xImage,0,0,0,0,xImage->width,xImage->height);

XDestroyImage(xImage);
}


  As you have guessed, nothing is happening , The question is WHY ??

              If there are any experts out there with a few moments to spare I would
appreciate a little advice.


                     Cheers  Jon King.