[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] fenfire/org/fenfire/spanimages/gl DefaultSpanIm...
From: |
Tuomas J. Lukka |
Subject: |
[ff-cvs] fenfire/org/fenfire/spanimages/gl DefaultSpanIm... |
Date: |
Mon, 18 Aug 2003 04:32:09 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/08/18 04:32:09
Modified files:
org/fenfire/spanimages/gl: DefaultSpanImageFactory.java
PageScrollBlockImager.java
SingleImage.java
Log message:
Aniso fixes
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/DefaultSpanImageFactory.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/SingleImage.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/spanimages/gl/DefaultSpanImageFactory.java
diff -u fenfire/org/fenfire/spanimages/gl/DefaultSpanImageFactory.java:1.7
fenfire/org/fenfire/spanimages/gl/DefaultSpanImageFactory.java:1.8
--- fenfire/org/fenfire/spanimages/gl/DefaultSpanImageFactory.java:1.7 Tue Jun
24 07:11:52 2003
+++ fenfire/org/fenfire/spanimages/gl/DefaultSpanImageFactory.java Mon Aug
18 04:32:09 2003
@@ -82,13 +82,16 @@
// Use 75 pixels per inch.
// singleImage.resolution is in DPI, so to get pixels per dot
// we divide
- float pixReso = 75 / singleImage.resolution;
+ float xpixReso = 75 / singleImage.xresolution;
+ float ypixReso = 75 / singleImage.yresolution;
// unless it's pixel data, in which case PPD is always 1
- if(pixReso <= 0)
- pixReso = 1;
+ if(xpixReso <= 0)
+ xpixReso = 1;
+ if(ypixReso <= 0)
+ ypixReso = 1;
- float xscale = 1f / largest.width / pixReso;
- float yscale = 1f / largest.height / pixReso;
+ float xscale = 1f / largest.width / xpixReso;
+ float yscale = 1f / largest.height / ypixReso;
Point p =s.getLocation();
Dimension ps =s.getSize();
Index: fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java
diff -u fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java:1.10
fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java:1.11
--- fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java:1.10 Mon Aug
18 04:07:08 2003
+++ fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java Mon Aug
18 04:32:09 2003
@@ -69,6 +69,11 @@
return m;
}
+ class PageFiles {
+ int xreso, yreso;
+ String[] filenames;
+ }
+
public SingleImage getSingleImage(ImageSpan img, PoolManager poolManager) {
PageImageSpan span = (PageImageSpan)img;
int page = span.getPageIndex();
@@ -80,12 +85,14 @@
if(singleImage == null) {
try {
- String[] pageFiles = getPageFiles(sb);
+ int[] res = new int[2];
+ PageFiles pageFiles = getPageFiles(sb);
singleImage = new SingleImage(
sb.getID(),
page,
- pageFiles[page],
- RESOLUTION,
+ pageFiles.filenames[page],
+ pageFiles.xreso,
+ pageFiles.yreso,
poolManager
);
} catch(Exception e) {
@@ -96,9 +103,9 @@
return singleImage;
}
- private String[] getPageFiles(ScrollBlock pages)
+ private PageFiles getPageFiles(ScrollBlock pages)
throws FileNotFoundException {
- String[] f = (String[]) block2pagefiles.get(pages);
+ PageFiles f = (PageFiles) block2pagefiles.get(pages);
if(f == null) {
f = makePageFiles(pages);
block2pagefiles.put(pages, f);
@@ -108,7 +115,7 @@
PythonInterpreter interp;
- private synchronized String[] makePageFiles(ScrollBlock pages)
+ private synchronized PageFiles makePageFiles(ScrollBlock pages)
throws java.io.FileNotFoundException {
String ct = pages.getContentType();
if(! (ct.equals("application/pdf") ||
@@ -145,7 +152,13 @@
tmppaths[i] = new File(tmp(), "tmp"+base).getPath();
if(!f.exists()) exist = false;
}
- if(exist) return paths;
+
+ PageFiles res = new PageFiles();
+ res.xreso = xreso;
+ res.yreso = yreso;
+ res.filenames = paths;
+
+ if(exist) return res;
// Need to make them.
//
@@ -177,7 +190,7 @@
(new File(tmppaths[i])).delete();
}
- return paths;
+ return res;
}
Index: fenfire/org/fenfire/spanimages/gl/SingleImage.java
diff -u fenfire/org/fenfire/spanimages/gl/SingleImage.java:1.9
fenfire/org/fenfire/spanimages/gl/SingleImage.java:1.10
--- fenfire/org/fenfire/spanimages/gl/SingleImage.java:1.9 Mon Jun 30
10:12:58 2003
+++ fenfire/org/fenfire/spanimages/gl/SingleImage.java Mon Aug 18 04:32:09 2003
@@ -62,14 +62,19 @@
public final String scrollBlock;
public final int page;
- public final float resolution;
+ public final float xresolution;
+ public final float yresolution;
/** Create.
* @param scrollBlock The scrollblock identifier.
* @param page The page index. For ImageSpans, always 0.
* @param filename The file to load the image from.
- * @param resolution The resolution (DPI) the image in the file is at.
+ * @param xresolution The resolution (DPI) the image in the file is at.
+ * For example, if a PS file was compiled into an image at
+ * 160dpi, then this number is 160. Zero or negative = unknown,
+ * use pixel data.
+ * @param yresolution The resolution (DPI) the image in the file is at.
* For example, if a PS file was compiled into an image at
* 160dpi, then this number is 160. Zero or negative = unknown,
* use pixel data.
@@ -78,12 +83,14 @@
public SingleImage(
String scrollBlock, int page,
String filename,
- float resolution,
+ float xresolution,
+ float yresolution,
GL.StatsCallback statsCallback
) throws java.io.IOException {
this.scrollBlock = scrollBlock;
this.page = page;
- this.resolution = resolution;
+ this.xresolution = xresolution;
+ this.yresolution = yresolution;
this.loader = new MipzipLoader(new File(filename));
if(statsCallback != null)
@@ -92,7 +99,7 @@
this.accum = GL.createTexAccum();
if(dbg) p("Create single image: "+scrollBlock+" "+page+" "+filename
- +" "+resolution+" "+statsCallback);
+ +" "+xresolution+" "+yresolution+" "+statsCallback);
this.missingPixels = new double[this.loader.getNLevels()];
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ff-cvs] fenfire/org/fenfire/spanimages/gl DefaultSpanIm...,
Tuomas J. Lukka <=