/[gzz]/gzz/gzz/view/VobVanishingClient.java
ViewVC logotype

Diff of /gzz/gzz/view/VobVanishingClient.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by benja, Sun Aug 25 21:20:26 2002 UTC revision 1.5 by tjl, Thu Aug 29 10:08:34 2002 UTC
# Line 158  public class VobVanishingClient implemen Line 158  public class VobVanishingClient implemen
158      */      */
159    
160      public Object getVobSize(Cell c, float fract, int flags, Dimension outDim) {      public Object getVobSize(Cell c, float fract, int flags, Dimension outDim) {
161            cvf.getDefaultSize(fract, outDim);
162          if((flags & VanishingClient.CENTER) != 0) {          return null;
             p("Center: "+c+" span: "+c.getSpan());  
         }  
   
         Span span = c.getSpan();  
         Vob v;  
         if (span != null && span instanceof ImageSpan) {  
             int iw = (int)(60 * fract);  
             int ih = (int)(20 * fract);  
   
             // Paint the span, if it's e.g. an imagespan.  
             Image img = null;  
             if (span instanceof PageSpan) {  
                 // Take 1st page if not under cursor, otherwise page'th page  
                 p("Is pagespan");  
                 PageSpan pagespan = (PageSpan)span;  
                 if((flags & VanishingClient.CENTER) != 0) {  
                     p("Center: take page'th page");  
                     // clip page index to span length  
                     if(page >= pagespan.length()) {  
                         p("Clipping page to "+pagespan);  
                         page = pagespan.length() - 1;  
                     }  
                     img = ((PageSpan)(pagespan.subSpan(page, page+1))).  
                                 getImage();  
                 } else {  
                     img = ((PageSpan)(pagespan.subSpan(0, 1))).getImage();  
                 }  
             }  
             else if (span instanceof ImageSpan) {  
                 p("Is imagespan");  
                 img = ((ImageSpan)span).getImage();  
             }  
   
             p("Image for cellimagevob: "+img);  
   
             // If available, use the dimensions of the actual image  
             // returned. There are some bugs with assuming the letter paper size  
             // for now.  
             Dimension dii = ((ImageSpan)span).getSize();  
             v = new CellImageVob(c, img);  
   
             if (img != null) {  
                 iw = img.getWidth(null);  
                 ih = img.getHeight(null);  
             }  
             if(iw == -1) iw = (int)dii.width;  
             if(ih == -1) ih = (int)dii.height;  
   
   
             if (iw > 0 && ih > 0) {  
                 double img_ratio = ((double)iw) / ih;  
                 boolean zoomnow = usezoom &&  
                     ((flags & VanishingClient.CENTER) != 0);  
                 if(zoomnow && zoom == 2) {  
                     // no change: just use iw and ih -- pixel-to-pixel.  
                 } else {  
                     if(!zoomnow || zoom == 0)  
                         iw = (int)(60 * fract);  
                     else /* zoom == 1 */  
                         iw = (int)((iw + 60 * fract) / 2);  
                     ih = (int)(iw / img_ratio);  
                 }  
                 /*  
                   if (img_ratio < 1) {  
                   ih = h;  
                   iw = (int)(img_ratio * h);  
                   }  
                   else {  
                 */  
                 // iw =  (int)(60 * fract); // XXX  
                 // ih = (int)(((double)iw) / img_ratio);  
                 /* } */  
             }  
             else {  
                 iw = (int)(60 * fract);  
                 ih = (int)(20 * fract);  
             }  
   
             outDim.width= iw;  
             outDim.height= ih;  
             if(dbg) p("Final vobsize: "+iw+" "+ih);  
             return v;  
         }  
   
         else {  
             cvf.getDefaultSize(fract, outDim);  
             return null;  
         }  
163      }      }
164    
165      public void place(Cell c, Object o, float fract, int x0, int y0, int x1, int y1,      public void place(Cell c, Object o, float fract, int x0, int y0, int x1, int y1,

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26