27 |
package org.fenfire.spanimages.gl; |
package org.fenfire.spanimages.gl; |
28 |
import java.io.File; |
import java.io.File; |
29 |
import org.nongnu.libvob.gl.*; |
import org.nongnu.libvob.gl.*; |
30 |
|
import org.nongnu.libvob.gl.virtualtexture.*; |
31 |
import org.nongnu.libvob.memory.*; |
import org.nongnu.libvob.memory.*; |
32 |
|
|
33 |
/** A single texture image of an imagespan or pageimagespan. |
/** A single texture image of an imagespan or pageimagespan. |
38 |
public static boolean dbg = false; |
public static boolean dbg = false; |
39 |
private static void p(String s) { System.out.println("SingleImage: "+s); } |
private static void p(String s) { System.out.println("SingleImage: "+s); } |
40 |
|
|
41 |
public final MipzipLoader loader; |
public final VirtualTexture virtualTexture; |
42 |
public final GL.TexAccum accum; |
public final GL.TexAccum accum; |
43 |
|
|
44 |
/** For each mipmap level of loader, the number of pixels |
/** For each mipmap level of the texture, the number of pixels |
45 |
* that would be rendered less than optimally. |
* that would be rendered less than optimally. |
46 |
* These numbers are calculated cumulatively with time, along |
* These numbers are calculated cumulatively with time, along |
47 |
* with an exponential decay term. |
* with an exponential decay term. |
86 |
String filename, |
String filename, |
87 |
float xresolution, |
float xresolution, |
88 |
float yresolution, |
float yresolution, |
|
String filter, |
|
89 |
GL.StatsCallback statsCallback |
GL.StatsCallback statsCallback |
90 |
) throws java.io.IOException { |
) throws java.io.IOException { |
91 |
this.scrollBlock = scrollBlock; |
this.scrollBlock = scrollBlock; |
93 |
this.xresolution = xresolution; |
this.xresolution = xresolution; |
94 |
this.yresolution = yresolution; |
this.yresolution = yresolution; |
95 |
|
|
96 |
this.loader = new MipzipLoader(new File(filename)); |
this.virtualTexture = new VirtualTexture( |
97 |
this.loader.setFilterSettings(filter); |
new MipzipFile(new File(filename))); |
98 |
|
|
99 |
if(statsCallback != null) |
if(statsCallback != null) |
100 |
this.accum = GL.createTexAccum(statsCallback, this); |
this.accum = GL.createTexAccum(statsCallback, this); |
101 |
else |
else |
104 |
if(dbg) p("Create single image: "+scrollBlock+" "+page+" "+filename |
if(dbg) p("Create single image: "+scrollBlock+" "+page+" "+filename |
105 |
+" "+xresolution+" "+yresolution+" "+statsCallback); |
+" "+xresolution+" "+yresolution+" "+statsCallback); |
106 |
|
|
107 |
this.missingPixels = new double[this.loader.getNLevels()]; |
this.missingPixels = new double[ |
108 |
|
this.virtualTexture.mipzipFile.getNLevels()]; |
109 |
} |
} |
110 |
|
|
111 |
public void finalize() { |
public void finalize() { |