# include "Ximage.h"

int Resize (Graphic *graphic, Layout *layout) {
 
  unsigned int NX, NY;

  KiiScanMessage (layout[0].Ximage, "%d %d", &NX, &NY);

  NX += ZOOM_X + 3*PAD1 + 25;
  NY += 2*PAD1 + PAD2 + COLORPAD + 25;

  if ((graphic[0].dx == NX) && (graphic[0].dy == NY)) 
    return (TRUE);

  graphic[0].dx = MAX(NX, 50); 
  graphic[0].dy = MAX(NY, 50); 

  if (USE_XWINDOW) XResizeWindow (graphic[0].display, graphic[0].window, NX, NY);

  PositionPictures (layout, graphic);

  if (USE_XWINDOW) {
    CreateColorbar (layout, graphic);
    CreatePicture (layout, graphic);
    Remap (graphic, layout, &layout[0].matrix); 
    XClearWindow (graphic[0].display, graphic[0].window);
    Refresh (graphic, layout, 1);
  }

  return (TRUE);
}
