/[alph]/alph/org/nongnu/alph/impl/SimpleImageScroll.java
ViewVC logotype

Diff of /alph/org/nongnu/alph/impl/SimpleImageScroll.java

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

revision 1.3 by tjl, Sun Apr 20 08:50:02 2003 UTC revision 1.4 by tjl, Mon Apr 21 16:31:23 2003 UTC
# Line 43  String rcsid = "$Id$"; Line 43  String rcsid = "$Id$";
43    
44      int width=-1, height=-1;      int width=-1, height=-1;
45    
46      public SimpleImageScroll(StormPool ms,  BlockId id) {      public SimpleImageScroll(Alph alph,  Object blockid, String contentType) {
47          super(ms, id);          super(alph, blockid, contentType);
         try {  
             ms.request(id, null);  
         } catch(IOException e) {  
             throw new Error("Couldn't load image block");  
         }  
48      }      }
49    
50      public boolean equals(Object o) {      public boolean equals(Object o) {
# Line 62  String rcsid = "$Id$"; Line 57  String rcsid = "$Id$";
57      }      }
58    
59      private void loadImageSize() {      private void loadImageSize() {
60                    int ind = contentType.indexOf('/');
61          String ct = msid.getContentType();          int ind2 = contentType.indexOf(';');
62            if(ind2 < 0) ind2 = contentType.length();
63    
64          if(!ct.substring(0,ct.indexOf('/')).equals("image"))          String type = contentType.substring(0,ind);
65              throw new Error("Block isn't an image");          String subtype = contentType.substring(ind+1, ind2);
66            
67            if(!type.equals("image"))
68                throw new Error("Image Block isn't an image");
69    
70          Block block ;          Block block ;
71          Dimension d;          Dimension d;
72    
73          try {          try {
74              block = ms.get(msid);              java.io.InputStream is = alph.getBlockInputStream(this);
             java.io.InputStream is = block.getInputStream();  
75              d = org.nongnu.navidoc.util.ImageSize.readSize(is);              d = org.nongnu.navidoc.util.ImageSize.readSize(is);
76              if(d == null)              if(d == null)
77                  throw new Error("Couldn't get size of image block");                  throw new Error("Couldn't get size of image block");

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

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