IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32660


Ignore:
Timestamp:
Nov 12, 2011, 1:55:19 PM (15 years ago)
Author:
eugene
Message:

updating to allow png and ps to generate a minimal window

Location:
branches/eam_branches/ipp-20111110/Ohana/src/kapa2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111110/Ohana/src/kapa2/include/structures.h

    r29938 r32660  
    2626  XFontStruct   *font;
    2727  Cursor         cursor;
    28   int            x,  y;
    29   unsigned int   dx, dy;
     28  int            x,  y;       // corner coord in X world coords
     29  unsigned int   dx, dy;      // size of window in X coords
     30  int            xwin, ywin;  // corner coord of display subregion (eg, png, ps plot)
     31  int            dxwin, dywin; // corner coord of display subregion (eg, png, ps plot)
    3032  CCNode        *cube;
    3133  XColor        *cmap;
  • branches/eam_branches/ipp-20111110/Ohana/src/kapa2/src/Sections.c

    r27790 r32660  
    237237  return (TRUE);
    238238}
     239
     240int SectionMinBoundary (Graphic *graphic) {
     241
     242    int Xs = graphic->dx;
     243    int Ys = graphic->dy;
     244    int Xe = 0;
     245    int Ye = 0;
     246
     247    // the boundary for a single section should probably be adjusted depending on the
     248    // image status (should not include the imtool portion)
     249    for (i = 0; i < Nsections; i++) {
     250        Xs = PS_MIN (Xs, sections[i][0].x);
     251        Ys = PS_MIN (Ys, sections[i][0].y);
     252        Xe = PS_MAX (Xe, sections[i][0].x + sections[i][0].dx);
     253        Ye = PS_MAX (Ye, sections[i][0].y + sections[i][0].dy);
     254    }
     255
     256    if ((Xs >= Xe) || (Ys >- Ye)) {
     257        // default values for the region window
     258        graphic->xwin  = 0;
     259        graphic->ywin  = 0;
     260        graphic->dxwin = graphic->dx;
     261        graphic->dywin = graphic->dy;
     262    }   
     263   
     264    // set min/max boundary (min window containing max range of sections)
     265    graphic->xwin = Xs;
     266    graphic->ywin = Ys;
     267    graphic->dxwin = Xe - Xs;
     268    graphic->dywin = Ye - Ys;
     269    return TRUE;
     270}
  • branches/eam_branches/ipp-20111110/Ohana/src/kapa2/src/SetUpGraphic.c

    r25757 r32660  
    1616  graphic->dx = 512;
    1717  graphic->dy = 512;
     18
     19  // default values for the region window
     20  graphic->xwin  = 0;
     21  graphic->ywin  = 0;
     22  graphic->dxwin = graphic->dx;
     23  graphic->dywin = graphic->dy;
    1824
    1925  if (!USE_XWINDOW) {
  • branches/eam_branches/ipp-20111110/Ohana/src/kapa2/src/bDrawImage.c

    r29938 r32660  
    4747  }
    4848
    49   Xs = image[0].picture.x;
    50   Ys = image[0].picture.y;
     49  // Xs,Ys are in full-frame coords.  can we trim here?
     50  Xs = image[0].picture.x - graphic[0].xwin;
     51  Ys = image[0].picture.y - graphic[0].ywin;
    5152  dx = image[0].picture.dx;
    5253  dy = image[0].picture.dy;
     
    5455  DY = image[0].image[0].matrix.Naxis[1];
    5556
     57  // the created buffer is supposed to contain the output windows
    5658  if (buffer[0].Nx < Xs + dx) {
    5759    fprintf (stderr, "invalid condition\n");
  • branches/eam_branches/ipp-20111110/Ohana/src/kapa2/src/bDrawIt.c

    r29938 r32660  
    1313  black = KapaColorByName ("black");
    1414
    15   buffer = bDrawBufferCreate (graphic->dx, graphic->dy, Nbyte, palette, Npalette);
     15  SectionMinBoundary (graphic);
     16
     17  // if we want to trim, we'll need to carry about the start in graphic coords and
     18  // the dx,dy size. 
     19  buffer = bDrawBufferCreate (graphic->dxwin, graphic->dywin, Nbyte, palette, Npalette);
    1620  bDrawSetStyle (buffer, black, 0, 0);
    1721 
Note: See TracChangeset for help on using the changeset viewer.