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.memory.*; |
import org.nongnu.libvob.memory.*; |
31 |
|
import org.fenfire.functional.PureFunction; |
32 |
|
import org.fenfire.util.Pair; |
33 |
|
|
34 |
public interface PaperMaker { |
/** A function that, given a singleimage and a texgen, |
35 |
Paper makePaper(SingleImage img, float[] texgen); |
* return a org.nongnu.libvob.gl.Paper. |
36 |
|
* Because this is a dyadic function, the makePaper() call |
37 |
|
* is also provided separately. The calls |
38 |
|
* |
39 |
|
* c = paperMaker.makePaper(a, b); |
40 |
|
* |
41 |
|
* and |
42 |
|
* c = (Paper) paperMaker.f(new Pair(a,b)); |
43 |
|
* |
44 |
|
* are equivalent. |
45 |
|
* <p> |
46 |
|
* The different implementations of this class can choose |
47 |
|
* to use different ways to filter the texture, different |
48 |
|
* backgrounds (using libpaper) etc. |
49 |
|
*/ |
50 |
|
public abstract class PaperMaker implements PureFunction { |
51 |
|
|
52 |
|
/** Make a Paper object which contains the texture |
53 |
|
* in the given SingleImage, with the given texgen. |
54 |
|
*/ |
55 |
|
public abstract Paper makePaper(SingleImage img, float[] texgen); |
56 |
|
|
57 |
|
public Object f(Object o) { |
58 |
|
Pair p = (Pair)o; |
59 |
|
return makePaper((SingleImage)p.first, (float[])p.second); |
60 |
|
} |
61 |
} |
} |