[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] libvob ./Makefile ./README doc/pegboard/glmosai...
From: |
Tuomas J. Lukka |
Subject: |
[ff-cvs] libvob ./Makefile ./README doc/pegboard/glmosai... |
Date: |
Sun, 28 Sep 2003 09:02:19 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/09/28 09:02:18
Modified files:
. : Makefile README
doc/pegboard/glmosaictext_java--tjl: peg.rst
include/vob/jni: Types.hxx
include/vob/util: ImageLoader.hxx
include/vob/vobs: Text.hxx
org/nongnu/libvob/gl: GL.java
org/nongnu/libvob/impl/gl: GLTextStyle.java
org/nongnu/libvob/vobs: TextVob.java textvob.test
src/jni : Main.cxx Makefile Makefile-Gen
src/main : Renderer.cxx
src/trans : Coorder.cxx
src/util : ImageLoader.cxx
test/tools : gfx.py
Added files:
include/vob/text: QuadFont.hxx
org/nongnu/libvob/gl: GLFont.java SimpleAlphaFont.java
fonts.test
org/nongnu/libvob/util: Mosaic2D.java mosaic2d.test
src/jni : FTFont.cxx QuadFont.cxx
vob/demo/font : __init__.py anifont.py
Removed files:
include/vob : Font.hxx
include/vob/jni: Floats.hxx
src/jni : Floats.cxx Font.cxx
Log message:
Arch sync
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/Makefile.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/README.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/doc/pegboard/glmosaictext_java--tjl/peg.rst.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Types.hxx.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/text/QuadFont.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/util/ImageLoader.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Text.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GLFont.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/SimpleAlphaFont.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/fonts.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GL.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLTextStyle.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/util/Mosaic2D.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/util/mosaic2d.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/vobs/TextVob.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/vobs/textvob.test.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/FTFont.cxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/QuadFont.cxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Main.cxx.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile-Gen.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/main/Renderer.cxx.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/trans/Coorder.cxx.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/ImageLoader.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/tools/gfx.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/font/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/font/anifont.py?rev=1.1
Patches:
Index: libvob/Makefile
diff -u libvob/Makefile:1.46 libvob/Makefile:1.47
--- libvob/Makefile:1.46 Mon Sep 22 04:49:00 2003
+++ libvob/Makefile Sun Sep 28 09:02:16 2003
@@ -27,6 +27,9 @@
make -C src/jni -f Makefile-Gen javahs
make -C src/jni jnilib
+jniq: # Just compile jni quickly, no java compilation or gen.
+ make -C src/jni jnilib
+
subdirs: $(SUBDIRS)
$(SUBDIRS):
Index: libvob/README
diff -u libvob/README:1.3 libvob/README:1.4
--- libvob/README:1.3 Tue Aug 12 07:40:08 2003
+++ libvob/README Sun Sep 28 09:02:16 2003
@@ -19,8 +19,6 @@
* CVS module libvob-depends checked out as ../libvob-depends
-* Savannah project glmosaictext compiled at ../glmosaictext
-
Compile with command "make".
Index: libvob/doc/pegboard/glmosaictext_java--tjl/peg.rst
diff -u libvob/doc/pegboard/glmosaictext_java--tjl/peg.rst:1.1
libvob/doc/pegboard/glmosaictext_java--tjl/peg.rst:1.2
--- libvob/doc/pegboard/glmosaictext_java--tjl/peg.rst:1.1 Tue Sep 23
06:38:32 2003
+++ libvob/doc/pegboard/glmosaictext_java--tjl/peg.rst Sun Sep 28 09:02:16 2003
@@ -3,9 +3,9 @@
=============================================================
:Author: Tuomas J. Lukka
-:Last-Modified: $Date: 2003/09/23 10:38:32 $
-:Revision: $Revision: 1.1 $
-:Status: Current
+:Last-Modified: $Date: 2003/09/28 13:02:16 $
+:Revision: $Revision: 1.2 $
+:Status: Accepted [the APIs have evolved slightly but the basic architecture
remains]
GLMosaicText is the only external graphics library we use that
encapsulates its own textures. This makes hunting the texture
@@ -43,19 +43,93 @@
the simplest possible solutions. The code will survive,
just not be maintained.
+ Also, to our knowledge, no-one else was using it.
+
+- Should QuadFont contain setupCode and teardownCode,
+ like Paper?
+
+ RESOLVED: No. The setup and teardown need to be done
+ on a higher level so that we can batch the
+ vobs together without state changes. This
+ has been shown to be one of the most
+ important performance drags on FenPDF (then PP) rendering.
+
Changes
=======
+The main gist is to separate the monolithic font implementation
+so that both the bitmap generation and texture font definition
+functions are available in Java.
+
+
+Remove GL.Font
+--------------
+
GL.Font class and implementations shall be removed. All dependencies
on glmosaictext shall be removed.
+Add GLFont as a replacement for GL.Font
+---------------------------------------
+
+A GLFont is essentially a single QuadFont plus some
+measurements information that used to be found
+in GL.Font. It's not a subclass since we couldn't
+create instances easily but rather a wrapper.
+
+The constructors for text renderables should be overloaded
+to take a GLFont and the QuadFont from inside it. ::
+
+ /** A wrapper for QuadFont that knows about
+ * measurements.
+ * Later on, this may change to an interface for using
+ * different font types, but not yet.
+ */
+ public class GLFont {
+
+ private float height;
+ private float yoffs;
+ private float[] widths;
+
+ private QuadFont quadFont;
+
+ public GLFont(float height, float yoffs, float[] widths, QuadFont
quadFont) {
+ this.height = height;
+ this.yoffs = yoffs;
+ this.widths = widths;
+ this.quadFont = quadFont;
+ }
+
+ /** Get the height of a single line.
+ */
+ public float getHeight() { return height; }
+ /** Get the offset (downwards from the top
+ * of the line) to the baseline.
+ */
+ public float getYOffs() { return yoffs; }
+ /** Get the widths (advances) of the characters
+ * in the font.
+ * The returned array MUST NOT BE MODIFIED.
+ */
+ public float[] getWidths() { return widths; }
+
+ public QuadFont getQuadFont() { return quadFont; }
+
+ }
+
+FTFont
+------
+
FTFont object added to GL, representing a single FTFont (as
in FTFont object in glmosaictext).
Methods ("native" means native as used in GL, i.e. delegated
to static method with the int id)::
- public native static FTFont createFTFont(String filename);
+ /** Create a freetype font, with the given
+ * pixel sizes.
+ */
+ public native static FTFont createFTFont(String filename,
+ int pixsize_x, int pixsize_y);
/** A freetype font.
* Not directly renderable - see GLFont for that.
@@ -78,6 +152,9 @@
}
+QuadFont
+--------
+
Additionally, the mutable QuadFont object for rendering
texture quads based on characters (with *dense* storage), in C++::
@@ -85,7 +162,8 @@
// Length invariants:
// length(textureUnits) == textureLayers
- // length(textureUnits) == NPAGES * textureLayers
+ // length(coordTextureUnits) == textureCoords
+ // length(textures) == NPAGES * textureLayers
// length(textureIndex) == NGLYPHS
// length(coordinates) == 8*NGLYPHS
// length(advances) == 1*NGLYPHS
@@ -96,10 +174,36 @@
* in the texture units.
*/
int textureLayers;
+
+ /** The number of texture coordinates used.
+ */
+ int textureCoords;
+
/** The texture unit tokens into which
* the textures are to be placed.
*/
vector<GLenum> textureUnits;
+
+ /** The texture unit tokens for which
+ * texture coordinates need to be set.
+ * For vertex and fragment programs, the
+ * this may be different from the above.
+ */
+ vector<GLenum> coordTextureUnits;
+
+ /** The texture targets the textures should be loaded.
+ */
+ vector<GLenum> textureTargets;
+
+ /** Bind the textures corresponding
+ * to the given index.
+ */
+ void bindTextures(int texIndex) ;
+
+ /** Unbind all textures bound by this class.
+ */
+ void unbindTextures() {
+
/** The actual texture ids.
* An interleaved vector, with textureLayers
* textures on the first level.
@@ -111,7 +215,10 @@
*/
vector<int> textureIndex;
- /** The quad coordinates.
+ /** The quad coordinates, corners and texture coordinates.
+ * These give the physical coordinates to use for the
+ * corners of the quad (A is larger than a)
+ * as well as the texture coordinates.
* These are stored in a single array so we can, in the future,
* bind and download this to the GPU and just index it,
* along with a vector of offsets (the cumulative sum of
@@ -120,19 +227,15 @@
*/
vector<float> coordinates;
- /** The advances. Only horizontal text supported here so far.
+ /** The amount to advance the x coordinate after rendering
+ * a glyph.
+ * Only horizontal text supported here so far.
*/
vector<float> advances;
CallGLCode setupCode;
CallGLCode teardownCode;
- void setUp();
-
- template<class I> void render(I begin, I end);
-
- void tearDown();
-
}
and in Java (operations mapping to the operations of the preceding class)::
@@ -146,13 +249,18 @@
private GL.Texture[] textures;
/** Set up the textures to use.
- * @param layers The number of textures to be active at a time
* @param texUnits The names of the texunits to bind textures to.
- * length = layers.
- * @param textures The textures. length = layers * number of font pages.
+ * @param targets The names of the texture targets to bind textures to.
+ * targets.length == texUnits.length
+ * @param texCoordUnits The names of the texunits to set coordinates
for.
+ * @param textures The textures.
+ * textures.length = texUnits.length * number of font
pages.
*/
- public "native" void setTextures(int layers, String[] texUnits,
- GL.Texture []textures);
+ public "native" void setTextures(
+ String[] texUnits,
+ String[] targets,
+ String[] texCoordUnits,
+ GL.Texture []textures);
/** Set the measurements of a single glyph.
* @param glyph The index of the glyph.
Index: libvob/include/vob/jni/Types.hxx
diff -u libvob/include/vob/jni/Types.hxx:1.31
libvob/include/vob/jni/Types.hxx:1.32
--- libvob/include/vob/jni/Types.hxx:1.31 Fri Aug 22 08:33:40 2003
+++ libvob/include/vob/jni/Types.hxx Sun Sep 28 09:02:17 2003
@@ -36,22 +36,10 @@
#include <vob/jni/Stats.hxx>
#include <vob/jni/Strings.hxx>
-#include <vob/jni/Floats.hxx>
+#include <vob/jni/Arrays.hxx>
-namespace GLMosaicText {
- namespace Mosaic {
- template<class Format> class GLMosaicText::Mosaic::Raster;
- namespace Format {
- struct Alpha;
- struct RGBA;
- }
- }
- template<class X, class Y> class DenseGlyphs;
- template<class X, class Y> class Renderer;
-}
-
namespace Vob {
// Predeclarations, to avoid including
// too many files here, since this file is
@@ -67,8 +55,7 @@
namespace Vobs {
}
namespace ImageLoader {
- typedef GLMosaicText::Mosaic::Raster<GLMosaicText::Mosaic::Format::RGBA>
- RGBARaster;
+ class RGBARaster;
}
namespace Stats {
struct TexAccum;
@@ -76,15 +63,8 @@
namespace JNI {
struct TexAccum_JNI;
}
- namespace Font {
- struct RealFont;
-
- // XXX Copied from include/vob/vobs/Text.hxx
- typedef GLMosaicText::Renderer<
- GLMosaicText::DenseGlyphs<unsigned short,
GLMosaicText::Mosaic::Format::Alpha>,
- unsigned short>
- DefaultTextRenderer;
-
+ namespace Text {
+ struct QuadFont;
}
namespace JNI {
@@ -113,6 +93,8 @@
extern ObjectStorer<ImageLoader::RGBARaster> images;
+ extern ObjectStorer<Text::QuadFont> quadFonts;
+
// Only TexAccum_JNI objects will be stored here
extern ObjectStorer<Stats::TexAccum> texaccums;
@@ -120,8 +102,6 @@
// template param
extern ObjectStorer<P> papers;
- typedef ::Vob::Font::RealFont RF;
- extern ObjectStorer<RF> textrenderers;
typedef std::vector<float> floatvector;
@@ -252,9 +232,10 @@
out = in;
END_VOB_JNI_CONVERSION
- START_VOB_JNI_CONVERSION_IDDED(Font::RealFont *,
- "GL.Font")
- out = textrenderers[in];
+
+ START_VOB_JNI_CONVERSION_IDDED(::Vob::Text::QuadFont *,
+ "GL.QuadFont")
+ out = quadFonts[in];
END_VOB_JNI_CONVERSION
START_VOB_JNI_CONVERSION_IDDED(::Vob::Paper::Paper *,
Index: libvob/include/vob/util/ImageLoader.hxx
diff -u libvob/include/vob/util/ImageLoader.hxx:1.2
libvob/include/vob/util/ImageLoader.hxx:1.3
--- libvob/include/vob/util/ImageLoader.hxx:1.2 Wed Jun 11 13:41:56 2003
+++ libvob/include/vob/util/ImageLoader.hxx Sun Sep 28 09:02:17 2003
@@ -29,9 +29,9 @@
#include <GL/gl.h>
-#include <glmosaictext/Mosaic.hxx>
#include <vob/Debug.hxx>
+#include <vector>
namespace Vob {
@@ -60,8 +60,41 @@
// virtual bool processGL() = 0;
// };
- typedef GLMosaicText::Mosaic::Raster<GLMosaicText::Mosaic::Format::RGBA>
- RGBARaster;
+ using std::vector;
+
+ /** A simple class for storing images.
+ */
+ class RGBARaster {
+ int width;
+ int height;
+ vector<GLuint> data;
+ public:
+ RGBARaster(int w, int h, vector<GLuint> &data0) :
+ width(w), height(h), data(data) {
+ }
+ int getWidth() { return width; }
+ int getHeight() { return height; }
+ void setGLPixelModes() {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
+ }
+
+ GLint getGLInternalFormat() {
+ return GL_RGBA;
+ }
+ GLenum getGLFormat() {
+ return GL_RGBA;
+ }
+ GLenum getGLType() {
+ return GL_UNSIGNED_BYTE;
+ }
+ void *getPointer() {
+ return &(data[0]);
+ }
+
+
+ };
+
/** Load a single file synchronously into an RGBA raster.
* Bad entry point, will be changed.
Index: libvob/include/vob/vobs/Text.hxx
diff -u libvob/include/vob/vobs/Text.hxx:1.7
libvob/include/vob/vobs/Text.hxx:1.8
--- libvob/include/vob/vobs/Text.hxx:1.7 Sat Aug 16 08:20:14 2003
+++ libvob/include/vob/vobs/Text.hxx Sun Sep 28 09:02:17 2003
@@ -31,8 +31,8 @@
#define VOB_DEFINED(x)
#endif
-#include <GLMosaicText.hxx>
-#include <vob/Font.hxx>
+#include <vob/glerr.hxx>
+#include <vob/text/QuadFont.hxx>
#include <vob/Types.hxx>
namespace Vob {
@@ -40,58 +40,107 @@
PREDBGVAR(dbg_text);
-typedef GLMosaicText::Renderer<
- GLMosaicText::DenseGlyphs<unsigned short>,
- unsigned short>
- DefaultTextRenderer;
-
-template<class TextRenderer, class str> struct Text1Base {
+template<class str> struct Text1Base {
enum { NTrans = 1 };
- Font::RealFont *rend;
+ Text::QuadFont *font;
str text;
float yoffs;
int flags;
template<class F> void params(F &f) {
- f(rend, text, yoffs, flags);
+ f(font, text, yoffs, flags);
}
- template<class Coords> struct Vertexer {
- const Coords &c;
- Vertexer(const Coords &c) : c(c) { }
- template<class T> void operator()(const T &x, const T &y) {
- ZVec tmp(x, y, 0);
- DBG(dbg_text) << "Vertex "<<tmp<<"\n";
- c.vertex(tmp);
- }
- };
-
template<class T> void render(const T &t) const {
if (dbg_text) {
- DBG(dbg_text) << "HorizText:\\n";
+ DBG(dbg_text) << "HorizText:\n";
for (typename str::const_iterator it = text.begin();
- it != text.end(); ++it)
+ it != text.end(); ++it) {
+ unsigned glyph = *it;
DBG(dbg_text) << "'" << (char)*it << "' (" <<
- (int)*it << ")\\n";
+ (int)*it << "): "<<
+ font->coordinates[8*glyph + 0 + 0] <<" "<<
+ font->coordinates[8*glyph + 0 + 1] << " "<<
+ font->coordinates[8*glyph + 0 + 2] <<" "<<
+ font->coordinates[8*glyph + 0 + 3] << " "<<
+ font->coordinates[8*glyph + 0 + 4] <<" "<<
+ font->coordinates[8*glyph + 0 + 5] << " "<<
+ font->coordinates[8*glyph + 0 + 6] <<" "<<
+ font->coordinates[8*glyph + 0 + 7] << " "<<
+ font->advances[glyph]<<
+ t.transform(ZPt(
+ font->coordinates[8*glyph + 0 + 0],
+ font->coordinates[8*glyph + 0 + 1],
+ 0)) <<
+ t.transform(ZPt(
+ font->coordinates[8*glyph + 0 + 2],
+ font->coordinates[8*glyph + 0 + 3],
+ 0)) <<
+ "\n";
+ }
+
+ for(unsigned i=0; i<font->textureUnits.size(); i++) {
+ DBG(dbg_text) << i<<": "<<
+ font->textureUnits[i]<<" "<<
+ font->textureTargets[i]<<"\n";
+ }
+ }
+
+ int curTexInd = -1;
+ int minGlyph = 0; int nGlyphs = font->textureIndex.size();
+ GLERR;
+
+ float x = 0;
+ float y = yoffs;
+ glBegin(GL_QUADS);
+ for (typename str::const_iterator it = text.begin();
+ it != text.end(); ++it) {
+ int glyph = *it;
+ if(glyph < minGlyph || glyph >= nGlyphs)
+ continue;
+ int texInd = font->textureIndex[glyph];
+ if(texInd < 0) continue;
+ if(curTexInd != texInd) {
+ glEnd();
+ GLERR;
+ font->bindTextures(texInd);
+ GLERR;
+ glBegin(GL_QUADS);
+ curTexInd = texInd;
+ }
+
+#define do_corner(a, b) \
+ font->texCoords( \
+ font->coordinates[8*glyph + 4 + a], \
+ font->coordinates[8*glyph + 4 + b]); \
+ t.vertex(ZPt( \
+ x + font->coordinates[8*glyph + 0 + a], \
+ y + font->coordinates[8*glyph + 0 + b], 0));
+
+ do_corner(0,1);
+ do_corner(2,1);
+ do_corner(2,3);
+ do_corner(0,3);
+
+#undef do_corner
+
+ x += font->advances[glyph];
+
+
}
- Vertexer<T> vertexer(t);
- DBG(dbg_text) << "Start text render "<<rend<<" "<<rend->rend<<"\n";
- GLMosaicText::renderIter(*(rend->rend), text.begin(), text.end(),
- 0,yoffs,
- vertexer, (flags & 1 ?
- GLMosaicText::normalBindTexture_01 :
- GLMosaicText::normalBindTexture)
- );
+ glEnd();
+ font->unbindTextures();
+ GLERR;
+
DBG(dbg_text) << "End text render\n";
}
};
-typedef Text1Base<DefaultTextRenderer, unicodecharvector>
- Text1;
+typedef Text1Base<unicodecharvector> Text1;
VOB_DEFINED(Text1);
Index: libvob/org/nongnu/libvob/gl/GL.java
diff -u libvob/org/nongnu/libvob/gl/GL.java:1.24
libvob/org/nongnu/libvob/gl/GL.java:1.25
--- libvob/org/nongnu/libvob/gl/GL.java:1.24 Mon Sep 22 03:24:53 2003
+++ libvob/org/nongnu/libvob/gl/GL.java Sun Sep 28 09:02:17 2003
@@ -464,6 +464,18 @@
type, data);
}
+ /** Call glTexSubImage2D.
+ * The length of data is used so it needs to be right.
+ */
+ public void texSubImage2D(int level,
+ int x, int y, int w, int h,
+ int border, String format, String type,
+ byte[] data) {
+ impl_Texture_texSubImage2D(getId(),
+ level, x, y, w, h, border, format,
+ type, data);
+ }
+
/** Call libtexture to create the image for each mipmap level
separately.
*/
public int shade_all_levels(int w, int h, int d, int comps,
@@ -542,6 +554,9 @@
static private native void impl_Texture_texImage2D(int id, int level,
String internalFormat, int w, int h,
int border, String format, String type, byte[] data) ;
+ static private native void impl_Texture_texSubImage2D(int id, int level,
+ int x, int y, int w, int h,
+ int border, String format, String type, byte[] data) ;
static private native void impl_Texture_loadSubImage(int id,
int level, int imgid, int x, int y, int xoffs, int yoffs, int w, int h)
;
static private native void impl_Texture_downsampleInto(int id, int intoid,
String target,
@@ -557,67 +572,164 @@
static private native void impl_Texture_getTexImage(int id,
int lod, String format, String type, byte[] array) ;
-//--------- Font
- /** A (mosaic-tiled) OpenGL font.
+// -------- FTFont
+ /** A freetype font.
+ * Not directly renderable - see GLFont for that.
+ * This class exists for getting freetype-rendered glyphs
+ * from C++ to Java.
*/
- static public class Font extends NonRenderableJavaObject{
- float height; float yoffs;
- private Font(int id) {
- super(id);
- height = getFontHeight(getId());
- yoffs = getFontYOffs(getId());
+ static public class FTFont extends NonRenderableJavaObject{
+ private FTFont(int id) {
+ super(id);
}
- protected void deleteObj() { deleteFont(getId()); }
-
- /** Get the height of a single line.
- */
- public float getHeight() { return height; }
- /** Get the offset (downwards from the top
- * of the line) to the baseline.
+ protected void deleteObj() { impl_FTFont_delete(getId()); }
+ /** A low-level character measurements routine.
+ * Intended to be used by a higher-level wrapper.
+ * @return an int array, containing 6*characters.length
+ * elements, in groups of
+ * (x,y,w,h, xadvance, yadvance).
+ * The coordinates are in pixels, and
+ * the advances are in FT fixed point units,
+ * scaled by 2**6. For nonexistent glyphs, w=0 and h=0.
*/
- public float getYOffs() { return yoffs; }
+ public int[] getMeasurements(int[] characters) {
+ return impl_FTFont_getMeasurements(getId(), characters);
+ }
- /** Get the widths of the characters
- * in the font.
+ /** Get bitmaps corresponding to a number of characters.
+ * For nonexistent glyphs, null is returned.
*/
- public void getWidths(float[] w) { putFontWidths(getId(), w); }
+ public byte[][] getBitmaps(int[] characters) {
+ return impl_FTFont_getBitmaps(getId(), characters);
+ }
- /** Get the number of textures in the font.
+ /** Get the font recommended row height, in
+ * pix * 2^6.
*/
- public int getNTextures() { return impl_Font_getNTextures(getId()); }
-
- /** Get the ith texture of the font.
+ public int getHeight() {
+ return impl_FTFont_getHeight(getId());
+ }
+ /** Get the font baseline offset, in pix.
*/
- public Texture getTexture(int i) {
- return new Texture(impl_Font_getTexture(getId(), i), false);
+ public int getYOffs() {
+ return impl_FTFont_getYOffs(getId());
}
+
}
- static String defaultFontFile =
"/usr/share/fonts/type1/gsfonts/n019004l.pfb";
+ /** Create a freetype font, with the given
+ * pixel sizes.
+ */
+ public static FTFont createFTFont(String filename, int pixelSize_X,
+ int pixelSize_Y) {
+ int id = impl_FTFont_create(filename, pixelSize_X, pixelSize_Y);
+ if(id < 0)
+ throw new Error("Couldn't create font '"+filename+"'");
+ return new FTFont(id);
+ }
+ private static native int impl_FTFont_create(String filename, int psx, int
psy);
+ private static native void impl_FTFont_delete(int id);
+ private static native int[] impl_FTFont_getMeasurements(int id, int[]
characters) ;
+ private static native byte[][] impl_FTFont_getBitmaps(int id, int[]
characters) ;
+ private static native int impl_FTFont_getHeight(int id) ;
+ private static native int impl_FTFont_getYOffs(int id) ;
- /** Create a new font.
- * @param name Filename to load the font from.
- * null for default.
- * @param loadPt The pixel size to load the font at.
+//-------- QuadFont
+ /** A font that is rendered as quads from an OpenGL texture.
*/
- static public Font createFont(String name, int loadPt) {
- return createFont(name, loadPt, 15);
+ static public class QuadFont extends NonRenderableJavaObject {
+ protected QuadFont(int id) {
+ super(id);
+ }
+ protected void deleteObj() { impl_QuadFont_delete(getId()); }
+
+ /** Store explicitly the GL.Texture objects
+ * to avoid GC.
+ */
+ private GL.Texture[] textures;
+
+ /** Set up the textures to use.
+ * @param texUnits The names of the texunits to bind textures to.
+ * @param targets The names of the texture targets to bind textures to.
+ * targets.length == texUnits.length
+ * @param texCoordUnits The names of the texunits to set coordinates
for.
+ * @param textures The textures.
+ * textures.length = texUnits.length * number of font
pages.
+ */
+ public void setTextures(
+ String[] texUnits,
+ String[] targets,
+ String[] texCoordUnits,
+ GL.Texture[] textures) {
+
+ // Store away
+ this.textures = new GL.Texture[textures.length];
+ System.arraycopy(textures, 0, this.textures, 0, textures.length);
+
+ int[] texids = new int[textures.length];
+ for(int i=0; i<texids.length; i++)
+ texids[i] = textures[i].getTexId();
+
+ impl_QuadFont_setTextures(getId(), texUnits, targets,
texCoordUnits,
+ texids);
+
+ }
+
+ public String[] getTexUnits() {
+ return impl_QuadFont_getTexUnits(getId());
+ }
+ public String[] getTexTargets() {
+ return impl_QuadFont_getTexTargets(getId());
+ }
+ public GL.Texture[] getTextures() {
+ GL.Texture[] ret = new GL.Texture[textures.length];
+ System.arraycopy(this.textures, 0, ret, 0, this.textures.length);
+ return ret;
+ }
+
+
+ public void setNGlyphs(int n) {
+ impl_QuadFont_setNGlyphs(getId(), n);
+ }
+
+ /** Set the measurements of a single glyph.
+ * @param glyph The index of the glyph.
+ * @param texInds The indices of the textures to be bound
+ * for this glyph. Lenght == layers given to
+ * setTextures.
+ */
+ public void setMeasurements(int glyph,
+ int texInd,
+ float x0, float y0, float x1, float y1,
+ float tx0, float ty0, float tx1, float ty1,
+ float xadvance, float yadvance) {
+ impl_QuadFont_setMeasurements(getId(),
+ glyph, texInd,
+ x0, y0, x1, y1,
+ tx0, ty0, tx1, ty1,
+ xadvance, yadvance);
+ }
+
}
- static public Font createFont(String name, int loadPt, int border) {
- return new Font(createFontImpl(
- name == null ? defaultFontFile : name,
- loadPt, border));
- }
-
-
- static private native int createFontImpl(String filename, int loadPt, int
border);
- static private native float getFontHeight(int id);
- static private native float getFontYOffs(int id);
- static private native void deleteFont(int id);
- static private native void putFontWidths(int id, float[] w);
- static private native int impl_Font_getNTextures(int id);
- static private native int impl_Font_getTexture(int id, int i);
+ public static QuadFont createQuadFont() {
+ return new QuadFont(impl_QuadFont_create());
+ }
+ private static native int impl_QuadFont_create();
+ private static native void impl_QuadFont_delete(int id);
+ private static native void impl_QuadFont_setTextures(int id,
+ String[] texUnits,
+ String[] targets,
+ String[] texCoordUnits,
+ int[] textures) ;
+ private static native void impl_QuadFont_setNGlyphs(int id, int n);
+ private static native void impl_QuadFont_setMeasurements(int id, int
glyph,
+ int texInd,
+ float x0, float y0, float x1, float y1,
+ float tx0, float ty0, float tx1, float ty1,
+ float xadvance, float yadvance) ;
+ private static native String[] impl_QuadFont_getTexUnits(int id);
+ private static native String[] impl_QuadFont_getTexTargets(int id);
//--------- OpenGL Program
Index: libvob/org/nongnu/libvob/impl/gl/GLTextStyle.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLTextStyle.java:1.6
libvob/org/nongnu/libvob/impl/gl/GLTextStyle.java:1.7
--- libvob/org/nongnu/libvob/impl/gl/GLTextStyle.java:1.6 Wed Sep 10
09:40:53 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLTextStyle.java Sun Sep 28 09:02:17 2003
@@ -43,7 +43,10 @@
/** A particular loaded font.
*/
static private class Face {
- GL.Font glFont;
+ GLFont glFont;
+ float height;
+ float yoffset;
+
float[] charWidths = new float[256];
GLTextStyle[] instances = new GLTextStyle[250];
};
@@ -96,9 +99,17 @@
static private Face getFace(String fileName) {
Face f = (Face)loadedFonts.get(fileName);
if(f == null) {
+ GL.FTFont ftfont = GL.createFTFont(fileName, 64, 64);
+
f = new Face();
- f.glFont = GL.createFont(fileName, 64, 40);
- f.glFont.getWidths(f.charWidths);
+
+ float scale = 1.0f / (ftfont.getHeight() >> 6);
+ f.glFont = SimpleAlphaFont.convertFont(ftfont, 10, scale, scale,
+ new String[] {
+ "TEXTURE_MAG_FILTER", "LINEAR",
+ "TEXTURE_MIN_FILTER", "LINEAR_MIPMAP_LINEAR"
+ });
+ f.charWidths = f.glFont.getWidths();
if(dbg) for(int i=0; i<256; i++) {
pa("char '"+((char)i)+"': width "+f.charWidths[i]);
}
@@ -206,8 +217,11 @@
return scale * 0.05f * fontScale * face.glFont.getHeight();
}
- public GL.Font getGLFont() {
+ public GLFont getGLFont() {
return face.glFont;
+ }
+ public GL.QuadFont getQuadFont() {
+ return face.glFont.getQuadFont();
}
}
Index: libvob/org/nongnu/libvob/vobs/TextVob.java
diff -u libvob/org/nongnu/libvob/vobs/TextVob.java:1.10
libvob/org/nongnu/libvob/vobs/TextVob.java:1.11
--- libvob/org/nongnu/libvob/vobs/TextVob.java:1.10 Wed Sep 10 09:40:54 2003
+++ libvob/org/nongnu/libvob/vobs/TextVob.java Sun Sep 28 09:02:17 2003
@@ -183,6 +183,8 @@
" FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV
RGB \n" +
" \n" +
" FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
\n" +
+// " Disable TEXTURE_2D\nColor 0 0 0\nDisable BLEND\nDisable ALPHA_TEST\n"+
+" Color 0 0 0\nEnable BLEND\nDisable ALPHA_TEST\n"+
"");
} else {
start = GLCache.getCallList(
@@ -202,7 +204,7 @@
if(ht == null) {
GLTextStyle gls = (GLTextStyle)style;
ht = GLRen.createText1(
- gls.getGLFont(),
+ gls.getQuadFont(),
text,
(baselined ? 1 : gls.getGLFont().getYOffs()),
0);
Index: libvob/org/nongnu/libvob/vobs/textvob.test
diff -u libvob/org/nongnu/libvob/vobs/textvob.test:1.2
libvob/org/nongnu/libvob/vobs/textvob.test:1.3
--- libvob/org/nongnu/libvob/vobs/textvob.test:1.2 Mon Sep 8 03:32:47 2003
+++ libvob/org/nongnu/libvob/vobs/textvob.test Sun Sep 28 09:02:17 2003
@@ -1,6 +1,7 @@
# -*-python-*-
#
# Copyright (c) 2003, Asko Soukka
+# Copyright (c) 2003, Tuomas J. Lukka
#
# This file is part of Gzz.
#
@@ -28,9 +29,12 @@
from test.tools.gfx import *
from java.awt import Color
+import java
sty1 = win.getGraphicsAPI().getTextStyle("SansSerif", 0, 20)
+dbg = 0
+
def testWH():
"""Test that TextVob is drawn with the width and height
that it claims with getWidth() and getHeight().
@@ -43,26 +47,57 @@
vs.map.put(vob.vobs.SolidBackdropVob(Color.red))
textvob = vob.vobs.TextVob(sty1,
"Xj"+chr(196)+"j"+chr(197)+"j"+chr(214)+"jX")
+ quadFont = sty1.getQuadFont()
+
text_width = int(textvob.getWidth(text_scale))
text_height = int(textvob.getHeight(text_scale))
text_depth = int(textvob.getDepth(text_scale))
+ sizes = (text_width, text_height, text_depth)
+ if dbg: print "SIZES:",sizes
+ assert 50 < text_width < 200, sizes
+ assert 10 < text_height < 60, sizes
+ assert 1 < text_depth < 30, sizes
+
+
+ if dbg: print "meas"
+ def sl():
+ if dbg: java.lang.Thread.sleep(4000)
+
cs = vs.orthoBoxCS(0, "window", 0, 100, 100, 1, 1, size.width,
size.height)
cs_text = vs.orthoCS(cs, "text", 0, 0, 0, text_height + text_depth,
text_height + text_depth)
vs.map.put(textvob, cs_text)
+
+ sl()
+
+ if dbg: print "rendering"
render(vs)
+ sl()
+
+ if dbg: print "rendered"
+
"""The top edge."""
checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1)
+ if dbg: print "checked1"
+
+ sl()
"""The left edge."""
checkNotAvgColor(100, 100, 10, text_height+text_depth, (255, 0, 0),
delta=1)
+ if dbg: print "checked2"
+
+ sl()
"""The right edge."""
checkNotAvgColor(100+text_width-10, 100, 10, text_height+text_depth,
(255, 0, 0), delta=1)
+ if dbg: print "checked3"
+ sl()
"""The bottom edge."""
checkNotAvgColor(100, 100+text_height-1, text_width, text_depth+1,
(255, 0, 0), delta=1)
+ if dbg: print "checkedX1"
+ sl()
"""The top side."""
checkAvgColor(100, 100-19, text_width, 10, (255, 0, 0), delta=1)
@@ -76,10 +111,13 @@
"""The bottom side."""
checkAvgColor(100, 100+text_height+text_depth+10, text_width, 10, (255,
0, 0), delta=1)
+ if dbg: print "finished"
+
def testEmpty():
""" Empty string has been found to jam the machine elsewhere.
This test convinces that the problem isn't in TextVob.
"""
+ quadFont = sty1.getQuadFont()
text_scale = 1
vs = getvs()
size = vs.getSize()
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.25 libvob/src/jni/Main.cxx:1.26
--- libvob/src/jni/Main.cxx:1.25 Mon Sep 22 03:24:53 2003
+++ libvob/src/jni/Main.cxx Sun Sep 28 09:02:17 2003
@@ -35,7 +35,6 @@
#include <vob/buildmipmaps.hxx>
#include <vob/Debug.hxx>
-#include <vob/Font.hxx>
#include "org_nongnu_libvob_gl_GL.h"
#include "vobjnidef.hxx"
@@ -57,7 +56,6 @@
ObjectStorer<ByteVector> bytevectors("bytevectors");
-ObjectStorer<Font::RealFont> textrenderers("Textrenderers");
ObjectStorer<Os::RenderingSurface> windows("windows");
Os::Window *defaultWindow; // A kludge
@@ -449,7 +447,32 @@
glBindTexture(GL_TEXTURE_2D, id);
glTexImage2D(GL_TEXTURE_2D,
level, internalFormat, w, h, border, format, type, data);
- env->ReleaseByteArrayElements(jdata, data, 0);
+ env->ReleaseByteArrayElements(jdata, data, JNI_ABORT);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ GLERR
+ }
+
+
+jf(void, impl_1Texture_1texSubImage2D)
+ (JNIEnv *env, jclass, jint id, jint level, jint x, jint y,
+ jint w, jint h, jint border, jstring format_s, jstring type_s,
+ jbyteArray jdata) {
+ int format = tokenFromJstring(env, format_s);
+ int type = tokenFromJstring(env, type_s);
+ jbyte *data = env->GetByteArrayElements(jdata, 0);
+
+ glBindTexture(GL_TEXTURE_2D, id);
+
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ glTexSubImage2D(GL_TEXTURE_2D,
+ level, x, y, w, h, format, type, data);
+
+ glPopClientAttrib();
+
+ env->ReleaseByteArrayElements(jdata, data, JNI_ABORT);
glBindTexture(GL_TEXTURE_2D, 0);
GLERR
}
@@ -784,6 +807,7 @@
//
jf(jint, createByteVectorImpl)
(JNIEnv *, jclass, jint size) {
+ DBG(dbg) << "Try to Alloc byte vector "<<size<<"\n";
ByteVector *vec = new ByteVector(size);
DBG(dbg) << "Alloc byte vector "<<(int)vec<<"\n";
return bytevectors.add(vec);
@@ -800,22 +824,28 @@
jint x, jint y, jint w, jint h,
jstring format, jstring type)
{
+ DBG(dbg) << "ReadFromBuffer\n";
setWindow(winid);
ByteVector *v = bytevectors[id];
GLenum buf = tokenFromJstring(env, buffer);
GLenum form = tokenFromJstring(env, format);
GLenum typ = tokenFromJstring(env, type);
+ DBG(dbg) << "prepped\n";
+
glPushAttrib(GL_PIXEL_MODE_BIT);
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
glReadBuffer(buf);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ DBG(dbg) << "set\n";
glReadPixels(x, y, w, h, form, typ, &((*v)[0]));
+ DBG(dbg) << "fin1\n";
GLERR
glPopClientAttrib();
glPopAttrib();
releaseWindow();
+ DBG(dbg) << "done\n";
}
jf(void, impl_1ByteVector_1drawPixels)
Index: libvob/src/jni/Makefile
diff -u libvob/src/jni/Makefile:1.34 libvob/src/jni/Makefile:1.35
--- libvob/src/jni/Makefile:1.34 Fri Aug 22 07:43:02 2003
+++ libvob/src/jni/Makefile Sun Sep 28 09:02:18 2003
@@ -5,14 +5,12 @@
VOB_OBJS = $(VOBS:%=%.vobjniobj)
TRANS_OBJS = $(TRANS:%=%.transjniobj)
-sources = TransFactory.cxx Main.cxx Strings.cxx Transform.cxx Render.cxx
Font.cxx Paper.cxx Image.cxx TexAccum.cxx Floats.cxx
+sources = TransFactory.cxx Main.cxx Strings.cxx Transform.cxx Render.cxx
Paper.cxx Image.cxx TexAccum.cxx Arrays.cxx QuadFont.cxx FTFont.cxx
CALLGL=../../../callgl
CALLGLOBJS=$(CALLGL)/src/glwrapper/GL_wrapper.o $(CALLGL)/src/callgl.o
-GLMOSAICTEXT=../../../glmosaictext
-GLMOSAICTEXTOBJS=$(GLMOSAICTEXT)/src/Text.o $(GLMOSAICTEXT)/src/Mosaic.o
LINESOBJ=../lines/Lines.o
PAPEROBJS=../paper/Paper.o
@@ -28,7 +26,7 @@
OBJS= $(sources:%.cxx=%.o)
-JNIOBJS=$(OBJS) $(VOB_OBJS) $(TRANS_OBJS) $(OSOBJS) $(TEXTUREOBJS) $(UTILOBJS)
$(CALLGLOBJS) $(TRANSOBJS) $(MAINOBJS) $(GLMOSAICTEXTOBJS) $(PAPEROBJS)
$(LINESOBJ) $(GEOMOBJS) $(STATSOBJS)
+JNIOBJS=$(OBJS) $(VOB_OBJS) $(TRANS_OBJS) $(OSOBJS) $(TEXTUREOBJS) $(UTILOBJS)
$(CALLGLOBJS) $(TRANSOBJS) $(MAINOBJS) $(PAPEROBJS) $(LINESOBJ) $(GEOMOBJS)
$(STATSOBJS)
ifeq ($(JAVAHOME),)
$(error JAVAHOME undefined in src/jni/Makefile (Please see README for
info))
Index: libvob/src/jni/Makefile-Gen
diff -u libvob/src/jni/Makefile-Gen:1.12 libvob/src/jni/Makefile-Gen:1.13
--- libvob/src/jni/Makefile-Gen:1.12 Sun Aug 17 12:10:22 2003
+++ libvob/src/jni/Makefile-Gen Sun Sep 28 09:02:18 2003
@@ -7,8 +7,6 @@
CALLGL=../../../callgl
CALLGLOBJS=$(CALLGL)/src/glwrapper/GL_wrapper.o $(CALLGL)/src/callgl.o
-GLMOSAICTEXT=../../../glmosaictext
-GLMOSAICTEXTOBJS=$(GLMOSAICTEXT)/src/Text.o $(GLMOSAICTEXT)/src/Mosaic.o
%.vobgenobj:
$(CXX) -c $(CXXFLAGS) "-DC_OUTPUT_FILE=src/jni/$*.vobgenjni"
"-DHEADER_FILE=<vob/vobs/$*.hxx>" -o $@ Generator.cxx
@@ -50,7 +48,7 @@
Generator: GeneratorMain.o $(VOB_OBJS) $(TRANS_OBJS)
- $(CXX) -o Generator $(CXXFLAGS) $(EXTRAINCLUDE) GeneratorMain.cxx
$(VOB_OBJS) $(TRANS_OBJS) ../util/Debug.o ../util/intersect.o
../trans/Transform.o ../main/Renderer.o $(CALLGLOBJS) $(GLMOSAICTEXTOBJS)
$(LIBS)
+ $(CXX) -o Generator $(CXXFLAGS) $(EXTRAINCLUDE) GeneratorMain.cxx
$(VOB_OBJS) $(TRANS_OBJS) ../util/Debug.o ../util/intersect.o
../trans/Transform.o ../main/Renderer.o $(CALLGLOBJS) $(LIBS)
.PHONY: javahs
Index: libvob/src/main/Renderer.cxx
diff -u libvob/src/main/Renderer.cxx:1.14 libvob/src/main/Renderer.cxx:1.15
--- libvob/src/main/Renderer.cxx:1.14 Sun Aug 17 22:55:14 2003
+++ libvob/src/main/Renderer.cxx Sun Sep 28 09:02:18 2003
@@ -30,7 +30,6 @@
#include <vob/Renderer.hxx>
#include <vob/glerr.hxx>
-#include <vob/Font.hxx>
double getTime() {
@@ -40,13 +39,6 @@
}
using namespace Vob;
-namespace GLMosaicText {
- DBGVAREXT(dbg, "GLMosaicText");
- DBGVAREXT(dbg_glyphdetails, "GLMosaicText.glyphdetails");
- namespace Mosaic {
- DBGVAREXT(dbg, "GLMosaicText.Mosaic");
- }
-}
namespace Vob {
@@ -78,6 +70,7 @@
namespace Primitives {
DBGVAR(dbg_buoyoncircle, "BuoyOnCircle");
}
+
namespace CurrentFPS {
// bool showFPS;
Index: libvob/src/trans/Coorder.cxx
diff -u libvob/src/trans/Coorder.cxx:1.8 libvob/src/trans/Coorder.cxx:1.9
--- libvob/src/trans/Coorder.cxx:1.8 Wed Aug 13 02:42:01 2003
+++ libvob/src/trans/Coorder.cxx Sun Sep 28 09:02:18 2003
@@ -211,7 +211,10 @@
// Used as a temp; set to null if moved to c.
Primitives::HierarchicalTransform *tmp_c;
tmp_c = transformFactory(tp);
- if(!tmp_c) abort();
+ if(!tmp_c) {
+ std::cerr << "OUCH! Coorder factory failure. Aborting\n";
+ abort();
+ }
int npars = tmp_c->getNParams();
int nprev = tmp_c->getNDepends();
Index: libvob/src/util/ImageLoader.cxx
diff -u libvob/src/util/ImageLoader.cxx:1.2 libvob/src/util/ImageLoader.cxx:1.3
--- libvob/src/util/ImageLoader.cxx:1.2 Wed Jun 11 13:41:56 2003
+++ libvob/src/util/ImageLoader.cxx Sun Sep 28 09:02:18 2003
@@ -30,6 +30,7 @@
#include </usr/include/gdk-pixbuf-1.0/gdk-pixbuf/gdk-pixbuf.h>
#include <vob/util/ImageLoader.hxx>
+#include <iostream>
namespace Vob {
@@ -55,7 +56,7 @@
<<"\n";
int nc = gdk_pixbuf_get_n_channels(pb);
- std::vector<GLMosaicText::Mosaic::Format::RGBA::ValueType> data;
+ std::vector<GLuint> data;
int w = gdk_pixbuf_get_width(pb);
int h = gdk_pixbuf_get_height(pb);
if(nc == 4) {
Index: libvob/test/tools/gfx.py
diff -u libvob/test/tools/gfx.py:1.12 libvob/test/tools/gfx.py:1.13
--- libvob/test/tools/gfx.py:1.12 Mon Sep 22 03:24:54 2003
+++ libvob/test/tools/gfx.py Sun Sep 28 09:02:18 2003
@@ -27,6 +27,8 @@
import vob
+dbg = 0
+
_didRender = 0
_realwin = vob.GraphicsAPI.getInstance().createWindow()
@@ -83,8 +85,11 @@
def getAvgColor(x, y, w, h):
+ if dbg: print "getavgcolor"
colors = win.readPixels(x, y, w, h)
+ if dbg: print "read done"
color = vob.util.ColorUtil.avgColor(colors)
+ if dbg: print "avgcolored"
return [c*255 for c in color.getComponents(None)]
def checkAvgColor(x, y, w, h, color, delta=10):
@@ -97,13 +102,16 @@
def checkNotAvgColor(x, y, w, h, color, delta=10):
+ if dbg: print "Checknotavgcolor"
real = getAvgColor(x, y, w, h)
+ if dbg: print "got avg"
msg = str((color, real, ":", x, y, w, h))
for i in range(0,3):
if abs(color[i]-real[i]) > delta:
return
+ if dbg: print "Checknotavgcolor fail - raising"
raise msg
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ff-cvs] libvob ./Makefile ./README doc/pegboard/glmosai...,
Tuomas J. Lukka <=