From d6f9dbc493df725d3d574403549de142c5e1222a Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 24 Oct 2005 19:21:03 +0000 Subject: Merged JSR-231 branch on to the main JOGL trunk. The main trunk now contains the evolving JSR-231 Reference Implementation and the JSR-231 branch is permanently closed. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@401 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/gluegen/ArrayTypes.java | 125 + .../com/sun/gluegen/CMethodBindingEmitter.java | 1454 ++++++++++++ src/classes/com/sun/gluegen/CodeGenUtils.java | 149 ++ src/classes/com/sun/gluegen/CommentEmitter.java | 52 + src/classes/com/sun/gluegen/DebugEmitter.java | 107 + src/classes/com/sun/gluegen/FunctionEmitter.java | 208 ++ src/classes/com/sun/gluegen/GlueEmitter.java | 103 + .../com/sun/gluegen/GlueEmitterControls.java | 53 + src/classes/com/sun/gluegen/GlueGen.java | 327 +++ src/classes/com/sun/gluegen/JavaConfiguration.java | 1232 ++++++++++ src/classes/com/sun/gluegen/JavaEmitter.java | 1550 ++++++++++++ .../com/sun/gluegen/JavaMethodBindingEmitter.java | 720 ++++++ src/classes/com/sun/gluegen/JavaType.java | 549 +++++ src/classes/com/sun/gluegen/MethodBinding.java | 571 +++++ src/classes/com/sun/gluegen/ReferencedStructs.java | 72 + src/classes/com/sun/gluegen/StructLayout.java | 142 ++ src/classes/com/sun/gluegen/TypeInfo.java | 61 + src/classes/com/sun/gluegen/ant/GlueGenTask.java | 494 ++++ .../com/sun/gluegen/ant/StaticGLGenTask.java | 303 +++ .../com/sun/gluegen/cgram/CSymbolTable.java | 132 ++ src/classes/com/sun/gluegen/cgram/CToken.java | 32 + src/classes/com/sun/gluegen/cgram/Define.java | 56 + src/classes/com/sun/gluegen/cgram/GnuCEmitter.g | 1145 +++++++++ src/classes/com/sun/gluegen/cgram/GnuCParser.g | 864 +++++++ src/classes/com/sun/gluegen/cgram/GnuCTreeParser.g | 852 +++++++ src/classes/com/sun/gluegen/cgram/HeaderParser.g | 715 ++++++ src/classes/com/sun/gluegen/cgram/LineObject.java | 126 + .../sun/gluegen/cgram/PreprocessorInfoChannel.java | 73 + src/classes/com/sun/gluegen/cgram/StdCParser.g | 1375 +++++++++++ src/classes/com/sun/gluegen/cgram/TNode.java | 433 ++++ .../com/sun/gluegen/cgram/TNodeFactory.java | 33 + .../com/sun/gluegen/cgram/types/ArrayType.java | 131 + .../com/sun/gluegen/cgram/types/BitType.java | 87 + .../com/sun/gluegen/cgram/types/CVAttributes.java | 48 + .../com/sun/gluegen/cgram/types/CompoundType.java | 206 ++ .../sun/gluegen/cgram/types/CompoundTypeKind.java | 50 + .../com/sun/gluegen/cgram/types/DoubleType.java | 64 + .../com/sun/gluegen/cgram/types/EnumType.java | 147 ++ src/classes/com/sun/gluegen/cgram/types/Field.java | 96 + .../com/sun/gluegen/cgram/types/FloatType.java | 64 + .../sun/gluegen/cgram/types/FunctionSymbol.java | 112 + .../com/sun/gluegen/cgram/types/FunctionType.java | 164 ++ .../com/sun/gluegen/cgram/types/IntType.java | 82 + .../gluegen/cgram/types/MachineDescription.java | 78 + .../cgram/types/MachineDescription32Bit.java | 46 + .../cgram/types/MachineDescription64Bit.java | 46 + .../com/sun/gluegen/cgram/types/PointerType.java | 140 ++ .../com/sun/gluegen/cgram/types/PrimitiveType.java | 50 + src/classes/com/sun/gluegen/cgram/types/Type.java | 254 ++ .../sun/gluegen/cgram/types/TypeDictionary.java | 169 ++ .../com/sun/gluegen/cgram/types/TypeVisitor.java | 44 + .../com/sun/gluegen/cgram/types/VoidType.java | 56 + .../gluegen/opengl/BuildComposablePipeline.java | 567 +++++ .../com/sun/gluegen/opengl/BuildStaticGLInfo.java | 320 +++ .../com/sun/gluegen/opengl/ConvertFromGL4Java.java | 91 + .../gluegen/opengl/GLCMethodBindingEmitter.java | 201 ++ src/classes/com/sun/gluegen/opengl/GLEmitter.java | 647 +++++ .../gluegen/opengl/GLJavaMethodBindingEmitter.java | 163 ++ src/classes/com/sun/gluegen/pcpp/PCPP.java | 845 +++++++ .../com/sun/gluegen/runtime/BufferFactory.java | 164 ++ .../com/sun/gluegen/runtime/ProcAddressHelper.java | 46 + .../com/sun/gluegen/runtime/StructAccessor.java | 191 ++ src/classes/com/sun/opengl/cg/CgException.java | 67 + src/classes/com/sun/opengl/impl/Debug.java | 91 + .../sun/opengl/impl/FunctionAvailabilityCache.java | 345 +++ src/classes/com/sun/opengl/impl/GLContextImpl.java | 270 +++ src/classes/com/sun/opengl/impl/GLContextLock.java | 118 + .../com/sun/opengl/impl/GLContextShareSet.java | 155 ++ .../com/sun/opengl/impl/GLDrawableFactoryImpl.java | 104 + .../com/sun/opengl/impl/GLDrawableHelper.java | 150 ++ .../com/sun/opengl/impl/GLDrawableImpl.java | 52 + src/classes/com/sun/opengl/impl/GLPbufferImpl.java | 241 ++ .../com/sun/opengl/impl/GLUquadricImpl.java | 1050 +++++++++ .../com/sun/opengl/impl/InternalBufferUtils.java | 55 + .../com/sun/opengl/impl/JAWT_PlatformInfo.java | 45 + src/classes/com/sun/opengl/impl/Java2D.java | 215 ++ .../com/sun/opengl/impl/NativeLibLoader.java | 91 + src/classes/com/sun/opengl/impl/Project.java | 631 +++++ src/classes/com/sun/opengl/impl/Util.java | 242 ++ src/classes/com/sun/opengl/impl/error/Error.java | 88 + src/classes/com/sun/opengl/impl/glue/Glue.java | 104 + .../opengl/impl/macosx/MacOSXDummyGLContext.java | 87 + .../sun/opengl/impl/macosx/MacOSXGLContext.java | 261 ++ .../sun/opengl/impl/macosx/MacOSXGLDrawable.java | 78 + .../impl/macosx/MacOSXGLDrawableFactory.java | 141 ++ .../impl/macosx/MacOSXOffscreenGLContext.java | 64 + .../impl/macosx/MacOSXOffscreenGLDrawable.java | 61 + .../impl/macosx/MacOSXOnscreenGLContext.java | 104 + .../impl/macosx/MacOSXOnscreenGLDrawable.java | 228 ++ .../opengl/impl/macosx/MacOSXPbufferGLContext.java | 101 + .../impl/macosx/MacOSXPbufferGLDrawable.java | 160 ++ .../com/sun/opengl/impl/mipmap/BuildMipmap.java | 1583 +++++++++++++ .../com/sun/opengl/impl/mipmap/Extract.java | 46 + .../com/sun/opengl/impl/mipmap/Extract1010102.java | 87 + .../com/sun/opengl/impl/mipmap/Extract1555rev.java | 87 + .../sun/opengl/impl/mipmap/Extract2101010rev.java | 87 + .../com/sun/opengl/impl/mipmap/Extract233rev.java | 75 + .../com/sun/opengl/impl/mipmap/Extract332.java | 74 + .../com/sun/opengl/impl/mipmap/Extract4444.java | 86 + .../com/sun/opengl/impl/mipmap/Extract4444rev.java | 87 + .../com/sun/opengl/impl/mipmap/Extract5551.java | 87 + .../com/sun/opengl/impl/mipmap/Extract565.java | 82 + .../com/sun/opengl/impl/mipmap/Extract565rev.java | 82 + .../com/sun/opengl/impl/mipmap/Extract8888.java | 87 + .../com/sun/opengl/impl/mipmap/Extract8888rev.java | 87 + .../com/sun/opengl/impl/mipmap/ExtractFloat.java | 64 + .../sun/opengl/impl/mipmap/ExtractPrimitive.java | 46 + .../com/sun/opengl/impl/mipmap/ExtractSByte.java | 59 + .../com/sun/opengl/impl/mipmap/ExtractSInt.java | 66 + .../com/sun/opengl/impl/mipmap/ExtractSShort.java | 66 + .../com/sun/opengl/impl/mipmap/ExtractUByte.java | 60 + .../com/sun/opengl/impl/mipmap/ExtractUInt.java | 66 + .../com/sun/opengl/impl/mipmap/ExtractUShort.java | 66 + .../com/sun/opengl/impl/mipmap/HalveImage.java | 1523 ++++++++++++ src/classes/com/sun/opengl/impl/mipmap/Image.java | 1402 +++++++++++ src/classes/com/sun/opengl/impl/mipmap/Mipmap.java | 802 +++++++ .../sun/opengl/impl/mipmap/PixelStorageModes.java | 416 ++++ .../com/sun/opengl/impl/mipmap/ScaleInternal.java | 2437 +++++++++++++++++++ .../com/sun/opengl/impl/mipmap/Type_Widget.java | 214 ++ .../com/sun/opengl/impl/nurbs/README-PORTING.txt | 40 + .../com/sun/opengl/impl/nurbs/internals/Arc.java | 274 +++ .../opengl/impl/nurbs/internals/ArcTesselator.java | 449 ++++ .../sun/opengl/impl/nurbs/internals/Backend.java | 377 +++ .../impl/nurbs/internals/BasicCurveEvaluator.java | 50 + .../nurbs/internals/BasicSurfaceEvaluator.java | 76 + .../sun/opengl/impl/nurbs/internals/BezierArc.java | 42 + .../com/sun/opengl/impl/nurbs/internals/Bin.java | 147 ++ .../impl/nurbs/internals/CachingEvaluator.java | 56 + .../sun/opengl/impl/nurbs/internals/Defines.java | 46 + .../opengl/impl/nurbs/internals/NurbsConsts.java | 117 + .../impl/nurbs/internals/NurbsException.java | 30 + .../opengl/impl/nurbs/internals/Subdivider.java | 1781 ++++++++++++++ .../com/sun/opengl/impl/registry/Registry.java | 65 + .../sun/opengl/impl/tessellator/ActiveRegion.java | 58 + .../sun/opengl/impl/tessellator/CachedVertex.java | 48 + .../com/sun/opengl/impl/tessellator/Dict.java | 130 + .../com/sun/opengl/impl/tessellator/DictNode.java | 49 + .../com/sun/opengl/impl/tessellator/GLUface.java | 55 + .../sun/opengl/impl/tessellator/GLUhalfEdge.java | 63 + .../com/sun/opengl/impl/tessellator/GLUmesh.java | 52 + .../impl/tessellator/GLUtessellatorImpl.java | 625 +++++ .../com/sun/opengl/impl/tessellator/GLUvertex.java | 55 + .../com/sun/opengl/impl/tessellator/Geom.java | 308 +++ .../com/sun/opengl/impl/tessellator/Mesh.java | 724 ++++++ .../com/sun/opengl/impl/tessellator/Normal.java | 278 +++ .../com/sun/opengl/impl/tessellator/PriorityQ.java | 90 + .../sun/opengl/impl/tessellator/PriorityQHeap.java | 254 ++ .../sun/opengl/impl/tessellator/PriorityQSort.java | 270 +++ .../com/sun/opengl/impl/tessellator/Render.java | 547 +++++ .../com/sun/opengl/impl/tessellator/Sweep.java | 1343 +++++++++++ .../com/sun/opengl/impl/tessellator/TessMono.java | 199 ++ .../com/sun/opengl/impl/tessellator/TessState.java | 50 + .../impl/windows/WindowsDummyGLDrawable.java | 97 + .../impl/windows/WindowsExternalGLContext.java | 77 + .../impl/windows/WindowsExternalGLDrawable.java | 69 + .../sun/opengl/impl/windows/WindowsGLContext.java | 286 +++ .../sun/opengl/impl/windows/WindowsGLDrawable.java | 502 ++++ .../impl/windows/WindowsGLDrawableFactory.java | 223 ++ .../impl/windows/WindowsOffscreenGLContext.java | 64 + .../impl/windows/WindowsOffscreenGLDrawable.java | 133 ++ .../impl/windows/WindowsOnscreenGLContext.java | 93 + .../impl/windows/WindowsOnscreenGLDrawable.java | 198 ++ .../impl/windows/WindowsPbufferGLContext.java | 163 ++ .../impl/windows/WindowsPbufferGLDrawable.java | 399 ++++ .../sun/opengl/impl/x11/X11ExternalGLContext.java | 83 + .../sun/opengl/impl/x11/X11ExternalGLDrawable.java | 212 ++ .../com/sun/opengl/impl/x11/X11GLContext.java | 301 +++ .../com/sun/opengl/impl/x11/X11GLDrawable.java | 172 ++ .../sun/opengl/impl/x11/X11GLDrawableFactory.java | 439 ++++ .../sun/opengl/impl/x11/X11OffscreenGLContext.java | 74 + .../opengl/impl/x11/X11OffscreenGLDrawable.java | 143 ++ .../sun/opengl/impl/x11/X11OnscreenGLContext.java | 95 + .../sun/opengl/impl/x11/X11OnscreenGLDrawable.java | 191 ++ .../sun/opengl/impl/x11/X11PbufferGLContext.java | 151 ++ .../sun/opengl/impl/x11/X11PbufferGLDrawable.java | 264 +++ .../sun/opengl/impl/x11/X11SunJDKReflection.java | 101 + src/classes/com/sun/opengl/utils/Animator.java | 308 +++ .../com/sun/opengl/utils/BitmapCharRec.java | 69 + .../com/sun/opengl/utils/BitmapFontRec.java | 63 + src/classes/com/sun/opengl/utils/BufferUtils.java | 266 +++ src/classes/com/sun/opengl/utils/CoordRec.java | 56 + src/classes/com/sun/opengl/utils/FPSAnimator.java | 99 + src/classes/com/sun/opengl/utils/GLUT.java | 1197 ++++++++++ .../com/sun/opengl/utils/GLUTBitmap8x13.java | 2078 ++++++++++++++++ .../com/sun/opengl/utils/GLUTBitmap9x15.java | 2079 ++++++++++++++++ .../sun/opengl/utils/GLUTBitmapHelvetica10.java | 1798 ++++++++++++++ .../sun/opengl/utils/GLUTBitmapHelvetica12.java | 1808 ++++++++++++++ .../sun/opengl/utils/GLUTBitmapHelvetica18.java | 1917 +++++++++++++++ .../sun/opengl/utils/GLUTBitmapTimesRoman10.java | 1797 ++++++++++++++ .../sun/opengl/utils/GLUTBitmapTimesRoman24.java | 2080 ++++++++++++++++ .../com/sun/opengl/utils/GLUTStrokeMonoRoman.java | 2491 ++++++++++++++++++++ .../com/sun/opengl/utils/GLUTStrokeRoman.java | 2491 ++++++++++++++++++++ .../com/sun/opengl/utils/StrokeCharRec.java | 63 + .../com/sun/opengl/utils/StrokeFontRec.java | 66 + src/classes/com/sun/opengl/utils/StrokeRec.java | 57 + src/classes/com/sun/opengl/utils/Version.java | 104 + .../javax/media/opengl/ComponentEvents.java | 74 + .../media/opengl/DefaultGLCapabilitiesChooser.java | 233 ++ src/classes/javax/media/opengl/GLAutoDrawable.java | 117 + src/classes/javax/media/opengl/GLCanvas.java | 250 ++ src/classes/javax/media/opengl/GLCapabilities.java | 342 +++ .../javax/media/opengl/GLCapabilitiesChooser.java | 67 + src/classes/javax/media/opengl/GLContext.java | 159 ++ src/classes/javax/media/opengl/GLDrawable.java | 118 + .../javax/media/opengl/GLDrawableFactory.java | 282 +++ .../javax/media/opengl/GLEventListener.java | 99 + src/classes/javax/media/opengl/GLException.java | 68 + src/classes/javax/media/opengl/GLJPanel.java | 877 +++++++ src/classes/javax/media/opengl/GLPbuffer.java | 91 + src/classes/javax/media/opengl/Threading.java | 215 ++ src/classes/javax/media/opengl/glu/GLUquadric.java | 8 + .../javax/media/opengl/glu/GLUtessellator.java | 56 + .../media/opengl/glu/GLUtessellatorCallback.java | 346 +++ .../opengl/glu/GLUtessellatorCallbackAdapter.java | 74 + src/native/jogl/BufferUtils.c | 54 - src/native/jogl/InternalBufferUtils.c | 2 +- src/native/jogl/JAWT_DrawingSurfaceInfo.c | 8 +- src/native/jogl/MacOSXWindowSystemInterface.m | 18 +- src/net/java/games/cg/CgException.java | 67 - src/net/java/games/gluegen/ArrayTypes.java | 125 - .../java/games/gluegen/CMethodBindingEmitter.java | 1343 ----------- .../games/gluegen/CMethodBindingImplEmitter.java | 99 - src/net/java/games/gluegen/CodeGenUtils.java | 149 -- src/net/java/games/gluegen/CommentEmitter.java | 52 - src/net/java/games/gluegen/DebugEmitter.java | 107 - src/net/java/games/gluegen/FunctionEmitter.java | 208 -- src/net/java/games/gluegen/GlueEmitter.java | 103 - .../java/games/gluegen/GlueEmitterControls.java | 49 - src/net/java/games/gluegen/GlueGen.java | 322 --- src/net/java/games/gluegen/JavaConfiguration.java | 1184 ---------- src/net/java/games/gluegen/JavaEmitter.java | 1414 ----------- .../games/gluegen/JavaMethodBindingEmitter.java | 269 --- .../gluegen/JavaMethodBindingImplEmitter.java | 263 --- src/net/java/games/gluegen/JavaType.java | 436 ---- src/net/java/games/gluegen/MethodBinding.java | 390 --- src/net/java/games/gluegen/ReferencedStructs.java | 72 - src/net/java/games/gluegen/StructLayout.java | 141 -- src/net/java/games/gluegen/TypeInfo.java | 61 - src/net/java/games/gluegen/ant/GlueGenTask.java | 494 ---- .../java/games/gluegen/ant/StaticGLGenTask.java | 303 --- src/net/java/games/gluegen/cgram/CSymbolTable.java | 132 -- src/net/java/games/gluegen/cgram/CToken.java | 32 - src/net/java/games/gluegen/cgram/Define.java | 56 - src/net/java/games/gluegen/cgram/GnuCEmitter.g | 1145 --------- src/net/java/games/gluegen/cgram/GnuCParser.g | 864 ------- src/net/java/games/gluegen/cgram/GnuCTreeParser.g | 852 ------- src/net/java/games/gluegen/cgram/HeaderParser.g | 715 ------ src/net/java/games/gluegen/cgram/LineObject.java | 126 - .../gluegen/cgram/PreprocessorInfoChannel.java | 73 - src/net/java/games/gluegen/cgram/StdCParser.g | 1375 ----------- src/net/java/games/gluegen/cgram/TNode.java | 433 ---- src/net/java/games/gluegen/cgram/TNodeFactory.java | 33 - .../java/games/gluegen/cgram/types/ArrayType.java | 131 - .../java/games/gluegen/cgram/types/BitType.java | 87 - .../games/gluegen/cgram/types/CVAttributes.java | 48 - .../games/gluegen/cgram/types/CompoundType.java | 206 -- .../gluegen/cgram/types/CompoundTypeKind.java | 50 - .../java/games/gluegen/cgram/types/DoubleType.java | 64 - .../java/games/gluegen/cgram/types/EnumType.java | 147 -- src/net/java/games/gluegen/cgram/types/Field.java | 96 - .../java/games/gluegen/cgram/types/FloatType.java | 64 - .../games/gluegen/cgram/types/FunctionSymbol.java | 112 - .../games/gluegen/cgram/types/FunctionType.java | 164 -- .../java/games/gluegen/cgram/types/IntType.java | 82 - .../gluegen/cgram/types/MachineDescription.java | 78 - .../cgram/types/MachineDescription32Bit.java | 46 - .../cgram/types/MachineDescription64Bit.java | 46 - .../games/gluegen/cgram/types/PointerType.java | 140 -- .../games/gluegen/cgram/types/PrimitiveType.java | 50 - src/net/java/games/gluegen/cgram/types/Type.java | 254 -- .../games/gluegen/cgram/types/TypeDictionary.java | 169 -- .../games/gluegen/cgram/types/TypeVisitor.java | 44 - .../java/games/gluegen/cgram/types/VoidType.java | 56 - .../gluegen/opengl/BuildComposablePipeline.java | 567 ----- .../games/gluegen/opengl/BuildStaticGLInfo.java | 257 -- .../games/gluegen/opengl/CGLPAWrapperEmitter.java | 223 -- .../games/gluegen/opengl/ConvertFromGL4Java.java | 91 - src/net/java/games/gluegen/opengl/GLEmitter.java | 427 ---- .../gluegen/opengl/JavaGLPAWrapperEmitter.java | 180 -- src/net/java/games/gluegen/pcpp/PCPP.java | 845 ------- .../java/games/gluegen/runtime/BufferFactory.java | 75 - .../games/gluegen/runtime/ProcAddressHelper.java | 46 - .../java/games/gluegen/runtime/StructAccessor.java | 191 -- src/net/java/games/jogl/Animator.java | 158 -- src/net/java/games/jogl/ComponentEvents.java | 74 - .../games/jogl/DefaultGLCapabilitiesChooser.java | 233 -- src/net/java/games/jogl/GLCanvas.java | 278 --- src/net/java/games/jogl/GLCapabilities.java | 342 --- src/net/java/games/jogl/GLCapabilitiesChooser.java | 67 - src/net/java/games/jogl/GLContextHelper.java | 68 - src/net/java/games/jogl/GLDrawable.java | 219 -- src/net/java/games/jogl/GLDrawableFactory.java | 195 -- src/net/java/games/jogl/GLEventListener.java | 98 - src/net/java/games/jogl/GLException.java | 68 - src/net/java/games/jogl/GLJPanel.java | 730 ------ src/net/java/games/jogl/GLPbuffer.java | 90 - src/net/java/games/jogl/GLUquadric.java | 8 - src/net/java/games/jogl/GLUtesselator.java | 56 - src/net/java/games/jogl/GLUtesselatorCallback.java | 353 --- .../games/jogl/GLUtesselatorCallbackAdapter.java | 76 - src/net/java/games/jogl/Version.java | 104 - src/net/java/games/jogl/impl/Debug.java | 91 - .../games/jogl/impl/FunctionAvailabilityCache.java | 315 --- src/net/java/games/jogl/impl/GLContext.java | 764 ------ src/net/java/games/jogl/impl/GLContextFactory.java | 105 - .../games/jogl/impl/GLContextInitActionPair.java | 58 - .../java/games/jogl/impl/GLContextShareSet.java | 153 -- src/net/java/games/jogl/impl/GLContextStack.java | 127 - src/net/java/games/jogl/impl/GLDrawableHelper.java | 84 - src/net/java/games/jogl/impl/GLPbufferImpl.java | 286 --- src/net/java/games/jogl/impl/GLUquadricImpl.java | 1049 --------- .../java/games/jogl/impl/InternalBufferUtils.java | 55 - .../java/games/jogl/impl/JAWT_PlatformInfo.java | 45 - src/net/java/games/jogl/impl/NativeLibLoader.java | 86 - src/net/java/games/jogl/impl/Project.java | 592 ----- .../games/jogl/impl/SingleThreadedWorkaround.java | 115 - src/net/java/games/jogl/impl/Util.java | 242 -- src/net/java/games/jogl/impl/error/Error.java | 89 - src/net/java/games/jogl/impl/glue/Glue.java | 104 - .../jogl/impl/macosx/MacOSXDummyGLContext.java | 116 - .../games/jogl/impl/macosx/MacOSXGLContext.java | 278 --- .../jogl/impl/macosx/MacOSXGLContextFactory.java | 65 - .../jogl/impl/macosx/MacOSXOffscreenGLContext.java | 101 - .../jogl/impl/macosx/MacOSXOnscreenGLContext.java | 248 -- .../jogl/impl/macosx/MacOSXPbufferGLContext.java | 203 -- .../java/games/jogl/impl/mipmap/BuildMipmap.java | 1576 ------------- src/net/java/games/jogl/impl/mipmap/Extract.java | 46 - .../games/jogl/impl/mipmap/Extract1010102.java | 87 - .../games/jogl/impl/mipmap/Extract1555rev.java | 87 - .../games/jogl/impl/mipmap/Extract2101010rev.java | 87 - .../java/games/jogl/impl/mipmap/Extract233rev.java | 75 - .../java/games/jogl/impl/mipmap/Extract332.java | 74 - .../java/games/jogl/impl/mipmap/Extract4444.java | 86 - .../games/jogl/impl/mipmap/Extract4444rev.java | 87 - .../java/games/jogl/impl/mipmap/Extract5551.java | 87 - .../java/games/jogl/impl/mipmap/Extract565.java | 82 - .../java/games/jogl/impl/mipmap/Extract565rev.java | 82 - .../java/games/jogl/impl/mipmap/Extract8888.java | 87 - .../games/jogl/impl/mipmap/Extract8888rev.java | 87 - .../java/games/jogl/impl/mipmap/ExtractFloat.java | 64 - .../games/jogl/impl/mipmap/ExtractPrimitive.java | 46 - .../java/games/jogl/impl/mipmap/ExtractSByte.java | 59 - .../java/games/jogl/impl/mipmap/ExtractSInt.java | 66 - .../java/games/jogl/impl/mipmap/ExtractSShort.java | 66 - .../java/games/jogl/impl/mipmap/ExtractUByte.java | 60 - .../java/games/jogl/impl/mipmap/ExtractUInt.java | 66 - .../java/games/jogl/impl/mipmap/ExtractUShort.java | 66 - .../java/games/jogl/impl/mipmap/HalveImage.java | 1523 ------------ src/net/java/games/jogl/impl/mipmap/Image.java | 1402 ----------- src/net/java/games/jogl/impl/mipmap/Mipmap.java | 799 ------- .../games/jogl/impl/mipmap/PixelStorageModes.java | 416 ---- .../java/games/jogl/impl/mipmap/ScaleInternal.java | 2381 ------------------- .../java/games/jogl/impl/mipmap/Type_Widget.java | 214 -- .../java/games/jogl/impl/nurbs/README-PORTING.txt | 40 - .../java/games/jogl/impl/nurbs/internals/Arc.java | 274 --- .../jogl/impl/nurbs/internals/ArcTesselator.java | 449 ---- .../games/jogl/impl/nurbs/internals/Backend.java | 377 --- .../impl/nurbs/internals/BasicCurveEvaluator.java | 50 - .../nurbs/internals/BasicSurfaceEvaluator.java | 76 - .../games/jogl/impl/nurbs/internals/BezierArc.java | 42 - .../java/games/jogl/impl/nurbs/internals/Bin.java | 147 -- .../impl/nurbs/internals/CachingEvaluator.java | 56 - .../games/jogl/impl/nurbs/internals/Defines.java | 46 - .../jogl/impl/nurbs/internals/NurbsConsts.java | 117 - .../jogl/impl/nurbs/internals/NurbsException.java | 30 - .../jogl/impl/nurbs/internals/Subdivider.java | 1781 -------------- .../java/games/jogl/impl/registry/Registry.java | 65 - .../games/jogl/impl/tesselator/ActiveRegion.java | 58 - .../games/jogl/impl/tesselator/CachedVertex.java | 48 - src/net/java/games/jogl/impl/tesselator/Dict.java | 130 - .../java/games/jogl/impl/tesselator/DictNode.java | 49 - .../java/games/jogl/impl/tesselator/GLUface.java | 55 - .../games/jogl/impl/tesselator/GLUhalfEdge.java | 63 - .../java/games/jogl/impl/tesselator/GLUmesh.java | 52 - .../jogl/impl/tesselator/GLUtesselatorImpl.java | 624 ----- .../java/games/jogl/impl/tesselator/GLUvertex.java | 55 - src/net/java/games/jogl/impl/tesselator/Geom.java | 308 --- src/net/java/games/jogl/impl/tesselator/Mesh.java | 724 ------ .../java/games/jogl/impl/tesselator/Normal.java | 277 --- .../java/games/jogl/impl/tesselator/PriorityQ.java | 90 - .../games/jogl/impl/tesselator/PriorityQHeap.java | 254 -- .../games/jogl/impl/tesselator/PriorityQSort.java | 270 --- .../java/games/jogl/impl/tesselator/Render.java | 546 ----- src/net/java/games/jogl/impl/tesselator/Sweep.java | 1342 ----------- .../java/games/jogl/impl/tesselator/TessMono.java | 199 -- .../java/games/jogl/impl/tesselator/TessState.java | 50 - .../games/jogl/impl/windows/WindowsGLContext.java | 717 ------ .../jogl/impl/windows/WindowsGLContextFactory.java | 361 --- .../impl/windows/WindowsOffscreenGLContext.java | 176 -- .../impl/windows/WindowsOnscreenGLContext.java | 228 -- .../jogl/impl/windows/WindowsPbufferGLContext.java | 529 ----- src/net/java/games/jogl/impl/x11/X11GLContext.java | 410 ---- .../games/jogl/impl/x11/X11GLContextFactory.java | 288 --- .../games/jogl/impl/x11/X11OffscreenGLContext.java | 175 -- .../games/jogl/impl/x11/X11OnscreenGLContext.java | 217 -- .../games/jogl/impl/x11/X11PbufferGLContext.java | 343 --- .../games/jogl/impl/x11/X11SunJDKReflection.java | 101 - src/net/java/games/jogl/util/BitmapCharRec.java | 69 - src/net/java/games/jogl/util/BitmapFontRec.java | 63 - src/net/java/games/jogl/util/BufferUtils.java | 121 - src/net/java/games/jogl/util/CoordRec.java | 56 - src/net/java/games/jogl/util/GLUT.java | 1201 ---------- src/net/java/games/jogl/util/GLUTBitmap8x13.java | 2078 ---------------- src/net/java/games/jogl/util/GLUTBitmap9x15.java | 2079 ---------------- .../games/jogl/util/GLUTBitmapHelvetica10.java | 1798 -------------- .../games/jogl/util/GLUTBitmapHelvetica12.java | 1808 -------------- .../games/jogl/util/GLUTBitmapHelvetica18.java | 1917 --------------- .../games/jogl/util/GLUTBitmapTimesRoman10.java | 1797 -------------- .../games/jogl/util/GLUTBitmapTimesRoman24.java | 2080 ---------------- .../java/games/jogl/util/GLUTStrokeMonoRoman.java | 2491 -------------------- src/net/java/games/jogl/util/GLUTStrokeRoman.java | 2491 -------------------- src/net/java/games/jogl/util/StrokeCharRec.java | 63 - src/net/java/games/jogl/util/StrokeFontRec.java | 66 - src/net/java/games/jogl/util/StrokeRec.java | 57 - 414 files changed, 72463 insertions(+), 69553 deletions(-) create mode 100644 src/classes/com/sun/gluegen/ArrayTypes.java create mode 100644 src/classes/com/sun/gluegen/CMethodBindingEmitter.java create mode 100644 src/classes/com/sun/gluegen/CodeGenUtils.java create mode 100644 src/classes/com/sun/gluegen/CommentEmitter.java create mode 100644 src/classes/com/sun/gluegen/DebugEmitter.java create mode 100644 src/classes/com/sun/gluegen/FunctionEmitter.java create mode 100644 src/classes/com/sun/gluegen/GlueEmitter.java create mode 100644 src/classes/com/sun/gluegen/GlueEmitterControls.java create mode 100644 src/classes/com/sun/gluegen/GlueGen.java create mode 100644 src/classes/com/sun/gluegen/JavaConfiguration.java create mode 100644 src/classes/com/sun/gluegen/JavaEmitter.java create mode 100644 src/classes/com/sun/gluegen/JavaMethodBindingEmitter.java create mode 100644 src/classes/com/sun/gluegen/JavaType.java create mode 100644 src/classes/com/sun/gluegen/MethodBinding.java create mode 100644 src/classes/com/sun/gluegen/ReferencedStructs.java create mode 100644 src/classes/com/sun/gluegen/StructLayout.java create mode 100644 src/classes/com/sun/gluegen/TypeInfo.java create mode 100644 src/classes/com/sun/gluegen/ant/GlueGenTask.java create mode 100644 src/classes/com/sun/gluegen/ant/StaticGLGenTask.java create mode 100644 src/classes/com/sun/gluegen/cgram/CSymbolTable.java create mode 100644 src/classes/com/sun/gluegen/cgram/CToken.java create mode 100644 src/classes/com/sun/gluegen/cgram/Define.java create mode 100644 src/classes/com/sun/gluegen/cgram/GnuCEmitter.g create mode 100644 src/classes/com/sun/gluegen/cgram/GnuCParser.g create mode 100644 src/classes/com/sun/gluegen/cgram/GnuCTreeParser.g create mode 100644 src/classes/com/sun/gluegen/cgram/HeaderParser.g create mode 100644 src/classes/com/sun/gluegen/cgram/LineObject.java create mode 100644 src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java create mode 100644 src/classes/com/sun/gluegen/cgram/StdCParser.g create mode 100644 src/classes/com/sun/gluegen/cgram/TNode.java create mode 100644 src/classes/com/sun/gluegen/cgram/TNodeFactory.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/ArrayType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/BitType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/CVAttributes.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/CompoundType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/CompoundTypeKind.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/DoubleType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/EnumType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/Field.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/FloatType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/FunctionSymbol.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/FunctionType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/IntType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/MachineDescription.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/MachineDescription32Bit.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/MachineDescription64Bit.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/PointerType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/PrimitiveType.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/Type.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/TypeDictionary.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/TypeVisitor.java create mode 100644 src/classes/com/sun/gluegen/cgram/types/VoidType.java create mode 100644 src/classes/com/sun/gluegen/opengl/BuildComposablePipeline.java create mode 100644 src/classes/com/sun/gluegen/opengl/BuildStaticGLInfo.java create mode 100644 src/classes/com/sun/gluegen/opengl/ConvertFromGL4Java.java create mode 100755 src/classes/com/sun/gluegen/opengl/GLCMethodBindingEmitter.java create mode 100644 src/classes/com/sun/gluegen/opengl/GLEmitter.java create mode 100755 src/classes/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java create mode 100644 src/classes/com/sun/gluegen/pcpp/PCPP.java create mode 100644 src/classes/com/sun/gluegen/runtime/BufferFactory.java create mode 100644 src/classes/com/sun/gluegen/runtime/ProcAddressHelper.java create mode 100644 src/classes/com/sun/gluegen/runtime/StructAccessor.java create mode 100644 src/classes/com/sun/opengl/cg/CgException.java create mode 100644 src/classes/com/sun/opengl/impl/Debug.java create mode 100644 src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java create mode 100644 src/classes/com/sun/opengl/impl/GLContextImpl.java create mode 100644 src/classes/com/sun/opengl/impl/GLContextLock.java create mode 100644 src/classes/com/sun/opengl/impl/GLContextShareSet.java create mode 100644 src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java create mode 100644 src/classes/com/sun/opengl/impl/GLDrawableHelper.java create mode 100644 src/classes/com/sun/opengl/impl/GLDrawableImpl.java create mode 100644 src/classes/com/sun/opengl/impl/GLPbufferImpl.java create mode 100644 src/classes/com/sun/opengl/impl/GLUquadricImpl.java create mode 100644 src/classes/com/sun/opengl/impl/InternalBufferUtils.java create mode 100644 src/classes/com/sun/opengl/impl/JAWT_PlatformInfo.java create mode 100755 src/classes/com/sun/opengl/impl/Java2D.java create mode 100644 src/classes/com/sun/opengl/impl/NativeLibLoader.java create mode 100755 src/classes/com/sun/opengl/impl/Project.java create mode 100644 src/classes/com/sun/opengl/impl/Util.java create mode 100644 src/classes/com/sun/opengl/impl/error/Error.java create mode 100644 src/classes/com/sun/opengl/impl/glue/Glue.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXDummyGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/BuildMipmap.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract1010102.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract1555rev.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract2101010rev.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract233rev.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract332.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract4444.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract4444rev.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract5551.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract565.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract565rev.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract8888.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Extract8888rev.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractFloat.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractPrimitive.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractSByte.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractSInt.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractSShort.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractUByte.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractUInt.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ExtractUShort.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/HalveImage.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Image.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Mipmap.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/PixelStorageModes.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java create mode 100644 src/classes/com/sun/opengl/impl/mipmap/Type_Widget.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/README-PORTING.txt create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/Arc.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/ArcTesselator.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/Backend.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/BasicCurveEvaluator.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/BasicSurfaceEvaluator.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/BezierArc.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/Bin.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/CachingEvaluator.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/Defines.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/NurbsConsts.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/NurbsException.java create mode 100644 src/classes/com/sun/opengl/impl/nurbs/internals/Subdivider.java create mode 100644 src/classes/com/sun/opengl/impl/registry/Registry.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/ActiveRegion.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/CachedVertex.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/Dict.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/DictNode.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/GLUface.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/GLUhalfEdge.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/GLUmesh.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/GLUtessellatorImpl.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/GLUvertex.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/Geom.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/Mesh.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/Normal.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/PriorityQ.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/PriorityQHeap.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/PriorityQSort.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/Render.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/Sweep.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/TessMono.java create mode 100644 src/classes/com/sun/opengl/impl/tessellator/TessState.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java create mode 100755 src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java create mode 100755 src/classes/com/sun/opengl/impl/windows/WindowsExternalGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java create mode 100755 src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java create mode 100755 src/classes/com/sun/opengl/impl/x11/X11ExternalGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11GLContext.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11GLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11OffscreenGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11OffscreenGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11OnscreenGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11PbufferGLContext.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11PbufferGLDrawable.java create mode 100644 src/classes/com/sun/opengl/impl/x11/X11SunJDKReflection.java create mode 100755 src/classes/com/sun/opengl/utils/Animator.java create mode 100644 src/classes/com/sun/opengl/utils/BitmapCharRec.java create mode 100644 src/classes/com/sun/opengl/utils/BitmapFontRec.java create mode 100644 src/classes/com/sun/opengl/utils/BufferUtils.java create mode 100644 src/classes/com/sun/opengl/utils/CoordRec.java create mode 100755 src/classes/com/sun/opengl/utils/FPSAnimator.java create mode 100644 src/classes/com/sun/opengl/utils/GLUT.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmap8x13.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmap9x15.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica10.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica12.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica18.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman10.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman24.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTStrokeMonoRoman.java create mode 100644 src/classes/com/sun/opengl/utils/GLUTStrokeRoman.java create mode 100644 src/classes/com/sun/opengl/utils/StrokeCharRec.java create mode 100644 src/classes/com/sun/opengl/utils/StrokeFontRec.java create mode 100644 src/classes/com/sun/opengl/utils/StrokeRec.java create mode 100644 src/classes/com/sun/opengl/utils/Version.java create mode 100644 src/classes/javax/media/opengl/ComponentEvents.java create mode 100644 src/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java create mode 100644 src/classes/javax/media/opengl/GLAutoDrawable.java create mode 100644 src/classes/javax/media/opengl/GLCanvas.java create mode 100644 src/classes/javax/media/opengl/GLCapabilities.java create mode 100644 src/classes/javax/media/opengl/GLCapabilitiesChooser.java create mode 100644 src/classes/javax/media/opengl/GLContext.java create mode 100644 src/classes/javax/media/opengl/GLDrawable.java create mode 100644 src/classes/javax/media/opengl/GLDrawableFactory.java create mode 100644 src/classes/javax/media/opengl/GLEventListener.java create mode 100644 src/classes/javax/media/opengl/GLException.java create mode 100644 src/classes/javax/media/opengl/GLJPanel.java create mode 100644 src/classes/javax/media/opengl/GLPbuffer.java create mode 100755 src/classes/javax/media/opengl/Threading.java create mode 100755 src/classes/javax/media/opengl/glu/GLUquadric.java create mode 100755 src/classes/javax/media/opengl/glu/GLUtessellator.java create mode 100755 src/classes/javax/media/opengl/glu/GLUtessellatorCallback.java create mode 100755 src/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java delete mode 100644 src/native/jogl/BufferUtils.c delete mode 100644 src/net/java/games/cg/CgException.java delete mode 100644 src/net/java/games/gluegen/ArrayTypes.java delete mode 100644 src/net/java/games/gluegen/CMethodBindingEmitter.java delete mode 100644 src/net/java/games/gluegen/CMethodBindingImplEmitter.java delete mode 100644 src/net/java/games/gluegen/CodeGenUtils.java delete mode 100644 src/net/java/games/gluegen/CommentEmitter.java delete mode 100644 src/net/java/games/gluegen/DebugEmitter.java delete mode 100644 src/net/java/games/gluegen/FunctionEmitter.java delete mode 100644 src/net/java/games/gluegen/GlueEmitter.java delete mode 100644 src/net/java/games/gluegen/GlueEmitterControls.java delete mode 100644 src/net/java/games/gluegen/GlueGen.java delete mode 100644 src/net/java/games/gluegen/JavaConfiguration.java delete mode 100644 src/net/java/games/gluegen/JavaEmitter.java delete mode 100644 src/net/java/games/gluegen/JavaMethodBindingEmitter.java delete mode 100644 src/net/java/games/gluegen/JavaMethodBindingImplEmitter.java delete mode 100644 src/net/java/games/gluegen/JavaType.java delete mode 100644 src/net/java/games/gluegen/MethodBinding.java delete mode 100644 src/net/java/games/gluegen/ReferencedStructs.java delete mode 100644 src/net/java/games/gluegen/StructLayout.java delete mode 100644 src/net/java/games/gluegen/TypeInfo.java delete mode 100644 src/net/java/games/gluegen/ant/GlueGenTask.java delete mode 100644 src/net/java/games/gluegen/ant/StaticGLGenTask.java delete mode 100644 src/net/java/games/gluegen/cgram/CSymbolTable.java delete mode 100644 src/net/java/games/gluegen/cgram/CToken.java delete mode 100644 src/net/java/games/gluegen/cgram/Define.java delete mode 100644 src/net/java/games/gluegen/cgram/GnuCEmitter.g delete mode 100644 src/net/java/games/gluegen/cgram/GnuCParser.g delete mode 100644 src/net/java/games/gluegen/cgram/GnuCTreeParser.g delete mode 100644 src/net/java/games/gluegen/cgram/HeaderParser.g delete mode 100644 src/net/java/games/gluegen/cgram/LineObject.java delete mode 100644 src/net/java/games/gluegen/cgram/PreprocessorInfoChannel.java delete mode 100644 src/net/java/games/gluegen/cgram/StdCParser.g delete mode 100644 src/net/java/games/gluegen/cgram/TNode.java delete mode 100644 src/net/java/games/gluegen/cgram/TNodeFactory.java delete mode 100644 src/net/java/games/gluegen/cgram/types/ArrayType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/BitType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/CVAttributes.java delete mode 100644 src/net/java/games/gluegen/cgram/types/CompoundType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/CompoundTypeKind.java delete mode 100644 src/net/java/games/gluegen/cgram/types/DoubleType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/EnumType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/Field.java delete mode 100644 src/net/java/games/gluegen/cgram/types/FloatType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/FunctionSymbol.java delete mode 100644 src/net/java/games/gluegen/cgram/types/FunctionType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/IntType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/MachineDescription.java delete mode 100644 src/net/java/games/gluegen/cgram/types/MachineDescription32Bit.java delete mode 100644 src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java delete mode 100644 src/net/java/games/gluegen/cgram/types/PointerType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/PrimitiveType.java delete mode 100644 src/net/java/games/gluegen/cgram/types/Type.java delete mode 100644 src/net/java/games/gluegen/cgram/types/TypeDictionary.java delete mode 100644 src/net/java/games/gluegen/cgram/types/TypeVisitor.java delete mode 100644 src/net/java/games/gluegen/cgram/types/VoidType.java delete mode 100644 src/net/java/games/gluegen/opengl/BuildComposablePipeline.java delete mode 100644 src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java delete mode 100644 src/net/java/games/gluegen/opengl/CGLPAWrapperEmitter.java delete mode 100644 src/net/java/games/gluegen/opengl/ConvertFromGL4Java.java delete mode 100644 src/net/java/games/gluegen/opengl/GLEmitter.java delete mode 100644 src/net/java/games/gluegen/opengl/JavaGLPAWrapperEmitter.java delete mode 100644 src/net/java/games/gluegen/pcpp/PCPP.java delete mode 100644 src/net/java/games/gluegen/runtime/BufferFactory.java delete mode 100644 src/net/java/games/gluegen/runtime/ProcAddressHelper.java delete mode 100644 src/net/java/games/gluegen/runtime/StructAccessor.java delete mode 100644 src/net/java/games/jogl/Animator.java delete mode 100644 src/net/java/games/jogl/ComponentEvents.java delete mode 100644 src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java delete mode 100644 src/net/java/games/jogl/GLCanvas.java delete mode 100644 src/net/java/games/jogl/GLCapabilities.java delete mode 100644 src/net/java/games/jogl/GLCapabilitiesChooser.java delete mode 100644 src/net/java/games/jogl/GLContextHelper.java delete mode 100644 src/net/java/games/jogl/GLDrawable.java delete mode 100644 src/net/java/games/jogl/GLDrawableFactory.java delete mode 100644 src/net/java/games/jogl/GLEventListener.java delete mode 100644 src/net/java/games/jogl/GLException.java delete mode 100644 src/net/java/games/jogl/GLJPanel.java delete mode 100644 src/net/java/games/jogl/GLPbuffer.java delete mode 100755 src/net/java/games/jogl/GLUquadric.java delete mode 100644 src/net/java/games/jogl/GLUtesselator.java delete mode 100644 src/net/java/games/jogl/GLUtesselatorCallback.java delete mode 100644 src/net/java/games/jogl/GLUtesselatorCallbackAdapter.java delete mode 100644 src/net/java/games/jogl/Version.java delete mode 100755 src/net/java/games/jogl/impl/Debug.java delete mode 100644 src/net/java/games/jogl/impl/FunctionAvailabilityCache.java delete mode 100644 src/net/java/games/jogl/impl/GLContext.java delete mode 100644 src/net/java/games/jogl/impl/GLContextFactory.java delete mode 100755 src/net/java/games/jogl/impl/GLContextInitActionPair.java delete mode 100644 src/net/java/games/jogl/impl/GLContextShareSet.java delete mode 100755 src/net/java/games/jogl/impl/GLContextStack.java delete mode 100644 src/net/java/games/jogl/impl/GLDrawableHelper.java delete mode 100644 src/net/java/games/jogl/impl/GLPbufferImpl.java delete mode 100755 src/net/java/games/jogl/impl/GLUquadricImpl.java delete mode 100644 src/net/java/games/jogl/impl/InternalBufferUtils.java delete mode 100644 src/net/java/games/jogl/impl/JAWT_PlatformInfo.java delete mode 100644 src/net/java/games/jogl/impl/NativeLibLoader.java delete mode 100755 src/net/java/games/jogl/impl/Project.java delete mode 100755 src/net/java/games/jogl/impl/SingleThreadedWorkaround.java delete mode 100755 src/net/java/games/jogl/impl/Util.java delete mode 100644 src/net/java/games/jogl/impl/error/Error.java delete mode 100644 src/net/java/games/jogl/impl/glue/Glue.java delete mode 100644 src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java delete mode 100644 src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java delete mode 100644 src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java delete mode 100644 src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java delete mode 100644 src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java delete mode 100644 src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/BuildMipmap.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract1010102.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract1555rev.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract2101010rev.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract233rev.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract332.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract4444.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract4444rev.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract5551.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract565.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract565rev.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract8888.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Extract8888rev.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractFloat.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractPrimitive.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractSByte.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractSInt.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractSShort.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractUByte.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractUInt.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ExtractUShort.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/HalveImage.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Image.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Mipmap.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/PixelStorageModes.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/ScaleInternal.java delete mode 100644 src/net/java/games/jogl/impl/mipmap/Type_Widget.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/README-PORTING.txt delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/Arc.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/ArcTesselator.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/Backend.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/BasicCurveEvaluator.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/BasicSurfaceEvaluator.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/BezierArc.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/Bin.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/CachingEvaluator.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/Defines.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/NurbsConsts.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/NurbsException.java delete mode 100755 src/net/java/games/jogl/impl/nurbs/internals/Subdivider.java delete mode 100644 src/net/java/games/jogl/impl/registry/Registry.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/ActiveRegion.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/CachedVertex.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/Dict.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/DictNode.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/GLUface.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/GLUhalfEdge.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/GLUmesh.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/GLUvertex.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/Geom.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/Mesh.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/Normal.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/PriorityQ.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/PriorityQHeap.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/PriorityQSort.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/Render.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/Sweep.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/TessMono.java delete mode 100644 src/net/java/games/jogl/impl/tesselator/TessState.java delete mode 100644 src/net/java/games/jogl/impl/windows/WindowsGLContext.java delete mode 100644 src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java delete mode 100644 src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java delete mode 100644 src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java delete mode 100644 src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java delete mode 100644 src/net/java/games/jogl/impl/x11/X11GLContext.java delete mode 100644 src/net/java/games/jogl/impl/x11/X11GLContextFactory.java delete mode 100644 src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java delete mode 100644 src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java delete mode 100644 src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java delete mode 100755 src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java delete mode 100644 src/net/java/games/jogl/util/BitmapCharRec.java delete mode 100644 src/net/java/games/jogl/util/BitmapFontRec.java delete mode 100644 src/net/java/games/jogl/util/BufferUtils.java delete mode 100644 src/net/java/games/jogl/util/CoordRec.java delete mode 100644 src/net/java/games/jogl/util/GLUT.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmap8x13.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmap9x15.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java delete mode 100644 src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java delete mode 100644 src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java delete mode 100644 src/net/java/games/jogl/util/GLUTStrokeRoman.java delete mode 100644 src/net/java/games/jogl/util/StrokeCharRec.java delete mode 100644 src/net/java/games/jogl/util/StrokeFontRec.java delete mode 100644 src/net/java/games/jogl/util/StrokeRec.java (limited to 'src') diff --git a/src/classes/com/sun/gluegen/ArrayTypes.java b/src/classes/com/sun/gluegen/ArrayTypes.java new file mode 100644 index 000000000..7e5dd9597 --- /dev/null +++ b/src/classes/com/sun/gluegen/ArrayTypes.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.nio.*; + +/** + * Convenience class containing the Class objects corresponding to arrays of + * various types (e.g., {@link #booleanArrayClass} is the Class of Java type + * "boolean[]"). + */ +public class ArrayTypes { + /** Class for Java type boolean[] */ + public static final Class booleanArrayClass; + /** Class for Java type byte[] */ + public static final Class byteArrayClass; + /** Class for Java type char[] */ + public static final Class charArrayClass; + /** Class for Java type short[] */ + public static final Class shortArrayClass; + /** Class for Java type int[] */ + public static final Class intArrayClass; + /** Class for Java type long[] */ + public static final Class longArrayClass; + /** Class for Java type float[] */ + public static final Class floatArrayClass; + /** Class for Java type double[] */ + public static final Class doubleArrayClass; + /** Class for Java type String[] */ + public static final Class stringArrayClass; + + // Classes for two-dimensional arrays. + // + // GlueGen converts C types like int** into Java arrays of direct + // buffers of the appropriate type (like IntBuffer[]). If the tool + // supported conversions like byte[][] -> char**, it would + // effectively be necessary to copy all of the data from the Java + // heap to the C heap during each call. The reason for this is that + // if we wanted to use GetPrimitiveArrayCritical to lock down the + // storage for each individual array element, we would need to fetch + // each element of the two-dimensional Java array into temporary + // storage before making the first GetPrimitiveArrayCritical call, + // since one can not call GetObjectArrayElement inside a Get / + // ReleasePrimitiveArrayCritical pair. This means that we would need + // two top-level pieces of temporary storage for the two-dimensional + // array as well as two loops to set up the contents, which would be + // too complicated. + // + // The one concession we make is converting String[] -> char**. The + // JVM takes care of the C heap allocation for GetStringUTFChars and + // ReleaseStringUTFChars, and this conversion is important for + // certain OpenGL operations. + + /** Class for Java type Buffer[] */ + public static final Class bufferArrayClass; + /** Class for Java type ByteBuffer[] */ + public static final Class byteBufferArrayClass; + /** Class for Java type ShortBuffer[] */ + public static final Class shortBufferArrayClass; + /** Class for Java type IntBuffer[] */ + public static final Class intBufferArrayClass; + /** Class for Java type LongBuffer[] */ + public static final Class longBufferArrayClass; + /** Class for Java type FloatBuffer[] */ + public static final Class floatBufferArrayClass; + /** Class for Java type DoubleBuffer[] */ + public static final Class doubleBufferArrayClass; + + static { + booleanArrayClass = new boolean[0].getClass(); + byteArrayClass = new byte [0].getClass(); + charArrayClass = new char [0].getClass(); + shortArrayClass = new short [0].getClass(); + intArrayClass = new int [0].getClass(); + longArrayClass = new long [0].getClass(); + floatArrayClass = new float [0].getClass(); + doubleArrayClass = new double [0].getClass(); + stringArrayClass = new String [0].getClass(); + + bufferArrayClass = new Buffer [0].getClass(); + byteBufferArrayClass = new ByteBuffer [0].getClass(); + shortBufferArrayClass = new ShortBuffer [0].getClass(); + intBufferArrayClass = new IntBuffer [0].getClass(); + longBufferArrayClass = new LongBuffer [0].getClass(); + floatBufferArrayClass = new FloatBuffer [0].getClass(); + doubleBufferArrayClass = new DoubleBuffer[0].getClass(); + } +} diff --git a/src/classes/com/sun/gluegen/CMethodBindingEmitter.java b/src/classes/com/sun/gluegen/CMethodBindingEmitter.java new file mode 100644 index 000000000..70877ff5e --- /dev/null +++ b/src/classes/com/sun/gluegen/CMethodBindingEmitter.java @@ -0,0 +1,1454 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.util.*; +import java.io.*; +import java.text.MessageFormat; + +import com.sun.gluegen.cgram.types.*; + +/** Emits the C-side component of the Java<->C JNI binding. */ +public class CMethodBindingEmitter extends FunctionEmitter +{ + protected static final CommentEmitter defaultCommentEmitter = + new DefaultCommentEmitter(); + + protected static final String arrayResLength = "_array_res_length"; + protected static final String arrayRes = "_array_res"; + protected static final String arrayIdx = "_array_idx"; + + protected MethodBinding binding; + + /** Name of the package in which the corresponding Java method resides.*/ + private String packageName; + + /** Name of the class in which the corresponding Java method resides.*/ + private String className; + + /** + * Whether or not the Java<->C JNI binding for this emitter's MethodBinding + * is overloaded. + */ + private boolean isOverloadedBinding; + + /** + * Whether or not the Java-side of the Java<->C JNI binding for this + * emitter's MethodBinding is static. + */ + private boolean isJavaMethodStatic; + + // Flags which change various aspects of glue code generation + protected boolean forImplementingMethodCall; + protected boolean forIndirectBufferAndArrayImplementation; + + /** + * Optional List of Strings containing temporary C variables to declare. + */ + private List/**/ temporaryCVariableDeclarations; + + /** + * Optional List of Strings containing assignments to temporary C variables + * to make after the call is completed. + */ + private List/**/ temporaryCVariableAssignments; + + /** + * Capacity of the return value in the event that it is encapsulated in a + * java.nio.Buffer. Is ignored if binding.getJavaReturnType().isNIOBuffer() + * == false; + */ + private MessageFormat returnValueCapacityExpression = null; + + /** + * Length of the returned array. Is ignored if + * binding.getJavaReturnType().isArray() is false. + */ + private MessageFormat returnValueLengthExpression = null; + + // Note: the VC++ 6.0 compiler emits hundreds of warnings when the + // (necessary) null-checking code is enabled. This appears to just + // be a compiler bug, but would be good to track down exactly why it + // is happening. When the null checking is enabled for just the + // GetPrimitiveArrayCritical calls, there are five warnings + // generated for several thousand new if tests added to the code. + // Which ones are the ones at fault? The line numbers for the + // warnings are incorrect. + private static final boolean EMIT_NULL_CHECKS = true; + + /** + * Constructs an emitter for the specified binding, and sets a default + * comment emitter that will emit the signature of the C function that is + * being bound. + */ + public CMethodBindingEmitter(MethodBinding binding, + PrintWriter output, + String javaPackageName, + String javaClassName, + boolean isOverloadedBinding, + boolean isJavaMethodStatic, + boolean forImplementingMethodCall, + boolean forIndirectBufferAndArrayImplementation) + { + super(output); + + assert(binding != null); + assert(javaClassName != null); + assert(javaPackageName != null); + + this.binding = binding; + this.packageName = javaPackageName; + this.className = javaClassName; + this.isOverloadedBinding = isOverloadedBinding; + this.isJavaMethodStatic = isJavaMethodStatic; + + this.forImplementingMethodCall = forImplementingMethodCall; + this.forIndirectBufferAndArrayImplementation = forIndirectBufferAndArrayImplementation; + + setCommentEmitter(defaultCommentEmitter); + } + + public final MethodBinding getBinding() { return binding; } + + public String getName() { + return binding.getRenamedMethodName(); + } + + /** + * Get the expression for the capacity of the returned java.nio.Buffer. + */ + public final MessageFormat getReturnValueCapacityExpression() + { + return returnValueCapacityExpression; + } + + /** + * If this function returns a void* encapsulated in a + * java.nio.Buffer (or compound type wrapper), sets the expression + * for the capacity of the returned Buffer. + * + * @param expression a MessageFormat which, when applied to an array + * of type String[] that contains each of the arguments names of the + * Java-side binding, returns an expression that will (when compiled + * by a C compiler) evaluate to an integer-valued expression. The + * value of this expression is the capacity of the java.nio.Buffer + * returned from this method. + * + * @throws IllegalArgumentException if the + * binding.getJavaReturnType().isNIOBuffer() == false and + * binding.getJavaReturnType().isCompoundTypeWrapper() == false + * + */ + public final void setReturnValueCapacityExpression(MessageFormat expression) + { + returnValueCapacityExpression = expression; + + if (!binding.getJavaReturnType().isNIOBuffer() && + !binding.getJavaReturnType().isCompoundTypeWrapper()) + { + throw new IllegalArgumentException( + "Cannot specify return value capacity for a method that does not " + + "return java.nio.Buffer or a compound type wrapper: \"" + binding + "\""); + } + } + + /** + * Get the expression for the length of the returned array + */ + public final MessageFormat getReturnValueLengthExpression() + { + return returnValueLengthExpression; + } + + /** + * If this function returns an array, sets the expression for the + * length of the returned array. + * + * @param expression a MessageFormat which, when applied to an array + * of type String[] that contains each of the arguments names of the + * Java-side binding, returns an expression that will (when compiled + * by a C compiler) evaluate to an integer-valued expression. The + * value of this expression is the length of the array returned from + * this method. + * + * @throws IllegalArgumentException if the + * binding.getJavaReturnType().isNIOBuffer() == false + * + */ + public final void setReturnValueLengthExpression(MessageFormat expression) + { + returnValueLengthExpression = expression; + + if (!binding.getJavaReturnType().isArray() && + !binding.getJavaReturnType().isArrayOfCompoundTypeWrappers()) + { + throw new IllegalArgumentException( + "Cannot specify return value length for a method that does not " + + "return an array: \"" + binding + "\""); + } + } + + /** + * Returns the List of Strings containing declarations for temporary + * C variables to be assigned to after the underlying function call. + */ + public final List/**/ getTemporaryCVariableDeclarations() { + return temporaryCVariableDeclarations; + } + + /** + * Sets up a List of Strings containing declarations for temporary C + * variables to be assigned to after the underlying function call. A + * null argument indicates that no manual declarations are to be made. + */ + public final void setTemporaryCVariableDeclarations(List/**/ arg) { + temporaryCVariableDeclarations = arg; + } + + /** + * Returns the List of Strings containing assignments for temporary + * C variables which are made after the underlying function call. A + * null argument indicates that no manual assignments are to be + * made. + */ + public final List/**/ getTemporaryCVariableAssignments() { + return temporaryCVariableAssignments; + } + + /** + * Sets up a List of Strings containing assignments for temporary C + * variables which are made after the underlying function call. A + * null argument indicates that no manual assignments are to be made. + */ + public final void setTemporaryCVariableAssignments(List/**/ arg) { + temporaryCVariableAssignments = arg; + } + + /** + * Get the name of the class in which the corresponding Java method + * resides. + */ + public String getJavaPackageName() { return packageName; } + + /** + * Get the name of the package in which the corresponding Java method + * resides. + */ + public String getJavaClassName() { return className; } + + /** + * Is the Java<->C JNI binding for this emitter's MethodBinding one of + * several overloaded methods with the same name? + */ + public final boolean getIsOverloadedBinding() { return isOverloadedBinding; } + + /** + * Is the Java side of the Java<->C JNI binding for this emitter's + * MethodBinding a static method?. + */ + public final boolean getIsJavaMethodStatic() { return isJavaMethodStatic; } + + /** + * Is this CMethodBindingEmitter implementing the case of an + * indirect buffer or array being passed down to C code? + */ + public final boolean forIndirectBufferAndArrayImplementation() { return forIndirectBufferAndArrayImplementation; } + + protected void emitReturnType(PrintWriter writer) + { + writer.print("JNIEXPORT "); + writer.print(binding.getJavaReturnType().jniTypeName()); + writer.print(" JNICALL"); + } + + protected void emitName(PrintWriter writer) + { + writer.println(); // start name on new line + writer.print("Java_"); + writer.print(jniMangle(getJavaPackageName())); + writer.print("_"); + writer.print(jniMangle(getJavaClassName())); + writer.print("_"); + if (isOverloadedBinding) + { + writer.print(jniMangle(binding)); + //System.err.println("OVERLOADED MANGLING FOR " + getName() + + // " = " + jniMangle(binding)); + } + else + { + writer.print(jniMangle(getName())); + //System.err.println(" NORMAL MANGLING FOR " + binding.getName() + + // " = " + jniMangle(getName())); + } + } + + protected String getImplSuffix() { + if (forImplementingMethodCall) { + if (forIndirectBufferAndArrayImplementation) { + return "1"; + } else { + return "0"; + } + } + return ""; + } + + protected int emitArguments(PrintWriter writer) + { + writer.print("JNIEnv *env, "); + int numEmitted = 1; // initially just the JNIEnv + if (isJavaMethodStatic && !binding.hasContainingType()) + { + writer.print("jclass"); + } + else + { + writer.print("jobject"); + } + writer.print(" _unused"); + ++numEmitted; + + if (binding.hasContainingType()) + { + // "this" argument always comes down in argument 0 as direct buffer + writer.print(", jobject " + JavaMethodBindingEmitter.javaThisArgumentName()); + } + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType javaArgType = binding.getJavaArgumentType(i); + // Handle case where only param is void + if (javaArgType.isVoid()) { + // Make sure this is the only param to the method; if it isn't, + // there's something wrong with our parsing of the headers. + assert(binding.getNumArguments() == 1); + continue; + } + if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) { + continue; + } + writer.print(", "); + writer.print(javaArgType.jniTypeName()); + writer.print(" "); + writer.print(binding.getArgumentName(i)); + ++numEmitted; + + if (javaArgType.isPrimitiveArray() || + javaArgType.isNIOBuffer()) { + writer.print(", jint " + byteOffsetArgName(i)); + } else if (javaArgType.isNIOBufferArray()) { + writer.print(", jintArray " + + byteOffsetArrayArgName(i)); + } + } + return numEmitted; + } + + + protected void emitBody(PrintWriter writer) + { + writer.println(" {"); + emitBodyVariableDeclarations(writer); + emitBodyUserVariableDeclarations(writer); + emitBodyVariablePreCallSetup(writer, false); + emitBodyVariablePreCallSetup(writer, true); + emitBodyCallCFunction(writer); + emitBodyUserVariableAssignments(writer); + emitBodyVariablePostCallCleanup(writer, true); + emitBodyVariablePostCallCleanup(writer, false); + emitBodyReturnResult(writer); + writer.println("}"); + writer.println(); + } + + protected void emitBodyVariableDeclarations(PrintWriter writer) + { + // Emit declarations for all pointer and String conversion variables + if (binding.hasContainingType()) { + emitPointerDeclaration(writer, + binding.getContainingType(), + binding.getContainingCType(), + CMethodBindingEmitter.cThisArgumentName(), + null); + } + + boolean emittedDataCopyTemps = false; + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType type = binding.getJavaArgumentType(i); + if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { + continue; + } + + if (type.isArray() || type.isNIOBuffer() || type.isCompoundTypeWrapper()) { + String convName = pointerConversionArgumentName(i); + // handle array/buffer argument types + boolean needsDataCopy = + emitPointerDeclaration(writer, + binding.getJavaArgumentType(i), + binding.getCArgumentType(i), + convName, + binding.getArgumentName(i)); + if (needsDataCopy && !emittedDataCopyTemps) { + // emit loop counter and array length variables used during data + // copy + writer.println(" jobject _tmpObj;"); + writer.println(" int _copyIndex;"); + writer.println(" jsize _tmpArrayLen;"); + + // Pointer to the data in the Buffer, taking the offset into account + writer.println(" int * _offsetHandle = NULL;"); + + emittedDataCopyTemps = true; + } + } else if (type.isString()) { + writer.print(" const char* _UTF8"); + writer.print(binding.getArgumentName(i)); + writer.println(" = NULL;"); + } + + } + + // Emit declaration for return value if necessary + Type cReturnType = binding.getCReturnType(); + + JavaType javaReturnType = binding.getJavaReturnType(); + String capitalizedComponentType = null; + if (!cReturnType.isVoid()) { + writer.print(" "); + // Note we must respect const/volatile for return argument + writer.print(binding.getCSymbol().getReturnType().getName(true)); + writer.println(" _res;"); + if (javaReturnType.isNIOByteBufferArray() || + javaReturnType.isArrayOfCompoundTypeWrappers()) { + writer.print(" int "); + writer.print(arrayResLength); + writer.println(";"); + writer.print(" int "); + writer.print(arrayIdx); + writer.println(";"); + writer.print(" jobjectArray "); + writer.print(arrayRes); + writer.println(";"); + } else if (javaReturnType.isArray()) { + writer.print(" int "); + writer.print(arrayResLength); + writer.println(";"); + + Class componentType = javaReturnType.getJavaClass().getComponentType(); + if (componentType.isArray()) { + throw new RuntimeException("Multi-dimensional arrays not supported yet"); + } + + String javaTypeName = componentType.getName(); + capitalizedComponentType = + "" + Character.toUpperCase(javaTypeName.charAt(0)) + javaTypeName.substring(1); + String javaArrayTypeName = "j" + javaTypeName + "Array"; + writer.print(" "); + writer.print(javaArrayTypeName); + writer.print(" "); + writer.print(arrayRes); + writer.println(";"); + } + } + } + + /** Emits the user-defined C variable declarations from the + TemporaryCVariableDeclarations directive in the .cfg file. */ + protected void emitBodyUserVariableDeclarations(PrintWriter writer) { + if (temporaryCVariableDeclarations != null) { + for (Iterator iter = temporaryCVariableDeclarations.iterator(); iter.hasNext(); ) { + String val = (String) iter.next(); + writer.print(" "); + writer.println(val); + } + } + } + + /** Checks a type (expected to be pointer-to-pointer) for const-ness */ + protected boolean isConstPtrPtr(Type type) { + if (type.pointerDepth() != 2) { + return false; + } + if (type.asPointer().getTargetType().asPointer().getTargetType().isConst()) { + return true; + } + return false; + } + + /** + * Code to init the variables that were declared in + * emitBodyVariableDeclarations(), PRIOR TO calling the actual C + * function. + */ + protected void emitBodyVariablePreCallSetup(PrintWriter writer, + boolean emittingPrimitiveArrayCritical) + { + if (!emittingPrimitiveArrayCritical) { + // Convert all Buffers to pointers first so we don't have to + // call ReleasePrimitiveArrayCritical for any arrays if any + // incoming buffers aren't direct + if (binding.hasContainingType()) { + emitPointerConversion(writer, binding, + binding.getContainingType(), + binding.getContainingCType(), + JavaMethodBindingEmitter.javaThisArgumentName(), + CMethodBindingEmitter.cThisArgumentName(), + null); + } + + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType type = binding.getJavaArgumentType(i); + if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { + continue; + } + + if (type.isCompoundTypeWrapper() || + (type.isNIOBuffer() && !forIndirectBufferAndArrayImplementation)) { + emitPointerConversion(writer, binding, type, + binding.getCArgumentType(i), + binding.getArgumentName(i), + pointerConversionArgumentName(i), + byteOffsetArgName(i)); + } + } + } + + // Convert all arrays to pointers, and get UTF-8 versions of jstring args + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType javaArgType = binding.getJavaArgumentType(i); + + if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) { + continue; + } + + if (javaArgType.isArray() || + (javaArgType.isNIOBuffer() && forIndirectBufferAndArrayImplementation)) { + boolean needsDataCopy = javaArgTypeNeedsDataCopy(javaArgType); + + // We only defer the emission of GetPrimitiveArrayCritical + // calls that won't be matched up until after the function + // we're calling + if ((!needsDataCopy && !emittingPrimitiveArrayCritical) || + (needsDataCopy && emittingPrimitiveArrayCritical)) { + continue; + } + + if (EMIT_NULL_CHECKS) { + writer.print(" if ("); + writer.print(binding.getArgumentName(i)); + writer.println(" != NULL) {"); + } + + Type cArgType = binding.getCArgumentType(i); + String cArgTypeName = cArgType.getName(); + + String convName = pointerConversionArgumentName(i); + + if (!needsDataCopy) { + writer.print(" "); + writer.print(convName); + writer.print(" = ("); + if (javaArgType.isStringArray()) { + // java-side type is String[] + cArgTypeName = "jstring *"; + } + writer.print(cArgTypeName); + writer.print(") (((char*) (*env)->GetPrimitiveArrayCritical(env, "); + writer.print(binding.getArgumentName(i)); + writer.println(", NULL)) + " + byteOffsetArgName(i) + ");"); +//if(cargtypename is void*) +// _ptrX = ((char*)convName + index1*sizeof(thisArgsJavaType)); + + } else { + // Handle the case where the array elements are of a type that needs a + // data copy operation to convert from the java memory model to the C + // memory model (e.g., int[][], String[], etc) + // + // FIXME: should factor out this whole block of code into a separate + // method for clarity and maintenance purposes + if (!isConstPtrPtr(cArgType)) { + // FIXME: if the arg type is non-const, the sematics might be that + // the function modifies the argument -- we don't yet support + // this. + // + // Note: the check for "const" in the CVAttributes string isn't + // truly checking the constness of the target types at both + // pointer depths. However, it's a quick approximation, and quite + // often C code doesn't get the constness right anyhow. + throw new RuntimeException( + "Cannot copy data for ptr-to-ptr arg type \"" + cArgType + + "\": support for non-const ptr-to-ptr types not implemented."); + } + + writer.println(); + writer.println(" /* Copy contents of " + binding.getArgumentName(i) + + " into " + convName + "_copy */"); + + // get length of array being copied + String arrayLenName = "_tmpArrayLen"; + writer.print(" "); + writer.print(arrayLenName); + writer.print(" = (*env)->GetArrayLength(env, "); + writer.print(binding.getArgumentName(i)); + writer.println(");"); + + // allocate an array to hold each element + if (cArgType.pointerDepth() != 2) { + throw new RuntimeException( + "Could not copy data for type \"" + cArgType + + "\"; copying only supported for types of the form " + + "ptr-to-ptr-to-type."); + } + PointerType cArgPtrType = cArgType.asPointer(); + if (cArgPtrType == null) { + throw new RuntimeException( + "Could not copy data for type \"" + cArgType + + "\"; currently only pointer types supported."); + } + PointerType cArgElementType = cArgPtrType.getTargetType().asPointer(); + emitMalloc( + writer, + convName+"_copy", + cArgElementType.getName(), + arrayLenName, + "Could not allocate buffer for copying data in argument \\\""+binding.getArgumentName(i)+"\\\""); + + // Get the handle for the byte offset array sent down for Buffers + // FIXME: not 100% sure this is correct with respect to the + // JNI spec because it may be illegal to call + // GetObjectArrayElement while in a critical section. May + // need to do another loop and add in the offsets. + if (javaArgType.isNIOBufferArray()) { + writer.println + (" _offsetHandle = (int *) (*env)->GetPrimitiveArrayCritical(env, " + + byteOffsetArrayArgName(i) + + ", NULL);"); + } + + // process each element in the array + writer.println(" for (_copyIndex = 0; _copyIndex < "+arrayLenName+"; ++_copyIndex) {"); + + // get each array element + writer.println(" /* get each element of the array argument \"" + binding.getArgumentName(i) + "\" */"); + writer.print(" _tmpObj = (*env)->GetObjectArrayElement(env, "); + writer.print(binding.getArgumentName(i)); + writer.println(", _copyIndex);"); + + if (javaArgType.isStringArray()) { + writer.print(" "); + emitGetStringUTFChars(writer, + "(jstring) _tmpObj", + convName+"_copy[_copyIndex]", + true); + } else if (javaArgType.isNIOBufferArray()) { + /* We always assume an integer "byte offset" argument follows any Buffer + in the method binding. */ + emitGetDirectBufferAddress(writer, + "_tmpObj", + cArgElementType.getName(), + convName + "_copy[_copyIndex]", + "_offsetHandle[_copyIndex]", + true); + } else { + // Question: do we always need to copy the sub-arrays, or just + // GetPrimitiveArrayCritical on each jobjectarray element and + // assign it to the appropriate elements at pointer depth 1? + // Probably depends on const-ness of the argument. + // Malloc enough space to hold a copy of each sub-array + writer.print(" "); + emitMalloc( + writer, + convName+"_copy[_copyIndex]", + cArgElementType.getTargetType().getName(), // assumes cArgPtrType is ptr-to-ptr-to-primitive !! + "(*env)->GetArrayLength(env, _tmpObj)", + "Could not allocate buffer during copying of data in argument \\\""+binding.getArgumentName(i)+"\\\""); + // FIXME: copy the data (use matched Get/ReleasePrimitiveArrayCritical() calls) + if (true) throw new RuntimeException( + "Cannot yet handle type \"" + cArgType.getName() + + "\"; need to add support for copying ptr-to-ptr-to-primitiveType subarrays"); + + + } + writer.println(" }"); + + if (javaArgType.isNIOBufferArray()) { + writer.println + (" (*env)->ReleasePrimitiveArrayCritical(env, " + + byteOffsetArrayArgName(i) + + ", _offsetHandle, JNI_ABORT);"); + } + + writer.println(); + } // end of data copy + + if (EMIT_NULL_CHECKS) { + writer.println(" }"); + } + } else if (javaArgType.isString()) { + if (!emittingPrimitiveArrayCritical) { + continue; + } + + if (EMIT_NULL_CHECKS) { + writer.print(" if ("); + writer.print(binding.getArgumentName(i)); + writer.println(" != NULL) {"); + } + + emitGetStringUTFChars(writer, + binding.getArgumentName(i), + "_UTF8" + binding.getArgumentName(i), + false); + + if (EMIT_NULL_CHECKS) { + writer.println(" }"); + } + } else if (javaArgType.isArrayOfCompoundTypeWrappers()) { + + // FIXME + throw new RuntimeException("Outgoing arrays of StructAccessors not yet implemented"); + } + } + } + + + /** + * Code to clean up any variables that were declared in + * emitBodyVariableDeclarations(), AFTER calling the actual C function. + */ + protected void emitBodyVariablePostCallCleanup(PrintWriter writer, + boolean emittingPrimitiveArrayCritical) + { + // Release primitive arrays and temporary UTF8 strings if necessary + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType javaArgType = binding.getJavaArgumentType(i); + if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) { + continue; + } + + if (javaArgType.isArray() || + (javaArgType.isNIOBuffer() && forIndirectBufferAndArrayImplementation)) { + boolean needsDataCopy = javaArgTypeNeedsDataCopy(javaArgType); + + if ((!needsDataCopy && !emittingPrimitiveArrayCritical) || + (needsDataCopy && emittingPrimitiveArrayCritical)) { + continue; + } + + if (EMIT_NULL_CHECKS) { + writer.print(" if ("); + writer.print(binding.getArgumentName(i)); + writer.println(" != NULL) {"); + } + + String convName = pointerConversionArgumentName(i); + + if (!needsDataCopy) { + // Release array + writer.print(" (*env)->ReleasePrimitiveArrayCritical(env, "); + writer.print(binding.getArgumentName(i)); + writer.print(", "); + writer.print(convName); + writer.println(", JNI_ABORT);"); + } else { + // clean up the case where the array elements are of a type that needed + // a data copy operation to convert from the java memory model to the + // C memory model (e.g., int[][], String[], etc) + // + // FIXME: should factor out this whole block of code into a separate + // method for clarity and maintenance purposes + Type cArgType = binding.getCArgumentType(i); + String cArgTypeName = cArgType.getName(); + + if (cArgType.toString().indexOf("const") == -1) { + // FIXME: handle any cleanup from treatment of non-const args, + // assuming they were treated differently in + // emitBodyVariablePreCallSetup() (see the similar section in that + // method for details). + throw new RuntimeException( + "Cannot clean up copied data for ptr-to-ptr arg type \"" + cArgType + + "\": support for cleaning up non-const ptr-to-ptr types not implemented."); + } + + writer.println(" /* Clean up " + convName + "_copy */"); + + // Only need to perform cleanup for individual array + // elements if they are not direct buffers + if (!javaArgType.isNIOBufferArray()) { + // Re-fetch length of array that was copied + String arrayLenName = "_tmpArrayLen"; + writer.print(" "); + writer.print(arrayLenName); + writer.print(" = (*env)->GetArrayLength(env, "); + writer.print(binding.getArgumentName(i)); + writer.println(");"); + + // free each element + PointerType cArgPtrType = cArgType.asPointer(); + if (cArgPtrType == null) { + throw new RuntimeException( + "Could not copy data for type \"" + cArgType + + "\"; currently only pointer types supported."); + } + PointerType cArgElementType = cArgPtrType.getTargetType().asPointer(); + + // process each element in the array + writer.println(" for (_copyIndex = 0; _copyIndex < " + arrayLenName +"; ++_copyIndex) {"); + + // get each array element + writer.println(" /* free each element of " +convName +"_copy */"); + writer.print(" _tmpObj = (*env)->GetObjectArrayElement(env, "); + writer.print(binding.getArgumentName(i)); + writer.println(", _copyIndex);"); + + if (javaArgType.isStringArray()) { + writer.print(" (*env)->ReleaseStringUTFChars(env, "); + writer.print("(jstring) _tmpObj"); + writer.print(", "); + writer.print(convName+"_copy[_copyIndex]"); + writer.println(");"); + } else { + if (true) throw new RuntimeException( + "Cannot yet handle type \"" + cArgType.getName() + + "\"; need to add support for cleaning up copied ptr-to-ptr-to-primitiveType subarrays"); + } + writer.println(" }"); + } + + // free the main array + writer.print(" free((void*) "); + writer.print(convName+"_copy"); + writer.println(");"); + } // end of cleaning up copied data + + if (EMIT_NULL_CHECKS) { + writer.println(" }"); + } + } else if (javaArgType.isString()) { + if (emittingPrimitiveArrayCritical) { + continue; + } + + if (EMIT_NULL_CHECKS) { + writer.print(" if ("); + writer.print(binding.getArgumentName(i)); + writer.println(" != NULL) {"); + } + + writer.print(" (*env)->ReleaseStringUTFChars(env, "); + writer.print(binding.getArgumentName(i)); + writer.print(", _UTF8"); + writer.print(binding.getArgumentName(i)); + writer.println(");"); + + if (EMIT_NULL_CHECKS) { + writer.println(" }"); + } + } else if (javaArgType.isArrayOfCompoundTypeWrappers()) { + + // FIXME + throw new RuntimeException("Outgoing arrays of StructAccessors not yet implemented"); + + } + } + } + + /** Returns the number of arguments passed so calling code knows + whether to print a comma */ + protected int emitBodyPassCArguments(PrintWriter writer) { + for (int i = 0; i < binding.getNumArguments(); i++) { + if (i != 0) { + writer.print(", "); + } + JavaType javaArgType = binding.getJavaArgumentType(i); + // Handle case where only param is void. + if (javaArgType.isVoid()) { + // Make sure this is the only param to the method; if it isn't, + // there's something wrong with our parsing of the headers. + assert(binding.getNumArguments() == 1); + continue; + } + + if (javaArgType.isJNIEnv()) { + writer.print("env"); + } else if (binding.isArgumentThisPointer(i)) { + writer.print(CMethodBindingEmitter.cThisArgumentName()); + } else { + writer.print("("); + Type cArgType = binding.getCSymbol().getArgumentType(i); + writer.print(cArgType.getName()); + writer.print(") "); + if (binding.getCArgumentType(i).isPointer() && binding.getJavaArgumentType(i).isPrimitive()) { + writer.print("(intptr_t) "); + } + if (javaArgType.isArray() || javaArgType.isNIOBuffer() || javaArgType.isCompoundTypeWrapper()) { + writer.print(pointerConversionArgumentName(i)); + if (javaArgTypeNeedsDataCopy(javaArgType)) { + writer.print("_copy"); + } + } else { + if (javaArgType.isString()) { writer.print("_UTF8"); } + writer.print(binding.getArgumentName(i)); + } + } + } + return binding.getNumArguments(); + } + + protected void emitBodyCallCFunction(PrintWriter writer) { + + // Make the call to the actual C function + writer.print(" "); + + // WARNING: this code assumes that the return type has already been + // typedef-resolved. + Type cReturnType = binding.getCReturnType(); + + if (!cReturnType.isVoid()) { + writer.print("_res = "); + } + if (binding.hasContainingType()) { + // Call through function pointer + writer.print(CMethodBindingEmitter.cThisArgumentName() + "->"); + } + writer.print(binding.getCSymbol().getName()); + writer.print("("); + emitBodyPassCArguments(writer); + writer.println(");"); + } + + /** Emits the user-defined C variable assignments from the + TemporaryCVariableAssignments directive in the .cfg file. */ + protected void emitBodyUserVariableAssignments(PrintWriter writer) { + if (temporaryCVariableAssignments != null) { + for (Iterator iter = temporaryCVariableAssignments.iterator(); iter.hasNext(); ) { + String val = (String) iter.next(); + writer.print(" "); + writer.println(val); + } + } + } + + protected void emitBodyReturnResult(PrintWriter writer) + { + // WARNING: this code assumes that the return type has already been + // typedef-resolved. + Type cReturnType = binding.getCReturnType(); + + // Return result if necessary + if (!cReturnType.isVoid()) { + JavaType javaReturnType = binding.getJavaReturnType(); + if (javaReturnType.isPrimitive()) { + writer.print(" return "); + if (cReturnType.isPointer()) { + // Pointer being converted to int or long: cast this result + // (through intptr_t to avoid compiler warnings with gcc) + writer.print("(" + javaReturnType.jniTypeName() + ") (intptr_t) "); + } + writer.println("_res;"); + } else if (javaReturnType.isNIOBuffer() || + javaReturnType.isCompoundTypeWrapper()) { + writer.println(" if (_res == NULL) return NULL;"); + writer.print(" return (*env)->NewDirectByteBuffer(env, _res, "); + // See whether capacity has been specified + if (returnValueCapacityExpression != null) { + String[] argumentNames = new String[binding.getNumArguments()]; + for (int i = 0; i < binding.getNumArguments(); i++) + { + argumentNames[i] = binding.getArgumentName(i); + } + writer.print( + returnValueCapacityExpression.format(argumentNames)); + } else { + int sz = 0; + if (cReturnType.isPointer() && + cReturnType.asPointer().getTargetType().isCompound()) { + sz = cReturnType.asPointer().getTargetType().getSize(); + if (sz == -1) { + throw new RuntimeException( + "Error emitting code for compound return type "+ + "for function \"" + binding + "\": " + + "Structs to be emitted should have been laid out by this point " + + "(type " + cReturnType.asPointer().getTargetType().getName() + " / " + + cReturnType.asPointer().getTargetType() + " was not)" + ); + } + } else { + sz = cReturnType.getSize(); + } + writer.print(sz); + System.err.println( + "WARNING: No capacity specified for java.nio.Buffer return " + + "value for function \"" + binding + "\";" + + " assuming size of equivalent C return type (" + sz + " bytes): " + binding); + } + writer.println(");"); + } else if (javaReturnType.isString()) { + writer.print(" if (_res == NULL) return NULL;"); + writer.println(" return (*env)->NewStringUTF(env, _res);"); + } else if (javaReturnType.isArrayOfCompoundTypeWrappers() || + (javaReturnType.isArray() && javaReturnType.isNIOByteBufferArray())) { + writer.println(" if (_res == NULL) return NULL;"); + if (returnValueLengthExpression == null) { + throw new RuntimeException("Error while generating C code: no length specified for array returned from function " + + binding); + } + String[] argumentNames = new String[binding.getNumArguments()]; + for (int i = 0; i < binding.getNumArguments(); i++) { + argumentNames[i] = binding.getArgumentName(i); + } + writer.println(" " + arrayResLength + " = " + returnValueLengthExpression.format(argumentNames) + ";"); + writer.println(" " + arrayRes + " = (*env)->NewObjectArray(env, " + arrayResLength + ", (*env)->FindClass(env, \"java/nio/ByteBuffer\"), NULL);"); + writer.println(" for (" + arrayIdx + " = 0; " + arrayIdx + " < " + arrayResLength + "; " + arrayIdx + "++) {"); + Type retType = binding.getCSymbol().getReturnType(); + Type baseType; + if (retType.isPointer()) { + baseType = retType.asPointer().getTargetType().asPointer().getTargetType(); + } else { + baseType = retType.asArray().getElementType().asPointer().getTargetType(); + } + int sz = baseType.getSize(); + if (sz < 0) + sz = 0; + writer.println(" (*env)->SetObjectArrayElement(env, " + arrayRes + ", " + arrayIdx + + ", (*env)->NewDirectByteBuffer(env, _res[" + arrayIdx + "], " + sz + "));"); + writer.println(" }"); + writer.println(" return " + arrayRes + ";"); + } else if (javaReturnType.isArray()) { + // FIXME: must have user provide length of array in .cfg file + // by providing a constant value, input parameter, or + // expression which computes the array size (already present + // as ReturnValueCapacity, not yet implemented / tested here) + + throw new RuntimeException( + "Could not emit native code for function \"" + binding + + "\": array return values for non-char types not implemented yet"); + + // FIXME: This is approximately what will be required here + // + //writer.print(" "); + //writer.print(arrayRes); + //writer.print(" = (*env)->New"); + //writer.print(capitalizedComponentType); + //writer.print("Array(env, "); + //writer.print(arrayResLength); + //writer.println(");"); + //writer.print(" (*env)->Set"); + //writer.print(capitalizedComponentType); + //writer.print("ArrayRegion(env, "); + //writer.print(arrayRes); + //writer.print(", 0, "); + //writer.print(arrayResLength); + //writer.println(", _res);"); + //writer.print(" return "); + //writer.print(arrayRes); + //writer.println(";"); + } else { + System.err.print("Unhandled return type: "); + javaReturnType.dump(); + throw new RuntimeException("Unhandled return type"); + } + } + } + + protected static String cThisArgumentName() { + return "this0"; + } + + // Mangle a class, package or function name + protected String jniMangle(String name) { + return name.replaceAll("_", "_1").replace('.', '_'); + } + + protected String jniMangle(MethodBinding binding) { + StringBuffer buf = new StringBuffer(); + buf.append(jniMangle(getName())); + buf.append(getImplSuffix()); + buf.append("__"); + if (binding.hasContainingType()) { + // "this" argument always comes down in argument 0 as direct buffer + jniMangle(java.nio.ByteBuffer.class, buf, true); + } + for (int i = 0; i < binding.getNumArguments(); i++) { + if (binding.isArgumentThisPointer(i)) { + continue; + } + JavaType type = binding.getJavaArgumentType(i); + if (type.isVoid()) { + // We should only see "void" as the first argument of a 1-argument function + // FIXME: should normalize this in the parser + if ((i != 0) || (binding.getNumArguments() > 1)) { + throw new RuntimeException("Saw illegal \"void\" argument while emitting \"" + getName() + "\""); + } + } else { + Class c = type.getJavaClass(); + if (c != null) { + jniMangle(c, buf, false); + // If Buffer offset arguments were added, we need to mangle the JNI for the + // extra arguments + if (type.isNIOBuffer()) { + jniMangle(Integer.TYPE, buf, false); + } else if (type.isNIOBufferArray()) { + int[] intArrayType = new int[0]; + c = intArrayType.getClass(); + jniMangle(c , buf, true); + } + if (type.isPrimitiveArray()) { + jniMangle(Integer.TYPE, buf, false); + } + } else if (type.isCompoundTypeWrapper()) { + // Mangle wrappers for C structs as ByteBuffer + jniMangle(java.nio.ByteBuffer.class, buf, true); + } else if (type.isJNIEnv()) { + // These are not exposed at the Java level + } else { + // FIXME: add support for char* -> String conversion + throw new RuntimeException("Unknown kind of JavaType: name="+type.getName()); + } + } + } + + return buf.toString(); + } + + protected void jniMangle(Class c, StringBuffer res, boolean syntheticArgument) { + if (c.isPrimitive()) { + if (c == Boolean.TYPE) res.append("Z"); + else if (c == Byte.TYPE) res.append("B"); + else if (c == Character.TYPE) res.append("C"); + else if (c == Short.TYPE) res.append("S"); + else if (c == Integer.TYPE) res.append("I"); + else if (c == Long.TYPE) res.append("J"); + else if (c == Float.TYPE) res.append("F"); + else if (c == Double.TYPE) res.append("D"); + else throw new RuntimeException("Illegal primitive type \"" + c.getName() + "\""); + } else { + // Arrays and NIO Buffers are always passed down as java.lang.Object. + // The only arrays that show up as true arrays in the signature + // are the synthetic byte offset arrays created when passing + // down arrays of direct Buffers. Compound type wrappers are + // passed down as ByteBuffers (no good reason, just to avoid + // accidental conflation) so we mangle them differently. + if (syntheticArgument) { + if (c.isArray()) { + res.append("_3"); + jniMangle(c.getComponentType(), res, false); + } else { + res.append("L"); + res.append(c.getName().replace('.', '_')); + res.append("_2"); + } + } else { + if (c.isArray()) { + res.append("_3"); + jniMangle(c.getComponentType(), res, false); + } else if (c == java.lang.String.class) { + res.append("L"); + res.append(c.getName().replace('.', '_')); + res.append("_2"); + } else { + res.append("L"); + res.append("java_lang_Object"); + res.append("_2"); + } + } + } + } + + private void emitOutOfMemoryCheck(PrintWriter writer, String varName, + String errorMessage) + { + writer.print(" if ("); + writer.print(varName); + writer.println(" == NULL) {"); + writer.println(" (*env)->ThrowNew(env, (*env)->FindClass(env, \"java/lang/OutOfMemoryError\"),"); + writer.print(" \"" + errorMessage); + writer.print(" in native dispatcher for \\\""); + writer.print(getName()); + writer.println("\\\"\");"); + writer.print(" return"); + if (!binding.getJavaReturnType().isVoid()) { + writer.print(" 0"); + } + writer.println(";"); + writer.println(" }"); + } + + private void emitMalloc(PrintWriter writer, + String targetVarName, + String elementTypeString, + String numElementsExpression, + String mallocFailureErrorString) + { + writer.print(" "); + writer.print(targetVarName); + writer.print(" = ("); + writer.print(elementTypeString); + writer.print(" *) malloc("); + writer.print(numElementsExpression); + writer.print(" * sizeof("); + writer.print(elementTypeString); + writer.println("));"); + // Catch memory allocation failure + if (EMIT_NULL_CHECKS) { + emitOutOfMemoryCheck( + writer, targetVarName, + mallocFailureErrorString); + } + } + + private void emitGetStringUTFChars(PrintWriter writer, + String sourceVarName, + String receivingVarName, + boolean emitElseClause) + { + if (EMIT_NULL_CHECKS) { + writer.print(" if ("); + writer.print(sourceVarName); + writer.println(" != NULL) {"); + } + writer.print(" "); + writer.print(receivingVarName); + writer.print(" = (*env)->GetStringUTFChars(env, "); + writer.print(sourceVarName); + writer.println(", (jboolean*)NULL);"); + // Catch memory allocation failure in the event that the VM didn't pin + // the String and failed to allocate a copy + if (EMIT_NULL_CHECKS) { + emitOutOfMemoryCheck( + writer, receivingVarName, + "Failed to get UTF-8 chars for argument \\\""+sourceVarName+"\\\""); + } + if (EMIT_NULL_CHECKS) { + writer.print(" }"); + if (emitElseClause) { + writer.print(" else {"); + writer.print(" "); + writer.print(receivingVarName); + writer.println(" = NULL;"); + writer.println(" }"); + } else { + writer.println(); + } + } + } + + + + private void emitGetDirectBufferAddress(PrintWriter writer, + String sourceVarName, + String receivingVarTypeString, + String receivingVarName, + String byteOffsetVarName, + boolean emitElseClause) { + if (EMIT_NULL_CHECKS) { + writer.print(" if ("); + writer.print(sourceVarName); + writer.println(" != NULL) {"); + writer.print(" "); + } + + writer.print(" "); + writer.print(receivingVarName); + writer.print(" = ("); + writer.print(receivingVarTypeString); + + writer.print(") (((char*) (*env)->GetDirectBufferAddress(env, "); + writer.print(sourceVarName); + writer.println(")) + " + ((byteOffsetVarName != null) ? byteOffsetVarName : "0") + ");"); + + if (EMIT_NULL_CHECKS) { + writer.print(" }"); + if (emitElseClause) { + writer.println(" else {"); + writer.print(" "); + writer.print(receivingVarName); + writer.println(" = NULL;"); + writer.println(" }"); + } else { + writer.println(); + } + } + } + + // Note: if the data in the Type needs to be converted from the Java memory + // model to the C memory model prior to calling any C-side functions, then + // an extra variable named XXX_copy (where XXX is the value of the + // cVariableName argument) will be emitted and TRUE will be returned. + private boolean emitPointerDeclaration(PrintWriter writer, + JavaType javaType, + Type cType, + String cVariableName, + String javaArgumentName) { + String ptrTypeString = null; + boolean needsDataCopy = false; + + // Emit declaration for the pointer variable. + // + // Note that we don't need to obey const/volatile for outgoing arguments + // + if (javaType.isNIOBuffer()) { + ptrTypeString = cType.getName(); + } else if (javaType.isArray()) { + needsDataCopy = javaArgTypeNeedsDataCopy(javaType); + if (javaType.isPrimitiveArray() || + javaType.isNIOBufferArray()) { + ptrTypeString = cType.getName(); + } else if (!javaType.isStringArray()) { + Class elementType = javaType.getJavaClass().getComponentType(); + if (elementType.isArray()) { + Class subElementType = elementType.getComponentType(); + if (subElementType.isPrimitive()) { + // type is pointer to pointer to primitive + ptrTypeString = cType.getName(); + } else { + // type is pointer to pointer of some type we don't support (maybe + // it's an array of pointers to structs?) + throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\""); + } + } else { + // type is pointer to pointer of some type we don't support (maybe + // it's an array of pointers to structs?) + throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\""); + } + } + } else if (javaType.isArrayOfCompoundTypeWrappers()) { + // FIXME + throw new RuntimeException("Outgoing arrays of StructAccessors not yet implemented"); + } else { + ptrTypeString = cType.getName(); + } + + if (!needsDataCopy) { + // declare the pointer variable + writer.print(" "); + writer.print(ptrTypeString); + writer.print(" "); + writer.print(cVariableName); + writer.println(" = NULL;"); + } else { + // Declare a variable to hold a copy of the argument data in which the + // incoming data has been properly laid out in memory to match the C + // memory model + Class elementType = javaType.getJavaClass().getComponentType(); + if (javaType.isStringArray()) { + writer.print(" const char **"); + } else { + writer.print(" " + ptrTypeString); + } + writer.print(" "); + writer.print(cVariableName); + writer.print("_copy = NULL; /* copy of data in "); + writer.print(javaArgumentName); + writer.println(", laid out according to C memory model */"); + } + + return needsDataCopy; + } + + private void emitPointerConversion(PrintWriter writer, + MethodBinding binding, + JavaType type, + Type cType, + String incomingArgumentName, + String cVariableName, + String byteOffsetVarName) { + // Compound type wrappers do not get byte offsets added on + if (type.isCompoundTypeWrapper()) { + byteOffsetVarName = null; + } + + emitGetDirectBufferAddress(writer, + incomingArgumentName, + cType.getName(), + cVariableName, + byteOffsetVarName, + false); + } + + protected String byteOffsetArgName(int i) { + return byteOffsetArgName(binding.getArgumentName(i)); + } + + protected String byteOffsetArgName(String s) { + return s + "_byte_offset"; + } + + protected String byteOffsetArrayArgName(int i) { + return binding.getArgumentName(i) + "_byte_offset_array"; + } + + protected String pointerConversionArgumentName(int i) { + return "_ptr" + i; + } + + /** + * Class that emits a generic comment for CMethodBindingEmitters; the comment + * includes the C signature of the native method that is being bound by the + * emitter java method. + */ + protected static class DefaultCommentEmitter implements CommentEmitter { + public void emit(FunctionEmitter emitter, PrintWriter writer) { + emitBeginning((CMethodBindingEmitter)emitter, writer); + emitEnding((CMethodBindingEmitter)emitter, writer); + } + protected void emitBeginning(CMethodBindingEmitter emitter, PrintWriter writer) { + writer.println(" Java->C glue code:"); + writer.print(" * Java package: "); + writer.print(emitter.getJavaPackageName()); + writer.print("."); + writer.println(emitter.getJavaClassName()); + writer.print(" * Java method: "); + MethodBinding binding = emitter.getBinding(); + writer.println(binding); + writer.println(" * C function: " + binding.getCSymbol()); + } + protected void emitEnding(CMethodBindingEmitter emitter, PrintWriter writer) { + } + } + + protected boolean javaArgTypeNeedsDataCopy(JavaType javaArgType) { + if (javaArgType.isArray()) { + return (javaArgType.isNIOBufferArray() || + javaArgType.isStringArray() || + javaArgType.getJavaClass().getComponentType().isArray()); + } + return false; + } +} diff --git a/src/classes/com/sun/gluegen/CodeGenUtils.java b/src/classes/com/sun/gluegen/CodeGenUtils.java new file mode 100644 index 000000000..553ef26b3 --- /dev/null +++ b/src/classes/com/sun/gluegen/CodeGenUtils.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.io.*; +import java.util.*; + +public class CodeGenUtils +{ + /** + * Given a java package name (e.g., "java.lang"), return the package as a + * directory path (i.e., "java/lang"). + */ + public static String packageAsPath(String packageName) { + String path = packageName.replace('.', File.separatorChar); + //System.out.println("Converted package [" + packageName + "] to path [" + path +"]"); + return path; + } + + /** + * @param generator the object that is emitting the autogenerated code. If + * null, the generator will not be mentioned in the warning message. + */ + public static void emitAutogeneratedWarning(PrintWriter w, Object generator) { + w.print("/* !---- DO NOT EDIT: This file autogenerated "); + if (generator != null) + { + w.print("by "); + w.print(packageAsPath(generator.getClass().getName())); + w.print(".java "); + } + w.print("on "); + w.print((new Date()).toString()); + w.println(" ----! */"); + w.println(); + } + + /** + * Emit the opening headers for one java class/interface file. + */ + public static void emitJavaHeaders( + PrintWriter w, + String packageName, + String className, + boolean isClassNotInterface, + String[] imports, + String[] accessModifiers, + String[] interfaces, + String classExtended, + EmissionCallback classDocComment) throws IOException + { + w.println("package " + packageName + ";"); + w.println(); + + for (int i = 0; imports != null && i < imports.length; ++i) { + w.print("import "); + w.print(imports[i]); + w.println(';'); + } + w.println("import com.sun.gluegen.runtime.*;"); + + w.println(); + + if (classDocComment != null) + { + classDocComment.emit(w); + } + + for (int i = 0; accessModifiers != null && i < accessModifiers.length; ++i) { + w.print(accessModifiers[i]); + w.print(' '); + } + + if (isClassNotInterface) { + w.print("class "); + w.print(className); + w.print(' '); + if (classExtended != null) { + w.print("extends "); + w.print(classExtended); + } + } + else { + if (classExtended != null) { + throw new IllegalArgumentException( + "Autogenerated interface class " + className + + " cannot extend class " + classExtended); + } + w.print("interface "); + w.print(className); + w.print(' '); + } + + for (int i = 0; interfaces != null && i < interfaces.length; ++i) { + if (i == 0) { w.print(isClassNotInterface ? "implements " : "extends "); } + w.print(interfaces[i]); + if (i < interfaces.length-1) { w.print(", "); } + } + + w.println(); + w.println('{'); + } + + //----------------------------------------- + + /** A class that emits source code of some time when activated. */ + public interface EmissionCallback + { + /** Emit appropriate source code through the given writer. */ + public void emit(PrintWriter output); + } +} diff --git a/src/classes/com/sun/gluegen/CommentEmitter.java b/src/classes/com/sun/gluegen/CommentEmitter.java new file mode 100644 index 000000000..30004f8bc --- /dev/null +++ b/src/classes/com/sun/gluegen/CommentEmitter.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.io.*; + +public interface CommentEmitter +{ + /** + * Emit the body of a comment for the specified function; do NOT emit the + * open (e.g., comment "/*") or close (e.g., "*\/") characters. + */ + public void emit(FunctionEmitter funcEmitter, PrintWriter output); +} + diff --git a/src/classes/com/sun/gluegen/DebugEmitter.java b/src/classes/com/sun/gluegen/DebugEmitter.java new file mode 100644 index 000000000..bbcde0e0d --- /dev/null +++ b/src/classes/com/sun/gluegen/DebugEmitter.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.util.*; + +import com.sun.gluegen.cgram.types.*; + +/** Debug emitter which prints the parsing results to standard output. */ + +public class DebugEmitter implements GlueEmitter { + public void readConfigurationFile(String filename) {} + + public void setMachineDescription(MachineDescription md) {} + + public void beginEmission(GlueEmitterControls controls) { + System.out.println("----- BEGIN EMISSION OF GLUE CODE -----"); + } + public void endEmission() { + System.out.println("----- END EMISSION OF GLUE CODE -----"); + } + public void beginDefines() {} + public void emitDefine(String name, String value, String optionalComment) { + System.out.println("#define " + name + " " + value + + (optionalComment != null ? ("// " + optionalComment) : "")); + } + public void endDefines() {} + + public void beginFunctions(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) { + Set keys = typedefDictionary.keySet(); + for (Iterator iter = keys.iterator(); iter.hasNext(); ) { + String key = (String) iter.next(); + Type value = typedefDictionary.get(key); + System.out.println("typedef " + value + " " + key + ";"); + } + } + public Iterator emitFunctions(List/**/ originalCFunctions) + throws Exception { + for (Iterator iter = originalCFunctions.iterator(); iter.hasNext(); ) { + FunctionSymbol sym = (FunctionSymbol) iter.next(); + emitSingleFunction(sym); + } + return originalCFunctions.iterator(); + } + public void emitSingleFunction(FunctionSymbol sym) { + System.out.println(sym); + System.out.println(" -> " + sym.toString()); + } + public void endFunctions() {} + + public void beginStructLayout() throws Exception {} + public void layoutStruct(CompoundType t) throws Exception {} + public void endStructLayout() throws Exception {} + + public void beginStructs(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) { + } + public void emitStruct(CompoundType t, String alternateName) { + String name = t.getName(); + if (name == null && alternateName != null) { + name = alternateName; + } + + System.out.println("Referenced type \"" + name + "\""); + } + public void endStructs() {} +} diff --git a/src/classes/com/sun/gluegen/FunctionEmitter.java b/src/classes/com/sun/gluegen/FunctionEmitter.java new file mode 100644 index 000000000..baf08b93a --- /dev/null +++ b/src/classes/com/sun/gluegen/FunctionEmitter.java @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.util.*; +import java.io.*; + +public abstract class FunctionEmitter +{ + public static final EmissionModifier STATIC = new EmissionModifier("static"); + + private HashSet modifiers = new HashSet(4); + private CommentEmitter commentEmitter = null; + private PrintWriter defaultOutput; + + /** + * Constructs the FunctionEmitter with a CommentEmitter that emits nothing. + */ + public FunctionEmitter(PrintWriter defaultOutput) + { + assert(defaultOutput != null); + this.defaultOutput = defaultOutput; + } + + /** + * Makes this FunctionEmitter a copy of the passed one. + */ + public FunctionEmitter(FunctionEmitter arg) { + modifiers = (HashSet) arg.modifiers.clone(); + commentEmitter = arg.commentEmitter; + defaultOutput = arg.defaultOutput; + } + + public PrintWriter getDefaultOutput() { return defaultOutput; } + + public void addModifiers(Iterator/**/ mi) + { + while (mi.hasNext()) + { + modifiers.add((EmissionModifier) mi.next()); + } + } + public void addModifier(EmissionModifier m) { modifiers.add(m); } + + public boolean removeModifier(EmissionModifier m) { return modifiers.remove(m); } + + public void clearModifiers() { modifiers.clear(); } + + public boolean hasModifier(EmissionModifier m) { return modifiers.contains(m); } + + public Iterator getModifiers() { return modifiers.iterator(); } + + public abstract String getName(); + + /** + * Emit the function to the specified output (instead of the default + * output). + */ + public void emit(PrintWriter output) + { + emitDocComment(output); + //output.println(" // Emitter: " + getClass().getName()); + emitSignature(output); + emitBody(output); + } + + /** + * Emit the function to the default output (the output that was passed to + * the constructor) + */ + public final void emit() + { + emit(getDefaultOutput()); + } + + /** Returns, as a String, whatever {@link #emit} would output. */ + public String toString() + { + StringWriter sw = new StringWriter(500); + PrintWriter w = new PrintWriter(sw); + emit(w); + return sw.toString(); + } + + /** + * Set the object that will emit the comment for this function. If the + * parameter is null, no comment will be emitted. + */ + public void setCommentEmitter(CommentEmitter cEmitter) + { + commentEmitter = cEmitter; + } + + /** + * Get the comment emitter for this FunctionEmitter. The return value may be + * null, in which case no comment emitter has been set. + */ + public CommentEmitter getCommentEmitter() { return commentEmitter; } + + protected void emitDocComment(PrintWriter writer) + { + if (commentEmitter != null) + { + writer.print(getBaseIndentString()); //indent + + writer.print(getCommentStartString()); + + commentEmitter.emit(this, writer); + + writer.print(getBaseIndentString()); //indent + + writer.println(getCommentEndString()); + } + } + + protected void emitSignature(PrintWriter writer) + { + writer.print(getBaseIndentString()); // indent method + + int numEmitted = emitModifiers(writer); + if (numEmitted > 0) + { + writer.print(" "); + } + + emitReturnType(writer); + writer.print(" "); + + emitName(writer); + writer.print("("); + + emitArguments(writer); + writer.print(")"); + } + + protected int emitModifiers(PrintWriter writer) + { + PrintWriter w = getDefaultOutput(); + int numEmitted = 0; + for (Iterator it = getModifiers(); it.hasNext(); ) + { + writer.print(it.next()); + ++numEmitted; + if (it.hasNext()) + { + writer.print(" "); + } + } + return numEmitted; + } + + protected String getBaseIndentString() { return ""; } + + protected String getCommentStartString() { return "/* "; } + protected String getCommentEndString() { return " */"; } + + protected abstract void emitReturnType(PrintWriter writer); + protected abstract void emitName(PrintWriter writer); + /** Returns the number of arguments emitted. */ + protected abstract int emitArguments(PrintWriter writer); + protected abstract void emitBody(PrintWriter writer); + + public static class EmissionModifier + { + public final String toString() { return emittedForm; } + + private String emittedForm; + protected EmissionModifier(String emittedForm) { this.emittedForm = emittedForm; } + } +} + diff --git a/src/classes/com/sun/gluegen/GlueEmitter.java b/src/classes/com/sun/gluegen/GlueEmitter.java new file mode 100644 index 000000000..d6f5fede8 --- /dev/null +++ b/src/classes/com/sun/gluegen/GlueEmitter.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.util.*; +import com.sun.gluegen.cgram.types.*; + +/** Specifies the interface by which GlueGen requests glue code to be + generated. Can be replaced to generate glue code for other + languages and foreign function interfaces. */ + +public interface GlueEmitter { + + public void readConfigurationFile(String filename) throws Exception; + + /** Set the description of the underlying hardware. */ + public void setMachineDescription(MachineDescription md); + + /** + * Begin the emission of glue code. This might include opening files, + * emitting class headers, etc. + */ + public void beginEmission(GlueEmitterControls controls) throws Exception; + + /** + * Finish the emission of glue code. This might include closing files, + * closing open class definitions, etc. + */ + public void endEmission() throws Exception; + + public void beginDefines() throws Exception; + /** + * @param optionalComment If optionalComment is non-null, the emitter can + * emit that string as a comment providing extra information about the + * define. + */ + public void emitDefine(String name, String value, String optionalComment) throws Exception; + public void endDefines() throws Exception; + + public void beginFunctions(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) throws Exception; + + /** Emit glue code for the list of FunctionSymbols. */ + public Iterator emitFunctions(java.util.List/**/ cFunctions) throws Exception; + public void endFunctions() throws Exception; + + /** Begins the process of computing field offsets and type sizes for + the structs to be emitted. */ + public void beginStructLayout() throws Exception; + /** Lays out one struct which will be emitted later. */ + public void layoutStruct(CompoundType t) throws Exception; + /** Finishes the struct layout process. */ + public void endStructLayout() throws Exception; + + public void beginStructs(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) throws Exception; + /** Emit glue code for the given CompoundType. alternateName is + provided when the CompoundType (e.g. "struct foo_t") has not + been typedefed to anything but the type of "pointer to struct + foo_t" has (e.g. "typedef struct foo_t {} *Foo"); in this case + alternateName would be set to Foo. */ + public void emitStruct(CompoundType t, String alternateName) throws Exception; + public void endStructs() throws Exception; +} diff --git a/src/classes/com/sun/gluegen/GlueEmitterControls.java b/src/classes/com/sun/gluegen/GlueEmitterControls.java new file mode 100644 index 000000000..46ff9fd91 --- /dev/null +++ b/src/classes/com/sun/gluegen/GlueEmitterControls.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +/** Specifies the interface by which a GlueEmitter can request + additional information from the glue generator. */ + +public interface GlueEmitterControls { + /** Requests emission of an accessor for a struct that will not be + referenced by any functions or other structs. */ + public void forceStructEmission(String typedefName); + + /** Finds the full path name of the specified header file based on + the include directories specified on the command line. */ + public String findHeaderFile(String headerFileName); +} diff --git a/src/classes/com/sun/gluegen/GlueGen.java b/src/classes/com/sun/gluegen/GlueGen.java new file mode 100644 index 000000000..c192ae8cd --- /dev/null +++ b/src/classes/com/sun/gluegen/GlueGen.java @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.io.*; +import java.util.*; + +import antlr.*; +import antlr.collections.*; +import com.sun.gluegen.cgram.*; +import com.sun.gluegen.cgram.types.*; +import com.sun.gluegen.pcpp.*; + +/** Glue code generator for C functions and data structures. */ + +public class GlueGen implements GlueEmitterControls { + private java.util.List forcedStructNames = new ArrayList(); + private PCPP preprocessor; + + public void forceStructEmission(String typedefName) { + forcedStructNames.add(typedefName); + } + + public String findHeaderFile(String headerFileName) { + return preprocessor.findFile(headerFileName); + } + + public void run(String[] args) { + try { + Reader reader = null; + String filename = null; + String emitterClass = null; + java.util.List cfgFiles = new ArrayList(); + + if (args.length == 0) { + usage(); + } + + java.util.List includePaths = new ArrayList(); + for (int i = 0; i < args.length; i++) { + if (i < args.length - 1) { + String arg = args[i]; + if (arg.startsWith("-I")) { + String[] paths = arg.substring(2).split(System.getProperty("path.separator")); + for (int j = 0; j < paths.length; j++) { + includePaths.add(paths[j]); + } + } else if (arg.startsWith("-E")) { + emitterClass = arg.substring(2); + } else if (arg.startsWith("-C")) { + cfgFiles.add(arg.substring(2)); + } else { + usage(); + } + } else { + String arg = args[i]; + if (arg.equals("-")) { + reader = new InputStreamReader(System.in); + filename = "standard input"; + } else { + if (arg.startsWith("-")) { + usage(); + } + filename = arg; + reader = new BufferedReader(new FileReader(filename)); + } + } + } + + preprocessor = new PCPP(includePaths); + PipedInputStream ppIn = new PipedInputStream(); + final PipedOutputStream ppOut = new PipedOutputStream(ppIn); + preprocessor.setOut(ppOut); + final Reader rdr = reader; + final String fn = filename; + new Thread(new Runnable() { + public void run() { + try { + preprocessor.run(rdr, fn); + ppOut.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + }).start(); + + DataInputStream dis = new DataInputStream(ppIn); + GnuCLexer lexer = new GnuCLexer(dis); + lexer.setTokenObjectClass(CToken.class.getName()); + lexer.initialize(); + // Parse the input expression. + GnuCParser parser = new GnuCParser(lexer); + + // set AST node type to TNode or get nasty cast class errors + parser.setASTNodeType(TNode.class.getName()); + TNode.setTokenVocabulary(GNUCTokenTypes.class.getName()); + + // invoke parser + try { + parser.translationUnit(); + } + catch (RecognitionException e) { + System.err.println("Fatal IO error:\n"+e); + System.exit(1); + } + catch (TokenStreamException e) { + System.err.println("Fatal IO error:\n"+e); + System.exit(1); + } + + HeaderParser headerParser = new HeaderParser(); + MachineDescription machDesc; + String os = System.getProperty("os.name").toLowerCase(); + String cpu = System.getProperty("os.arch").toLowerCase(); + if ((os.startsWith("linux") && cpu.equals("amd64")) || + (os.startsWith("linux") && cpu.equals("ia64"))) { + machDesc = new MachineDescription64Bit(); + } else { + machDesc = new MachineDescription32Bit(); + } + headerParser.setMachineDescription(machDesc); + TypeDictionary td = new TypeDictionary(); + headerParser.setTypedefDictionary(td); + TypeDictionary sd = new TypeDictionary(); + headerParser.setStructDictionary(sd); + // set AST node type to TNode or get nasty cast class errors + headerParser.setASTNodeType(TNode.class.getName()); + // walk that tree + headerParser.translationUnit( parser.getAST() ); + + // For debugging: Dump type dictionary and struct dictionary to System.err + //td.dumpDictionary(System.err, "All Types"); + //sd.dumpDictionary(System.err, "All Structs"); + + // At this point we have all of the pieces we need in order to + // generate glue code: the #defines to constants, the set of + // typedefs, and the set of functions. + + GlueEmitter emit = null; + if (emitterClass == null) { + emit = new JavaEmitter(); + } else { + try { + emit = (GlueEmitter) Class.forName(emitterClass).newInstance(); + } catch (Exception e) { + System.err.println("Exception occurred while instantiating emitter class. Exiting."); + e.printStackTrace(); + System.exit(1); + } + } + + for (Iterator iter = cfgFiles.iterator(); iter.hasNext(); ) { + emit.readConfigurationFile((String) iter.next()); + } + + // provide MachineDescription to emitter if it needs it + emit.setMachineDescription(machDesc); + + // begin emission of glue code + emit.beginEmission(this); + + emit.beginDefines(); + Set emittedDefines = new HashSet(100); + // emit java equivalent of enum { ... } statements + for (Iterator iter = headerParser.getEnums().iterator(); iter.hasNext(); ) { + EnumType enumeration = (EnumType)iter.next(); + // iterate over all values in the enumeration + for (int i = 0; i < enumeration.getNumEnumerates(); ++i) { + String enumElementName = enumeration.getEnumName(i); + if (emittedDefines.contains(enumElementName) == false) { + emittedDefines.add(enumElementName); + String comment = null; + if (! enumeration.getName().equals("")) { + comment = "Defined as part of enum type \"" + + enumeration.getName() + "\""; + } + emit.emitDefine( + enumElementName, + String.valueOf(enumeration.getEnumValue(i)), + comment); + } + } + } + // emit java equivalent of #define statements + for (Iterator iter = lexer.getDefines().iterator(); iter.hasNext(); ) { + Define def = (Define) iter.next(); + if (emittedDefines.contains(def.getName()) == false) { + emittedDefines.add(def.getName()); + emit.emitDefine(def.getName(), def.getValue(), null); + } + } + emit.endDefines(); + + java.util.List functions = headerParser.getParsedFunctions(); + + // Iterate through the functions finding structs that are referenced in + // the function signatures; these will be remembered for later emission + ReferencedStructs referencedStructs = new ReferencedStructs(); + for (Iterator iter = functions.iterator(); iter.hasNext(); ) { + FunctionSymbol sym = (FunctionSymbol) iter.next(); + // FIXME: this doesn't take into account the possibility that some of + // the functions we send to emitMethodBindings() might not actually be + // emitted (e.g., if an Ignore directive in the JavaEmitter causes it + // to be skipped). + sym.getType().visit(referencedStructs); + } + + // Normally only referenced types will be emitted. The user can force a + // type to be emitted via a .cfg file directive. Those directives are + // processed here. + for (Iterator iter = forcedStructNames.iterator(); iter.hasNext(); ) { + String name = (String) iter.next(); + Type type = td.get(name); + if (type == null) { + System.err.println("WARNING: during forced struct emission: struct \"" + name + "\" not found"); + } else if (!type.isCompound()) { + System.err.println("WARNING: during forced struct emission: type \"" + name + "\" was not a struct"); + } else { + type.visit(referencedStructs); + } + } + + // Lay out structs + emit.beginStructLayout(); + for (Iterator iter = referencedStructs.results(); iter.hasNext(); ) { + Type t = (Type) iter.next(); + if (t.isCompound()) { + emit.layoutStruct(t.asCompound()); + } else if (t.isPointer()) { + PointerType p = t.asPointer(); + CompoundType c = p.getTargetType().asCompound(); + emit.layoutStruct(c); + } + } + emit.endStructLayout(); + + // Emit structs + emit.beginStructs(td, sd, headerParser.getCanonMap()); + for (Iterator iter = referencedStructs.results(); iter.hasNext(); ) { + Type t = (Type) iter.next(); + if (t.isCompound()) { + emit.emitStruct(t.asCompound(), null); + } else if (t.isPointer()) { + PointerType p = t.asPointer(); + CompoundType c = p.getTargetType().asCompound(); + assert p.hasTypedefedName() && c.getName() == null : "ReferencedStructs incorrectly recorded pointer type " + p; + emit.emitStruct(c, p.getName()); + } + } + emit.endStructs(); + + // emit java and C code to interface with the native functions + emit.beginFunctions(td, sd, headerParser.getCanonMap()); + emit.emitFunctions(functions); + emit.endFunctions(); + + // end emission of glue code + emit.endEmission(); + + } catch ( Exception e ) { + e.printStackTrace(); + System.err.println("Exception occurred while generating glue code. Exiting."); + System.exit(1); + } + } + + public static void main(String[] args) { + new GlueGen().run(args); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private static void usage() { + System.out.println("Usage: java GlueGen [-I...] [-Eemitter_class_name] [-Ccfg_file_name...] "); + System.out.println(); + System.out.println("Runs C header parser on input file or standard input, first"); + System.out.println("passing input through minimal pseudo-C-preprocessor. Use -I"); + System.out.println("command-line arguments to specify the search path for #includes."); + System.out.println("Emitter class name can be specified with -E option: i.e.,"); + System.out.println("-Ecom.sun.gluegen.JavaEmitter (the default). Use"); + System.out.println("-Ecom.sun.gluegen.DebugEmitter to print recognized entities"); + System.out.println("(#define directives to constant numbers, typedefs, and function"); + System.out.println("declarations) to standard output. Emitter-specific configuration"); + System.out.println("file or files can be specified with -C option; e.g,"); + System.out.println("-Cjava-emitter.cfg."); + System.exit(1); + } +} diff --git a/src/classes/com/sun/gluegen/JavaConfiguration.java b/src/classes/com/sun/gluegen/JavaConfiguration.java new file mode 100644 index 000000000..a48582a3f --- /dev/null +++ b/src/classes/com/sun/gluegen/JavaConfiguration.java @@ -0,0 +1,1232 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.io.*; +import java.util.*; +import java.util.regex.*; + +import com.sun.gluegen.cgram.types.*; + +/** Parses and provides access to the contents of .cfg files for the + JavaEmitter. */ + +public class JavaConfiguration { + + private int nestedReads; + private String packageName; + private String implPackageName; + private String className; + private String implClassName; + /** + * Root directory for the hierarchy of generated java classes. Default is + * working directory. + */ + private String javaOutputDir = "."; + /** + * Directory into which generated native JNI code will be written. Default + * is current working directory. + */ + private String nativeOutputDir = "."; + /** + * If true, then each native *.c and *.h file will be generated in the + * directory nativeOutputDir/packageAsPath(packageName). Default is false. + */ + private boolean nativeOutputUsesJavaHierarchy; + /** + * Style of code emission. Can emit everything into one class + * (AllStatic), separate interface and implementing classes + * (InterfaceAndImpl), only the interface (InterfaceOnly), or only + * the implementation (ImplOnly). + */ + private int emissionStyle = JavaEmitter.ALL_STATIC; + /** + * List of imports to emit at the head of the output files. + */ + private List/**/ imports = new ArrayList(); + /** + * The kind of exception raised by the generated code if run-time + * checks fail. Defaults to RuntimeException. + */ + private String runtimeExceptionType = "RuntimeException"; + private Map/**/ accessControl = new HashMap(); + private Map/**/ typeInfoMap = new HashMap(); + private Set/**/ returnsString = new HashSet(); + private Map/**/ returnedArrayLengths = new HashMap(); + /** + * Key is function that has some byte[] arguments that should be + * converted to String args; value is List of Integer argument indices + */ + private Map/*>*/ argumentsAreString = new HashMap(); + private Set/**/ ignores = new HashSet(); + private Map/**/ ignoreMap = new HashMap(); + private Set/**/ ignoreNots = new HashSet(); + private Set/**/ unimplemented = new HashSet(); + private Set/**/ nioDirectOnly = new HashSet(); + private Set/**/ manuallyImplement = new HashSet(); + private Map/*>*/ customJavaCode = new HashMap(); + private Map/*>*/ classJavadoc = new HashMap(); + private Map/**/ structPackages = new HashMap(); + private List/**/ customCCode = new ArrayList(); + private List/**/ forcedStructs = new ArrayList(); + private Map/**/ returnValueCapacities = new HashMap(); + private Map/**/ returnValueLengths = new HashMap(); + private Map/*>*/ temporaryCVariableDeclarations = new HashMap(); + private Map/*>*/ temporaryCVariableAssignments = new HashMap(); + private Map/*>*/ extendedInterfaces = new HashMap(); + private Map/*>*/ implementedInterfaces = new HashMap(); + private Map/**/ javaTypeRenames = new HashMap(); + private Map/**/ javaMethodRenames = new HashMap(); + private Map/*>*/ javaPrologues = new HashMap(); + private Map/*>*/ javaEpilogues = new HashMap(); + + /** Reads the configuration file. + @param filename path to file that should be read + */ + public final void read(String filename) throws IOException { + read(filename, null); + } + + /** Reads the specified file, treating each line as if it started with the + specified string. + @param filename path to file that should be read + @param linePrefix if not null, treat each line read as if it were + prefixed with the specified string. + */ + protected final void read(String filename, String linePrefix) throws IOException { + File file = new File(filename); + BufferedReader reader = null; + try { + reader = new BufferedReader(new FileReader(file)); + } + catch (FileNotFoundException fnfe) { + throw new RuntimeException("Could not read file \"" + file + "\"", fnfe); + } + int lineNo = 0; + String line = null; + boolean hasPrefix = linePrefix != null && linePrefix.length() > 0; + try { + ++nestedReads; + while ((line = reader.readLine()) != null) { + ++lineNo; + if (hasPrefix) + { + line = linePrefix + " " + line; + } + + if (line.trim().startsWith("#")) + { + // comment line + continue; + } + + StringTokenizer tok = new StringTokenizer(line); + if (tok.hasMoreTokens()) + { + // always reset delimiters in case of CustomJavaCode, etc. + String cmd = tok.nextToken(" \t\n\r\f"); + + dispatch(cmd, tok, file, filename, lineNo); + } + } + reader.close(); + } finally { + --nestedReads; + } + + if (nestedReads == 0) { + if (allStatic() && implClassName != null) { + throw new IllegalStateException( + "Error in configuration file \"" + filename + "\": Cannot use " + + "directive \"ImplJavaClass\" in conjunction with " + + "\"Style AllStatic\""); + } + + if (className == null && (emissionStyle() != JavaEmitter.IMPL_ONLY)) { + throw new RuntimeException("Output class name was not specified in configuration file"); + } + if (packageName == null && (emissionStyle() != JavaEmitter.IMPL_ONLY)) { + throw new RuntimeException("Output package name was not specified in configuration file"); + } + + if (allStatic()) { + implClassName = className; + // If we're using the "Style AllStatic" directive, then the + // implPackageName is the same as the regular package name + implPackageName = packageName; + } else { + if (implClassName == null) { + // implClassName defaults to "Impl" if ImplJavaClass + // directive is not used + if (className == null) { + throw new RuntimeException("If ImplJavaClass is not specified, must specify JavaClass"); + } + implClassName = className + "Impl"; + } + if (implPackageName == null) { + // implPackageName defaults to ".impl" if ImplPackage + // directive is not used + if (packageName == null) { + throw new RuntimeException("If ImplPackageName is not specified, must specify PackageName"); + } + implPackageName = packageName + ".impl"; + } + } + } + } + + /** Returns the package name parsed from the configuration file. */ + public String packageName() { return packageName; } + /** Returns the implementation package name parsed from the configuration file. */ + public String implPackageName() { return implPackageName; } + /** Returns the class name parsed from the configuration file. */ + public String className() { return className; } + /** Returns the implementation class name parsed from the configuration file. */ + public String implClassName() { return implClassName; } + /** Returns the Java code output directory parsed from the configuration file. */ + public String javaOutputDir() { return javaOutputDir; } + /** Returns the native code output directory parsed from the configuration file. */ + public String nativeOutputDir() { return nativeOutputDir; } + /** Returns whether the native code directory structure mirrors the Java hierarchy. */ + public boolean nativeOutputUsesJavaHierarchy() { return nativeOutputUsesJavaHierarchy; } + /** Returns the code emission style (constants in JavaEmitter) parsed from the configuration file. */ + public int emissionStyle() { return emissionStyle; } + /** Returns the access control for the emitted Java method. Returns one of JavaEmitter.ACC_PUBLIC, JavaEmitter.ACC_PROTECTED, JavaEmitter.ACC_PRIVATE, or JavaEmitter.ACC_PACKAGE_PRIVATE. */ + public int accessControl(String methodName) { + Integer ret = (Integer) accessControl.get(methodName); + if (ret != null) { + return ret.intValue(); + } + // Default access control is public + return JavaEmitter.ACC_PUBLIC; + } + + /** Returns the kind of exception to raise if run-time checks fail in the generated code. */ + public String runtimeExceptionType() { return runtimeExceptionType; } + /** Returns the list of imports that should be emitted at the top of each .java file. */ + public List/**/ imports() { return imports; } + + /** If this type should be considered opaque, returns the TypeInfo + describing the replacement type. Returns null if this type + should not be considered opaque. */ + public TypeInfo typeInfo(Type type, TypeDictionary typedefDictionary) { + // Because typedefs of pointer types can show up at any point, + // walk the pointer chain looking for a typedef name that is in + // the TypeInfo map. + int pointerDepth = type.pointerDepth(); + for (int i = 0; i <= pointerDepth; i++) { + String name = type.getName(); + if (name != null) { + TypeInfo info = (TypeInfo) typeInfoMap.get(name); + while (info != null) { + if (info.name().equals(name) && info.pointerDepth() == i) { + return info; + } + info = info.next(); + } + } + + if (type.isCompound()) { + // Try struct name as well + name = type.asCompound().getStructName(); + if (name != null) { + TypeInfo info = (TypeInfo) typeInfoMap.get(name); + while (info != null) { + if (info.name().equals(name) && info.pointerDepth() == i) { + return info; + } + info = info.next(); + } + } + } + + // Try all typedef names that map to this type + Set entrySet = typedefDictionary.entrySet(); + for (Iterator iter = entrySet.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Map.Entry) iter.next(); + // "eq" equality is OK to use here since all types have been canonicalized + if (entry.getValue() == type) { + name = (String) entry.getKey(); + TypeInfo info = (TypeInfo) typeInfoMap.get(name); + while (info != null) { + if (info.name().equals(name) && info.pointerDepth() == i) { + return info; + } + info = info.next(); + } + } + } + + if (type.isPointer()) { + type = type.asPointer().getTargetType(); + } + } + + return null; + } + + /** Indicates whether the given function (which returns a + char* in C) should be translated as returning a + java.lang.String. */ + public boolean returnsString(String functionName) { + return returnsString.contains(functionName); + } + + /** Provides a Java MessageFormat expression indicating the number + of elements in the returned array from the specified function + name. Indicates that the given return value, which must be a + pointer to a CompoundType, is actually an array of the + CompoundType rather than a pointer to a single object. */ + public String returnedArrayLength(String functionName) { + return (String) returnedArrayLengths.get(functionName); + } + + /** Returns a list of Integers which are the indices of const char* + arguments that should be converted to Strings. Returns null if there are no + such hints for the given function name. */ + + public List/**/ stringArguments(String functionName) { + return (List) argumentsAreString.get(functionName); + } + + /** Returns true if the given function should only create a java.nio + variant, and no array variants, for void* and other + C primitive pointers. */ + public boolean nioDirectOnly(String functionName) { + return nioDirectOnly.contains(functionName); + } + + /** Returns true if the glue code for the given function will be + manually implemented by the end user. */ + public boolean manuallyImplement(String functionName) { + return manuallyImplement.contains(functionName); + } + + /** Returns a list of Strings containing user-implemented code for + the given Java type name (not fully-qualified, only the class + name); returns either null or an empty list if there is no + custom code for the class. */ + public List customJavaCodeForClass(String className) { + List res = (List) customJavaCode.get(className); + if (res == null) { + res = new ArrayList(); + customJavaCode.put(className, res); + } + return res; + } + + /** Returns a list of Strings containing Javadoc documentation for + the given Java type name (not fully-qualified, only the class + name); returns either null or an empty list if there is no + Javadoc documentation for the class. */ + public List javadocForClass(String className) { + List res = (List) classJavadoc.get(className); + if (res == null) { + res = new ArrayList(); + classJavadoc.put(className, res); + } + return res; + } + + /** Returns the package into which to place the glue code for + accessing the specified struct. Defaults to emitting into the + regular package (i.e., the result of {@link #packageName}). */ + public String packageForStruct(String structName) { + String res = (String) structPackages.get(structName); + if (res == null) { + res = packageName; + } + return res; + } + + /** Returns, as a List of Strings, the custom C code to be emitted + along with the glue code for the main class. */ + public List/**/ customCCode() { + return customCCode; + } + + /** Returns, as a List of Strings, the structs for which glue code + emission should be forced. */ + public List/**/ forcedStructs() { + return forcedStructs; + } + + /** Returns a MessageFormat string of the C expression calculating + the capacity of the java.nio.ByteBuffer being returned from a + native method, or null if no expression has been specified. */ + public String returnValueCapacity(String functionName) { + return (String) returnValueCapacities.get(functionName); + } + + /** Returns a MessageFormat string of the C expression calculating + the length of the array being returned from a native method, or + null if no expression has been specified. */ + public String returnValueLength(String functionName) { + return (String) returnValueLengths.get(functionName); + } + + /** Returns a List of Strings of expressions declaring temporary C + variables in the glue code for the specified function. */ + public List/**/ temporaryCVariableDeclarations(String functionName) { + return (List) temporaryCVariableDeclarations.get(functionName); + } + + /** Returns a List of Strings of expressions containing assignments + to temporary C variables in the glue code for the specified + function. */ + public List/**/ temporaryCVariableAssignments(String functionName) { + return (List) temporaryCVariableAssignments.get(functionName); + } + + /** Returns a List of Strings indicating the interfaces the passed + interface should declare it extends. May return null or a list + of zero length if there are none. */ + public List/**/ extendedInterfaces(String interfaceName) { + List res = (List) extendedInterfaces.get(interfaceName); + if (res == null) { + res = new ArrayList(); + extendedInterfaces.put(interfaceName, res); + } + return res; + } + + /** Returns a List of Strings indicating the interfaces the passed + class should declare it implements. May return null or a list + of zero length if there are none. */ + public List/**/ implementedInterfaces(String className) { + List res = (List) implementedInterfaces.get(className); + if (res == null) { + res = new ArrayList(); + implementedInterfaces.put(className, res); + } + return res; + } + + /** Returns true if this #define, function, struct, or field within + a struct should be ignored during glue code generation. */ + public boolean shouldIgnore(String symbol) { + + //System.err.println("CHECKING IGNORE: " + symbol); + + // Simple case; the entire symbol is in the ignore table. + if (ignores.contains(symbol)) { + return true; + } + + // Ok, the slow case. We need to check the entire table, in case the table + // contains an regular expression that matches the symbol. + for (Iterator iter = ignores.iterator(); iter.hasNext(); ) { + Pattern regexp = (Pattern)iter.next(); + Matcher matcher = regexp.matcher(symbol); + if (matcher.matches()) { + return true; + } + } + + // Check negated ignore table if not empty + if (ignoreNots.size() > 0) { + // Ok, the slow case. We need to check the entire table, in case the table + // contains an regular expression that matches the symbol. + for (Iterator iter = ignoreNots.iterator(); iter.hasNext(); ) { + Pattern regexp = (Pattern)iter.next(); + Matcher matcher = regexp.matcher(symbol); + if (!matcher.matches()) { + return true; + } + } + } + + return false; + } + + /** Returns true if this function should be given a body which + throws a run-time exception with an "unimplemented" message + during glue code generation. */ + public boolean isUnimplemented(String symbol) { + + // Simple case; the entire symbol is in the ignore table. + if (unimplemented.contains(symbol)) { + return true; + } + + // Ok, the slow case. We need to check the entire table, in case the table + // contains an regular expression that matches the symbol. + for (Iterator iter = unimplemented.iterator(); iter.hasNext(); ) { + Pattern regexp = (Pattern)iter.next(); + Matcher matcher = regexp.matcher(symbol); + if (matcher.matches()) { + return true; + } + } + + return false; + } + + /** Returns a replacement name for this type, which should be the + name of a Java wrapper class for a C struct, or the name + unchanged if no RenameJavaType directive was specified for this + type. */ + public String renameJavaType(String javaTypeName) { + String rename = (String) javaTypeRenames.get(javaTypeName); + if (rename != null) { + return rename; + } + return javaTypeName; + } + + /** Returns a replacement name for this function which should be + used as the Java name for the bound method. It still calls the + originally-named C function under the hood. Returns null if this + function has not been explicitly renamed. */ + public String getJavaMethodRename(String functionName) { + return (String) javaMethodRenames.get(functionName); + } + + /** Returns true if the emission style is AllStatic. */ + public boolean allStatic() { + return (emissionStyle == JavaEmitter.ALL_STATIC); + } + + /** Returns true if an interface should be emitted during glue code generation. */ + public boolean emitInterface() { + return (emissionStyle() == JavaEmitter.INTERFACE_AND_IMPL || + emissionStyle() == JavaEmitter.INTERFACE_ONLY); + } + + /** Returns true if an implementing class should be emitted during glue code generation. */ + public boolean emitImpl() { + return (emissionStyle() == JavaEmitter.ALL_STATIC || + emissionStyle() == JavaEmitter.INTERFACE_AND_IMPL || + emissionStyle() == JavaEmitter.IMPL_ONLY); + } + + /** Returns a list of Strings which should be emitted as a prologue + to the body for the Java-side glue code for the given method. + Returns null if no prologue was specified. */ + public List/**/ javaPrologueForMethod(MethodBinding binding, + boolean forImplementingMethodCall, + boolean eraseBufferAndArrayTypes) { + List/**/ res = (List/**/) javaPrologues.get(binding.getName()); + if (res == null) { + // Try again with method name and descriptor + res = (List/**/) javaPrologues.get(binding.getName() + + binding.getDescriptor(forImplementingMethodCall, + eraseBufferAndArrayTypes)); + } + return res; + } + + /** Returns a list of Strings which should be emitted as an epilogue + to the body for the Java-side glue code for the given method. + Returns null if no epilogue was specified. */ + public List/**/ javaEpilogueForMethod(MethodBinding binding, + boolean forImplementingMethodCall, + boolean eraseBufferAndArrayTypes) { + List/**/ res = (List/**/) javaEpilogues.get(binding.getName()); + if (res == null) { + // Try again with method name and descriptor + res = (List/**/) javaEpilogues.get(binding.getName() + + binding.getDescriptor(forImplementingMethodCall, + eraseBufferAndArrayTypes)); + } + return res; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { + //System.err.println("read cmd = [" + cmd + "]"); + if (cmd.equalsIgnoreCase("Package")) { + packageName = readString("package", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("ImplPackage")) { + implPackageName = readString("ImplPackage", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("JavaClass")) { + className = readString("JavaClass", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("ImplJavaClass")) { + implClassName = readString("ImplJavaClass", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("JavaOutputDir")) { + javaOutputDir = readString("JavaOutputDir", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("NativeOutputDir")) { + nativeOutputDir = readString("NativeOutputDir", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("HierarchicalNativeOutput")) { + String tmp = readString("HierarchicalNativeOutput", tok, filename, lineNo); + nativeOutputUsesJavaHierarchy = Boolean.valueOf(tmp).booleanValue(); + } else if (cmd.equalsIgnoreCase("Style")) { + String style = readString("Style", tok, filename, lineNo); + if (style.equalsIgnoreCase("AllStatic")) { + emissionStyle = JavaEmitter.ALL_STATIC; + } else if (style.equalsIgnoreCase("InterfaceAndImpl")) { + emissionStyle = JavaEmitter.INTERFACE_AND_IMPL; + } else if (style.equalsIgnoreCase("InterfaceOnly")) { + emissionStyle = JavaEmitter.INTERFACE_ONLY; + } else if (style.equalsIgnoreCase("ImplOnly")) { + emissionStyle = JavaEmitter.IMPL_ONLY; + } else { + System.err.println("WARNING: Error parsing \"style\" command at line " + lineNo + + " in file \"" + filename + "\""); + } + } else if (cmd.equalsIgnoreCase("AccessControl")) { + readAccessControl(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("Import")) { + imports.add(readString("Import", tok, filename, lineNo)); + } else if (cmd.equalsIgnoreCase("Opaque")) { + readOpaque(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("ReturnsString")) { + readReturnsString(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("ReturnedArrayLength")) { + readReturnedArrayLength(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because ReturnedArrayLength changes them. + } else if (cmd.equalsIgnoreCase("ArgumentIsString")) { + readArgumentIsString(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("Ignore")) { + readIgnore(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("Unignore")) { + readUnignore(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("IgnoreNot")) { + readIgnoreNot(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("Unimplemented")) { + readUnimplemented(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("IgnoreField")) { + readIgnoreField(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("ManuallyImplement")) { + readManuallyImplement(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("CustomJavaCode")) { + readCustomJavaCode(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because readCustomJavaCode changes them. + } else if (cmd.equalsIgnoreCase("CustomCCode")) { + readCustomCCode(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because readCustomCCode changes them. + } else if (cmd.equalsIgnoreCase("ClassJavadoc")) { + readClassJavadoc(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because readClassJavadoc changes them. + } else if (cmd.equalsIgnoreCase("NioDirectOnly")) { + nioDirectOnly.add(readString("NioDirectOnly", tok, filename, lineNo)); + } else if (cmd.equalsIgnoreCase("EmitStruct")) { + forcedStructs.add(readString("EmitStruct", tok, filename, lineNo)); + } else if (cmd.equalsIgnoreCase("StructPackage")) { + readStructPackage(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("TemporaryCVariableDeclaration")) { + readTemporaryCVariableDeclaration(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because TemporaryCVariableDeclaration changes them. + } else if (cmd.equalsIgnoreCase("TemporaryCVariableAssignment")) { + readTemporaryCVariableAssignment(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because TemporaryCVariableAssignment changes them. + } else if (cmd.equalsIgnoreCase("ReturnValueCapacity")) { + readReturnValueCapacity(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because ReturnValueCapacity changes them. + } else if (cmd.equalsIgnoreCase("ReturnValueLength")) { + readReturnValueLength(tok, filename, lineNo); + // Warning: make sure delimiters are reset at the top of this loop + // because ReturnValueLength changes them. + } else if (cmd.equalsIgnoreCase("Include")) { + doInclude(tok, file, filename, lineNo); + } else if (cmd.equalsIgnoreCase("IncludeAs")) { + doIncludeAs(tok, file, filename, lineNo); + } else if (cmd.equalsIgnoreCase("Extends")) { + readExtend(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("Implements")) { + readImplements(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("RenameJavaType")) { + readRenameJavaType(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("RenameJavaMethod")) { + readRenameJavaMethod(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("RuntimeExceptionType")) { + runtimeExceptionType = readString("RuntimeExceptionType", tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("JavaPrologue")) { + readJavaPrologueOrEpilogue(tok, filename, lineNo, true); + // Warning: make sure delimiters are reset at the top of this loop + // because readJavaPrologueOrEpilogue changes them. + } else if (cmd.equalsIgnoreCase("JavaEpilogue")) { + readJavaPrologueOrEpilogue(tok, filename, lineNo, false); + // Warning: make sure delimiters are reset at the top of this loop + // because readJavaPrologueOrEpilogue changes them. + } else { + throw new RuntimeException("Unknown command \"" + cmd + + "\" in command file " + filename + + " at line number " + lineNo); + } + } + + protected String readString(String cmd, StringTokenizer tok, String filename, int lineNo) { + try { + return tok.nextToken(); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"" + cmd + "\" command at line " + lineNo + + " in file \"" + filename + "\": missing expected parameter", e); + } + } + + protected Boolean readBoolean(String cmd, StringTokenizer tok, String filename, int lineNo) { + try { + return Boolean.valueOf(tok.nextToken()); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"" + cmd + "\" command at line " + lineNo + + " in file \"" + filename + "\": missing expected boolean value", e); + } + } + + protected Class stringToPrimitiveType(String type) throws ClassNotFoundException { + if (type.equals("boolean")) return Boolean.TYPE; + if (type.equals("byte")) return Integer.TYPE; + if (type.equals("char")) return Character.TYPE; + if (type.equals("short")) return Short.TYPE; + if (type.equals("int")) return Integer.TYPE; + if (type.equals("long")) return Long.TYPE; + if (type.equals("float")) return Float.TYPE; + if (type.equals("double")) return Double.TYPE; + throw new RuntimeException("Only primitive types are supported here"); + } + + protected void readAccessControl(StringTokenizer tok, String filename, int lineNo) { + try { + String methodName = tok.nextToken(); + String style = tok.nextToken(); + int acc = 0; + if (style.equalsIgnoreCase("PUBLIC")) { + acc = JavaEmitter.ACC_PUBLIC; + } else if (style.equalsIgnoreCase("PROTECTED")) { + acc = JavaEmitter.ACC_PROTECTED; + } else if (style.equalsIgnoreCase("PRIVATE")) { + acc = JavaEmitter.ACC_PRIVATE; + } else if (style.equalsIgnoreCase("PACKAGE_PRIVATE")) { + acc = JavaEmitter.ACC_PRIVATE; + } else { + throw new RuntimeException("Error parsing \"AccessControl\" command at line " + lineNo + + " in file \"" + filename + "\""); + } + accessControl.put(methodName, new Integer(acc)); + } catch (Exception e) { + throw new RuntimeException("Error parsing \"AccessControl\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readOpaque(StringTokenizer tok, String filename, int lineNo) { + try { + JavaType javaType = JavaType.createForClass(stringToPrimitiveType(tok.nextToken())); + String cType = null; + while (tok.hasMoreTokens()) { + if (cType == null) { + cType = tok.nextToken(); + } else { + cType = cType + " " + tok.nextToken(); + } + } + if (cType == null) { + throw new RuntimeException("No C type for \"Opaque\" command at line " + lineNo + + " in file \"" + filename + "\""); + } + TypeInfo info = parseTypeInfo(cType, javaType); + addTypeInfo(info); + } catch (Exception e) { + throw new RuntimeException("Error parsing \"Opaque\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readReturnsString(StringTokenizer tok, String filename, int lineNo) { + try { + String name = tok.nextToken(); + returnsString.add(name); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"ReturnsString\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readReturnedArrayLength(StringTokenizer tok, String filename, int lineNo) { + try { + String functionName = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + restOfLine = restOfLine.trim(); + returnedArrayLengths.put(functionName, restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"ReturnedArrayLength\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readIgnore(StringTokenizer tok, String filename, int lineNo) { + try { + String regex = tok.nextToken(); + Pattern pattern = Pattern.compile(regex); + ignores.add(pattern); + ignoreMap.put(regex, pattern); + //System.err.println("IGNORING " + regex + " / " + ignores.get(regex)); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"Ignore\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readUnignore(StringTokenizer tok, String filename, int lineNo) { + try { + String regex = tok.nextToken(); + Pattern pattern = (Pattern) ignoreMap.get(regex); + ignoreMap.remove(regex); + ignores.remove(pattern); + //System.err.println("UN-IGNORING " + regex + " / " + ignores.get(regex)); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"Unignore\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readIgnoreNot(StringTokenizer tok, String filename, int lineNo) { + try { + String regex = tok.nextToken(); + ignoreNots.add(Pattern.compile(regex)); + //System.err.println("IGNORING NEGATION OF " + regex + " / " + ignores.get(regex)); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"IgnoreNot\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readUnimplemented(StringTokenizer tok, String filename, int lineNo) { + try { + String regex = tok.nextToken(); + unimplemented.add(Pattern.compile(regex)); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"Unimplemented\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readIgnoreField(StringTokenizer tok, String filename, int lineNo) { + try { + String containingStruct = tok.nextToken(); + String name = tok.nextToken(); + ignores.add(Pattern.compile(containingStruct + " " + name)); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"IgnoreField\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readManuallyImplement(StringTokenizer tok, String filename, int lineNo) { + try { + String name = tok.nextToken(); + manuallyImplement.add(name); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"ManuallyImplement\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readCustomJavaCode(StringTokenizer tok, String filename, int lineNo) { + try { + String className = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + addCustomJavaCode(className, restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"CustomJavaCode\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void addCustomJavaCode(String className, String code) { + List codeList = customJavaCodeForClass(className); + codeList.add(code); + } + + protected void readCustomCCode(StringTokenizer tok, String filename, int lineNo) { + try { + String restOfLine = tok.nextToken("\n\r\f"); + customCCode.add(restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"CustomCCode\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readClassJavadoc(StringTokenizer tok, String filename, int lineNo) { + try { + String className = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + addClassJavadoc(className, restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"ClassJavadoc\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void addClassJavadoc(String className, String code) { + List codeList = javadocForClass(className); + codeList.add(code); + } + + /** + * When const char* arguments in the C function prototypes are encountered, + * the emitter will normally convert them to byte[] + * arguments. This directive lets you specify which of those arguments + * should be converted to String arguments instead of + * byte[] .

+ * + * For example, given the C prototype: + *

+   * void FuncName(const char* ugh, int bar, const char *foo, const char* goop);
+   * 
+ * + * The emitter will normally emit: + *
+   * public abstract void FuncName(byte[] ugh, int bar, byte[] foo, byte[] goop);
+   * 
+ * + * However, if you supplied the following directive: + * + *
+   * ArgumentIsString FuncName 0 2
+   * 
+ * + * The emitter will instead emit: + *
+   * public abstract void FuncName(String ugh, int bar, String foo, byte[] goop);
+   * 
+ * + */ + protected void readArgumentIsString(StringTokenizer tok, String filename, int lineNo) { + try { + String methodName = tok.nextToken(); + ArrayList argIndices = new ArrayList(2); + while (tok.hasMoreTokens()) { + Integer idx = Integer.valueOf(tok.nextToken()); + argIndices.add(idx); + } + + if(argIndices.size() > 0) { + argumentsAreString.put(methodName, argIndices); + } + else { + throw new RuntimeException("ERROR: Error parsing \"ArgumentIsString\" command at line " + lineNo + + " in file \"" + filename + "\": directive requires specification of at least 1 index"); + } + } catch (NoSuchElementException e) { + throw new RuntimeException( + "Error parsing \"ArgumentIsString\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readStructPackage(StringTokenizer tok, String filename, int lineNo) { + try { + String struct = tok.nextToken(); + String pkg = tok.nextToken(); + structPackages.put(struct, pkg); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"StructPackage\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readReturnValueCapacity(StringTokenizer tok, String filename, int lineNo) { + try { + String functionName = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + restOfLine = restOfLine.trim(); + returnValueCapacities.put(functionName, restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"ReturnValueCapacity\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readReturnValueLength(StringTokenizer tok, String filename, int lineNo) { + try { + String functionName = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + restOfLine = restOfLine.trim(); + returnValueLengths.put(functionName, restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"ReturnValueLength\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readTemporaryCVariableDeclaration(StringTokenizer tok, String filename, int lineNo) { + try { + String functionName = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + restOfLine = restOfLine.trim(); + List list = (List) temporaryCVariableDeclarations.get(functionName); + if (list == null) { + list = new ArrayList/**/(); + temporaryCVariableDeclarations.put(functionName, list); + } + list.add(restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"TemporaryCVariableDeclaration\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readTemporaryCVariableAssignment(StringTokenizer tok, String filename, int lineNo) { + try { + String functionName = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + restOfLine = restOfLine.trim(); + List list = (List) temporaryCVariableAssignments.get(functionName); + if (list == null) { + list = new ArrayList/**/(); + temporaryCVariableAssignments.put(functionName, list); + } + list.add(restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"TemporaryCVariableAssignment\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void doInclude(StringTokenizer tok, File file, String filename, int lineNo) throws IOException { + try { + String includedFilename = tok.nextToken(); + File includedFile = new File(includedFilename); + if (!includedFile.isAbsolute()) { + includedFile = new File(file.getParentFile(), includedFilename); + } + read(includedFile.getAbsolutePath()); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"Include\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void doIncludeAs(StringTokenizer tok, File file, String filename, int lineNo) throws IOException { + try { + StringBuffer linePrefix = new StringBuffer(128); + while (tok.countTokens() > 1) + { + linePrefix.append(tok.nextToken()); + linePrefix.append(" "); + } + // last token is filename + String includedFilename = tok.nextToken(); + File includedFile = new File(includedFilename); + if (!includedFile.isAbsolute()) { + includedFile = new File(file.getParentFile(), includedFilename); + } + read(includedFile.getAbsolutePath(), linePrefix.toString()); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"IncludeAs\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readExtend(StringTokenizer tok, String filename, int lineNo) { + try { + String interfaceName = tok.nextToken(); + List intfs = extendedInterfaces(interfaceName); + intfs.add(tok.nextToken()); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"Extends\" command at line " + lineNo + + " in file \"" + filename + "\": missing expected parameter", e); + } + } + + protected void readImplements(StringTokenizer tok, String filename, int lineNo) { + try { + String className = tok.nextToken(); + List intfs = implementedInterfaces(className); + intfs.add(tok.nextToken()); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"Implements\" command at line " + lineNo + + " in file \"" + filename + "\": missing expected parameter", e); + } + } + + protected void readRenameJavaType(StringTokenizer tok, String filename, int lineNo) { + try { + String fromName = tok.nextToken(); + String toName = tok.nextToken(); + javaTypeRenames.put(fromName, toName); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"RenameJavaType\" command at line " + lineNo + + " in file \"" + filename + "\": missing expected parameter", e); + } + } + + protected void readRenameJavaMethod(StringTokenizer tok, String filename, int lineNo) { + try { + String fromName = tok.nextToken(); + String toName = tok.nextToken(); + javaMethodRenames.put(fromName, toName); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"RenameJavaMethod\" command at line " + lineNo + + " in file \"" + filename + "\": missing expected parameter", e); + } + } + + protected void readJavaPrologueOrEpilogue(StringTokenizer tok, String filename, int lineNo, boolean prologue) { + try { + String methodName = tok.nextToken(); + String restOfLine = tok.nextToken("\n\r\f"); + restOfLine = restOfLine.trim(); + if (startsWithDescriptor(restOfLine)) { + // Assume it starts with signature for disambiguation + int spaceIdx = restOfLine.indexOf(' '); + if (spaceIdx > 0) { + String descriptor = restOfLine.substring(0, spaceIdx); + restOfLine = restOfLine.substring(spaceIdx + 1, restOfLine.length()); + methodName = methodName + descriptor; + } + } + Map code = (prologue ? javaPrologues : javaEpilogues); + List/**/ data = (List/**/) code.get(methodName); + if (data == null) { + data = new ArrayList/**/(); + code.put(methodName, data); + } + data.add(restOfLine); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"" + + (prologue ? "JavaPrologue" : "JavaEpilogue") + + "\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected static TypeInfo parseTypeInfo(String cType, JavaType javaType) { + String typeName = null; + int pointerDepth = 0; + int idx = 0; + while (idx < cType.length() && + (cType.charAt(idx) != ' ') && + (cType.charAt(idx) != '*')) { + ++idx; + } + typeName = cType.substring(0, idx); + // Count pointer depth + while (idx < cType.length()) { + if (cType.charAt(idx) == '*') { + ++pointerDepth; + } + ++idx; + } + return new TypeInfo(typeName, pointerDepth, javaType); + } + + protected void addTypeInfo(TypeInfo info) { + TypeInfo tmp = (TypeInfo) typeInfoMap.get(info.name()); + if (tmp == null) { + typeInfoMap.put(info.name(), info); + return; + } + while (tmp.next() != null) { + tmp = tmp.next(); + } + tmp.setNext(info); + } + + private static int nextIndexAfterType(String s, int idx) { + int len = s.length(); + while (idx < len) { + char c = s.charAt(idx); + + if (Character.isJavaIdentifierStart(c) || + Character.isJavaIdentifierPart(c) || + (c == '/')) { + idx++; + } else if (c == ';') { + return (idx + 1); + } else { + return -1; + } + } + return -1; + } + + private static int nextIndexAfterDescriptor(String s, int idx) { + char c = s.charAt(idx); + switch (c) { + case 'B': + case 'C': + case 'D': + case 'F': + case 'I': + case 'J': + case 'S': + case 'Z': + case 'V': return (1 + idx); + case 'L': return nextIndexAfterType(s, idx + 1); + case ')': return idx; + default: break; + } + return -1; + } + + protected static boolean startsWithDescriptor(String s) { + // Try to see whether the String s starts with a valid Java + // descriptor. + + int idx = 0; + int len = s.length(); + while ((idx < len) && s.charAt(idx) == ' ') { + ++idx; + } + + if (idx >= len) return false; + if (s.charAt(idx++) != '(') return false; + while (idx < len) { + int nextIdx = nextIndexAfterDescriptor(s, idx); + if (nextIdx < 0) { + return false; + } + if (nextIdx == idx) { + // ')' + break; + } + idx = nextIdx; + } + int nextIdx = nextIndexAfterDescriptor(s, idx + 1); + if (nextIdx < 0) { + return false; + } + return true; + } +} diff --git a/src/classes/com/sun/gluegen/JavaEmitter.java b/src/classes/com/sun/gluegen/JavaEmitter.java new file mode 100644 index 000000000..24687d36f --- /dev/null +++ b/src/classes/com/sun/gluegen/JavaEmitter.java @@ -0,0 +1,1550 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.io.*; +import java.util.*; +import java.text.MessageFormat; + +import com.sun.gluegen.cgram.types.*; + +// PROBLEMS: +// - what if something returns 'const int *'? Could we +// return an IntBuffer that has read-only behavior? Or do we copy the array +// (but we don't know its size!). What do we do if it returns a non-const +// int*? Should the user be allowed to write back to the returned pointer? +// +// - Non-const array types must be properly released with JNI_COMMIT +// in order to see side effects if the array was copied. + + +public class JavaEmitter implements GlueEmitter { + private StructLayout layout; + private TypeDictionary typedefDictionary; + private TypeDictionary structDictionary; + private Map canonMap; + private JavaConfiguration cfg; + + /** + * Style of code emission. Can emit everything into one class + * (AllStatic), separate interface and implementing classes + * (InterfaceAndImpl), only the interface (InterfaceOnly), or only + * the implementation (ImplOnly). + */ + public static final int ALL_STATIC = 1; + public static final int INTERFACE_AND_IMPL = 2; + public static final int INTERFACE_ONLY = 3; + public static final int IMPL_ONLY = 4; + + /** + * Access control for emitted Java methods. + */ + public static final int ACC_PUBLIC = 1; + public static final int ACC_PROTECTED = 2; + public static final int ACC_PRIVATE = 3; + public static final int ACC_PACKAGE_PRIVATE = 4; + + private PrintWriter javaWriter; // Emits either interface or, in AllStatic mode, everything + private PrintWriter javaImplWriter; // Only used in non-AllStatic modes for impl class + private PrintWriter cWriter; + private MachineDescription machDesc; + + public void readConfigurationFile(String filename) throws Exception { + cfg = createConfig(); + cfg.read(filename); + } + + public void setMachineDescription(MachineDescription md) { + machDesc = md; + } + + public void beginEmission(GlueEmitterControls controls) throws IOException + { + try + { + openWriters(); + } + catch (Exception e) + { + throw new RuntimeException( + "Unable to open files for writing", e); + } + + emitAllFileHeaders(); + + // Request emission of any structs requested + for (Iterator iter = cfg.forcedStructs().iterator(); iter.hasNext(); ) { + controls.forceStructEmission((String) iter.next()); + } + } + + public void endEmission() + { + emitAllFileFooters(); + + try + { + closeWriters(); + } + catch (Exception e) + { + throw new RuntimeException( + "Unable to close open files", e); + } + } + + public void beginDefines() throws Exception + { + if (cfg.allStatic() || cfg.emitInterface()) { + javaWriter().println(); + } + } + + public void emitDefine(String name, String value, String optionalComment) throws Exception + { + if (cfg.allStatic() || cfg.emitInterface()) { + // TODO: Some defines (e.g., GL_DOUBLE_EXT in gl.h) are defined in terms + // of other defines -- should we emit them as references to the original + // define (not even sure if the lexer supports this)? Right now they're + // emitted as the numeric value of the original definition. If we decide + // emit them as references we'll also have to emit them in the correct + // order. It's probably not an issue right now because the emitter + // currently only emits only numeric defines -- if it handled #define'd + // objects it would make a bigger difference. + + if (!cfg.shouldIgnore(name)) { + String type = null; + + // FIXME: need to handle when type specifier is in last char (e.g., + // "1.0d or 2759L", because parseXXX() methods don't allow the type + // specifier character in the string. + // + //char lastChar = value.charAt(value.length()-1); + + try { + // see if it's a long or int + int radix; + String parseValue; + // FIXME: are you allowed to specify hex/octal constants with + // negation, e.g. "-0xFF" or "-056"? If so, need to modify the + // following "if(..)" checks and parseValue computation + if (value.startsWith("0x") || value.startsWith("0X")) { + radix = 16; + parseValue = value.substring(2); + } + else if (value.startsWith("0") && value.length() > 1) { + // TODO: is "0" the prefix in C to indicate octal??? + radix = 8; + parseValue = value.substring(1); + } + else { + radix = 10; + parseValue = value; + } + //System.err.println("parsing " + value + " as long w/ radix " + radix); + long longVal = Long.parseLong(parseValue, radix); + type = "long"; + // if constant is small enough, store it as an int instead of a long + if (longVal > Integer.MIN_VALUE && longVal < Integer.MAX_VALUE) { + type = "int"; + } + + } catch (NumberFormatException e) { + try { + // see if it's a double or float + double dVal = Double.parseDouble(value); + type = "double"; + // if constant is small enough, store it as a float instead of a double + if (dVal > Float.MIN_VALUE && dVal < Float.MAX_VALUE) { + type = "float"; + } + + } catch (NumberFormatException e2) { + throw new RuntimeException( + "Cannot emit define \""+name+"\": value \""+value+ + "\" cannot be assigned to a int, long, float, or double", e2); + } + } + + if (type == null) { + throw new RuntimeException( + "Cannot emit define (2) \""+name+"\": value \""+value+ + "\" cannot be assigned to a int, long, float, or double"); + } + if (optionalComment != null && optionalComment.length() != 0) { + javaWriter().println(" /** " + optionalComment + " */"); + } + javaWriter().println(" public static final " + type + " " + name + " = " + value + ";"); + } + } + } + + public void endDefines() throws Exception + { + } + + public void beginFunctions(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) throws Exception { + this.typedefDictionary = typedefDictionary; + this.structDictionary = structDictionary; + this.canonMap = canonMap; + if (cfg.allStatic() || cfg.emitInterface()) { + javaWriter().println(); + } + } + + public Iterator emitFunctions(List/**/ originalCFunctions) + throws Exception { + // Sometimes headers will have the same function prototype twice, once + // with the argument names and once without. We'll remember the signatures + // we've already processed we don't generate duplicate bindings. + // + // Note: this code assumes that on the equals() method in FunctionSymbol + // only considers function name and argument types (i.e., it does not + // consider argument *names*) when comparing FunctionSymbols for equality + Set funcsToBindSet = new HashSet(100); + for (Iterator cIter = originalCFunctions.iterator(); cIter.hasNext(); ) { + FunctionSymbol cFunc = (FunctionSymbol) cIter.next(); + if (!funcsToBindSet.contains(cFunc)) { + funcsToBindSet.add(cFunc); + } + } + + ArrayList funcsToBind = new ArrayList(funcsToBindSet.size()); + funcsToBind.addAll(funcsToBindSet); + // sort functions to make them easier to find in native code + Collections.sort( + funcsToBind, + new Comparator() { + public int compare(Object o1, Object o2) { + return ((FunctionSymbol)o1).getName().compareTo( + ((FunctionSymbol)o2).getName()); + } + public boolean equals(Object obj) { + return obj.getClass() == this.getClass(); + } + }); + + // Bind all the C funcs to Java methods + ArrayList/**/ methodBindingEmitters = new ArrayList(2*funcsToBind.size()); + for (Iterator iter = funcsToBind.iterator(); iter.hasNext(); ) { + FunctionSymbol cFunc = (FunctionSymbol) iter.next(); + // Check to see whether this function should be ignored + if (cfg.shouldIgnore(cFunc.getName())) { + continue; // don't generate bindings for this symbol + } + + List allBindings = generateMethodBindingEmitters(cFunc); + methodBindingEmitters.addAll(allBindings); + } + + // Emit all the methods + for (int i = 0; i < methodBindingEmitters.size(); ++i) { + FunctionEmitter emitter = (FunctionEmitter)methodBindingEmitters.get(i); + try { + emitter.emit(); + } catch (Exception e) { + throw new RuntimeException( + "Error while emitting binding for \"" + emitter.getName() + "\"", e); + } + emitter.getDefaultOutput().println(); // put newline after method body + } + + // Return the list of FunctionSymbols that we generated gluecode for + return funcsToBind.iterator(); + } + + /** + * Create the object that will read and store configuration information for + * this JavaEmitter. + */ + protected JavaConfiguration createConfig() { + return new JavaConfiguration(); + } + + /** + * Get the configuration information for this JavaEmitter. + */ + protected JavaConfiguration getConfig() { + return cfg; + } + + /** + * Generates the public emitters for this MethodBinding which will + * produce either simply signatures (for the interface class, if + * any) or function definitions with or without a body (depending on + * whether or not the implementing function can go directly to + * native code because it doesn't need any processing of the + * outgoing arguments). + */ + protected void generatePublicEmitters(MethodBinding binding, + List allEmitters, + boolean signatureOnly) { + PrintWriter writer = ((signatureOnly || cfg.allStatic()) ? javaWriter() : javaImplWriter()); + + if (cfg.manuallyImplement(binding.getName()) && !signatureOnly) { + // We only generate signatures for manually-implemented methods; + // user provides the implementation + return; + } + + // It's possible we may not need a body even if signatureOnly is + // set to false; for example, if the routine doesn't take any + // arrays or buffers as arguments + boolean isUnimplemented = cfg.isUnimplemented(binding.getName()); + List/**/ prologue = cfg.javaPrologueForMethod(binding, false, false); + List/**/ epilogue = cfg.javaEpilogueForMethod(binding, false, false); + boolean needsBody = (isUnimplemented || + (binding.needsNIOWrappingOrUnwrapping() || + binding.signatureUsesJavaPrimitiveArrays()) || + (prologue != null) || + (epilogue != null)); + + JavaMethodBindingEmitter emitter = + new JavaMethodBindingEmitter(binding, + writer, + cfg.runtimeExceptionType(), + !signatureOnly && needsBody, + false, + cfg.nioDirectOnly(binding.getName()), + false, + false, + false, + isUnimplemented); + switch (cfg.accessControl(binding.getName())) { + case ACC_PUBLIC: emitter.addModifier(JavaMethodBindingEmitter.PUBLIC); break; + case ACC_PROTECTED: emitter.addModifier(JavaMethodBindingEmitter.PROTECTED); break; + case ACC_PRIVATE: emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); break; + default: break; // package-private adds no modifiers + } + if (cfg.allStatic()) { + emitter.addModifier(JavaMethodBindingEmitter.STATIC); + } + if (!isUnimplemented && !needsBody && !signatureOnly) { + emitter.addModifier(JavaMethodBindingEmitter.NATIVE); + } + emitter.setReturnedArrayLengthExpression(cfg.returnedArrayLength(binding.getName())); + emitter.setPrologue(prologue); + emitter.setEpilogue(epilogue); + allEmitters.add(emitter); + } + + /** + * Generates the private emitters for this MethodBinding. On the + * Java side these will simply produce signatures for native + * methods. On the C side these will create the emitters which will + * write the JNI code to interface to the functions. We need to be + * careful to make the signatures all match up and not produce too + * many emitters which would lead to compilation errors from + * creating duplicated methods / functions. + */ + protected void generatePrivateEmitters(MethodBinding binding, + List allEmitters) { + if (cfg.manuallyImplement(binding.getName())) { + // Don't produce emitters for the implementation class + return; + } + + boolean hasPrologueOrEpilogue = + ((cfg.javaPrologueForMethod(binding, false, false) != null) || + (cfg.javaEpilogueForMethod(binding, false, false) != null)); + + // If we already generated a public native entry point for this + // method, don't emit another one + if (!cfg.isUnimplemented(binding.getName()) && + (binding.needsNIOWrappingOrUnwrapping() || + binding.signatureUsesJavaPrimitiveArrays() || + hasPrologueOrEpilogue)) { + PrintWriter writer = (cfg.allStatic() ? javaWriter() : javaImplWriter()); + + // If the binding uses primitive arrays, we are going to emit + // the private native entry point for it along with the version + // taking only NIO buffers + if (!binding.signatureUsesJavaPrimitiveArrays()) { + // (Always) emit the entry point taking only direct buffers + JavaMethodBindingEmitter emitter = + new JavaMethodBindingEmitter(binding, + writer, + cfg.runtimeExceptionType(), + false, + true, + cfg.nioDirectOnly(binding.getName()), + true, + true, + false, + false); + emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); + if (cfg.allStatic()) { + emitter.addModifier(JavaMethodBindingEmitter.STATIC); + } + emitter.addModifier(JavaMethodBindingEmitter.NATIVE); + emitter.setReturnedArrayLengthExpression(cfg.returnedArrayLength(binding.getName())); + allEmitters.add(emitter); + + // Optionally emit the entry point taking arrays which handles + // both the public entry point taking arrays as well as the + // indirect buffer case + if (!cfg.nioDirectOnly(binding.getName()) && + binding.signatureCanUseIndirectNIO()) { + emitter = + new JavaMethodBindingEmitter(binding, + writer, + cfg.runtimeExceptionType(), + false, + true, + false, + true, + false, + true, + false); + + emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); + if (cfg.allStatic()) { + emitter.addModifier(JavaMethodBindingEmitter.STATIC); + } + emitter.addModifier(JavaMethodBindingEmitter.NATIVE); + emitter.setReturnedArrayLengthExpression(cfg.returnedArrayLength(binding.getName())); + allEmitters.add(emitter); + } + } + } + + // Now generate the C emitter(s). We need to produce one for every + // Java native entry point (public or private). The only + // situations where we don't produce one are (a) when the method + // is unimplemented, and (b) when the signature contains primitive + // arrays, since the latter is handled by the method binding + // variant taking only NIO Buffers. + if (!cfg.isUnimplemented(binding.getName()) && + !binding.signatureUsesJavaPrimitiveArrays()) { + // See whether we need an expression to help calculate the + // length of any return type + MessageFormat returnValueCapacityFormat = null; + MessageFormat returnValueLengthFormat = null; + JavaType javaReturnType = binding.getJavaReturnType(); + if (javaReturnType.isNIOBuffer() || + javaReturnType.isCompoundTypeWrapper()) { + // See whether capacity has been specified + String capacity = cfg.returnValueCapacity(binding.getName()); + if (capacity != null) { + returnValueCapacityFormat = new MessageFormat(capacity); + } + } else if (javaReturnType.isArray() || + javaReturnType.isArrayOfCompoundTypeWrappers()) { + // NOTE: adding a check here because the CMethodBindingEmitter + // also doesn't yet handle returning scalar arrays. In order + // to implement this, return the type as a Buffer instead + // (i.e., IntBuffer, FloatBuffer) and add code as necessary. + if (javaReturnType.isPrimitiveArray()) { + throw new RuntimeException("Primitive array return types not yet supported"); + } + + // See whether length has been specified + String len = cfg.returnValueLength(binding.getName()); + if (len != null) { + returnValueLengthFormat = new MessageFormat(len); + } + } + + CMethodBindingEmitter cEmitter = + new CMethodBindingEmitter(binding, + cWriter(), + cfg.implPackageName(), + cfg.implClassName(), + true, /* NOTE: we always disambiguate with a suffix now, so this is optional */ + cfg.allStatic(), + (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue), + false); + if (returnValueCapacityFormat != null) { + cEmitter.setReturnValueCapacityExpression(returnValueCapacityFormat); + } + if (returnValueLengthFormat != null) { + cEmitter.setReturnValueLengthExpression(returnValueLengthFormat); + } + cEmitter.setTemporaryCVariableDeclarations(cfg.temporaryCVariableDeclarations(binding.getName())); + cEmitter.setTemporaryCVariableAssignments(cfg.temporaryCVariableAssignments(binding.getName())); + allEmitters.add(cEmitter); + + // Now see if we have to emit another entry point to handle the + // indirect buffer and array case + if (binding.argumentsUseNIO() && + binding.signatureCanUseIndirectNIO() && + !cfg.nioDirectOnly(binding.getName())) { + cEmitter = + new CMethodBindingEmitter(binding, + cWriter(), + cfg.implPackageName(), + cfg.implClassName(), + true, /* NOTE: we always disambiguate with a suffix now, so this is optional */ + cfg.allStatic(), + binding.needsNIOWrappingOrUnwrapping(), + true); + if (returnValueCapacityFormat != null) { + cEmitter.setReturnValueCapacityExpression(returnValueCapacityFormat); + } + if (returnValueLengthFormat != null) { + cEmitter.setReturnValueLengthExpression(returnValueLengthFormat); + } + cEmitter.setTemporaryCVariableDeclarations(cfg.temporaryCVariableDeclarations(binding.getName())); + cEmitter.setTemporaryCVariableAssignments(cfg.temporaryCVariableAssignments(binding.getName())); + allEmitters.add(cEmitter); + } + } + } + + /** + * Generate all appropriate Java bindings for the specified C function + * symbols. + */ + protected List generateMethodBindingEmitters(FunctionSymbol sym) throws Exception { + + ArrayList/**/ allEmitters = new ArrayList(); + + try { + // Get Java binding for the function + MethodBinding mb = bindFunction(sym, null, null); + + // JavaTypes representing C pointers in the initial + // MethodBinding have not been lowered yet to concrete types + List bindings = expandMethodBinding(mb); + + for (Iterator iter = bindings.iterator(); iter.hasNext(); ) { + MethodBinding binding = (MethodBinding) iter.next(); + + if (cfg.allStatic() && binding.hasContainingType()) { + // This should not currently happen since structs are emitted using a different mechanism + throw new IllegalArgumentException("Cannot create binding in AllStatic mode because method has containing type: \"" + + binding + "\""); + } + + // The structure of the generated glue code looks something like this: + // Simple method (no arrays, void pointers, etc.): + // Interface class: + // public void fooMethod(); + // Implementation class: + // public native void fooMethod(); + // + // Method taking void* argument: + // Interface class: + // public void fooMethod(Buffer arg); + // Implementation class: + // public void fooMethod(Buffer arg) { + // ... bounds checks, etc. ... + // if (arg.isDirect()) { + // fooMethod0(arg, computeDirectBufferByteOffset(arg)); + // } else { + // fooMethod1(getIndirectBufferArray(arg), computeIndirectBufferByteOffset(arg)); + // } + // } + // private native void fooMethod0(Object arg, int arg_byte_offset); + // private native void fooMethod1(Object arg, int arg_byte_offset); + // + // Method taking primitive array argument: + // Interface class: + // public void fooMethod(int[] arg, int arg_offset); + // public void fooMethod(IntBuffer arg); + // Implementing class: + // public void fooMethod(int[] arg, int arg_offset) { + // ... range checks, etc. ... + // fooMethod1(arg, SIZEOF_INT * arg_offset); + // } + // public void fooMethod(IntBuffer arg) { + // ... bounds checks, etc. ... + // if (arg.isDirect()) { + // fooMethod0(arg, computeDirectBufferByteOffset(arg)); + // } else { + // fooMethod1(getIndirectBufferArray(arg), computeIndirectBufferByteOffset(arg)); + // } + // } + // private native void fooMethod0(Object arg, int arg_byte_offset); + // private native void fooMethod1(Object arg, int arg_byte_offset); + // + // Note in particular that the public entry point taking an + // array is merely a special case of the indirect buffer case. + + if (cfg.emitInterface()) { + generatePublicEmitters(binding, allEmitters, true); + } + if (cfg.emitImpl()) { + generatePublicEmitters(binding, allEmitters, false); + generatePrivateEmitters(binding, allEmitters); + } + } // end iteration over expanded bindings + } catch (Exception e) { + throw new RuntimeException( + "Error while generating bindings for \"" + sym + "\"", e); + } + + return allEmitters; + } + + + public void endFunctions() throws Exception + { + if (cfg.allStatic() || cfg.emitInterface()) { + emitCustomJavaCode(javaWriter(), cfg.className()); + } + if (!cfg.allStatic() && cfg.emitImpl()) { + emitCustomJavaCode(javaImplWriter(), cfg.implClassName()); + } + } + + public void beginStructLayout() throws Exception {} + public void layoutStruct(CompoundType t) throws Exception { + getLayout().layout(t); + } + public void endStructLayout() throws Exception {} + + public void beginStructs(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) throws Exception { + this.typedefDictionary = typedefDictionary; + this.structDictionary = structDictionary; + this.canonMap = canonMap; + } + + public void emitStruct(CompoundType structType, String alternateName) throws Exception { + String name = structType.getName(); + if (name == null && alternateName != null) { + name = alternateName; + } + + if (name == null) { + System.err.println("WARNING: skipping emission of unnamed struct \"" + structType + "\""); + return; + } + + if (cfg.shouldIgnore(name)) { + return; + } + + Type containingCType = canonicalize(new PointerType(machDesc.pointerSizeInBytes(), structType, 0)); + JavaType containingType = typeToJavaType(containingCType, false); + if (!containingType.isCompoundTypeWrapper()) { + return; + } + String containingTypeName = containingType.getName(); + + boolean needsNativeCode = false; + for (int i = 0; i < structType.getNumFields(); i++) { + if (structType.getField(i).getType().isFunctionPointer()) { + needsNativeCode = true; + break; + } + } + + String structClassPkg = cfg.packageForStruct(name); + PrintWriter writer = null; + PrintWriter cWriter = null; + try + { + writer = openFile( + cfg.javaOutputDir() + File.separator + + CodeGenUtils.packageAsPath(structClassPkg) + + File.separator + containingTypeName + ".java"); + CodeGenUtils.emitAutogeneratedWarning(writer, this); + if (needsNativeCode) { + String nRoot = cfg.nativeOutputDir(); + if (cfg.nativeOutputUsesJavaHierarchy()) { + nRoot += + File.separator + + CodeGenUtils.packageAsPath(cfg.packageName()); + } + cWriter = openFile(nRoot + File.separator + containingTypeName + "_JNI.c"); + CodeGenUtils.emitAutogeneratedWarning(cWriter, this); + emitCHeader(cWriter, containingTypeName); + } + } + catch(Exception e) + { + throw new RuntimeException( + "Unable to open files for emission of struct class", e); + } + + writer.println(); + writer.println("package " + structClassPkg + ";"); + writer.println(); + writer.println("import java.nio.*;"); + writer.println(); + writer.println("import com.sun.gluegen.runtime.*;"); + writer.println(); + List/**/ imports = cfg.imports(); + for (Iterator iter = imports.iterator(); iter.hasNext(); ) { + writer.print("import "); + writer.print(iter.next()); + writer.println(";"); + } + List/**/ javadoc = cfg.javadocForClass(containingTypeName); + for (Iterator iter = javadoc.iterator(); iter.hasNext(); ) { + writer.println((String) iter.next()); + } + writer.println(); + writer.print("public class " + containingTypeName + " "); + boolean firstIteration = true; + List/**/ userSpecifiedInterfaces = cfg.implementedInterfaces(containingTypeName); + for (Iterator iter = userSpecifiedInterfaces.iterator(); iter.hasNext(); ) { + if (firstIteration) { + writer.print("implements "); + } + firstIteration = false; + writer.print(iter.next()); + writer.print(" "); + } + writer.println("{"); + writer.println(" private StructAccessor accessor;"); + writer.println(); + writer.println(" public static int size() {"); + writer.println(" return " + structType.getSize() + ";"); + writer.println(" }"); + writer.println(); + writer.println(" public " + containingTypeName + "() {"); + writer.println(" this(BufferFactory.newDirectByteBuffer(size()));"); + writer.println(" }"); + writer.println(); + writer.println(" public " + containingTypeName + "(ByteBuffer buf) {"); + writer.println(" accessor = new StructAccessor(buf);"); + writer.println(" }"); + writer.println(); + writer.println(" public ByteBuffer getBuffer() {"); + writer.println(" return accessor.getBuffer();"); + writer.println(" }"); + for (int i = 0; i < structType.getNumFields(); i++) { + Field field = structType.getField(i); + Type fieldType = field.getType(); + if (!cfg.shouldIgnore(name + " " + field.getName())) { + if (fieldType.isFunctionPointer()) { + try { + // Emit method call and associated native code + FunctionType funcType = fieldType.asPointer().getTargetType().asFunction(); + FunctionSymbol funcSym = new FunctionSymbol(field.getName(), funcType); + MethodBinding binding = bindFunction(funcSym, containingType, containingCType); + binding.findThisPointer(); // FIXME: need to provide option to disable this on per-function basis + writer.println(); + + // Emit public Java entry point for calling this function pointer + JavaMethodBindingEmitter emitter = + new JavaMethodBindingEmitter(binding, + writer, + cfg.runtimeExceptionType(), + true, + false, + true, // FIXME: should unify this with the general emission code + false, + false, // FIXME: should unify this with the general emission code + false, // FIXME: should unify this with the general emission code + false); + emitter.addModifier(JavaMethodBindingEmitter.PUBLIC); + emitter.emit(); + + // Emit private native Java entry point for calling this function pointer + emitter = + new JavaMethodBindingEmitter(binding, + writer, + cfg.runtimeExceptionType(), + false, + true, + true, // FIXME: should unify this with the general emission code + true, + true, // FIXME: should unify this with the general emission code + false, // FIXME: should unify this with the general emission code + false); + emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); + emitter.addModifier(JavaMethodBindingEmitter.NATIVE); + emitter.emit(); + + // Emit (private) C entry point for calling this function pointer + CMethodBindingEmitter cEmitter = + new CMethodBindingEmitter(binding, + cWriter, + structClassPkg, + containingTypeName, + true, // FIXME: this is optional at this point + false, + true, + false); // FIXME: should unify this with the general emission code + cEmitter.emit(); + } catch (Exception e) { + System.err.println("While processing field " + field + " of type " + name + ":"); + throw(e); + } + } else if (fieldType.isCompound()) { + // FIXME: will need to support this at least in order to + // handle the union in jawt_Win32DrawingSurfaceInfo (fabricate + // a name?) + if (fieldType.getName() == null) { + throw new RuntimeException("Anonymous structs as fields not supported yet (field \"" + + field + "\" in type \"" + name + "\")"); + } + + writer.println(); + writer.println(" public " + fieldType.getName() + " " + field.getName() + "() {"); + writer.println(" return new " + fieldType.getName() + "(accessor.slice(" + + field.getOffset() + ", " + fieldType.getSize() + "));"); + writer.println(" }"); + + // FIXME: add setter by autogenerating "copyTo" for all compound type wrappers + } else if (fieldType.isArray()) { + System.err.println("WARNING: Array fields (field \"" + field + "\" of type \"" + name + + "\") not implemented yet"); + } else { + JavaType javaType = null; + try { + javaType = typeToJavaType(fieldType, false); + } catch (Exception e) { + System.err.println("Error occurred while creating accessor for field \"" + + field.getName() + "\" in type \"" + name + "\""); + e.printStackTrace(); + throw(e); + } + if (javaType.isPrimitive()) { + // Primitive type + String externalJavaTypeName = javaType.getName(); + String internalJavaTypeName = externalJavaTypeName; + if (isOpaque(fieldType)) { + internalJavaTypeName = compatiblePrimitiveJavaTypeName(fieldType, javaType); + } + String capitalized = + "" + Character.toUpperCase(internalJavaTypeName.charAt(0)) + internalJavaTypeName.substring(1); + int slot = slot(fieldType, (int) field.getOffset()); + // Setter + writer.println(); + writer.println(" public " + containingTypeName + " " + field.getName() + "(" + externalJavaTypeName + " val) {"); + writer.print (" accessor.set" + capitalized + "At(" + slot + ", "); + if (!externalJavaTypeName.equals(internalJavaTypeName)) { + writer.print("(" + internalJavaTypeName + ") "); + } + writer.println("val);"); + writer.println(" return this;"); + writer.println(" }"); + // Getter + writer.println(); + writer.println(" public " + externalJavaTypeName + " " + field.getName() + "() {"); + writer.print (" return "); + if (!externalJavaTypeName.equals(internalJavaTypeName)) { + writer.print("(" + externalJavaTypeName + ") "); + } + writer.println("accessor.get" + capitalized + "At(" + slot + ");"); + writer.println(" }"); + } else { + // FIXME + System.err.println("WARNING: Complicated fields (field \"" + field + "\" of type \"" + name + + "\") not implemented yet"); + // throw new RuntimeException("Complicated fields (field \"" + field + "\" of type \"" + t + + // "\") not implemented yet"); + } + } + } + } + emitCustomJavaCode(writer, containingTypeName); + writer.println("}"); + writer.flush(); + writer.close(); + if (needsNativeCode) { + cWriter.flush(); + cWriter.close(); + } + } + public void endStructs() throws Exception {} + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private JavaType typeToJavaType(Type cType, boolean outgoingArgument) { + // Recognize JNIEnv* case up front + PointerType opt = cType.asPointer(); + if ((opt != null) && + (opt.getTargetType().getName() != null) && + (opt.getTargetType().getName().equals("JNIEnv"))) { + return JavaType.createForJNIEnv(); + } + + // Opaque specifications override automatic conversions + TypeInfo info = cfg.typeInfo(cType, typedefDictionary); + if (info != null) { + return info.javaType(); + } + Type t = cType; + if (t.isInt() || t.isEnum()) { + switch (t.getSize()) { + case 1: return javaType(Byte.TYPE); + case 2: return javaType(Short.TYPE); + case 4: return javaType(Integer.TYPE); + case 8: return javaType(Long.TYPE); + default: throw new RuntimeException("Unknown integer type of size " + + t.getSize() + " and name " + t.getName()); + } + } else if (t.isFloat()) { + return javaType(Float.TYPE); + } else if (t.isDouble()) { + return javaType(Double.TYPE); + } else if (t.isVoid()) { + return javaType(Void.TYPE); + } else { + if (t.pointerDepth() > 0 || t.arrayDimension() > 0) { + Type targetType; // target type + if (t.isPointer()) { + // t is *, we need to get + targetType = t.asPointer().getTargetType(); + } else { + // t is [], we need to get + targetType = t.asArray().getElementType(); + } + + // Handle Types of form pointer-to-type or array-of-type, like + // char* or int[]; these are expanded out into Java primitive + // arrays, NIO buffers, or both in expandMethodBinding + if (t.pointerDepth() == 1 || t.arrayDimension() == 1) { + if (targetType.isVoid()) { + return JavaType.createForVoidPointer(); + } else if (targetType.isInt()) { + switch (targetType.getSize()) { + case 1: return JavaType.createForCCharPointer(); + case 2: return JavaType.createForCShortPointer(); + case 4: return JavaType.createForCInt32Pointer(); + case 8: return JavaType.createForCInt64Pointer(); + default: throw new RuntimeException("Unknown integer array type of size " + + t.getSize() + " and name " + t.getName()); + } + } else if (targetType.isFloat()) { + return JavaType.createForCFloatPointer(); + } else if (targetType.isDouble()) { + return JavaType.createForCDoublePointer(); + } else if (targetType.isCompound()) { + if (t.isArray()) { + throw new RuntimeException("Arrays of compound types not handled yet"); + } + // Special cases for known JNI types (in particular for converting jawt.h) + if (t.getName() != null && + t.getName().equals("jobject")) { + return javaType(java.lang.Object.class); + } + + String name = targetType.getName(); + if (name == null) { + // Try containing pointer type for any typedefs + name = t.getName(); + if (name == null) { + throw new RuntimeException("Couldn't find a proper type name for pointer type " + t); + } + } + + return JavaType.createForCStruct(cfg.renameJavaType(name)); + } else { + throw new RuntimeException("Don't know how to convert pointer/array type \"" + + t + "\""); + } + } + // Handle Types of form pointer-to-pointer-to-type or + // array-of-arrays-of-type, like char** or int[][] + else if (t.pointerDepth() == 2 || t.arrayDimension() == 2) { + // Get the target type of the target type (targetType was computer earlier + // as to be a pointer to the target type, so now we need to get its + // target type) + Type bottomType; + if (targetType.isPointer()) { + // t is**, targetType is *, we need to get + bottomType = targetType.asPointer().getTargetType(); + } else { + // t is[][], targetType is [], we need to get + bottomType = targetType.asArray().getElementType(); + } + + if (bottomType.isPrimitive()) { + if (bottomType.isInt()) { + switch (bottomType.getSize()) { + case 1: return javaType(ArrayTypes.byteBufferArrayClass); + case 2: return javaType(ArrayTypes.shortBufferArrayClass); + case 4: return javaType(ArrayTypes.intBufferArrayClass); + case 8: return javaType(ArrayTypes.longBufferArrayClass); + default: throw new RuntimeException("Unknown two-dimensional integer array type of element size " + + bottomType.getSize() + " and name " + bottomType.getName()); + } + } else if (bottomType.isFloat()) { + return javaType(ArrayTypes.floatBufferArrayClass); + } else if (bottomType.isDouble()) { + return javaType(ArrayTypes.doubleBufferArrayClass); + } else { + throw new RuntimeException("Unexpected primitive type " + bottomType.getName() + + " in two-dimensional array"); + } + } else if (bottomType.isVoid()) { + return javaType(ArrayTypes.bufferArrayClass); + } else if (targetType.isPointer() && (targetType.pointerDepth() == 1) && + targetType.asPointer().getTargetType().isCompound()) { + // Array of pointers; convert as array of StructAccessors + return JavaType.createForCArray(targetType); + } else { + throw new RuntimeException( + "Could not convert C type \"" + t + "\" " + + "to appropriate Java type; need to add more support for " + + "depth=2 pointer/array types [debug info: targetType=\"" + + targetType + "\"]"); + } + } else { + // can't handle this type of pointer/array argument + throw new RuntimeException( + "Could not convert C pointer/array \"" + t + "\" to " + + "appropriate Java type; types with pointer/array depth " + + "greater than 2 are not yet supported [debug info: " + + "pointerDepth=" + t.pointerDepth() + " arrayDimension=" + + t.arrayDimension() + " targetType=\"" + targetType + "\"]"); + } + + } else { + throw new RuntimeException( + "Could not convert C type \"" + t + "\" (class " + + t.getClass().getName() + ") to appropriate Java type"); + } + } + } + + private static boolean isIntegerType(Class c) { + return ((c == Byte.TYPE) || + (c == Short.TYPE) || + (c == Character.TYPE) || + (c == Integer.TYPE) || + (c == Long.TYPE)); + } + + private int slot(Type t, int byteOffset) { + if (t.isInt()) { + switch (t.getSize()) { + case 1: + case 2: + case 4: + case 8: return byteOffset / t.getSize(); + default: throw new RuntimeException("Illegal type"); + } + } else if (t.isFloat()) { + return byteOffset / 4; + } else if (t.isDouble()) { + return byteOffset / 8; + } else if (t.isPointer()) { + return byteOffset / machDesc.pointerSizeInBytes(); + } else { + throw new RuntimeException("Illegal type " + t); + } + } + + private StructLayout getLayout() { + if (layout == null) { + layout = StructLayout.createForCurrentPlatform(); + } + return layout; + } + + protected PrintWriter openFile(String filename) throws IOException { + //System.out.println("Trying to open: " + filename); + File file = new File(filename); + String parentDir = file.getParent(); + if (parentDir != null) + { + File pDirFile = new File(parentDir); + pDirFile.mkdirs(); + } + return new PrintWriter(new BufferedWriter(new FileWriter(file))); + } + + private boolean isOpaque(Type type) { + return (cfg.typeInfo(type, typedefDictionary) != null); + } + + private String compatiblePrimitiveJavaTypeName(Type fieldType, + JavaType javaType) { + Class c = javaType.getJavaClass(); + if (!isIntegerType(c)) { + // FIXME + throw new RuntimeException("Can't yet handle opaque definitions of structs' fields to non-integer types (byte, short, int, long, etc.)"); + } + switch (fieldType.getSize()) { + case 1: return "byte"; + case 2: return "short"; + case 4: return "int"; + case 8: return "long"; + default: throw new RuntimeException("Can't handle opaque definitions if the starting type isn't compatible with integral types"); + } + } + + private void openWriters() throws IOException { + String jRoot = null; + if (cfg.allStatic() || cfg.emitInterface()) { + jRoot = cfg.javaOutputDir() + File.separator + + CodeGenUtils.packageAsPath(cfg.packageName()); + } + String jImplRoot = null; + if (!cfg.allStatic()) { + jImplRoot = + cfg.javaOutputDir() + File.separator + + CodeGenUtils.packageAsPath(cfg.implPackageName()); + } + String nRoot = cfg.nativeOutputDir(); + if (cfg.nativeOutputUsesJavaHierarchy()) + { + nRoot += + File.separator + CodeGenUtils.packageAsPath(cfg.packageName()); + } + + if (cfg.allStatic() || cfg.emitInterface()) { + javaWriter = openFile(jRoot + File.separator + cfg.className() + ".java"); + } + if (!cfg.allStatic() && cfg.emitImpl()) { + javaImplWriter = openFile(jImplRoot + File.separator + cfg.implClassName() + ".java"); + } + if (cfg.emitImpl()) { + cWriter = openFile(nRoot + File.separator + cfg.implClassName() + "_JNI.c"); + } + + if (javaWriter != null) { + CodeGenUtils.emitAutogeneratedWarning(javaWriter, this); + } + if (javaImplWriter != null) { + CodeGenUtils.emitAutogeneratedWarning(javaImplWriter, this); + } + if (cWriter != null) { + CodeGenUtils.emitAutogeneratedWarning(cWriter, this); + } + } + + protected PrintWriter javaWriter() { + if (!cfg.allStatic() && !cfg.emitInterface()) { + throw new InternalError("Should not call this"); + } + return javaWriter; + } + + protected PrintWriter javaImplWriter() { + if (cfg.allStatic() || !cfg.emitImpl()) { + throw new InternalError("Should not call this"); + } + return javaImplWriter; + } + + protected PrintWriter cWriter() { + if (!cfg.emitImpl()) { + throw new InternalError("Should not call this"); + } + return cWriter; + } + + private void closeWriter(PrintWriter writer) throws IOException { + writer.flush(); + writer.close(); + } + + private void closeWriters() throws IOException { + if (javaWriter != null) { + closeWriter(javaWriter); + } + if (javaImplWriter != null) { + closeWriter(javaImplWriter); + } + if (cWriter != null) { + closeWriter(cWriter); + } + javaWriter = null; + javaImplWriter = null; + cWriter = null; + } + + /** + * Returns the value that was specified by the configuration directive + * "JavaOutputDir", or the default if none was specified. + */ + protected String getJavaOutputDir() { + return cfg.javaOutputDir(); + } + + /** + * Returns the value that was specified by the configuration directive + * "Package", or the default if none was specified. + */ + protected String getJavaPackageName() { + return cfg.packageName(); + } + + /** + * Returns the value that was specified by the configuration directive + * "ImplPackage", or the default if none was specified. + */ + protected String getImplPackageName() { + return cfg.implPackageName(); + } + + /** + * Emit all the strings specified in the "CustomJavaCode" parameters of + * the configuration file. + */ + protected void emitCustomJavaCode(PrintWriter writer, String className) throws Exception + { + List code = cfg.customJavaCodeForClass(className); + if (code.size() == 0) + return; + + writer.println(); + writer.println(" // --- Begin CustomJavaCode .cfg declarations"); + for (Iterator iter = code.iterator(); iter.hasNext(); ) { + writer.println((String) iter.next()); + } + writer.println(" // ---- End CustomJavaCode .cfg declarations"); + } + + /** + * Write out any header information for the output files (class declaration + * and opening brace, import statements, etc). + */ + protected void emitAllFileHeaders() throws IOException { + try { + if (cfg.allStatic() || cfg.emitInterface()) { + String[] interfaces; + List userSpecifiedInterfaces = null; + if (cfg.emitInterface()) { + userSpecifiedInterfaces = cfg.extendedInterfaces(cfg.className()); + } else { + userSpecifiedInterfaces = cfg.implementedInterfaces(cfg.className()); + } + interfaces = new String[userSpecifiedInterfaces.size()]; + userSpecifiedInterfaces.toArray(interfaces); + + final List/**/ intfDocs = cfg.javadocForClass(cfg.className()); + CodeGenUtils.EmissionCallback docEmitter = + new CodeGenUtils.EmissionCallback() { + public void emit(PrintWriter w) { + for (Iterator iter = intfDocs.iterator(); iter.hasNext(); ) { + w.println((String) iter.next()); + } + } + }; + + CodeGenUtils.emitJavaHeaders( + javaWriter, + cfg.packageName(), + cfg.className(), + cfg.allStatic() ? true : false, + (String[]) cfg.imports().toArray(new String[] {}), + new String[] { "public" }, + interfaces, + null, + docEmitter); + } + + if (!cfg.allStatic() && cfg.emitImpl()) { + final List/**/ implDocs = cfg.javadocForClass(cfg.implClassName()); + CodeGenUtils.EmissionCallback docEmitter = + new CodeGenUtils.EmissionCallback() { + public void emit(PrintWriter w) { + for (Iterator iter = implDocs.iterator(); iter.hasNext(); ) { + w.println((String) iter.next()); + } + } + }; + + String[] interfaces; + List userSpecifiedInterfaces = null; + userSpecifiedInterfaces = cfg.implementedInterfaces(cfg.implClassName()); + int additionalNum = 0; + if (cfg.className() != null) { + additionalNum = 1; + } + interfaces = new String[additionalNum + userSpecifiedInterfaces.size()]; + userSpecifiedInterfaces.toArray(interfaces); + if (additionalNum == 1) { + interfaces[userSpecifiedInterfaces.size()] = cfg.className(); + } + + CodeGenUtils.emitJavaHeaders( + javaImplWriter, + cfg.implPackageName(), + cfg.implClassName(), + true, + (String[]) cfg.imports().toArray(new String[] {}), + new String[] { "public" }, + interfaces, + null, + docEmitter); + } + + if (cfg.emitImpl()) { + PrintWriter cWriter = cWriter(); + emitCHeader(cWriter, cfg.implClassName()); + } + } catch (Exception e) { + throw new RuntimeException( + "Error emitting all file headers: cfg.allStatic()=" + cfg.allStatic() + + " cfg.emitImpl()=" + cfg.emitImpl() + " cfg.emitInterface()=" + cfg.emitInterface(), + e); + } + + } + + protected void emitCHeader(PrintWriter cWriter, String className) { + cWriter.println("#include "); + cWriter.println(); + + if (getConfig().emitImpl()) { + cWriter.println("#include "); + cWriter.println(); + } + + for (Iterator iter = cfg.customCCode().iterator(); iter.hasNext(); ) { + cWriter.println((String) iter.next()); + } + cWriter.println(); + } + + /** + * Write out any footer information for the output files (closing brace of + * class definition, etc). + */ + protected void emitAllFileFooters(){ + if (cfg.allStatic() || cfg.emitInterface()) { + javaWriter().println(); + javaWriter().println("} // end of class " + cfg.className()); + } + if (!cfg.allStatic() && cfg.emitImpl()) + { + javaImplWriter().println(); + javaImplWriter().println("} // end of class " + cfg.implClassName()); + } + } + + private JavaType javaType(Class c) { + return JavaType.createForClass(c); + } + + /** Maps the C types in the specified function to Java types through + the MethodBinding interface. Note that the JavaTypes in the + returned MethodBinding are "intermediate" JavaTypes (some + potentially representing C pointers rather than true Java types) + and must be lowered to concrete Java types before creating + emitters for them. */ + private MethodBinding bindFunction(FunctionSymbol sym, + JavaType containingType, + Type containingCType) { + + MethodBinding binding = new MethodBinding(sym, containingType, containingCType); + + binding.setRenamedMethodName(cfg.getJavaMethodRename(sym.getName())); + + if (cfg.returnsString(binding.getName())) { + PointerType prt = sym.getReturnType().asPointer(); + if (prt == null || + prt.getTargetType().asInt() == null || + prt.getTargetType().getSize() != 1) { + throw new RuntimeException( + "Cannot apply ReturnsString configuration directive to \"" + sym + + "\". ReturnsString requires native method to have return type \"char *\""); + } + binding.setJavaReturnType(javaType(java.lang.String.class)); + } else { + binding.setJavaReturnType(typeToJavaType(sym.getReturnType(), false)); + } + + // List of the indices of the arguments in this function that should be + // converted from byte[] to String + List stringArgIndices = cfg.stringArguments(binding.getName()); + + for (int i = 0; i < sym.getNumArguments(); i++) { + Type cArgType = sym.getArgumentType(i); + JavaType mappedType = typeToJavaType(cArgType, true); + //System.out.println("C arg type -> \"" + cArgType + "\"" ); + //System.out.println(" Java -> \"" + mappedType + "\"" ); + + // Take into account any ArgumentIsString configuration directives that apply + if (stringArgIndices != null && stringArgIndices.contains(new Integer(i))) { + //System.out.println("Forcing conversion of " + binding.getName() + " arg #" + i + " from byte[] to String "); + if (mappedType.isCVoidPointerType() || + mappedType.isCCharPointerType() || + (mappedType.isArray() && mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass)) { + // convert mapped type from void* and byte[] to String, or ByteBuffer[] to String[] + if (mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass) { + mappedType = javaType(ArrayTypes.stringArrayClass); + } else { + mappedType = javaType(String.class); + } + } + else { + throw new RuntimeException( + "Cannot apply ArgumentIsString configuration directive to " + + "argument " + i + " of \"" + sym + "\": argument type is not " + + "a \"void*\", \"char *\", or \"char**\" equivalent"); + } + } + binding.addJavaArgumentType(mappedType); + //System.out.println("During binding of [" + sym + "], added mapping from C type: " + cArgType + " to Java type: " + mappedType); + } + + //System.err.println("---> " + binding); + //System.err.println(" ---> " + binding.getCSymbol()); + return binding; + } + + + private MethodBinding lowerMethodBindingPointerTypes(MethodBinding inputBinding, + boolean convertToArrays, + boolean[] canProduceArrayVariant) { + MethodBinding result = inputBinding; + boolean arrayPossible = false; + + for (int i = 0; i < inputBinding.getNumArguments(); i++) { + JavaType t = inputBinding.getJavaArgumentType(i); + if (t.isCPrimitivePointerType()) { + if (t.isCVoidPointerType()) { + // These are always bound to java.nio.Buffer + result = result.replaceJavaArgumentType(i, JavaType.forNIOBufferClass()); + } else if (t.isCCharPointerType()) { + arrayPossible = true; + if (convertToArrays) { + result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.byteArrayClass)); + } else { + result = result.replaceJavaArgumentType(i, JavaType.forNIOByteBufferClass()); + } + } else if (t.isCShortPointerType()) { + arrayPossible = true; + if (convertToArrays) { + result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.shortArrayClass)); + } else { + result = result.replaceJavaArgumentType(i, JavaType.forNIOShortBufferClass()); + } + } else if (t.isCInt32PointerType()) { + arrayPossible = true; + if (convertToArrays) { + result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.intArrayClass)); + } else { + result = result.replaceJavaArgumentType(i, JavaType.forNIOIntBufferClass()); + } + } else if (t.isCInt64PointerType()) { + arrayPossible = true; + if (convertToArrays) { + result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.longArrayClass)); + } else { + result = result.replaceJavaArgumentType(i, JavaType.forNIOLongBufferClass()); + } + } else if (t.isCFloatPointerType()) { + arrayPossible = true; + if (convertToArrays) { + result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.floatArrayClass)); + } else { + result = result.replaceJavaArgumentType(i, JavaType.forNIOFloatBufferClass()); + } + } else if (t.isCDoublePointerType()) { + arrayPossible = true; + if (convertToArrays) { + result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.doubleArrayClass)); + } else { + result = result.replaceJavaArgumentType(i, JavaType.forNIODoubleBufferClass()); + } + } else { + throw new RuntimeException("Unknown C pointer type " + t); + } + } + } + + // Always return primitive pointer types as NIO buffers + JavaType t = result.getJavaReturnType(); + if (t.isCPrimitivePointerType()) { + if (t.isCVoidPointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIOByteBufferClass()); + } else if (t.isCCharPointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIOByteBufferClass()); + } else if (t.isCShortPointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIOShortBufferClass()); + } else if (t.isCInt32PointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIOIntBufferClass()); + } else if (t.isCInt64PointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIOLongBufferClass()); + } else if (t.isCFloatPointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIOFloatBufferClass()); + } else if (t.isCDoublePointerType()) { + result = result.replaceJavaArgumentType(-1, JavaType.forNIODoubleBufferClass()); + } else { + throw new RuntimeException("Unknown C pointer type " + t); + } + } + + if (canProduceArrayVariant != null) { + canProduceArrayVariant[0] = arrayPossible; + } + + return result; + } + + // Expands a MethodBinding containing C primitive pointer types into + // multiple variants taking Java primitive arrays and NIO buffers, subject + // to the per-function "NIO only" rule in the configuration file + protected List/**/ expandMethodBinding(MethodBinding binding) { + List result = new ArrayList(); + // Indicates whether it is possible to produce an array variant + // Prevents e.g. char* -> String conversions from emitting two entry points + boolean[] canProduceArrayVariant = new boolean[1]; + + if (binding.signatureUsesCPrimitivePointers() || + binding.signatureUsesCVoidPointers() || + binding.signatureUsesCArrays()) { + result.add(lowerMethodBindingPointerTypes(binding, false, canProduceArrayVariant)); + + // FIXME: should add new configuration flag for this + if (canProduceArrayVariant[0] && + (binding.signatureUsesCPrimitivePointers() || + binding.signatureUsesCArrays()) && + !cfg.nioDirectOnly(binding.getName())) { + result.add(lowerMethodBindingPointerTypes(binding, true, null)); + } + } else { + result.add(binding); + } + + return result; + } + + private String resultName() { + return "_res"; + } + + private Type canonicalize(Type t) { + Type res = (Type) canonMap.get(t); + if (res != null) { + return res; + } + canonMap.put(t, t); + return t; + } +} diff --git a/src/classes/com/sun/gluegen/JavaMethodBindingEmitter.java b/src/classes/com/sun/gluegen/JavaMethodBindingEmitter.java new file mode 100644 index 000000000..8dbb20d28 --- /dev/null +++ b/src/classes/com/sun/gluegen/JavaMethodBindingEmitter.java @@ -0,0 +1,720 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.io.*; +import java.util.*; +import java.text.MessageFormat; + +import com.sun.gluegen.cgram.types.*; +import com.sun.gluegen.cgram.*; + +/** + * An emitter that emits only the interface for a Java<->C JNI binding. + */ +public class JavaMethodBindingEmitter extends FunctionEmitter +{ + public static final EmissionModifier PUBLIC = new EmissionModifier("public"); + public static final EmissionModifier PROTECTED = new EmissionModifier("protected"); + public static final EmissionModifier PRIVATE = new EmissionModifier("private"); + public static final EmissionModifier ABSTRACT = new EmissionModifier("abstract"); + public static final EmissionModifier FINAL = new EmissionModifier("final"); + public static final EmissionModifier NATIVE = new EmissionModifier("native"); + public static final EmissionModifier SYNCHRONIZED = new EmissionModifier("synchronized"); + + protected final CommentEmitter defaultJavaCommentEmitter = new DefaultCommentEmitter(); + protected final CommentEmitter defaultInterfaceCommentEmitter = + new InterfaceCommentEmitter(); + + // Exception type raised in the generated code if runtime checks fail + private String runtimeExceptionType; + + protected boolean emitBody; + protected boolean eraseBufferAndArrayTypes; + protected boolean directNIOOnly; + protected boolean forImplementingMethodCall; + protected boolean forDirectBufferImplementation; + protected boolean forIndirectBufferAndArrayImplementation; + protected boolean isUnimplemented; + + protected MethodBinding binding; + + // Manually-specified prologue and epilogue code + protected List/**/ prologue; + protected List/**/ epilogue; + + // A non-null value indicates that rather than returning a compound + // type accessor we are returning an array of such accessors; this + // expression is a MessageFormat string taking the names of the + // incoming Java arguments as parameters and computing as an int the + // number of elements of the returned array. + private String returnedArrayLengthExpression; + + public JavaMethodBindingEmitter(MethodBinding binding, + PrintWriter output, + String runtimeExceptionType, + boolean emitBody, + boolean eraseBufferAndArrayTypes, + boolean directNIOOnly, + boolean forImplementingMethodCall, + boolean forDirectBufferImplementation, + boolean forIndirectBufferAndArrayImplementation, + boolean isUnimplemented) + { + super(output); + this.binding = binding; + this.runtimeExceptionType = runtimeExceptionType; + this.emitBody = emitBody; + this.eraseBufferAndArrayTypes = eraseBufferAndArrayTypes; + this.directNIOOnly = directNIOOnly; + this.forImplementingMethodCall = forImplementingMethodCall; + this.forDirectBufferImplementation = forDirectBufferImplementation; + this.forIndirectBufferAndArrayImplementation = forIndirectBufferAndArrayImplementation; + this.isUnimplemented = isUnimplemented; + if (forImplementingMethodCall) { + setCommentEmitter(defaultJavaCommentEmitter); + } else { + setCommentEmitter(defaultInterfaceCommentEmitter); + } + } + + public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg) { + super(arg); + binding = arg.binding; + runtimeExceptionType = arg.runtimeExceptionType; + emitBody = arg.emitBody; + eraseBufferAndArrayTypes = arg.eraseBufferAndArrayTypes; + directNIOOnly = arg.directNIOOnly; + forImplementingMethodCall = arg.forImplementingMethodCall; + forDirectBufferImplementation = arg.forDirectBufferImplementation; + forIndirectBufferAndArrayImplementation = arg.forIndirectBufferAndArrayImplementation; + isUnimplemented = arg.isUnimplemented; + returnedArrayLengthExpression = arg.returnedArrayLengthExpression; + prologue = arg.prologue; + epilogue = arg.epilogue; + } + + public final MethodBinding getBinding() { return binding; } + + public boolean isForImplementingMethodCall() { return forImplementingMethodCall; } + + public String getName() { + return binding.getRenamedMethodName(); + } + + protected String getArgumentName(int i) { + return binding.getArgumentName(i); + } + + /** The type of exception (must subclass + java.lang.RuntimeException) raised if runtime + checks fail in the generated code. */ + public String getRuntimeExceptionType() { + return runtimeExceptionType; + } + + /** If the underlying function returns an array (currently only + arrays of compound types are supported) as opposed to a pointer + to an object, this method should be called to provide a + MessageFormat string containing an expression that computes the + number of elements of the returned array. The parameters to the + MessageFormat expression are the names of the incoming Java + arguments. */ + public void setReturnedArrayLengthExpression(String expr) { + returnedArrayLengthExpression = expr; + } + + /** Sets the manually-generated prologue code for this emitter. */ + public void setPrologue(List/**/ prologue) { + this.prologue = prologue; + } + + /** Sets the manually-generated epilogue code for this emitter. */ + public void setEpilogue(List/**/ epilogue) { + this.epilogue = epilogue; + } + + /** Indicates whether this emitter will print only a signature, or + whether it will emit Java code for the body of the method as + well. */ + public boolean signatureOnly() { + return !emitBody; + } + + /** Accessor for subclasses. */ + public void setEmitBody(boolean emitBody) { + this.emitBody = emitBody; + } + + /** Accessor for subclasses. */ + public void setEraseBufferAndArrayTypes(boolean erase) { + this.eraseBufferAndArrayTypes = erase; + } + + /** Accessor for subclasses. */ + public void setForImplementingMethodCall(boolean impl) { + this.forImplementingMethodCall = impl; + } + + protected void emitReturnType(PrintWriter writer) + { + writer.print(getReturnTypeString(false)); + } + + protected String erasedTypeString(JavaType type, boolean skipBuffers) { + if (eraseBufferAndArrayTypes) { + if (type.isNIOBuffer() || + type.isPrimitiveArray()) { + if (!skipBuffers) { + // Direct buffers and arrays sent down as Object (but + // returned as e.g. ByteBuffer) + return "Object"; + } + } else if (type.isCompoundTypeWrapper()) { + // Compound type wrappers are unwrapped to ByteBuffer + return "java.nio.ByteBuffer"; + } else if (type.isArrayOfCompoundTypeWrappers()) { + return "java.nio.ByteBuffer"; + } + } + return type.getName(); + } + + protected String getReturnTypeString(boolean skipArray) { + // The first arm of the "if" clause is used by the glue code + // generation for arrays of compound type wrappers + if (skipArray || + // The following arm is used by most other kinds of return types + (getReturnedArrayLengthExpression() == null && + !binding.getJavaReturnType().isArrayOfCompoundTypeWrappers()) || + // The following arm is used specifically to get the splitting up + // of one returned ByteBuffer into an array of compound type + // wrappers to work (e.g., XGetVisualInfo) + (eraseBufferAndArrayTypes && + binding.getJavaReturnType().isCompoundTypeWrapper() && + (getReturnedArrayLengthExpression() != null))) { + return erasedTypeString(binding.getJavaReturnType(), true); + } + return erasedTypeString(binding.getJavaReturnType(), true) + "[]"; + } + + protected void emitName(PrintWriter writer) + { + if (forImplementingMethodCall) { + if (forIndirectBufferAndArrayImplementation) { + writer.print(getImplMethodName(false)); + } else { + writer.print(getImplMethodName(true)); + } + } else { + writer.print(getName()); + } + } + + protected int emitArguments(PrintWriter writer) + { + boolean needComma = false; + int numEmitted = 0; + + if (forImplementingMethodCall && binding.hasContainingType()) { + // Always emit outgoing "this" argument + writer.print("java.nio.ByteBuffer "); + writer.print(javaThisArgumentName()); + ++numEmitted; + needComma = true; + } + + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType type = binding.getJavaArgumentType(i); + if (type.isVoid()) { + // Make sure this is the only param to the method; if it isn't, + // there's something wrong with our parsing of the headers. + if (binding.getNumArguments() != 1) { + throw new InternalError( + "\"void\" argument type found in " + + "multi-argument function \"" + binding + "\""); + } + continue; + } + + if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { + // Don't need to expose these at the Java level + continue; + } + + if (needComma) { + writer.print(", "); + } + + writer.print(erasedTypeString(type, false)); + writer.print(" "); + writer.print(getArgumentName(i)); + + ++numEmitted; + needComma = true; + + // Add Buffer and array index offset arguments after each associated argument + if (forDirectBufferImplementation || forIndirectBufferAndArrayImplementation) { + if (type.isNIOBuffer()) { + writer.print(", int " + byteOffsetArgName(i)); + } else if (type.isNIOBufferArray()) { + writer.print(", int[] " + + byteOffsetArrayArgName(i)); + } + } + + // Add offset argument after each primitive array + if (type.isPrimitiveArray()) { + writer.print(", int " + offsetArgName(i)); + } + } + return numEmitted; + } + + + protected String getImplMethodName(boolean direct) { + if (direct) { + return binding.getRenamedMethodName() + "0"; + } else { + return binding.getRenamedMethodName() + "1"; + } + } + + protected String byteOffsetArgName(int i) { + return byteOffsetArgName(getArgumentName(i)); + } + + protected String byteOffsetArgName(String s) { + return s + "_byte_offset"; + } + + protected String byteOffsetArrayArgName(int i) { + return getArgumentName(i) + "_byte_offset_array"; + } + + protected String offsetArgName(int i) { + return getArgumentName(i) + "_offset"; + } + + protected void emitBody(PrintWriter writer) + { + if (!emitBody) { + writer.println(';'); + } else { + MethodBinding binding = getBinding(); + writer.println(); + writer.println(" {"); + if (isUnimplemented) { + writer.println(" throw new " + getRuntimeExceptionType() + "(\"Unimplemented\");"); + } else { + emitPrologueOrEpilogue(prologue, writer); + emitPreCallSetup(binding, writer); + //emitReturnVariableSetup(binding, writer); + emitReturnVariableSetupAndCall(binding, writer); + emitPrologueOrEpilogue(epilogue, writer); + } + writer.println(" }"); + } + } + + protected void emitPrologueOrEpilogue(List/**/ code, PrintWriter writer) { + if (code != null) { + for (Iterator iter = code.iterator(); iter.hasNext(); ) { + writer.println(" " + (String) iter.next()); + } + } + } + + protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) { + emitArrayLengthAndNIOBufferChecks(binding, writer); + } + + protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer) { + int numBufferOffsetArrayArgs = 0; + boolean firstBuffer = true; + // Check lengths of any incoming arrays if necessary + for (int i = 0; i < binding.getNumArguments(); i++) { + Type type = binding.getCArgumentType(i); + if (type.isArray()) { + ArrayType arrayType = type.asArray(); + writer.println(" if (" + getArgumentName(i) + ".length < " + + arrayType.getLength() + ")"); + writer.println(" throw new " + getRuntimeExceptionType() + + "(\"Length of array \\\"" + getArgumentName(i) + + "\\\" was less than the required " + arrayType.getLength() + "\");"); + } else { + JavaType javaType = binding.getJavaArgumentType(i); + if (javaType.isNIOBuffer()) { + if (directNIOOnly) { + writer.println(" if (!BufferFactory.isDirect(" + getArgumentName(i) + "))"); + writer.println(" throw new " + getRuntimeExceptionType() + "(\"Argument \\\"" + + getArgumentName(i) + "\\\" was not a direct buffer\");"); + } else { + if(firstBuffer) { + firstBuffer = false; + writer.println(" boolean _direct = BufferFactory.isDirect(" + getArgumentName(i) + ");"); + } else { + writer.println(" if (_direct != BufferFactory.isDirect(" + getArgumentName(i) + "))"); + writer.println(" throw new " + getRuntimeExceptionType() + + "(\"Argument \\\"" + getArgumentName(i) + + "\\\" : Buffers passed to this method must all be either direct or indirect\");"); + } + } + } else if (javaType.isNIOBufferArray()) { + // All buffers passed down in an array of NIO buffers must be direct + String argName = getArgumentName(i); + String arrayName = byteOffsetArrayArgName(i); + writer.println(" int[] " + arrayName + " = new int[" + argName + ".length];"); + // Check direct buffer properties of all buffers within + writer.println(" if (" + argName + " != null) {"); + writer.println(" for (int _ctr = 0; _ctr < " + argName + ".length; _ctr++) {"); + writer.println(" if (!BufferFactory.isDirect(" + argName + "[_ctr])) {"); + writer.println(" throw new " + getRuntimeExceptionType() + + "(\"Element \" + _ctr + \" of argument \\\"" + + getArgumentName(i) + "\\\" was not a direct buffer\");"); + writer.println(" }"); + // get the Buffer Array offset values and save them into another array to send down to JNI + writer.print (" " + arrayName + "[_ctr] = BufferFactory.getDirectBufferByteOffset("); + writer.println(argName + "[_ctr]);"); + writer.println(" }"); + writer.println(" }"); + } else if (javaType.isPrimitiveArray()) { + String argName = getArgumentName(i); + String offsetArg = offsetArgName(i); + writer.println(" if(" + argName + " != null && " + argName + ".length <= " + offsetArg + ")"); + writer.print (" throw new " + getRuntimeExceptionType()); + writer.println("(\"array offset argument \\\"" + offsetArg + "\\\" (\" + " + offsetArg + + " + \") equals or exceeds array length (\" + " + argName + ".length + \")\");"); + } + } + } + } + + protected void emitCall(MethodBinding binding, PrintWriter writer, boolean direct) { + writer.print(getImplMethodName(direct)); + writer.print("("); + emitCallArguments(binding, writer, direct); + writer.print(");"); + } + + + protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer) { + writer.print(" "); + JavaType returnType = binding.getJavaReturnType(); + boolean needsResultAssignment = false; + + if (!returnType.isVoid()) { + if (returnType.isCompoundTypeWrapper() || + returnType.isNIOByteBuffer()) { + writer.println("ByteBuffer _res;"); + needsResultAssignment = true; + } else if (returnType.isArrayOfCompoundTypeWrappers()) { + writer.println("ByteBuffer[] _res;"); + needsResultAssignment = true; + } + } + + if (binding.signatureCanUseIndirectNIO() && !directNIOOnly) { + // Must generate two calls for this gated on whether the NIO + // buffers coming in are all direct or indirect + writer.println("if (_direct) {"); + writer.print (" "); + } + + if (needsResultAssignment) { + writer.print(" _res = "); + } else { + writer.print(" "); + if (!returnType.isVoid()) { + writer.print("return "); + } + } + + if (binding.signatureUsesJavaPrimitiveArrays() && + !binding.signatureCanUseIndirectNIO()) { + // FIXME: what happens with a C function of the form + // void foo(int* arg0, void* arg1); + // ? + + // Only one call being made in this body, going to indirect + // buffer / array entry point + emitCall(binding, writer, false); + writer.println(); + } else { + emitCall(binding, writer, true); + } + + if (binding.signatureCanUseIndirectNIO() && !directNIOOnly) { + // Must generate two calls for this gated on whether the NIO + // buffers coming in are all direct or indirect + writer.println(); + writer.println(" } else {"); + writer.print (" "); + if (needsResultAssignment) { + writer.print(" _res = "); + } else { + writer.print(" "); + if (!returnType.isVoid()) { + writer.print("return "); + } + } + emitCall(binding, writer, false); + writer.println(); + writer.println(" }"); + } else { + writer.println(); + } + if (needsResultAssignment) { + emitCallResultReturn(binding, writer); + } + } + + protected int emitCallArguments(MethodBinding binding, PrintWriter writer, boolean direct) { + boolean needComma = false; + int numArgsEmitted = 0; + + if (binding.hasContainingType()) { + // Emit this pointer + assert(binding.getContainingType().isCompoundTypeWrapper()); + writer.print("getBuffer()"); + needComma = true; + ++numArgsEmitted; + } + for (int i = 0; i < binding.getNumArguments(); i++) { + JavaType type = binding.getJavaArgumentType(i); + if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { + // Don't need to expose these at the Java level + continue; + } + + if (type.isVoid()) { + // Make sure this is the only param to the method; if it isn't, + // there's something wrong with our parsing of the headers. + assert(binding.getNumArguments() == 1); + continue; + } + + if (needComma) { + writer.print(", "); + } + + if (type.isCompoundTypeWrapper()) { + writer.print("(("); + } + + if (type.isNIOBuffer() && !direct) { + writer.print("BufferFactory.getArray(" + getArgumentName(i) + ")"); + } else { + writer.print(getArgumentName(i)); + } + + if (type.isCompoundTypeWrapper()) { + writer.print(" == null) ? null : "); + writer.print(getArgumentName(i)); + writer.print(".getBuffer())"); + } + needComma = true; + ++numArgsEmitted; + if (type.isNIOBuffer()) { + if (direct) { + writer.print(", BufferFactory.getDirectBufferByteOffset(" + getArgumentName(i) + ")"); + } else { + writer.print(", BufferFactory.getIndirectBufferByteOffset(" + getArgumentName(i) + ")"); + } + } else if (type.isNIOBufferArray()) { + writer.print(", " + byteOffsetArrayArgName(i)); + } + + // Add Array offset parameter for primitive arrays + if (type.isPrimitiveArray()) { + if(type.isFloatArray()) { + writer.print(", BufferFactory.SIZEOF_FLOAT * "); + } else if(type.isDoubleArray()) { + writer.print(", BufferFactory.SIZEOF_DOUBLE * "); + } else if(type.isByteArray()) { + writer.print(", "); + } else if(type.isLongArray()) { + writer.print(", BufferFactory.SIZEOF_LONG * "); + } else if(type.isShortArray()) { + writer.print(", BufferFactory.SIZEOF_SHORT * "); + } else if(type.isIntArray()) { + writer.print(", BufferFactory.SIZEOF_INT * "); + } else { + throw new RuntimeException("Unsupported type for calculating array offset argument for " + + getArgumentName(i) + + "-- error occurred while processing Java glue code for " + getName()); + } + writer.print(offsetArgName(i)); + } + } + return numArgsEmitted; + } + + protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer) { + JavaType returnType = binding.getJavaReturnType(); + + if (returnType.isCompoundTypeWrapper()) { + String fmt = getReturnedArrayLengthExpression(); + writer.println(" if (_res == null) return null;"); + if (fmt == null) { + writer.print(" return new " + returnType.getName() + "(_res.order(ByteOrder.nativeOrder()))"); + } else { + writer.println(" _res.order(ByteOrder.nativeOrder());"); + String[] argumentNames = new String[binding.getNumArguments()]; + for (int i = 0; i < binding.getNumArguments(); i++) { + argumentNames[i] = getArgumentName(i); + } + String expr = new MessageFormat(fmt).format(argumentNames); + PointerType cReturnTypePointer = binding.getCReturnType().asPointer(); + CompoundType cReturnType = null; + if (cReturnTypePointer != null) { + cReturnType = cReturnTypePointer.getTargetType().asCompound(); + } + if (cReturnType == null) { + throw new RuntimeException("ReturnedArrayLength directive currently only supported for pointers to compound types " + + "(error occurred while generating Java glue code for " + getName() + ")"); + } + writer.println(" " + getReturnTypeString(false) + " _retarray = new " + getReturnTypeString(true) + "[" + expr + "];"); + writer.println(" for (int _count = 0; _count < " + expr + "; _count++) {"); + // Create temporary ByteBuffer slice + // FIXME: probably need Type.getAlignedSize() for arrays of + // compound types (rounding up to machine-dependent alignment) + writer.println(" _res.position(_count * " + cReturnType.getSize() + ");"); + writer.println(" _res.limit ((1 + _count) * " + cReturnType.getSize() + ");"); + writer.println(" ByteBuffer _tmp = _res.slice();"); + writer.println(" _tmp.order(ByteOrder.nativeOrder());"); + writer.println(" _res.position(0);"); + writer.println(" _res.limit(_res.capacity());"); + writer.println(" _retarray[_count] = new " + getReturnTypeString(true) + "(_tmp);"); + writer.println(" }"); + writer.print (" return _retarray"); + } + writer.println(";"); + } else if (returnType.isNIOBuffer()) { + writer.println(" if (_res == null) return null;"); + writer.println(" return _res.order(ByteOrder.nativeOrder());"); + } else if (returnType.isArrayOfCompoundTypeWrappers()) { + writer.println(" if (_res == null) return null;"); + writer.println(" " + getReturnTypeString(false) + " _retarray = new " + getReturnTypeString(true) + "[_res.length];"); + writer.println(" for (int _count = 0; _count < _res.length; _count++) {"); + writer.println(" _retarray[_count] = new " + getReturnTypeString(true) + "(_res[_count]);"); + writer.println(" }"); + writer.println(" return _retarray;"); + } + } + + public static String javaThisArgumentName() { + return "jthis0"; + } + + protected String getCommentStartString() { return "/** "; } + + protected String getBaseIndentString() { return " "; } + + protected String getReturnedArrayLengthExpression() { + return returnedArrayLengthExpression; + } + + /** + * Class that emits a generic comment for JavaMethodBindingEmitters; the comment + * includes the C signature of the native method that is being bound by the + * emitter java method. + */ + protected class DefaultCommentEmitter implements CommentEmitter { + public void emit(FunctionEmitter emitter, PrintWriter writer) { + emitBeginning(emitter, writer); + emitBindingCSignature(((JavaMethodBindingEmitter)emitter).getBinding(), writer); + emitEnding(emitter, writer); + } + protected void emitBeginning(FunctionEmitter emitter, PrintWriter writer) { + writer.print("Entry point to C language function:
"); + } + protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + writer.print(" "); + writer.print(binding.getCSymbol()); + writer.print(" "); + } + protected void emitEnding(FunctionEmitter emitter, PrintWriter writer) { + // If argument type is a named enum, then emit a comment detailing the + // acceptable values of that enum. + // If we're emitting a direct buffer variant only, then declare + // that the NIO buffer arguments must be direct. + MethodBinding binding = ((JavaMethodBindingEmitter)emitter).getBinding(); + for (int i = 0; i < binding.getNumArguments(); i++) { + Type type = binding.getCArgumentType(i); + JavaType javaType = binding.getJavaArgumentType(i); + // don't emit param comments for anonymous enums, since we can't + // distinguish between the values found within multiple anonymous + // enums in the same C translation unit. + if (type.isEnum() && type.getName() != HeaderParser.ANONYMOUS_ENUM_NAME) { + EnumType enumType = (EnumType)type; + writer.println(); + writer.print(emitter.getBaseIndentString()); + writer.print(" "); + writer.print("@param "); + writer.print(getArgumentName(i)); + writer.print(" valid values are: "); + for (int j = 0; j < enumType.getNumEnumerates(); ++j) { + if (j>0) writer.print(", "); + writer.print(enumType.getEnumName(j)); + } + writer.println(""); + } else if (directNIOOnly && javaType.isNIOBuffer()) { + writer.println(); + writer.print(emitter.getBaseIndentString()); + writer.print(" "); + writer.print("@param "); + writer.print(getArgumentName(i)); + writer.print(" a direct {@link " + javaType.getName() + "}"); + } + } + } + } + + protected class InterfaceCommentEmitter + extends JavaMethodBindingEmitter.DefaultCommentEmitter + { + protected void emitBeginning(FunctionEmitter emitter, + PrintWriter writer) { + writer.print("Interface to C language function:
"); + } + } +} + diff --git a/src/classes/com/sun/gluegen/JavaType.java b/src/classes/com/sun/gluegen/JavaType.java new file mode 100644 index 000000000..496fd6961 --- /dev/null +++ b/src/classes/com/sun/gluegen/JavaType.java @@ -0,0 +1,549 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.nio.*; + +import com.sun.gluegen.cgram.types.*; + +/** + * Describes a java-side representation of a type that is used to represent + * the same data on both the Java-side and C-side during a JNI operation. Also + * contains some utility methods for creating common types. + */ +public class JavaType { + private static final int PTR_C_VOID = 1; + private static final int PTR_C_CHAR = 2; + private static final int PTR_C_SHORT = 3; + private static final int PTR_C_INT32 = 4; + private static final int PTR_C_INT64 = 5; + private static final int PTR_C_FLOAT = 6; + private static final int PTR_C_DOUBLE = 7; + + private Class clazz; // Primitive types and other types representable as Class objects + private String name; // Types we're generating glue code for (i.e., C structs) + private Type elementType; // Element type if this JavaType represents a C array + private int primitivePointerType; // Represents C arrays that + // will / can be represented + // with NIO buffers (resolved + // down to another JavaType + // later in processing) + private static JavaType nioBufferType; + private static JavaType nioByteBufferType; + private static JavaType nioShortBufferType; + private static JavaType nioIntBufferType; + private static JavaType nioLongBufferType; + private static JavaType nioFloatBufferType; + private static JavaType nioDoubleBufferType; + private static JavaType nioByteBufferArrayType; + + public boolean equals(Object arg) { + if ((arg == null) || (!(arg instanceof JavaType))) { + return false; + } + JavaType t = (JavaType) arg; + return (this == t || + (t.clazz == clazz && + ((name == t.name) || + ((name != null) && (t.name != null) && (name.equals(t.name)))) && + ((elementType == t.elementType) || + (elementType != null) && (t.elementType != null) && (elementType.equals(t.elementType))) && + (primitivePointerType == t.primitivePointerType))); + } + + public int hashCode() { + if (clazz == null) { + if (name == null) { + return 0; + } + return name.hashCode(); + } + return clazz.hashCode(); + } + + public JavaType getElementType() { + return new JavaType(elementType); + } + + /** Creates a JavaType corresponding to the given Java type. This + can be used to represent arrays of primitive values or Strings; + the emitters understand how to perform proper conversion from + the corresponding C type. */ + public static JavaType createForClass(Class clazz) { + return new JavaType(clazz); + } + + /** Creates a JavaType corresponding to the specified C CompoundType + name; for example, if "Foo" is supplied, then this JavaType + represents a "Foo *" by way of a StructAccessor. */ + public static JavaType createForCStruct(String name) { + return new JavaType(name); + } + + /** Creates a JavaType corresponding to an array of the given + element type. This is used to represent arrays of "Foo **" which + should be mapped to Foo[] in Java. */ + public static JavaType createForCArray(Type elementType) { + return new JavaType(elementType); + } + + public static JavaType createForVoidPointer() { + return new JavaType(PTR_C_VOID); + } + + public static JavaType createForCCharPointer() { + return new JavaType(PTR_C_CHAR); + } + + public static JavaType createForCShortPointer() { + return new JavaType(PTR_C_SHORT); + } + + public static JavaType createForCInt32Pointer() { + return new JavaType(PTR_C_INT32); + } + + public static JavaType createForCInt64Pointer() { + return new JavaType(PTR_C_INT64); + } + + public static JavaType createForCFloatPointer() { + return new JavaType(PTR_C_FLOAT); + } + + public static JavaType createForCDoublePointer() { + return new JavaType(PTR_C_DOUBLE); + } + + public static JavaType createForJNIEnv() { + return createForCStruct("JNIEnv"); + } + + public static JavaType forNIOBufferClass() { + if (nioBufferType == null) { + nioBufferType = createForClass(java.nio.Buffer.class); + } + return nioBufferType; + } + + public static JavaType forNIOByteBufferClass() { + if (nioByteBufferType == null) { + nioByteBufferType = createForClass(java.nio.ByteBuffer.class); + } + return nioByteBufferType; + } + + public static JavaType forNIOShortBufferClass() { + if (nioShortBufferType == null) { + nioShortBufferType = createForClass(java.nio.ShortBuffer.class); + } + return nioShortBufferType; + } + + public static JavaType forNIOIntBufferClass() { + if (nioIntBufferType == null) { + nioIntBufferType = createForClass(java.nio.IntBuffer.class); + } + return nioIntBufferType; + } + + public static JavaType forNIOLongBufferClass() { + if (nioLongBufferType == null) { + nioLongBufferType = createForClass(java.nio.LongBuffer.class); + } + return nioLongBufferType; + } + + public static JavaType forNIOFloatBufferClass() { + if (nioFloatBufferType == null) { + nioFloatBufferType = createForClass(java.nio.FloatBuffer.class); + } + return nioFloatBufferType; + } + + public static JavaType forNIODoubleBufferClass() { + if (nioDoubleBufferType == null) { + nioDoubleBufferType = createForClass(java.nio.DoubleBuffer.class); + } + return nioDoubleBufferType; + } + + public static JavaType forNIOByteBufferArrayClass() { + if (nioByteBufferArrayType == null) { + ByteBuffer[] tmp = new ByteBuffer[0]; + nioByteBufferArrayType = createForClass(tmp.getClass()); + } + return nioByteBufferArrayType; + } + + /** + * Returns the Java Class corresponding to this type. Returns null if this + * object corresponds to a C primitive array type. + */ + public Class getJavaClass() { + return clazz; + } + + /** + * Returns the Java type name corresponding to this type. + */ + public String getName() { + if (clazz != null) { + if (clazz.isArray()) { + return arrayName(clazz); + } + return clazz.getName(); + } + if (elementType != null) { + return elementType.getName(); + } + return name; + } + + /** + * Returns the descriptor (internal type signature) corresponding to + * this type. + */ + public String getDescriptor() { + // FIXME: this is not completely accurate at this point (for + // example, it knows nothing about the packages for compound + // types) + if (clazz != null) { + return descriptor(clazz); + } + if (elementType != null) { + return "[" + descriptor(elementType.getName()); + } + return descriptor(name); + } + + /** Returns the String corresponding to the JNI type for this type, + or NULL if it can't be represented (i.e., it's a boxing class + that we need to call getBuffer() on.) */ + public String jniTypeName() { + if (isCompoundTypeWrapper()) { + // These are sent down as Buffers (e.g., jobject) + return "jobject"; + } + + if (isArrayOfCompoundTypeWrappers()) { + // These are returned as arrays of ByteBuffers (e.g., jobjectArray) + return "jobjectArray /* of ByteBuffer */"; + } + + if (clazz == null) { + return null; + } + + if (isVoid()) { + return "void"; + } + + if (isPrimitive()) { + return "j" + clazz.getName(); + } + + if (isPrimitiveArray() || isNIOBuffer()) { + // We now pass primitive arrays and buffers uniformly down to native code as java.lang.Object. + return "jobject"; + } + + if (isArray()) { + if (isStringArray()) { + return "jobjectArray /*elements are String*/"; + } + + Class elementType = clazz.getComponentType(); + + if (isNIOBufferArray()) { + return "jobjectArray /*elements are " + elementType.getName() + "*/"; + } + + if (elementType.isArray()) { + // Type is array-of-arrays-of-something + + if (elementType.getComponentType().isPrimitive()) { + // Type is an array-of-arrays-of-primitive + return "jobjectArray /* elements are " + elementType.getComponentType() + "[]*/"; + //return "jobjectArray"; + } else { + throw new RuntimeException("Multi-dimensional arrays of types that are not primitives or Strings are not supported."); + } + } + + // Some unusual type that we don't handle + throw new RuntimeException("Unexpected and unsupported array type: \"" + this + "\""); + } + + if (isString()) { + return "jstring"; + } + + return "jobject"; + } + + public boolean isNIOBuffer() { + return (clazz != null && java.nio.Buffer.class.isAssignableFrom(clazz)); + } + + public boolean isNIOByteBuffer() { + return (clazz == java.nio.ByteBuffer.class); + } + + public boolean isNIOByteBufferArray() { + return (this == nioByteBufferArrayType); + } + + public boolean isNIOBufferArray() { + return (isArray() && + (java.nio.Buffer.class.isAssignableFrom(clazz.getComponentType()))); + } + + public boolean isString() { + return (clazz == java.lang.String.class); + } + + public boolean isArray() { + return ((clazz != null) && clazz.isArray()); + } + + public boolean isFloatArray() { + return(clazz.isArray() && clazz.getComponentType() == Float.TYPE); + } + + public boolean isDoubleArray() { + return(clazz.isArray() && clazz.getComponentType() == Double.TYPE); + } + + public boolean isByteArray() { + return(clazz.isArray() && clazz.getComponentType() == Byte.TYPE); + } + + public boolean isIntArray() { + return(clazz.isArray() && clazz.getComponentType() == Integer.TYPE); + } + + public boolean isShortArray() { + return(clazz.isArray() && clazz.getComponentType() == Short.TYPE); + } + + public boolean isLongArray() { + return(clazz.isArray() && clazz.getComponentType() == Long.TYPE); + } + + public boolean isStringArray() { + return(clazz.isArray() && clazz.getComponentType() == java.lang.String.class); + } + + + public boolean isPrimitive() { + return ((clazz != null) && !isArray() && clazz.isPrimitive() && (clazz != Void.TYPE)); + } + + public boolean isPrimitiveArray() { + return (isArray() && (clazz.getComponentType().isPrimitive())); + } + + public boolean isShort() { + return (clazz == Short.TYPE); + } + + public boolean isFloat() { + return (clazz == Float.TYPE); + } + + public boolean isDouble() { + return (clazz == Double.TYPE); + } + + public boolean isByte() { + return (clazz == Byte.TYPE); + } + + public boolean isLong() { + return (clazz == Long.TYPE); + } + + public boolean isInt() { + return (clazz == Integer.TYPE); + } + + public boolean isVoid() { + return (clazz == Void.TYPE); + } + + public boolean isCompoundTypeWrapper() { + return (clazz == null && name != null && !isJNIEnv()); + } + + public boolean isArrayOfCompoundTypeWrappers() { + return (elementType != null); + } + + public boolean isCPrimitivePointerType() { + return (primitivePointerType != 0); + } + + public boolean isCVoidPointerType() { + return (primitivePointerType == PTR_C_VOID); + } + + public boolean isCCharPointerType() { + return (primitivePointerType == PTR_C_CHAR); + } + + public boolean isCShortPointerType() { + return (primitivePointerType == PTR_C_SHORT); + } + + public boolean isCInt32PointerType() { + return (primitivePointerType == PTR_C_INT32); + } + + public boolean isCInt64PointerType() { + return (primitivePointerType == PTR_C_INT64); + } + + public boolean isCFloatPointerType() { + return (primitivePointerType == PTR_C_FLOAT); + } + + public boolean isCDoublePointerType() { + return (primitivePointerType == PTR_C_DOUBLE); + } + + public boolean isJNIEnv() { + return clazz == null && name == "JNIEnv"; + } + + public Object clone() { + JavaType clone = new JavaType(primitivePointerType); + + clone.clazz = this.clazz; + clone.name = this.name; + clone.elementType = this.elementType; + + return clone; + } + + public String toString() { + return getName(); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + // For debugging + public void dump() { + System.err.println("[clazz = " + clazz + " , name = " + name + " , elementType = " + elementType + " , primitivePointerType = " + primitivePointerType + "]"); + } + + /** + * Constructs a representation for a type corresponding to the given Class + * argument. + */ + private JavaType(Class clazz) { + this.clazz = clazz; + } + + /** Constructs a type representing a named C struct. */ + private JavaType(String name) { + this.name = name; + } + + /** Constructs a type representing an array of C pointers. */ + private JavaType(Type elementType) { + this.elementType = elementType; + } + + /** Constructs a type representing a pointer to a C primitive + (integer, floating-point, or void pointer) type. */ + private JavaType(int primitivePointerType) { + this.primitivePointerType = primitivePointerType; + } + + private String arrayName(Class clazz) { + StringBuffer buf = new StringBuffer(); + int arrayCount = 0; + while (clazz.isArray()) { + ++arrayCount; + clazz = clazz.getComponentType(); + } + buf.append(clazz.getName()); + while (--arrayCount >= 0) { + buf.append("[]"); + } + return buf.toString(); + } + + private String arrayDescriptor(Class clazz) { + StringBuffer buf = new StringBuffer(); + int arrayCount = 0; + while (clazz.isArray()) { + buf.append("["); + clazz = clazz.getComponentType(); + } + buf.append(descriptor(clazz)); + return buf.toString(); + } + + private String descriptor(Class clazz) { + if (clazz.isPrimitive()) { + if (clazz == Boolean.TYPE) return "Z"; + if (clazz == Byte.TYPE) return "B"; + if (clazz == Double.TYPE) return "D"; + if (clazz == Float.TYPE) return "F"; + if (clazz == Integer.TYPE) return "I"; + if (clazz == Long.TYPE) return "J"; + if (clazz == Short.TYPE) return "S"; + if (clazz == Void.TYPE) return "V"; + throw new RuntimeException("Unexpected primitive type " + clazz.getName()); + } + if (clazz.isArray()) { + return arrayDescriptor(clazz); + } + return descriptor(clazz.getName()); + } + + private String descriptor(String referenceTypeName) { + return "L" + referenceTypeName.replace('.', '/') + ";"; + } +} diff --git a/src/classes/com/sun/gluegen/MethodBinding.java b/src/classes/com/sun/gluegen/MethodBinding.java new file mode 100644 index 000000000..b8ebb092a --- /dev/null +++ b/src/classes/com/sun/gluegen/MethodBinding.java @@ -0,0 +1,571 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.util.*; + +import com.sun.gluegen.cgram.types.*; + +/** Represents the binding of a C function to a Java method. Also used + to represent calls through function pointers contained in + structs. */ + +public class MethodBinding { + + private FunctionSymbol sym; + private String renamedMethodName; + private JavaType javaReturnType; + private List javaArgumentTypes; + private boolean computedSignatureProperties; + private boolean argumentsUseNIO; + private boolean signatureUsesNIO; + private boolean signatureCanUseIndirectNIO; + private boolean signatureUsesCompoundTypeWrappers; + private boolean signatureUsesCVoidPointers; + private boolean signatureUsesCPrimitivePointers; + private boolean signatureUsesCArrays; + private boolean signatureUsesJavaPrimitiveArrays; + private JavaType containingType; + private Type containingCType; + private int thisPointerIndex = -1; + + /** + * Constructs a new MethodBinding that is an exact clone of the + * argument, including the java return type and java argument + * types. It's safe to modify this binding after construction. + */ + public MethodBinding(MethodBinding bindingToCopy) { + this.sym = bindingToCopy.sym; + + this.renamedMethodName = bindingToCopy.renamedMethodName; + this.containingType = bindingToCopy.containingType; + this.containingCType = bindingToCopy.containingCType; + this.javaReturnType = bindingToCopy.javaReturnType; + this.javaArgumentTypes = (List)((ArrayList)bindingToCopy.javaArgumentTypes).clone(); + this.computedSignatureProperties = bindingToCopy.computedSignatureProperties; + this.argumentsUseNIO = bindingToCopy.argumentsUseNIO; + this.signatureUsesNIO = bindingToCopy.signatureUsesNIO; + this.signatureCanUseIndirectNIO = bindingToCopy.signatureCanUseIndirectNIO; + this.signatureUsesCompoundTypeWrappers = bindingToCopy.signatureUsesCompoundTypeWrappers; + this.signatureUsesCVoidPointers = bindingToCopy.signatureUsesCVoidPointers; + this.signatureUsesCPrimitivePointers = bindingToCopy.signatureUsesCPrimitivePointers; + this.signatureUsesCArrays = bindingToCopy.signatureUsesCArrays; + this.signatureUsesJavaPrimitiveArrays = bindingToCopy.signatureUsesJavaPrimitiveArrays; + this.thisPointerIndex = bindingToCopy.thisPointerIndex; + } + + /** Constructor for calling a C function. */ + public MethodBinding(FunctionSymbol sym) { + this.sym = sym; + } + + /** Constructor for calling a function pointer contained in a + struct. */ + public MethodBinding(FunctionSymbol sym, JavaType containingType, Type containingCType) { + this.sym = sym; + this.containingType = containingType; + this.containingCType = containingCType; + } + + public void setJavaReturnType(JavaType type) { + javaReturnType = type; + computedSignatureProperties = false; + } + + public void addJavaArgumentType(JavaType type) { + if (javaArgumentTypes == null) { + javaArgumentTypes = new ArrayList(); + } + javaArgumentTypes.add(type); + computedSignatureProperties = false; + } + + public JavaType getJavaReturnType() { + return javaReturnType; + } + + public int getNumArguments() { + return sym.getNumArguments(); + } + + public JavaType getJavaArgumentType(int i) { + return (JavaType) javaArgumentTypes.get(i); + } + + public Type getCReturnType() { + return sym.getReturnType(); + } + + public Type getCArgumentType(int i) { + return sym.getArgumentType(i); + } + + public FunctionSymbol getCSymbol() { + return sym; + } + + /** Returns either the argument name specified by the underlying + FunctionSymbol or a fabricated argument name based on the + position. Note that it is currently not guaranteed that there + are no namespace clashes with these fabricated argument + names. */ + public String getArgumentName(int i) { + String ret = sym.getArgumentName(i); + if (ret != null) { + return ret; + } + return "arg" + i; + } + + public String getName() { + return sym.getName(); + } + + public String getRenamedMethodName() { + // Defaults to same as C symbol unless renamed + if (renamedMethodName != null) { + return renamedMethodName; + } + return sym.getName(); + } + + /** Supports renaming C function in Java binding. */ + public void setRenamedMethodName(String name) { + renamedMethodName = name; + } + + /** Creates a new MethodBinding replacing the specified Java + argument type with a new argument type. If argumentNumber is + less than 0 then replaces the return type. */ + public MethodBinding replaceJavaArgumentType(int argumentNumber, + JavaType newArgType) { + MethodBinding binding = (MethodBinding) clone(); + binding.javaArgumentTypes = null; + if (argumentNumber < 0) { + binding.setJavaReturnType(newArgType); + } else { + binding.setJavaReturnType(javaReturnType); + } + for (int i = 0; i < getNumArguments(); i++) { + JavaType type = getJavaArgumentType(i); + if (i == argumentNumber) { + type = newArgType; + } + binding.addJavaArgumentType(type); + } + return binding; + } + + /** + * Returns true if any of the outgoing arguments in the method's + * signature require conversion or checking due to the use of New + * I/O. + */ + public boolean argumentsUseNIO() { + computeSignatureProperties(); + return argumentsUseNIO; + } + + /** + * Returns true if the return type or any of the outgoing arguments + * in the method's signature require conversion or checking due to + * the use of New I/O. + */ + public boolean signatureUsesNIO() { + computeSignatureProperties(); + return signatureUsesNIO; + } + + /** + * Returns true if it is possible for any of the outgoing arguments + * to be indirect NIO buffers. + */ + public boolean signatureCanUseIndirectNIO() { + computeSignatureProperties(); + return signatureCanUseIndirectNIO; + } + + /** + * Returns true if the return type or any of the outgoing arguments + * in the method's signature use "compound type wrappers", or + * NIO-based wrappers for C data structures. + */ + public boolean signatureUsesCompoundTypeWrappers() { + computeSignatureProperties(); + return signatureUsesCompoundTypeWrappers; + } + + /** + * Returns true if the function needs NIO-related + * wrapping/unwrapping or conversion of various arguments. Currently + * this returns the logical OR of signatureUsesNIO() and + * signatureUsesCompoundTypeWrappers(). + */ + public boolean needsNIOWrappingOrUnwrapping() { + return (signatureUsesNIO() || signatureUsesCompoundTypeWrappers()); + } + + /** + * Returns true if the return type or any of the outgoing arguments + * in the method's signature represent C void* pointers. + */ + public boolean signatureUsesCVoidPointers() { + computeSignatureProperties(); + return signatureUsesCVoidPointers; + } + + /** + * Returns true if the return type or any of the outgoing arguments + * in the method's signature represent C primitive pointers. + */ + public boolean signatureUsesCPrimitivePointers() { + computeSignatureProperties(); + return signatureUsesCPrimitivePointers; + } + + /** + * Returns true if the return type or any of the outgoing arguments + * in the method's signature represent C arrays. + */ + public boolean signatureUsesCArrays() { + computeSignatureProperties(); + return signatureUsesCArrays; + } + + /** + * Returns true if the return type or any of the outgoing arguments + * in the method's signature represent Java primitive arrays. + */ + public boolean signatureUsesJavaPrimitiveArrays() { + computeSignatureProperties(); + return signatureUsesJavaPrimitiveArrays; + } + + /** + * Computes summary information about the method's C and Java + * signatures. + */ + protected void computeSignatureProperties() { + if (computedSignatureProperties) + return; + + argumentsUseNIO = false; + signatureUsesNIO = false; + signatureCanUseIndirectNIO = false; + signatureUsesCompoundTypeWrappers = false; + signatureUsesCVoidPointers = false; + signatureUsesCPrimitivePointers = false; + signatureUsesCArrays = false; + signatureUsesJavaPrimitiveArrays = false; + + if (javaReturnType.isCompoundTypeWrapper()) { + // Needs wrapping and/or setting of byte order (neither of which + // can be done easily from native code) + signatureUsesCompoundTypeWrappers = true; + } + + if (javaReturnType.isNIOByteBuffer() || + javaReturnType.isArrayOfCompoundTypeWrappers()) { + // Needs setting of byte order which can't be done easily from + // native code + signatureUsesNIO = true; + } + + Type cRetType = sym.getReturnType(); + if (cRetType.isArray()) { + // Needs checking of array lengths + signatureUsesCArrays = true; + if (cRetType.asArray().getElementType().isPrimitive()) { + signatureUsesCPrimitivePointers = true; + } + } + + if (cRetType.isPointer()) { + if (cRetType.asPointer().getTargetType().isPrimitive()) { + signatureUsesCPrimitivePointers = true; + } else if (cRetType.asPointer().getTargetType().isVoid()) { + signatureUsesCVoidPointers = true; + } + } + + for (int i = 0; i < getNumArguments(); i++) { + JavaType javaArgType = getJavaArgumentType(i); + Type cArgType = getCArgumentType(i); + if (javaArgType.isCompoundTypeWrapper()) { + // Needs unwrapping of accessors + signatureUsesCompoundTypeWrappers = true; + } + + if (javaArgType.isNIOBuffer() || + javaArgType.isNIOBufferArray()) { + // Needs checking of direct buffer property + signatureUsesNIO = true; + argumentsUseNIO = true; + + if (javaArgType.isNIOBuffer()) { + // Potential conversion to indirect buffer + signatureCanUseIndirectNIO = true; + } + } + + if (cArgType.isArray()) { + // Needs checking of array lengths + signatureUsesCArrays = true; + if (cArgType.asArray().getElementType().isPrimitive()) { + signatureUsesCPrimitivePointers = true; + } + } + + if (cArgType.isPointer()) { + if (cArgType.asPointer().getTargetType().isPrimitive()) { + signatureUsesCPrimitivePointers = true; + } else if (cArgType.asPointer().getTargetType().isVoid()) { + signatureUsesCVoidPointers = true; + } + } + + if (javaArgType.isPrimitiveArray()) { + // Needs getPrimitiveArrayCritical or similar construct + // depending on native code calling convention + signatureUsesJavaPrimitiveArrays = true; + } + } + + computedSignatureProperties = true; + } + + /** Indicates whether this MethodBinding is for a function pointer + contained in a struct. */ + public boolean hasContainingType() { + return (getContainingType() != null); + } + + /** Retrieves the containing type of this MethodBinding if it is for + a function pointer contained in a struct. */ + public JavaType getContainingType() { + return containingType; + } + + /** Retrieves the containing C type of this MethodBinding if it is for + a function pointer contained in a struct. */ + public Type getContainingCType() { + return containingCType; + } + + /** Find the leftmost argument matching the type of the containing + type (for function pointer MethodBindings) and record that as a + "this" pointer, meaning that it does not need to be explicitly + passed at the Java level. */ + public void findThisPointer() { + clearThisPointer(); + for (int i = 0; i < getNumArguments(); i++) { + JavaType arg = getJavaArgumentType(i); + if (arg.equals(containingType)) { + thisPointerIndex = i; + break; + } + + if (!arg.isJNIEnv()) { + break; // this pointer must be leftmost argument excluding JNIEnvs + } + } + } + + /** Clears any record of a this pointer for this MethodBinding. */ + public void clearThisPointer() { + thisPointerIndex = -1; + } + + /** Indicates whether the ith argument to this MethodBinding + is actually a "this" pointer. */ + public boolean isArgumentThisPointer(int i) { + return (thisPointerIndex == i); + } + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (obj == null || ! (obj instanceof MethodBinding)) { + return false; + } + + MethodBinding other = (MethodBinding)obj; + if (!(sym.equals(other.sym))) { return false; } + if (!(javaReturnType.equals(other.getJavaReturnType()))) { return false; } + if (containingType != null && + other.getContainingCType() != null && + (!(containingCType.equals(other.getContainingCType())))) { + return false; + } + if (javaArgumentTypes.size() != other.javaArgumentTypes.size()) { + return false; + } + + for (int i = 0; i < javaArgumentTypes.size(); ++i) { + Object typeThis = javaArgumentTypes.get(i); + Object typeOther = other.getJavaArgumentType(i); + if (!(typeThis.equals(typeOther))) { + return false; + } + } + + return true; + } + + // FIXME!! Implement hashCode() to match equals(Object) + + /** Returns the signature of this binding. */ + public String toString() { + StringBuffer buf = new StringBuffer(200); + buf.append(getJavaReturnType().getName()); + buf.append(" "); + buf.append(getRenamedMethodName()); + buf.append("("); + boolean needComma = false; + for (int i = 0; i < getNumArguments(); i++) { + JavaType type = getJavaArgumentType(i); + if (type.isVoid()) { + // Make sure this is the only param to the method; if it isn't, + // there's something wrong with our parsing of the headers. + assert(getNumArguments() == 1); + continue; + } + if (type.isJNIEnv() || isArgumentThisPointer(i)) { + // Don't need to expose these at the Java level + continue; + } + + if (needComma) { + buf.append(", "); + } + + buf.append(type.getName()); + buf.append(" "); + buf.append(getArgumentName(i)); + needComma = true; + } + buf.append(")"); + return buf.toString(); + } + + public final Object clone() { + return new MethodBinding(this); + } + + /** Returns a String containing the descriptor (signature in + internal format) of this MethodBinding as it will be + emitted. This is used to disambiguate between overloadings when + manually specifying prologue and epilogue code, for example. */ + public String getDescriptor(boolean forImplementingMethodCall, + boolean eraseBufferAndArrayTypes) { + StringBuffer buf = new StringBuffer(); + + buf.append("("); + + if (forImplementingMethodCall && hasContainingType()) { + // Always emit outgoing "this" argument + buf.append("Ljava/nio/ByteBuffer;"); + } + + for (int i = 0; i < getNumArguments(); i++) { + JavaType type = getJavaArgumentType(i); + if (type.isVoid()) { + // Make sure this is the only param to the method; if it isn't, + // there's something wrong with our parsing of the headers. + if (getNumArguments() != 1) { + throw new InternalError( + "\"void\" argument type found in " + + "multi-argument function \"" + this + "\""); + } + continue; + } + + if (type.isJNIEnv() || isArgumentThisPointer(i)) { + // Don't need to expose these at the Java level + continue; + } + + buf.append(erasedTypeDescriptor(type, eraseBufferAndArrayTypes, false)); + + // Add Buffer and array index offset arguments after each associated argument + if (forImplementingMethodCall) { + if (type.isNIOBuffer()) { + buf.append("I"); + } else if (type.isNIOBufferArray()) { + buf.append("[I"); + } + } + + // Add offset argument after each primitive array + if (type.isPrimitiveArray()) { + buf.append("I"); + } + } + + buf.append(")"); + + // Emit return type for completeness even though we can't overload + // based solely on return type + buf.append(erasedTypeDescriptor(getJavaReturnType(), eraseBufferAndArrayTypes, false)); + + return buf.toString(); + } + + protected String erasedTypeDescriptor(JavaType type, boolean eraseBufferAndArrayTypes, boolean skipBuffers) { + if (eraseBufferAndArrayTypes) { + if (type.isNIOBuffer() || + type.isPrimitiveArray()) { + if (!skipBuffers) { + // Direct buffers and arrays sent down as Object (but + // returned as e.g. ByteBuffer) + return "Ljava/lang/Object;"; + } + } else if (type.isCompoundTypeWrapper()) { + // Compound type wrappers are unwrapped to ByteBuffer + return "Ljava/nio/ByteBuffer;"; + } else if (type.isArrayOfCompoundTypeWrappers()) { + return "Ljava/nio/ByteBuffer;"; + } + } + return type.getDescriptor(); + } +} + diff --git a/src/classes/com/sun/gluegen/ReferencedStructs.java b/src/classes/com/sun/gluegen/ReferencedStructs.java new file mode 100644 index 000000000..6c0dfb401 --- /dev/null +++ b/src/classes/com/sun/gluegen/ReferencedStructs.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import java.util.*; +import com.sun.gluegen.cgram.types.*; + +public class ReferencedStructs implements TypeVisitor { + private Set results = new HashSet(); + + public void clear() { + results.clear(); + } + + public Iterator results() { + return results.iterator(); + } + + public void visitType(Type t) { + if (t.isPointer()) { + PointerType p = t.asPointer(); + if (p.hasTypedefedName()) { + CompoundType c = p.getTargetType().asCompound(); + if (c != null && c.getName() == null) { + // This otherwise-unnamed CompoundType is referred to by a + // PointerType that has a typedef name. Assume that it is + // referred to in the glue code and emit it. + results.add(p); + } + } + } else if (t.isCompound()) { + results.add(t); + } + } +} diff --git a/src/classes/com/sun/gluegen/StructLayout.java b/src/classes/com/sun/gluegen/StructLayout.java new file mode 100644 index 000000000..a7dbab61f --- /dev/null +++ b/src/classes/com/sun/gluegen/StructLayout.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +import com.sun.gluegen.cgram.types.*; + +public class StructLayout { + private int baseOffset; + private int structAlignment; + + protected StructLayout(int baseOffset, + int structAlignment) { + this.baseOffset = baseOffset; + this.structAlignment = structAlignment; + } + + public void layout(CompoundType t) { + int n = t.getNumFields(); + int curOffset = baseOffset; + int maxSize = 0; + for (int i = 0; i < n; i++) { + Field f = t.getField(i); + Type ft = f.getType(); + if (ft.isInt() || ft.isFloat() || ft.isDouble() || ft.isPointer()) { + int sz = ft.getSize(); + if ((curOffset % sz) != 0) { + curOffset += sz - (curOffset % sz); + } + f.setOffset(curOffset); + if (t.isUnion()) { + maxSize = Math.max(maxSize, sz); + } else { + curOffset += sz; + } + } else if (ft.isCompound()) { + new StructLayout(0, structAlignment).layout(ft.asCompound()); + if ((curOffset % structAlignment) != 0) { + curOffset += structAlignment - (curOffset % structAlignment); + } + f.setOffset(curOffset); + if (t.isUnion()) { + maxSize = Math.max(maxSize, ft.getSize()); + } else { + curOffset += ft.getSize(); + } + } else if (ft.isArray()) { + ArrayType arrayType = ft.asArray(); + CompoundType compoundElementType = arrayType.getBaseElementType().asCompound(); + if (compoundElementType != null) { + new StructLayout(0, structAlignment).layout(compoundElementType); + arrayType.recomputeSize(); + } + // Note: not sure how this rounding is done + if ((curOffset % structAlignment) != 0) { + curOffset += structAlignment - (curOffset % structAlignment); + } + f.setOffset(curOffset); + curOffset += ft.getSize(); + } else { + // FIXME + String name = t.getName(); + if (name == null) { + name = t.toString(); + } + throw new RuntimeException("Complicated field types (" + ft + + " " + f.getName() + + " in type " + name + + ") not implemented yet"); + } + } + // FIXME: I think the below is wrong; better check with some examples + // if ((curOffset % structAlignment) != 0) { + // curOffset += structAlignment - (curOffset % structAlignment); + // } + if (t.isUnion()) { + t.setSize(maxSize); + } else { + t.setSize(curOffset); + } + } + + + + public static StructLayout createForCurrentPlatform() { + String os = System.getProperty("os.name").toLowerCase(); + String cpu = System.getProperty("os.arch").toLowerCase(); + if ((os.startsWith("windows") && cpu.equals("x86")) || + (os.startsWith("linux") && cpu.equals("i386")) || + (os.startsWith("linux") && cpu.equals("amd64")) || + (os.startsWith("linux") && cpu.equals("x86_64")) || + (os.startsWith("linux") && cpu.equals("ia64")) || + (os.startsWith("sunos") && cpu.equals("sparc")) || + (os.startsWith("sunos") && cpu.equals("x86")) || + (os.startsWith("mac os") && cpu.equals("ppc")) || + (os.startsWith("freebsd") && cpu.equals("i386")) + ) { + // FIXME: make struct alignment configurable? May need to change + // packing rules on a per-type basis? + return new StructLayout(0, 8); + } else { + // FIXME: add more ports + throw new RuntimeException("Please port StructLayout to your OS (" + os + ") and CPU (" + cpu + ")"); + } + } +} diff --git a/src/classes/com/sun/gluegen/TypeInfo.java b/src/classes/com/sun/gluegen/TypeInfo.java new file mode 100644 index 000000000..437fa8564 --- /dev/null +++ b/src/classes/com/sun/gluegen/TypeInfo.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen; + +/** Utility class for handling Opaque directives for JavaEmitter. */ + +public class TypeInfo { + private String name; + private int pointerDepth; + private JavaType javaType; + private TypeInfo next; + + public TypeInfo(String name, int pointerDepth, JavaType javaType) { + this.name = name; + this.pointerDepth = pointerDepth; + this.javaType = javaType; + } + + public String name() { return name; } + public int pointerDepth() { return pointerDepth; } + public JavaType javaType() { return javaType; } + public void setNext(TypeInfo info) { this.next = info; } + public TypeInfo next() { return next; } +} diff --git a/src/classes/com/sun/gluegen/ant/GlueGenTask.java b/src/classes/com/sun/gluegen/ant/GlueGenTask.java new file mode 100644 index 000000000..b90009883 --- /dev/null +++ b/src/classes/com/sun/gluegen/ant/GlueGenTask.java @@ -0,0 +1,494 @@ +package com.sun.gluegen.ant; + +/* + * GlueGenTask.java + * Copyright (C) 2003 Rob Grzywinski (rgrzywinski@realityinteractive.com) + * + * Copying, distribution and use of this software in source and binary + * forms, with or without modification, is permitted provided that the + * following conditions are met: + * + * Distributions of source code must reproduce the copyright notice, + * this list of conditions and the following disclaimer in the source + * code header files; and Distributions of binary code must reproduce + * the copyright notice, this list of conditions and the following + * disclaimer in the documentation, Read me file, license file and/or + * other materials provided with the software distribution. + * + * The names of Sun Microsystems, Inc. ("Sun") and/or the copyright + * holder may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT A WARRANTY OF ANY + * KIND. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, NON-INTERFERENCE, ACCURACY OF + * INFORMATIONAL CONTENT OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. THE + * COPYRIGHT HOLDER, SUN AND SUN'S LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL THE + * COPYRIGHT HOLDER, SUN OR SUN'S LICENSORS BE LIABLE FOR ANY LOST + * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT + * DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION, + * OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE COPYRIGHT + * HOLDER, SUN AND SUN'S LICENSORS DISCLAIM ANY EXPRESS OR IMPLIED + * WARRANTY OF FITNESS FOR SUCH USES. + */ + +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.taskdefs.LogStreamHandler; +import org.apache.tools.ant.types.CommandlineJava; +import org.apache.tools.ant.types.DirSet; +import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.PatternSet; +import org.apache.tools.ant.types.Reference; +import org.apache.tools.ant.util.JavaEnvUtils; + +/** + *

An ANT {@link org.apache.tools.ant.Task} + * for using {@link com.sun.gluegen.GlueGen}.

+ * + *

Usage:

+ *
+    <gluegen src="[source C file]" 
+                includes="[optional directory pattern of include files to include]"
+                excludes="[optional directory pattern of include files to exclude]"
+                includeRefid="[optional FileSet or DirSet for include files]"
+                literalInclude="[optional hack to get around FileSet / DirSet issues with different drives]"
+                emitter="[emitter class name]"
+                config="[configuration file]" />
+ * 
+ * + * @author Rob Grzywinski rgrzywinski@yahoo.com + */ +// FIXME: blow out javadoc +// NOTE: this has not been exhaustively tested +public class GlueGenTask extends Task +{ + /** + *

The {@link com.sun.gluegen.GlueGen} classname.

+ */ + private static final String GLUE_GEN = "com.sun.gluegen.GlueGen"; + + // ========================================================================= + /** + *

The {@link org.apache.tools.ant.types.CommandlineJava} that is used + * to execute {@link com.sun.gluegen.GlueGen}.

+ */ + private CommandlineJava gluegenCommandline; + + // ========================================================================= + /** + *

The name of the emitter class.

+ */ + private String emitter; + + /** + *

The configuration file name.

+ */ + private String configuration; + + /** + *

The name of the source C file that is to be parsed.

+ */ + private String sourceFile; + + /** + *

The {@link org.apache.tools.ant.types.FileSet} of includes.

+ */ + private FileSet includeSet = new FileSet(); + + /** + *

Because a {@link org.apache.tools.ant.types.FileSet} will include + * everything in its base directory if it is left untouched, the includeSet + * must only be added to the set of includes if it has been explicitly + * set.

+ */ + private boolean usedIncludeSet = false; // by default it is not used + + /** + *

The set of include sets. This allows includes to be added in multiple + * fashions.

+ */ + // FIXME: rename to listXXXX + private List setOfIncludeSets = new LinkedList(); + + /** + *

A single literal directory to include. This is to get around the + * fact that neither {@link org.apache.tools.ant.types.FileSet} nor + * {@link org.apache.tools.ant.types.DirSet} can handle multiple drives in + * a sane manner. If null then it has not been specified.

+ */ + private String literalInclude; + + // ========================================================================= + /** + *

Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.

+ */ + public GlueGenTask() + { + // create the CommandlineJava that will be used to call GlueGen + gluegenCommandline = new CommandlineJava(); + + // set the VM and classname in the commandline + gluegenCommandline.setVm(JavaEnvUtils.getJreExecutable("java")); + gluegenCommandline.setClassname(GLUE_GEN); + // gluegenCommandline.createVmArgument().setValue("-verbose:class"); + } + + // ========================================================================= + // ANT getters and setters + /** + *

Set the emitter class name. This is called by ANT.

+ * + * @param emitter the name of the emitter class + */ + public void setEmitter(String emitter) + { + log( ("Setting emitter class name to: " + emitter), Project.MSG_VERBOSE); + this.emitter = emitter; + } + + /** + *

Set the configuration file name. This is called by ANT.

+ * + * @param configuration the name of the configuration file + */ + public void setConfig(String configuration) + { + log( ("Setting configuration file name to: " + configuration), + Project.MSG_VERBOSE); + this.configuration = configuration; + } + + /** + *

Set the source C file that is to be parsed. This is called by ANT.

+ * + * @param sourceFile the name of the source file + */ + public void setSrc(String sourceFile) + { + log( ("Setting source file name to: " + sourceFile), Project.MSG_VERBOSE); + this.sourceFile = sourceFile; + } + + /** + *

Set a single literal include directory. See the literalInclude + * javadoc for more information.

+ * + * @param directory the directory to include + */ + public void setLiteralInclude(String directory) + { + this.literalInclude = directory; + } + + /** + *

Add an include file to the list. This is called by ANT for a nested + * element.

+ * + * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} + */ + public PatternSet.NameEntry createInclude() + { + usedIncludeSet = true; + return includeSet.createInclude(); + } + + /** + *

Add an include file to the list. This is called by ANT for a nested + * element.

+ * + * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} + */ + public PatternSet.NameEntry createIncludesFile() + { + usedIncludeSet = true; + return includeSet.createIncludesFile(); + } + + /** + *

Set the set of include patterns. Patterns may be separated by a comma + * or a space. This is called by ANT.

+ * + * @param includes the string containing the include patterns + */ + public void setIncludes(String includes) + { + usedIncludeSet = true; + includeSet.setIncludes(includes); + } + + /** + *

Add an include file to the list that is to be exluded. This is called + * by ANT for a nested element.

+ * + * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} + */ + public PatternSet.NameEntry createExclude() + { + usedIncludeSet = true; + return includeSet.createExclude(); + } + + /** + *

Add an exclude file to the list. This is called by ANT for a nested + * element.

+ * + * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} + */ + public PatternSet.NameEntry createExcludesFile() + { + usedIncludeSet = true; + return includeSet.createExcludesFile(); + } + + /** + *

Set the set of exclude patterns. Patterns may be separated by a comma + * or a space. This is called by ANT.

+ * + * @param includes the string containing the exclude patterns + */ + public void setExcludes(String excludes) + { + usedIncludeSet = true; + includeSet.setExcludes(excludes); + } + + /** + *

Set a {@link org.apache.tools.ant.types.Reference} to simplify adding + * of complex sets of files to include. This is called by ANT.

? + * + * @param reference a Reference to a {@link org.apache.tools.ant.types.FileSet} + * or {@link org.apache.tools.ant.types.DirSet} + * @throws BuildException if the specified Reference is not + * either a FileSet or DirSet + */ + public void setIncludeRefid(Reference reference) + { + // ensure that the referenced object is either a FileSet or DirSet + final Object referencedObject = reference.getReferencedObject(getProject()); + if( !( (referencedObject instanceof FileSet) || + (referencedObject instanceof DirSet)) ) + { + throw new BuildException("Only FileSets or DirSets are allowed as an include refid."); + } + + // add the referenced object to the set of include sets + setOfIncludeSets.add(referencedObject); + } + + /** + *

Add a nested {@link org.apache.tools.ant.types.DirSet} to specify + * the files to include. This is called by ANT.

+ * + * @param dirset the DirSet to be added + */ + public void addDirset(DirSet dirset) + { + setOfIncludeSets.add(dirset); + } + + /** + *

Add an optional classpath that defines the location of {@link com.sun.gluegen.GlueGen} + * and GlueGen's dependencies.

+ * + * @returns {@link org.apache.tools.ant.types.Path} + */ + public Path createClasspath() + { + return gluegenCommandline.createClasspath(project).createPath(); + } + + // ========================================================================= + /** + *

Run the task. This involves validating the set attributes, creating + * the command line to be executed and finally executing the command.

+ * + * @see org.apache.tools.ant.Task#execute() + */ + public void execute() + throws BuildException + { + // validate that all of the required attributes have been set + validateAttributes(); + + // TODO: add logic to determine if the generated file needs to be + // regenerated + + // add the attributes to the CommandlineJava + addAttributes(); + + log(gluegenCommandline.describeCommand(), Project.MSG_VERBOSE); + + // execute the command and throw on error + final int error = execute(gluegenCommandline.getCommandline()); + if(error == 1) + throw new BuildException( ("GlueGen returned: " + error), location); + } + + /** + *

Ensure that the user specified all required arguments.

+ * + * @throws BuildException if there are required arguments that are not + * present or not valid + */ + private void validateAttributes() + throws BuildException + { + // validate that the emitter class is set + if(!isValid(emitter)) + throw new BuildException("Invalid emitter class name: " + emitter); + + // validate that the configuration file is set + if(!isValid(configuration)) + throw new BuildException("Invalid configuration file name: " + configuration); + + // validate that the source file is set + if(!isValid(sourceFile)) + throw new BuildException("Invalid source file name: " + sourceFile); + + // CHECK: do there need to be includes to be valid? + } + + /** + *

Is the specified string valid? A valid string is non-null + * and has a non-zero length.

+ * + * @param string the string to be tested for validity + * @return true if the string is valid. false + * otherwise. + */ + private boolean isValid(String string) + { + // check for null + if(string == null) + return false; + + // ensure that the string has a non-zero length + // NOTE: must trim() to remove leading and trailing whitespace + if(string.trim().length() < 1) + return false; + + // the string is valid + return true; + } + + /** + *

Add all of the attributes to the command line. They have already + * been validated.

+ */ + private void addAttributes() + throws BuildException + { + // NOTE: GlueGen uses concatenated flag / value rather than two + // separate arguments + + // add the emitter class name + gluegenCommandline.createArgument().setValue("-E" + emitter); + + // add the configuration file name + gluegenCommandline.createArgument().setValue("-C" + configuration); + + // add the includedSet to the setOfIncludeSets to simplify processing + // all types of include sets ONLY if it has been set. + // NOTE: see the usedIncludeSet member javadoc for more info + // NOTE: references and nested DirSets have already been added to the + // set of include sets + if(usedIncludeSet) + { + includeSet.setDir(getProject().getBaseDir()); // NOTE: the base dir must be set + setOfIncludeSets.add(includeSet); + } + + // iterate over all include sets and add their directories to the + // list of included directories. + final List includedDirectories = new LinkedList(); + for(Iterator includes=setOfIncludeSets.iterator(); includes.hasNext(); ) + { + // get the included set and based on its type add the directories + // to includedDirectories + Object include = (Object)includes.next(); + final String[] directoryDirs; + if(include instanceof FileSet) + { + final FileSet fileSet = (FileSet)include; + DirectoryScanner directoryScanner = fileSet.getDirectoryScanner(getProject()); + directoryDirs = directoryScanner.getIncludedDirectories(); + } else if(include instanceof DirSet) + { + final DirSet dirSet = (DirSet)include; + DirectoryScanner directoryScanner = dirSet.getDirectoryScanner(getProject()); + directoryDirs = directoryScanner.getIncludedDirectories(); + } else + { + // NOTE: this cannot occur as it is checked on setXXX() but + // just to be pedantic this is here + throw new BuildException("Invalid included construct."); + } + + // add the directoryDirs to the includedDirectories + // TODO: exclude any directory that is already in the list + for(int i=0; iExecute {@link com.sun.gluegen.GlueGen} in a forked JVM.

+ * + * @throws BuildException + */ + private int execute(String[] command) + throws BuildException + { + // create the object that will perform the command execution + Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, + Project.MSG_WARN), + null); + + // set the project and command line + execute.setAntRun(project); + execute.setCommandline(command); + + // execute the command + try + { + return execute.execute(); + } catch(IOException ioe) + { + throw new BuildException(ioe, location); + } + } +} diff --git a/src/classes/com/sun/gluegen/ant/StaticGLGenTask.java b/src/classes/com/sun/gluegen/ant/StaticGLGenTask.java new file mode 100644 index 000000000..255ab8a1a --- /dev/null +++ b/src/classes/com/sun/gluegen/ant/StaticGLGenTask.java @@ -0,0 +1,303 @@ +package com.sun.gluegen.ant; + +/* + * StaticGLGenTask.java + * Copyright (C) 2003 Rob Grzywinski (rgrzywinski@realityinteractive.com) + * + * Copying, distribution and use of this software in source and binary + * forms, with or without modification, is permitted provided that the + * following conditions are met: + * + * Distributions of source code must reproduce the copyright notice, + * this list of conditions and the following disclaimer in the source + * code header files; and Distributions of binary code must reproduce + * the copyright notice, this list of conditions and the following + * disclaimer in the documentation, Read me file, license file and/or + * other materials provided with the software distribution. + * + * The names of Sun Microsystems, Inc. ("Sun") and/or the copyright + * holder may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT A WARRANTY OF ANY + * KIND. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, NON-INTERFERENCE, ACCURACY OF + * INFORMATIONAL CONTENT OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. THE + * COPYRIGHT HOLDER, SUN AND SUN'S LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL THE + * COPYRIGHT HOLDER, SUN OR SUN'S LICENSORS BE LIABLE FOR ANY LOST + * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT + * DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION, + * OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE COPYRIGHT + * HOLDER, SUN AND SUN'S LICENSORS DISCLAIM ANY EXPRESS OR IMPLIED + * WARRANTY OF FITNESS FOR SUCH USES. + */ + +import java.io.IOException; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.taskdefs.LogStreamHandler; +import org.apache.tools.ant.types.CommandlineJava; +import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.PatternSet; +import org.apache.tools.ant.util.JavaEnvUtils; + +/** + *

An ANT {@link org.apache.tools.ant.Task} + * for using {@link com.sun.gluegen.opengl.BuildStaticGLInfo}.

+ * + *

Usage:

+ *
+    <staticglgen package="[generated files package]" 
+                    headers="[file pattern of GL headers]"
+                    outputdir="[directory to output the generated files]" />
+ * 
+ * + * @author Rob Grzywinski rgrzywinski@yahoo.com + */ +// FIXME: blow out javadoc +public class StaticGLGenTask extends Task +{ + /** + *

The {@link com.sun.gluegen.opengl.BuildStaticGLInfo} classname.

+ */ + private static final String GL_GEN = "com.sun.gluegen.opengl.BuildStaticGLInfo"; + + // ========================================================================= + /** + *

The {@link org.apache.tools.ant.types.CommandlineJava} that is used + * to execute {@link com.sun.gluegen.opengl.BuildStaticGLInfo}.

+ */ + private CommandlineJava glgenCommandline; + + // ========================================================================= + /** + *

The package name for the generated files.

+ */ + private String packageName; + + /** + *

The output directory.

+ */ + private String outputDirectory; + + /** + *

The {@link org.apache.tools.ant.types.FileSet} of GL headers.

+ */ + private FileSet headerSet = new FileSet(); + + // ========================================================================= + /** + *

Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.

+ */ + public StaticGLGenTask() + { + // create the CommandlineJava that will be used to call BuildStaticGLInfo + glgenCommandline = new CommandlineJava(); + + // set the VM and classname in the commandline + glgenCommandline.setVm(JavaEnvUtils.getJreExecutable("java")); + glgenCommandline.setClassname(GL_GEN); + } + + // ========================================================================= + // ANT getters and setters + /** + *

Set the package name for the generated files. This is called by ANT.

+ * + * @param packageName the name of the package for the generated files + */ + public void setPackage(String packageName) + { + log( ("Setting package name to: " + packageName), Project.MSG_VERBOSE); + this.packageName = packageName; + } + + /** + *

Set the output directory. This is called by ANT.

+ * + * @param directory the output directory + */ + public void setOutputDir(String directory) + { + log( ("Setting output directory to: " + directory), + Project.MSG_VERBOSE); + this.outputDirectory = directory; + } + + /** + *

Add a header file to the list. This is called by ANT for a nested + * element.

+ * + * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} + */ + public PatternSet.NameEntry createHeader() + { + return headerSet.createInclude(); + } + + /** + *

Add a header file to the list. This is called by ANT for a nested + * element.

+ * + * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} + */ + public PatternSet.NameEntry createHeadersFile() + { + return headerSet.createIncludesFile(); + } + + /** + *

Set the set of header patterns. Patterns may be separated by a comma + * or a space. This is called by ANT.

+ * + * @param headers the string containing the header patterns + */ + public void setHeaders(String headers) + { + headerSet.setIncludes(headers); + } + + /** + *

Add an optional classpath that defines the location of {@link com.sun.gluegen.opengl.BuildStaticGLInfo} + * and BuildStaticGLInfo's dependencies.

+ * + * @returns {@link org.apache.tools.ant.types.Path} + */ + public Path createClasspath() + { + return glgenCommandline.createClasspath(project).createPath(); + } + + // ========================================================================= + /** + *

Run the task. This involves validating the set attributes, creating + * the command line to be executed and finally executing the command.

+ * + * @see org.apache.tools.ant.Task#execute() + */ + public void execute() + throws BuildException + { + // validate that all of the required attributes have been set + validateAttributes(); + + // TODO: add logic to determine if the generated file needs to be + // regenerated + + // add the attributes to the CommandlineJava + addAttributes(); + + log(glgenCommandline.describeCommand(), Project.MSG_VERBOSE); + + // execute the command and throw on error + final int error = execute(glgenCommandline.getCommandline()); + if(error == 1) + throw new BuildException( ("BuildStaticGLInfo returned: " + error), location); + } + + /** + *

Ensure that the user specified all required arguments.

+ * + * @throws BuildException if there are required arguments that are not + * present or not valid + */ + private void validateAttributes() + throws BuildException + { + // validate that the package name is set + if(!isValid(packageName)) + throw new BuildException("Invalid package name: " + packageName); + + // validate that the output directory is set + // TODO: switch to file and ensure that it exists + if(!isValid(outputDirectory)) + throw new BuildException("Invalid output directory name: " + outputDirectory); + + // TODO: validate that there are headers set + } + + /** + *

Is the specified string valid? A valid string is non-null + * and has a non-zero length.

+ * + * @param string the string to be tested for validity + * @return true if the string is valid. false + * otherwise. + */ + private boolean isValid(String string) + { + // check for null + if(string == null) + return false; + + // ensure that the string has a non-zero length + // NOTE: must trim() to remove leading and trailing whitespace + if(string.trim().length() < 1) + return false; + + // the string is valid + return true; + } + + /** + *

Add all of the attributes to the command line. They have already + * been validated.

+ */ + private void addAttributes() + { + // add the package name + glgenCommandline.createArgument().setValue(packageName); + + // add the output directory name + glgenCommandline.createArgument().setValue(outputDirectory); + + // add the header -files- from the FileSet + headerSet.setDir(getProject().getBaseDir()); + DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject()); + String[] directoryFiles = directoryScanner.getIncludedFiles(); + for(int i=0; iExecute {@link com.sun.gluegen.opengl.BuildStaticGLInfo} in a + * forked JVM.

+ * + * @throws BuildException + */ + private int execute(String[] command) + throws BuildException + { + // create the object that will perform the command execution + Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, + Project.MSG_WARN), + null); + + // set the project and command line + execute.setAntRun(project); + execute.setCommandline(command); + + // execute the command + try + { + return execute.execute(); + } catch(IOException ioe) + { + throw new BuildException(ioe, location); + } + } +} diff --git a/src/classes/com/sun/gluegen/cgram/CSymbolTable.java b/src/classes/com/sun/gluegen/cgram/CSymbolTable.java new file mode 100644 index 000000000..51edf44c3 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/CSymbolTable.java @@ -0,0 +1,132 @@ +package com.sun.gluegen.cgram; + +import java.util.Vector; +import java.util.Hashtable; +import java.util.Enumeration; + + + +public class CSymbolTable { + + /** holds list of scopes */ + private Vector scopeStack; + + /** table where all defined names are mapped to TNode tree nodes */ + private Hashtable symTable; + + public CSymbolTable() { + scopeStack = new Vector(10); + symTable = new Hashtable(533); + } + + + /** push a new scope onto the scope stack. + */ + public void pushScope(String s) { + //System.out.println("push scope:" + s); + scopeStack.addElement(s); + } + + /** pop the last scope off the scope stack. + */ + public void popScope() { + //System.out.println("pop scope"); + int size = scopeStack.size(); + if(size > 0) + scopeStack.removeElementAt(size - 1); + } + + /** return the current scope as a string + */ + public String currentScopeAsString() { + StringBuffer buf = new StringBuffer(100); + boolean first = true; + Enumeration e = scopeStack.elements(); + while(e.hasMoreElements()) { + if(first) + first = false; + else + buf.append("::"); + buf.append(e.nextElement().toString()); + } + return buf.toString(); + } + + /** given a name for a type, append it with the + current scope. + */ + public String addCurrentScopeToName(String name) { + String currScope = currentScopeAsString(); + return addScopeToName(currScope, name); + } + + /** given a name for a type, append it with the + given scope. MBZ + */ + public String addScopeToName(String scope, String name) { + if(scope == null || scope.length() > 0) + return scope + "::" + name; + else + return name; + } + + /** remove one level of scope from name MBZ*/ + public String removeOneLevelScope(String scopeName) { + int index = scopeName.lastIndexOf("::"); + if (index > 0) { + return scopeName.substring(0,index); + } + if (scopeName.length() > 0) { + return ""; + } + return null; + } + + /** add a node to the table with it's key as + the current scope and the name */ + public TNode add(String name, TNode node) { + return (TNode)symTable.put(addCurrentScopeToName(name),node); + } + + + /** lookup a fully scoped name in the symbol table */ + public TNode lookupScopedName(String scopedName) { + return (TNode)symTable.get(scopedName); + } + + /** lookup an unscoped name in the table by prepending + the current scope. + MBZ -- if not found, pop scopes and look again + */ + public TNode lookupNameInCurrentScope(String name) { + String scope = currentScopeAsString(); + String scopedName; + TNode tnode = null; + + //System.out.println( "\n"+ this.toString() ); + + while (tnode == null && scope != null) { + scopedName = addScopeToName(scope, name); + //System.out.println("lookup trying " + scopedName); + tnode = (TNode)symTable.get(scopedName); + scope = removeOneLevelScope(scope); + } + return tnode; + } + + /** convert this table to a string */ + public String toString() { + StringBuffer buff = new StringBuffer(300); + buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() + + "\nDefinedSymbols:\n"); + Enumeration ke = symTable.keys(); + Enumeration ve = symTable.elements(); + while(ke.hasMoreElements()) { + buff.append(ke.nextElement().toString() + " (" + + TNode.getNameForType(((TNode)ve.nextElement()).getType()) + ")\n"); + } + buff.append("}\n"); + return buff.toString(); + } + +}; diff --git a/src/classes/com/sun/gluegen/cgram/CToken.java b/src/classes/com/sun/gluegen/cgram/CToken.java new file mode 100644 index 000000000..5d85c48c7 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/CToken.java @@ -0,0 +1,32 @@ +package com.sun.gluegen.cgram; + +import antlr.CommonToken; + +public class CToken extends antlr.CommonToken { + String source = ""; + int tokenNumber; + + public String getSource() + { + return source; + } + + public void setSource(String src) + { + source = src; + } + + public int getTokenNumber() + { + return tokenNumber; + } + + public void setTokenNumber(int i) + { + tokenNumber = i; + } + + public String toString() { + return "CToken:" +"(" + hashCode() + ")" + "[" + getType() + "] "+ getText() + " line:" + getLine() + " source:" + source ; + } +} diff --git a/src/classes/com/sun/gluegen/cgram/Define.java b/src/classes/com/sun/gluegen/cgram/Define.java new file mode 100644 index 000000000..a71c538bb --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/Define.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram; + +/** Represents a #define of a literal to a value (a number represented + in string form.) */ + +public class Define { + private String name; + private String value; + + public Define(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { return name; } + public String getValue() { return value; } +} diff --git a/src/classes/com/sun/gluegen/cgram/GnuCEmitter.g b/src/classes/com/sun/gluegen/cgram/GnuCEmitter.g new file mode 100644 index 000000000..82003c3a0 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/GnuCEmitter.g @@ -0,0 +1,1145 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Copyright (c) Non, Inc. 1998 -- All Rights Reserved + +PROJECT: C Compiler +MODULE: GnuCEmitter +FILE: GnuCEmitter.g + +AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 + +DESCRIPTION: + + This tree grammar is for a Gnu C AST. + It turns the tree back into source code. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + + +header { + package com.sun.gluegen.cgram; + + import java.io.*; + import java.util.*; + + import antlr.CommonAST; + import antlr.DumpASTVisitor; +} + + +class GnuCEmitter extends GnuCTreeParser; + +options + { + importVocab = GNUC; + buildAST = false; + ASTLabelType = "TNode"; + + // Copied following options from java grammar. + codeGenMakeSwitchThreshold = 2; + codeGenBitsetTestThreshold = 3; + } + + +{ + + +int tabs = 0; +PrintStream currentOutput = System.out; +int lineNum = 1; +String currentSource = ""; +LineObject trueSourceFile; +final int lineDirectiveThreshold = Integer.MAX_VALUE; +PreprocessorInfoChannel preprocessorInfoChannel = null; +Stack sourceFiles = new Stack(); + +public GnuCEmitter( PreprocessorInfoChannel preprocChannel ) +{ + preprocessorInfoChannel = preprocChannel; +} + +void initializePrinting() +{ + Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber( new Integer(1) ); + printPreprocs(preprocs); +/* if ( currentSource.equals("") ) { + trueSourceFile = new LineObject(currentSource); + currentOutput.println("# 1 \"" + currentSource + "\"\n"); + sourceFiles.push(trueSourceFile); + } +*/ +} + +void finalizePrinting() { + // flush any leftover preprocessing instructions to the stream + + printPreprocs( + preprocessorInfoChannel.extractLinesPrecedingTokenNumber( + new Integer( preprocessorInfoChannel.getMaxTokenNumber() + 1 ) )); + //print a newline so file ends at a new line + currentOutput.println(); +} + +void printPreprocs( Vector preprocs ) +{ + // if there was a preprocessingDirective previous to this token then + // print a newline and the directive, line numbers handled later + if ( preprocs.size() > 0 ) { + if ( trueSourceFile != null ) { + currentOutput.println(); //make sure we're starting a new line unless this is the first line directive + } + lineNum++; + Enumeration e = preprocs.elements(); + while (e.hasMoreElements()) + { + Object o = e.nextElement(); + if ( o.getClass().getName().equals("LineObject") ) { + LineObject l = (LineObject) o; + + // we always return to the trueSourceFile, we never enter it from another file + // force it to be returning if in fact we aren't currently in trueSourceFile + if (( trueSourceFile != null ) //trueSource exists + && ( !currentSource.equals(trueSourceFile.getSource()) ) //currently not in trueSource + && ( trueSourceFile.getSource().equals(l.getSource()) ) ) { //returning to trueSource + l.setEnteringFile( false ); + l.setReturningToFile( true ); + } + + + // print the line directive + currentOutput.println(l); + lineNum = l.getLine(); + currentSource = l.getSource(); + + + // the very first line directive always represents the true sourcefile + if ( trueSourceFile == null ) { + trueSourceFile = new LineObject(currentSource); + sourceFiles.push(trueSourceFile); + } + + // keep our own stack of files entered + if ( l.getEnteringFile() ) { + sourceFiles.push(l); + } + + // if returning to a file, pop the exited files off the stack + if ( l.getReturningToFile() ) { + LineObject top = (LineObject) sourceFiles.peek(); + while (( top != trueSourceFile ) && (! l.getSource().equals(top.getSource()) )) { + sourceFiles.pop(); + top = (LineObject) sourceFiles.peek(); + } + } + } + else { // it was a #pragma or such + currentOutput.println(o); + lineNum++; + } + } + } + +} + +void print( TNode t ) { + int tLineNum = t.getLocalLineNum(); + if ( tLineNum == 0 ) tLineNum = lineNum; + + Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); + printPreprocs(preprocs); + + if ( (lineNum != tLineNum) ) { + // we know we'll be newlines or a line directive or it probably + // is just the case that this token is on the next line + // either way start a new line and indent it + currentOutput.println(); + lineNum++; + printTabs(); + } + + if ( lineNum == tLineNum ){ + // do nothing special, we're at the right place + } + else { + int diff = tLineNum - lineNum; + if ( lineNum < tLineNum ) { + // print out the blank lines to bring us up to right line number + for ( ; lineNum < tLineNum ; lineNum++ ) { + currentOutput.println(); + } + printTabs(); + } + else { // just reset lineNum + lineNum = tLineNum; + } + } + currentOutput.print( t.getText() + " " ); +} + + +/* This was my attempt at being smart about line numbers + It didn't work quite right but I don't know why, I didn't + have enough test cases. Worked ok compiling rcs and ghostscript +*/ +void printAddingLineDirectives( TNode t ) { + int tLineNum = t.getLocalLineNum(); + String tSource = (String) t.getAttribute("source"); + + if ( tSource == null ) tSource = currentSource; + if ( tLineNum == 0 ) tLineNum = lineNum; + + Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); + printPreprocs(preprocs); + + if ( (lineNum != tLineNum) || !currentSource.equals(tSource) ) { + // we know we'll be newlines or a line directive or it probably + // is just the case that this token is on the next line + // either way start a new line and indent it + currentOutput.println(); + lineNum++; + printTabs(); + } + + if ( ( lineNum == tLineNum ) && ( currentSource.equals(tSource) ) ){ + // do nothing special, we're at the right place + } + else if ( currentSource.equals(tSource) ) { + int diff = tLineNum - lineNum; + if (diff > 0 && diff < lineDirectiveThreshold) { + // print out the blank lines to bring us up to right line number + for ( ; lineNum < tLineNum ; lineNum++ ) { + currentOutput.println(); + } + } + else { // print line directive to get us to right line number + // preserve flags 3 and 4 if present in current file + if ( ! sourceFiles.empty() ) { + LineObject l = (LineObject) sourceFiles.peek(); + StringBuffer tFlags = new StringBuffer(""); + if (l.getSystemHeader()) { + tFlags.append(" 3"); + } + if (l.getTreatAsC()) { + tFlags.append(" 4"); + } + currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags.toString()); + lineNum = tLineNum; + } + } + + printTabs(); + } + else { // different source + Enumeration sources = sourceFiles.elements(); + // see if we're returning to a file we entered earlier + boolean returningToEarlierFile = false; + while (sources.hasMoreElements()) { + LineObject l = (LineObject) sources.nextElement(); + if (l.getSource().equals(tSource)) { + returningToEarlierFile = true; + break; + } + } + if (returningToEarlierFile) { + // pop off the files we're exiting, but never pop the trueSourceFile + LineObject l = (LineObject) sourceFiles.peek(); + while ( ( l != trueSourceFile ) &&(! l.getSource().equals(tSource) ) ) { + sourceFiles.pop(); + l = (LineObject) sourceFiles.peek(); + } + + // put in the return flag, plus others as needed + StringBuffer tFlags = new StringBuffer(" 2"); + if (l.getSystemHeader()) { + tFlags.append(" 3"); + } + if (l.getTreatAsC()) { + tFlags.append(" 4"); + } + + currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags); + lineNum = tLineNum; + currentSource = tSource; + printTabs(); + } + else { // entering a file that wasn't in the original source + // pretend we're entering it from top of stack + currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + " 1"); + lineNum = tLineNum; + currentSource = tSource; + printTabs(); + } + } + currentOutput.print( t.getText() + " " ); +} + +/** It is not ok to print newlines from the String passed in as +it will screw up the line number handling **/ +void print( String s ) { + currentOutput.print( s + " " ); +} + +void printTabs() { + for ( int i = 0; i< tabs; i++ ) { + currentOutput.print( "\t" ); + } +} + +void commaSep( TNode t ) { + print( t ); + if ( t.getNextSibling() != null ) { + print( "," ); + } +} + + int traceDepth = 0; + public void reportError(RecognitionException ex) { + if ( ex != null) { + System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); + ex.printStackTrace(System.err); + } + } + public void reportError(NoViableAltException ex) { + System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); + TNode.printTree( ex.node ); + ex.printStackTrace(System.err); + } + public void reportError(MismatchedTokenException ex) { + if ( ex != null) { + TNode.printTree( ex.node ); + System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); + ex.printStackTrace(System.err); + } + } + public void reportError(String s) { + System.err.println("ANTLR Error from String: " + s); + } + public void reportWarning(String s) { + System.err.println("ANTLR Warning from String: " + s); + } + protected void match(AST t, int ttype) throws MismatchedTokenException { + //System.out.println("match("+ttype+"); cursor is "+t); + super.match(t, ttype); + } + public void match(AST t, BitSet b) throws MismatchedTokenException { + //System.out.println("match("+b+"); cursor is "+t); + super.match(t, b); + } + protected void matchNot(AST t, int ttype) throws MismatchedTokenException { + //System.out.println("matchNot("+ttype+"); cursor is "+t); + super.matchNot(t, ttype); + } + public void traceIn(String rname, AST t) { + traceDepth += 1; + for (int x=0; x typeName + | expr + ) + rp:RPAREN { print( rp ); } + ) + | p:"__complex" { print( p ); } + ; + + +typedefName + : #(NTypedefName i:ID { print( i ); } ) + ; + + +structSpecifier + : #( a:"struct" { print( a ); } + structOrUnionBody + ) + ; + +unionSpecifier + : #( a:"union" { print( a ); } + structOrUnionBody + ) + ; + +structOrUnionBody + : ( (ID LCURLY) => i1:ID lc1:LCURLY { print( i1 ); print ( "{" ); tabs++; } + ( structDeclarationList )? + rc1:RCURLY { tabs--; print( rc1 ); } + | lc2:LCURLY { print( lc2 ); tabs++; } + ( structDeclarationList )? + rc2:RCURLY { tabs--; print( rc2 ); } + | i2:ID { print( i2 ); } + ) + ; + +structDeclarationList + : ( structDeclaration { print( ";" ); } + )+ + ; + + +structDeclaration + : specifierQualifierList structDeclaratorList + ; + + +specifierQualifierList + : ( + typeSpecifier + | typeQualifier + )+ + ; + + +structDeclaratorList + : structDeclarator + ( { print(","); } structDeclarator )* + ; + + +structDeclarator + : + #( NStructDeclarator + ( declarator )? + ( c:COLON { print( c ); } expr )? + ( attributeDecl )* + ) + ; + + +enumSpecifier + : #( a:"enum" { print( a ); } + ( i:ID { print( i ); } )? + ( lc:LCURLY { print( lc ); tabs++; } + enumList + rc:RCURLY { tabs--; print( rc ); } + )? + ) + ; + + +enumList + : + enumerator ( {print(",");} enumerator)* + ; + + +enumerator + : i:ID { print( i ); } + ( b:ASSIGN { print( b ); } + expr + )? + ; + + +attributeDecl: + #( a:"__attribute" { print( a ); } + (b:. { print( b ); } )* + ) + | #( n:NAsmAttribute { print( n ); } + lp:LPAREN { print( lp ); } + expr { print( ")" ); } + rp:RPAREN { print( rp ); } + ) + ; + +initDeclList + : initDecl + ( { print( "," ); } initDecl )* + ; + + +initDecl + { String declName = ""; } + : #(NInitDecl + declarator + ( attributeDecl )* + ( a:ASSIGN { print( a ); } + initializer + | b:COLON { print( b ); } + expr + )? + ) + ; + + +pointerGroup + : #( NPointerGroup + ( a:STAR { print( a ); } + ( typeQualifier )* + )+ + ) + ; + + + +idList + : i:ID { print( i ); } + ( c:COMMA { print( c ); } + id:ID { print( id ); } + )* + ; + + + +initializer + : #( NInitializer (initializerElementLabel)? expr ) + | lcurlyInitializer + ; + +initializerElementLabel + : #( NInitializerElementLabel + ( + ( l:LBRACKET { print( l ); } + expr + r:RBRACKET { print( r ); } + (a1:ASSIGN { print( a1 ); } )? + ) + | i1:ID c:COLON { print( i1 ); print( c ); } + | d:DOT i2:ID a2:ASSIGN { print( d ); print( i2 ); print( a2 ); } + ) + ) + ; + +lcurlyInitializer + : #(n:NLcurlyInitializer { print( n ); tabs++; } + initializerList + rc:RCURLY { tabs--; print( rc ); } + ) + ; + +initializerList + : ( i:initializer { commaSep( i ); } + )* + ; + + +declarator + : #( NDeclarator + ( pointerGroup )? + + ( id:ID { print( id ); } + | lp:LPAREN { print( lp ); } declarator rp:RPAREN { print( rp ); } + ) + + ( #( n:NParameterTypeList { print( n ); } + ( + parameterTypeList + | (idList)? + ) + r:RPAREN { print( r ); } + ) + | lb:LBRACKET { print( lb );} ( expr )? rb:RBRACKET { print( rb ); } + )* + ) + ; + + + +parameterTypeList + : ( parameterDeclaration + ( c:COMMA { print( c ); } + | s:SEMI { print( s ); } + )? + )+ + ( v:VARARGS { print( v ); } )? + ; + + + +parameterDeclaration + : #( NParameterDeclaration + declSpecifiers + (declarator | nonemptyAbstractDeclarator)? + ) + ; + + +functionDef + : #( NFunctionDef + ( functionDeclSpecifiers)? + declarator + (declaration + | v:VARARGS { print( v ); } + )* + compoundStatement + ) + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + +functionDeclSpecifiers + : + ( functionStorageClassSpecifier + | typeQualifier + | typeSpecifier + )+ + ; + +declarationList + : + ( //ANTLR doesn't know that declarationList properly eats all the declarations + //so it warns about the ambiguity + options { + warnWhenFollowAmbig = false; + } : + localLabelDecl + | declaration + )+ + ; + +localLabelDecl + : #(a:"__label__" { print( a ); } + ( i:ID { commaSep( i ); } + )+ + { print( ";" ); } + ) + ; + + + +compoundStatement + : #( cs:NCompoundStatement { print( cs ); tabs++; } + ( declarationList + | functionDef + )* + ( statementList )? + rc:RCURLY { tabs--; print( rc ); } + ) + + ; + +statementList + : ( statement )+ + ; + +statement + : statementBody + ; + +statementBody + : s:SEMI { print( s ); } + + | compoundStatement // Group of statements + + | #(NStatementExpr + expr { print( ";" ); } + ) // Expressions + +// Iteration statements: + + | #( w:"while" { print( w ); print( "(" ); } + expr { print( ")" ); } + statement ) + + | #( d:"do" { print( d ); } + statement + { print( " while ( " ); } + expr + { print( " );" ); } + ) + + | #( f:"for" { print( f ); print( "(" ); } + expr { print( ";" ); } + expr { print( ";" ); } + expr { print( ")" ); } + statement + ) + + +// Jump statements: + + | #( g:"goto" { print( g );} + expr { print( ";" ); } + ) + | c:"continue" { print( c ); print( ";" );} + | b:"break" { print( b ); print( ";" );} + | #( r:"return" { print( r ); } + ( expr )? + { print( ";" ); } + ) + + +// Labeled statements: + | #( NLabel + ni:ID { print( ni ); print( ":" ); } + ( statement )? + ) + + | #( + ca:"case" { print( ca ); } + expr { print( ":" ); } + (statement)? + ) + + | #( + de:"default" { print( de ); print( ":" ); } + (statement)? + ) + + + +// Selection statements: + + | #( i:"if" { print( i ); print( "(" ); } + expr { print( ")" ); } + statement + ( e:"else" { print( e ); } + statement + )? + ) + | #( sw:"switch" { print( sw ); print( "(" ); } + expr { print( ")" ); } + statement + ) + + + + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + + + + +expr + : + binaryExpr + | conditionalExpr + | castExpr + | unaryExpr + | postfixExpr + | primaryExpr + | emptyExpr + | compoundStatementExpr + | initializer + | rangeExpr + | gnuAsmExpr + ; + +emptyExpr + : NEmptyExpression + ; + +compoundStatementExpr + : #(l:LPAREN { print( l ); } + compoundStatement + r:RPAREN { print( r ); } + ) + ; + +rangeExpr + : #(NRangeExpr expr v:VARARGS{ print( v ); } expr) + ; + +gnuAsmExpr + : #(n:NGnuAsmExpr { print( n ); } + (v:"volatile" { print( v ); } )? + lp:LPAREN { print( lp ); } + stringConst + ( options { warnWhenFollowAmbig = false; }: + c1:COLON { print( c1 );} + (strOptExprPair + ( c2:COMMA { print( c2 ); } strOptExprPair)* + )? + ( options { warnWhenFollowAmbig = false; }: + c3:COLON { print( c3 ); } + (strOptExprPair + ( c4:COMMA { print( c4 ); } strOptExprPair)* + )? + )? + )? + ( c5:COLON { print( c5 ); } + stringConst + ( c6:COMMA { print( c6 ); } + stringConst + )* + )? + rp:RPAREN { print( rp ); } + ) + ; + +strOptExprPair + : stringConst + ( + l:LPAREN { print( l ); } + expr + r:RPAREN { print( r ); } + )? + ; + +binaryOperator + : ASSIGN + | DIV_ASSIGN + | PLUS_ASSIGN + | MINUS_ASSIGN + | STAR_ASSIGN + | MOD_ASSIGN + | RSHIFT_ASSIGN + | LSHIFT_ASSIGN + | BAND_ASSIGN + | BOR_ASSIGN + | BXOR_ASSIGN + | LOR + | LAND + | BOR + | BXOR + | BAND + | EQUAL + | NOT_EQUAL + | LT + | LTE + | GT + | GTE + | LSHIFT + | RSHIFT + | PLUS + | MINUS + | STAR + | DIV + | MOD + | NCommaExpr + ; + +binaryExpr + : b:binaryOperator + // no rules allowed as roots, so here I manually get + // the first and second children of the binary operator + // and then print them out in the right order + { TNode e1, e2; + e1 = (TNode) b.getFirstChild(); + e2 = (TNode) e1.getNextSibling(); + expr( e1 ); + print( b ); + expr( e2 ); + } + + ; + + +conditionalExpr + : #( q:QUESTION + expr { print( q ); } + ( expr )? + c:COLON { print( c ); } + expr + ) + ; + + +castExpr + : #( + c:NCast { print( c ); } + typeName + rp:RPAREN { print( rp ); } + expr + ) + ; + + +typeName + : specifierQualifierList (nonemptyAbstractDeclarator)? + ; + +nonemptyAbstractDeclarator + : #( NNonemptyAbstractDeclarator + ( pointerGroup + ( (lp1:LPAREN { print( lp1 ); } + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + rp1:RPAREN { print( rp1 ); } + ) + | ( + lb1:LBRACKET { print( lb1 ); } + (expr)? + rb1:RBRACKET { print( rb1 ); } + ) + )* + + | ( (lp2:LPAREN { print( lp2 ); } + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + rp2:RPAREN { print( rp2 ); } + ) + | ( + lb2:LBRACKET { print( lb2 ); } + (expr)? + rb2:RBRACKET { print( rb2 ); } + ) + )+ + ) + ) + ; + + + +unaryExpr + : #( i:INC { print( i ); } expr ) + | #( d:DEC { print( d ); } expr ) + | #( NUnaryExpr u:unaryOperator { print( u ); } expr) + | #( s:"sizeof" { print( s ); } + ( ( LPAREN typeName )=> + lps:LPAREN { print( lps ); } + typeName + rps:RPAREN { print( rps ); } + | expr + ) + ) + | #( a:"__alignof" { print( a ); } + ( ( LPAREN typeName )=> + lpa:LPAREN { print( lpa ); } + typeName + rpa:RPAREN { print( rpa ); } + | expr + ) + ) + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + unaryOperator + : BAND + | STAR + | PLUS + | MINUS + | BNOT + | LNOT + | LAND + | "__real" + | "__imag" + ; + + +postfixExpr + : #( NPostfixExpr + primaryExpr + ( a:PTR b:ID { print( a ); print( b ); } + | c:DOT d:ID { print( c ); print( d ); } + | #( n:NFunctionCallArgs { print( n ); } + (argExprList)? + rp:RPAREN { print( rp ); } + ) + | lb:LBRACKET { print( lb ); } + expr + rb:RBRACKET { print( rb ); } + | f:INC { print( f ); } + | g:DEC { print( g ); } + )+ + ) + ; + + + +primaryExpr + : i:ID { print( i ); } + | n:Number { print( n ); } + | charConst + | stringConst + +// JTC: +// ID should catch the enumerator +// leaving it in gives ambiguous err +// | enumerator + + | #( eg:NExpressionGroup { print( eg ); } + expr { print( ")" ); } + ) + ; + + + +argExprList + : expr ( {print( "," );} expr )* + ; + + + +protected +charConst + : c:CharLiteral { print( c ); } + ; + + +protected +stringConst + : #( NStringSeq + ( + s:StringLiteral { print( s ); } + )+ + ) + ; + + +protected +intConst + : IntOctalConst + | LongOctalConst + | UnsignedOctalConst + | IntIntConst + | LongIntConst + | UnsignedIntConst + | IntHexConst + | LongHexConst + | UnsignedHexConst + ; + + +protected +floatConst + : FloatDoubleConst + | DoubleDoubleConst + | LongDoubleConst + ; + + + + + + + + + + diff --git a/src/classes/com/sun/gluegen/cgram/GnuCParser.g b/src/classes/com/sun/gluegen/cgram/GnuCParser.g new file mode 100644 index 000000000..c90e01179 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/GnuCParser.g @@ -0,0 +1,864 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Copyright (c) Non, Inc. 1998 -- All Rights Reserved + +PROJECT: C Compiler +MODULE: GnuCParser +FILE: GnuCParser.g + +AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 + +DESCRIPTION: + This is a grammar for the GNU C compiler. It is a + grammar subclass of StdCParser, overriding only those + rules which are different from Standard C. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + + +header { + package com.sun.gluegen.cgram; + + import java.io.*; + + import antlr.CommonAST; + import antlr.DumpASTVisitor; +} + + +class GnuCParser extends StdCParser; + +options + { + k = 2; + exportVocab = GNUC; + buildAST = true; + ASTLabelType = "TNode"; + + // Copied following options from java grammar. + codeGenMakeSwitchThreshold = 2; + codeGenBitsetTestThreshold = 3; + } + + +{ + // Suppport C++-style single-line comments? + public static boolean CPPComments = true; + + // access to symbol table + public CSymbolTable symbolTable = new CSymbolTable(); + + // source for names to unnamed scopes + protected int unnamedScopeCounter = 0; + + public boolean isTypedefName(String name) { + boolean returnValue = false; + TNode node = symbolTable.lookupNameInCurrentScope(name); + for (; node != null; node = (TNode) node.getNextSibling() ) { + if(node.getType() == LITERAL_typedef) { + returnValue = true; + break; + } + } + return returnValue; + } + + + public String getAScopeName() { + return "" + (unnamedScopeCounter++); + } + + public void pushScope(String scopeName) { + symbolTable.pushScope(scopeName); + } + + public void popScope() { + symbolTable.popScope(); + } + + int traceDepth = 0; + public void reportError(RecognitionException ex) { + try { + System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); + ex.printStackTrace(System.err); + } + catch (TokenStreamException e) { + System.err.println("ANTLR Parsing Error: "+ex); + ex.printStackTrace(System.err); + } + } + public void reportError(String s) { + System.err.println("ANTLR Parsing Error from String: " + s); + } + public void reportWarning(String s) { + System.err.println("ANTLR Parsing Warning from String: " + s); + } + public void match(int t) throws MismatchedTokenException { + boolean debugging = false; + + if ( debugging ) { + for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); + + } + + } + try { + if ( LA(1)!=t ) { + if ( debugging ){ + for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] + + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); + } + catch (TokenStreamException e) { + } + } + public void traceOut(String rname) { + for (int x=0; x declaration + | ( functionPrefix )=> functionDef + | typelessDeclaration + | asm_expr + | SEMI + ; + +/* these two are here because GCC allows "cat = 13;" as a valid program! */ +functionPrefix + { String declName; } + : ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers + | //epsilon + ) + declName = d:declarator[true] + ( declaration )* (VARARGS)? ( SEMI )* + LCURLY + ; + +typelessDeclaration + { AST typeMissing = #[NTypeMissing]; } + : initDeclList[typeMissing] SEMI { ## = #( #[NTypeMissing], ##); } + ; + +initializer + : ( ( ( (initializerElementLabel)=> initializerElementLabel )? + ( assignExpr | lcurlyInitializer ) { ## = #( #[NInitializer], ## ); } + ) + | lcurlyInitializer + ) + ; + +// GCC allows more specific initializers +initializerElementLabel + : ( ( LBRACKET ((constExpr VARARGS)=> rangeExpr | constExpr) RBRACKET (ASSIGN)? ) + | ID COLON + | DOT ID ASSIGN + ) + { ## = #( #[NInitializerElementLabel], ##) ; } + ; + +// GCC allows empty initializer lists +lcurlyInitializer + : + LCURLY^ (initializerList ( COMMA! )? )? RCURLY + { ##.setType( NLcurlyInitializer ); } + ; + +initializerList + : initializer ( options{warnWhenFollowAmbig=false;}:COMMA! initializer )* + ; + + +declarator[boolean isFunctionDefinition] returns [String declName] + { declName = ""; } + : + ( pointerGroup )? + + ( id:ID { declName = id.getText(); } + | LPAREN declName = declarator[false] RPAREN + ) + + ( declaratorParamaterList[isFunctionDefinition, declName] + | LBRACKET ( expr )? RBRACKET + )* + { ## = #( #[NDeclarator], ## ); } + ; + +declaratorParamaterList[boolean isFunctionDefinition, String declName] + : + LPAREN^ + { + if (isFunctionDefinition) { + pushScope(declName); + } + else { + pushScope("!"+declName); + } + } + ( + (declSpecifiers)=> parameterTypeList + | (idList)? + ) + { + popScope(); + } + ( COMMA! )? + RPAREN + { ##.setType(NParameterTypeList); } + ; + +parameterTypeList + : parameterDeclaration + ( options { + warnWhenFollowAmbig = false; + } : + ( COMMA | SEMI ) + parameterDeclaration + )* + ( ( COMMA | SEMI ) + VARARGS + )? + ; + + +declarationList + : ( options { // this loop properly aborts when + // it finds a non-typedefName ID MBZ + warnWhenFollowAmbig = false; + } : + + localLabelDeclaration + | ( declarationPredictor )=> declaration + )+ + ; +localLabelDeclaration + : ( //GNU note: any __label__ declarations must come before regular declarations. + "__label__"^ ID (options{warnWhenFollowAmbig=false;}: COMMA! ID)* ( COMMA! )? ( SEMI! )+ + ) + ; + + +declaration + { AST ds1 = null; } + : ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } + ( + initDeclList[ds1] + )? + ( SEMI )+ + { ## = #( #[NDeclaration], ##); } + + ; + +functionStorageClassSpecifier + : "extern" + | "static" + | "inline" + ; + +typeSpecifier [int specCount] returns [int retSpecCount] + { retSpecCount = specCount + 1; } + : + ( "void" + | "char" + | "short" + | "int" + | "__int64" + | "long" + | "float" + | "double" + | "signed" + | "unsigned" + | structOrUnionSpecifier ( options{warnWhenFollowAmbig=false;}: attributeDecl )* + | enumSpecifier + | { specCount==0 }? typedefName + | "typeof"^ LPAREN + ( ( typeName )=> typeName + | expr + ) + RPAREN + | "__complex" + ) + ; + + +structOrUnionSpecifier + { String scopeName; } + : sou:structOrUnion! + ( ( ID LCURLY )=> i:ID l:LCURLY + { + scopeName = #sou.getText() + " " + #i.getText(); + #l.setText(scopeName); + pushScope(scopeName); + } + ( structDeclarationList )? + { popScope();} + RCURLY + | l1:LCURLY + { + scopeName = getAScopeName(); + #l1.setText(scopeName); + pushScope(scopeName); + } + ( structDeclarationList )? + { popScope(); } + RCURLY + | ID + ) + { + ## = #( #sou, ## ); + } + ; + + +structDeclaration + : specifierQualifierList structDeclaratorList ( COMMA! )? ( SEMI! )+ + ; + +structDeclaratorList + : structDeclarator ( options{warnWhenFollowAmbig=false;}: COMMA! structDeclarator )* + ; + +structDeclarator + : ( declarator[false] )? + ( COLON constExpr )? + ( attributeDecl )* + { ## = #( #[NStructDeclarator], ##); } + ; + + + +enumSpecifier + : "enum"^ + ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY + | LCURLY enumList["anonymous"] RCURLY + | ID + ) + ; +enumList[String enumName] + : enumerator[enumName] ( options{warnWhenFollowAmbig=false;}: COMMA! enumerator[enumName] )* ( COMMA! )? + ; + + +initDeclList[AST declarationSpecifiers] + : initDecl[declarationSpecifiers] + ( options{warnWhenFollowAmbig=false;}: COMMA! initDecl[declarationSpecifiers] )* + ( COMMA! )? + ; + +initDecl[AST declarationSpecifiers] + { String declName = ""; } + : declName = d:declarator[false] + { AST ds1, d1; + ds1 = astFactory.dupList(declarationSpecifiers); + d1 = astFactory.dupList(#d); + symbolTable.add(declName, #(null, ds1, d1) ); + } + ( attributeDecl )* + ( ASSIGN initializer + | COLON expr + )? + { ## = #( #[NInitDecl], ## ); } + ; + +attributeDecl + : "__attribute"^ LPAREN LPAREN attributeList RPAREN RPAREN + | "asm"^ LPAREN stringConst RPAREN { ##.setType( NAsmAttribute ); } + ; + +attributeList + : attribute ( options{warnWhenFollowAmbig=false;}: COMMA attribute)* ( COMMA )? + ; + +attribute + : ( ~(LPAREN | RPAREN | COMMA) + | LPAREN attributeList RPAREN + )* + ; +compoundStatement[String scopeName] + : LCURLY^ + + { + pushScope(scopeName); + } + ( //this ambiguity is ok, declarationList and nestedFunctionDef end properly + options { + warnWhenFollowAmbig = false; + } : + ( "typedef" | "__label__" | declaration )=> declarationList + | (nestedFunctionDef)=> nestedFunctionDef + )* + ( statementList )? + { popScope(); } + RCURLY + { ##.setType( NCompoundStatement ); ##.setAttribute( "scopeName", scopeName ); } + ; + +nestedFunctionDef + { String declName; } + : ( "auto" )? //only for nested functions + ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers + )? + declName = d:declarator[false] + { + AST d2, ds2; + d2 = astFactory.dupList(#d); + ds2 = astFactory.dupList(#ds); + symbolTable.add(declName, #(null, ds2, d2)); + pushScope(declName); + } + ( declaration )* + { popScope(); } + compoundStatement[declName] + { ## = #( #[NFunctionDef], ## );} + ; + +statement + : SEMI // Empty statements + + | compoundStatement[getAScopeName()] // Group of statements + + | expr SEMI! { ## = #( #[NStatementExpr], ## );} // Expressions + +// Iteration statements: + + | "while"^ LPAREN! expr RPAREN! statement + | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! + |! "for" + LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN + s:statement + { + if ( #e1 == null) { #e1 = (TNode) #[ NEmptyExpression ]; } + if ( #e2 == null) { #e2 = (TNode) #[ NEmptyExpression ]; } + if ( #e3 == null) { #e3 = (TNode) #[ NEmptyExpression ]; } + ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); + } + + +// Jump statements: + + | "goto"^ expr SEMI! + | "continue" SEMI! + | "break" SEMI! + | "return"^ ( expr )? SEMI! + + + | ID COLON! (options {warnWhenFollowAmbig=false;}: statement)? { ## = #( #[NLabel], ## ); } +// GNU allows range expressions in case statements + | "case"^ ((constExpr VARARGS)=> rangeExpr | constExpr) COLON! ( options{warnWhenFollowAmbig=false;}:statement )? + | "default"^ COLON! ( options{warnWhenFollowAmbig=false;}: statement )? + +// Selection statements: + + | "if"^ + LPAREN! expr RPAREN! statement + ( //standard if-else ambiguity + options { + warnWhenFollowAmbig = false; + } : + "else" statement )? + | "switch"^ LPAREN! expr RPAREN! statement + ; + + + +conditionalExpr + : logicalOrExpr + ( QUESTION^ (expr)? COLON conditionalExpr )? + ; + +rangeExpr //used in initializers only + : constExpr VARARGS constExpr + { ## = #(#[NRangeExpr], ##); } + ; + +castExpr + : ( LPAREN typeName RPAREN )=> + LPAREN^ typeName RPAREN ( castExpr | lcurlyInitializer ) + { ##.setType(NCast); } + + | unaryExpr + ; +nonemptyAbstractDeclarator + : ( + pointerGroup + ( (LPAREN + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + ( COMMA! )? + RPAREN) + | (LBRACKET (expr)? RBRACKET) + )* + + | ( (LPAREN + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + ( COMMA! )? + RPAREN) + | (LBRACKET (expr)? RBRACKET) + )+ + ) + { ## = #( #[NNonemptyAbstractDeclarator], ## ); } + + ; + + + +unaryExpr + : postfixExpr + | INC^ castExpr + | DEC^ castExpr + | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } + + | "sizeof"^ + ( ( LPAREN typeName )=> LPAREN typeName RPAREN + | unaryExpr + ) + | "__alignof"^ + ( ( LPAREN typeName )=> LPAREN typeName RPAREN + | unaryExpr + ) + | gnuAsmExpr + ; + +unaryOperator + : BAND + | STAR + | PLUS + | MINUS + | BNOT //also stands for complex conjugation + | LNOT + | LAND //for label dereference (&&label) + | "__real" + | "__imag" + ; + +gnuAsmExpr + : "asm"^ ("volatile")? + LPAREN stringConst + ( options { warnWhenFollowAmbig = false; }: + COLON (strOptExprPair ( COMMA strOptExprPair)* )? + ( options { warnWhenFollowAmbig = false; }: + COLON (strOptExprPair ( COMMA strOptExprPair)* )? + )? + )? + ( COLON stringConst ( COMMA stringConst)* )? + RPAREN + { ##.setType(NGnuAsmExpr); } + ; + +//GCC requires the PARENs +strOptExprPair + : stringConst ( LPAREN expr RPAREN )? + ; + + +primaryExpr + : ID + | Number + | charConst + | stringConst +// JTC: +// ID should catch the enumerator +// leaving it in gives ambiguous err +// | enumerator + | (LPAREN LCURLY) => LPAREN^ compoundStatement[getAScopeName()] RPAREN + | LPAREN^ expr RPAREN { ##.setType(NExpressionGroup); } + ; + + +{ + import java.io.*; + import java.util.*; + import antlr.*; +} + +class GnuCLexer extends StdCLexer; +options + { + k = 3; + importVocab = GNUC; + testLiterals = false; + } +tokens { + LITERAL___extension__ = "__extension__"; +} + +{ + public void initialize(String src) + { + setOriginalSource(src); + initialize(); + } + + public void initialize() + { + literals.put(new ANTLRHashString("__alignof__", this), new Integer(LITERAL___alignof)); + literals.put(new ANTLRHashString("__asm", this), new Integer(LITERAL_asm)); + literals.put(new ANTLRHashString("__asm__", this), new Integer(LITERAL_asm)); + literals.put(new ANTLRHashString("__attribute__", this), new Integer(LITERAL___attribute)); + literals.put(new ANTLRHashString("__complex__", this), new Integer(LITERAL___complex)); + literals.put(new ANTLRHashString("__const", this), new Integer(LITERAL_const)); + literals.put(new ANTLRHashString("__const__", this), new Integer(LITERAL_const)); + literals.put(new ANTLRHashString("__imag__", this), new Integer(LITERAL___imag)); + literals.put(new ANTLRHashString("__inline", this), new Integer(LITERAL_inline)); + literals.put(new ANTLRHashString("__inline__", this), new Integer(LITERAL_inline)); + literals.put(new ANTLRHashString("__real__", this), new Integer(LITERAL___real)); + literals.put(new ANTLRHashString("__signed", this), new Integer(LITERAL_signed)); + literals.put(new ANTLRHashString("__signed__", this), new Integer(LITERAL_signed)); + literals.put(new ANTLRHashString("__typeof", this), new Integer(LITERAL_typeof)); + literals.put(new ANTLRHashString("__typeof__", this), new Integer(LITERAL_typeof)); + literals.put(new ANTLRHashString("__volatile", this), new Integer(LITERAL_volatile)); + literals.put(new ANTLRHashString("__volatile__", this), new Integer(LITERAL_volatile)); + } + + + LineObject lineObject = new LineObject(); + String originalSource = ""; + PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); + int tokenNumber = 0; + boolean countingTokens = true; + int deferredLineCount = 0; + List defines = new ArrayList(); + + public void setCountingTokens(boolean ct) + { + countingTokens = ct; + if ( countingTokens ) { + tokenNumber = 0; + } + else { + tokenNumber = 1; + } + } + + public void setOriginalSource(String src) + { + originalSource = src; + lineObject.setSource(src); + } + public void setSource(String src) + { + lineObject.setSource(src); + } + + public PreprocessorInfoChannel getPreprocessorInfoChannel() + { + return preprocessorInfoChannel; + } + + public void setPreprocessingDirective(String pre) + { + preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); + } + + public void addDefine(String name, String value) + { + defines.add(new Define(name, value)); + } + + /** Returns a list of Define objects corresponding to the + preprocessor definitions seen during parsing. */ + public List getDefines() { + return defines; + } + + protected Token makeToken(int t) + { + if ( t != Token.SKIP && countingTokens) { + tokenNumber++; + } + CToken tok = (CToken) super.makeToken(t); + tok.setLine(lineObject.line); + tok.setSource(lineObject.source); + tok.setTokenNumber(tokenNumber); + + lineObject.line += deferredLineCount; + deferredLineCount = 0; + return tok; + } + + public void deferredNewline() { + deferredLineCount++; + } + + public void newline() { + lineObject.newline(); + } + + + + + + +} +Whitespace + : ( ( ' ' | '\t' | '\014') + | "\r\n" { newline(); } + | ( '\n' | '\r' ) { newline(); } + ) { _ttype = Token.SKIP; } + ; + + +protected +Escape + : '\\' + ( options{warnWhenFollowAmbig=false;}: + ~('0'..'7' | 'x') + | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit )* + | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )* + | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ + ) + ; + +protected IntSuffix + : 'L' + | 'l' + | 'U' + | 'u' + | 'I' + | 'i' + | 'J' + | 'j' + ; +protected NumberSuffix + : + IntSuffix + | 'F' + | 'f' + ; + +Number + : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ + ( '.' ( Digit )* ( Exponent )? + | Exponent + ) + ( NumberSuffix + )* + + | ( "..." )=> "..." { _ttype = VARARGS; } + + | '.' { _ttype = DOT; } + ( ( Digit )+ ( Exponent )? + { _ttype = Number; } + ( NumberSuffix + )* + )? + + | '0' ( '0'..'7' )* + ( NumberSuffix + )* + + | '1'..'9' ( Digit )* + ( NumberSuffix + )* + + | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ + ( IntSuffix + )* + ; + +IDMEAT + : + i:ID { + + if ( i.getType() == LITERAL___extension__ ) { + $setType(Token.SKIP); + } + else { + $setType(i.getType()); + } + + } + ; + +protected ID + options + { + testLiterals = true; + } + : ( 'a'..'z' | 'A'..'Z' | '_' | '$') + ( 'a'..'z' | 'A'..'Z' | '_' | '$' | '0'..'9' )* + ; + +WideCharLiteral + : + 'L' CharLiteral + { $setType(CharLiteral); } + ; + + + +WideStringLiteral + : + 'L' StringLiteral + { $setType(StringLiteral); } + ; + +StringLiteral + : + '"' + ( ('\\' ~('\n'))=> Escape + | ( '\r' { newline(); } + | '\n' { + newline(); + } + | '\\' '\n' { + newline(); + } + ) + | ~( '"' | '\r' | '\n' | '\\' ) + )* + '"' + ; + + + + diff --git a/src/classes/com/sun/gluegen/cgram/GnuCTreeParser.g b/src/classes/com/sun/gluegen/cgram/GnuCTreeParser.g new file mode 100644 index 000000000..5231dee17 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/GnuCTreeParser.g @@ -0,0 +1,852 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Copyright (c) Non, Inc. 1998 -- All Rights Reserved + +PROJECT: C Compiler +MODULE: GnuCTreeParser +FILE: GnuCTreeParser.g + +AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 + +DESCRIPTION: + + This tree grammar is for a Gnu C AST. No actions in it, + subclass to do something useful. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + + +header { + package com.sun.gluegen.cgram; + + import java.io.*; + + import antlr.CommonAST; + import antlr.DumpASTVisitor; +} + + +class GnuCTreeParser extends TreeParser; + +options + { + importVocab = GNUC; + buildAST = false; + ASTLabelType = "TNode"; + + // Copied following options from java grammar. + codeGenMakeSwitchThreshold = 2; + codeGenBitsetTestThreshold = 3; + } + + +{ + int traceDepth = 0; + public void reportError(RecognitionException ex) { + if ( ex != null) { + System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); + ex.printStackTrace(System.err); + } + } + public void reportError(NoViableAltException ex) { + System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); + TNode.printTree( ex.node ); + ex.printStackTrace(System.err); + } + public void reportError(MismatchedTokenException ex) { + if ( ex != null) { + TNode.printTree( ex.node ); + System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); + ex.printStackTrace(System.err); + } + } + public void reportError(String s) { + System.err.println("ANTLR Error from String: " + s); + } + public void reportWarning(String s) { + System.err.println("ANTLR Warning from String: " + s); + } + protected void match(AST t, int ttype) throws MismatchedTokenException { + //System.out.println("match("+ttype+"); cursor is "+t); + super.match(t, ttype); + } + public void match(AST t, BitSet b) throws MismatchedTokenException { + //System.out.println("match("+b+"); cursor is "+t); + super.match(t, b); + } + protected void matchNot(AST t, int ttype) throws MismatchedTokenException { + //System.out.println("matchNot("+ttype+"); cursor is "+t); + super.matchNot(t, ttype); + } + public void traceIn(String rname, AST t) { + traceDepth += 1; + for (int x=0; x typeName + | expr + ) + RPAREN + ) + | "__complex" + ; + + +typedefName + : #(NTypedefName ID) + ; + + +structSpecifier + : #( "struct" structOrUnionBody ) + ; + +unionSpecifier + : #( "union" structOrUnionBody ) + ; + +structOrUnionBody + : ( (ID LCURLY) => ID LCURLY + ( structDeclarationList )? + RCURLY + | LCURLY + ( structDeclarationList )? + RCURLY + | ID + ) + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + +structDeclarationList + : ( structDeclaration )+ + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + +structDeclaration + : specifierQualifierList structDeclaratorList + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + +specifierQualifierList + : ( + typeSpecifier + | typeQualifier + )+ + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + +structDeclaratorList + : ( structDeclarator )+ + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + +structDeclarator + : + #( NStructDeclarator + ( declarator )? + ( COLON expr )? + ( attributeDecl )* + ) + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + + +enumSpecifier + : #( "enum" + ( ID )? + ( LCURLY enumList RCURLY )? + ) + ; + + +enumList + : ( enumerator )+ + ; + + +enumerator + : ID ( ASSIGN expr )? + ; + + + +attributeDecl: + #( "__attribute" (.)* ) + | #( NAsmAttribute LPAREN expr RPAREN ) + ; + +initDeclList + : ( initDecl )+ + ; + + +initDecl + { String declName = ""; } + : #( NInitDecl + declarator + ( attributeDecl )* + ( ASSIGN initializer + | COLON expr + )? + ) + ; + + +pointerGroup + : #( NPointerGroup ( STAR ( typeQualifier )* )+ ) + ; + + + +idList + : ID ( COMMA ID )* + ; + + + +initializer + : #( NInitializer (initializerElementLabel)? expr ) + | lcurlyInitializer + ; + +initializerElementLabel + : #( NInitializerElementLabel + ( + ( LBRACKET expr RBRACKET (ASSIGN)? ) + | ID COLON + | DOT ID ASSIGN + ) + ) + ; + +lcurlyInitializer + : #( NLcurlyInitializer + initializerList + RCURLY + ) + ; + +initializerList + : ( initializer )* + ; + + +declarator + : #( NDeclarator + ( pointerGroup )? + + ( id:ID + | LPAREN declarator RPAREN + ) + + ( #( NParameterTypeList + ( + parameterTypeList + | (idList)? + ) + RPAREN + ) + | LBRACKET ( expr )? RBRACKET + )* + ) + ; + + + +parameterTypeList + : ( parameterDeclaration ( COMMA | SEMI )? )+ ( VARARGS )? + ; + + + +parameterDeclaration + : #( NParameterDeclaration + declSpecifiers + (declarator | nonemptyAbstractDeclarator)? + ) + ; + + +functionDef + : #( NFunctionDef + ( functionDeclSpecifiers)? + declarator + (declaration | VARARGS)* + compoundStatement + ) + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + +functionDeclSpecifiers + : + ( functionStorageClassSpecifier + | typeQualifier + | typeSpecifier + )+ + ; + +declarationList + : + ( //ANTLR doesn't know that declarationList properly eats all the declarations + //so it warns about the ambiguity + options { + warnWhenFollowAmbig = false; + } : + localLabelDecl + | declaration + )+ + ; + +localLabelDecl + : #("__label__" (ID)+ ) + ; + + + +compoundStatement + : #( NCompoundStatement + ( declarationList + | functionDef + )* + ( statementList )? + RCURLY + ) + ; + +statementList + : ( statement )+ + ; + +statement + : statementBody + ; + +statementBody + : SEMI // Empty statements + + | compoundStatement // Group of statements + + | #(NStatementExpr expr) // Expressions + +// Iteration statements: + + | #( "while" expr statement ) + | #( "do" statement expr ) + | #( "for" + expr expr expr + statement + ) + + +// Jump statements: + + | #( "goto" expr ) + | "continue" + | "break" + | #( "return" ( expr )? ) + + +// Labeled statements: + | #( NLabel ID (statement)? ) + | #( "case" expr (statement)? ) + | #( "default" (statement)? ) + + + +// Selection statements: + + | #( "if" + expr statement + ( "else" statement )? + ) + | #( "switch" expr statement ) + + + + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + + + + + +expr + : assignExpr + | conditionalExpr + | logicalOrExpr + | logicalAndExpr + | inclusiveOrExpr + | exclusiveOrExpr + | bitAndExpr + | equalityExpr + | relationalExpr + | shiftExpr + | additiveExpr + | multExpr + | castExpr + | unaryExpr + | postfixExpr + | primaryExpr + | commaExpr + | emptyExpr + | compoundStatementExpr + | initializer + | rangeExpr + | gnuAsmExpr + ; + +commaExpr + : #(NCommaExpr expr expr) + ; + +emptyExpr + : NEmptyExpression + ; + +compoundStatementExpr + : #(LPAREN compoundStatement RPAREN) + ; + +rangeExpr + : #(NRangeExpr expr VARARGS expr) + ; + +gnuAsmExpr + : #(NGnuAsmExpr + ("volatile")? + LPAREN stringConst + ( options { warnWhenFollowAmbig = false; }: + COLON (strOptExprPair ( COMMA strOptExprPair)* )? + ( options { warnWhenFollowAmbig = false; }: + COLON (strOptExprPair ( COMMA strOptExprPair)* )? + )? + )? + ( COLON stringConst ( COMMA stringConst)* )? + RPAREN + ) + ; + +strOptExprPair + : stringConst ( LPAREN expr RPAREN )? + ; + +assignExpr + : #( ASSIGN expr expr) + | #( DIV_ASSIGN expr expr) + | #( PLUS_ASSIGN expr expr) + | #( MINUS_ASSIGN expr expr) + | #( STAR_ASSIGN expr expr) + | #( MOD_ASSIGN expr expr) + | #( RSHIFT_ASSIGN expr expr) + | #( LSHIFT_ASSIGN expr expr) + | #( BAND_ASSIGN expr expr) + | #( BOR_ASSIGN expr expr) + | #( BXOR_ASSIGN expr expr) + ; + + +conditionalExpr + : #( QUESTION expr (expr)? COLON expr ) + ; + + +logicalOrExpr + : #( LOR expr expr) + ; + + +logicalAndExpr + : #( LAND expr expr ) + ; + + +inclusiveOrExpr + : #( BOR expr expr ) + ; + + +exclusiveOrExpr + : #( BXOR expr expr ) + ; + + +bitAndExpr + : #( BAND expr expr ) + ; + + + +equalityExpr + : #( EQUAL expr expr) + | #( NOT_EQUAL expr expr) + ; + + +relationalExpr + : #( LT expr expr) + | #( LTE expr expr) + | #( GT expr expr) + | #( GTE expr expr) + ; + + + +shiftExpr + : #( LSHIFT expr expr) + | #( RSHIFT expr expr) + ; + + +additiveExpr + : #( PLUS expr expr) + | #( MINUS expr expr) + ; + + +multExpr + : #( STAR expr expr) + | #( DIV expr expr) + | #( MOD expr expr) + ; + + + +castExpr + : #( NCast typeName RPAREN expr) + ; + + +typeName + : specifierQualifierList (nonemptyAbstractDeclarator)? + ; + +nonemptyAbstractDeclarator + : #( NNonemptyAbstractDeclarator + ( pointerGroup + ( (LPAREN + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + RPAREN) + | (LBRACKET (expr)? RBRACKET) + )* + + | ( (LPAREN + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + RPAREN) + | (LBRACKET (expr)? RBRACKET) + )+ + ) + ) + ; + + + +unaryExpr + : #( INC expr ) + | #( DEC expr ) + | #( NUnaryExpr unaryOperator expr) + | #( "sizeof" + ( ( LPAREN typeName )=> LPAREN typeName RPAREN + | expr + ) + ) + | #( "__alignof" + ( ( LPAREN typeName )=> LPAREN typeName RPAREN + | expr + ) + ) + ; +/* +exception +catch [RecognitionException ex] + { + reportError(ex); + System.out.println("PROBLEM TREE:\n" + + _t.toStringList()); + if (_t!=null) {_t = _t.getNextSibling();} + } +*/ + + unaryOperator + : BAND + | STAR + | PLUS + | MINUS + | BNOT + | LNOT + | LAND + | "__real" + | "__imag" + ; + + +postfixExpr + : #( NPostfixExpr + primaryExpr + ( PTR ID + | DOT ID + | #( NFunctionCallArgs (argExprList)? RPAREN ) + | LBRACKET expr RBRACKET + | INC + | DEC + )+ + ) + ; + + + +primaryExpr + : ID + | Number + | charConst + | stringConst + +// JTC: +// ID should catch the enumerator +// leaving it in gives ambiguous err +// | enumerator + + | #( NExpressionGroup expr ) + ; + + + +argExprList + : ( expr )+ + ; + + + +protected +charConst + : CharLiteral + ; + + +protected +stringConst + : #(NStringSeq (StringLiteral)+) + ; + + +protected +intConst + : IntOctalConst + | LongOctalConst + | UnsignedOctalConst + | IntIntConst + | LongIntConst + | UnsignedIntConst + | IntHexConst + | LongHexConst + | UnsignedHexConst + ; + + +protected +floatConst + : FloatDoubleConst + | DoubleDoubleConst + | LongDoubleConst + ; + + + + + + + + + diff --git a/src/classes/com/sun/gluegen/cgram/HeaderParser.g b/src/classes/com/sun/gluegen/cgram/HeaderParser.g new file mode 100644 index 000000000..212e56091 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/HeaderParser.g @@ -0,0 +1,715 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +header { + package com.sun.gluegen.cgram; + + import java.io.*; + import java.util.*; + + import antlr.CommonAST; + import com.sun.gluegen.cgram.types.*; +} + +class HeaderParser extends GnuCTreeParser; +options { + k = 1; +} + +{ + /** Name assigned to a anonymous EnumType (e.g., "enum { ... }"). */ + public static final String ANONYMOUS_ENUM_NAME = ""; + + /** Set the machine description for this HeaderParser. Must be + done before parsing. */ + public void setMachineDescription(MachineDescription machDesc) { + this.machDesc = machDesc; + } + + /** Returns the MachineDescription this HeaderParser uses. */ + public MachineDescription machineDescription() { + return machDesc; + } + + /** Set the dictionary mapping typedef names to types for this + HeaderParser. Must be done before parsing. */ + public void setTypedefDictionary(TypeDictionary dict) { + this.typedefDictionary = dict; + } + + /** Returns the typedef dictionary this HeaderParser uses. */ + public TypeDictionary getTypedefDictionary() { + return typedefDictionary; + } + + /** Set the dictionary mapping struct names (i.e., the "foo" in + "struct foo { ... };") to types for this HeaderParser. Must be done + before parsing. */ + public void setStructDictionary(TypeDictionary dict) { + this.structDictionary = dict; + } + + /** Returns the struct name dictionary this HeaderParser uses. */ + public TypeDictionary getStructDictionary() { + return structDictionary; + } + + /** Get the canonicalization map, which is a regular HashMap + mapping Type to Type and which is used for looking up the unique + instances of e.g. pointer-to-structure types that have been typedefed + and therefore have names. */ + public Map getCanonMap() { + return canonMap; + } + + /** Pre-define the list of EnumTypes for this HeaderParser. Must be + done before parsing. */ + public void setEnums(List/**/ enumTypes) { + // FIXME: Need to take the input set of EnumTypes, extract all + // the enumerates from each EnumType, and fill in the enumHash + // so that each enumerate maps to the enumType to which it + // belongs. + throw new RuntimeException("setEnums is Unimplemented!"); + } + + /** Returns the EnumTypes this HeaderParser processed. */ + public List/**/ getEnums() { + return new ArrayList(enumHash.values()); + } + + /** Clears the list of functions this HeaderParser has parsed. + Useful when reusing the same HeaderParser for more than one + header file. */ + public void clearParsedFunctions() { + functions.clear(); + } + + /** Returns the list of FunctionSymbols this HeaderParser has parsed. */ + public List getParsedFunctions() { + return functions; + } + + private CompoundType lookupInStructDictionary(String typeName, + CompoundTypeKind kind, + int cvAttrs) { + CompoundType t = (CompoundType) structDictionary.get(typeName); + if (t == null) { + t = new CompoundType(null, -1, kind, cvAttrs); + t.setStructName(typeName); + structDictionary.put(typeName, t); + } + return t; + } + + private Type lookupInTypedefDictionary(String typeName) { + Type t = typedefDictionary.get(typeName); + if (t == null) { + throw new RuntimeException("Undefined reference to typedef name " + typeName); + } + return t; + } + + static class ParameterDeclaration { + private String id; + private Type type; + + ParameterDeclaration(String id, Type type) { + this.id = id; + this.type = type; + } + String id() { return id; } + Type type() { return type; } + } + + // A box for a Type. Allows type to be passed down to be modified by recursive rules. + static class TypeBox { + private Type origType; + private Type type; + private boolean isTypedef; + + TypeBox(Type type) { + this(type, false); + } + + TypeBox(Type type, boolean isTypedef) { + this.origType = type; + this.isTypedef = isTypedef; + } + + Type type() { + if (type == null) { + return origType; + } + return type; + } + void setType(Type type) { + this.type = type; + } + void reset() { + type = null; + } + + boolean isTypedef() { return isTypedef; } + + // for easier debugging + public String toString() { + String tStr = "Type=NULL_REF"; + if (type == origType) { + tStr = "Type=ORIG_TYPE"; + } else if (type != null) { + tStr = "Type: name=\"" + type.getCVAttributesString() + " " + + type.getName() + "\"; signature=\"" + type + "\"; class " + + type.getClass().getName(); + } + String oStr = "OrigType=NULL_REF"; + if (origType != null) { + oStr = "OrigType: name=\"" + origType.getCVAttributesString() + " " + + origType.getName() + "\"; signature=\"" + origType + "\"; class " + + origType.getClass().getName(); + } + return "<["+tStr + "] [" + oStr + "] " + " isTypedef=" + isTypedef+">"; + } + } + + private MachineDescription machDesc; + private boolean doDeclaration; // Used to only process function typedefs + private String declId; + private List parameters; + private TypeDictionary typedefDictionary; + private TypeDictionary structDictionary; + private List/**/ functions = new ArrayList(); + // hash from name of an enumerated value to the EnumType to which it belongs + private HashMap/**/ enumHash = new HashMap(); + + // Storage class specifiers + private static final int AUTO = 1 << 0; + private static final int REGISTER = 1 << 1; + private static final int TYPEDEF = 1 << 2; + // Function storage class specifiers + private static final int EXTERN = 1 << 3; + private static final int STATIC = 1 << 4; + private static final int INLINE = 1 << 5; + // Type qualifiers + private static final int CONST = 1 << 6; + private static final int VOLATILE = 1 << 7; + private static final int SIGNED = 1 << 8; + private static final int UNSIGNED = 1 << 9; + + private void initDeclaration() { + doDeclaration = false; + declId = null; + } + + private void doDeclaration() { + doDeclaration = true; + } + + private void processDeclaration(Type returnType) { + if (doDeclaration) { + FunctionSymbol sym = new FunctionSymbol(declId, new FunctionType(null, -1, returnType, 0)); + if (parameters != null) { // handle funcs w/ empty parameter lists (e.g., "foo()") + for (Iterator iter = parameters.iterator(); iter.hasNext(); ) { + ParameterDeclaration pd = (ParameterDeclaration) iter.next(); + sym.addArgument(pd.type(), pd.id()); + } + } + functions.add(sym); + } + } + + private int attrs2CVAttrs(int attrs) { + int cvAttrs = 0; + if ((attrs & CONST) != 0) { + cvAttrs |= CVAttributes.CONST; + } + if ((attrs & VOLATILE) != 0) { + cvAttrs |= CVAttributes.VOLATILE; + } + return cvAttrs; + } + + /** Helper routine which handles creating a pointer or array type + for [] expressions */ + private void handleArrayExpr(TypeBox tb, AST t) { + if (t != null) { + try { + // FIXME: this doesn't take into account struct alignment, which may be necessary + // See also FIXMEs in ArrayType.java + int len = parseIntConstExpr(t); + tb.setType(canonicalize(new ArrayType(tb.type(), len * tb.type().getSize(), len, 0))); + return; + } catch (RecognitionException e) { + // Fall through + } + } + tb.setType(canonicalize(new PointerType(machDesc.pointerSizeInBytes(), + tb.type(), + 0))); + } + + private int parseIntConstExpr(AST t) throws RecognitionException { + return intConstExpr(t); + } + + /** Utility function: creates a new EnumType with the given name, or + returns an existing one if it has already been created. */ + private EnumType getEnumType(String enumTypeName) { + EnumType enumType = null; + Iterator it = enumHash.values().iterator(); + while (it.hasNext()) { + EnumType potentialMatch = (EnumType)it.next(); + if (potentialMatch.getName().equals(enumTypeName)) { + enumType = potentialMatch; + break; + } + } + + if (enumType == null) { + enumType = new EnumType(enumTypeName, machDesc.longSizeInBytes()); + } + + return enumType; + } + + // Map used to canonicalize types. For example, we may typedef + // struct foo { ... } *pfoo; subsequent references to struct foo* should + // point to the same PointerType object that had its name set to "pfoo". + private Map canonMap = new HashMap(); + private Type canonicalize(Type t) { + Type res = (Type) canonMap.get(t); + if (res != null) { + return res; + } + canonMap.put(t, t); + return t; + } +} + +declarator[TypeBox tb] returns [String s] { + initDeclaration(); + s = null; + List params = null; + String funcPointerName = null; + TypeBox dummyTypeBox = null; +} + : #( NDeclarator + ( pointerGroup[tb] )? + + ( id:ID { s = id.getText(); } + | LPAREN funcPointerName = declarator[dummyTypeBox] RPAREN + ) + + ( #( NParameterTypeList + ( + params = parameterTypeList + | (idList)? + ) + RPAREN + ) { + if (id != null) { + declId = id.getText(); + parameters = params; // FIXME: Ken, why are we setting this class member here? + doDeclaration(); + } else if ( funcPointerName != null ) { + /* TypeBox becomes function pointer in this case */ + FunctionType ft = new FunctionType(null, -1, tb.type(), 0); + if (params == null) { + // If the function pointer has no declared parameters, it's a + // void function. I'm not sure if the parameter name is + // ever referenced anywhere when the type is VoidType, so + // just in case I'll set it to a comment string so it will + // still compile if written out to code anywhere. + ft.addArgument(new VoidType(0), "/*unnamed-void*/"); + } else { + for (Iterator iter = params.iterator(); iter.hasNext(); ) { + ParameterDeclaration pd = (ParameterDeclaration) iter.next(); + ft.addArgument(pd.type(), pd.id()); + } + } + tb.setType(canonicalize(new PointerType(machDesc.pointerSizeInBytes(), + ft, + 0))); + s = funcPointerName; + } + } + | LBRACKET ( e:expr )? RBRACKET { handleArrayExpr(tb, e); } + )* + ) + ; + +typelessDeclaration { + TypeBox tb = null; +} + : #(NTypeMissing initDeclList[tb] SEMI) + ; + +declaration { + TypeBox tb = null; +} + : #( NDeclaration + tb = declSpecifiers + ( + initDeclList[tb] + )? + ( SEMI )+ + ) { processDeclaration(tb.type()); } + ; + +parameterTypeList returns [List l] { l = new ArrayList(); ParameterDeclaration decl = null; } + : ( decl = parameterDeclaration { if (decl != null) l.add(decl); } ( COMMA | SEMI )? )+ ( VARARGS )? + ; + +parameterDeclaration returns [ParameterDeclaration pd] { + Type t = null; + String decl = null; + pd = null; + TypeBox tb = null; +} + : #( NParameterDeclaration + tb = declSpecifiers + (decl = declarator[tb] | nonemptyAbstractDeclarator[tb])? + ) { pd = new ParameterDeclaration(decl, tb.type()); } + ; + +functionDef { + TypeBox tb = null; +} + : #( NFunctionDef + ( functionDeclSpecifiers)? + declarator[tb] + (declaration | VARARGS)* + compoundStatement + ) + ; + +declSpecifiers returns [TypeBox tb] { + tb = null; + Type t = null; + int x = 0; + int y = 0; +} + : ( y = storageClassSpecifier { x |= y; } + | y = typeQualifier { x |= y; } + | t = typeSpecifier[x] + )+ +{ + if (t == null && + (x & (SIGNED | UNSIGNED)) != 0) { + t = new IntType("int", machDesc.intSizeInBytes(), ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); + } + tb = new TypeBox(t, ((x & TYPEDEF) != 0)); +} + ; + +storageClassSpecifier returns [int x] { x = 0; } + : "auto" { x |= AUTO; } + | "register" { x |= REGISTER; } + | "typedef" { x |= TYPEDEF; } + | x = functionStorageClassSpecifier + ; + + +functionStorageClassSpecifier returns [int x] { x = 0; } + : "extern" { x |= EXTERN; } + | "static" { x |= STATIC; } + | "inline" { x |= INLINE; } + ; + + +typeQualifier returns [int x] { x = 0; } + : "const" { x |= CONST; } + | "volatile" { x |= VOLATILE; } + | "signed" { x |= SIGNED; } + | "unsigned" { x |= UNSIGNED; } + ; + +typeSpecifier[int attributes] returns [Type t] { + t = null; + int cvAttrs = attrs2CVAttrs(attributes); + boolean unsigned = ((attributes & UNSIGNED) != 0); +} + : "void" { t = new VoidType(cvAttrs); } + | "char" { t = new IntType("char" , machDesc.charSizeInBytes(), unsigned, cvAttrs); } + | "short" { t = new IntType("short", machDesc.shortSizeInBytes(), unsigned, cvAttrs); } + | "int" { t = new IntType("int" , machDesc.intSizeInBytes(), unsigned, cvAttrs); } + | "long" { t = new IntType("long" , machDesc.longSizeInBytes(), unsigned, cvAttrs); } + | "__int64" { t = new IntType("__int64", machDesc.int64SizeInBytes(), unsigned, cvAttrs); } + | "float" { t = new FloatType("float", machDesc.floatSizeInBytes(), cvAttrs); } + | "double" { t = new DoubleType("double", machDesc.doubleSizeInBytes(), cvAttrs); } + | t = structSpecifier[cvAttrs] ( attributeDecl )* + | t = unionSpecifier [cvAttrs] ( attributeDecl )* + | t = enumSpecifier [cvAttrs] + | t = typedefName [cvAttrs] + | #("typeof" LPAREN + ( (typeName )=> typeName + | expr + ) + RPAREN + ) + | "__complex" + ; + +typedefName[int cvAttrs] returns [Type t] { t = null; } + : #(NTypedefName id : ID) + { + t = canonicalize(lookupInTypedefDictionary(id.getText()).getCVVariant(cvAttrs)); + } + ; + +structSpecifier[int cvAttrs] returns [Type t] { t = null; } + : #( "struct" t = structOrUnionBody[CompoundTypeKind.STRUCT, cvAttrs] ) + ; + +unionSpecifier[int cvAttrs] returns [Type t] { t = null; } + : #( "union" t = structOrUnionBody[CompoundTypeKind.UNION, cvAttrs] ) + ; + +structOrUnionBody[CompoundTypeKind kind, int cvAttrs] returns [CompoundType t] { + t = null; +} + : ( (ID LCURLY) => id:ID LCURLY { + t = (CompoundType) canonicalize(lookupInStructDictionary(id.getText(), kind, cvAttrs)); + } ( structDeclarationList[t] )? + RCURLY { t.setBodyParsed(); } + | LCURLY { t = new CompoundType(null, -1, kind, cvAttrs); } + ( structDeclarationList[t] )? + RCURLY { t.setBodyParsed(); } + | id2:ID { t = (CompoundType) canonicalize(lookupInStructDictionary(id2.getText(), kind, cvAttrs)); } + ) + ; + +structDeclarationList[CompoundType t] + : ( structDeclaration[t] )+ + ; + +structDeclaration[CompoundType containingType] { + Type t = null; + boolean addedAny = false; +} + : t = specifierQualifierList addedAny = structDeclaratorList[containingType, t] { + if (!addedAny) { + if (t != null) { + CompoundType ct = t.asCompound(); + if (ct.isUnion()) { + // Anonymous union + containingType.addField(new Field(null, t, -1)); + } + } + } + } + ; + +specifierQualifierList returns [Type t] { + t = null; int x = 0; int y = 0; +} + : ( + t = typeSpecifier[x] + | y = typeQualifier { x |= y; } + )+ { + if (t == null && + (x & (SIGNED | UNSIGNED)) != 0) { + t = new IntType("int", machDesc.intSizeInBytes(), ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); + } +} + ; + +structDeclaratorList[CompoundType containingType, Type t] returns [boolean addedAny] { + addedAny = false; + boolean y = false; +} + : ( y = structDeclarator[containingType, t] { addedAny = y; })+ + ; + +structDeclarator[CompoundType containingType, Type t] returns [boolean addedAny] { + addedAny = false; + String s = null; + TypeBox tb = new TypeBox(t); +} + : + #( NStructDeclarator + ( s = declarator[tb] { containingType.addField(new Field(s, tb.type(), -1)); addedAny = true; } )? + ( COLON expr { /* FIXME: bit types not handled yet */ } ) ? + ( attributeDecl )* + ) + ; + +// FIXME: this will not correctly set the name of the enumeration when +// encountering a declaration like this: +// +// typedef enum { } enumName; +// +// In this case calling getName() on the EnumType return value will +// incorrectly return HeaderParser.ANONYMOUS_ENUM_NAME instead of +// "enumName" +// +// I haven't implemented it yet because I'm not sure how to get the +// "enumName" *before* executing the enumList rule. +enumSpecifier [int cvAttrs] returns [Type t] { + t = null; +} + : #( "enum" + ( ( ID LCURLY )=> i:ID LCURLY enumList[(EnumType)(t = getEnumType(i.getText()))] RCURLY + | LCURLY enumList[(EnumType)(t = getEnumType(ANONYMOUS_ENUM_NAME))] RCURLY + | ID { t = getEnumType(i.getText()); } + ) + ) + ; + +enumList[EnumType enumeration] { + long defaultEnumerantValue = 0; +} + : ( defaultEnumerantValue = enumerator[enumeration, defaultEnumerantValue] )+ + ; + +enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValue] { + newDefaultValue = defaultValue; +} + : eName:ID ( ASSIGN eVal:expr )? { + // FIXME! Integer.parseInt() will throw if its argument is in octal or hex format. + long value = (eVal == null) ? defaultValue : Long.parseLong(eVal.getText()); + newDefaultValue = value+1; + String eTxt = eName.getText(); + if (enumHash.containsKey(eTxt)) { + EnumType oldEnumType = ((EnumType)enumHash.get(eTxt)); + long oldValue = oldEnumType.getEnumValue(eTxt); + System.err.println("WARNING: redefinition of enumerated value '" + eTxt + "';" + + " existing definition is in enumeration '" + oldEnumType.getName() + + "' with value " + oldValue + " and new definition is in enumeration '" + + enumeration.getName() + "' with value " + value); + // remove old definition + oldEnumType.removeEnumerate(eTxt); + } + // insert new definition + enumeration.addEnum(eTxt, value); + enumHash.put(eTxt, enumeration); + //System.err.println("ENUM [" + enumeration.getName() + "]: " + eTxt + " = " + enumeration.getEnumValue(eTxt) + + // " (new default = " + newDefaultValue + ")"); + } + ; + +initDeclList[TypeBox tb] + : ( initDecl[tb] )+ + ; + +initDecl[TypeBox tb] { + String declName = null; +} + : #( NInitDecl + declName = declarator[tb] { + //System.err.println("GOT declName: " + declName + " TB=" + tb); + } + ( attributeDecl )* + ( ASSIGN initializer + | COLON expr + )? + ) +{ + if ((declName != null) && (tb != null) && tb.isTypedef()) { + Type t = tb.type(); + //System.err.println("Adding typedef mapping: [" + declName + "] -> [" + t + "]"); + if (!t.hasTypedefName()) { + t.setName(declName); + } + t = canonicalize(t); + typedefDictionary.put(declName, t); + // Clear out PointerGroup effects in case another typedef variant follows + tb.reset(); + } +} + ; + +pointerGroup[TypeBox tb] { int x = 0; int y = 0; } + : #( NPointerGroup ( STAR { x = 0; y = 0; } ( y = typeQualifier { x |= y; } )* + { + //System.err.println("IN PTR GROUP: TB=" + tb); + if (tb != null) { + tb.setType(canonicalize(new PointerType(machDesc.pointerSizeInBytes(), + tb.type(), + attrs2CVAttrs(x)))); + } + } + )+ ) + ; + + +functionDeclSpecifiers + : + ( functionStorageClassSpecifier + | typeQualifier + | typeSpecifier[0] + )+ + ; + +typeName { + TypeBox tb = null; +} + : specifierQualifierList (nonemptyAbstractDeclarator[tb])? + ; + + +/* FIXME: the handling of types in this rule has not been well thought + out and is known to be incomplete. Currently it is only used to handle + pointerGroups for unnamed parameters. */ +nonemptyAbstractDeclarator[TypeBox tb] + : #( NNonemptyAbstractDeclarator + ( pointerGroup[tb] + ( (LPAREN + ( nonemptyAbstractDeclarator[tb] + | parameterTypeList + )? + RPAREN) + | (LBRACKET (e1:expr)? RBRACKET) { handleArrayExpr(tb, e1); } + )* + + | ( (LPAREN + ( nonemptyAbstractDeclarator[tb] + | parameterTypeList + )? + RPAREN) + | (LBRACKET (e2:expr)? RBRACKET) { handleArrayExpr(tb, e2); } + )+ + ) + ) + ; + +/* Helper routine for parsing expressions which evaluate to integer + constants. Can be made more complicated as necessary. */ +intConstExpr returns [int i] { i = -1; } + : n:Number { return Integer.parseInt(n.getText()); } + ; diff --git a/src/classes/com/sun/gluegen/cgram/LineObject.java b/src/classes/com/sun/gluegen/cgram/LineObject.java new file mode 100644 index 000000000..0ed470c92 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/LineObject.java @@ -0,0 +1,126 @@ +package com.sun.gluegen.cgram; + +class LineObject { + LineObject parent = null; + String source = ""; + int line = 1; + boolean enteringFile = false; + boolean returningToFile = false; + boolean systemHeader = false; + boolean treatAsC = false; + + public LineObject() + { + super(); + } + + public LineObject( LineObject lobj ) + { + parent = lobj.getParent(); + source = lobj.getSource(); + line = lobj.getLine(); + enteringFile = lobj.getEnteringFile(); + returningToFile = lobj.getReturningToFile(); + systemHeader = lobj.getSystemHeader(); + treatAsC = lobj.getTreatAsC(); + } + + public LineObject( String src) + { + source = src; + } + + public void setSource(String src) + { + source = src; + } + + public String getSource() + { + return source; + } + + public void setParent(LineObject par) + { + parent = par; + } + + public LineObject getParent() + { + return parent; + } + + public void setLine(int l) + { + line = l; + } + + public int getLine() + { + return line; + } + + public void newline() + { + line++; + } + + public void setEnteringFile(boolean v) + { + enteringFile = v; + } + + public boolean getEnteringFile() + { + return enteringFile; + } + + public void setReturningToFile(boolean v) + { + returningToFile = v; + } + + public boolean getReturningToFile() + { + return returningToFile; + } + + public void setSystemHeader(boolean v) + { + systemHeader = v; + } + + public boolean getSystemHeader() + { + return systemHeader; + } + + public void setTreatAsC(boolean v) + { + treatAsC = v; + } + + public boolean getTreatAsC() + { + return treatAsC; + } + + public String toString() { + StringBuffer ret; + ret = new StringBuffer("# " + line + " \"" + source + "\""); + if (enteringFile) { + ret.append(" 1"); + } + if (returningToFile) { + ret.append(" 2"); + } + if (systemHeader) { + ret.append(" 3"); + } + if (treatAsC) { + ret.append(" 4"); + } + return ret.toString(); + } +} + diff --git a/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java b/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java new file mode 100644 index 000000000..431af91d3 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/PreprocessorInfoChannel.java @@ -0,0 +1,73 @@ +package com.sun.gluegen.cgram; + +import java.util.*; + +public class PreprocessorInfoChannel +{ + Hashtable lineLists = new Hashtable(); // indexed by Token number + int firstValidTokenNumber = 0; + int maxTokenNumber = 0; + + public void addLineForTokenNumber( Object line, Integer toknum ) + { + if ( lineLists.containsKey( toknum ) ) { + Vector lines = (Vector) lineLists.get( toknum ); + lines.addElement(line); + } + else { + Vector lines = new Vector(); + lines.addElement(line); + lineLists.put(toknum, lines); + if ( maxTokenNumber < toknum.intValue() ) { + maxTokenNumber = toknum.intValue(); + } + } + } + + public int getMaxTokenNumber() + { + return maxTokenNumber; + } + + public Vector extractLinesPrecedingTokenNumber( Integer toknum ) + { + Vector lines = new Vector(); + if (toknum == null) return lines; + for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){ + Integer inti = new Integer(i); + if ( lineLists.containsKey( inti ) ) { + Vector tokenLineVector = (Vector) lineLists.get( inti ); + if ( tokenLineVector != null) { + Enumeration tokenLines = tokenLineVector.elements(); + while ( tokenLines.hasMoreElements() ) { + lines.addElement( tokenLines.nextElement() ); + } + lineLists.remove(inti); + } + } + } + firstValidTokenNumber = toknum.intValue(); + return lines; + } + + public String toString() + { + StringBuffer sb = new StringBuffer("PreprocessorInfoChannel:\n"); + for (int i = 0; i <= maxTokenNumber + 1; i++){ + Integer inti = new Integer(i); + if ( lineLists.containsKey( inti ) ) { + Vector tokenLineVector = (Vector) lineLists.get( inti ); + if ( tokenLineVector != null) { + Enumeration tokenLines = tokenLineVector.elements(); + while ( tokenLines.hasMoreElements() ) { + sb.append(inti + ":" + tokenLines.nextElement() + '\n'); + } + } + } + } + return sb.toString(); + } +} + + + diff --git a/src/classes/com/sun/gluegen/cgram/StdCParser.g b/src/classes/com/sun/gluegen/cgram/StdCParser.g new file mode 100644 index 000000000..e84fbfd6e --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/StdCParser.g @@ -0,0 +1,1375 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Copyright (c) Non, Inc. 1997 -- All Rights Reserved + +PROJECT: C Compiler +MODULE: Parser +FILE: stdc.g + +AUTHOR: John D. Mitchell (john@non.net), Jul 12, 1997 + +REVISION HISTORY: + + Name Date Description + ---- ---- ----------- + JDM 97.07.12 Initial version. + JTC 97.11.18 Declaration vs declarator & misc. hacking. + JDM 97.11.20 Fixed: declaration vs funcDef, + parenthesized expressions, + declarator iteration, + varargs recognition, + empty source file recognition, + and some typos. + + +DESCRIPTION: + + This grammar supports the Standard C language. + + Note clearly that this grammar does *NOT* deal with + preprocessor functionality (including things like trigraphs) + Nor does this grammar deal with multi-byte characters nor strings + containing multi-byte characters [these constructs are "exercises + for the reader" as it were :-)]. + + Please refer to the ISO/ANSI C Language Standard if you believe + this grammar to be in error. Please cite chapter and verse in any + correspondence to the author to back up your claim. + +TODO: + + - typedefName is commented out, needs a symbol table to resolve + ambiguity. + + - trees + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + + +header { + package com.sun.gluegen.cgram; + + import java.io.*; + + import antlr.CommonAST; + import antlr.DumpASTVisitor; +} + + +class StdCParser extends Parser; + +options + { + k = 2; + exportVocab = STDC; + buildAST = true; + ASTLabelType = "TNode"; + + // Copied following options from java grammar. + codeGenMakeSwitchThreshold = 2; + codeGenBitsetTestThreshold = 3; + } + + +{ + // Suppport C++-style single-line comments? + public static boolean CPPComments = true; + + // access to symbol table + public CSymbolTable symbolTable = new CSymbolTable(); + + // source for names to unnamed scopes + protected int unnamedScopeCounter = 0; + + public boolean isTypedefName(String name) { + boolean returnValue = false; + TNode node = symbolTable.lookupNameInCurrentScope(name); + for (; node != null; node = (TNode) node.getNextSibling() ) { + if(node.getType() == LITERAL_typedef) { + returnValue = true; + break; + } + } + return returnValue; + } + + + public String getAScopeName() { + return "" + (unnamedScopeCounter++); + } + + public void pushScope(String scopeName) { + symbolTable.pushScope(scopeName); + } + + public void popScope() { + symbolTable.popScope(); + } + + int traceDepth = 0; + public void reportError(RecognitionException ex) { + try { + System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); + ex.printStackTrace(System.err); + } + catch (TokenStreamException e) { + System.err.println("ANTLR Parsing Error: "+ex); + ex.printStackTrace(System.err); + } + } + public void reportError(String s) { + System.err.println("ANTLR Parsing Error from String: " + s); + } + public void reportWarning(String s) { + System.err.println("ANTLR Parsing Warning from String: " + s); + } + public void match(int t) throws MismatchedTokenException { + boolean debugging = false; + + if ( debugging ) { + for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); + + } + + } + try { + if ( LA(1)!=t ) { + if ( debugging ){ + for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] + + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); + } + catch (TokenStreamException e) { + } + } + public void traceOut(String rname) { + for (int x=0; x declaration + | functionDef + | asm_expr + ; + + +asm_expr + : "asm"^ + ("volatile")? LCURLY! expr RCURLY! SEMI! + ; + + +declaration + { AST ds1 = null; } + : ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } + ( + initDeclList[ds1] + )? + SEMI! + { ## = #( #[NDeclaration], ##); } + + ; + + +declSpecifiers + { int specCount=0; } + : ( options { // this loop properly aborts when + // it finds a non-typedefName ID MBZ + warnWhenFollowAmbig = false; + } : + s:storageClassSpecifier + | typeQualifier + | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> + specCount = typeSpecifier[specCount] + )+ + ; + +storageClassSpecifier + : "auto" + | "register" + | "typedef" + | functionStorageClassSpecifier + ; + + +functionStorageClassSpecifier + : "extern" + | "static" + ; + + +typeQualifier + : "const" + | "volatile" + ; + +typeSpecifier [int specCount] returns [int retSpecCount] + { retSpecCount = specCount + 1; } + : + ( "void" + | "char" + | "short" + | "int" + | "long" + | "float" + | "double" + | "signed" + | "unsigned" + | structOrUnionSpecifier + | enumSpecifier + | { specCount == 0 }? typedefName + ) + ; + + +typedefName + : { isTypedefName ( LT(1).getText() ) }? + i:ID { ## = #(#[NTypedefName], #i); } + ; + +structOrUnionSpecifier + { String scopeName; } + : sou:structOrUnion! + ( ( ID LCURLY )=> i:ID l:LCURLY + { + scopeName = #sou.getText() + " " + #i.getText(); + #l.setText(scopeName); + pushScope(scopeName); + } + structDeclarationList + { popScope();} + RCURLY! + | l1:LCURLY + { + scopeName = getAScopeName(); + #l1.setText(scopeName); + pushScope(scopeName); + } + structDeclarationList + { popScope(); } + RCURLY! + | ID + ) + { + ## = #( #sou, ## ); + } + ; + + +structOrUnion + : "struct" + | "union" + ; + + +structDeclarationList + : ( structDeclaration )+ + ; + + +structDeclaration + : specifierQualifierList structDeclaratorList ( SEMI! )+ + ; + + +specifierQualifierList + { int specCount = 0; } + : ( options { // this loop properly aborts when + // it finds a non-typedefName ID MBZ + warnWhenFollowAmbig = false; + } : + ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> + specCount = typeSpecifier[specCount] + | typeQualifier + )+ + ; + + +structDeclaratorList + : structDeclarator ( COMMA! structDeclarator )* + ; + + +structDeclarator + : + ( COLON constExpr + | declarator[false] ( COLON constExpr )? + ) + { ## = #( #[NStructDeclarator], ##); } + ; + + +enumSpecifier + : "enum"^ + ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY! + | LCURLY enumList["anonymous"] RCURLY! + | ID + ) + ; + + +enumList[String enumName] + : enumerator[enumName] ( COMMA! enumerator[enumName] )* + ; + +enumerator[String enumName] + : i:ID { symbolTable.add( i.getText(), + #( null, + #[LITERAL_enum, "enum"], + #[ ID, enumName] + ) + ); + } + (ASSIGN constExpr)? + ; + + +initDeclList[AST declarationSpecifiers] + : initDecl[declarationSpecifiers] + ( COMMA! initDecl[declarationSpecifiers] )* + ; + + +initDecl[AST declarationSpecifiers] + { String declName = ""; } + : declName = d:declarator[false] + { AST ds1, d1; + ds1 = astFactory.dupList(declarationSpecifiers); + d1 = astFactory.dupList(#d); + symbolTable.add(declName, #(null, ds1, d1) ); + } + ( ASSIGN initializer + | COLON expr + )? + { ## = #( #[NInitDecl], ## ); } + + ; + +pointerGroup + : ( STAR ( typeQualifier )* )+ { ## = #( #[NPointerGroup], ##); } + ; + + + +idList + : ID ( COMMA! ID )* + ; + + +initializer + : ( assignExpr + | LCURLY initializerList ( COMMA! )? RCURLY! + ) + { ## = #( #[NInitializer], ## ); } + ; + + +initializerList + : initializer ( COMMA! initializer )* + ; + + +declarator[boolean isFunctionDefinition] returns [String declName] + { declName = ""; } + : + ( pointerGroup )? + + ( id:ID { declName = id.getText(); } + | LPAREN declName = declarator[false] RPAREN + ) + + ( ! LPAREN + { + if (isFunctionDefinition) { + pushScope(declName); + } + else { + pushScope("!"+declName); + } + } + ( + (declSpecifiers)=> p:parameterTypeList + { + ## = #( null, ##, #( #[NParameterTypeList], #p ) ); + } + + | (i:idList)? + { + ## = #( null, ##, #( #[NParameterTypeList], #i ) ); + } + ) + { + popScope(); + } + RPAREN + | LBRACKET ( constExpr )? RBRACKET + )* + { ## = #( #[NDeclarator], ## ); } + ; + +parameterTypeList + : parameterDeclaration + ( options { + warnWhenFollowAmbig = false; + } : + COMMA! + parameterDeclaration + )* + ( COMMA! + VARARGS + )? + ; + + +parameterDeclaration + { String declName; } + : ds:declSpecifiers + ( ( declarator[false] )=> declName = d:declarator[false] + { + AST d2, ds2; + d2 = astFactory.dupList(#d); + ds2 = astFactory.dupList(#ds); + symbolTable.add(declName, #(null, ds2, d2)); + } + | nonemptyAbstractDeclarator + )? + { + ## = #( #[NParameterDeclaration], ## ); + } + ; + +/* JTC: + * This handles both new and old style functions. + * see declarator rule to see differences in parameters + * and here (declaration SEMI)* is the param type decls for the + * old style. may want to do some checking to check for illegal + * combinations (but I assume all parsed code will be legal?) + */ + +functionDef + { String declName; } + : ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers + | //epsilon + ) + declName = d:declarator[true] + { + AST d2, ds2; + d2 = astFactory.dupList(#d); + ds2 = astFactory.dupList(#ds); + symbolTable.add(declName, #(null, ds2, d2)); + pushScope(declName); + } + ( declaration )* (VARARGS)? ( SEMI! )* + { popScope(); } + compoundStatement[declName] + { ## = #( #[NFunctionDef], ## );} + ; + +functionDeclSpecifiers + { int specCount = 0; } + : ( options { // this loop properly aborts when + // it finds a non-typedefName ID MBZ + warnWhenFollowAmbig = false; + } : + functionStorageClassSpecifier + | typeQualifier + | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> + specCount = typeSpecifier[specCount] + )+ + ; + +declarationList + : ( options { // this loop properly aborts when + // it finds a non-typedefName ID MBZ + warnWhenFollowAmbig = false; + } : + ( declarationPredictor )=> declaration + )+ + ; + +declarationPredictor + : (options { //only want to look at declaration if I don't see typedef + warnWhenFollowAmbig = false; + }: + "typedef" + | declaration + ) + ; + + +compoundStatement[String scopeName] + : LCURLY! + { + pushScope(scopeName); + } + ( ( declarationPredictor)=> declarationList )? + ( statementList )? + { popScope(); } + RCURLY! + { ## = #( #[NCompoundStatement, scopeName], ##); } + ; + + +statementList + : ( statement )+ + ; +statement + : SEMI // Empty statements + + | compoundStatement[getAScopeName()] // Group of statements + + | expr SEMI! { ## = #( #[NStatementExpr], ## ); } // Expressions + +// Iteration statements: + + | "while"^ LPAREN! expr RPAREN! statement + | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! + |! "for" + LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN + s:statement + { + if ( #e1 == null) { #e1 = (TNode) #[ NEmptyExpression ]; } + if ( #e2 == null) { #e2 = (TNode) #[ NEmptyExpression ]; } + if ( #e3 == null) { #e3 = (TNode) #[ NEmptyExpression ]; } + ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); + } + + +// Jump statements: + + | "goto"^ ID SEMI! + | "continue" SEMI! + | "break" SEMI! + | "return"^ ( expr )? SEMI! + + +// Labeled statements: + | ID COLON! (options {warnWhenFollowAmbig=false;}:statement)? { ## = #( #[NLabel], ## ); } + | "case"^ constExpr COLON! statement + | "default"^ COLON! statement + + + +// Selection statements: + + | "if"^ + LPAREN! expr RPAREN! statement + ( //standard if-else ambiguity + options { + warnWhenFollowAmbig = false; + } : + "else" statement )? + | "switch"^ LPAREN! expr RPAREN! statement + ; + + + + + + +expr + : assignExpr (options { + /* MBZ: + COMMA is ambiguous between comma expressions and + argument lists. argExprList should get priority, + and it does by being deeper in the expr rule tree + and using (COMMA assignExpr)* + */ + warnWhenFollowAmbig = false; + } : + c:COMMA^ { #c.setType(NCommaExpr); } assignExpr + )* + ; + + +assignExpr + : conditionalExpr ( a:assignOperator! assignExpr { ## = #( #a, ## );} )? + ; + +assignOperator + : ASSIGN + | DIV_ASSIGN + | PLUS_ASSIGN + | MINUS_ASSIGN + | STAR_ASSIGN + | MOD_ASSIGN + | RSHIFT_ASSIGN + | LSHIFT_ASSIGN + | BAND_ASSIGN + | BOR_ASSIGN + | BXOR_ASSIGN + ; + + +conditionalExpr + : logicalOrExpr + ( QUESTION^ expr COLON! conditionalExpr )? + ; + + +constExpr + : conditionalExpr + ; + +logicalOrExpr + : logicalAndExpr ( LOR^ logicalAndExpr )* + ; + + +logicalAndExpr + : inclusiveOrExpr ( LAND^ inclusiveOrExpr )* + ; + +inclusiveOrExpr + : exclusiveOrExpr ( BOR^ exclusiveOrExpr )* + ; + + +exclusiveOrExpr + : bitAndExpr ( BXOR^ bitAndExpr )* + ; + + +bitAndExpr + : equalityExpr ( BAND^ equalityExpr )* + ; + + + +equalityExpr + : relationalExpr + ( ( EQUAL^ | NOT_EQUAL^ ) relationalExpr )* + ; + + +relationalExpr + : shiftExpr + ( ( LT^ | LTE^ | GT^ | GTE^ ) shiftExpr )* + ; + + + +shiftExpr + : additiveExpr + ( ( LSHIFT^ | RSHIFT^ ) additiveExpr )* + ; + + +additiveExpr + : multExpr + ( ( PLUS^ | MINUS^ ) multExpr )* + ; + + +multExpr + : castExpr + ( ( STAR^ | DIV^ | MOD^ ) castExpr )* + ; + + +castExpr + : ( LPAREN typeName RPAREN )=> + LPAREN! typeName RPAREN! ( castExpr ) + { ## = #( #[NCast, "("], ## ); } + + | unaryExpr + ; + + +typeName + : specifierQualifierList (nonemptyAbstractDeclarator)? + ; + +nonemptyAbstractDeclarator + : ( + pointerGroup + ( (LPAREN + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + RPAREN) + | (LBRACKET (expr)? RBRACKET) + )* + + | ( (LPAREN + ( nonemptyAbstractDeclarator + | parameterTypeList + )? + RPAREN) + | (LBRACKET (expr)? RBRACKET) + )+ + ) + { ## = #( #[NNonemptyAbstractDeclarator], ## ); } + + ; + +/* JTC: + +LR rules: + +abstractDeclarator + : nonemptyAbstractDeclarator + | // null + ; + +nonemptyAbstractDeclarator + : LPAREN nonemptyAbstractDeclarator RPAREN + | abstractDeclarator LPAREN RPAREN + | abstractDeclarator (LBRACKET (expr)? RBRACKET) + | STAR abstractDeclarator + ; +*/ + +unaryExpr + : postfixExpr + | INC^ unaryExpr + | DEC^ unaryExpr + | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } + + | "sizeof"^ + ( ( LPAREN typeName )=> LPAREN typeName RPAREN + | unaryExpr + ) + ; + + +unaryOperator + : BAND + | STAR + | PLUS + | MINUS + | BNOT + | LNOT + ; + +postfixExpr + : primaryExpr + ( + postfixSuffix {## = #( #[NPostfixExpr], ## );} + )? + ; +postfixSuffix + : + ( PTR ID + | DOT ID + | functionCall + | LBRACKET expr RBRACKET + | INC + | DEC + )+ + ; + +functionCall + : + LPAREN^ (a:argExprList)? RPAREN + { + ##.setType( NFunctionCallArgs ); + } + ; + + +primaryExpr + : ID + | charConst + | intConst + | floatConst + | stringConst + +// JTC: +// ID should catch the enumerator +// leaving it in gives ambiguous err +// | enumerator + | LPAREN! expr RPAREN! { ## = #( #[NExpressionGroup, "("], ## ); } + ; + +argExprList + : assignExpr ( COMMA! assignExpr )* + ; + + + +protected +charConst + : CharLiteral + ; + + +protected +stringConst + : (StringLiteral)+ { ## = #(#[NStringSeq], ##); } + ; + + +protected +intConst + : IntOctalConst + | LongOctalConst + | UnsignedOctalConst + | IntIntConst + | LongIntConst + | UnsignedIntConst + | IntHexConst + | LongHexConst + | UnsignedHexConst + ; + + +protected +floatConst + : FloatDoubleConst + | DoubleDoubleConst + | LongDoubleConst + ; + + + + + + +dummy + : NTypedefName + | NInitDecl + | NDeclarator + | NStructDeclarator + | NDeclaration + | NCast + | NPointerGroup + | NExpressionGroup + | NFunctionCallArgs + | NNonemptyAbstractDeclarator + | NInitializer + | NStatementExpr + | NEmptyExpression + | NParameterTypeList + | NFunctionDef + | NCompoundStatement + | NParameterDeclaration + | NCommaExpr + | NUnaryExpr + | NLabel + | NPostfixExpr + | NRangeExpr + | NStringSeq + | NInitializerElementLabel + | NLcurlyInitializer + | NAsmAttribute + | NGnuAsmExpr + | NTypeMissing + ; + + + + + + +{ + import java.io.*; + import antlr.*; +} + +class StdCLexer extends Lexer; + +options + { + k = 3; + exportVocab = STDC; + testLiterals = false; + } + +{ + LineObject lineObject = new LineObject(); + String originalSource = ""; + PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); + int tokenNumber = 0; + boolean countingTokens = true; + int deferredLineCount = 0; + + public void setCountingTokens(boolean ct) + { + countingTokens = ct; + if ( countingTokens ) { + tokenNumber = 0; + } + else { + tokenNumber = 1; + } + } + + public void setOriginalSource(String src) + { + originalSource = src; + lineObject.setSource(src); + } + public void setSource(String src) + { + lineObject.setSource(src); + } + + public PreprocessorInfoChannel getPreprocessorInfoChannel() + { + return preprocessorInfoChannel; + } + + public void setPreprocessingDirective(String pre) + { + preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); + } + + public void addDefine(String name, String value) + { + } + + protected Token makeToken(int t) + { + if ( t != Token.SKIP && countingTokens) { + tokenNumber++; + } + CToken tok = (CToken) super.makeToken(t); + tok.setLine(lineObject.line); + tok.setSource(lineObject.source); + tok.setTokenNumber(tokenNumber); + + lineObject.line += deferredLineCount; + deferredLineCount = 0; + return tok; + } + + public void deferredNewline() { + deferredLineCount++; + } + + public void newline() { + lineObject.newline(); + } + + + + + + +} + +protected +Vocabulary + : '\3'..'\377' + ; + + +/* Operators: */ + +ASSIGN : '=' ; +COLON : ':' ; +COMMA : ',' ; +QUESTION : '?' ; +SEMI : ';' ; +PTR : "->" ; + + +// DOT & VARARGS are commented out since they are generated as part of +// the Number rule below due to some bizarre lexical ambiguity shme. + +// DOT : '.' ; +protected +DOT:; + +// VARARGS : "..." ; +protected +VARARGS:; + + +LPAREN : '(' ; +RPAREN : ')' ; +LBRACKET : '[' ; +RBRACKET : ']' ; +LCURLY : '{' ; +RCURLY : '}' ; + +EQUAL : "==" ; +NOT_EQUAL : "!=" ; +LTE : "<=" ; +LT : "<" ; +GTE : ">=" ; +GT : ">" ; + +DIV : '/' ; +DIV_ASSIGN : "/=" ; +PLUS : '+' ; +PLUS_ASSIGN : "+=" ; +INC : "++" ; +MINUS : '-' ; +MINUS_ASSIGN : "-=" ; +DEC : "--" ; +STAR : '*' ; +STAR_ASSIGN : "*=" ; +MOD : '%' ; +MOD_ASSIGN : "%=" ; +RSHIFT : ">>" ; +RSHIFT_ASSIGN : ">>=" ; +LSHIFT : "<<" ; +LSHIFT_ASSIGN : "<<=" ; + +LAND : "&&" ; +LNOT : '!' ; +LOR : "||" ; + +BAND : '&' ; +BAND_ASSIGN : "&=" ; +BNOT : '~' ; +BOR : '|' ; +BOR_ASSIGN : "|=" ; +BXOR : '^' ; +BXOR_ASSIGN : "^=" ; + + +Whitespace + : ( ( '\003'..'\010' | '\t' | '\013' | '\f' | '\016'.. '\037' | '\177'..'\377' | ' ' ) + | "\r\n" { newline(); } + | ( '\n' | '\r' ) { newline(); } + ) { _ttype = Token.SKIP; } + ; + + +Comment + : "/*" + ( { LA(2) != '/' }? '*' + | "\r\n" { deferredNewline(); } + | ( '\r' | '\n' ) { deferredNewline(); } + | ~( '*'| '\r' | '\n' ) + )* + "*/" { _ttype = Token.SKIP; + } + ; + + +CPPComment + : + "//" ( ~('\n') )* + { + _ttype = Token.SKIP; + } + ; + +protected NonWhitespace + : (~('\r' | '\n'))* + ; + + +PREPROC_DIRECTIVE +options { + paraphrase = "a line directive"; +} + + : + '#' + ( ( "line" || (( ' ' | '\t' | '\014')+ '0'..'9')) => LineDirective + | ( (Space)* "define" (Space)* i:ID (Space)* (n:Number)? + nw:NonWhitespace + ("\r\n" | "\r" | "\n") ) { if (n != null) { + addDefine(i.getText(), n.getText()); + } else { + setPreprocessingDirective("#define " + i.getText() + " " + + nw.getText()); + } + } + | (~'\n')* { setPreprocessingDirective(getText()); } + ) + { + _ttype = Token.SKIP; + } + ; + +protected Space: + ( ' ' | '\t' | '\014') + ; + +protected LineDirective +{ + boolean oldCountingTokens = countingTokens; + countingTokens = false; +} +: + { + lineObject = new LineObject(); + deferredLineCount = 0; + } + ("line")? //this would be for if the directive started "#line", but not there for GNU directives + (Space)+ + n:Number { lineObject.setLine(Integer.parseInt(n.getText())); } + (Space)+ + ( fn:StringLiteral { try { + lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1)); + } + catch (StringIndexOutOfBoundsException e) { /*not possible*/ } + } + | fi:ID { lineObject.setSource(fi.getText()); } + )? + (Space)* + ("1" { lineObject.setEnteringFile(true); } )? + (Space)* + ("2" { lineObject.setReturningToFile(true); } )? + (Space)* + ("3" { lineObject.setSystemHeader(true); } )? + (Space)* + ("4" { lineObject.setTreatAsC(true); } )? + (~('\r' | '\n'))* + ("\r\n" | "\r" | "\n") + { + preprocessorInfoChannel.addLineForTokenNumber(new LineObject(lineObject), new Integer(tokenNumber)); + countingTokens = oldCountingTokens; + } + ; + + + +/* Literals: */ + +/* + * Note that we do NOT handle tri-graphs nor multi-byte sequences. + */ + + +/* + * Note that we can't have empty character constants (even though we + * can have empty strings :-). + */ +CharLiteral + : '\'' ( Escape | ~( '\'' ) ) '\'' + ; + + +/* + * Can't have raw imbedded newlines in string constants. Strict reading of + * the standard gives odd dichotomy between newlines & carriage returns. + * Go figure. + */ +StringLiteral + : '"' + ( Escape + | ( + '\r' { deferredNewline(); } + | '\n' { + deferredNewline(); + _ttype = BadStringLiteral; + } + | '\\' '\n' { + deferredNewline(); + } + ) + | ~( '"' | '\r' | '\n' | '\\' ) + )* + '"' + ; + + +protected BadStringLiteral + : // Imaginary token. + ; + + +/* + * Handle the various escape sequences. + * + * Note carefully that these numeric escape *sequences* are *not* of the + * same form as the C language numeric *constants*. + * + * There is no such thing as a binary numeric escape sequence. + * + * Octal escape sequences are either 1, 2, or 3 octal digits exactly. + * + * There is no such thing as a decimal escape sequence. + * + * Hexadecimal escape sequences are begun with a leading \x and continue + * until a non-hexadecimal character is found. + * + * No real handling of tri-graph sequences, yet. + */ + +protected +Escape + : '\\' + ( options{warnWhenFollowAmbig=false;}: + 'a' + | 'b' + | 'f' + | 'n' + | 'r' + | 't' + | 'v' + | '"' + | '\'' + | '\\' + | '?' + | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit ( options{warnWhenFollowAmbig=false;}: Digit )? )? + | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )? + | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ + ) + ; + + +/* Numeric Constants: */ + +protected +Digit + : '0'..'9' + ; + +protected +LongSuffix + : 'l' + | 'L' + ; + +protected +UnsignedSuffix + : 'u' + | 'U' + ; + +protected +FloatSuffix + : 'f' + | 'F' + ; + +protected +Exponent + : ( 'e' | 'E' ) ( '+' | '-' )? ( Digit )+ + ; + + +protected +DoubleDoubleConst:; + +protected +FloatDoubleConst:; + +protected +LongDoubleConst:; + +protected +IntOctalConst:; + +protected +LongOctalConst:; + +protected +UnsignedOctalConst:; + +protected +IntIntConst:; + +protected +LongIntConst:; + +protected +UnsignedIntConst:; + +protected +IntHexConst:; + +protected +LongHexConst:; + +protected +UnsignedHexConst:; + + + + +Number + : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ + ( '.' ( Digit )* ( Exponent )? + | Exponent + ) { _ttype = DoubleDoubleConst; } + ( FloatSuffix { _ttype = FloatDoubleConst; } + | LongSuffix { _ttype = LongDoubleConst; } + )? + + | ( "..." )=> "..." { _ttype = VARARGS; } + + | '.' { _ttype = DOT; } + ( ( Digit )+ ( Exponent )? + { _ttype = DoubleDoubleConst; } + ( FloatSuffix { _ttype = FloatDoubleConst; } + | LongSuffix { _ttype = LongDoubleConst; } + )? + )? + + | '0' ( '0'..'7' )* { _ttype = IntOctalConst; } + ( LongSuffix { _ttype = LongOctalConst; } + | UnsignedSuffix { _ttype = UnsignedOctalConst; } + )? + + | '1'..'9' ( Digit )* { _ttype = IntIntConst; } + ( LongSuffix { _ttype = LongIntConst; } + | UnsignedSuffix { _ttype = UnsignedIntConst; } + )? + + | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ + { _ttype = IntHexConst; } + ( LongSuffix { _ttype = LongHexConst; } + | UnsignedSuffix { _ttype = UnsignedHexConst; } + )? + ; + + +ID + options + { + testLiterals = true; + } + : ( 'a'..'z' | 'A'..'Z' | '_' ) + ( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' )* + ; + + diff --git a/src/classes/com/sun/gluegen/cgram/TNode.java b/src/classes/com/sun/gluegen/cgram/TNode.java new file mode 100644 index 000000000..f5b2c17e2 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/TNode.java @@ -0,0 +1,433 @@ +package com.sun.gluegen.cgram; + +import antlr.collections.AST; +import antlr.CommonAST; +import antlr.Token; +import java.lang.reflect.*; +import java.util.Hashtable; +import java.util.Enumeration; + +/** + Class TNode is an implementation of the AST interface + and adds many useful features: + + It is double-linked for reverse searching. + (this is currently incomplete, in that method doubleLink() must + be called after any changes to the tree to maintain the + reverse links). + + It can store a definition node (defNode), so that nodes such + as scoped names can refer to the node that defines the name. + + It stores line numbers for nodes. + + Searches for parents and children of a tree can be done + based on their type. + + The tree can be printed to System.out using a lisp-style syntax. + + + + */ +public class TNode extends CommonAST { + protected int ttype; + protected String text; + protected int lineNum = 0; + protected TNode defNode; + protected TNode up; + protected TNode left; + protected boolean marker = false; + protected Hashtable attributes = null; + static String tokenVocabulary; + + + + + /** Set the token vocabulary to a tokentypes class + generated by antlr. + */ + public static void setTokenVocabulary(String s) { + tokenVocabulary = s; + } + + +public void initialize(Token token) { + CToken tok = (CToken) token; + setText(tok.getText()); + setType(tok.getType()); + setLineNum(tok.getLine()); + setAttribute("source", tok.getSource()); + setAttribute("tokenNumber", new Integer(tok.getTokenNumber())); +} +public void initialize(AST tr) { + TNode t = (TNode) tr; + setText(t.getText()); + setType(t.getType()); + setLineNum(t.getLineNum()); + setDefNode(t.getDefNode()); + this.attributes = t.getAttributesTable(); +} + + + /** Get the token type for this node */ + public int getType() { return ttype; } + + /** Set the token type for this node */ + public void setType(int ttype_) { + ttype = ttype_; + } + + /** Get the marker value for this node. + This member is a general-use marker. + */ + public boolean getMarker() { return marker; } + + /** Set the marker value for this node. + This property is a general-use boolean marker. + */ + public void setMarker(boolean marker_) { + marker = marker_; + } + + /** get the hashtable that holds attribute values. + */ + public Hashtable getAttributesTable() { + if(attributes == null) + attributes = new Hashtable(7); + return attributes; + } + + /** set an attribute in the attribute table. + */ + public void setAttribute(String attrName, Object value) { + if(attributes == null) + attributes = new Hashtable(7); + attributes.put(attrName,value); + } + + /** lookup the attribute name in the attribute table. + If the value does not exist, it returns null. + */ + public Object getAttribute(String attrName) { + if(attributes == null) + return null; + else + return attributes.get(attrName); + } + + /** Get the line number for this node. + If the line number is 0, search for a non-zero line num among children */ + public int getLineNum() { + if(lineNum != 0) + return lineNum; + else + if(down == null) + return lineNum; + else + return ((TNode)down).getLocalLineNum(); + } + + public int getLocalLineNum() { + if(lineNum != 0) + return lineNum; + else + if(down == null) + if(right == null) + return lineNum; + else + return ((TNode)right).getLocalLineNum(); + else + return ((TNode)down).getLocalLineNum(); + } + + /** Set the line number for this node */ + public void setLineNum(int lineNum_) { + lineNum = lineNum_; + } + + /** Get the token text for this node */ + public String getText() { return text; } + + /** Set the token text for this node */ + public void setText(String text_) { + text = text_; + } + + /** return the last child of this node, or null if there is none */ + public TNode getLastChild() { + TNode down = (TNode)getFirstChild(); + if(down != null) + return down.getLastSibling(); + else + return null; + } + + /** return the last sibling of this node, which is + this if the next sibling is null */ + public TNode getLastSibling() { + TNode next = (TNode)getNextSibling(); + if(next != null) + return next.getLastSibling(); + else + return this; + } + + /** return the first sibling of this node, which is + this if the prev sibling is null */ + public TNode getFirstSibling() { + TNode prev = (TNode)left; + if(prev != null) + return prev.getFirstSibling(); + else + return this; + } + + + /** return the parent node of this node */ + public TNode getParent() { + return (TNode)getFirstSibling().up; + } + + + /** add the new node as a new sibling, inserting it ahead of any + existing next sibling. This method maintains double-linking. + if node is null, nothing happens. If the node has siblings, + then they are added in as well. + */ + public void addSibling(AST node) { + if(node == null) return; + TNode next = (TNode)right; + right = (TNode)node; + ((TNode)node).left = this; + TNode nodeLastSib = ((TNode)node).getLastSibling(); + nodeLastSib.right = next; + if(next != null) + next.left = nodeLastSib; + } + + + /** return the number of children of this node */ + public int numberOfChildren() { + int count = 0; + AST child = getFirstChild(); + while(child != null) { + count++; + child = child.getNextSibling(); + } + return count; + } + + + /** remove this node from the tree, resetting sibling and parent + pointers as necessary. This method maintains double-linking */ + public void removeSelf() { + TNode parent = (TNode)up; + TNode prev = (TNode)left; + TNode next = (TNode)right; + + if(parent != null) { + parent.down = next; + if(next != null) { + next.up = parent; + next.left = prev; // which should be null + } + } + else { + if(prev != null) + prev.right = next; + if(next != null) + next.left = prev; + } + } + + + /** return the def node for this node */ + public TNode getDefNode() { + return defNode; + } + + /** set the def node for this node */ + public void setDefNode(TNode n) { + defNode = n; + } + + + /** return a deep copy of this node, and all sub nodes. + New tree is doubleLinked, with no parent or siblings. + Marker value is not copied! + */ + public TNode deepCopy() { + TNode copy = new TNode(); + copy.ttype = ttype; + copy.text = text; + copy.lineNum = lineNum; + copy.defNode = defNode; + if(attributes != null) + copy.attributes = (Hashtable)attributes.clone(); + if(down != null) + copy.down = ((TNode)down).deepCopyWithRightSiblings(); + copy.doubleLink(); + return copy; + } + + + /** return a deep copy of this node, all sub nodes, + and right siblings. + New tree is doubleLinked, with no parent or left siblings. + defNode is not copied */ + public TNode deepCopyWithRightSiblings() { + TNode copy = new TNode(); + copy.ttype = ttype; + copy.text = text; + copy.lineNum = lineNum; + copy.defNode = defNode; + if(attributes != null) + copy.attributes = (Hashtable)attributes.clone(); + if(down != null) + copy.down = ((TNode)down).deepCopyWithRightSiblings(); + if(right != null) + copy.right = ((TNode)right).deepCopyWithRightSiblings(); + copy.doubleLink(); + return copy; + } + + + /** return a short string representation of the node */ + public String toString() { + StringBuffer str = new StringBuffer( getNameForType(getType()) + + "[" + getText() + ", " + "]"); + + if(this.getLineNum() != 0) + str.append(" line:" + (this.getLineNum() ) ); + + Enumeration keys = (this.getAttributesTable().keys()); + while (keys.hasMoreElements()) { + String key = (String) keys.nextElement(); + str.append(" " + key + ":" + (this.getAttribute(key))); + } + + return str.toString(); + } + + + /** print given tree to System.out */ + public static void printTree(AST t) { + if (t == null) return; + printASTNode(t,0); + System.out.print("\n"); + } + + + /** protected method that does the work of printing */ + protected static void printASTNode(AST t, int indent) { + AST child1, next; + child1 = t.getFirstChild(); + + System.out.print("\n"); + for(int i = 0; i < indent; i++) + System.out.print(" "); + + if(child1 != null) + System.out.print("("); + + String s = t.getText(); + if(s != null && s.length() > 0) { + System.out.print(getNameForType(t.getType())); + System.out.print(": \"" + s + "\""); + } + else + System.out.print(getNameForType(t.getType())); + if(((TNode)t).getLineNum() != 0) + System.out.print(" line:" + ((TNode)t).getLineNum() ); + + Enumeration keys = ((TNode)t).getAttributesTable().keys(); + while (keys.hasMoreElements()) { + String key = (String) keys.nextElement(); + System.out.print(" " + key + ":" + ((TNode)t).getAttribute(key)); + } + TNode def = ((TNode)t).getDefNode(); + if(def != null) + System.out.print("[" + getNameForType(def.getType()) + "]"); + + + if(child1 != null) { + printASTNode(child1,indent + 1); + + System.out.print("\n"); + for(int i = 0; i < indent; i++) + System.out.print(" "); + System.out.print(")"); + } + + next = t.getNextSibling(); + if(next != null) { + printASTNode(next,indent); + } + } + + /** converts an int tree token type to a name. + Does this by reflecting on nsdidl.IDLTreeTokenTypes, + and is dependent on how ANTLR 2.00 outputs that class. */ + public static String getNameForType(int t) { + try{ + Class c = Class.forName(tokenVocabulary); + Field[] fields = c.getDeclaredFields(); + if(t-2 < fields.length) + return fields[t-2].getName(); + } catch (Exception e) { System.out.println(e); } + return "unfoundtype: " + t; + } + + + /** set up reverse links between this node and its first + child and its first sibling, and link those as well */ + public void doubleLink() { + TNode right = (TNode)getNextSibling(); + if(right != null) { + right.left = this; + right.doubleLink(); + } + TNode down = (TNode)getFirstChild(); + if(down != null) { + down.up = this; + down.doubleLink(); + } + } + + /** find first parent of the given type, + return null on failure */ + public TNode parentOfType(int type) { + if(up == null) { + if(left == null) + return null; + else + return left.parentOfType(type); + } + if(up.getType() == type) + return up; + return up.parentOfType(type); + } + + /** find the first child of the node + of the given type, return null on failure */ + public TNode firstChildOfType(int type) { + TNode down = (TNode)getFirstChild(); + if(down == null) + return null; + if(down.getType() == type) + return down; + return down.firstSiblingOfType(type); + } + + /** find the first sibling of the node + of the given type, return null on failure */ + public TNode firstSiblingOfType(int type) { + TNode right = (TNode)getNextSibling(); + if(right == null) + return null; + if(right.getType() == type) + return right; + return right.firstSiblingOfType(type); + } + +} diff --git a/src/classes/com/sun/gluegen/cgram/TNodeFactory.java b/src/classes/com/sun/gluegen/cgram/TNodeFactory.java new file mode 100644 index 000000000..452363263 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/TNodeFactory.java @@ -0,0 +1,33 @@ +package com.sun.gluegen.cgram; + +import antlr.Token; +import antlr.ASTFactory; +import antlr.collections.AST; + +/** This class extends ASTFactory to build instances + of class TNode */ +public class TNodeFactory extends ASTFactory { + + /** Create a new ampty AST node */ + public AST create() { + return new TNode(); + } + + /** Create a new AST node from type and text */ + public AST create(int ttype, String text) { + AST ast = new TNode(); + ast.setType(ttype); + ast.setText(text); + return ast; + } + + /** Create a new AST node from an existing AST node */ + public AST create(AST ast) { + AST newast = new TNode(); + newast.setType(ast.getType()); + newast.setText(ast.getText()); + return newast; + } + + +} diff --git a/src/classes/com/sun/gluegen/cgram/types/ArrayType.java b/src/classes/com/sun/gluegen/cgram/types/ArrayType.java new file mode 100644 index 000000000..c61e6457f --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/ArrayType.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Represents an array type. This differs from a pointer type in C + syntax by the use of "[]" rather than "*". The length may or may + not be known; if the length is unknown then a negative number + should be passed in to the constructor. */ + +public class ArrayType extends Type { + private Type elementType; + private int length; + private String computedName; + + public ArrayType(Type elementType, int sizeInBytes, int length, int cvAttributes) { + super(elementType.getName() + " *", sizeInBytes, cvAttributes); + this.elementType = elementType; + this.length = length; + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof ArrayType))) { + return false; + } + ArrayType t = (ArrayType) arg; + return (super.equals(arg) && elementType.equals(t.elementType) && (length == t.length)); + } + + public String getName(boolean includeCVAttrs) { + // Lazy computation of name due to lazy setting of compound type + // names during parsing + // Note: don't think cvAttributes can be set for array types (unlike pointer types) + if (computedName == null) { + computedName = elementType.getName() + " *"; + computedName = computedName.intern(); + } + return computedName; + } + + public ArrayType asArray() { return this; } + + public Type getElementType() { return elementType; } + public int getLength() { return length; } + public boolean hasLength() { return length >= 0; } + + /** Return the bottommost element type if this is a multidimensional + array. */ + public Type getBaseElementType() { + ArrayType t = this; + while (t.getElementType().isArray()) { + t = t.getElementType().asArray(); + } + return t.getElementType(); + } + + /** Recompute the size of this array if necessary. This needs to be + done when the base element type is a compound type. */ + public void recomputeSize() { + ArrayType arrayElementType = getElementType().asArray(); + if (arrayElementType != null) { + arrayElementType.recomputeSize(); + } + // FIXME: this doesn't take into account struct alignment, which may be necessary + // See also FIXME below and in HeaderParser.g + super.setSize(getLength() * elementType.getSize()); + } + + public String toString() { + return toString(null); + } + + public String toString(String variableName) { + StringBuffer buf = new StringBuffer(); + buf.append(elementType.getName()); + if (variableName != null) { + buf.append(" "); + buf.append(variableName); + } + buf.append("["); + buf.append(length); + buf.append("]"); + return buf.toString(); + } + + public void visit(TypeVisitor arg) { + super.visit(arg); + elementType.visit(arg); + } + + Type newCVVariant(int cvAttributes) { + return new ArrayType(elementType, getSize(), length, cvAttributes); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/BitType.java b/src/classes/com/sun/gluegen/cgram/types/BitType.java new file mode 100644 index 000000000..293eb3969 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/BitType.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Represents a bitfield in a struct. */ + +public class BitType extends IntType { + private IntType underlyingType; + private int sizeInBits; + private int offset; + + public BitType(IntType underlyingType, int sizeInBits, int lsbOffset, int cvAttributes) { + super(underlyingType.getName(), underlyingType.getSize(), underlyingType.isUnsigned(), cvAttributes); + this.underlyingType = underlyingType; + this.sizeInBits = sizeInBits; + this.offset = lsbOffset; + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof BitType))) { + return false; + } + BitType t = (BitType) arg; + return (super.equals(arg) && underlyingType.equals(t.underlyingType) && + (sizeInBits == t.sizeInBits) && (offset == t.offset)); + } + + public BitType asBit() { return this; } + + /** Size in bits of this type. */ + public int getSizeInBits() { + return sizeInBits; + } + + /** Offset from the least-significant bit (LSB) of the LSB of this + type */ + public int getOffset() { + return offset; + } + + public void visit(TypeVisitor arg) { + super.visit(arg); + underlyingType.visit(arg); + } + + Type newCVVariant(int cvAttributes) { + return new BitType(underlyingType, sizeInBits, offset, cvAttributes); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/CVAttributes.java b/src/classes/com/sun/gluegen/cgram/types/CVAttributes.java new file mode 100644 index 000000000..589904b36 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/CVAttributes.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Enumeration for const/volatile attributes. These are passed in to + the constructor of the type. */ + +public interface CVAttributes { + public static final int CONST = 0x01; + public static final int VOLATILE = 0x02; +} diff --git a/src/classes/com/sun/gluegen/cgram/types/CompoundType.java b/src/classes/com/sun/gluegen/cgram/types/CompoundType.java new file mode 100644 index 000000000..6ad7580e0 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/CompoundType.java @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +import java.util.*; + +/** Models all compound types, i.e., those containing fields: structs + and unions. The boolean type accessors indicate how the type is + really defined. */ + +public class CompoundType extends Type { + private CompoundTypeKind kind; + // The name "foo" in the construct "struct foo { ... }"; + private String structName; + private ArrayList fields; + private boolean visiting; + private boolean bodyParsed; + private boolean computedHashcode; + private int hashcode; + + public CompoundType(String name, int size, CompoundTypeKind kind, int cvAttributes) { + this(name, size, kind, cvAttributes, null); + } + + private CompoundType(String name, int size, CompoundTypeKind kind, int cvAttributes, String structName) { + super(name, size, cvAttributes); + assert kind != null; + this.kind = kind; + this.structName = structName; + } + + public int hashCode() { + if (computedHashcode) { + return hashcode; + } + + if (structName != null) { + hashcode = structName.hashCode(); + } else if (getName() != null) { + hashcode = getName().hashCode(); + } else { + hashcode = 0; + } + + computedHashcode = true; + return hashcode; + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof CompoundType))) { + return false; + } + CompoundType t = (CompoundType) arg; + return (super.equals(arg) && + (structName == t.structName || (structName != null && structName.equals(t.structName))) && + kind == t.kind && + listsEqual(fields, t.fields)); + } + + /** Returns the struct name of this CompoundType, i.e. the "foo" in + the construct "struct foo { ... };". */ + public String getStructName() { + return structName; + } + + /** Sets the struct name of this CompoundType, i.e. the "foo" in the + construct "struct foo { ... };". */ + public void setStructName(String structName) { + this.structName = structName; + } + + public void setSize(int size) { + super.setSize(size); + } + + public CompoundType asCompound() { return this; } + + /** Returns the number of fields in this type. */ + public int getNumFields() { + return ((fields == null) ? 0 : fields.size()); + } + + /** Returns the ith field of this type. */ + public Field getField(int i) { + return (Field) fields.get(i); + } + + /** Adds a field to this type. */ + public void addField(Field f) { + if (bodyParsed) { + throw new RuntimeException("Body of this CompoundType has already been parsed; should not be adding more fields"); + } + if (fields == null) { + fields = new ArrayList(); + } + fields.add(f); + } + + /** Indicates to this CompoundType that its body has been parsed and + that no more {@link #addField} operations will be made. */ + public void setBodyParsed() { + bodyParsed = true; + } + + /** Indicates whether this type was declared as a struct. */ + public boolean isStruct() { return (kind == CompoundTypeKind.STRUCT); } + /** Indicates whether this type was declared as a union. */ + public boolean isUnion() { return (kind == CompoundTypeKind.UNION); } + + public String toString() { + String cvAttributesString = getCVAttributesString(); + if (getName() != null) { + return cvAttributesString + getName(); + } else if (getStructName() != null) { + return cvAttributesString + "struct " + getStructName(); + } else { + return cvAttributesString + getStructString(); + } + } + + public void visit(TypeVisitor arg) { + if (visiting) { + return; + } + try { + visiting = true; + super.visit(arg); + int n = getNumFields(); + for (int i = 0; i < n; i++) { + Field f = getField(i); + f.getType().visit(arg); + } + } finally { + visiting = false; + } + } + + public String getStructString() { + if (visiting) { + if (getName() != null) { + return getName(); + } + return "struct {/*Recursive type reference*/}"; + } + + try { + visiting = true; + String kind = (isStruct() ? "struct {" : "union {"); + StringBuffer res = new StringBuffer(); + res.append(kind); + int n = getNumFields(); + for (int i = 0; i < n; i++) { + res.append(" "); + res.append(getField(i)); + } + res.append(" }"); + return res.toString(); + } finally { + visiting = false; + } + } + + Type newCVVariant(int cvAttributes) { + CompoundType t = new CompoundType(getName(), getSize(), kind, cvAttributes, structName); + t.fields = fields; + return t; + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/CompoundTypeKind.java b/src/classes/com/sun/gluegen/cgram/types/CompoundTypeKind.java new file mode 100644 index 000000000..8df12ac7f --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/CompoundTypeKind.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Type-safe enum for discriminating between structs and unions, + which are both represented as compound types. */ + +public class CompoundTypeKind { + public static final CompoundTypeKind STRUCT = new CompoundTypeKind(); + public static final CompoundTypeKind UNION = new CompoundTypeKind(); + + private CompoundTypeKind() {} +} diff --git a/src/classes/com/sun/gluegen/cgram/types/DoubleType.java b/src/classes/com/sun/gluegen/cgram/types/DoubleType.java new file mode 100644 index 000000000..e2be470fb --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/DoubleType.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Represents a double-word floating-point type (C type "double".) */ + +public class DoubleType extends PrimitiveType { + public DoubleType(String name, int size, int cvAttributes) { + super(name, size, cvAttributes); + } + + public boolean equals(Object arg) { + if (arg == this) { + return true; + } + if (arg == null || (!(arg instanceof DoubleType))) { + return false; + } + return super.equals(arg); + } + + public DoubleType asDouble() { return this; } + + Type newCVVariant(int cvAttributes) { + return new DoubleType(getName(), getSize(), cvAttributes); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/EnumType.java b/src/classes/com/sun/gluegen/cgram/types/EnumType.java new file mode 100644 index 000000000..7f4b9e559 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/EnumType.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +import java.util.*; + +/** Describes enumerated types. Enumerations are like ints except that + they have a set of named values. */ + +public class EnumType extends IntType { + private IntType underlyingType; + + private static class Enum { + String name; + long value; + Enum(String name, long value) { + this.name = name; + this.value = value; + } + + String getName() { return name; } + long getValue() { return value; } + } + private List/**/ enums; + + private static final int longSizeBytes = 8; + + public EnumType(String name) { + super(name, longSizeBytes, false, CVAttributes.CONST ); + this.underlyingType = new IntType(name, longSizeBytes, false, CVAttributes.CONST); + } + + public EnumType(String name, int enumSizeBytes) { + super(name, enumSizeBytes, false, CVAttributes.CONST ); + this.underlyingType = new IntType(name, enumSizeBytes, false, CVAttributes.CONST); + } + + protected EnumType(String name, IntType underlyingType, int cvAttributes) { + super(name, underlyingType.getSize(), underlyingType.isUnsigned(), cvAttributes); + this.underlyingType = underlyingType; + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof EnumType))) { + return false; + } + EnumType t = (EnumType) arg; + return (super.equals(arg) && + underlyingType.equals(t.underlyingType) && + listsEqual(enums, t.enums)); + } + + public EnumType asEnum() { return this; } + + public void addEnum(String name, long val) { + if (enums == null) { + enums = new ArrayList(); + } + enums.add(new Enum(name, val)); + } + + /** Number of enumerates defined in this enum. */ + public int getNumEnumerates() { return enums.size(); } + /** Fetch ith (0..getNumEnumerates() - 1) name */ + public String getEnumName(int i) { return ((Enum) enums.get(i)).getName(); } + /** Fetch ith (0..getNumEnumerates() - 1) value */ + public long getEnumValue(int i) { return ((Enum) enums.get(i)).getValue(); } + /** Fetch the value of the enumerate with the given name. */ + public long getEnumValue(String name) { + for (int i = 0; i < enums.size(); ++i) { + Enum n = ((Enum)enums.get(i)); + if (n.getName().equals(name)) { return n.getValue(); } + } + throw new NoSuchElementException( + "No enumerate named \"" + name + "\" in EnumType \"" + + getName() + "\""); + } + /** Does this enum type contain an enumerate with the given name? */ + public boolean containsEnumerate(String name) { + for (int i = 0; i < enums.size(); ++i) { + if (((Enum)enums.get(i)).getName().equals(name)) { return true; } + } + return false; + } + /** Remove the enumerate with the given name. Returns true if it was found + * and removed; false if it was not found. + */ + public boolean removeEnumerate(String name) { + for (int i = 0; i < enums.size(); ++i) { + Enum e = (Enum)enums.get(i); + if (e.getName().equals(name)) { + enums.remove(e); + return true; + } + } + return false; + } + + public void visit(TypeVisitor arg) { + super.visit(arg); + underlyingType.visit(arg); + } + + Type newCVVariant(int cvAttributes) { + EnumType t = new EnumType(getName(), underlyingType, cvAttributes); + t.enums = enums; + return t; + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/Field.java b/src/classes/com/sun/gluegen/cgram/types/Field.java new file mode 100644 index 000000000..3514c8f7e --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/Field.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Represents a field in a struct or union. */ + +public class Field { + private String name; + private Type type; + private long offset; + + public Field(String name, Type type, long offset) { + this.name = name; + this.type = type; + this.offset = offset; + } + + public int hashCode() { + return name.hashCode(); + } + + public boolean equals(Object arg) { + if (arg == null || (!(arg instanceof Field))) { + return false; + } + + Field f = (Field) arg; + return (((name != null && name.equals(f.name)) || + (name == null && f.name == null)) && + type.equals(f.type) && + offset == f.offset); + } + + /** Name of this field in the containing data structure. */ + public String getName() { return name; } + + /** Type of this field. */ + public Type getType() { return type; } + + /** Offset, in bytes, of this field in the containing data structure. */ + public long getOffset() { return offset; } + + /** Sets the offset of this field in the containing data structure. */ + public void setOffset(long offset) { this.offset = offset; } + + public String toString() { + if (!getType().isFunctionPointer()) { + if (getName() == null && + getType().asCompound() != null && + getType().asCompound().isUnion()) { + return "" + getType() + ";"; + } + return "" + getType() + " " + getName() + ";"; + } else { + FunctionType ft = getType().asPointer().getTargetType().asFunction(); + return ft.toString(getName(), true) + ";"; + } + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/FloatType.java b/src/classes/com/sun/gluegen/cgram/types/FloatType.java new file mode 100644 index 000000000..9f59b3564 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/FloatType.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +/** Represents a single-word floating-point type (C type "float".) */ + +public class FloatType extends PrimitiveType { + public FloatType(String name, int size, int cvAttributes) { + super(name, size, cvAttributes); + } + + public boolean equals(Object arg) { + if (arg == this) { + return true; + } + if (arg == null || (!(arg instanceof FloatType))) { + return false; + } + return super.equals(arg); + } + + public FloatType asFloat() { return this; } + + Type newCVVariant(int cvAttributes) { + return new FloatType(getName(), getSize(), cvAttributes); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/FunctionSymbol.java b/src/classes/com/sun/gluegen/cgram/types/FunctionSymbol.java new file mode 100644 index 000000000..50ee8ccff --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/FunctionSymbol.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +import java.util.*; + +/** Describes a function symbol, which includes the name and + type. Since we are currently only concerned with processing + functions this is the only symbol type, though plausibly more + types should be added and a true symbol table constructed during + parsing. */ + +public class FunctionSymbol { + private String name; + private FunctionType type; + + public FunctionSymbol(String name, FunctionType type) { + this.name = name; + this.type = type; + } + + public String getName() { return name; } + + /** Returns the type of this function. Do not add arguments to it + directly; use addArgument instead. */ + public FunctionType getType() { return type; } + + /** Returns the return type of this function. */ + public Type getReturnType() { return type.getReturnType(); } + + public int getNumArguments() { return type.getNumArguments(); } + + /** Returns the name of the ith argument. May return null if + no argument names were available during parsing. */ + public String getArgumentName(int i) { + return type.getArgumentName(i); + } + + /** Returns the type of the ith argument. */ + public Type getArgumentType(int i) { + return type.getArgumentType(i); + } + + /** Add an argument's name and type. Use null for unknown argument + names. */ + public void addArgument(Type argumentType, String argumentName) { + type.addArgument(argumentType, argumentName); + } + + public String toString() { + return getType().toString(getName()); + } + + public int hashCode() { + if (name == null) { + return 0; + } + return name.hashCode(); + } + + public boolean equals(Object arg) { + if (arg == this) { + return true; + } + + if (arg == null || (!(arg instanceof FunctionSymbol))) { + return false; + } + + FunctionSymbol other = (FunctionSymbol) arg; + return ( + (getName() == other.getName() || getName().equals(other.getName())) + && type.equals(other.type)); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/FunctionType.java b/src/classes/com/sun/gluegen/cgram/types/FunctionType.java new file mode 100644 index 000000000..9c94daea2 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/FunctionType.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +import java.util.*; + +/** Describes a function type, used to model both function + declarations and (via PointerType) function pointers. */ + +public class FunctionType extends Type { + private Type returnType; + private ArrayList argumentTypes; + private ArrayList argumentNames; + + public FunctionType(String name, int size, Type returnType, int cvAttributes) { + super(name, size, cvAttributes); + this.returnType = returnType; + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof FunctionType))) { + return false; + } + FunctionType t = (FunctionType) arg; + return (super.equals(arg) && + returnType.equals(t.returnType) && + listsEqual(argumentTypes, t.argumentTypes)); + } + + public FunctionType asFunction() { return this; } + + /** Returns the return type of this function. */ + public Type getReturnType() { return returnType; } + + public int getNumArguments() { return ((argumentTypes == null) ? 0 : argumentTypes.size()); } + + /** Returns the name of the ith argument. May return null if + no argument names were available during parsing. */ + public String getArgumentName(int i) { + return (String) argumentNames.get(i); + } + + /** Returns the type of the ith argument. */ + public Type getArgumentType(int i) { + return (Type) argumentTypes.get(i); + } + + /** Add an argument's name and type. Use null for unknown argument + names. */ + public void addArgument(Type argumentType, String argumentName) { + if (argumentTypes == null) { + argumentTypes = new ArrayList(); + argumentNames = new ArrayList(); + } + argumentTypes.add(argumentType); + argumentNames.add(argumentName); + } + + public void setArgumentName(int i, String name) + { + argumentNames.set(i,name); + } + + public String toString() { + return toString(null); + } + + public String toString(String functionName) { + return toString(functionName, false); + } + + String toString(String functionName, boolean isPointer) { + StringBuffer res = new StringBuffer(); + res.append(getReturnType()); + res.append(" "); + if (isPointer) { + res.append("(*"); + } + if (functionName != null) { + res.append(functionName); + } + if (isPointer) { + res.append(")"); + } + res.append("("); + int n = getNumArguments(); + for (int i = 0; i < n; i++) { + Type t = getArgumentType(i); + if (t.isFunctionPointer()) { + FunctionType ft = t.asPointer().getTargetType().asFunction(); + res.append(ft.toString(getArgumentName(i), true)); + } else if (t.isArray()) { + res.append(t.asArray().toString(getArgumentName(i))); + } else { + res.append(t); + String argumentName = getArgumentName(i); + if (argumentName != null) { + res.append(" "); + res.append(argumentName); + } + } + if (i < n - 1) { + res.append(", "); + } + } + res.append(")"); + if (!isPointer) { + res.append(";"); + } + return res.toString(); + } + + public void visit(TypeVisitor arg) { + super.visit(arg); + returnType.visit(arg); + int n = getNumArguments(); + for (int i = 0; i < n; i++) { + getArgumentType(i).visit(arg); + } + } + + Type newCVVariant(int cvAttributes) { + // Functions don't have const/volatile attributes + return this; + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/IntType.java b/src/classes/com/sun/gluegen/cgram/types/IntType.java new file mode 100644 index 000000000..2816c561c --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/IntType.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public class IntType extends PrimitiveType { + private boolean unsigned; + private boolean typedefedUnsigned; + + public IntType(String name, int size, boolean unsigned, int cvAttributes) { + this(name, size, unsigned, cvAttributes, false); + } + + private IntType(String name, int size, boolean unsigned, int cvAttributes, boolean typedefedUnsigned) { + super(name, size, cvAttributes); + this.unsigned = unsigned; + this.typedefedUnsigned = typedefedUnsigned; + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof IntType))) { + return false; + } + IntType t = (IntType) arg; + return (super.equals(arg) && (unsigned == t.unsigned)); + } + + public void setName(String name) { + super.setName(name); + typedefedUnsigned = unsigned; + } + + public IntType asInt() { return this; } + + /** Indicates whether this type is unsigned */ + public boolean isUnsigned() { return unsigned; } + + public String toString() { + return getCVAttributesString() + ((isUnsigned() & (!typedefedUnsigned)) ? "unsigned " : "") + getName(); + } + + Type newCVVariant(int cvAttributes) { + return new IntType(getName(), getSize(), isUnsigned(), cvAttributes, typedefedUnsigned); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/MachineDescription.java b/src/classes/com/sun/gluegen/cgram/types/MachineDescription.java new file mode 100644 index 000000000..41923979b --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/MachineDescription.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public class MachineDescription { + private int charSizeInBytes; + private int shortSizeInBytes; + private int intSizeInBytes; + private int longSizeInBytes; + private int int64SizeInBytes; + private int floatSizeInBytes; + private int doubleSizeInBytes; + private int pointerSizeInBytes; + + public MachineDescription(int charSizeInBytes, + int shortSizeInBytes, + int intSizeInBytes, + int longSizeInBytes, + int int64SizeInBytes, + int floatSizeInBytes, + int doubleSizeInBytes, + int pointerSizeInBytes) { + this.charSizeInBytes = charSizeInBytes; + this.shortSizeInBytes = shortSizeInBytes; + this.intSizeInBytes = intSizeInBytes; + this.longSizeInBytes = longSizeInBytes; + this.int64SizeInBytes = int64SizeInBytes; + this.floatSizeInBytes = floatSizeInBytes; + this.doubleSizeInBytes = doubleSizeInBytes; + this.pointerSizeInBytes = pointerSizeInBytes; + } + + public int charSizeInBytes() { return charSizeInBytes; } + public int shortSizeInBytes() { return shortSizeInBytes; } + public int intSizeInBytes() { return intSizeInBytes; } + public int longSizeInBytes() { return longSizeInBytes; } + public int int64SizeInBytes() { return int64SizeInBytes; } + public int floatSizeInBytes() { return floatSizeInBytes; } + public int doubleSizeInBytes() { return doubleSizeInBytes; } + public int pointerSizeInBytes() { return pointerSizeInBytes; } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/MachineDescription32Bit.java b/src/classes/com/sun/gluegen/cgram/types/MachineDescription32Bit.java new file mode 100644 index 000000000..1dbbb700c --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/MachineDescription32Bit.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public class MachineDescription32Bit extends MachineDescription { + public MachineDescription32Bit() { + super(1, 2, 4, 4, 8, 4, 8, 4); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/MachineDescription64Bit.java b/src/classes/com/sun/gluegen/cgram/types/MachineDescription64Bit.java new file mode 100644 index 000000000..00d581266 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/MachineDescription64Bit.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public class MachineDescription64Bit extends MachineDescription { + public MachineDescription64Bit() { + super(1, 2, 4, 8, 8, 4, 8, 8); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/PointerType.java b/src/classes/com/sun/gluegen/cgram/types/PointerType.java new file mode 100644 index 000000000..142a2f12d --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/PointerType.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public class PointerType extends Type { + private Type targetType; + private String computedName; + private boolean hasTypedefedName; + + public PointerType(int size, Type targetType, int cvAttributes) { + // can pass null for the final name parameter because the PointerType's getName() + // completely replaces superclass behavior + this(size, targetType, cvAttributes, false, null); + } + + private PointerType(int size, Type targetType, int cvAttributes, boolean hasTypedefedName, String typedefedName) { + super(targetType.getName() + " *", size, cvAttributes); + this.hasTypedefedName = false; + this.targetType = targetType; + if (hasTypedefedName) { + setName(typedefedName); + } + } + + public int hashCode() { + return targetType.hashCode(); + } + + public boolean equals(Object arg) { + if (arg == this) return true; + if (arg == null || (!(arg instanceof PointerType))) { + return false; + } + PointerType t = (PointerType) arg; + // Note we ignore the name of this type (which might be a typedef + // name) for comparison purposes because this is what allows + // e.g. a newly-fabricated type "PIXELFORMATDESCRIPTOR *" to be + // canonicalized to e.g. "LPPIXELFORMATDESCRIPTOR" + return ((getSize() == t.getSize()) && + (getCVAttributes() == t.getCVAttributes()) && + targetType.equals(t.targetType)); + } + + public void setName(String name) { + super.setName(name); + hasTypedefedName = true; + } + + public String getName(boolean includeCVAttrs) { + if (hasTypedefedName) { + return super.getName(includeCVAttrs); + } else { + // Lazy computation of name due to lazy setting of compound type + // names during parsing + if (computedName == null) { + computedName = targetType.getName(includeCVAttrs) + " *"; + computedName = computedName.intern(); + } + if (!includeCVAttrs) { + return computedName; + } + return targetType.getName(includeCVAttrs) + " * " + getCVAttributesString(); + } + } + + public boolean hasTypedefedName() { + return hasTypedefedName; + } + + public PointerType asPointer() { return this; } + + public Type getTargetType() { return targetType; } + + public boolean isFunctionPointer() { return targetType.isFunction(); } + + public String toString() { + if (hasTypedefedName) { + return super.getName(true); + } else { + if (!targetType.isFunction()) { + return targetType.toString() + " * " + getCVAttributesString(); + } + return toString(null); // this is a pointer to an unnamed function + } + } + + /** For use only when printing function pointers */ + public String toString(String functionName) { + if (!targetType.isFunction()) { + throw new RuntimeException(" This method is only for use when printing function pointers"); + } + return ((FunctionType) targetType).toString(functionName, true); + } + + public void visit(TypeVisitor arg) { + super.visit(arg); + targetType.visit(arg); + } + + Type newCVVariant(int cvAttributes) { + return new PointerType(getSize(), targetType, cvAttributes, hasTypedefedName, (hasTypedefedName ? getName() : null)); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/PrimitiveType.java b/src/classes/com/sun/gluegen/cgram/types/PrimitiveType.java new file mode 100644 index 000000000..8807e2615 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/PrimitiveType.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public abstract class PrimitiveType extends Type { + protected PrimitiveType(String name, int size, int cvAttributes) { + super(name, size, cvAttributes); + } + + public boolean isPrimitive() { + return true; + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/Type.java b/src/classes/com/sun/gluegen/cgram/types/Type.java new file mode 100644 index 000000000..2ac492d3f --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/Type.java @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +import java.util.List; + +/** Models a C type. Primitive types include int, float, and + double. All types have an associated name. Structs and unions are + modeled as "compound" types -- composed of fields of primitive or + other types. */ + +public abstract class Type { + private String name; + private int size; + private int cvAttributes; + private int typedefedCVAttributes; + private boolean hasTypedefName; + + protected Type(String name, int size, int cvAttributes) { + setName(name); + this.size = size; + this.cvAttributes = cvAttributes; + hasTypedefName = false; + } + + /** Returns the name of this type. The returned string is suitable + for use as a type specifier. Does not include any const/volatile + attributes. */ + public String getName() { return getName(false); } + + /** Returns the name of this type, optionally including + const/volatile attributes. The returned string is suitable for + use as a type specifier. */ + public String getName(boolean includeCVAttrs) { + if (!includeCVAttrs) { + return name; + } + return getCVAttributesString() + name; + } + + /** Set the name of this type; used for handling typedefs. */ + public void setName(String name) { + if (name == null) { + this.name = name; + } else { + this.name = name.intern(); + } + // Capture the const/volatile attributes at the time of typedef so + // we don't redundantly repeat them in the CV attributes string + typedefedCVAttributes = cvAttributes; + hasTypedefName = true; + } + + /** Size of this type in bytes. */ + public int getSize() { return size; } + /** Set the size of this type; only available for CompoundTypes. */ + void setSize(int size) { this.size = size; } + + /** Casts this to a BitType or returns null if not a BitType. */ + public BitType asBit() { return null; } + /** Casts this to an IntType or returns null if not an IntType. */ + public IntType asInt() { return null; } + /** Casts this to an EnumType or returns null if not an EnumType. */ + public EnumType asEnum() { return null; } + /** Casts this to a FloatType or returns null if not a FloatType. */ + public FloatType asFloat() { return null; } + /** Casts this to a DoubleType or returns null if not a DoubleType. */ + public DoubleType asDouble() { return null; } + /** Casts this to a PointerType or returns null if not a PointerType. */ + public PointerType asPointer() { return null; } + /** Casts this to an ArrayType or returns null if not an ArrayType. */ + public ArrayType asArray() { return null; } + /** Casts this to a CompoundType or returns null if not a CompoundType. */ + public CompoundType asCompound() { return null; } + /** Casts this to a FunctionType or returns null if not a FunctionType. */ + public FunctionType asFunction() { return null; } + /** Casts this to a VoidType or returns null if not a VoidType. */ + public VoidType asVoid() { return null; } + + /** Indicates whether this is a BitType. */ + public boolean isBit() { return (asBit() != null); } + /** Indicates whether this is an IntType. */ + public boolean isInt() { return (asInt() != null); } + /** Indicates whether this is an EnumType. */ + public boolean isEnum() { return (asEnum() != null); } + /** Indicates whether this is a FloatType. */ + public boolean isFloat() { return (asFloat() != null); } + /** Indicates whether this is a DoubleType. */ + public boolean isDouble() { return (asDouble() != null); } + /** Indicates whether this is a PointerType. */ + public boolean isPointer() { return (asPointer() != null); } + /** Indicates whether this is an ArrayType. */ + public boolean isArray() { return (asArray() != null); } + /** Indicates whether this is a CompoundType. */ + public boolean isCompound() { return (asCompound() != null); } + /** Indicates whether this is a FunctionType. */ + public boolean isFunction() { return (asFunction() != null); } + /** Indicates whether this is a VoidType. */ + public boolean isVoid() { return (asVoid() != null); } + + /** Indicates whether this type is const. */ + public boolean isConst() { return (((cvAttributes & ~typedefedCVAttributes) & CVAttributes.CONST) != 0); } + /** Indicates whether this type is volatile. */ + public boolean isVolatile() { return (((cvAttributes & ~typedefedCVAttributes) & CVAttributes.VOLATILE) != 0); } + + /** Indicates whether this type is a primitive type. */ + public boolean isPrimitive(){ return false; } + + /** Convenience routine indicating whether this Type is a pointer to + a function. */ + public boolean isFunctionPointer() { + return (isPointer() && asPointer().getTargetType().isFunction()); + } + + /** Hashcode for Types. */ + public int hashCode() { + if (name == null) { + return 0; + } + + if (cvAttributes != 0) + { + String nameWithAttribs = name + cvAttributes; + return nameWithAttribs.hashCode(); + } + return name.hashCode(); + } + + /** + * Equality test for Types. + */ + public boolean equals(Object arg) { + if (arg == this) { + return true; + } + if (arg == null || (!(arg instanceof Type))) { + return false; + } + Type t = (Type) arg; + return ((name == t.name || (name != null && name.equals(name))) && + (size == t.size) && + (cvAttributes == t.cvAttributes)); + } + + /** Returns a string representation of this type. This string is not + necessarily suitable for use as a type specifier; for example, + it will contain an expanded description of structs/unions. */ + public String toString() { + return getName(true); + } + + /** Visit this type and all of the component types of this one; for + example, the return type and argument types of a FunctionType. */ + public void visit(TypeVisitor visitor) { + visitor.visitType(this); + } + + public final int getCVAttributes() { + return cvAttributes; + } + + /** Returns a string indicating the const/volatile attributes of + this type. */ + public final String getCVAttributesString() { + if (isConst() && isVolatile()) return "const volatile "; + if (isConst()) return "const "; + if (isVolatile()) return "volatile "; + return ""; + } + + /** Return a variant of this type matching the given const/volatile + attributes. May return this object if the attributes match. */ + public final Type getCVVariant(int cvAttributes) { + if (this.cvAttributes == cvAttributes) { + return this; + } + return newCVVariant(cvAttributes); + } + + /** Create a new variant of this type matching the given + const/volatile attributes. */ + abstract Type newCVVariant(int cvAttributes); + + /** Indicates whether setName() has been called on this type, + indicating that it already has a typedef name. */ + public boolean hasTypedefName() { + return hasTypedefName; + } + + /** Helper method for determining how many pointer indirections this + type represents (i.e., "void **" returns 2). Returns 0 if this + type is not a pointer type. */ + public int pointerDepth() { + PointerType pt = asPointer(); + if (pt == null) { + return 0; + } + return 1 + pt.getTargetType().pointerDepth(); + } + + /** Helper method for determining how many array dimentions this + type represents (i.e., "char[][]" returns 2). Returns 0 if this + type is not an array type. */ + public int arrayDimension() { + ArrayType arrayType = asArray(); + if (arrayType == null) { + return 0; + } + return 1 + arrayType.getElementType().arrayDimension(); + } + + /** Helper routine for list equality comparison */ + static boolean listsEqual(List a, List b) { + return ((a == null && b == null) || + (a != null && b != null && a.equals(b))); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/TypeDictionary.java b/src/classes/com/sun/gluegen/cgram/types/TypeDictionary.java new file mode 100644 index 000000000..5c74455cb --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/TypeDictionary.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +import java.util.*; + +/** Utility class for recording names of typedefs and structs. */ + +public class TypeDictionary { + /** Mapping from type name to type.*/ + private HashMap/**/ map = new HashMap/**/(); + + /** Reverse mapping; created lazily from the regular map */ + private HashMap/*, String>*/ reverseMap = new HashMap/*, String>*/(); + + /** Has a type been added/removed since the last time the reverse map was + * calculated? */ + private boolean reverseMapOutOfDate = false; + + /** + * Create a mapping from a type to its name. + * @param name the name to which the type is defined + * @param type the type that can be referred to by the specified name. + */ + public Type put(String name, Type type) { + reverseMapOutOfDate = true; + return (Type) map.put(name, type); + } + + /** Get the type corresponding to the given name. Returns null if no type + * was found corresponding to the given name. */ + public Type get(String name) { + return (Type) map.get(name); + } + + /** + * Get the names that correspond to the given type. There will be more than + * one name in the returned list if the type has been defined to multiple + * names. Returns null if no names were found for given type. + */ + public Set/**/ get(Type type) { + if (reverseMapOutOfDate) { + rebuildReverseMap(); + reverseMapOutOfDate = false; + } + // Don't let callers muck with the set. + return Collections.unmodifiableSet((Set)reverseMap.get(type)); + } + + /** Remove the mapping from the specified name to its associated type.*/ + public Type remove(String name) { + reverseMapOutOfDate = true; + return (Type) map.remove(name); + } + + /** Get all the names that map to Types. + * @return a Set of Strings that are the typedef names that map to Types in the dictionary. + */ + public Set keySet() { + return map.keySet(); + } + + public Set entrySet() { + return map.entrySet(); + } + + public boolean containsKey(String key) { + return map.containsKey(key); + } + + public boolean containsValue(Type value) { + return map.containsValue(value); + } + + public boolean isEmpty() { + return map.isEmpty(); + } + + /** Returns a collection of all the Types in the dictionary that are mapped via typedefs names. */ + public Collection values() { + return map.values(); + } + + /** Build the mapping of from each Type to all the names by which is may be + * referenced. Warning: this is a slow operation! + */ + private void rebuildReverseMap() { + reverseMap.clear(); + for (Iterator/**/ it = map.keySet().iterator(); it.hasNext(); ) { + String name = (String)it.next(); + Type type = (Type)map.get(name); + if (type == null) { + throw new IllegalStateException("Internal error; TypedefDictionary contains null Type for name \"" + name + "\""); + } + HashSet allNamesForType = (HashSet)reverseMap.get(type); + if (allNamesForType == null) { + allNamesForType = new HashSet/**/(); + reverseMap.put(type, allNamesForType); + } + allNamesForType.add(name); + } + } + + /** + * Dumps the dictionary contents to the specified output stream, annotated + * with the specified description. Useful for debugging. + */ + public void dumpDictionary(java.io.PrintStream out, String description) { + out.println("------------------------------------------------------------------------------"); + out.println("TypeDictionary: " + (description == null ? "" : description)); + out.println("------------------------------------------------------------------------------"); + out.println("Forward mapping: "); + for (Iterator names = keySet().iterator(); names.hasNext(); ) { + String typeName = (String)names.next(); + out.println(" [" + typeName + "]\t--> [" + get(typeName) + "]"); + } + out.println("Reverse mapping: "); + + // because the reverse mapping is built lazily upon query, we must force it to + // be built if it has not yet been built. + if (reverseMapOutOfDate) { + rebuildReverseMap(); + reverseMapOutOfDate = false; + } + for (Iterator types = reverseMap.keySet().iterator(); types.hasNext(); ) { + Type type = (Type)types.next(); + Set names = get(type); + out.println(" [" + type + "]\t--> " + names + ""); + } + out.println("------------------------------------------------------------------------------"); + } +} diff --git a/src/classes/com/sun/gluegen/cgram/types/TypeVisitor.java b/src/classes/com/sun/gluegen/cgram/types/TypeVisitor.java new file mode 100644 index 000000000..88f7dd544 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/TypeVisitor.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public interface TypeVisitor { + public void visitType(Type t); +} diff --git a/src/classes/com/sun/gluegen/cgram/types/VoidType.java b/src/classes/com/sun/gluegen/cgram/types/VoidType.java new file mode 100644 index 000000000..db4c43f81 --- /dev/null +++ b/src/classes/com/sun/gluegen/cgram/types/VoidType.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.cgram.types; + +public class VoidType extends Type { + public VoidType(int cvAttributes) { + this("void", cvAttributes); + } + + private VoidType(String name, int cvAttributes) { + super(name, 0, cvAttributes); + } + + public VoidType asVoid() { return this; } + + Type newCVVariant(int cvAttributes) { + return new VoidType(getName(), cvAttributes); + } +} diff --git a/src/classes/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/classes/com/sun/gluegen/opengl/BuildComposablePipeline.java new file mode 100644 index 000000000..5235631be --- /dev/null +++ b/src/classes/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -0,0 +1,567 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.opengl; + +import com.sun.gluegen.*; + +import java.lang.reflect.*; +import java.io.*; +import java.util.*; +import java.util.regex.*; + +public class BuildComposablePipeline +{ + private String outputDirectory; + private Class classToComposeAround; + + public static void main(String[] args) + { + String nameOfClassToComposeAround = args[0]; + Class classToComposeAround; + try { + classToComposeAround = Class.forName(nameOfClassToComposeAround); + } catch (Exception e) { + throw new RuntimeException( + "Could not find class \"" + nameOfClassToComposeAround + "\"", e); + } + + String outputDir = args[1]; + + BuildComposablePipeline composer = + new BuildComposablePipeline(classToComposeAround, outputDir); + + try + { + composer.emit(); + } + catch (IOException e) + { + throw new RuntimeException( + "Error generating composable pipeline source files", e); + } + } + + protected BuildComposablePipeline(Class classToComposeAround, String outputDirectory) + { + this.outputDirectory = outputDirectory; + this.classToComposeAround = classToComposeAround; + + if (! classToComposeAround.isInterface()) + { + throw new IllegalArgumentException( + classToComposeAround.getName() + " is not an interface class"); + } + } + + /** + * Emit the java source code for the classes that comprise the composable + * pipeline. + */ + public void emit() throws IOException + { + String pDir = outputDirectory; + String pInterface = classToComposeAround.getName(); + List/**/ publicMethods = Arrays.asList(classToComposeAround.getMethods()); + + (new DebugPipeline(pDir, pInterface)).emit(publicMethods); + (new TracePipeline(pDir, pInterface)).emit(publicMethods); + } + + //------------------------------------------------------- + + /** + * Emits a Java source file that represents one element of the composable + * pipeline. + */ + protected static abstract class PipelineEmitter + { + private File file; + private String basePackage; + private String baseName; // does not include package! + private String outputDir; + + /** + * @param outputDir the directory into which the pipeline classes will be + * generated. + * @param baseInterfaceClassName the full class name (including package, + * e.g. "java.lang.String") of the interface that the pipeline wraps + * @exception IllegalArgumentException if classToComposeAround is not an + * interface. + */ + public PipelineEmitter(String outputDir, String baseInterfaceClassName) + { + int lastDot = baseInterfaceClassName.lastIndexOf('.'); + if (lastDot == -1) + { + // no package, class is at root level + this.baseName = baseInterfaceClassName; + this.basePackage = null; + } + else + { + this.baseName = baseInterfaceClassName.substring(lastDot+1); + this.basePackage = baseInterfaceClassName.substring(0, lastDot); + } + + this.outputDir = outputDir; + } + + public void emit(List/**/ methodsToWrap) throws IOException + { + String pipelineClassName = getPipelineName(); + this.file = new File(outputDir + File.separatorChar + pipelineClassName + ".java"); + String parentDir = file.getParent(); + if (parentDir != null) + { + File pDirFile = new File(parentDir); + pDirFile.mkdirs(); + } + + PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); + + CodeGenUtils.emitJavaHeaders(output, + basePackage, + pipelineClassName, + true, + new String[] { "java.io.*" }, + new String[] { "public" }, + new String[] { baseName }, + null, + new CodeGenUtils.EmissionCallback() { + public void emit(PrintWriter w) { emitClassDocComment(w); } + } + ); + + preMethodEmissionHook(output); + + constructorHook(output); + + for (int i = 0; i < methodsToWrap.size(); ++i) + { + Method m = (Method)methodsToWrap.get(i); + emitMethodDocComment(output, m); + emitSignature(output, m); + emitBody(output, m); + } + + postMethodEmissionHook(output); + + output.println(); + output.print(" private " + baseName + " " + getDownstreamObjectName() + ";"); + + // end the class + output.println(); + output.print("} // end class "); + output.println(pipelineClassName); + + output.flush(); + output.close(); + } + + /** Get the name of the object through which API calls should be routed. */ + protected String getDownstreamObjectName() + { + return "downstream" + baseName; + } + + protected void emitMethodDocComment(PrintWriter output, Method m) + { + } + + protected void emitSignature(PrintWriter output, Method m) + { + output.print(" public "); + output.print(' '); + output.print(JavaType.createForClass(m.getReturnType()).getName()); + output.print(' '); + output.print(m.getName()); + output.print('('); + output.print(getArgListAsString(m, true, true)); + output.println(")"); + } + + protected void emitBody(PrintWriter output, Method m) + { + output.println(" {"); + output.print(" "); + Class retType = m.getReturnType(); + + preDownstreamCallHook(output, m); + + if (retType != Void.TYPE) + { + output.print(JavaType.createForClass(retType).getName()); + output.print(" _res = "); + } + output.print(getDownstreamObjectName()); + output.print('.'); + output.print(m.getName()); + output.print('('); + output.print(getArgListAsString(m, false, true)); + output.println(");"); + + postDownstreamCallHook(output, m); + + if (retType != Void.TYPE) + { + output.println(" return _res;"); + } + output.println(" }"); + + } + + private String getArgListAsString(Method m, boolean includeArgTypes, boolean includeArgNames) + { + StringBuffer buf = new StringBuffer(256); + if (!includeArgNames && !includeArgTypes) + { + throw new IllegalArgumentException( + "Cannot generate arglist without both arg types and arg names"); + } + + Class[] argTypes = m.getParameterTypes(); + for (int i = 0; i < argTypes.length; ++i) + { + if (includeArgTypes) + { + buf.append(JavaType.createForClass(argTypes[i]).getName()); + buf.append(' '); + } + + if (includeArgNames) + { + buf.append("arg"); + buf.append(i); + } + if (i < argTypes.length-1) { buf.append(','); } + } + + return buf.toString(); + } + + /** The name of the class around which this pipeline is being + * composed. E.g., if this pipeline was constructed with + * "java.util.Set" as the baseInterfaceClassName, then this method will + * return "Set". + */ + protected String getBaseInterfaceName() + { + return baseName; + } + + /** Get the name for this pipeline class. */ + protected abstract String getPipelineName(); + + /** + * Called after the class headers have been generated, but before any + * method wrappers have been generated. + */ + protected abstract void preMethodEmissionHook(PrintWriter output); + + /** + * Emits the constructor for the pipeline; called after the preMethodEmissionHook. + */ + protected void constructorHook(PrintWriter output) { + output.print( " public " + getPipelineName() + "(" + baseName + " "); + output.println(getDownstreamObjectName() + ")"); + output.println(" {"); + output.println(" if (" + getDownstreamObjectName() + " == null) {"); + output.println(" throw new IllegalArgumentException(\"null " + getDownstreamObjectName() + "\");"); + output.println(" }"); + output.print( " this." + getDownstreamObjectName()); + output.println(" = " + getDownstreamObjectName() + ";"); + output.println(" }"); + output.println(); + } + + /** + * Called after the method wrappers have been generated, but before the + * closing parenthesis of the class is emitted. + */ + protected abstract void postMethodEmissionHook(PrintWriter output); + + /** + * Called before the pipeline routes the call to the downstream object. + */ + protected abstract void preDownstreamCallHook(PrintWriter output, Method m); + + /** + * Called after the pipeline has routed the call to the downstream object, + * but before the calling function exits or returns a value. + */ + protected abstract void postDownstreamCallHook(PrintWriter output, Method m); + + /** Emit a Javadoc comment for this pipeline class. */ + protected abstract void emitClassDocComment(PrintWriter output); + + } // end class PipelineEmitter + + //------------------------------------------------------- + + protected class DebugPipeline extends PipelineEmitter + { + String className; + String baseInterfaceClassName; + public DebugPipeline(String outputDir, String baseInterfaceClassName) + { + super(outputDir, baseInterfaceClassName); + className = "Debug" + getBaseInterfaceName(); + } + + protected String getPipelineName() + { + return className; + } + + protected void preMethodEmissionHook(PrintWriter output) + { + } + + protected void postMethodEmissionHook(PrintWriter output) + { + output.println(" private void checkGLGetError(String caller)"); + output.println(" {"); + output.println(" if (insideBeginEndPair) {"); + output.println(" return;"); + output.println(" }"); + output.println(); + output.println(" // Debug code to make sure the pipeline is working; leave commented out unless testing this class"); + output.println(" //System.err.println(\"Checking for GL errors " + + "after call to \" + caller + \"()\");"); + output.println(); + output.println(" int err = " + + getDownstreamObjectName() + + ".glGetError();"); + output.println(" if (err == GL_NO_ERROR) { return; }"); + output.println(); + output.println(" StringBuffer buf = new StringBuffer("); + output.println(" \"glGetError() returned the following error codes " + + "after a call to \" + caller + \"(): \");"); + output.println(); + output.println(" // Loop repeatedly to allow for distributed GL implementations,"); + output.println(" // as detailed in the glGetError() specification"); + output.println(" int recursionDepth = 10;"); + output.println(" do {"); + output.println(" switch (err) {"); + output.println(" case GL_INVALID_ENUM: buf.append(\"GL_INVALID_ENUM \"); break;"); + output.println(" case GL_INVALID_VALUE: buf.append(\"GL_INVALID_VALUE \"); break;"); + output.println(" case GL_INVALID_OPERATION: buf.append(\"GL_INVALID_OPERATION \"); break;"); + output.println(" case GL_STACK_OVERFLOW: buf.append(\"GL_STACK_OVERFLOW \"); break;"); + output.println(" case GL_STACK_UNDERFLOW: buf.append(\"GL_STACK_UNDERFLOW \"); break;"); + output.println(" case GL_OUT_OF_MEMORY: buf.append(\"GL_OUT_OF_MEMORY \"); break;"); + output.println(" case GL_NO_ERROR: throw new InternalError(\"Should not be treating GL_NO_ERROR as error\");"); + output.println(" default: throw new InternalError(\"Unknown glGetError() return value: \" + err);"); + output.println(" }"); + output.println(" } while ((--recursionDepth >= 0) && (err = " + + getDownstreamObjectName() + + ".glGetError()) != GL_NO_ERROR);"); + output.println(" throw new GLException(buf.toString());"); + output.println(" }"); + + output.println(" /** True if the pipeline is inside a glBegin/glEnd pair.*/"); + output.println(" private boolean insideBeginEndPair = false;"); + output.println(); + + } + protected void emitClassDocComment(PrintWriter output) + { + output.println("/**

Composable pipline which wraps an underlying {@link GL} implementation,"); + output.println(" providing error checking after each OpenGL method call. If an error occurs,"); + output.println(" causes a {@link GLException} to be thrown at exactly the point of failure."); + output.println(" Sample code which installs this pipeline:

"); + output.println(); + output.println("
");
+      output.println("     drawable.setGL(new DebugGL(drawable.getGL()));");
+      output.println("
"); + output.println("*/"); + } + + protected void preDownstreamCallHook(PrintWriter output, Method m) + { + } + + protected void postDownstreamCallHook(PrintWriter output, Method m) + { + if (m.getName().equals("glBegin")) + { + output.println(" insideBeginEndPair = true;"); + output.println(" // NOTE: can't check glGetError(); it's not allowed inside glBegin/glEnd pair"); + } + else + { + if (m.getName().equals("glEnd")) + { + output.println(" insideBeginEndPair = false;"); + } + + // calls to glGetError() are only allowed outside of glBegin/glEnd pairs + output.println(" checkGLGetError(\"" + m.getName() + "\");"); + } + } + + } // end class DebugPipeline + + //------------------------------------------------------- + + protected class TracePipeline extends PipelineEmitter + { + String className; + String baseInterfaceClassName; + public TracePipeline(String outputDir, String baseInterfaceClassName) + { + super(outputDir, baseInterfaceClassName); + className = "Trace" + getBaseInterfaceName(); + } + + protected String getPipelineName() + { + return className; + } + + protected void preMethodEmissionHook(PrintWriter output) + { + } + + protected void constructorHook(PrintWriter output) { + output.print( " public " + getPipelineName() + "(" + getBaseInterfaceName() + " "); + output.println(getDownstreamObjectName() + ", PrintStream " + getOutputStreamName() + ")"); + output.println(" {"); + output.println(" if (" + getDownstreamObjectName() + " == null) {"); + output.println(" throw new IllegalArgumentException(\"null " + getDownstreamObjectName() + "\");"); + output.println(" }"); + output.print( " this." + getDownstreamObjectName()); + output.println(" = " + getDownstreamObjectName() + ";"); + output.print( " this." + getOutputStreamName()); + output.println(" = " + getOutputStreamName() + ";"); + output.println(" }"); + output.println(); + } + + protected void postMethodEmissionHook(PrintWriter output) + { + output.println("private PrintStream " + getOutputStreamName() + ";"); + output.println("private int indent = 0;"); + output.println("protected String dumpArray(Object obj)"); + output.println("{"); + output.println(" if (obj == null) return \"[null]\";"); + output.println(" StringBuffer sb = new StringBuffer(\"[\");"); + output.println(" int len = java.lang.reflect.Array.getLength(obj);"); + output.println(" int count = Math.min(len,16);"); + output.println(" for ( int i =0; i < count; i++ ) {"); + output.println(" sb.append(java.lang.reflect.Array.get(obj,i));"); + output.println(" if (i < count-1)"); + output.println(" sb.append(',');"); + output.println(" }"); + output.println(" if ( len > 16 )"); + output.println(" sb.append(\"...\").append(len);"); + output.println(" sb.append(']');"); + output.println(" return sb.toString();"); + output.println("}"); + output.println("protected void print(String str)"); + output.println("{"); + output.println(" "+getOutputStreamName()+".print(str);"); + output.println("}"); + output.println("protected void println(String str)"); + output.println("{"); + output.println(" "+getOutputStreamName()+".println(str);"); + output.println("}"); + output.println("protected void printIndent()"); + output.println("{"); + output.println(" for( int i =0; i < indent; i++) {"+getOutputStreamName()+".print(' ');}"); + output.println("}"); + } + protected void emitClassDocComment(PrintWriter output) + { + output.println("/**

Composable pipline which wraps an underlying {@link GL} implementation,"); + output.println(" providing tracing information to a user-specified {@link java.io.PrintStream}"); + output.println(" before and after each OpenGL method call. Sample code which installs this pipeline:

"); + output.println(); + output.println("
");
+      output.println("     drawable.setGL(new TraceGL(drawable.getGL(), System.err));");
+      output.println("
"); + output.println("*/"); + } + + protected void preDownstreamCallHook(PrintWriter output, Method m) + { + Class[] params = m.getParameterTypes(); + if ( m.getName().equals("glEnd") || m.getName().equals("glEndList")) + { + output.println("indent-=2;"); + output.println(" printIndent();"); + } + else + { + output.println("printIndent();"); + } + + output.print(" print(\"" + m.getName() + "(\""); + for ( int i =0; i < params.length; i++ ) + { + if ( params[i].isArray() ) + output.print("+dumpArray(arg"+i+")"); + else + output.print("+arg"+i); + if ( i < params.length-1) + output.print("+\",\""); + } + output.println("+\")\");"); + output.print(" "); + } + + protected void postDownstreamCallHook(PrintWriter output, Method m) + { + Class ret = m.getReturnType(); + if ( ret != Void.TYPE ) + { + output.println(" println(\" = \"+_res);"); + } + else + { + output.println(" println(\"\");"); + } + } + + private String getOutputStreamName() { + return "stream"; + } + + } // end class TracePipeline +} diff --git a/src/classes/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/classes/com/sun/gluegen/opengl/BuildStaticGLInfo.java new file mode 100644 index 000000000..52b9fde51 --- /dev/null +++ b/src/classes/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.opengl; + +import java.io.*; +import java.util.*; +import java.util.regex.*; + + /** + * Builds the StaticGLInfo class from the OpenGL header files (i.e., gl.h + * and glext.h) whose paths were passed as arguments to {@link + * #main(String[])}. + * + * It relies upon the assumption that a function's membership is scoped by + * preprocessor blocks in the header files that match the following pattern: + *
+ * + *
+   * 
+   * #ifndef GL_XXXX
+   * GLAPI   glFuncName()
+   * #endif GL_XXXX
+   *
+   * 
+ * + * For example, if it parses the following data: + * + *
+   * 
+   * #ifndef GL_VERSION_1_3
+   * GLAPI void APIENTRY glActiveTexture (GLenum);
+   * GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
+   * GLAPI void   glFuncName()
+   * #endif GL_VERSION_1_3
+   *
+   * #ifndef GL_ARB_texture_compression
+   * GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+   * GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+   * #endif
+   * 
+   * 
+ * + * It will associate + * glActiveTexture and + * glMultiTexCoord1dv + * with the symbol + * GL_VERSION_1_3 , + * and associate + * glCompressedTexImage2DARB and + * glCompressedTexImage3DARB + * with the symbol + * GL_ARB_texture_compression . + * */ +public class BuildStaticGLInfo +{ + // Handles function pointer + protected static Pattern funcPattern = + Pattern.compile("^(GLAPI|extern)?(\\s*)(\\w+)(\\*)?(\\s+)(GLAPIENTRY|APIENTRY|WINAPI)?(\\s*)([w]?gl\\w+)\\s?(\\(.*)"); + protected static Pattern associationPattern = + Pattern.compile("\\#ifndef ([W]?GL[X]?_[A-Za-z0-9_]+)"); + protected static Pattern definePattern = + Pattern.compile("\\#define ([W]?GL[X]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)"); + // Maps function / #define names to the names of the extensions they're declared in + protected Map declarationToExtensionMap = new HashMap(); + // Maps extension names to Set of identifiers (both #defines and + // function names) this extension declares + protected Map/**/ extensionToDeclarationMap = new HashMap(); + + /** + * The first argument is the package to which the StaticGLInfo class + * belongs, the second is the path to the directory in which that package's + * classes reside, and the remaining arguments are paths to the C header + * files that should be parsed + */ + public static void main(String[] args) throws IOException + { + if (args.length > 0 && args[0].equals("-test")) { + BuildStaticGLInfo builder = new BuildStaticGLInfo(); + String[] newArgs = new String[args.length - 1]; + System.arraycopy(args, 1, newArgs, 0, args.length - 1); + builder.parse(newArgs); + builder.dump(); + System.exit(0); + } + + String packageName = args[0]; + String packageDir = args[1]; + + String[] cHeaderFilePaths = new String[args.length-2]; + System.arraycopy(args, 2, cHeaderFilePaths, 0, cHeaderFilePaths.length); + + BuildStaticGLInfo builder = new BuildStaticGLInfo(); + try { + builder.parse(cHeaderFilePaths); + + File file = new File(packageDir + File.separatorChar + "StaticGLInfo.java"); + String parentDir = file.getParent(); + if (parentDir != null) { + File pDirFile = new File(parentDir); + pDirFile.mkdirs(); + } + + PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(file))); + builder.emitJavaCode(writer, packageName); + + writer.flush(); + writer.close(); + } + catch (Exception e) + { + StringBuffer buf = new StringBuffer("{ "); + for (int i = 0; i < cHeaderFilePaths.length; ++i) + { + buf.append(cHeaderFilePaths[i]); + buf.append(" "); + } + buf.append('}'); + throw new RuntimeException( + "Error building StaticGLInfo.java from " + buf.toString(), e); + } + } + + + /** Parses the supplied C header files and adds the function + associations contained therein to the internal map. */ + public void parse(String[] cHeaderFilePaths) throws IOException { + for (int i = 0; i < cHeaderFilePaths.length; i++) { + parse(cHeaderFilePaths[i]); + } + } + + /** Parses the supplied C header file and adds the function + associations contained therein to the internal map. */ + public void parse(String cHeaderFilePath) throws IOException { + BufferedReader reader = new BufferedReader(new FileReader(cHeaderFilePath)); + String line, activeAssociation = null; + Matcher m = null; + while ((line = reader.readLine()) != null) { + // see if we're inside a #ifndef GL_XXX block and matching a function + if (activeAssociation != null) { + String identifier = null; + if ((m = funcPattern.matcher(line)).matches()) { + identifier = m.group(8); + } else if ((m = definePattern.matcher(line)).matches()) { + identifier = m.group(1); + } else if (line.startsWith("#endif")) { + activeAssociation = null; + } + if ((identifier != null) && + (activeAssociation != null) && + // Handles #ifndef GL_... #define GL_... + !identifier.equals(activeAssociation)) { + addAssociation(identifier, activeAssociation); + } + } else if ((m = associationPattern.matcher(line)).matches()) { + // found a new #ifndef GL_XXX block + activeAssociation = m.group(1); + + //System.err.println("FOUND NEW ASSOCIATION BLOCK: " + activeAssociation); + } + } + reader.close(); + } + + public void dump() { + for (Iterator i1 = extensionToDeclarationMap.keySet().iterator(); i1.hasNext(); ) { + String name = (String) i1.next(); + Set decls = (Set) extensionToDeclarationMap.get(name); + System.out.println(name + ":"); + List l = new ArrayList(); + l.addAll(decls); + Collections.sort(l); + for (Iterator i2 = l.iterator(); i2.hasNext(); ) { + System.out.println(" " + (String) i2.next()); + } + } + } + + public String getExtension(String identifier) { + return (String) declarationToExtensionMap.get(identifier); + } + + public Set getDeclarations(String extension) { + return (Set) extensionToDeclarationMap.get(extension); + } + + public void emitJavaCode(PrintWriter output, String packageName) { + output.println("package " + packageName + ";"); + output.println(); + output.println("import java.util.*;"); + output.println(); + output.println("public final class StaticGLInfo"); + output.println("{"); + + output.println(" // maps function names to the extension string or OpenGL"); + output.println(" // specification version string to which they correspond."); + output.println(" private static HashMap funcToAssocMap;"); + output.println(); + + output.println(" /**"); + output.println(" * Returns the OpenGL extension string or GL_VERSION string with which the"); + output.println(" * given function is associated.

"); + output.println(" *"); + output.println(" * If the"); + output.println(" * function is part of the OpenGL core, the returned value will be"); + output.println(" * GL_VERSION_XXX where XXX represents the OpenGL version of which the"); + output.println(" * function is a member (XXX will be of the form \"A\" or \"A_B\" or \"A_B_C\";"); + output.println(" * e.g., GL_VERSION_1_2_1 for OpenGL version 1.2.1)."); + output.println(" *"); + output.println(" * If the function is an extension function, the returned value will the"); + output.println(" * OpenGL extension string for the extension to which the function"); + output.println(" * corresponds. For example, if glLoadTransposeMatrixfARB is the argument,"); + output.println(" * GL_ARB_transpose_matrix will be the value returned."); + output.println(" * Please see http://oss.sgi.com/projects/ogl-sample/registry/index.html for"); + output.println(" * a list of extension names and the functions they expose."); + output.println(" *"); + output.println(" * If the function specified is not part of any known OpenGL core version or"); + output.println(" * extension, then NULL will be returned."); + output.println(" */"); + output.println(" public static String getFunctionAssociation(String glFunctionName)"); + output.println(" {"); + output.println(" return (String)funcToAssocMap.get(glFunctionName);"); + output.println(" }"); + output.println(); + + output.println(" static"); + output.println(" {"); + + // Compute max capacity + int maxCapacity = 0; + for (Iterator iter = declarationToExtensionMap.keySet().iterator(); iter.hasNext(); ) { + String name = (String) iter.next(); + if (!name.startsWith("GL")) { + ++maxCapacity; + } + } + + output.println(" funcToAssocMap = new HashMap(" + maxCapacity + "); // approximate max capacity"); + output.println(" String group;"); + ArrayList sets = new ArrayList(extensionToDeclarationMap.keySet()); + Collections.sort(sets); + for (Iterator iter = sets.iterator(); iter.hasNext(); ) { + String groupName = (String) iter.next(); + Set funcs = (Set) extensionToDeclarationMap.get(groupName); + List l = new ArrayList(); + l.addAll(funcs); + Collections.sort(l); + Iterator funcIter = l.iterator(); + boolean printedHeader = false; + while (funcIter.hasNext()) { + String funcName = (String)funcIter.next(); + if (!funcName.startsWith("GL")) { + if (!printedHeader) { + output.println(); + output.println(" //----------------------------------------------------------------"); + output.println(" // " + groupName); + output.println(" //----------------------------------------------------------------"); + output.println(" group = \"" + groupName + "\";"); + printedHeader = true; + } + + output.println(" funcToAssocMap.put(\"" + funcName + "\", group);"); + } + } + } + output.println(" }"); + output.println("} // end class StaticGLInfo"); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + protected void addAssociation(String identifier, String association) { + declarationToExtensionMap.put(identifier, association); + Set/**/ identifiers = (Set) extensionToDeclarationMap.get(association); + if (identifiers == null) { + identifiers = new HashSet/**/(); + extensionToDeclarationMap.put(association, identifiers); + } + identifiers.add(identifier); + } +} diff --git a/src/classes/com/sun/gluegen/opengl/ConvertFromGL4Java.java b/src/classes/com/sun/gluegen/opengl/ConvertFromGL4Java.java new file mode 100644 index 000000000..2f051a78b --- /dev/null +++ b/src/classes/com/sun/gluegen/opengl/ConvertFromGL4Java.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.opengl; + +import java.io.*; + +public class ConvertFromGL4Java { + public static void main(String[] args) throws IOException { + for (int i = 0; i < args.length; i++) { + convert(new File(args[i])); + } + } + + private static void convert(File src) throws IOException { + File orig = new File(src.getAbsolutePath() + ".orig"); + if (!src.renameTo(orig)) { + throw new IOException("Error renaming original file to " + orig); + } + File dest = src; + BufferedReader reader = new BufferedReader(new FileReader(orig)); + BufferedWriter writer = new BufferedWriter(new FileWriter(dest)); + boolean handledImports = false; + String line = null; + while ((line = reader.readLine()) != null) { + String trimmed = line.trim(); + boolean isImport = false; + if (trimmed.startsWith("import gl4java")) { + line = "import javax.media.opengl.*;"; + isImport = true; + } + if (!isImport || + (isImport && !handledImports)) { + line = line.replaceAll("GLFunc14", "GL"); + line = line.replaceAll("GLUFunc14", "GLU"); + line = line.replaceAll("GLFunc", "GL"); + line = line.replaceAll("GLUFunc", "GLU"); + line = line.replaceAll("implements GLEnum,", "implements "); + line = line.replaceAll(", GLEnum\\s", " "); + line = line.replaceAll("GLEnum,", ""); + line = line.replaceAll("GLEnum.", ""); + line = line.replaceAll("GLEnum", ""); + line = line.replaceAll("GL_", "GL.GL_"); + writer.write(line); + writer.newLine(); + if (isImport) { + handledImports = true; + } + } + } + writer.flush(); + reader.close(); + writer.close(); + } +} diff --git a/src/classes/com/sun/gluegen/opengl/GLCMethodBindingEmitter.java b/src/classes/com/sun/gluegen/opengl/GLCMethodBindingEmitter.java new file mode 100755 index 000000000..653a8cd3d --- /dev/null +++ b/src/classes/com/sun/gluegen/opengl/GLCMethodBindingEmitter.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.opengl; + +import java.io.*; +import java.util.*; +import com.sun.gluegen.*; +import com.sun.gluegen.cgram.types.*; + +public class GLCMethodBindingEmitter extends CMethodBindingEmitter { + private static final CommentEmitter defaultCommentEmitter = + new CGLPAWrapperCommentEmitter(); + + private boolean callThroughProcAddress; + private String glFuncPtrTypedefValue; + private static String procAddressJavaTypeName = + JavaType.createForClass(Long.TYPE).jniTypeName(); + + public GLCMethodBindingEmitter(CMethodBindingEmitter methodToWrap, + final boolean callThroughProcAddress) { + super( + new MethodBinding(methodToWrap.getBinding()) { + public String getName() { + if (callThroughProcAddress) { + return GLEmitter.WRAP_PREFIX + super.getName(); + } else { + return super.getName(); + } + } + + public String getRenamedMethodName() { + if (callThroughProcAddress) { + return GLEmitter.WRAP_PREFIX + super.getRenamedMethodName(); + } else { + return super.getRenamedMethodName(); + } + } + }, + methodToWrap.getDefaultOutput(), + methodToWrap.getJavaPackageName(), + methodToWrap.getJavaClassName(), + methodToWrap.getIsOverloadedBinding(), + methodToWrap.getIsJavaMethodStatic(), + true, + methodToWrap.forIndirectBufferAndArrayImplementation() + ); + + if (methodToWrap.getReturnValueCapacityExpression() != null) { + setReturnValueCapacityExpression(methodToWrap.getReturnValueCapacityExpression()); + } + if (methodToWrap.getReturnValueLengthExpression() != null) { + setReturnValueLengthExpression(methodToWrap.getReturnValueLengthExpression()); + } + setTemporaryCVariableDeclarations(methodToWrap.getTemporaryCVariableDeclarations()); + setTemporaryCVariableAssignments (methodToWrap.getTemporaryCVariableAssignments ()); + + setCommentEmitter(defaultCommentEmitter); + this.callThroughProcAddress = callThroughProcAddress; + } + + protected int emitArguments(PrintWriter writer) { + int numEmitted = super.emitArguments(writer); + if (callThroughProcAddress) { + if (numEmitted > 0) + { + writer.print(", "); + } + //writer.print("long glProcAddress"); + writer.print(procAddressJavaTypeName); + writer.print(" glProcAddress"); + ++numEmitted; + } + + return numEmitted; + } + + protected void emitBodyVariableDeclarations(PrintWriter writer) { + if (callThroughProcAddress) { + // create variable for the function pointer with the right type, and set + // it to the value of the passed-in glProcAddress + FunctionSymbol cSym = getBinding().getCSymbol(); + String funcPointerTypedefName = + GLEmitter.getGLFunctionPointerTypedefName(cSym); + + writer.print(" "); + writer.print(funcPointerTypedefName); + writer.print(" ptr_"); + writer.print(cSym.getName()); + writer.println(";"); + } + + super.emitBodyVariableDeclarations(writer); + } + + protected void emitBodyVariablePreCallSetup(PrintWriter writer, + boolean emittingPrimitiveArrayCritical) { + super.emitBodyVariablePreCallSetup(writer, emittingPrimitiveArrayCritical); + + if (callThroughProcAddress) { + if (!emittingPrimitiveArrayCritical) { + // set the function pointer to the value of the passed-in glProcAddress + FunctionSymbol cSym = getBinding().getCSymbol(); + String funcPointerTypedefName = + GLEmitter.getGLFunctionPointerTypedefName(cSym); + + String ptrVarName = "ptr_" + cSym.getName(); + + writer.print(" "); + writer.print(ptrVarName); + writer.print(" = ("); + writer.print(funcPointerTypedefName); + writer.println(") (intptr_t) glProcAddress;"); + + writer.println(" assert(" + ptrVarName + " != NULL);"); + } + } + } + + protected void emitBodyCallCFunction(PrintWriter writer) { + if (!callThroughProcAddress) { + super.emitBodyCallCFunction(writer); + } else { + // Make the call to the actual C function + writer.print(" "); + + // WARNING: this code assumes that the return type has already been + // typedef-resolved. + Type cReturnType = binding.getCReturnType(); + + if (!cReturnType.isVoid()) { + writer.print("_res = "); + } + MethodBinding binding = getBinding(); + if (binding.hasContainingType()) { + // Cannot call GL func through function pointer + throw new IllegalStateException( + "Cannot call GL func through function pointer: " + binding); + } + + // call throught the run-time function pointer + writer.print("(* ptr_"); + writer.print(binding.getCSymbol().getName()); + writer.print(") "); + writer.print("("); + emitBodyPassCArguments(writer); + writer.println(");"); + } + } + + protected String jniMangle(MethodBinding binding) { + StringBuffer buf = new StringBuffer(super.jniMangle(binding)); + if (callThroughProcAddress) { + jniMangle(Long.TYPE, buf, false); // to account for the additional _addr_ parameter + } + return buf.toString(); + } + + /** This class emits the comment for the wrapper method */ + private static class CGLPAWrapperCommentEmitter extends CMethodBindingEmitter.DefaultCommentEmitter { + protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { + writer.print(" -- FIXME: IMPLEMENT COMMENT FOR CGLPAWrapperCommentEmitter -- "); + } + } +} // end class GLCMethodBindingEmitter diff --git a/src/classes/com/sun/gluegen/opengl/GLEmitter.java b/src/classes/com/sun/gluegen/opengl/GLEmitter.java new file mode 100644 index 000000000..4ba1df87b --- /dev/null +++ b/src/classes/com/sun/gluegen/opengl/GLEmitter.java @@ -0,0 +1,647 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.opengl; + +import java.io.*; +import java.text.MessageFormat; +import java.util.*; +import com.sun.gluegen.*; +import com.sun.gluegen.cgram.types.*; +import com.sun.gluegen.runtime.*; + +/** + * A subclass of JavaEmitter that modifies the normal emission of C and Java + * code in order to allow a high-performance, cross-platform binding of Java + * to OpenGL. + */ +public class GLEmitter extends JavaEmitter +{ + public static final String PROCADDRESS_VAR_PREFIX = ProcAddressHelper.PROCADDRESS_VAR_PREFIX; + protected static final String WRAP_PREFIX = "dispatch_"; + private TypeDictionary typedefDictionary; + private PrintWriter tableWriter; + private String tableClassPackage; + private String tableClassName; + private int numProcAddressEntries; + // Keeps track of which MethodBindings were created for handling + // Buffer Object variants. Used as a Set rather than a Map. + private Map/**/ bufferObjectMethodBindings = new IdentityHashMap(); + + static class BufferObjectKind { + private BufferObjectKind() {} + + static final BufferObjectKind UNPACK_PIXEL = new BufferObjectKind(); + static final BufferObjectKind PACK_PIXEL = new BufferObjectKind(); + static final BufferObjectKind ARRAY = new BufferObjectKind(); + static final BufferObjectKind ELEMENT = new BufferObjectKind(); + } + + public void beginEmission(GlueEmitterControls controls) throws IOException + { + getGLConfig().parseGLHeaders(controls); + super.beginEmission(controls); + } + + public void beginFunctions(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) throws Exception + { + this.typedefDictionary = typedefDictionary; + + if (getGLConfig().emitProcAddressTable()) + { + beginGLProcAddressTable(); + } + super.beginFunctions(typedefDictionary, structDictionary, canonMap); + } + + public void endFunctions() throws Exception + { + if (getGLConfig().emitProcAddressTable()) + { + endGLProcAddressTable(); + } + super.endFunctions(); + } + + public void beginStructs(TypeDictionary typedefDictionary, + TypeDictionary structDictionary, + Map canonMap) throws Exception { + super.beginStructs(typedefDictionary, structDictionary, canonMap); + } + + protected JavaConfiguration createConfig() { + return new GLConfiguration(); + } + + /** In order to implement Buffer Object variants of certain + functions we generate another MethodBinding which maps the void* + argument to a Java long. The generation of emitters then takes + place as usual. We do however need to keep track of the modified + MethodBinding object so that we can also modify the emitters + later to inform them that their argument has changed. We might + want to push this functionality down into the MethodBinding + (i.e., mutators for argument names). We also would need to + inform the CMethodBindingEmitter that it is overloaded in this + case (though we default to true currently). */ + protected List/**/ expandMethodBinding(MethodBinding binding) { + List/**/ bindings = super.expandMethodBinding(binding); + + if (!getGLConfig().isBufferObjectFunction(binding.getName())) { + return bindings; + } + + List/**/ newBindings = new ArrayList(); + newBindings.addAll(bindings); + + // Need to expand each one of the generated bindings to take a + // Java long instead of a Buffer for each void* argument + for (Iterator iter = bindings.iterator(); iter.hasNext(); ) { + MethodBinding cur = (MethodBinding) iter.next(); + + // Some of these routines (glBitmap) take strongly-typed + // primitive pointers as arguments which are expanded into + // non-void* arguments + // This test (rather than !signatureUsesNIO) is used to catch + // more unexpected situations + if (cur.signatureUsesJavaPrimitiveArrays()) { + continue; + } + + MethodBinding result = cur; + for (int i = 0; i < cur.getNumArguments(); i++) { + if (cur.getJavaArgumentType(i).isNIOBuffer()) { + result = result.replaceJavaArgumentType(i, JavaType.createForClass(Long.TYPE)); + } + } + + if (result == cur) { + throw new RuntimeException("Error: didn't find any void* arguments for BufferObject function " + + binding.getName()); + } + + newBindings.add(result); + // Now need to flag this MethodBinding so that we generate the + // correct flags in the emitters later + bufferObjectMethodBindings.put(result, result); + } + + return newBindings; + } + + protected List generateMethodBindingEmitters(FunctionSymbol sym) throws Exception + { + return generateMethodBindingEmittersImpl(sym); + } + + private List generateMethodBindingEmittersImpl(FunctionSymbol sym) throws Exception + { + List defaultEmitters = super.generateMethodBindingEmitters(sym); + + // if the superclass didn't generate any bindings for the symbol, let's + // honor that (for example, the superclass might have caught an Ignore + // direction that matched the symbol's name). + if (defaultEmitters.isEmpty()) + { + return defaultEmitters; + } + + // Don't do anything special if this symbol doesn't require + // OpenGL-related modifications + if ((!needsProcAddressWrapper(sym) && !needsBufferObjectVariant(sym)) || + getConfig().isUnimplemented(sym.getName())) + { + return defaultEmitters; + } + + ArrayList modifiedEmitters = new ArrayList(defaultEmitters.size()); + + if (needsProcAddressWrapper(sym)) { + if (getGLConfig().emitProcAddressTable()) { + // emit an entry in the GL proc address table for this method. + emitGLProcAddressTableEntryForSymbol(sym); + } + } + + for (Iterator iter = defaultEmitters.iterator(); iter.hasNext(); ) + { + FunctionEmitter emitter = (FunctionEmitter) iter.next(); + if (emitter instanceof JavaMethodBindingEmitter) + { + generateModifiedEmitters((JavaMethodBindingEmitter) emitter, modifiedEmitters); + } + else if (emitter instanceof CMethodBindingEmitter) + { + generateModifiedEmitters((CMethodBindingEmitter) emitter, modifiedEmitters); + } + else + { + throw new RuntimeException("Unexpected emitter type: " + + emitter.getClass().getName()); + } + } + + return modifiedEmitters; + } + + /** + * Returns the name of the typedef for a pointer to the GL function + * represented by the argument. For example, if the argument is the function + * "glFuncName", the value returned will be "PFNGLFUNCNAMEPROC". This + * returns a valid string regardless of whether or not the typedef is + * actually defined. + */ + static String getGLFunctionPointerTypedefName(FunctionSymbol sym) + { + String symName = sym.getName(); + StringBuffer buf = new StringBuffer(symName.length() + 8); + buf.append("PFN"); + buf.append(symName.toUpperCase()); + buf.append("PROC"); + return buf.toString(); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List emitters) { + if (getGLConfig().manuallyImplement(baseJavaEmitter.getName())) { + // User will provide Java-side implementation of this routine; + // pass through any emitters which will produce signatures for + // it unmodified + emitters.add(baseJavaEmitter); + return; + } + + // See whether we need a proc address entry for this one + boolean callThroughProcAddress = needsProcAddressWrapper(baseJavaEmitter.getBinding().getCSymbol()); + // See whether this is one of the Buffer Object variants + boolean bufferObjectVariant = bufferObjectMethodBindings.containsKey(baseJavaEmitter.getBinding()); + + GLJavaMethodBindingEmitter emitter = + new GLJavaMethodBindingEmitter(baseJavaEmitter, + callThroughProcAddress, + getGLConfig().getProcAddressTableExpr(), + baseJavaEmitter.isForImplementingMethodCall(), + bufferObjectVariant); + emitters.add(emitter); + + // If this emitter doesn't have a body (i.e., is a public native + // call), we need to force it to emit a body, and produce another + // one to act as the entry point + if (baseJavaEmitter.signatureOnly() && + baseJavaEmitter.hasModifier(JavaMethodBindingEmitter.PUBLIC) && + baseJavaEmitter.hasModifier(JavaMethodBindingEmitter.NATIVE) && + callThroughProcAddress) { + emitter.setEmitBody(true); + emitter.removeModifier(JavaMethodBindingEmitter.NATIVE); + emitter = new GLJavaMethodBindingEmitter(baseJavaEmitter, + callThroughProcAddress, + getGLConfig().getProcAddressTableExpr(), + true, + bufferObjectVariant); + emitter.setForImplementingMethodCall(true); + emitters.add(emitter); + } + } + + protected void generateModifiedEmitters(CMethodBindingEmitter baseCEmitter, List emitters) + { + // See whether we need a proc address entry for this one + boolean callThroughProcAddress = needsProcAddressWrapper(baseCEmitter.getBinding().getCSymbol()); + // Note that we don't care much about the naming of the C argument + // variables so to keep things simple we ignore the buffer object + // property for the binding + + // The C-side JNI binding for this particular function will have an + // extra final argument, which is the address (the OpenGL procedure + // address) of the function it needs to call + GLCMethodBindingEmitter res = new GLCMethodBindingEmitter(baseCEmitter, callThroughProcAddress); + MessageFormat exp = baseCEmitter.getReturnValueCapacityExpression(); + if (exp != null) { + res.setReturnValueCapacityExpression(exp); + } + emitters.add(res); + } + + protected boolean needsProcAddressWrapper(FunctionSymbol sym) + { + String symName = sym.getName(); + + GLConfiguration config = getGLConfig(); + + // We should only wrap the GL symbol if its function pointer typedef has + // been defined (most likely in glext.h). + String funcPointerTypedefName = getGLFunctionPointerTypedefName(sym); + boolean shouldWrap = typedefDictionary.containsKey(funcPointerTypedefName); + //System.err.println(funcPointerTypedefName + " defined: " + shouldWrap); + + if (config.skipProcAddressGen(symName)) { + shouldWrap = false; + } + + if (!shouldWrap) + { + //System.err.println("WARNING (GL): *not* run-time linking: " + sym + + // "(" + funcPointerTypedefName + " undefined)"); + } + else + { + FunctionType typedef = typedefDictionary.get(funcPointerTypedefName).asPointer().getTargetType().asFunction(); + FunctionType fun = sym.getType(); + int numarg = typedef.getNumArguments(); + for ( int i =0; i < numarg; i++ ) + { + if ( fun.getArgumentName(i) == null ) + fun.setArgumentName(i,typedef.getArgumentName(i)); + } + } + + return shouldWrap; + } + + protected boolean needsBufferObjectVariant(FunctionSymbol sym) { + return getGLConfig().isBufferObjectFunction(sym.getName()); + } + + private void beginGLProcAddressTable() throws Exception + { + tableClassPackage = getGLConfig().tableClassPackage(); + tableClassName = getGLConfig().tableClassName(); + + // Table defaults to going into the impl directory unless otherwise overridden + String implPackageName = tableClassPackage; + if (implPackageName == null) { + implPackageName = getImplPackageName(); + } + String jImplRoot = + getJavaOutputDir() + File.separator + + CodeGenUtils.packageAsPath(implPackageName); + + tableWriter = openFile(jImplRoot + File.separator + tableClassName + ".java"); + + CodeGenUtils.emitAutogeneratedWarning(tableWriter, this); + + tableWriter.println("package " + implPackageName + ";"); + tableWriter.println(); + for (Iterator iter = getConfig().imports().iterator(); iter.hasNext(); ) { + tableWriter.println("import " + ((String) iter.next()) + ";"); + } + tableWriter.println(); + tableWriter.println("/**"); + tableWriter.println(" * This table is a cache of the native pointers to OpenGL extension"); + tableWriter.println(" * functions, to be used for run-time linking of these extensions. "); + tableWriter.println(" * These pointers are obtained by the OpenGL context via a "); + tableWriter.println(" * platform-specific function (e.g., wglGetProcAddress() on Win32,"); + tableWriter.println(" * glXGetProcAddress() on X11, etc). If the member variable "); + tableWriter.println(" * " + PROCADDRESS_VAR_PREFIX + "glFuncName is non-zero then function"); + tableWriter.println(" * \"glFuncName\" can be called through the associated GLContext; "); + tableWriter.println(" * if it is 0, then the extension is not available and cannot be called."); + tableWriter.println(" */"); + tableWriter.println("public class " + tableClassName); + tableWriter.println("{"); + numProcAddressEntries = 0; + + for (Iterator iter = getGLConfig().getForceProcAddressGen().iterator(); iter.hasNext(); ) { + emitGLProcAddressTableEntryForString((String) iter.next()); + } + } + + private void endGLProcAddressTable() throws Exception + { + PrintWriter w = tableWriter; + + w.println(); + w.println(" /**"); + w.println(" * This is a convenience method to get (by name) the native function "); + w.println(" * pointer for a given extension function. It lets you avoid "); + w.println(" * having to manually compute the " + PROCADDRESS_VAR_PREFIX + ""); + w.println(" * member variable name and look it up via reflection; it also"); + w.println(" * will throw an exception if you try to get the address of an"); + w.println(" * unknown GL extension, or one that is statically linked "); + w.println(" * and therefore does not have a valid GL procedure address. "); + w.println(" */"); + w.println(" public long getAddressFor(String glFunctionName) {"); + w.println(" String addressFieldName = com.sun.gluegen.opengl.GLEmitter.PROCADDRESS_VAR_PREFIX + glFunctionName;"); + w.println(" try { "); + w.println(" java.lang.reflect.Field addressField = this.getClass().getField(addressFieldName);"); + w.println(" return addressField.getLong(this);"); + w.println(" } catch (Exception e) {"); + w.println(" // The user is calling a bogus function or one which is not runtime"); + w.println(" // linked (extensions and core post-OpenGL 1.1 functions are runtime linked)"); + w.println(" if (!FunctionAvailabilityCache.isPartOfGLCore(\"1.1\", glFunctionName)) "); + w.println(" {"); + w.println(" throw new RuntimeException(" ); + w.println(" \"WARNING: Address query failed for \\\"\" + glFunctionName +"); + w.println(" \"\\\"; either it's not runtime linked or it is not a known \" +"); + w.println(" \"OpenGL function\", e);"); + w.println(" }"); + w.println(" } "); + w.println(" assert(false); // should never get this far"); + w.println(" return 0;"); + w.println(" }"); + + w.println("} // end of class " + tableClassName); + w.flush(); + w.close(); + } + + protected void emitGLProcAddressTableEntryForSymbol(FunctionSymbol cFunc) + { + emitGLProcAddressTableEntryForString(cFunc.getName()); + } + + protected void emitGLProcAddressTableEntryForString(String str) + { + tableWriter.print(" public long "); + tableWriter.print(PROCADDRESS_VAR_PREFIX); + tableWriter.print(str); + tableWriter.println(";"); + ++numProcAddressEntries; + } + + protected GLConfiguration getGLConfig() { + return (GLConfiguration) getConfig(); + } + + protected class GLConfiguration extends JavaConfiguration + { + private boolean emitProcAddressTable = false; + private String tableClassPackage; + private String tableClassName = "ProcAddressTable"; + private Set/**/ skipProcAddressGen = new HashSet(); + private List/**/ forceProcAddressGen = new ArrayList(); + private String contextVariableName = "context"; + private String getProcAddressTableExpr; + // The following data members support ignoring an entire extension at a time + private List/**/ glHeaders = new ArrayList(); + private Set/**/ ignoredExtensions = new HashSet(); + private BuildStaticGLInfo glInfo; + // Maps function names to the kind of buffer object it deals with + private Map/**/ bufferObjectKinds = new HashMap(); + + protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { + if (cmd.equalsIgnoreCase("EmitProcAddressTable")) + { + emitProcAddressTable = + readBoolean("EmitProcAddressTable", tok, filename, lineNo).booleanValue(); + } + else if (cmd.equalsIgnoreCase("ProcAddressTablePackage")) + { + tableClassPackage = readString("ProcAddressTablePackage", tok, filename, lineNo); + } + else if (cmd.equalsIgnoreCase("ProcAddressTableClassName")) + { + tableClassName = readString("ProcAddressTableClassName", tok, filename, lineNo); + } + else if (cmd.equalsIgnoreCase("SkipProcAddressGen")) + { + String sym = readString("SkipProcAddressGen", tok, filename, lineNo); + skipProcAddressGen.add(sym); + } + else if (cmd.equalsIgnoreCase("ForceProcAddressGen")) + { + String sym = readString("ForceProcAddressGen", tok, filename, lineNo); + forceProcAddressGen.add(sym); + } + else if (cmd.equalsIgnoreCase("ContextVariableName")) + { + contextVariableName = readString("ContextVariableName", tok, filename, lineNo); + } + else if (cmd.equalsIgnoreCase("GetProcAddressTableExpr")) + { + getProcAddressTableExpr = readGetProcAddressTableExpr(tok, filename, lineNo); + } + else if (cmd.equalsIgnoreCase("IgnoreExtension")) + { + String sym = readString("IgnoreExtension", tok, filename, lineNo); + ignoredExtensions.add(sym); + } + else if (cmd.equalsIgnoreCase("GLHeader")) + { + String sym = readString("GLHeader", tok, filename, lineNo); + glHeaders.add(sym); + } + else if (cmd.equalsIgnoreCase("BufferObjectKind")) + { + readBufferObjectKind(tok, filename, lineNo); + } + else + { + super.dispatch(cmd,tok,file,filename,lineNo); + } + } + + protected String readGetProcAddressTableExpr(StringTokenizer tok, String filename, int lineNo) { + try { + String restOfLine = tok.nextToken("\n\r\f"); + return restOfLine.trim(); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"GetProcAddressTableExpr\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + protected void readBufferObjectKind(StringTokenizer tok, String filename, int lineNo) { + try { + String kindString = tok.nextToken(); + BufferObjectKind kind = null; + String target = tok.nextToken(); + if (kindString.equalsIgnoreCase("UnpackPixel")) { + kind = BufferObjectKind.UNPACK_PIXEL; + } else if (kindString.equalsIgnoreCase("PackPixel")) { + kind = BufferObjectKind.PACK_PIXEL; + } else if (kindString.equalsIgnoreCase("Array")) { + kind = BufferObjectKind.ARRAY; + } else if (kindString.equalsIgnoreCase("Element")) { + kind = BufferObjectKind.ELEMENT; + } else { + throw new RuntimeException("Error parsing \"BufferObjectKind\" command at line " + lineNo + + " in file \"" + filename + "\": illegal BufferObjectKind \"" + + kindString + "\", expected one of UnpackPixel, PackPixel, Array, or Element"); + } + + bufferObjectKinds.put(target, kind); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"BufferObjectKind\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + + public boolean emitProcAddressTable() { return emitProcAddressTable; } + public String tableClassPackage() { return tableClassPackage; } + public String tableClassName() { return tableClassName; } + public boolean skipProcAddressGen (String name) { return skipProcAddressGen.contains(name); } + public List getForceProcAddressGen() { return forceProcAddressGen; } + public String contextVariableName() { return contextVariableName; } + public String getProcAddressTableExpr() { + if (getProcAddressTableExpr == null) { + getProcAddressTableExpr = contextVariableName + ".get" + tableClassName + "()"; + } + return getProcAddressTableExpr; + } + + public boolean shouldIgnore(String symbol) { + // Check ignored extensions based on our knowledge of the static GL info + if (glInfo != null) { + String extension = glInfo.getExtension(symbol); + if (extension != null && + ignoredExtensions.contains(extension)) { + return true; + } + } + + return super.shouldIgnore(symbol); + } + + /** Overrides javaPrologueForMethod in superclass and + automatically generates prologue code for functions associated + with buffer objects. */ + public List/**/ javaPrologueForMethod(MethodBinding binding, + boolean forImplementingMethodCall, + boolean eraseBufferAndArrayTypes) { + List/**/ res = super.javaPrologueForMethod(binding, + forImplementingMethodCall, + eraseBufferAndArrayTypes); + BufferObjectKind kind = getBufferObjectKind(binding.getName()); + if (kind != null) { + // Need to generate appropriate prologue based on both buffer + // object kind and whether this variant of the MethodBinding + // is the one accepting a "long" as argument + if (res == null) { + res = new ArrayList(); + } + + String prologue = "check"; + + if (kind == BufferObjectKind.UNPACK_PIXEL) { + prologue = prologue + "UnpackPBO"; + } else if (kind == BufferObjectKind.PACK_PIXEL) { + prologue = prologue + "PackPBO"; + } else if (kind == BufferObjectKind.ARRAY) { + prologue = prologue + "ArrayVBO"; + } else if (kind == BufferObjectKind.ELEMENT) { + prologue = prologue + "ElementVBO"; + } else { + throw new RuntimeException("Unknown BufferObjectKind " + kind); + } + + if (bufferObjectMethodBindings.containsKey(binding)) { + prologue = prologue + "Enabled"; + } else { + prologue = prologue + "Disabled"; + } + + prologue = prologue + "();"; + + res.add(0, prologue); + } + + return res; + } + + /** Returns the kind of buffer object this function deals with, or + null if none. */ + public BufferObjectKind getBufferObjectKind(String name) { + return (BufferObjectKind) bufferObjectKinds.get(name); + } + + public boolean isBufferObjectFunction(String name) { + return (getBufferObjectKind(name) != null); + } + + /** Parses any GL headers specified in the configuration file for + the purpose of being able to ignore an extension at a time. */ + public void parseGLHeaders(GlueEmitterControls controls) throws IOException { + if (!glHeaders.isEmpty()) { + glInfo = new BuildStaticGLInfo(); + for (Iterator iter = glHeaders.iterator(); iter.hasNext(); ) { + String file = (String) iter.next(); + String fullPath = controls.findHeaderFile(file); + if (fullPath == null) { + throw new IOException("Unable to locate header file \"" + file + "\""); + } + glInfo.parse(fullPath); + } + } + } + } // end class GLConfiguration +} diff --git a/src/classes/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/classes/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java new file mode 100755 index 000000000..1e72cd633 --- /dev/null +++ b/src/classes/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.opengl; + +import java.io.*; +import java.util.*; +import com.sun.gluegen.*; +import com.sun.gluegen.cgram.types.*; + +public class GLJavaMethodBindingEmitter extends JavaMethodBindingEmitter { + private final CommentEmitter commentEmitterForWrappedMethod = + new WrappedMethodCommentEmitter(); + + private boolean callThroughProcAddress; + private boolean changeNameAndArguments; + private String getProcAddressTableExpr; + private boolean bufferObjectVariant; + + public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, + boolean callThroughProcAddress, + String getProcAddressTableExpr, + boolean changeNameAndArguments, + boolean bufferObjectVariant) { + super(methodToWrap); + this.callThroughProcAddress = callThroughProcAddress; + this.getProcAddressTableExpr = getProcAddressTableExpr; + this.changeNameAndArguments = changeNameAndArguments; + this.bufferObjectVariant = bufferObjectVariant; + if (callThroughProcAddress) { + setCommentEmitter(new WrappedMethodCommentEmitter()); + } + + if (methodToWrap.getBinding().hasContainingType()) + { + throw new IllegalArgumentException( + "Cannot create OpenGL proc. address wrapper; method has containing type: \"" + + methodToWrap.getBinding() + "\""); + } + } + + public String getName() { + String res = super.getName(); + if (changeNameAndArguments) { + return GLEmitter.WRAP_PREFIX + res; + } + return res; + } + + protected String getArgumentName(int i) { + String name = super.getArgumentName(i); + + if (!bufferObjectVariant) { + return name; + } + + // Emitters for VBO/PBO-related routines change the outgoing + // argument name for the buffer + if (binding.getJavaArgumentType(i).isLong()) { + Type cType = binding.getCArgumentType(i); + if (cType.isPointer() && + (cType.asPointer().getTargetType().isVoid() || + cType.asPointer().getTargetType().isPrimitive())) { + return name + "_buffer_offset"; + } + } + + return name; + } + + protected int emitArguments(PrintWriter writer) { + int numEmitted = super.emitArguments(writer); + if (callThroughProcAddress) { + if (changeNameAndArguments) { + if (numEmitted > 0) { + writer.print(", "); + } + + writer.print("long glProcAddress"); + ++numEmitted; + } + } + + return numEmitted; + } + + protected String getImplMethodName(boolean direct) { + String name = super.getImplMethodName(direct); + if (callThroughProcAddress) { + return GLEmitter.WRAP_PREFIX + name; + } + return name; + } + + protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) { + super.emitPreCallSetup(binding, writer); + + if (callThroughProcAddress) { + String procAddressVariable = + GLEmitter.PROCADDRESS_VAR_PREFIX + binding.getName(); + writer.println(" final long __addr_ = " + getProcAddressTableExpr + "." + procAddressVariable + ";"); + writer.println(" if (__addr_ == 0) {"); + writer.println(" throw new GLException(\"Method \\\"" + binding.getName() + "\\\" not available\");"); + writer.println(" }"); + } + } + + protected int emitCallArguments(MethodBinding binding, PrintWriter writer, boolean indirect) { + int numEmitted = super.emitCallArguments(binding, writer, indirect); + if (callThroughProcAddress) { + if (numEmitted > 0) { + writer.print(", "); + } + writer.print("__addr_"); + ++numEmitted; + } + + return numEmitted; + } + + /** This class emits the comment for the wrapper method */ + private class WrappedMethodCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { + protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { + writer.print("Encapsulates function pointer for OpenGL function
: "); + } + } +} // end class GLJavaMethodBindingEmitter diff --git a/src/classes/com/sun/gluegen/pcpp/PCPP.java b/src/classes/com/sun/gluegen/pcpp/PCPP.java new file mode 100644 index 000000000..a2d3ab09b --- /dev/null +++ b/src/classes/com/sun/gluegen/pcpp/PCPP.java @@ -0,0 +1,845 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.pcpp; + +import java.io.*; +import java.util.*; + +/** A minimal pseudo-C-preprocessor designed in particular to preserve + #define statements defining constants so they can be observed by a + glue code generator. */ + +public class PCPP { + private static final boolean disableDebugPrint = true; + + public PCPP(List/**/ includePaths) { + this.includePaths = includePaths; + setOut(System.out); + } + + public OutputStream out() { return out; } + public void setOut(OutputStream out) { this.out = out; writer = new PrintWriter(out); } + + public void run(Reader reader, String filename) throws IOException { + StreamTokenizer tok = new StreamTokenizer(reader); + tok.resetSyntax(); + tok.wordChars('a', 'z'); + tok.wordChars('A', 'Z'); + tok.wordChars('0', '9'); + tok.wordChars('_', '_'); + tok.wordChars('.', '.'); + tok.wordChars(128 + 32, 255); + tok.whitespaceChars(0, ' '); + tok.quoteChar('"'); + tok.quoteChar('\''); + tok.eolIsSignificant(true); + tok.slashSlashComments(true); + tok.slashStarComments(true); + ParseState curState = new ParseState(tok, filename); + ParseState oldState = state; + state = curState; + lineDirective(); + parse(); + state = oldState; + if (state != null) { + lineDirective(); + } + } + + public static void main(String[] args) { + try { + Reader reader = null; + String filename = null; + + if (args.length == 0) { + usage(); + } + + List includePaths = new ArrayList(); + for (int i = 0; i < args.length; i++) { + if (i < args.length - 1) { + String arg = args[i]; + if (arg.startsWith("-I")) { + String[] paths = arg.substring(2).split(System.getProperty("path.separator")); + for (int j = 0; j < paths.length; j++) { + includePaths.add(paths[j]); + } + } else { + usage(); + } + } else { + String arg = args[i]; + if (arg.equals("-")) { + reader = new InputStreamReader(System.in); + filename = "standard input"; + } else { + if (arg.startsWith("-")) { + usage(); + } + filename = arg; + reader = new BufferedReader(new FileReader(filename)); + } + } + } + + new PCPP(includePaths).run(reader, filename); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public String findFile(String filename) { + String sep = File.separator; + for (Iterator iter = includePaths.iterator(); iter.hasNext(); ) { + String inclPath = (String) iter.next(); + String fullPath = inclPath + sep + filename; + File file = new File(fullPath); + if (file.exists()) { + return fullPath; + } + } + return null; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private static void usage() { + System.out.println("Usage: java PCPP [filename | -]"); + System.out.println("Minimal pseudo-C-preprocessor."); + System.out.println("Output goes to standard output. Standard input can be used as input"); + System.out.println("by passing '-' as the argument."); + System.exit(1); + } + + /** Map containing the results of #define statements. We must + evaluate certain very simple definitions (to properly handle + OpenGL's gl.h) but preserve the text of definitions evaluating + to constants. Macros and multi-line defines (which typically + contain either macro definitions or expressions) are currently + not handled. */ + private Map/**/ defineMap = new HashMap(); + private Set/**/ nonConstantDefines = new HashSet(); + + /** List containing the #include paths as Strings */ + private List/**/ includePaths; + + // State + static class ParseState { + private StreamTokenizer tok; + private String filename; + private int lineNumber; + private boolean startOfLine; + private boolean startOfFile; + + ParseState(StreamTokenizer tok, String filename) { + this.tok = tok; + this.filename = filename; + lineNumber = 1; + startOfLine = true; + startOfFile = true; + } + + StreamTokenizer tok() { return tok; } + String filename() { return filename; } + int lineNumber() { return tok.lineno(); } + boolean startOfLine() { return startOfLine; } + void setStartOfLine(boolean val) { startOfLine = val; } + boolean startOfFile() { return startOfFile; } + void setStartOfFile(boolean val) { startOfFile = val; } + } + + private ParseState state; + + // Accessors + + private void pushBackToken() throws IOException { + state.tok().pushBack(); + } + + /** Equivalent to nextToken(false) */ + private int nextToken() throws IOException { + return nextToken(false); + } + + private int nextToken(boolean returnEOLs) throws IOException { + int lineno = lineNumber(); + // Check to see whether the previous call to nextToken() left an + // EOL on the stream + if (curToken() == StreamTokenizer.TT_EOL) { + state.setStartOfLine(true); + } else if (!state.startOfFile()) { + state.setStartOfLine(false); + } + state.setStartOfFile(false); + int val = state.tok().nextToken(); + if (!returnEOLs) { + if (val == StreamTokenizer.TT_EOL) { + do { + // Consume and return next token, setting state appropriately + val = state.tok().nextToken(); + state.setStartOfLine(true); + println(); + } while (val == StreamTokenizer.TT_EOL); + } + } + if (lineNumber() > lineno + 1) { + // This is a little noisier than it needs to be, but does handle + // the case of multi-line comments properly + lineDirective(); + } + return val; + } + + /** + * Reads the next token and throws an IOException if it is not the specified + * token character. + */ + private void nextRequiredToken(int requiredToken) throws IOException { + int nextTok = nextToken(); + if (nextTok != requiredToken) { + String msg = "Expected token '" + requiredToken + "' but got "; + switch (nextTok) { + case StreamTokenizer.TT_EOF: msg += ""; break; + case StreamTokenizer.TT_EOL: msg += ""; break; + default: msg += "'" + curTokenAsString() + "'"; break; + } + msg += " at file " + filename() + ", line " + lineNumber(); + throw new IOException(msg); + } + } + + private int curToken() { + return state.tok().ttype; + } + + private String curTokenAsString() { + int t = curToken(); + if (t == StreamTokenizer.TT_WORD) { + return curWord(); + } + if (t == StreamTokenizer.TT_EOL) { + throw new RuntimeException("Should not be converting EOL characters to strings"); + } + char c = (char) t; + if (c == '"' || c == '\'') { + StringBuffer buf = new StringBuffer(); + buf.append(c); + buf.append(state.tok().sval); + buf.append(c); + return buf.toString(); + } + return new String(new char[] { c }); + } + + private String nextWord() throws IOException { + int val = nextToken(); + if (val != StreamTokenizer.TT_WORD) { + throw new RuntimeException("Expected word at file " + filename() + + ", line " + lineNumber()); + } + return curWord(); + } + + private String curWord() { + return state.tok().sval; + } + + private boolean startOfLine() { + return state.startOfLine(); + } + + private String filename() { + return state.filename(); + } + + private int lineNumber() { + return state.lineNumber(); + } + + ///////////// + // Parsing // + ///////////// + + private void parse() throws IOException { + int tok = 0; + while ((tok = nextToken()) != StreamTokenizer.TT_EOF) { + // A '#' at the beginning of a line is a preprocessor directive + if (startOfLine() && (tok == '#')) { + preprocessorDirective(); + } else { + // Output white space plus current token, handling #defines + // (though not properly -- only handling #defines to constants and the empty string) + print(" "); + String s = curTokenAsString(); + String newS = (String) defineMap.get(s); + if (newS == null) { + newS = s; + } + print(newS); + } + } + flush(); + } + + private void preprocessorDirective() throws IOException { + String w = nextWord(); + boolean shouldPrint = true; + if (w.equals("define")) { + handleDefine(); + shouldPrint = false; + } else if (w.equals("undef")) { + handleUndefine(); + shouldPrint = false; + } else if (w.equals("if") || w.equals("elif")) { + handleIf(w.equals("if")); + shouldPrint = false; + } else if (w.equals("ifdef") || w.equals("ifndef")) { + handleIfdef(w.equals("ifdef")); + shouldPrint = false; + } else if (w.equals("else")) { + handleElse(); + shouldPrint = false; + } else if (w.equals("endif")) { + handleEndif(); + shouldPrint = false; + } else if (w.equals("include")) { + handleInclude(); + shouldPrint = false; + } else { + // Unknown preprocessor directive (#pragma?) -- ignore + } + if (shouldPrint) { + print("# "); + printToken(); + } + } + + //////////////////////////////////// + // Handling of #define directives // + //////////////////////////////////// + + private void handleUndefine() throws IOException { + // Next token is the name of the #undef + String name = nextWord(); + + debugPrint(true, "#undef " + name); + + // there shouldn't be any extra symbols after the name, but just in case... + List values = new ArrayList(); + while (nextToken(true) != StreamTokenizer.TT_EOL) { + values.add(curTokenAsString()); + } + + if (enabled()) { + String oldDef = (String)defineMap.remove(name); + if (oldDef == null) { + System.err.println("WARNING: ignoring redundant \"#undef " + + name + "\", at \"" + filename() + "\" line " + lineNumber() + + ": \"" + name + "\" was not previously defined"); + } else { + // System.err.println("UNDEFINED: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); + } + nonConstantDefines.remove(name); + } + else System.err.println("FAILED TO UNDEFINE: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); + } + + private void handleDefine() throws IOException { + // Next token is the name of the #define + String name = nextWord(); + //System.err.println("IN HANDLE_DEFINE: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); + // (Note that this is not actually proper handling for multi-line #defines) + List values = new ArrayList(); + while (nextToken(true) != StreamTokenizer.TT_EOL) { + values.add(curTokenAsString()); + } + // if we're not within an active block of code (like inside an "#ifdef + // FOO" where FOO isn't defined), then don't actually alter the definition + // map. + debugPrint(true, "#define " + name); + if (enabled()) + { + boolean emitDefine = true; + + // Handle #definitions to nothing or to a constant value + int sz = values.size(); + if (sz == 0) { + // definition to nothing, like "#define FOO" + String oldDef = (String)defineMap.put(name, ""); + if (oldDef != null) { + System.err.println("WARNING: \"" + name + "\" redefined from \"" + + oldDef + "\" to \"\""); + } + // We don't want to emit the define, because it would serve no purpose + // and cause GlueGen errors (confuse the GnuCParser) + emitDefine = false; + //System.out.println("//---DEFINED: " + name + "to \"\""); + } else if (sz == 1) { + // See whether the value is a constant + String value = (String) values.get(0); + if (isConstant(value)) { + // Value is numeric constant like "#define FOO 5". + // Put it in the #define map + String oldDef = (String)defineMap.put(name, value); + if (oldDef != null) { + System.err.println("WARNING: \"" + name + "\" redefined from \"" + + oldDef + "\" to \"" + value + "\""); + } + //System.out.println("//---DEFINED: " + name + " to \"" + value + "\""); + } else { + // Value is a symbolic constant like "#define FOO BAR". + // Try to look up the symbol's value + String newValue = resolveDefine(value, true); + if (newValue != null) { + // Set the value to the value of the symbol. + // + // TO DO: Is this correct? Why not output the symbol unchanged? + // I think that it's a good thing to see that some symbols are + // defined in terms of others. -chris + values.set(0, newValue); + } + else + { + // Still perform textual replacement + defineMap.put(name, value); + nonConstantDefines.add(name); + emitDefine = false; + } + } + } + else + { + // Non-constant define; try to do reasonable textual substitution anyway + // (FIXME: should identify some of these, like (-1), as constants) + emitDefine = false; + StringBuffer val = new StringBuffer(); + for (int i = 0; i < sz; i++) { + if (i != 0) { + val.append(" "); + } + val.append(resolveDefine((String) values.get(i), false)); + } + if (defineMap.get(name) != null) { + // This is probably something the user should investigate. + throw new RuntimeException("Cannot redefine symbol \"" + name + + " from \"" + defineMap.get(name) + "\" to non-constant " + + " definition \"" + val.toString() + "\""); + } + defineMap.put(name, val.toString()); + nonConstantDefines.add(name); + } + + if (emitDefine) + { + // Print name and value + print("# define "); + print(name); + for (Iterator iter = values.iterator(); iter.hasNext(); ) { + print(" "); + print((String) iter.next()); + } + println(); + } + + } // end if (enabled()) + + //System.err.println("OUT HANDLE_DEFINE: " + name); + } + + private boolean isConstant(String s) { + if (s.startsWith("0x") || s.startsWith("0X")) { + return checkHex(s); + } else { + return checkDecimal(s); + } + } + + private boolean checkHex(String s) { + for (int i = 2; i < s.length(); i++) { + char c = s.charAt(i); + if (!((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F'))) { + return false; + } + } + return true; + } + + private boolean checkDecimal(String s) { + try { + Float.valueOf(s); + } + catch (NumberFormatException e) { + // not parsable as a number + return false; + } + return true; + } + + private String resolveDefine(String word, boolean returnNullIfNotFound) { + String lastWord = (String) defineMap.get(word); + if (lastWord == null) { + if (returnNullIfNotFound) { + return null; + } + return word; + } + String nextWord = null; + do { + nextWord = (String) defineMap.get(lastWord); + if (nextWord != null) { + lastWord = nextWord; + } + } while (nextWord != null); + return lastWord; + } + + //////////////////////////////////////////////// + // Handling of #if/#ifdef/ifndef/endif directives // + //////////////////////////////////////////////// + + /** + * @param isIfdef if true, we're processing #ifdef; if false, we're + * processing #ifndef. + */ + private void handleIfdef(boolean isIfdef) throws IOException { + // Next token is the name of the #ifdef + String symbolName = nextWord(); + debugPrint(true, (isIfdef ? "#ifdef " : "#ifndef ") + symbolName); + boolean symbolIsDefined = defineMap.get(symbolName) != null; + //debugPrint(true, "HANDLE_IFDEF: ifdef(" + symbolName + ") = " + symbolIsDefined ); + pushEnableBit(enabled() && symbolIsDefined == isIfdef); + } + + /** Handles #else directives */ + private void handleElse() throws IOException { + boolean enabledStatusBeforeElse = enabled(); + popEnableBit(); + pushEnableBit(enabled() && !enabledStatusBeforeElse); + debugPrint(true, "#else "); + } + + private void handleEndif() { + boolean enabledBeforePopping = enabled(); + popEnableBit(); + + // print the endif if we were enabled prior to popEnableBit() (sending + // false to debugPrint means "print regardless of current enabled() state). + debugPrint(!enabledBeforePopping, "#endif/end-else"); + } + + /** + * @param isIf if true, we're processing #if; if false, we're + * processing #elif. + */ + private void handleIf(boolean isIf) throws IOException { + //System.out.println("IN HANDLE_" + (isIf ? "IF" : "ELIF") + " file \"" + filename() + " line " + lineNumber()); + debugPrint(true, (isIf ? "#if" : "#elif")); + boolean defineEvaluatedToTrue = handleIfRecursive(true); + if (!isIf) { + popEnableBit(); + } + pushEnableBit(defineEvaluatedToTrue); + //System.out.println("OUT HANDLE_" + (isIf ? "IF" : "ELIF") +" (evaluated to " + defineEvaluatedToTrue + ")"); + } + + //static int tmp = -1; + + /** + * This method is called recursively to process nested sub-expressions such as: + *

+   *   #if !defined(OPENSTEP) && !(defined(NeXT) || !defined(NeXT_PDO))
+   *
+ * + * @param greedy if true, continue evaluating sub-expressions until EOL is + * reached. If false, return as soon as the first sub-expression is + * processed. + * @return the value of the sub-expression or (if greedy==true) + * series of sub-expressions. + */ + private boolean handleIfRecursive(boolean greedy) throws IOException { + //System.out.println("IN HANDLE_IF_RECURSIVE (" + ++tmp + ", greedy = " + greedy + ")"); System.out.flush(); + + // ifValue keeps track of the current value of the potentially nested + // "defined()" expressions as we process them. + boolean ifValue = true; + int openParens = 0; + int tok; + do { + tok = nextToken(true); + //System.out.println("-- READ: [" + (tok == StreamTokenizer.TT_EOL ? "" :curTokenAsString()) + "]"); + switch (tok) { + case '(': + ++openParens; + //System.out.println("OPEN PARENS = " + openParens); + ifValue = ifValue && handleIfRecursive(true); + break; + case ')': + --openParens; + //System.out.println("OPEN PARENS = " + openParens); + break; + case '!': + { + //System.out.println("HANDLE_IF_RECURSIVE HANDLING !"); + boolean rhs = handleIfRecursive(false); + ifValue = !rhs; + //System.out.println("HANDLE_IF_RECURSIVE HANDLED OUT !, RHS = " + rhs); + } + break; + case '&': + { + nextRequiredToken('&'); + //System.out.println("HANDLE_IF_RECURSIVE HANDLING &&, LHS = " + ifValue); + boolean rhs = handleIfRecursive(true); + //System.out.println("HANDLE_IF_RECURSIVE HANDLED &&, RHS = " + rhs); + ifValue = ifValue && rhs; + } + break; + case '|': + { + nextRequiredToken('|'); + //System.out.println("HANDLE_IF_RECURSIVE HANDLING ||, LHS = " + ifValue); + boolean rhs = handleIfRecursive(true); + //System.out.println("HANDLE_IF_RECURSIVE HANDLED ||, RHS = " + rhs); + ifValue = ifValue || rhs; + } + break; + case StreamTokenizer.TT_WORD: + { + String word = curTokenAsString(); + if (word.equals("defined")) { + // Handle things like #if defined(SOMESYMBOL) + nextRequiredToken('('); + String symbol = nextWord(); + boolean isDefined = defineMap.get(symbol) != null; + //System.out.println("HANDLE_IF_RECURSIVE HANDLING defined(" + symbol + ") = " + isDefined); + ifValue = ifValue && isDefined; + nextRequiredToken(')'); + } + else { + // Handle things like #if SOME_SYMBOL. + String symbolValue = (String)defineMap.get(word); + + // See if the statement is "true"; i.e., a non-zero expression + if (symbolValue != null) { + // The statement is true if the symbol is defined and is a constant expression + return (!nonConstantDefines.contains(word)); + } else { + // The statement is true if the symbol evaluates to a non-zero value + // + // NOTE: This doesn't yet handle evaluable expressions like "#if + // SOME_SYMBOL > 5" or "#if SOME_SYMBOL == 0", both of which are + // valid syntax. It only handles numeric symbols like "#if 1" + + try { + // see if it's in decimal form + return Double.parseDouble(word) != 0; + } + catch (NumberFormatException nfe1) { + try { + // ok, it's not a valid decimal value, try hex/octal value + return Long.parseLong(word) != 0; + } + catch (NumberFormatException nfe2) { + try { + // ok, it's not a valid hex/octal value, try boolean + return Boolean.valueOf(word) == Boolean.TRUE; + } + catch (NumberFormatException nfe3) { + // give up; the symbol isn't a numeric or boolean value + return false; + } + } + } + } + } + } // end case TT_WORD + break; + case StreamTokenizer.TT_EOL: + //System.out.println("HANDLE_IF_RECURSIVE HIT !"); + pushBackToken(); // so caller hits EOL as well if we're recursing + break; + case StreamTokenizer.TT_EOF: + throw new RuntimeException("Unexpected end of file while parsing " + + "#if statement at file " + filename() + ", line " + lineNumber()); + + default: + throw new RuntimeException("Unexpected token (" + curTokenAsString() + + ") while parsing " + "#if statement at file " + filename() + + ", line " + lineNumber()); + } + //System.out.println("END OF WHILE: greedy = " + greedy + " parens = " +openParens + " not EOL = " + (tok != StreamTokenizer.TT_EOL) + " --> " + ((greedy && openParens >= 0) && tok != StreamTokenizer.TT_EOL)); + } while ((greedy && openParens >= 0) && tok != StreamTokenizer.TT_EOL); + //System.out.println("OUT HANDLE_IF_RECURSIVE (" + tmp-- + ", returning " + ifValue + ")"); + //System.out.flush(); + return ifValue; + } + + ///////////////////////////////////// + // Handling of #include directives // + ///////////////////////////////////// + + private void handleInclude() throws IOException { + // Two kinds of #includes: one with quoted string for argument, + // one with angle brackets surrounding argument + int t = nextToken(); + String filename = null; + if (t == '"') { + filename = curWord(); + } else if (t == '<') { + // Components of path name are coming in as separate tokens; + // concatenate them + StringBuffer buf = new StringBuffer(); + while ((t = nextToken()) != '>' && (t != StreamTokenizer.TT_EOF)) { + buf.append(curTokenAsString()); + } + if (t == StreamTokenizer.TT_EOF) { + System.err.println("WARNING: unexpected EOF while processing #include directive"); + } + filename = buf.toString(); + } + // if we're not within an active block of code (like inside an "#ifdef + // FOO" where FOO isn't defined), then don't actually process the + // #included file. + debugPrint(true, "#include [" + filename + "]"); + if (enabled()) + { + // Look up file in known #include path + String fullname = findFile(filename); + //System.out.println("ACTIVE BLOCK, LOADING " + filename); + if (fullname == null) { + System.err.println("WARNING: unable to find #include file \"" + filename + "\""); + return; + } + // Process this file in-line + Reader reader = new BufferedReader(new FileReader(fullname)); + run(reader, fullname); + } + else + { + //System.out.println("INACTIVE BLOCK, SKIPPING " + filename); + } + } + + //////////// + // Output // + //////////// + + private OutputStream out; + private PrintWriter writer; + private ArrayList enabledBits = new ArrayList(); + + private static int debugPrintIndentLevel = 0; + private void debugPrint(boolean onlyPrintIfEnabled, String msg) + { + if (disableDebugPrint) { + return; + } + + if (!onlyPrintIfEnabled || (onlyPrintIfEnabled && enabled())) + { + for (int i = debugPrintIndentLevel; --i >0; ) { + System.out.print(" "); + } + System.out.println(msg + " (line " + lineNumber() + " file " + filename() + ")"); + } + } + + private void pushEnableBit(boolean enabled) { + enabledBits.add(new Boolean(enabled)); + ++debugPrintIndentLevel; + //debugPrint(false, "PUSH_ENABLED, NOW: " + enabled()); + } + + private void popEnableBit() { + if (enabledBits.size() == 0) { + System.err.println("WARNING: mismatched #ifdef/endif pairs"); + return; + } + enabledBits.remove(enabledBits.size() - 1); + --debugPrintIndentLevel; + //debugPrint(false, "POP_ENABLED, NOW: " + enabled()); + } + + private boolean enabled() { + return (enabledBits.size() == 0 || + ((Boolean) enabledBits.get(enabledBits.size() - 1)).booleanValue()); + } + + private void print(String s) { + if (enabled()) { + writer.print(s); + //System.out.print(s);//debug + } + } + + private void print(char c) { + if (enabled()) { + writer.print(c); + //System.err.print(c); //debug + } + } + + private void println() { + if (enabled()) { + writer.println(); + //System.err.println();//debug + } + } + + private void printToken() { + print(curTokenAsString()); + } + + private void flush() { + if (enabled()) { + writer.flush(); + //System.err.flush(); //debug + } + } + + private void lineDirective() { + print("#line " + lineNumber() + " \"" + filename() + "\""); + println(); + } +} diff --git a/src/classes/com/sun/gluegen/runtime/BufferFactory.java b/src/classes/com/sun/gluegen/runtime/BufferFactory.java new file mode 100644 index 000000000..ca66e6915 --- /dev/null +++ b/src/classes/com/sun/gluegen/runtime/BufferFactory.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.runtime; + +import java.nio.*; +import com.sun.opengl.utils.BufferUtils; + +public class BufferFactory { + + public static int SIZEOF_FLOAT = BufferUtils.SIZEOF_FLOAT; + public static int SIZEOF_DOUBLE = BufferUtils.SIZEOF_DOUBLE; + public static int SIZEOF_INT = BufferUtils.SIZEOF_INT; + public static int SIZEOF_SHORT = BufferUtils.SIZEOF_SHORT; + public static int SIZEOF_LONG = BufferUtils.SIZEOF_LONG; + + public static ByteBuffer newDirectByteBuffer(int size) { + ByteBuffer buf = ByteBuffer.allocateDirect(size); + buf.order(ByteOrder.nativeOrder()); + return buf; + } + + /** Helper routine to tell whether a buffer is direct or not. Null + pointers are considered direct. isDirect() should really be + public in Buffer and not replicated in all subclasses. */ + public static boolean isDirect(Buffer buf) { + if (buf == null) { + return true; + } + if (buf instanceof ByteBuffer) { + return ((ByteBuffer) buf).isDirect(); + } else if (buf instanceof FloatBuffer) { + return ((FloatBuffer) buf).isDirect(); + } else if (buf instanceof DoubleBuffer) { + return ((DoubleBuffer) buf).isDirect(); + } else if (buf instanceof CharBuffer) { + return ((CharBuffer) buf).isDirect(); + } else if (buf instanceof ShortBuffer) { + return ((ShortBuffer) buf).isDirect(); + } else if (buf instanceof IntBuffer) { + return ((IntBuffer) buf).isDirect(); + } else if (buf instanceof LongBuffer) { + return ((LongBuffer) buf).isDirect(); + } + throw new RuntimeException("Unknown buffer type " + buf.getClass().getName()); + } + + + /** Helper routine to get the Buffer byte offset by taking into + account the Buffer position and the underlying type. This is + the total offset for Direct Buffers. */ + + public static int getDirectBufferByteOffset(Buffer buf) { + if(buf == null) { + return 0; + } + if(buf instanceof ByteBuffer) { + return (buf.position()); + } else if (buf instanceof FloatBuffer) { + return (buf.position() * BufferUtils.SIZEOF_FLOAT); + } else if (buf instanceof IntBuffer) { + return (buf.position() * BufferUtils.SIZEOF_INT); + } else if (buf instanceof ShortBuffer) { + return (buf.position() * BufferUtils.SIZEOF_SHORT); + } else if (buf instanceof DoubleBuffer) { + return (buf.position() * BufferUtils.SIZEOF_DOUBLE); + } else if (buf instanceof LongBuffer) { + return (buf.position() * BufferUtils.SIZEOF_LONG); + } + + throw new RuntimeException("Disallowed array backing store type in buffer " + + buf.getClass().getName()); + } + + + /** Helper routine to return the array backing store reference from + a Buffer object. */ + + public static Object getArray(Buffer buf) { + if (buf == null) { + return null; + } + if(buf instanceof ByteBuffer) { + return ((ByteBuffer) buf).array(); + } else if (buf instanceof FloatBuffer) { + return ((FloatBuffer) buf).array(); + } else if (buf instanceof IntBuffer) { + return ((IntBuffer) buf).array(); + } else if (buf instanceof ShortBuffer) { + return ((ShortBuffer) buf).array(); + } else if (buf instanceof DoubleBuffer) { + return ((DoubleBuffer) buf).array(); + } else if (buf instanceof LongBuffer) { + return ((LongBuffer) buf).array(); + } + + throw new RuntimeException("Disallowed array backing store type in buffer " + + buf.getClass().getName()); + } + + + /** Helper routine to get the full byte offset from the beginning of + the array that is the storage for the indirect Buffer + object. The array offset also includes the position offset + within the buffer, in addition to any array offset. */ + + public static int getIndirectBufferByteOffset(Buffer buf) { + if(buf == null) { + return 0; + } + int pos = buf.position(); + if(buf instanceof ByteBuffer) { + return (((ByteBuffer)buf).arrayOffset() + pos); + } else if(buf instanceof FloatBuffer) { + return (BufferUtils.SIZEOF_FLOAT*(((FloatBuffer)buf).arrayOffset() + pos)); + } else if(buf instanceof IntBuffer) { + return (BufferUtils.SIZEOF_INT*(((IntBuffer)buf).arrayOffset() + pos)); + } else if(buf instanceof ShortBuffer) { + return (BufferUtils.SIZEOF_SHORT*(((ShortBuffer)buf).arrayOffset() + pos)); + } else if(buf instanceof DoubleBuffer) { + return (BufferUtils.SIZEOF_DOUBLE*(((DoubleBuffer)buf).arrayOffset() + pos)); + } else if(buf instanceof LongBuffer) { + return (BufferUtils.SIZEOF_LONG*(((LongBuffer)buf).arrayOffset() + pos)); + } + + throw new RuntimeException("Unknown buffer type " + buf.getClass().getName()); + } +} diff --git a/src/classes/com/sun/gluegen/runtime/ProcAddressHelper.java b/src/classes/com/sun/gluegen/runtime/ProcAddressHelper.java new file mode 100644 index 000000000..4d40fd487 --- /dev/null +++ b/src/classes/com/sun/gluegen/runtime/ProcAddressHelper.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.runtime; + +/** Contains constants used in glue code generation. */ + +public class ProcAddressHelper { + public static final String PROCADDRESS_VAR_PREFIX = "_addressof_"; +} diff --git a/src/classes/com/sun/gluegen/runtime/StructAccessor.java b/src/classes/com/sun/gluegen/runtime/StructAccessor.java new file mode 100644 index 000000000..5a0fa5d25 --- /dev/null +++ b/src/classes/com/sun/gluegen/runtime/StructAccessor.java @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.gluegen.runtime; + +import java.nio.*; + +public class StructAccessor { + private ByteBuffer bb; + private CharBuffer cb; + private DoubleBuffer db; + private FloatBuffer fb; + private IntBuffer ib; + private LongBuffer lb; + private ShortBuffer sb; + + public StructAccessor(ByteBuffer bb) { + // Setting of byte order is concession to native code which needs + // to instantiate these + this.bb = bb.order(ByteOrder.nativeOrder()); + } + + public ByteBuffer getBuffer() { + return bb; + } + + /** Return a slice of the current ByteBuffer starting at the + specified byte offset and extending the specified number of + bytes. Note that this method is not thread-safe with respect to + the other methods in this class. */ + public ByteBuffer slice(int byteOffset, int byteLength) { + bb.position(byteOffset); + bb.limit(byteOffset + byteLength); + ByteBuffer newBuf = bb.slice(); + bb.position(0); + bb.limit(bb.capacity()); + return newBuf; + } + + /** Retrieves the byte at the specified slot (byte offset). */ + public byte getByteAt(int slot) { + return bb.get(slot); + } + + /** Puts a byte at the specified slot (byte offset). */ + public void setByteAt(int slot, byte v) { + bb.put(slot, v); + } + + /** Retrieves the char at the specified slot (2-byte offset). */ + public char getCharAt(int slot) { + return charBuffer().get(slot); + } + + /** Puts a char at the specified slot (2-byte offset). */ + public void setCharAt(int slot, char v) { + charBuffer().put(slot, v); + } + + /** Retrieves the double at the specified slot (8-byte offset). */ + public double getDoubleAt(int slot) { + return doubleBuffer().get(slot); + } + + /** Puts a double at the specified slot (8-byte offset). */ + public void setDoubleAt(int slot, double v) { + doubleBuffer().put(slot, v); + } + + /** Retrieves the float at the specified slot (4-byte offset). */ + public float getFloatAt(int slot) { + return floatBuffer().get(slot); + } + + /** Puts a float at the specified slot (4-byte offset). */ + public void setFloatAt(int slot, float v) { + floatBuffer().put(slot, v); + } + + /** Retrieves the int at the specified slot (4-byte offset). */ + public int getIntAt(int slot) { + return intBuffer().get(slot); + } + + /** Puts a int at the specified slot (4-byte offset). */ + public void setIntAt(int slot, int v) { + intBuffer().put(slot, v); + } + + /** Retrieves the long at the specified slot (8-byte offset). */ + public long getLongAt(int slot) { + return longBuffer().get(slot); + } + + /** Puts a long at the specified slot (8-byte offset). */ + public void setLongAt(int slot, long v) { + longBuffer().put(slot, v); + } + + /** Retrieves the short at the specified slot (2-byte offset). */ + public short getShortAt(int slot) { + return shortBuffer().get(slot); + } + + /** Puts a short at the specified slot (2-byte offset). */ + public void setShortAt(int slot, short v) { + shortBuffer().put(slot, v); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private CharBuffer charBuffer() { + if (cb == null) { + cb = bb.asCharBuffer(); + } + return cb; + } + + private DoubleBuffer doubleBuffer() { + if (db == null) { + db = bb.asDoubleBuffer(); + } + return db; + } + + private FloatBuffer floatBuffer() { + if (fb == null) { + fb = bb.asFloatBuffer(); + } + return fb; + } + + private IntBuffer intBuffer() { + if (ib == null) { + ib = bb.asIntBuffer(); + } + return ib; + } + + private LongBuffer longBuffer() { + if (lb == null) { + lb = bb.asLongBuffer(); + } + return lb; + } + + private ShortBuffer shortBuffer() { + if (sb == null) { + sb = bb.asShortBuffer(); + } + return sb; + } +} diff --git a/src/classes/com/sun/opengl/cg/CgException.java b/src/classes/com/sun/opengl/cg/CgException.java new file mode 100644 index 000000000..3380bb540 --- /dev/null +++ b/src/classes/com/sun/opengl/cg/CgException.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.cg; + +/** + * A generic exception for errors that occur throughout the NVidia Cg + * binding, as a substitute for {@link RuntimeException}. + */ +public class CgException extends RuntimeException { + /** Constructs a CgException object. */ + public CgException() { + super(); + } + + /** Constructs a CgException object with the specified detail message. */ + public CgException(String message) { + super(message); + } + + /** Constructs a CgException object with the specified detail message and + root cause. */ + public CgException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs a CgException object with the specified root cause. */ + public CgException(Throwable cause) { + super(cause); + } +} diff --git a/src/classes/com/sun/opengl/impl/Debug.java b/src/classes/com/sun/opengl/impl/Debug.java new file mode 100644 index 000000000..8d25db304 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/Debug.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.security.*; +import com.sun.opengl.utils.Version; + +/** Helper routines for logging and debugging. */ + +public class Debug { + // Some common properties + private static boolean verbose; + private static boolean debugAll; + + static { + verbose = isPropertyDefined("jogl.verbose"); + debugAll = isPropertyDefined("jogl.debug"); + if (verbose) { + System.err.println("JOGL version " + Version.getVersion()); + } + } + + public static boolean getBooleanProperty(final String property) { + Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + boolean val = Boolean.getBoolean(property); + return (val ? Boolean.TRUE : Boolean.FALSE); + } + }); + return b.booleanValue(); + } + + public static boolean isPropertyDefined(final String property) { + Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String val = System.getProperty(property); + return (val != null ? Boolean.TRUE : Boolean.FALSE); + } + }); + return b.booleanValue(); + } + + public static boolean verbose() { + return verbose; + } + + public static boolean debugAll() { + return debugAll; + } + + public static boolean debug(String subcomponent) { + return debugAll() || isPropertyDefined("jogl.debug." + subcomponent); + } +} diff --git a/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java b/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java new file mode 100644 index 000000000..754e1d918 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import javax.media.opengl.*; +import java.util.*; +import java.awt.Canvas; +import java.awt.Graphics; +import java.awt.GraphicsConfiguration; +import java.lang.reflect.*; + +/** + * A utility object intended to be used by implementations to act as a cache + * of which OpenGL functions are currently available on both the host machine + * and display. + */ +public final class FunctionAvailabilityCache { + private static final boolean DEBUG = Debug.debug("FunctionAvailabilityCache"); + + FunctionAvailabilityCache(GLContextImpl context) + { + this.context = context; + } + + /** + * Flush the cache. The cache will be rebuilt lazily as calls to {@link + * #isFunctionAvailable(String)} are received. + */ + public void flush() + { + availabilityCache.clear(); + availableExtensionCache.clear(); + } + + public boolean isFunctionAvailable(String glFunctionName) + { + if (DEBUG) { + System.err.println("!!! CHECKING FOR AVAILABILITY OF: "+ glFunctionName); + } + + Boolean available = (Boolean)availabilityCache.get(glFunctionName); + + if (available == null) // not in availabilityCache + { + if (isPartOfAvailableExtensions(glFunctionName) || + isPartOfGLCore(context.getGL().glGetString(GL.GL_VERSION), glFunctionName)) + { + available = Boolean.TRUE; + } + else + { + available = Boolean.FALSE; + } + + availabilityCache.put(glFunctionName, available); + } + + if (DEBUG) { + System.err.println("!!! AVAILABILITY OF "+ glFunctionName + ": " + available.booleanValue()); + } + + return available.booleanValue(); + } + + public boolean isExtensionAvailable(String glExtensionName) { + initAvailableExtensions(); + return availableExtensionCache.contains(glExtensionName); + } + + protected void initAvailableExtensions() { + // if hash is empty (meaning it was flushed), pre-cache it with the list + // of extensions that are in the GL_EXTENSIONS string + if (availableExtensionCache.isEmpty()) { + GL gl = context.getGL(); + if (DEBUG) { + System.err.println("!!! Pre-caching extension availability"); + } + String allAvailableExtensions = + gl.glGetString(GL.GL_EXTENSIONS) + " " + context.getPlatformExtensionsString(); + if (DEBUG) { + System.err.println("!!! Available extensions: " + allAvailableExtensions); + System.err.println("!!! GL vendor: " + gl.glGetString(GL.GL_VENDOR)); + } + StringTokenizer tok = new StringTokenizer(allAvailableExtensions); + while (tok.hasMoreTokens()) { + String availableExt = tok.nextToken().trim(); + availableExt = availableExt.intern(); + availableExtensionCache.add(availableExt); + if (DEBUG) { + System.err.println("!!! Available: " + availableExt); + } + } + + // Put GL version strings in the table as well + Version version = new Version(gl.glGetString(GL.GL_VERSION)); + int major = version.getMajor(); + int minor = version.getMinor(); + // FIXME: this needs to be adjusted when the major and minor + // revs change beyond the known ones + switch (major) { + default: + if (major < 2) + break; + case 2: availableExtensionCache.add("GL_VERSION_2_0"); minor = 5; + case 1: + switch (minor) { + case 5: availableExtensionCache.add("GL_VERSION_1_5"); + case 4: availableExtensionCache.add("GL_VERSION_1_4"); + case 3: availableExtensionCache.add("GL_VERSION_1_3"); + case 2: availableExtensionCache.add("GL_VERSION_1_2"); + case 1: availableExtensionCache.add("GL_VERSION_1_1"); + case 0: availableExtensionCache.add("GL_VERSION_1_0"); + } + } + + // put a dummy var in here so that the cache is no longer empty even if + // no extensions are in the GL_EXTENSIONS string + availableExtensionCache.add(""); + } + } + + protected boolean isPartOfAvailableExtensions(String glFunctionName) + { + initAvailableExtensions(); + + // First, find the extension to which the function corresponds + String extensionName = getExtensionCorrespondingToFunction(glFunctionName); + + // Now see if that extension is available + boolean extensionAvailable = availableExtensionCache.contains(extensionName); + + return extensionAvailable; + } + + /** + * Returns true if the given OpenGL function is part of the OpenGL core + * that corresponds to the give OpenGL version string. + * + * @param glVersionString must be of the form "X" or "X.Y" or "X.Y.Z", where + * X, Y, and Z are integers + * @exception GLException if the glFunctionName passed in is + * not the name of any known OpenGL extension function. + */ + public static boolean isPartOfGLCore(String glVersionString, String glFunctionName) + { + String funcCoreVersionString = + StaticGLInfo.getFunctionAssociation(glFunctionName); + + if (funcCoreVersionString == null) { + // No extension string was found in the glext.h/wglext.h/glxext.h + // headers when building the StaticGLInfo class. So either it's a new + // extension that's not in those headers, or it's not an opengl + // extension. Either way it's an illegal argument. + throw new GLException( + "Function \"" + glFunctionName + "\" does not " + + "correspond to any known OpenGL extension or core version."); + } + + Version actualVersion; + try + { + actualVersion = new Version(funcCoreVersionString); + } + catch (IllegalArgumentException e) + { + // funcCoreVersionString is not an OpenGL version identifier (i.e., not + // of the form GL_VERSION_XXX or X.Y). + // + // Since the association string returned from + // StaticGLInfo.getFunctionAssociation() was not null, this function + // must be an OpenGL extension function. + // + // Therefore this function can't be part of any OpenGL core. + return false; + } + + Version versionToCheck; + try + { + versionToCheck = new Version(glVersionString); + } + catch (IllegalArgumentException e) + { + // user did not supply a valid OpenGL version identifier + throw new IllegalArgumentException( + "Illegally formatted OpenGL version identifier: \"" + glVersionString + "\""); + } + + // See if the version number of glVersionString is less than or equal to + // the OpenGL specification number to which the given function actually + // belongs. + if (actualVersion.compareTo(versionToCheck) <= 0) + { + if (DEBUG) { + System.err.println( + glFunctionName + " is in core OpenGL " + glVersionString + + " because it is in OpenGL " + funcCoreVersionString); + } + return true; + } + + if (DEBUG) { + System.err.println( + glFunctionName + " is NOT a part of the OpenGL " + glVersionString + " core" + + "; it is part of OpenGL " + funcCoreVersionString); + } + + return false; + } + + /** Returns the extension name that corresponds to the given extension + * function. For example, it will return "GL_EXT_vertex_array" when the + * argument is "glNormalPointerEXT". + * + * Please see http://oss.sgi.com/projects/ogl-sample/registry/index.html for + * a list of extension names and the functions they expose. + */ + protected static String getExtensionCorrespondingToFunction(String glFunctionName) + { + // HACK: FIXME!!! return something I know is supported so I can test other + // functions. + return StaticGLInfo.getFunctionAssociation(glFunctionName); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private HashMap availabilityCache = new HashMap(50); + private HashSet availableExtensionCache = new HashSet(50); + private GLContextImpl context; + + /** + * A class for storing and comparing revision version numbers. + */ + private static class Version implements Comparable + { + private int major, minor, sub; + public Version(int majorRev, int minorRev, int subMinorRev) + { + major = majorRev; + minor = minorRev; + sub = subMinorRev; + } + + /** + * @param versionString must be of the form "GL_VERSION_X" or + * "GL_VERSION_X_Y" or "GL_VERSION_X_Y_Z" or "X.Y", where X, Y, + * and Z are integers. + * + * @exception IllegalArgumentException if the argument is not a valid + * OpenGL version identifier + */ + public Version(String versionString) + { + try + { + if (versionString.startsWith("GL_VERSION_")) + { + StringTokenizer tok = new StringTokenizer(versionString, "_"); + + tok.nextToken(); // GL_ + tok.nextToken(); // VERSION_ + if (!tok.hasMoreTokens()) { major = 0; return; } + major = Integer.valueOf(tok.nextToken()).intValue(); + if (!tok.hasMoreTokens()) { minor = 0; return; } + minor = Integer.valueOf(tok.nextToken()).intValue(); + if (!tok.hasMoreTokens()) { sub = 0; return; } + sub = Integer.valueOf(tok.nextToken()).intValue(); + } + else + { + StringTokenizer tok = new StringTokenizer(versionString, ". "); + major = Integer.valueOf(tok.nextToken()).intValue(); + minor = Integer.valueOf(tok.nextToken()).intValue(); + } + } + catch (Exception e) + { + throw new IllegalArgumentException( + "Illegally formatted version identifier: \"" + versionString + "\""); + } + } + + public int compareTo(Object o) + { + Version vo = (Version)o; + if (major > vo.major) return 1; + else if (major < vo.major) return -1; + else if (minor > vo.minor) return 1; + else if (minor < vo.minor) return -1; + else if (sub > vo.sub) return 1; + else if (sub < vo.sub) return -1; + + return 0; // they are equal + } + + public int getMajor() { + return major; + } + + public int getMinor() { + return minor; + } + + } // end class Version +} + diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java new file mode 100644 index 000000000..f2dfa216b --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.awt.Component; +import java.nio.*; + +import javax.media.opengl.*; +import com.sun.gluegen.runtime.*; + +public abstract class GLContextImpl extends GLContext { + protected GLContextLock lock = new GLContextLock(); + protected static final boolean DEBUG = Debug.debug("GLContextImpl"); + protected static final boolean VERBOSE = Debug.verbose(); + protected static final boolean NO_FREE = Debug.isPropertyDefined("jogl.GLContext.nofree"); + + // Cache of the functions that are available to be called at the current + // moment in time + protected FunctionAvailabilityCache functionAvailability; + // Table that holds the addresses of the native C-language entry points for + // OpenGL functions. + private GLProcAddressTable glProcAddressTable; + + protected GL gl; + public GLContextImpl(GLContext shareWith) { + setGL(createGL()); + functionAvailability = new FunctionAvailabilityCache(this); + if (shareWith != null) { + GLContextShareSet.registerSharing(this, shareWith); + } + } + + public int makeCurrent() throws GLException { + lock.lock(); + int res = 0; + try { + res = makeCurrentImpl(); + } catch (GLException e) { + lock.unlock(); + throw(e); + } + if (res == CONTEXT_NOT_CURRENT) { + lock.unlock(); + } else { + setCurrent(this); + } + return res; + } + + protected abstract int makeCurrentImpl() throws GLException; + + public void release() throws GLException { + if (!lock.isHeld()) { + throw new GLException("Context not current on current thread"); + } + setCurrent(null); + try { + releaseImpl(); + } finally { + lock.unlock(); + } + } + + protected abstract void releaseImpl() throws GLException; + + public void destroy() { + if (lock.isHeld()) { + throw new GLException("Can not destroy context while it is current"); + } + // Should we check the lock state? It should not be current on any + // thread. + destroyImpl(); + } + + protected abstract void destroyImpl() throws GLException; + + public boolean isSynchronized() { + return !lock.getFailFastMode(); + } + + public void setSynchronized(boolean isSynchronized) { + lock.setFailFastMode(!isSynchronized); + } + + public GL getGL() { + return gl; + } + + public void setGL(GL gl) { + this.gl = gl; + } + + public abstract Object getPlatformGLExtensions(); + + //---------------------------------------------------------------------- + // Helpers for various context implementations + // + + /** Create the GL for this context. */ + protected GL createGL() { + return new GLImpl(this); + } + + public GLProcAddressTable getGLProcAddressTable() { + if (glProcAddressTable == null) { + // FIXME: cache ProcAddressTables by capability bits so we can + // share them among contexts with the same capabilities + glProcAddressTable = new GLProcAddressTable(); + } + return glProcAddressTable; + } + + /** + * Pbuffer support; given that this is a GLContext associated with a + * pbuffer, binds this pbuffer to its texture target. + */ + public abstract void bindPbufferToTexture(); + + /** + * Pbuffer support; given that this is a GLContext associated with a + * pbuffer, releases this pbuffer from its texture target. + */ + public abstract void releasePbufferFromTexture(); + + public abstract ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3); + + /* + * Sets the swap interval for onscreen OpenGL contexts. Has no + * effect for offscreen contexts. + */ + public void setSwapInterval(final int interval) { + } + + /** Maps the given "platform-independent" function name to a real function + name. Currently this is only used to map "glAllocateMemoryNV" and + associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */ + protected abstract String mapToRealGLFunctionName(String glFunctionName); + + /** Maps the given "platform-independent" extension name to a real + function name. Currently this is only used to map + "GL_ARB_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pbuffer" + and "WGL_ARB_pixel_format" (not yet mapped to X11). */ + protected abstract String mapToRealGLExtensionName(String glExtensionName); + + /** Returns a non-null (but possibly empty) string containing the + space-separated list of available platform-dependent (e.g., WGL, + GLX) extensions. Can only be called while this context is + current. */ + public abstract String getPlatformExtensionsString(); + + /** Helper routine which resets a ProcAddressTable generated by the + GLEmitter by looking up anew all of its function pointers. */ + protected void resetProcAddressTable(Object table) { + GLDrawableFactoryImpl.getFactoryImpl().resetProcAddressTable(table); + } + + /** Indicates whether the underlying OpenGL context has been + created. This is used to manage sharing of display lists and + textures between contexts. */ + public abstract boolean isCreated(); + + /** + * Resets the cache of which GL functions are available for calling through this + * context. See {@link #isFunctionAvailable(String)} for more information on + * the definition of "available". + */ + protected void resetGLFunctionAvailability() { + // In order to be able to allow the user to uniformly install the + // debug and trace pipelines in their GLEventListener.init() + // method (for both GLCanvas and GLJPanel), we need to reset the + // actual GL object in the GLDrawable as well + setGL(createGL()); + + functionAvailability.flush(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Initializing OpenGL extension address table for " + this); + } + resetProcAddressTable(getGLProcAddressTable()); + } + + /** + * Returns true if the specified OpenGL core- or extension-function can be + * successfully called using this GL context given the current host (OpenGL + * client) and display (OpenGL server) configuration. + * + * See {@link GL#isFunctionAvailable(String)} for more details. + * + * @param glFunctionName the name of the OpenGL function (e.g., use + * "glPolygonOffsetEXT" to check if the {@link + * javax.media.opengl.GL#glPolygonOffsetEXT(float,float)} is available). + */ + protected boolean isFunctionAvailable(String glFunctionName) { + return functionAvailability.isFunctionAvailable(mapToRealGLFunctionName(glFunctionName)); + } + + /** + * Returns true if the specified OpenGL extension can be + * successfully called using this GL context given the current host (OpenGL + * client) and display (OpenGL server) configuration. + * + * See {@link GL#isExtensionAvailable(String)} for more details. + * + * @param glExtensionName the name of the OpenGL extension (e.g., + * "GL_VERTEX_PROGRAM_ARB"). + */ + public boolean isExtensionAvailable(String glExtensionName) { + return functionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName)); + } + + /** Indicates which floating-point pbuffer implementation is in + use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT, + or GLPbuffer.NV_FLOAT. */ + public int getFloatingPointMode() throws GLException { + throw new GLException("Not supported on non-pbuffer contexts"); + } + + /** On some platforms the mismatch between OpenGL's coordinate + system (origin at bottom left) and the window system's + coordinate system (origin at top left) necessitates a vertical + flip of pixels read from offscreen contexts. */ + public abstract boolean offscreenImageNeedsVerticalFlip(); + + /** Only called for offscreen contexts; needed by glReadPixels */ + public abstract int getOffscreenContextPixelDataType(); + + protected static String getThreadName() { + return Thread.currentThread().getName(); + } + + public static String toHexString(long hex) { + return "0x" + Long.toHexString(hex); + } +} diff --git a/src/classes/com/sun/opengl/impl/GLContextLock.java b/src/classes/com/sun/opengl/impl/GLContextLock.java new file mode 100644 index 000000000..7668678b7 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLContextLock.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import javax.media.opengl.*; + +/** Implements the makeCurrent / release locking behavior of the + GLContext class. When "fail fast mode" is enabled, attempts to + lock the same GLContextLock on more than one thread cause + GLException to be raised. This lock is not recursive. Attempts to + lock it more than once on a given thread will cause GLException to + be raised. */ + +public class GLContextLock { + private Object lock = new Object(); + private Thread owner; + private boolean failFastMode = true; + + /** Locks this GLContextLock on the current thread. If fail fast + mode is enabled and the GLContextLock is already owned by + another thread, throws GLException. */ + public void lock() throws GLException { + synchronized(lock) { + Thread current = Thread.currentThread(); + if (owner == null) { + owner = current; + } else if (owner != current) { + while (owner != null) { + if (failFastMode) { + throw new GLException("Attempt to make context current on thread " + current + + " which is already current on thread " + owner); + } else { + try { + lock.wait(); + } catch (InterruptedException e) { + throw new GLException(e); + } + } + } + owner = current; + } else { + throw new GLException("Attempt to make the same context current twice on thread " + current); + } + } + } + + /** Unlocks this GLContextLock. */ + public void unlock() throws GLException { + synchronized (lock) { + Thread current = Thread.currentThread(); + if (owner == current) { + owner = null; + lock.notifyAll(); + } else { + if (owner != null) { + throw new GLException("Attempt by thread " + current + + " to release context owned by thread " + owner); + } else { + throw new GLException("Attempt by thread " + current + + " to release unowned context"); + } + } + } + } + + /** Indicates whether this lock is held by the current thread. */ + public boolean isHeld() { + synchronized(lock) { + Thread current = Thread.currentThread(); + return (owner == current); + } + } + + public void setFailFastMode(boolean onOrOff) { + failFastMode = onOrOff; + } + + public boolean getFailFastMode() { + return failFastMode; + } +} diff --git a/src/classes/com/sun/opengl/impl/GLContextShareSet.java b/src/classes/com/sun/opengl/impl/GLContextShareSet.java new file mode 100644 index 000000000..a797ae69c --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLContextShareSet.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.lang.ref.*; +import java.util.*; +import javax.media.opengl.*; + +/** Provides a mechanism by which OpenGL contexts can share textures + and display lists in the face of multithreading and asynchronous + context creation as is inherent in the AWT and Swing. */ + +public class GLContextShareSet { + // This class is implemented with a WeakHashMap that goes from the + // contexts as keys to a complex data structure as value that tracks + // context creation and deletion. + + private static Map/*>*/ shareMap = new WeakHashMap(); + private static Object dummyValue = new Object(); + + private static class ShareSet { + private Map allShares = new WeakHashMap(); + private Map createdShares = new WeakHashMap(); + private Map destroyedShares = new WeakHashMap(); + + public void add(GLContext ctx) { + if (allShares.put(ctx, dummyValue) == null) { + // FIXME: downcast to GLContextImpl undesirable + if (((GLContextImpl) ctx).isCreated()) { + createdShares.put(ctx, dummyValue); + } else { + destroyedShares.put(ctx, dummyValue); + } + } + } + + public GLContext getCreatedShare(GLContext ignore) { + for (Iterator iter = createdShares.keySet().iterator(); iter.hasNext(); ) { + GLContext ctx = (GLContext) iter.next(); + if (ctx != ignore) { + return ctx; + } + } + return null; + } + + public void contextCreated(GLContext ctx) { + Object res = destroyedShares.remove(ctx); + assert res != null : "State of ShareSet corrupted; thought context " + + ctx + " should have been in destroyed set but wasn't"; + res = createdShares.put(ctx, dummyValue); + assert res == null : "State of ShareSet corrupted; thought context " + + ctx + " shouldn't have been in created set but was"; + } + + public void contextDestroyed(GLContext ctx) { + Object res = createdShares.remove(ctx); + assert res != null : "State of ShareSet corrupted; thought context " + + ctx + " should have been in created set but wasn't"; + res = destroyedShares.put(ctx, dummyValue); + assert res == null : "State of ShareSet corrupted; thought context " + + ctx + " shouldn't have been in destroyed set but was"; + } + } + + + /** Indicate that contexts share1 and + share2 will share textures and display lists. */ + public static synchronized void registerSharing(GLContext share1, GLContext share2) { + ShareSet share = entryFor(share1); + if (share == null) { + share = entryFor(share2); + } + if (share == null) { + share = new ShareSet(); + } + share.add(share1); + share.add(share2); + addEntry(share1, share); + addEntry(share2, share); + } + + public static synchronized GLContext getShareContext(GLContext contextToCreate) { + ShareSet share = entryFor(contextToCreate); + if (share == null) { + return null; + } + return share.getCreatedShare(contextToCreate); + } + + public static synchronized void contextCreated(GLContext context) { + ShareSet share = entryFor(context); + if (share != null) { + share.contextCreated(context); + } + } + + public static synchronized void contextDestroyed(GLContext context) { + ShareSet share = entryFor(context); + if (share != null) { + share.contextDestroyed(context); + } + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private static ShareSet entryFor(GLContext context) { + return (ShareSet) shareMap.get(context); + } + + private static void addEntry(GLContext context, ShareSet share) { + if (shareMap.get(context) == null) { + shareMap.put(context, share); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java new file mode 100644 index 000000000..37dea5c15 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.awt.Component; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import com.sun.gluegen.runtime.*; // for PROCADDRESS_VAR_PREFIX +import javax.media.opengl.*; + +/** Extends GLDrawableFactory with a few methods for handling + typically software-accelerated offscreen rendering (Device + Independent Bitmaps on Windows, pixmaps on X11). Direct access to + these GLDrawables is not supplied directly to end users, though + they may be instantiated by the GLJPanel implementation. */ +public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { + /** Creates a (typically software-accelerated) offscreen GLDrawable + used to implement the fallback rendering path of the + GLJPanel. */ + public abstract GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser); + + /** Helper routine which resets a ProcAddressTable generated by the + GLEmitter by looking up anew all of its function pointers. */ + public void resetProcAddressTable(Object table) { + Class tableClass = table.getClass(); + java.lang.reflect.Field[] fields = tableClass.getDeclaredFields(); + + for (int i = 0; i < fields.length; ++i) { + String addressFieldName = fields[i].getName(); + if (!addressFieldName.startsWith(ProcAddressHelper.PROCADDRESS_VAR_PREFIX)) { + // not a proc address variable + continue; + } + int startOfMethodName = ProcAddressHelper.PROCADDRESS_VAR_PREFIX.length(); + String glFuncName = addressFieldName.substring(startOfMethodName); + try { + java.lang.reflect.Field addressField = tableClass.getDeclaredField(addressFieldName); + assert(addressField.getType() == Long.TYPE); + long newProcAddress = dynamicLookupFunction(glFuncName); + // set the current value of the proc address variable in the table object + addressField.setLong(table, newProcAddress); + } catch (Exception e) { + throw new GLException("Cannot get GL proc address for method \"" + + glFuncName + "\": Couldn't set value of field \"" + addressFieldName + + "\" in class " + tableClass.getName(), e); + } + } + } + + /** Dynamically looks up the given function. */ + public abstract long dynamicLookupFunction(String glFuncName); + + /** Locks the AWT for the purposes of Java2D/JOGL integration. This + * is not necessary on some platforms. + */ + public abstract void lockAWTForJava2D(); + + /** Unlocks the AWT for the purposes of Java2D/JOGL integration. + * This is not necessary on some platforms. + */ + public abstract void unlockAWTForJava2D(); + + public static GLDrawableFactoryImpl getFactoryImpl() { + return (GLDrawableFactoryImpl) getFactory(); + } +} diff --git a/src/classes/com/sun/opengl/impl/GLDrawableHelper.java b/src/classes/com/sun/opengl/impl/GLDrawableHelper.java new file mode 100644 index 000000000..014e35f7e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLDrawableHelper.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.util.*; +import javax.media.opengl.*; + +/** Encapsulates the implementation of most of the GLAutoDrawable's + methods to be able to share it between GLCanvas and GLJPanel. */ + +public class GLDrawableHelper { + private volatile List listeners = new ArrayList(); + private static final boolean DEBUG = Debug.debug("GLDrawableHelper"); + private static final boolean VERBOSE = Debug.verbose(); + private boolean autoSwapBufferMode = true; + + public GLDrawableHelper() { + } + + public synchronized void addGLEventListener(GLEventListener listener) { + List newListeners = (List) ((ArrayList) listeners).clone(); + newListeners.add(listener); + listeners = newListeners; + } + + public synchronized void removeGLEventListener(GLEventListener listener) { + List newListeners = (List) ((ArrayList) listeners).clone(); + newListeners.remove(listener); + listeners = newListeners; + } + + public void init(GLAutoDrawable drawable) { + for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { + ((GLEventListener) iter.next()).init(drawable); + } + } + + public void display(GLAutoDrawable drawable) { + for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { + ((GLEventListener) iter.next()).display(drawable); + } + } + + public void reshape(GLAutoDrawable drawable, + int x, int y, int width, int height) { + for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { + ((GLEventListener) iter.next()).reshape(drawable, x, y, width, height); + } + } + + public void setAutoSwapBufferMode(boolean onOrOff) { + autoSwapBufferMode = onOrOff; + } + + public boolean getAutoSwapBufferMode() { + return autoSwapBufferMode; + } + + private static final ThreadLocal perThreadInitAction = new ThreadLocal(); + /** Principal helper method which runs a Runnable with the context + made current. This could have been made part of GLContext, but a + desired goal is to be able to implement the GLCanvas in terms of + the GLContext's public APIs, and putting it into a separate + class helps ensure that we don't inadvertently use private + methods of the GLContext or its implementing classes. */ + public void invokeGL(GLDrawable drawable, + GLContext context, + Runnable runnable, + Runnable initAction) { + // Support for recursive makeCurrent() calls as well as calling + // other drawables' display() methods from within another one's + GLContext lastContext = GLContext.getCurrent(); + Runnable lastInitAction = (Runnable) perThreadInitAction.get(); + if (lastContext != null) { + lastContext.release(); + } + + int res = 0; + try { + res = context.makeCurrent(); + if (res != GLContext.CONTEXT_NOT_CURRENT) { + if (res == GLContext.CONTEXT_CURRENT_NEW) { + if (DEBUG) { + System.err.println("GLDrawableHelper " + this + ".invokeGL(): Running initAction"); + } + initAction.run(); + } + if (DEBUG && VERBOSE) { + System.err.println("GLDrawableHelper " + this + ".invokeGL(): Running runnable"); + } + runnable.run(); + if (autoSwapBufferMode) { + if (drawable != null) { + drawable.swapBuffers(); + } + } + } + } finally { + try { + if (res != GLContext.CONTEXT_NOT_CURRENT) { + context.release(); + } + } catch (Exception e) { + } + if (lastContext != null) { + int res2 = lastContext.makeCurrent(); + if (res2 == GLContext.CONTEXT_CURRENT_NEW) { + lastInitAction.run(); + } + } + } + } +} diff --git a/src/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableImpl.java new file mode 100644 index 000000000..f93ed9663 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import javax.media.opengl.*; + +public abstract class GLDrawableImpl implements GLDrawable { + /** For offscreen GLDrawables (pbuffers and "pixmap" drawables), + indicates that native resources should be reclaimed. */ + public abstract void destroy() throws GLException; + + public static String toHexString(long hex) { + return GLContextImpl.toHexString(hex); + } +} diff --git a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java new file mode 100644 index 000000000..196ea7223 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.event.*; +import java.beans.PropertyChangeListener; + +import javax.media.opengl.*; + +/** Platform-independent class exposing pbuffer functionality to + applications. This class is not exposed in the public API as it + would probably add no value; however it implements the GLDrawable + interface so can be interacted with via its display() method. */ + +public class GLPbufferImpl implements GLPbuffer { + private GLDrawableImpl pbufferDrawable; + private GLContextImpl context; + private GLDrawableHelper drawableHelper = new GLDrawableHelper(); + private int floatMode; + + public GLPbufferImpl(GLDrawableImpl pbufferDrawable, + GLContext parentContext) { + this.pbufferDrawable = pbufferDrawable; + context = (GLContextImpl) pbufferDrawable.createContext(parentContext); + context.setSynchronized(true); + } + + public GLContext createContext(GLContext shareWith) { + return pbufferDrawable.createContext(shareWith); + } + + public void setRealized(boolean realized) { + } + + public void setSize(int width, int height) { + // FIXME + throw new GLException("Not yet implemented"); + } + + public int getWidth() { + return pbufferDrawable.getWidth(); + } + + public int getHeight() { + return pbufferDrawable.getHeight(); + } + + public void display() { + maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction, + displayAction, + false); + } + + public void repaint() { + display(); + } + + public void addGLEventListener(GLEventListener listener) { + drawableHelper.addGLEventListener(listener); + } + + public void removeGLEventListener(GLEventListener listener) { + drawableHelper.removeGLEventListener(listener); + } + + public GLContext getContext() { + return context; + } + + public GLDrawable getDrawable() { + return pbufferDrawable; + } + + public GL getGL() { + return getContext().getGL(); + } + + public void setGL(GL gl) { + getContext().setGL(gl); + } + + public void setAutoSwapBufferMode(boolean onOrOff) { + drawableHelper.setAutoSwapBufferMode(onOrOff); + } + + public boolean getAutoSwapBufferMode() { + return drawableHelper.getAutoSwapBufferMode(); + } + + public void swapBuffers() { + maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction, false); + } + + public void bindTexture() { + // Doesn't make much sense to try to do this on the event dispatch + // thread given that it has to be called while the context is current + context.bindPbufferToTexture(); + } + + public void releaseTexture() { + // Doesn't make much sense to try to do this on the event dispatch + // thread given that it has to be called while the context is current + context.releasePbufferFromTexture(); + } + + //---------------------------------------------------------------------- + // No-ops for ComponentEvents + // + + public void addComponentListener(ComponentListener l) {} + public void removeComponentListener(ComponentListener l) {} + public void addFocusListener(FocusListener l) {} + public void removeFocusListener(FocusListener l) {} + public void addHierarchyBoundsListener(HierarchyBoundsListener l) {} + public void removeHierarchyBoundsListener(HierarchyBoundsListener l) {} + public void addHierarchyListener(HierarchyListener l) {} + public void removeHierarchyListener(HierarchyListener l) {} + public void addInputMethodListener(InputMethodListener l) {} + public void removeInputMethodListener(InputMethodListener l) {} + public void addKeyListener(KeyListener l) {} + public void removeKeyListener(KeyListener l) {} + public void addMouseListener(MouseListener l) {} + public void removeMouseListener(MouseListener l) {} + public void addMouseMotionListener(MouseMotionListener l) {} + public void removeMouseMotionListener(MouseMotionListener l) {} + public void addMouseWheelListener(MouseWheelListener l) {} + public void removeMouseWheelListener(MouseWheelListener l) {} + public void addPropertyChangeListener(PropertyChangeListener listener) {} + public void removePropertyChangeListener(PropertyChangeListener listener) {} + public void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener) {} + public void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener) {} + + public void destroy() { + context.destroy(); + pbufferDrawable.destroy(); + } + + public int getFloatingPointMode() { + if (floatMode == 0) { + throw new GLException("Pbuffer not initialized, or floating-point support not requested"); + } + return floatMode; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private void maybeDoSingleThreadedWorkaround(Runnable eventDispatchThreadAction, + Runnable invokeGLAction, + boolean isReshape) { + if (Threading.isSingleThreaded() && + !Threading.isOpenGLThread()) { + Threading.invokeOnOpenGLThread(eventDispatchThreadAction); + } else { + drawableHelper.invokeGL(pbufferDrawable, context, invokeGLAction, initAction); + } + } + + class InitAction implements Runnable { + public void run() { + floatMode = context.getFloatingPointMode(); + drawableHelper.init(GLPbufferImpl.this); + } + } + private InitAction initAction = new InitAction(); + + class DisplayAction implements Runnable { + public void run() { + drawableHelper.display(GLPbufferImpl.this); + } + } + private DisplayAction displayAction = new DisplayAction(); + + class SwapBuffersAction implements Runnable { + // FIXME: currently a no-op + public void run() { + pbufferDrawable.swapBuffers(); + } + } + private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); + + // Workaround for ATI driver bugs related to multithreading issues + // like simultaneous rendering via Animators to canvases that are + // being resized on the AWT event dispatch thread + class DisplayOnEventDispatchThreadAction implements Runnable { + public void run() { + drawableHelper.invokeGL(pbufferDrawable, context, displayAction, initAction); + } + } + private DisplayOnEventDispatchThreadAction displayOnEventDispatchThreadAction = + new DisplayOnEventDispatchThreadAction(); + class SwapBuffersOnEventDispatchThreadAction implements Runnable { + public void run() { + drawableHelper.invokeGL(pbufferDrawable, context, swapBuffersAction, initAction); + } + } + private SwapBuffersOnEventDispatchThreadAction swapBuffersOnEventDispatchThreadAction = + new SwapBuffersOnEventDispatchThreadAction(); +} diff --git a/src/classes/com/sun/opengl/impl/GLUquadricImpl.java b/src/classes/com/sun/opengl/impl/GLUquadricImpl.java new file mode 100644 index 000000000..b56f33368 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/GLUquadricImpl.java @@ -0,0 +1,1050 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** $Date$ $Revision$ +** $Header$ +*/ + +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +package com.sun.opengl.impl; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; + +/** + * GLUquadricImpl.java + * + * + * Created 22-dec-2003 (originally Quadric.java) + * @author Erik Duijs + * @author Kenneth Russell + */ + +public class GLUquadricImpl implements GLUquadric { + private int drawStyle; + private int orientation; + private boolean textureFlag; + private int normals; + + public GLUquadricImpl() { + drawStyle = GLU.GLU_FILL; + orientation = GLU.GLU_OUTSIDE; + textureFlag = false; + normals = GLU.GLU_SMOOTH; + } + + /** + * specifies the draw style for quadrics. + * + * The legal values are as follows: + * + * GLU.FILL: Quadrics are rendered with polygon primitives. The polygons + * are drawn in a counterclockwise fashion with respect to + * their normals (as defined with glu.quadricOrientation). + * + * GLU.LINE: Quadrics are rendered as a set of lines. + * + * GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges + * separating coplanar faces will not be drawn. + * + * GLU.POINT: Quadrics are rendered as a set of points. + * + * @param drawStyle The drawStyle to set + */ + public void setDrawStyle(int drawStyle) { + this.drawStyle = drawStyle; + } + + /** + * specifies what kind of normals are desired for quadrics. + * The legal values are as follows: + * + * GLU.NONE: No normals are generated. + * + * GLU.FLAT: One normal is generated for every facet of a quadric. + * + * GLU.SMOOTH: One normal is generated for every vertex of a quadric. This + * is the default. + * + * @param normals The normals to set + */ + public void setNormals(int normals) { + this.normals = normals; + } + + /** + * specifies what kind of orientation is desired for. + * The orientation values are as follows: + * + * GLU.OUTSIDE: Quadrics are drawn with normals pointing outward. + * + * GLU.INSIDE: Normals point inward. The default is GLU.OUTSIDE. + * + * Note that the interpretation of outward and inward depends on the quadric + * being drawn. + * + * @param orientation The orientation to set + */ + public void setOrientation(int orientation) { + this.orientation = orientation; + } + + /** + * specifies if texture coordinates should be generated for + * quadrics rendered with qobj. If the value of textureCoords is true, + * then texture coordinates are generated, and if textureCoords is false, + * they are not.. The default is false. + * + * The manner in which texture coordinates are generated depends upon the + * specific quadric rendered. + * + * @param textureFlag The textureFlag to set + */ + public void setTextureFlag(boolean textureFlag) { + this.textureFlag = textureFlag; + } + + /** + * Returns the drawStyle. + * @return int + */ + public int getDrawStyle() { + return drawStyle; + } + + /** + * Returns the normals. + * @return int + */ + public int getNormals() { + return normals; + } + + /** + * Returns the orientation. + * @return int + */ + public int getOrientation() { + return orientation; + } + + /** + * Returns the textureFlag. + * @return boolean + */ + public boolean getTextureFlag() { + return textureFlag; + } + + /** + * draws a cylinder oriented along the z axis. The base of the + * cylinder is placed at z = 0, and the top at z=height. Like a sphere, a + * cylinder is subdivided around the z axis into slices, and along the z axis + * into stacks. + * + * Note that if topRadius is set to zero, then this routine will generate a + * cone. + * + * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then + * any generated normals point away from the z axis. Otherwise, they point + * toward the z axis. + * + * If texturing is turned on (with glu.quadricTexture), then texture + * coordinates are generated so that t ranges linearly from 0.0 at z = 0 to + * 1.0 at z = height, and s ranges from 0.0 at the +y axis, to 0.25 at the +x + * axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the + * +y axis. + * + * @param baseRadius Specifies the radius of the cylinder at z = 0. + * @param topRadius Specifies the radius of the cylinder at z = height. + * @param height Specifies the height of the cylinder. + * @param slices Specifies the number of subdivisions around the z axis. + * @param stacks Specifies the number of subdivisions along the z axis. + */ + public void drawCylinder(GL gl, float baseRadius, float topRadius, float height, int slices, int stacks) { + + float da, r, dr, dz; + float x, y, z, nz, nsign; + int i, j; + + if (orientation == GLU.GLU_INSIDE) { + nsign = -1.0f; + } else { + nsign = 1.0f; + } + + da = 2.0f * PI / slices; + dr = (topRadius - baseRadius) / stacks; + dz = height / stacks; + nz = (baseRadius - topRadius) / height; + // Z component of normal vectors + + if (drawStyle == GLU.GLU_POINT) { + gl.glBegin(GL.GL_POINTS); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(gl, x * nsign, y * nsign, nz * nsign); + + z = 0.0f; + r = baseRadius; + for (j = 0; j <= stacks; j++) { + gl.glVertex3f((x * r), (y * r), z); + z += dz; + r += dr; + } + } + gl.glEnd(); + } else if (drawStyle == GLU.GLU_LINE || drawStyle == GLU.GLU_SILHOUETTE) { + // Draw rings + if (drawStyle == GLU.GLU_LINE) { + z = 0.0f; + r = baseRadius; + for (j = 0; j <= stacks; j++) { + gl.glBegin(GL.GL_LINE_LOOP); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(gl, x * nsign, y * nsign, nz * nsign); + gl.glVertex3f((x * r), (y * r), z); + } + gl.glEnd(); + z += dz; + r += dr; + } + } else { + // draw one ring at each end + if (baseRadius != 0.0) { + gl.glBegin(GL.GL_LINE_LOOP); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(gl, x * nsign, y * nsign, nz * nsign); + gl.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); + } + gl.glEnd(); + gl.glBegin(GL.GL_LINE_LOOP); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(gl, x * nsign, y * nsign, nz * nsign); + gl.glVertex3f((x * topRadius), (y * topRadius), height); + } + gl.glEnd(); + } + } + // draw length lines + gl.glBegin(GL.GL_LINES); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(gl, x * nsign, y * nsign, nz * nsign); + gl.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); + gl.glVertex3f((x * topRadius), (y * topRadius), (height)); + } + gl.glEnd(); + } else if (drawStyle == GLU.GLU_FILL) { + float ds = 1.0f / slices; + float dt = 1.0f / stacks; + float t = 0.0f; + z = 0.0f; + r = baseRadius; + for (j = 0; j < stacks; j++) { + float s = 0.0f; + gl.glBegin(GL.GL_QUAD_STRIP); + for (i = 0; i <= slices; i++) { + if (i == slices) { + x = sin(0.0f); + y = cos(0.0f); + } else { + x = sin((i * da)); + y = cos((i * da)); + } + if (nsign == 1.0f) { + normal3f(gl, (x * nsign), (y * nsign), (nz * nsign)); + TXTR_COORD(gl, s, t); + gl.glVertex3f((x * r), (y * r), z); + normal3f(gl, (x * nsign), (y * nsign), (nz * nsign)); + TXTR_COORD(gl, s, t + dt); + gl.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); + } else { + normal3f(gl, x * nsign, y * nsign, nz * nsign); + TXTR_COORD(gl, s, t); + gl.glVertex3f((x * r), (y * r), z); + normal3f(gl, x * nsign, y * nsign, nz * nsign); + TXTR_COORD(gl, s, t + dt); + gl.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); + } + s += ds; + } // for slices + gl.glEnd(); + r += dr; + t += dt; + z += dz; + } // for stacks + } + } + + /** + * renders a disk on the z = 0 plane. The disk has a radius of + * outerRadius, and contains a concentric circular hole with a radius of + * innerRadius. If innerRadius is 0, then no hole is generated. The disk is + * subdivided around the z axis into slices (like pizza slices), and also + * about the z axis into rings (as specified by slices and loops, + * respectively). + * + * With respect to orientation, the +z side of the disk is considered to be + * "outside" (see glu.quadricOrientation). This means that if the orientation + * is set to GLU.OUTSIDE, then any normals generated point along the +z axis. + * Otherwise, they point along the -z axis. + * + * If texturing is turned on (with glu.quadricTexture), texture coordinates are + * generated linearly such that where r=outerRadius, the value at (r, 0, 0) is + * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at + * (0, -r, 0) it is (0.5, 0). + */ + public void drawDisk(GL gl, float innerRadius, float outerRadius, int slices, int loops) + { + float da, dr; + + /* Normal vectors */ + if (normals != GLU.GLU_NONE) { + if (orientation == GLU.GLU_OUTSIDE) { + gl.glNormal3f(0.0f, 0.0f, +1.0f); + } + else { + gl.glNormal3f(0.0f, 0.0f, -1.0f); + } + } + + da = 2.0f * PI / slices; + dr = (outerRadius - innerRadius) / loops; + + switch (drawStyle) { + case GLU.GLU_FILL: + { + /* texture of a gluDisk is a cut out of the texture unit square + * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] + * (linear mapping) + */ + float dtc = 2.0f * outerRadius; + float sa, ca; + float r1 = innerRadius; + int l; + for (l = 0; l < loops; l++) { + float r2 = r1 + dr; + if (orientation == GLU.GLU_OUTSIDE) { + int s; + gl.glBegin(gl.GL_QUAD_STRIP); + for (s = 0; s <= slices; s++) { + float a; + if (s == slices) + a = 0.0f; + else + a = s * da; + sa = sin(a); + ca = cos(a); + TXTR_COORD(gl, 0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc); + gl.glVertex2f(r2 * sa, r2 * ca); + TXTR_COORD(gl, 0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc); + gl.glVertex2f(r1 * sa, r1 * ca); + } + gl.glEnd(); + } + else { + int s; + gl.glBegin(GL.GL_QUAD_STRIP); + for (s = slices; s >= 0; s--) { + float a; + if (s == slices) + a = 0.0f; + else + a = s * da; + sa = sin(a); + ca = cos(a); + TXTR_COORD(gl, 0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc); + gl.glVertex2f(r2 * sa, r2 * ca); + TXTR_COORD(gl, 0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc); + gl.glVertex2f(r1 * sa, r1 * ca); + } + gl.glEnd(); + } + r1 = r2; + } + break; + } + case GLU.GLU_LINE: + { + int l, s; + /* draw loops */ + for (l = 0; l <= loops; l++) { + float r = innerRadius + l * dr; + gl.glBegin(GL.GL_LINE_LOOP); + for (s = 0; s < slices; s++) { + float a = s * da; + gl.glVertex2f(r * sin(a), r * cos(a)); + } + gl.glEnd(); + } + /* draw spokes */ + for (s = 0; s < slices; s++) { + float a = s * da; + float x = sin(a); + float y = cos(a); + gl.glBegin(GL.GL_LINE_STRIP); + for (l = 0; l <= loops; l++) { + float r = innerRadius + l * dr; + gl.glVertex2f(r * x, r * y); + } + gl.glEnd(); + } + break; + } + case GLU.GLU_POINT: + { + int s; + gl.glBegin(GL.GL_POINTS); + for (s = 0; s < slices; s++) { + float a = s * da; + float x = sin(a); + float y = cos(a); + int l; + for (l = 0; l <= loops; l++) { + float r = innerRadius * l * dr; + gl.glVertex2f(r * x, r * y); + } + } + gl.glEnd(); + break; + } + case GLU.GLU_SILHOUETTE: + { + if (innerRadius != 0.0) { + float a; + gl.glBegin(GL.GL_LINE_LOOP); + for (a = 0.0f; a < 2.0 * PI; a += da) { + float x = innerRadius * sin(a); + float y = innerRadius * cos(a); + gl.glVertex2f(x, y); + } + gl.glEnd(); + } + { + float a; + gl.glBegin(GL.GL_LINE_LOOP); + for (a = 0; a < 2.0f * PI; a += da) { + float x = outerRadius * sin(a); + float y = outerRadius * cos(a); + gl.glVertex2f(x, y); + } + gl.glEnd(); + } + break; + } + default: + return; + } + } + + /** + * renders a partial disk on the z=0 plane. A partial disk is similar to a + * full disk, except that only the subset of the disk from startAngle + * through startAngle + sweepAngle is included (where 0 degrees is along + * the +y axis, 90 degrees along the +x axis, 180 along the -y axis, and + * 270 along the -x axis). + * + * The partial disk has a radius of outerRadius, and contains a concentric + * circular hole with a radius of innerRadius. If innerRadius is zero, then + * no hole is generated. The partial disk is subdivided around the z axis + * into slices (like pizza slices), and also about the z axis into rings + * (as specified by slices and loops, respectively). + * + * With respect to orientation, the +z side of the partial disk is + * considered to be outside (see gluQuadricOrientation). This means that if + * the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point + * along the +z axis. Otherwise, they point along the -z axis. + * + * If texturing is turned on (with gluQuadricTexture), texture coordinates + * are generated linearly such that where r=outerRadius, the value at (r, 0, 0) + * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), + * and at (0, -r, 0) it is (0.5, 0). + */ + public void drawPartialDisk(GL gl, + float innerRadius, + float outerRadius, + int slices, + int loops, + float startAngle, + float sweepAngle) { + int i, j, max; + float[] sinCache = new float[CACHE_SIZE]; + float[] cosCache = new float[CACHE_SIZE]; + float angle; + float x, y; + float sintemp, costemp; + float deltaRadius; + float radiusLow, radiusHigh; + float texLow = 0, texHigh = 0; + float angleOffset; + int slices2; + int finish; + + if (slices >= CACHE_SIZE) + slices = CACHE_SIZE - 1; + if (slices < 2 + || loops < 1 + || outerRadius <= 0.0f + || innerRadius < 0.0f + || innerRadius > outerRadius) { + //gluQuadricError(qobj, GLU.GLU_INVALID_VALUE); + System.err.println("PartialDisk: GLU_INVALID_VALUE"); + return; + } + + if (sweepAngle < -360.0f) + sweepAngle = 360.0f; + if (sweepAngle > 360.0f) + sweepAngle = 360.0f; + if (sweepAngle < 0) { + startAngle += sweepAngle; + sweepAngle = -sweepAngle; + } + + if (sweepAngle == 360.0f) { + slices2 = slices; + } else { + slices2 = slices + 1; + } + + /* Compute length (needed for normal calculations) */ + deltaRadius = outerRadius - innerRadius; + + /* Cache is the vertex locations cache */ + + angleOffset = startAngle / 180.0f * PI; + for (i = 0; i <= slices; i++) { + angle = angleOffset + ((PI * sweepAngle) / 180.0f) * i / slices; + sinCache[i] = sin(angle); + cosCache[i] = cos(angle); + } + + if (sweepAngle == 360.0f) { + sinCache[slices] = sinCache[0]; + cosCache[slices] = cosCache[0]; + } + + switch (normals) { + case GLU.GLU_FLAT : + case GLU.GLU_SMOOTH : + if (orientation == GLU.GLU_OUTSIDE) { + gl.glNormal3f(0.0f, 0.0f, 1.0f); + } else { + gl.glNormal3f(0.0f, 0.0f, -1.0f); + } + break; + default : + case GLU.GLU_NONE : + break; + } + + switch (drawStyle) { + case GLU.GLU_FILL : + if (innerRadius == .0f) { + finish = loops - 1; + /* Triangle strip for inner polygons */ + gl.glBegin(GL.GL_TRIANGLE_FAN); + if (textureFlag) { + gl.glTexCoord2f(0.5f, 0.5f); + } + gl.glVertex3f(0.0f, 0.0f, 0.0f); + radiusLow = outerRadius - deltaRadius * ((float) (loops - 1) / loops); + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + } + + if (orientation == GLU.GLU_OUTSIDE) { + for (i = slices; i >= 0; i--) { + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); + } + } else { + for (i = 0; i <= slices; i++) { + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); + } + } + gl.glEnd(); + } else { + finish = loops; + } + for (j = 0; j < finish; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + radiusHigh = outerRadius - deltaRadius * ((float) (j + 1) / loops); + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + texHigh = radiusHigh / outerRadius / 2; + } + + gl.glBegin(GL.GL_QUAD_STRIP); + for (i = 0; i <= slices; i++) { + if (orientation == GLU.GLU_OUTSIDE) { + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); + + if (textureFlag) { + gl.glTexCoord2f(texHigh * sinCache[i] + 0.5f, + texHigh * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusHigh * sinCache[i], + radiusHigh * cosCache[i], + 0.0f); + } else { + if (textureFlag) { + gl.glTexCoord2f(texHigh * sinCache[i] + 0.5f, + texHigh * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusHigh * sinCache[i], + radiusHigh * cosCache[i], + 0.0f); + + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); + } + } + gl.glEnd(); + } + break; + case GLU.GLU_POINT : + gl.glBegin(GL.GL_POINTS); + for (i = 0; i < slices2; i++) { + sintemp = sinCache[i]; + costemp = cosCache[i]; + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); + } + } + gl.glEnd(); + break; + case GLU.GLU_LINE : + if (innerRadius == outerRadius) { + gl.glBegin(GL.GL_LINE_STRIP); + + for (i = 0; i <= slices; i++) { + if (textureFlag) { + gl.glTexCoord2f(sinCache[i] / 2 + 0.5f, cosCache[i] / 2 + 0.5f); + } + gl.glVertex3f(innerRadius * sinCache[i], innerRadius * cosCache[i], 0.0f); + } + gl.glEnd(); + break; + } + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + } + + gl.glBegin(GL.GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); + } + gl.glEnd(); + } + for (i = 0; i < slices2; i++) { + sintemp = sinCache[i]; + costemp = cosCache[i]; + gl.glBegin(GL.GL_LINE_STRIP); + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + } + + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); + } + gl.glEnd(); + } + break; + case GLU.GLU_SILHOUETTE : + if (sweepAngle < 360.0f) { + for (i = 0; i <= slices; i += slices) { + sintemp = sinCache[i]; + costemp = cosCache[i]; + gl.glBegin(GL.GL_LINE_STRIP); + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); + } + gl.glEnd(); + } + } + for (j = 0; j <= loops; j += loops) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + if (textureFlag) { + texLow = radiusLow / outerRadius / 2; + } + + gl.glBegin(GL.GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + if (textureFlag) { + gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, + texLow * cosCache[i] + 0.5f); + } + gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); + } + gl.glEnd(); + if (innerRadius == outerRadius) + break; + } + break; + default : + break; + } + } + + /** + * draws a sphere of the given radius centered around the origin. + * The sphere is subdivided around the z axis into slices and along the z axis + * into stacks (similar to lines of longitude and latitude). + * + * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then + * any normals generated point away from the center of the sphere. Otherwise, + * they point toward the center of the sphere. + + * If texturing is turned on (with glu.quadricTexture), then texture + * coordinates are generated so that t ranges from 0.0 at z=-radius to 1.0 at + * z=radius (t increases linearly along longitudinal lines), and s ranges from + * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 + * at the -x axis, and back to 1.0 at the +y axis. + */ + public void drawSphere(GL gl, float radius, int slices, int stacks) { + // TODO + + float rho, drho, theta, dtheta; + float x, y, z; + float s, t, ds, dt; + int i, j, imin, imax; + boolean normals; + float nsign; + + normals = (this.normals != GLU.GLU_NONE); + + if (orientation == GLU.GLU_INSIDE) { + nsign = -1.0f; + } else { + nsign = 1.0f; + } + + drho = PI / stacks; + dtheta = 2.0f * PI / slices; + + if (drawStyle == GLU.GLU_FILL) { + if (!textureFlag) { + // draw +Z end as a triangle fan + gl.glBegin(GL.GL_TRIANGLE_FAN); + gl.glNormal3f(0.0f, 0.0f, 1.0f); + gl.glVertex3f(0.0f, 0.0f, nsign * radius); + for (j = 0; j <= slices; j++) { + theta = (j == slices) ? 0.0f : j * dtheta; + x = -sin(theta) * sin(drho); + y = cos(theta) * sin(drho); + z = nsign * cos(drho); + if (normals) { + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + } + gl.glVertex3f(x * radius, y * radius, z * radius); + } + gl.glEnd(); + } + + ds = 1.0f / slices; + dt = 1.0f / stacks; + t = 1.0f; // because loop now runs from 0 + if (textureFlag) { + imin = 0; + imax = stacks; + } else { + imin = 1; + imax = stacks - 1; + } + + // draw intermediate stacks as quad strips + for (i = imin; i < imax; i++) { + rho = i * drho; + gl.glBegin(GL.GL_QUAD_STRIP); + s = 0.0f; + for (j = 0; j <= slices; j++) { + theta = (j == slices) ? 0.0f : j * dtheta; + x = -sin(theta) * sin(rho); + y = cos(theta) * sin(rho); + z = nsign * cos(rho); + if (normals) { + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + } + TXTR_COORD(gl, s, t); + gl.glVertex3f(x * radius, y * radius, z * radius); + x = -sin(theta) * sin(rho + drho); + y = cos(theta) * sin(rho + drho); + z = nsign * cos(rho + drho); + if (normals) { + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + } + TXTR_COORD(gl, s, t - dt); + s += ds; + gl.glVertex3f(x * radius, y * radius, z * radius); + } + gl.glEnd(); + t -= dt; + } + + if (!textureFlag) { + // draw -Z end as a triangle fan + gl.glBegin(GL.GL_TRIANGLE_FAN); + gl.glNormal3f(0.0f, 0.0f, -1.0f); + gl.glVertex3f(0.0f, 0.0f, -radius * nsign); + rho = PI - drho; + s = 1.0f; + for (j = slices; j >= 0; j--) { + theta = (j == slices) ? 0.0f : j * dtheta; + x = -sin(theta) * sin(rho); + y = cos(theta) * sin(rho); + z = nsign * cos(rho); + if (normals) + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + s -= ds; + gl.glVertex3f(x * radius, y * radius, z * radius); + } + gl.glEnd(); + } + } else if ( + drawStyle == GLU.GLU_LINE + || drawStyle == GLU.GLU_SILHOUETTE) { + // draw stack lines + for (i = 1; + i < stacks; + i++) { // stack line at i==stacks-1 was missing here + rho = i * drho; + gl.glBegin(GL.GL_LINE_LOOP); + for (j = 0; j < slices; j++) { + theta = j * dtheta; + x = cos(theta) * sin(rho); + y = sin(theta) * sin(rho); + z = cos(rho); + if (normals) + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + gl.glVertex3f(x * radius, y * radius, z * radius); + } + gl.glEnd(); + } + // draw slice lines + for (j = 0; j < slices; j++) { + theta = j * dtheta; + gl.glBegin(GL.GL_LINE_STRIP); + for (i = 0; i <= stacks; i++) { + rho = i * drho; + x = cos(theta) * sin(rho); + y = sin(theta) * sin(rho); + z = cos(rho); + if (normals) + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + gl.glVertex3f(x * radius, y * radius, z * radius); + } + gl.glEnd(); + } + } else if (drawStyle == GLU.GLU_POINT) { + // top and bottom-most points + gl.glBegin(GL.GL_POINTS); + if (normals) + gl.glNormal3f(0.0f, 0.0f, nsign); + gl.glVertex3f(0.0f, 0.0f, radius); + if (normals) + gl.glNormal3f(0.0f, 0.0f, -nsign); + gl.glVertex3f(0.0f, 0.0f, -radius); + + // loop over stacks + for (i = 1; i < stacks - 1; i++) { + rho = i * drho; + for (j = 0; j < slices; j++) { + theta = j * dtheta; + x = cos(theta) * sin(rho); + y = sin(theta) * sin(rho); + z = cos(rho); + if (normals) + gl.glNormal3f(x * nsign, y * nsign, z * nsign); + gl.glVertex3f(x * radius, y * radius, z * radius); + } + } + gl.glEnd(); + } + } + + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private static final float PI = (float)Math.PI; + private static final int CACHE_SIZE = 240; + + /** + * Call glNormal3f after scaling normal to unit length. + * + * @param x + * @param y + * @param z + */ + private void normal3f(GL gl, float x, float y, float z) { + float mag; + + mag = (float)Math.sqrt(x * x + y * y + z * z); + if (mag > 0.00001F) { + x /= mag; + y /= mag; + z /= mag; + } + gl.glNormal3f(x, y, z); + } + + private void TXTR_COORD(GL gl, float x, float y) { + if (textureFlag) gl.glTexCoord2f(x,y); + } + + private float sin(float r) { + return (float)Math.sin(r); + } + + private float cos(float r) { + return (float)Math.cos(r); + } +} diff --git a/src/classes/com/sun/opengl/impl/InternalBufferUtils.java b/src/classes/com/sun/opengl/impl/InternalBufferUtils.java new file mode 100644 index 000000000..89639c493 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/InternalBufferUtils.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.nio.*; + +/** Utility routines available only to the JOGL implementation. */ + +public class InternalBufferUtils { + /** Allocates a new direct byte buffer at the given address with the + given capacity. This is exposed only because of glMapBufferARB + and its semantics; it is undesirable to allocate a new buffer + every frame because (a) ByteBuffers are finalizable and (b) the + application would typically need to re-slice the buffer every + frame. Instead we cache these ByteBuffer objects up in Java and + look them up in a HashMap by base address and capacity. */ + public static native ByteBuffer newDirectByteBuffer(long address, int capacity); +} diff --git a/src/classes/com/sun/opengl/impl/JAWT_PlatformInfo.java b/src/classes/com/sun/opengl/impl/JAWT_PlatformInfo.java new file mode 100644 index 000000000..ca101eff9 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/JAWT_PlatformInfo.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +/** Marker class for all window system-specific JAWT data structures. */ + +public interface JAWT_PlatformInfo { +} diff --git a/src/classes/com/sun/opengl/impl/Java2D.java b/src/classes/com/sun/opengl/impl/Java2D.java new file mode 100755 index 000000000..7d666e138 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/Java2D.java @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.awt.*; +import java.lang.reflect.*; +import java.security.*; + +import javax.media.opengl.*; + +/** Defines integration with the Java2D OpenGL pipeline. This + integration is only supported in 1.6 and is highly experimental. */ + +public class Java2D { + private static boolean DEBUG = Debug.debug("Java2D"); + private static boolean VERBOSE = Debug.verbose(); + private static boolean isOGLPipelineActive; + private static Method invokeWithOGLContextCurrentMethod; + private static Method isQueueFlusherThreadMethod; + private static Method getOGLViewportMethod; + private static Method getOGLScissorBoxMethod; + private static Method getOGLSurfaceIdentifierMethod; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + if (DEBUG && VERBOSE) { + System.err.println("Checking for Java2D/OpenGL support"); + } + // Figure out whether the default graphics configuration is an + // OpenGL graphics configuration + GraphicsConfiguration cfg = + GraphicsEnvironment.getLocalGraphicsEnvironment(). + getDefaultScreenDevice(). + getDefaultConfiguration(); + String name = cfg.getClass().getName(); + if (DEBUG && VERBOSE) { + System.err.println("Java2D support: default GraphicsConfiguration = " + name); + } + isOGLPipelineActive = (name.startsWith("sun.java2d.opengl")); + + if (isOGLPipelineActive) { + try { + // Try to get methods we need to integrate + Class utils = Class.forName("sun.java2d.opengl.OGLUtilities"); + invokeWithOGLContextCurrentMethod = utils.getDeclaredMethod("invokeWithOGLContextCurrent", + new Class[] { + Graphics.class, + Runnable.class + }); + invokeWithOGLContextCurrentMethod.setAccessible(true); + + isQueueFlusherThreadMethod = utils.getDeclaredMethod("isQueueFlusherThread", + new Class[] {}); + isQueueFlusherThreadMethod.setAccessible(true); + + getOGLViewportMethod = utils.getDeclaredMethod("getOGLViewport", + new Class[] { + Graphics.class, + Integer.TYPE, + Integer.TYPE + }); + getOGLViewportMethod.setAccessible(true); + + getOGLScissorBoxMethod = utils.getDeclaredMethod("getOGLScissorBox", + new Class[] { + Graphics.class + }); + getOGLScissorBoxMethod.setAccessible(true); + + getOGLSurfaceIdentifierMethod = utils.getDeclaredMethod("getOGLSurfaceIdentifier", + new Class[] { + Graphics.class + }); + getOGLSurfaceIdentifierMethod.setAccessible(true); + } catch (Exception e) { + if (DEBUG && VERBOSE) { + e.printStackTrace(); + } + isOGLPipelineActive = false; + } + } + + if (DEBUG) { + System.err.println("JOGL/Java2D integration " + (isOGLPipelineActive ? "enabled" : "disabled")); + } + return null; + } + }); + } + + public static boolean isOGLPipelineActive() { + return isOGLPipelineActive; + } + + public static boolean isQueueFlusherThread() { + if (!isOGLPipelineActive()) { + throw new GLException("Java2D OpenGL pipeline not active (or necessary support not present)"); + } + + try { + return ((Boolean) isQueueFlusherThreadMethod.invoke(null, new Object[] {})).booleanValue(); + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (Exception e) { + throw (InternalError) new InternalError().initCause(e); + } + } + + /** Makes current the OpenGL context associated with the passed + Graphics object and runs the given Runnable on the Queue + Flushing Thread in one atomic action. */ + public static void invokeWithOGLContextCurrent(Graphics g, Runnable r) throws GLException { + if (!isOGLPipelineActive()) { + throw new GLException("Java2D OpenGL pipeline not active (or necessary support not present)"); + } + + try { + GLDrawableFactoryImpl.getFactoryImpl().lockAWTForJava2D(); + try { + invokeWithOGLContextCurrentMethod.invoke(null, new Object[] {g, r}); + } finally { + GLDrawableFactoryImpl.getFactoryImpl().unlockAWTForJava2D(); + } + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (Exception e) { + throw (InternalError) new InternalError().initCause(e); + } + } + + public static Rectangle getOGLViewport(Graphics g, + int componentWidth, + int componentHeight) { + if (!isOGLPipelineActive()) { + throw new GLException("Java2D OpenGL pipeline not active (or necessary support not present)"); + } + + try { + return (Rectangle) getOGLViewportMethod.invoke(null, new Object[] {g, + new Integer(componentWidth), + new Integer(componentHeight)}); + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (Exception e) { + throw (InternalError) new InternalError().initCause(e); + } + } + + public static Rectangle getOGLScissorBox(Graphics g) { + if (!isOGLPipelineActive()) { + throw new GLException("Java2D OpenGL pipeline not active (or necessary support not present)"); + } + + try { + return (Rectangle) getOGLScissorBoxMethod.invoke(null, new Object[] {g}); + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (Exception e) { + throw (InternalError) new InternalError().initCause(e); + } + } + + + public static Object getOGLSurfaceIdentifier(Graphics g) { + if (!isOGLPipelineActive()) { + throw new GLException("Java2D OpenGL pipeline not active (or necessary support not present)"); + } + + try { + return getOGLSurfaceIdentifierMethod.invoke(null, new Object[] {g}); + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (Exception e) { + throw (InternalError) new InternalError().initCause(e); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java new file mode 100644 index 000000000..fa535c7d5 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl; + +import java.awt.Toolkit; +import java.security.*; + +public class NativeLibLoader { + private static volatile boolean doLoading = true; + private static volatile boolean doneLoading = false; + + public static void disableLoading() { + doLoading = false; + } + + public static void enableLoading() { + doLoading = true; + } + + public static synchronized void load() { + if (doLoading && !doneLoading) { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + boolean isOSX = System.getProperty("os.name").equals("Mac OS X"); + if (!isOSX) { + try { + // On X11 systems, toolkit must be loaded before + // trying to resolve JAWT in order for libmawt.so to + // be found properly + Toolkit.getDefaultToolkit(); + System.loadLibrary("jawt"); + } catch (UnsatisfiedLinkError e) { + // Accessibility technologies load JAWT themselves; safe to continue + // as long as JAWT is loaded by any loader + if (e.getMessage().indexOf("already loaded") == -1) { + throw e; + } + } + } + System.loadLibrary("jogl"); + + // Workaround for 4845371. + // Make sure the first reference to the JNI GetDirectBufferAddress is done + // from a privileged context so the VM's internal class lookups will succeed. + JAWT jawt = new JAWT(); + JAWTFactory.JAWT_GetAWT(jawt); + + return null; + } + }); + doneLoading = true; + } + } +} diff --git a/src/classes/com/sun/opengl/impl/Project.java b/src/classes/com/sun/opengl/impl/Project.java new file mode 100755 index 000000000..655434319 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/Project.java @@ -0,0 +1,631 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** $Date$ $Revision$ +** $Header$ +*/ + +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ +package com.sun.opengl.impl; + +import java.nio.*; + +import javax.media.opengl.*; +import com.sun.opengl.utils.*; + +/** + * Project.java + *

+ *

+ * Created 11-jan-2004 + * + * @author Erik Duijs + * @author Kenneth Russell + */ +public class Project { + private static final double[] IDENTITY_MATRIX = + new double[] { + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + private final DoubleBuffer matrix = BufferUtils.newDoubleBuffer(16); + private final double[] finalMatrix = new double[16]; + + private final double[][] tempMatrix = new double[4][4]; + private final double[] in = new double[4]; + private final double[] out = new double[4]; + + private final double[] forward = new double[3]; + private final double[] side = new double[3]; + private final double[] up = new double[3]; + + /** + * Make matrix an identity matrix + */ + private void __gluMakeIdentityd(DoubleBuffer m) { + int oldPos = m.position(); + m.put(IDENTITY_MATRIX); + m.position(oldPos); + } + + private void __gluMakeIdentityd(double[] m) { + for (int i = 0; i < 16; i++) { + m[i] = IDENTITY_MATRIX[i]; + } + } + + /** + * Method __gluMultMatrixVecd + * + * @param matrix + * @param in + * @param out + */ + private void __gluMultMatrixVecd(double[] matrix, int matrix_offset, double[] in, double[] out) { + for (int i = 0; i < 4; i++) { + out[i] = + in[0] * matrix[0*4+i+matrix_offset] + + in[1] * matrix[1*4+i+matrix_offset] + + in[2] * matrix[2*4+i+matrix_offset] + + in[3] * matrix[3*4+i+matrix_offset]; + } + } + + /** + * @param src + * @param inverse + * + * @return + */ + private boolean __gluInvertMatrixd(double[] src, double[] inverse) { + int i, j, k, swap; + double t; + double[][] temp = tempMatrix; + + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + temp[i][j] = src[i*4+j]; + } + } + __gluMakeIdentityd(inverse); + + for (i = 0; i < 4; i++) { + /* + * * Look for largest element in column + */ + swap = i; + for (j = i + 1; j < 4; j++) { + if (Math.abs(temp[j][i]) > Math.abs(temp[i][i])) { + swap = j; + } + } + + if (swap != i) { + /* + * * Swap rows. + */ + for (k = 0; k < 4; k++) { + t = temp[i][k]; + temp[i][k] = temp[swap][k]; + temp[swap][k] = t; + + t = inverse[i*4+k]; + inverse[i*4+k] = inverse[swap*4+k]; + inverse[swap*4+k] = t; + } + } + + if (temp[i][i] == 0) { + /* + * No non-zero pivot. The matrix is singular, which shouldn't + * happen. This means the user gave us a bad matrix. + */ + return false; + } + + t = temp[i][i]; + for (k = 0; k < 4; k++) { + temp[i][k] /= t; + inverse[i*4+k] /= t; + } + for (j = 0; j < 4; j++) { + if (j != i) { + t = temp[j][i]; + for (k = 0; k < 4; k++) { + temp[j][k] -= temp[i][k] * t; + inverse[j*4+k] -= inverse[i*4+k]*t; + } + } + } + } + return true; + } + + /** + * @param a + * @param b + * @param r + */ + private void __gluMultMatricesd(double[] a, int a_offset, double[] b, int b_offset, double[] r) { + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + r[i*4+j] = + a[i*4+0+a_offset]*b[0*4+j+b_offset] + + a[i*4+1+a_offset]*b[1*4+j+b_offset] + + a[i*4+2+a_offset]*b[2*4+j+b_offset] + + a[i*4+3+a_offset]*b[3*4+j+b_offset]; + } + } + } + + /** + * Normalize vector + * + * @param v + */ + private static void normalize(double[] v) { + double r; + + r = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); + if ( r == 0.0 ) + return; + + r = 1.0 / r; + + v[0] *= r; + v[1] *= r; + v[2] *= r; + + return; + } + + /** + * Calculate cross-product + * + * @param v1 + * @param v2 + * @param result + */ + private static void cross(double[] v1, double[] v2, double[] result) { + result[0] = v1[1] * v2[2] - v1[2] * v2[1]; + result[1] = v1[2] * v2[0] - v1[0] * v2[2]; + result[2] = v1[0] * v2[1] - v1[1] * v2[0]; + } + + /** + * Method gluOrtho2D. + * + * @param left + * @param right + * @param bottom + * @param top + */ + public void gluOrtho2D(GL gl, double left, double right, double bottom, double top) { + gl.glOrtho(left, right, bottom, top, -1, 1); + } + + /** + * Method gluPerspective. + * + * @param fovy + * @param aspect + * @param zNear + * @param zFar + */ + public void gluPerspective(GL gl, double fovy, double aspect, double zNear, double zFar) { + double sine, cotangent, deltaZ; + double radians = fovy / 2 * Math.PI / 180; + + deltaZ = zFar - zNear; + sine = Math.sin(radians); + + if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) { + return; + } + + cotangent = Math.cos(radians) / sine; + + __gluMakeIdentityd(matrix); + + matrix.put(0 * 4 + 0, cotangent / aspect); + matrix.put(1 * 4 + 1, cotangent); + matrix.put(2 * 4 + 2, - (zFar + zNear) / deltaZ); + matrix.put(2 * 4 + 3, -1); + matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ); + matrix.put(3 * 4 + 3, 0); + + gl.glMultMatrixd(matrix); + } + + /** + * Method gluLookAt + * + * @param eyex + * @param eyey + * @param eyez + * @param centerx + * @param centery + * @param centerz + * @param upx + * @param upy + * @param upz + */ + public void gluLookAt(GL gl, + double eyex, + double eyey, + double eyez, + double centerx, + double centery, + double centerz, + double upx, + double upy, + double upz) { + double[] forward = this.forward; + double[] side = this.side; + double[] up = this.up; + + forward[0] = centerx - eyex; + forward[1] = centery - eyey; + forward[2] = centerz - eyez; + + up[0] = upx; + up[1] = upy; + up[2] = upz; + + normalize(forward); + + /* Side = forward x up */ + cross(forward, up, side); + normalize(side); + + /* Recompute up as: up = side x forward */ + cross(side, forward, up); + + __gluMakeIdentityd(matrix); + matrix.put(0 * 4 + 0, side[0]); + matrix.put(1 * 4 + 0, side[1]); + matrix.put(2 * 4 + 0, side[2]); + + matrix.put(0 * 4 + 1, up[0]); + matrix.put(1 * 4 + 1, up[1]); + matrix.put(2 * 4 + 1, up[2]); + + matrix.put(0 * 4 + 2, -forward[0]); + matrix.put(1 * 4 + 2, -forward[1]); + matrix.put(2 * 4 + 2, -forward[2]); + + gl.glMultMatrixd(matrix); + gl.glTranslated(-eyex, -eyey, -eyez); + } + + /** + * Method gluProject + * + * @param objx + * @param objy + * @param objz + * @param modelMatrix + * @param projMatrix + * @param viewport + * @param win_pos + * + * @return + */ + public boolean gluProject(double objx, + double objy, + double objz, + double[] modelMatrix, + int modelMatrix_offset, + double[] projMatrix, + int projMatrix_offset, + int[] viewport, + int viewport_offset, + double[] win_pos, + int win_pos_offset ) { + + double[] in = this.in; + double[] out = this.out; + + in[0] = objx; + in[1] = objy; + in[2] = objz; + in[3] = 1.0; + + __gluMultMatrixVecd(modelMatrix, modelMatrix_offset, in, out); + __gluMultMatrixVecd(projMatrix, projMatrix_offset, out, in); + + if (in[3] == 0.0) + return false; + + in[3] = (1.0 / in[3]) * 0.5; + + // Map x, y and z to range 0-1 + in[0] = in[0] * in[3] + 0.5f; + in[1] = in[1] * in[3] + 0.5f; + in[2] = in[2] * in[3] + 0.5f; + + // Map x,y to viewport + win_pos[0+win_pos_offset] = in[0] * viewport[2+viewport_offset] + viewport[0+viewport_offset]; + win_pos[1+win_pos_offset] = in[1] * viewport[3+viewport_offset] + viewport[1+viewport_offset]; + win_pos[2+win_pos_offset] = in[2]; + + return true; + } + + /** + * Method gluUnproject + * + * @param winx + * @param winy + * @param winz + * @param modelMatrix + * @param projMatrix + * @param viewport + * @param obj_pos + * + * @return + */ + public boolean gluUnProject(double winx, + double winy, + double winz, + double[] modelMatrix, + int modelMatrix_offset, + double[] projMatrix, + int projMatrix_offset, + int[] viewport, + int viewport_offset, + double[] obj_pos, + int obj_pos_offset) { + double[] in = this.in; + double[] out = this.out; + + __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, finalMatrix); + + if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) + return false; + + in[0] = winx; + in[1] = winy; + in[2] = winz; + in[3] = 1.0; + + // Map x and y from window coordinates + in[0] = (in[0] - viewport[0+viewport_offset]) / viewport[2+viewport_offset]; + in[1] = (in[1] - viewport[1+viewport_offset]) / viewport[3+viewport_offset]; + + // Map to range -1 to 1 + in[0] = in[0] * 2 - 1; + in[1] = in[1] * 2 - 1; + in[2] = in[2] * 2 - 1; + + __gluMultMatrixVecd(finalMatrix, 0, in, out); + + if (out[3] == 0.0) + return false; + + out[3] = 1.0 / out[3]; + + obj_pos[0+obj_pos_offset] = out[0] * out[3]; + obj_pos[1+obj_pos_offset] = out[1] * out[3]; + obj_pos[2+obj_pos_offset] = out[2] * out[3]; + + return true; + } + + /** + * Method gluUnproject4 + * + * @param winx + * @param winy + * @param winz + * @param clipw + * @param modelMatrix + * @param projMatrix + * @param viewport + * @param near + * @param far + * @param obj_pos + * + * @return + */ + public boolean gluUnProject4(double winx, + double winy, + double winz, + double clipw, + double[] modelMatrix, + int modelMatrix_offset, + double[] projMatrix, + int projMatrix_offset, + int[] viewport, + int viewport_offset, + double near, + double far, + double[] obj_pos, + int obj_pos_offset ) { + double[] in = this.in; + double[] out = this.out; + + __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, finalMatrix); + + if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) + return false; + + in[0] = winx; + in[1] = winy; + in[2] = winz; + in[3] = clipw; + + // Map x and y from window coordinates + in[0] = (in[0] - viewport[0+viewport_offset]) / viewport[2+viewport_offset]; + in[1] = (in[1] - viewport[1+viewport_offset]) / viewport[3+viewport_offset]; + in[2] = (in[2] - near) / (far - near); + + // Map to range -1 to 1 + in[0] = in[0] * 2 - 1; + in[1] = in[1] * 2 - 1; + in[2] = in[2] * 2 - 1; + + __gluMultMatrixVecd(finalMatrix, 0, in, out); + + if (out[3] == 0.0) + return false; + + obj_pos[0+obj_pos_offset] = out[0]; + obj_pos[1+obj_pos_offset] = out[1]; + obj_pos[2+obj_pos_offset] = out[2]; + obj_pos[3+obj_pos_offset] = out[3]; + return true; + } + + /** + * Method gluPickMatrix + * + * @param x + * @param y + * @param deltaX + * @param deltaY + * @param viewport + */ + public void gluPickMatrix(GL gl, + double x, + double y, + double deltaX, + double deltaY, + IntBuffer viewport) { + if (deltaX <= 0 || deltaY <= 0) { + return; + } + + /* Translate and scale the picked region to the entire window */ + gl.glTranslated((viewport.get(2) - 2 * (x - viewport.get(0))) / deltaX, + (viewport.get(3) - 2 * (y - viewport.get(1))) / deltaY, + 0); + gl.glScaled(viewport.get(2) / deltaX, viewport.get(3) / deltaY, 1.0); + } + + /** + * Method gluPickMatrix + * + * @param x + * @param y + * @param deltaX + * @param deltaY + * @param viewport + * @param viewport_offset + */ + public void gluPickMatrix(GL gl, + double x, + double y, + double deltaX, + double deltaY, + int[] viewport, + int viewport_offset) { + if (deltaX <= 0 || deltaY <= 0) { + return; + } + + /* Translate and scale the picked region to the entire window */ + gl.glTranslated((viewport[2+viewport_offset] - 2 * (x - viewport[0+viewport_offset])) / deltaX, + (viewport[3+viewport_offset] - 2 * (y - viewport[1+viewport_offset])) / deltaY, + 0); + gl.glScaled(viewport[2+viewport_offset] / deltaX, viewport[3+viewport_offset] / deltaY, 1.0); + } +} diff --git a/src/classes/com/sun/opengl/impl/Util.java b/src/classes/com/sun/opengl/impl/Util.java new file mode 100644 index 000000000..b4b501659 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/Util.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +package com.sun.opengl.impl; + +import java.nio.IntBuffer; +import javax.media.opengl.*; + +/** + * Util.java + *

+ *

+ * Created 7-jan-2004 + * + * @author Erik Duijs + */ +class Util { + + /** + * temp int[] of one for getting an int from some GL functions + */ + private int[] scratch = new int[1]; + + /** + * Return ceiling of integer division + * + * @param a + * @param b + * + * @return int + */ + protected static int ceil(int a, int b) { + return (a % b == 0 ? a / b : a / b + 1); + } + + /** + * Method compPerPix. + * + * @param format + * + * @return int + */ + protected static int compPerPix(int format) { + /* Determine number of components per pixel */ + switch ( format ) { + case GL.GL_COLOR_INDEX: + case GL.GL_STENCIL_INDEX: + case GL.GL_DEPTH_COMPONENT: + case GL.GL_RED: + case GL.GL_GREEN: + case GL.GL_BLUE: + case GL.GL_ALPHA: + case GL.GL_LUMINANCE: + return 1; + case GL.GL_LUMINANCE_ALPHA: + return 2; + case GL.GL_RGB: + case GL.GL_BGR: + return 3; + case GL.GL_RGBA: + case GL.GL_BGRA: + return 4; + default : + return -1; + } + } + + /** + * Method nearestPower. + *

+ * Compute the nearest power of 2 number. This algorithm is a little strange, but it works quite well. + * + * @param value + * + * @return int + */ + protected static int nearestPower(int value) { + int i; + + i = 1; + + /* Error! */ + if ( value == 0 ) + return -1; + + for ( ; ; ) { + if ( value == 1 ) { + return i; + } else if ( value == 3 ) { + return i << 2; + } + value >>= 1; + i <<= 1; + } + } + + /** + * Method bytesPerPixel. + * + * @param format + * @param type + * + * @return int + */ + protected static int bytesPerPixel(int format, int type) { + int n, m; + + switch ( format ) { + case GL.GL_COLOR_INDEX: + case GL.GL_STENCIL_INDEX: + case GL.GL_DEPTH_COMPONENT: + case GL.GL_RED: + case GL.GL_GREEN: + case GL.GL_BLUE: + case GL.GL_ALPHA: + case GL.GL_LUMINANCE: + n = 1; + break; + case GL.GL_LUMINANCE_ALPHA: + n = 2; + break; + case GL.GL_RGB: + case GL.GL_BGR: + n = 3; + break; + case GL.GL_RGBA: + case GL.GL_BGRA: + n = 4; + break; + default : + n = 0; + } + + switch ( type ) { + case GL.GL_UNSIGNED_BYTE: + m = 1; + break; + case GL.GL_BYTE: + m = 1; + break; + case GL.GL_BITMAP: + m = 1; + break; + case GL.GL_UNSIGNED_SHORT: + m = 2; + break; + case GL.GL_SHORT: + m = 2; + break; + case GL.GL_UNSIGNED_INT: + m = 4; + break; + case GL.GL_INT: + m = 4; + break; + case GL.GL_FLOAT: + m = 4; + break; + default : + m = 0; + } + + return n * m; + } + + /** + * Convenience method for returning an int, rather than getting it out of a buffer yourself. + * + * @param what + * + * @return int + */ + protected int glGetIntegerv(GL gl, int what) { + gl.glGetIntegerv(what, scratch, 0); + return scratch[0]; + } +} diff --git a/src/classes/com/sun/opengl/impl/error/Error.java b/src/classes/com/sun/opengl/impl/error/Error.java new file mode 100644 index 000000000..b19fb4903 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/error/Error.java @@ -0,0 +1,88 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.error; + +import javax.media.opengl.GL; +import javax.media.opengl.glu.GLU; + +/** + * + * @author Administrator + */ +public class Error { + + private static String[] glErrorStrings = { + "invalid enumerant", + "invalid value", + "invalid operation", + "stack overflow", + "stack underflow", + "out of memory" + }; + + private static String[] gluErrorStrings = { + "invalid enumerant", + "invalid value", + "out of memory", + "", + "invalid operation" + }; + + /** Creates a new instance of Error */ + public Error() { + } + + public static String gluErrorString( int errorCode ) { + if( errorCode == 0 ) { + return( "no error" ); + } + if( (errorCode >= GL.GL_INVALID_ENUM) && (errorCode <= GL.GL_OUT_OF_MEMORY) ) { + return( glErrorStrings[ errorCode - GL.GL_INVALID_ENUM ] ); + } + if( errorCode == GL.GL_TABLE_TOO_LARGE ) { + return( "table too large" ); + } + if( (errorCode >= GLU.GLU_INVALID_ENUM) && (errorCode <= GLU.GLU_INVALID_OPERATION) ) { + return( gluErrorStrings[ errorCode - GLU.GLU_INVALID_ENUM ] ); + } + if( (errorCode >= GLU.GLU_NURBS_ERROR1) && (errorCode <= GLU.GLU_NURBS_ERROR37) ) { + return( gluErrorStrings[ errorCode - (GLU.GLU_NURBS_ERROR1 - 1) ] ); + } + if( (errorCode >= GLU.GLU_TESS_ERROR1) && (errorCode <= GLU.GLU_TESS_ERROR8) ) { + return( gluErrorStrings[ errorCode - (GLU.GLU_TESS_ERROR1 - 1) ] ); + } + return( null ); + } +} diff --git a/src/classes/com/sun/opengl/impl/glue/Glue.java b/src/classes/com/sun/opengl/impl/glue/Glue.java new file mode 100644 index 000000000..5938f6e0d --- /dev/null +++ b/src/classes/com/sun/opengl/impl/glue/Glue.java @@ -0,0 +1,104 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.glue; + +/** + * + * @author Administrator + */ +public class Glue { + private static String[] __gluNurbsErrors = { + " ", + "spline order un-supported", + "too few knots", + "valid knot range is empty", + "decreasing knot sequence knot", + "knot multiplicity greater than order of spline", + "gluEndCurve() must follow gluBeginCurve()", + "gluBeginCurve() must precede gluEndCurve()", + "missing or extra geometric data", + "can't draw piecewise linear trimming curves", + "missing or extra domain data", + "missing or extra domain data", + "gluEndTrim() must precede gluEndSurface()", + "gluBeginSurface() must precede gluEndSurface()", + "curve of improper type passed as trim curve", + "gluBeginSurface() must precede gluBeginTrim()", + "gluEndTrim() must follow gluBeginTrim()", + "gluBeginTrim() must follow gluEndTrim()", + "invalid or missing trim curve", + "gluBeginTrim() must precede gluPwlCurve()", + "piecewise linear trimming curve referenced twice", + "piecewise linear trimming curve and nurbs curve mixed", + "improper usage of trim data type", + "nurbs curve referenced twice", + "nurbs curve and piecewise linear trimming curve mixed", + "nurbs surface referenced twice", + "invalid property", + "gluEndSurface() must follow gluBeginSurface()", + "intersecting or misoriented trim curve", + "intersecting trim curves", + "UNUSED", + "inconnected trim curves", + "unknown knot error", + "negative vertex count encountered", + "negative byte-stride encountered", + "unknown type descriptor", + "null control point reference", + "duplicate point on piecewise linear trimming curve" + } ; + + /** Creates a new instance of Glue */ + public Glue() { + } + + public static String __gluNURBSErrorString( int errno ) { + return( __gluNurbsErrors[ errno ] ); + } + + private static String[] __gluTessErrors = { + " ", + "gluTessBeginPolygon() must precede a gluTessEndPolygon", + "gluTessBeginContour() must precede a gluTessEndContour()", + "gluTessEndPolygon() must follow a gluTessBeginPolygon()", + "gluTessEndContour() must follow a gluTessBeginContour()", + "a coordinate is too large", + "need combine callback" + }; + + public static String __gluTessErrorString( int errno ) { + return( __gluTessErrors[ errno ] ); + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXDummyGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXDummyGLContext.java new file mode 100644 index 000000000..fef5584ab --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXDummyGLContext.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +/** This MacOSXGLContext implementation provides interoperability with + the NSOpenGLView Cocoa widget. The MacOSXGLImpl can be + instantiated without a GLContext, in which case it expects that + the end user will handle all OpenGL context management. Dynamic + function lookup is supported in this configuration by having this + object provide the FunctionAvailabilityTable. */ + +public class MacOSXDummyGLContext extends MacOSXGLContext +{ + public MacOSXDummyGLContext() { + super(null, null); + } + + public int getOffscreenContextReadBuffer() { + throw new GLException("Should not call this"); + } + + public boolean offscreenImageNeedsVerticalFlip() { + throw new GLException("Should not call this"); + } + + public boolean canCreatePbufferContext() { + throw new GLException("Should not call this"); + } + + public GLDrawableImpl createPbufferDrawable(GLCapabilities capabilities, + int initialWidth, + int initialHeight) { + throw new GLException("Should not call this"); + } + + public void bindPbufferToTexture() { + throw new GLException("Should not call this"); + } + + public void releasePbufferFromTexture() { + throw new GLException("Should not call this"); + } + + public void resetGLFunctionAvailability() { + super.resetGLFunctionAvailability(); + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java new file mode 100644 index 000000000..e7b06e32e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import java.nio.*; +import java.util.*; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public abstract class MacOSXGLContext extends GLContextImpl +{ + protected MacOSXGLDrawable drawable; + protected long nsContext; // NSOpenGLContext + private CGLExt cglExt; + // Table that holds the addresses of the native C-language entry points for + // CGL extension functions. + private CGLExtProcAddressTable cglExtProcAddressTable; + + public MacOSXGLContext(MacOSXGLDrawable drawable, + GLContext shareWith) + { + super(shareWith); + this.drawable = drawable; + } + + public Object getPlatformGLExtensions() { + return getCGLExt(); + } + + public CGLExt getCGLExt() { + if (cglExt == null) { + cglExt = new CGLExtImpl(this); + } + return cglExt; + } + + public GLDrawable getGLDrawable() { + return drawable; + } + + protected String mapToRealGLFunctionName(String glFunctionName) + { + return glFunctionName; + } + + protected String mapToRealGLExtensionName(String glExtensionName) + { + return glExtensionName; + } + + protected boolean create() { + return create(false, false); + } + + /** + * Creates and initializes an appropriate OpenGl nsContext. Should only be + * called by {@link makeCurrentImpl()}. + */ + protected boolean create(boolean pbuffer, boolean floatingPoint) { + MacOSXGLContext other = (MacOSXGLContext) GLContextShareSet.getShareContext(this); + long share = 0; + if (other != null) { + share = other.getNSContext(); + if (share == 0) { + throw new GLException("GLContextShareSet returned an invalid OpenGL context"); + } + } + int[] viewNotReady = new int[1]; + GLCapabilities capabilities = drawable.getCapabilities(); + nsContext = CGL.createContext(share, + drawable.getView(), + capabilities.getDoubleBuffered() ? 1 : 0, + capabilities.getStereo() ? 1 : 0, + capabilities.getRedBits(), + capabilities.getGreenBits(), + capabilities.getBlueBits(), + capabilities.getAlphaBits(), + capabilities.getDepthBits(), + capabilities.getStencilBits(), + capabilities.getAccumRedBits(), + capabilities.getAccumGreenBits(), + capabilities.getAccumBlueBits(), + capabilities.getAccumAlphaBits(), + capabilities.getSampleBuffers() ? 1 : 0, + capabilities.getNumSamples(), + (pbuffer ? 1 : 0), + (floatingPoint ? 1 : 0), + viewNotReady, 0); + if (nsContext == 0) { + if (viewNotReady[0] == 1) { + if (DEBUG) { + System.err.println("!!! View not ready for " + getClass().getName()); + } + // View not ready at the window system level -- this is OK + return false; + } + throw new GLException("Error creating nsContext"); + } + GLContextShareSet.contextCreated(this); + return true; + } + + protected int makeCurrentImpl() throws GLException { + boolean created = false; + if (nsContext == 0) { + if (!create()) { + return CONTEXT_NOT_CURRENT; + } + if (DEBUG) { + System.err.println("!!! Created GL nsContext for " + getClass().getName()); + } + created = true; + } + + if (!CGL.makeCurrentContext(nsContext, drawable.getView())) { + throw new GLException("Error making nsContext current"); + } + + if (created) { + resetGLFunctionAvailability(); + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } + + protected void releaseImpl() throws GLException { + if (!CGL.clearCurrentContext(nsContext, drawable.getView())) { + throw new GLException("Error freeing OpenGL nsContext"); + } + } + + protected void destroyImpl() throws GLException { + if (nsContext != 0) { + if (!CGL.deleteContext(nsContext, 0)) { + throw new GLException("Unable to delete OpenGL context"); + } + if (DEBUG) { + System.err.println("!!! Destroyed OpenGL context " + nsContext); + } + nsContext = 0; + GLContextShareSet.contextDestroyed(this); + } + } + + public boolean isCreated() { + return (nsContext != 0); + } + + protected void resetGLFunctionAvailability() + { + super.resetGLFunctionAvailability(); + if (DEBUG) { + System.err.println("!!! Initializing CGL extension address table"); + } + resetProcAddressTable(getCGLExtProcAddressTable()); + } + + public CGLExtProcAddressTable getCGLExtProcAddressTable() { + if (cglExtProcAddressTable == null) { + // FIXME: cache ProcAddressTables by capability bits so we can + // share them among contexts with the same capabilities + cglExtProcAddressTable = new CGLExtProcAddressTable(); + } + return cglExtProcAddressTable; + } + + public String getPlatformExtensionsString() + { + return ""; + } + + public void setSwapInterval(int interval) { + if (nsContext == 0) { + throw new GLException("OpenGL context not current"); + } + CGL.setSwapInterval(nsContext, interval); + } + + public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { + // FIXME: apparently the Apple extension doesn't require a custom memory allocator + throw new GLException("Not yet implemented"); + } + + protected boolean isFunctionAvailable(String glFunctionName) + { + return super.isFunctionAvailable(glFunctionName); + } + + public boolean isExtensionAvailable(String glExtensionName) { + if (glExtensionName.equals("GL_ARB_pbuffer") || + glExtensionName.equals("GL_ARB_pixel_format")) { + return true; + } + return super.isExtensionAvailable(glExtensionName); + } + + public int getOffscreenContextPixelDataType() { + throw new GLException("Should not call this"); + } + + public int getOffscreenContextReadBuffer() { + throw new GLException("Should not call this"); + } + + public boolean offscreenImageNeedsVerticalFlip() { + throw new GLException("Should not call this"); + } + + public void bindPbufferToTexture() { + throw new GLException("Should not call this"); + } + + public void releasePbufferFromTexture() { + throw new GLException("Should not call this"); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + protected long getNSContext() { + return nsContext; + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java new file mode 100644 index 000000000..26ea8ec54 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import java.awt.Component; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public abstract class MacOSXGLDrawable extends GLDrawableImpl { + protected static final boolean DEBUG = Debug.debug("MacOSXGLDrawable"); + + protected long nsView; // NSView + protected GLCapabilities capabilities; + protected GLCapabilitiesChooser chooser; + + public MacOSXGLDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + this.capabilities = (GLCapabilities) capabilities.clone(); + this.chooser = chooser; + } + + public void setRealized(boolean val) { + throw new GLException("Should not call this (should only be called for onscreen GLDrawables)"); + } + + public void destroy() { + throw new GLException("Should not call this (should only be called for offscreen GLDrawables)"); + } + + public void swapBuffers() throws GLException { + } + + public GLCapabilities getCapabilities() { + return capabilities; + } + + public long getView() { + return nsView; + } +} \ No newline at end of file diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java new file mode 100644 index 000000000..62b7f3b93 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXGLDrawableFactory extends GLDrawableFactoryImpl { + static { + NativeLibLoader.load(); + } + + public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GraphicsDevice device) { + return null; + } + + public GLDrawable getGLDrawable(Object target, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + if (target == null) { + throw new IllegalArgumentException("Null target"); + } + if (!(target instanceof Component)) { + throw new IllegalArgumentException("GLDrawables not supported for objects of type " + + target.getClass().getName() + " (only Components are supported in this implementation)"); + } + if (capabilities == null) { + capabilities = new GLCapabilities(); + } + if (chooser == null) { + chooser = new DefaultGLCapabilitiesChooser(); + } + return new MacOSXOnscreenGLDrawable((Component) target, capabilities, chooser); + } + + public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + return new MacOSXOffscreenGLDrawable(capabilities); + } + + public boolean canCreateGLPbuffer() { + return true; + } + + public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, + final int initialWidth, + final int initialHeight, + final GLContext shareWith) { + final List returnList = new ArrayList(); + Runnable r = new Runnable() { + public void run() { + MacOSXPbufferGLDrawable pbufferDrawable = new MacOSXPbufferGLDrawable(capabilities, + initialWidth, + initialHeight); + GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith); + returnList.add(pbuffer); + } + }; + maybeDoSingleThreadedWorkaround(r); + return (GLPbuffer) returnList.get(0); + } + + public GLContext createExternalGLContext() { + // FIXME + throw new GLException("Not yet implemented"); + } + + public boolean canCreateExternalGLDrawable() { + return false; + } + + public GLDrawable createExternalGLDrawable() { + // FIXME + throw new GLException("Not yet implemented"); + } + + public long dynamicLookupFunction(String glFuncName) { + return CGL.getProcAddress(glFuncName); + } + + private void maybeDoSingleThreadedWorkaround(Runnable action) { + if (Threading.isSingleThreaded() && + !Threading.isOpenGLThread()) { + Threading.invokeOnOpenGLThread(action); + } else { + action.run(); + } + } + + public void lockAWTForJava2D() { + } + + public void unlockAWTForJava2D() { + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLContext.java new file mode 100644 index 000000000..c1d106da8 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLContext.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import java.awt.image.BufferedImage; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXOffscreenGLContext extends MacOSXPbufferGLContext +{ + public MacOSXOffscreenGLContext(MacOSXPbufferGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + } + + public int getOffscreenContextPixelDataType() { + return GL.GL_UNSIGNED_INT_8_8_8_8_REV; + } + + public int getOffscreenContextReadBuffer() { + return GL.GL_FRONT; + } + + public boolean offscreenImageNeedsVerticalFlip() { + return true; + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLDrawable.java new file mode 100644 index 000000000..f478f43fc --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXOffscreenGLDrawable.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXOffscreenGLDrawable extends MacOSXPbufferGLDrawable { + + public MacOSXOffscreenGLDrawable(GLCapabilities capabilities) { + super(capabilities, 0, 0); + } + + public GLContext createContext(GLContext shareWith) { + return new MacOSXOffscreenGLContext(this, shareWith); + } + + public void setSize(int width, int height) { + destroy(); + initWidth = width; + initHeight = height; + createPbuffer(); + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java new file mode 100644 index 000000000..9e20dd6dd --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import java.util.*; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXOnscreenGLContext extends MacOSXGLContext { + protected MacOSXOnscreenGLDrawable drawable; + + public MacOSXOnscreenGLContext(MacOSXOnscreenGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + protected int makeCurrentImpl() throws GLException { + try { + int lockRes = drawable.lockSurface(); + if (lockRes == MacOSXOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { + return CONTEXT_NOT_CURRENT; + } + if (lockRes == MacOSXOnscreenGLDrawable.LOCK_SURFACE_CHANGED) { + super.destroy(); + } + int ret = super.makeCurrentImpl(); + if ((ret == CONTEXT_CURRENT) || + (ret == CONTEXT_CURRENT_NEW)) { + // Assume the canvas might have been resized or moved and tell the OpenGL + // context to update itself. This used to be done only upon receiving a + // reshape event but that doesn't appear to be sufficient. An experiment + // was also done to add a HierarchyBoundsListener to the GLCanvas and + // do this updating only upon reshape of this component or reshape or movement + // of an ancestor, but this also wasn't sufficient and left garbage on the + // screen in some situations. + CGL.updateContext(nsContext, drawable.getView()); + } else { + // View might not have been ready + drawable.unlockSurface(); + } + return ret; + } catch (RuntimeException e) { + try { + drawable.unlockSurface(); + } catch (Exception e2) { + // do nothing if unlockSurface throws + } + throw(e); + } + } + + protected void releaseImpl() throws GLException { + try { + super.releaseImpl(); + } finally { + drawable.unlockSurface(); + } + } + + public void swapBuffers() throws GLException { + if (!CGL.flushBuffer(nsContext, drawable.getView())) { + throw new GLException("Error swapping buffers"); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLDrawable.java new file mode 100644 index 000000000..e7f6537b9 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLDrawable.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import java.awt.Component; +import java.lang.ref.WeakReference; +import java.security.*; +import java.util.*; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXOnscreenGLDrawable extends MacOSXGLDrawable { + public static final int LOCK_SURFACE_NOT_READY = 1; + public static final int LOCK_SURFACE_CHANGED = 2; + public static final int LOCK_SUCCESS = 3; + + private static JAWT jawt; + protected Component component; + + private List/*>*/ createdContexts = + new ArrayList(); + + // Variables for lockSurface/unlockSurface + private JAWT_DrawingSurface ds; + private JAWT_DrawingSurfaceInfo dsi; + private JAWT_MacOSXDrawingSurfaceInfo macosxdsi; + + // Indicates whether the component (if an onscreen context) has been + // realized. Plausibly, before the component is realized the JAWT + // should return an error or NULL object from some of its + // operations; this appears to be the case on Win32 but is not true + // at least with Sun's current X11 implementation (1.4.x), which + // crashes with no other error reported if the DrawingSurfaceInfo is + // fetched from a locked DrawingSurface during the validation as a + // result of calling show() on the main thread. To work around this + // we prevent any JAWT or OpenGL operations from being done until + // addNotify() is called on the component. + protected boolean realized; + + // Workaround for instance of 4796548 + private boolean firstLock = true; + + public MacOSXOnscreenGLDrawable(Component component, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + super(capabilities, chooser); + this.component = component; + } + + public GLContext createContext(GLContext shareWith) { + MacOSXOnscreenGLContext context = + new MacOSXOnscreenGLContext(this, shareWith); + // NOTE: we need to keep track of the created contexts in order to + // implement swapBuffers() because of how Mac OS X implements its + // OpenGL window interface + synchronized (this) { + List newContexts = new ArrayList(); + newContexts.addAll(createdContexts); + newContexts.add(new WeakReference(context)); + createdContexts = newContexts; + } + return context; + } + + public void setRealized(boolean realized) { + this.realized = realized; + } + + public void setSize(int width, int height) { + component.setSize(width, height); + } + + public int getWidth() { + return component.getWidth(); + } + + public int getHeight() { + return component.getHeight(); + } + + public void swapBuffers() throws GLException { + for (Iterator iter = createdContexts.iterator(); iter.hasNext(); ) { + WeakReference ref = (WeakReference) iter.next(); + MacOSXOnscreenGLContext ctx = (MacOSXOnscreenGLContext) ref.get(); + // FIXME: clear out unreachable contexts + if (ctx != null) { + ctx.swapBuffers(); + } + } + } + + public int lockSurface() throws GLException { + if (!realized) { + return LOCK_SURFACE_NOT_READY; + } + if (nsView != 0) { + throw new GLException("Surface already locked"); + } + ds = getJAWT().GetDrawingSurface(component); + if (ds == null) { + // Widget not yet realized + return LOCK_SURFACE_NOT_READY; + } + int res = ds.Lock(); + if ((res & JAWTFactory.JAWT_LOCK_ERROR) != 0) { + throw new GLException("Unable to lock surface"); + } + // See whether the surface changed and if so destroy the old + // OpenGL context so it will be recreated (NOTE: removeNotify + // should handle this case, but it may be possible that race + // conditions can cause this code to be triggered -- should test + // more) + int ret = LOCK_SUCCESS; + if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { + ret = LOCK_SURFACE_CHANGED; + } + if (firstLock) { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + dsi = ds.GetDrawingSurfaceInfo(); + return null; + } + }); + } else { + dsi = ds.GetDrawingSurfaceInfo(); + } + if (dsi == null) { + // Widget not yet realized + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + return LOCK_SURFACE_NOT_READY; + } + firstLock = false; + macosxdsi = (JAWT_MacOSXDrawingSurfaceInfo) dsi.platformInfo(); + if (macosxdsi == null) { + // Widget not yet realized + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + return LOCK_SURFACE_NOT_READY; + } + nsView = macosxdsi.cocoaViewRef(); + if (nsView == 0) { + // Widget not yet realized + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + macosxdsi = null; + return LOCK_SURFACE_NOT_READY; + } + return ret; + } + + public void unlockSurface() throws GLException { + if (nsView == 0) { + throw new GLException("Surface already unlocked"); + } + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + macosxdsi = null; + nsView = 0; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private JAWT getJAWT() + { + if (jawt == null) + { + JAWT j = new JAWT(); + j.version(JAWTFactory.JAWT_VERSION_1_4); + if (!JAWTFactory.JAWT_GetAWT(j)) + { + throw new RuntimeException("Unable to initialize JAWT"); + } + jawt = j; + } + return jawt; + } +} \ No newline at end of file diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLContext.java new file mode 100644 index 000000000..048a256ea --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLContext.java @@ -0,0 +1,101 @@ +package com.sun.opengl.impl.macosx; + +import java.security.*; +import java.util.*; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXPbufferGLContext extends MacOSXGLContext { + protected MacOSXPbufferGLDrawable drawable; + + // State for render-to-texture and render-to-texture-rectangle support + private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV + private int texture; // actual texture object + + private static boolean isTigerOrLater; + + static { + String osVersion = + (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("os.version"); + } + }); + StringTokenizer tok = new StringTokenizer(osVersion, ". "); + int major = Integer.parseInt(tok.nextToken()); + int minor = Integer.parseInt(tok.nextToken()); + isTigerOrLater = ((major > 10) || (minor > 3)); + } + + public MacOSXPbufferGLContext(MacOSXPbufferGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + public void bindPbufferToTexture() { + GL gl = getGL(); + gl.glBindTexture(textureTarget, texture); + // FIXME: not clear whether this is really necessary, but since + // the API docs seem to imply it is and since it doesn't seem to + // impact performance, leaving it in + CGL.setContextTextureImageToPBuffer(nsContext, drawable.getPbuffer(), GL.GL_FRONT); + } + + public void releasePbufferFromTexture() { + } + + protected int makeCurrentImpl() throws GLException { + if (drawable.getPbuffer() == 0) { + if (DEBUG) { + System.err.println("Pbuffer not instantiated yet for " + this); + } + // pbuffer not instantiated yet + return CONTEXT_NOT_CURRENT; + } + + int res = super.makeCurrentImpl(); + if (res == CONTEXT_CURRENT_NEW) { + // Initialize render-to-texture support if requested + boolean rect = drawable.getCapabilities().getOffscreenRenderToTextureRectangle(); + GL gl = getGL(); + if (rect) { + if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) { + System.err.println("MacOSXPbufferGLContext: WARNING: GL_EXT_texture_rectangle extension not " + + "supported; skipping requested render_to_texture_rectangle support for pbuffer"); + rect = false; + } + } + textureTarget = (rect ? GL.GL_TEXTURE_RECTANGLE_EXT : GL.GL_TEXTURE_2D); + int[] tmp = new int[1]; + gl.glGenTextures(1, tmp, 0); + texture = tmp[0]; + gl.glBindTexture(textureTarget, texture); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); + gl.glCopyTexImage2D(textureTarget, 0, GL.GL_RGB, 0, 0, drawable.getWidth(), drawable.getHeight(), 0); + } + return res; + } + + public int getFloatingPointMode() { + return GLPbuffer.APPLE_FLOAT; + } + + protected boolean create() { + GLCapabilities capabilities = drawable.getCapabilities(); + if (capabilities.getOffscreenFloatingPointBuffers() && + !isTigerOrLater) { + throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later"); + } + if (!super.create(true, capabilities.getOffscreenFloatingPointBuffers())) { + return false; + } + // Must now associate the pbuffer with our newly-created context + CGL.setContextPBuffer(nsContext, drawable.getPbuffer()); + return true; + } +} diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLDrawable.java new file mode 100644 index 000000000..038b1d759 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXPbufferGLDrawable.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.macosx; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class MacOSXPbufferGLDrawable extends MacOSXGLDrawable { + private static final boolean DEBUG = Debug.debug("MacOSXPbufferGLContext"); + + protected int initWidth; + protected int initHeight; + + protected long pBuffer; + + protected int width; + protected int height; + + // State for render-to-texture and render-to-texture-rectangle support + private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV + private int texture; // actual texture object + + public MacOSXPbufferGLDrawable(GLCapabilities capabilities, int initialWidth, int initialHeight) { + super(capabilities, null); + this.initWidth = initialWidth; + this.initHeight = initialHeight; + + createPbuffer(); + } + + public GLContext createContext(GLContext shareWith) { + return new MacOSXPbufferGLContext(this, shareWith); + } + + public void destroy() { + if (this.pBuffer != 0) { + CGL.destroyPBuffer(0, pBuffer); + this.pBuffer = 0; + + if (DEBUG) { + System.err.println("Destroyed pbuffer " + width + " x " + height); + } + } + } + + public void setSize(int width, int height) { + // FIXME + throw new GLException("Not yet implemented"); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public GLCapabilities getCapabilities() { + return capabilities; + } + + public long getPbuffer() { + return pBuffer; + } + + public void swapBuffers() throws GLException { + // FIXME: do we need to do anything if the pbuffer is double-buffered? + } + + protected void createPbuffer() { + int renderTarget; + if (capabilities.getOffscreenRenderToTextureRectangle()) { + width = initWidth; + height = initHeight; + renderTarget = GL.GL_TEXTURE_RECTANGLE_EXT; + } else { + width = getNextPowerOf2(initWidth); + height = getNextPowerOf2(initHeight); + renderTarget = GL.GL_TEXTURE_2D; + } + + int internalFormat = GL.GL_RGBA; + if (capabilities.getOffscreenFloatingPointBuffers()) { + // FIXME: want to check availability of GL_APPLE_float_pixels + // extension, but need valid OpenGL context in order to do so -- + // in worst case would need to create dummy window / GLCanvas + // (undesirable) -- could maybe also do this with pbuffers + /* + if (!gl.isExtensionAvailable("GL_APPLE_float_pixels")) { + throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available"); + } + */ + switch (capabilities.getRedBits()) { + case 16: internalFormat = GL.GL_RGBA_FLOAT16_APPLE; break; + case 32: internalFormat = GL.GL_RGBA_FLOAT32_APPLE; break; + default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)"); + } + } + + pBuffer = CGL.createPBuffer(renderTarget, internalFormat, width, height); + if (pBuffer == 0) { + throw new GLException("pbuffer creation error: CGL.createPBuffer() failed"); + } + + if (DEBUG) { + System.err.println("Created pbuffer 0x" + toHexString(pBuffer) + ", " + width + " x " + height + " for " + this); + } + } + + private int getNextPowerOf2(int number) { + if (((number-1) & number) == 0) { + //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0 + return number; + } + int power = 0; + while (number > 0) { + number = number>>1; + power++; + } + return (1<= 1 ); + + newwidth = widthPowerOf2; + levels = Mipmap.computeLog( newwidth ); + + levels += userLevel; + + Mipmap.retrieveStoreModes( gl, psm ); + try { + newImage = ByteBuffer.allocateDirect( Mipmap.image_size( width, 1, format, + GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ).asShortBuffer(); + } catch( OutOfMemoryError ome ) { + return( GLU.GLU_OUT_OF_MEMORY ); + } + newImage_width = width; + + Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); + cmpts = Mipmap.elements_per_group( format, type ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); + + // if swap_bytes was set, swapping occurred in fill_image + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); + + for( level = userLevel; level <= levels; level++ ) { + if( newImage_width == newwidth ) { + // user newimage for this level + if( baseLevel <= level && level <= maxLevel ) { + gl.glTexImage1D( target, level, internalFormat, newImage_width, 0, format, + GL.GL_UNSIGNED_SHORT, newImage ); + } + } else { + if( otherImage == null ) { + memreq = Mipmap.image_size( newwidth, 1, format, GL.GL_UNSIGNED_SHORT ); + try { + otherImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ).asShortBuffer(); + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + } + ScaleInternal.scale_internal( cmpts, newImage_width, 1, newImage, newwidth, 1, otherImage ); + // swap newImage and otherImage + imageTemp = otherImage; + otherImage = newImage; + newImage = imageTemp; + + newImage_width = newwidth; + if( baseLevel <= level && level <= maxLevel ) { + gl.glTexImage1D( target, level, internalFormat, newImage_width, 0, + format, GL.GL_UNSIGNED_SHORT, newImage ); + } + } + if( newwidth > 1 ) { + newwidth /= 2; + } + } + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + + return( 0 ); + } + + public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, + int width, int height, int format, int type, ByteBuffer data ) { + int newwidth[] = new int[1]; + int newheight[] = new int[1]; + int level, levels; + ShortBuffer newImage = null; + int newImage_width; + int newImage_height; + ShortBuffer otherImage = null; + ShortBuffer tempImage = null; + int memreq; + int maxsize; + int cmpts; + PixelStorageModes psm = new PixelStorageModes(); + + Mipmap.retrieveStoreModes( gl, psm ); + + Mipmap.closestFit( gl, target, width, height, internalFormat, format, type, newwidth, newheight ); + + levels = Mipmap.computeLog( newwidth[0] ); + level = Mipmap.computeLog( newheight[0] ); + if( level > levels ) { + levels = level; + } + + try { + newImage = ByteBuffer.allocateDirect( Mipmap.image_size( width, height, + format, GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ).asShortBuffer(); + } catch( OutOfMemoryError ome ) { + return( GLU.GLU_OUT_OF_MEMORY ); + } + newImage_width = width; + newImage_height = height; + + Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); + + cmpts = Mipmap.elements_per_group( format, type ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); + + // if swap_bytes is set, swapping occurred in fill_image + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); + + for( level = 0; level < levels; level++ ) { + if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { + gl.glTexImage2D( target, level, internalFormat, newImage_width, + newImage_height, 0, format, GL.GL_UNSIGNED_SHORT, newImage ); + } else { + if( otherImage == null ) { + memreq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_SHORT ); + try { + otherImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ).asShortBuffer(); + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + } + ScaleInternal.scale_internal( cmpts, newImage_width, newImage_height, + newImage, newwidth[0], newheight[0], otherImage ); + // swap newImage and otherImage + tempImage = otherImage; + otherImage = newImage; + newImage = tempImage; + + newImage_width = newwidth[0]; + newImage_height = newheight[0]; + gl.glTexImage2D( target, level, internalFormat, newImage_width, newImage_height, + 0, format, GL.GL_UNSIGNED_SHORT, newImage ); + } + if( newheight[0] > 1 ) { + newwidth[0] /= 2; + } + if( newheight[0] > 1 ) { + newheight[0] /= 2; + } + } + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + + return( 0 ); + } + + public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, + int width, int height, int widthPowerOf2, int heightPowerOf2, + int format, int type, int userLevel, int baseLevel, int maxLevel, + ByteBuffer data ) { // PointerWrapper data + int newwidth; + int newheight; + int level, levels; + int usersImage; + ByteBuffer srcImage = null; + ByteBuffer dstImage = null; + ByteBuffer tempImage = null; + int newImage_width; + int newImage_height; + short[] SWAP_IMAGE = null; + int memreq; + int maxsize; + int cmpts; + + boolean myswap_bytes; + int groups_per_line, element_size, group_size; + int rowsize, padding; + PixelStorageModes psm = new PixelStorageModes(); + + assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); + assert( width >= 1 && height >= 1 ); + + if( type == GL.GL_BITMAP ) { + return( bitmapBuild2DMipmaps( gl, target, internalFormat, width, height, format, type, data ) ); + } + + newwidth = widthPowerOf2; + newheight = heightPowerOf2; + levels = Mipmap.computeLog( newwidth ); + level = Mipmap.computeLog( newheight ); + if( level > levels ) { + levels = level; + } + + levels += userLevel; + + Mipmap.retrieveStoreModes( gl, psm ); + myswap_bytes = psm.getUnpackSwapBytes(); + cmpts = Mipmap.elements_per_group( format, type ); + if( psm.getUnpackRowLength() > 0 ) { + groups_per_line = psm.getUnpackRowLength(); + } else { + groups_per_line = width; + } + + element_size = Mipmap.bytes_per_element( type ); + group_size = element_size * cmpts; + if( element_size == 1 ) { + myswap_bytes = false; + } + + rowsize = groups_per_line * group_size; + padding = ( rowsize % psm.getUnpackAlignment() ); + if( padding != 0 ) { + rowsize += psm.getUnpackAlignment() - padding; + } + + data.position( psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size ); + data.mark(); + + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); + + level = userLevel; + + // already power of two square + if( width == newwidth && height == newheight ) { + // use usersImage for level userLevel + if( baseLevel <= level && level <= maxLevel ) { + gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data ); + } + if( levels == 0 ) { /* we're done. clean up and return */ + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( 0 ); + } + int nextWidth = newwidth / 2; + int nextHeight = newheight / 2; + + // clamp to 1 + if( nextWidth < 1 ) { + nextWidth = 1; + } + if( nextHeight < 1 ) { + nextHeight = 1; + } + memreq = Mipmap.image_size( nextWidth, nextHeight, format, type ); + + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + if( dstImage != null ) { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + HalveImage.halveImage_ubyte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); + break; + case( GL.GL_BYTE ): + HalveImage.halveImage_byte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); + break; + case( GL.GL_UNSIGNED_SHORT ): + HalveImage.halveImage_ushort( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_SHORT ): + HalveImage.halveImage_short( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT ): + HalveImage.halveImage_uint( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_INT ): + HalveImage.halveImage_int( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_FLOAT ): + HalveImage.halveImage_float( cmpts, width, height, data, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); + HalveImage.halveImagePackedPixel( 3, new Extract332(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); + HalveImage.halveImagePackedPixel( 3, new Extract233rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + HalveImage.halveImagePackedPixel( 3, new Extract565(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + HalveImage.halveImagePackedPixel( 3, new Extract565rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + HalveImage.halveImagePackedPixel( 4, new Extract4444(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + HalveImage.halveImagePackedPixel( 4, new Extract5551(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + HalveImage.halveImagePackedPixel( 4, new Extract8888(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + HalveImage.halveImagePackedPixel( 4, new Extract1010102(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); + break; + default: + assert( false ); + break; + } + } + newwidth = width / 2; + newheight = height / 2; + // clamp to 1 + if( newwidth < 1 ) { + newwidth = 1; + } + if( newheight < 1 ) { + newheight = 1; + } + + myswap_bytes = false; + rowsize = newwidth * group_size; + memreq = Mipmap.image_size( newwidth, newheight, format, type ); + // swap srcImage and dstImage + tempImage = srcImage; + srcImage = dstImage; + dstImage = tempImage; + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + // level userLevel+1 is in srcImage; level userLevel already saved + level = userLevel + 1; + } else { // user's image is not nice powerof2 size square + memreq = Mipmap.image_size( newwidth, newheight, format, type ); + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + data.reset(); + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, + newwidth, newheight, dstImage, element_size, rowsize, group_size ); + break; + case( GL.GL_BYTE ): + ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, group_size ); + break; + case( GL.GL_UNSIGNED_SHORT ): + ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, + newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_SHORT ): + ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, + newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT ): + ScaleInternal.scale_internal_uint( cmpts, width, height, data, newwidth, + newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_INT ): + ScaleInternal.scale_internal_int( cmpts, width, height, data, newwidth, + newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_FLOAT ): + ScaleInternal.scale_internal_float( cmpts, width, height, data, newwidth, + newheight, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + ScaleInternal.scaleInternalPackedPixel( 3, new Extract332(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + ScaleInternal.scaleInternalPackedPixel( 3, new Extract233rev(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + ScaleInternal.scaleInternalPackedPixel( 3, new Extract565(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + ScaleInternal.scaleInternalPackedPixel( 3, new Extract565rev(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444rev(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract5551(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract1555rev(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888rev(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract1010102(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + ScaleInternal.scaleInternalPackedPixel( 4, new Extract2101010rev(), width, height, data, newwidth, + newheight, dstImage, element_size, rowsize, myswap_bytes ); + break; + default: + assert( false ); + break; + } + myswap_bytes = false; + rowsize = newwidth * group_size; + // swap dstImage and srcImage + tempImage = srcImage; + srcImage = dstImage; + dstImage = tempImage; + + if( levels != 0 ) { // use as little memory as possible + int nextWidth = newwidth / 2; + int nextHeight = newheight / 2; + if( nextWidth < 1 ) { + nextWidth = 1; + } + if( nextHeight < 1 ) { + nextHeight = 1; + } + + memreq = Mipmap.image_size( nextWidth, nextHeight, format, type ); + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + } + // level userLevel is in srcImage; nothing saved yet + level = userLevel; + } + + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); + if( baseLevel <= level && level <= maxLevel ) { + srcImage.rewind(); + if (DEBUG) { + System.err.println("GL Error(" + level + "): " + gl.glGetError() ); + } + gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); + if (DEBUG) { + System.err.println("GL Error(" + level + "): " + gl.glGetError() ); + if (VERBOSE) { + try { + File file = new File( "glu2DMipmapJ" + level + ".bin" ); + FileOutputStream fos = new FileOutputStream( file ); + srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) ); + fos.getChannel().write( srcImage ); + srcImage.clear(); + fos.close(); + } catch( IOException e ) { + System.err.println("IOException"); + System.err.println(e.getMessage()); + } + } + } + } + + level++; // update current level for the loop + for( ; level <= levels; level++ ) { + srcImage.rewind(); + dstImage.rewind(); + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + HalveImage.halveImage_ubyte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); + break; + case( GL.GL_BYTE ): + HalveImage.halveImage_byte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); + break; + case( GL.GL_UNSIGNED_SHORT ): + HalveImage.halveImage_ushort( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_SHORT ): + HalveImage.halveImage_short( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT ): + HalveImage.halveImage_uint( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_INT ): + HalveImage.halveImage_int( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_FLOAT ): + HalveImage.halveImage_float( cmpts, newwidth, newheight, srcImage, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); + HalveImage.halveImagePackedPixel( 3, new Extract332(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); + HalveImage.halveImagePackedPixel( 3, new Extract233rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + HalveImage.halveImagePackedPixel( 3, new Extract565(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + HalveImage.halveImagePackedPixel( 3, new Extract565rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + HalveImage.halveImagePackedPixel( 4, new Extract4444(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + HalveImage.halveImagePackedPixel( 4, new Extract5551(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + HalveImage.halveImagePackedPixel( 4, new Extract8888(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + HalveImage.halveImagePackedPixel( 4, new Extract1010102(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); + break; + default: + assert( false ); + break; + } + + // swap dstImage and srcImage + tempImage = srcImage; + srcImage = dstImage; + dstImage = tempImage; + + if( newwidth > 1 ) { + newwidth /= 2; + rowsize /= 2; + } + if( newheight > 1 ) { + newheight /= 2; + } + // compute amount to pad per row if any + int rowPad = rowsize % psm.getUnpackAlignment(); + + // should row be padded + if( rowPad == 0 ) { + // call teximage with srcImage untouched since its not padded + if( baseLevel <= level && level <= maxLevel ) { + srcImage.rewind(); + gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); + if (DEBUG) { + System.err.println("GL Error(" + level + "): " + gl.glGetError() ); + if (VERBOSE) { + try { + File file = new File( "glu2DMipmapJ" + level + ".bin" ); + FileOutputStream fos = new FileOutputStream( file ); + srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) ); + fos.getChannel().write( srcImage ); + srcImage.clear(); + } catch( IOException e ) { + System.err.println("IOException"); + System.err.println(e.getMessage()); + } + } + } + } + } else { + // compute length of new row in bytes, including padding + int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; + int ii, jj; + int dstTrav; + int srcTrav; + + // allocate new image for mipmap of size newRowLength x newheight + ByteBuffer newMipmapImage = null; + try { + newMipmapImage = ByteBuffer.allocateDirect( newRowLength * newheight ); + } catch( OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + srcImage.rewind(); + // copy image from srcImage into newMipmapImage by rows + for( ii = 0; ii < newheight; ii++ ) { + for( jj = 0; jj < rowsize; jj++ ) { + newMipmapImage.put( srcImage.get() ); + } + if( jj < rowsize - 1 ) { + newMipmapImage.position( newMipmapImage.position() + rowPad ); + } + } + + // and use this new image for mipmapping instead + if( baseLevel <= level && level <= maxLevel ) { + newMipmapImage.rewind(); + gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, newMipmapImage ); + if (DEBUG) { + System.err.println("GL Error: " + gl.glGetError() ); + if (VERBOSE) { + try { + File file = new File( "glu2DMipmapJ" + level + ".bin" ); + FileOutputStream fos = new FileOutputStream( file ); + srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) ); + fos.getChannel().write( newMipmapImage ); + srcImage.clear(); + } catch( IOException e ) { + System.err.println("IOException"); + System.err.println(e.getMessage()); + } + } + } + } + } + } + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + + return( 0 ); + } + + public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, + int components, int width, int height, int format, int type, ByteBuffer data ) { + int[] newwidth = new int[1]; + int[] newheight = new int[1]; + int level, levels; + ByteBuffer newImage; + int newImage_width; + int newImage_height; + ByteBuffer otherImage; + ByteBuffer imageTemp; + int memreq; + int maxsize; + int cmpts; + + Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, + newheight ); + + levels = Mipmap.computeLog( newwidth[0] ); + level = Mipmap.computeLog( newheight[0] ); + if( level > levels ) { + levels = level; + } + + cmpts = Mipmap.elements_per_group( format, type ); + + otherImage = null; + // No need to copy the user data if its packed correctly. + // Make sure that later routines don't change that data. + + if( psm.getUnpackSkipRows() == 0 && psm.getUnpackSkipPixels() == 0 ) { + newImage = data; + newImage_width = width; + newImage_height = height; + } else { + int rowsize; + int group_per_line; + int elements_per_line; + int start; + int iter; + int iter2; + int i, j; + + try { + newImage = ByteBuffer.allocateDirect( Mipmap.image_size( + width, height, format, GL.GL_UNSIGNED_BYTE ) ).order( ByteOrder.nativeOrder() ); + } catch( OutOfMemoryError err ) { + return( GLU.GLU_OUT_OF_MEMORY ); + } + newImage_width = width; + newImage_height = height; + + // Abbreviated version of fill_image for the restricted case. + if( psm.getUnpackRowLength() > 0 ) { + group_per_line = psm.getUnpackRowLength(); + } else { + group_per_line = width; + } + rowsize = group_per_line * cmpts; + elements_per_line = width * cmpts; + start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * cmpts; + + for( i = 0; i < height; i++ ) { + iter = start; + data.position( iter ); + for( j = 0; j < elements_per_line; j++ ) { + newImage.put( data.get() ); + } + start += rowsize; + } + } + + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); + + for( level = 0; level <= levels; level++ ) { + if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { + // use newImage for this level + gl.glTexImage2D( target, level, components, newImage_width, newImage_height, + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); + } else { + if( otherImage == null ) { + memreq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_BYTE ); + try { + otherImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); + } catch( OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + return( GLU.GLU_OUT_OF_MEMORY ); + } + } + // swap newImage and otherImage + imageTemp = otherImage; + otherImage = newImage; + newImage = imageTemp; + + newImage_width = newwidth[0]; + newImage_height = newheight[0]; + gl.glTexImage2D( target, level, components, newImage_width, newImage_height, + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); + } + if( newwidth[0] > 1 ) { + newwidth[0] /= 2; + } + if( newheight[0] > 1 ) { + newheight[0] /= 2; + } + } + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + + return( 0 ); + } + + public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, + int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, + int depthPowerOf2, int format, int type, int userLevel, int baseLevel, + int maxLevel, ByteBuffer data ) { + int newWidth; + int newHeight; + int newDepth; + int level, levels; + ByteBuffer usersImage; + ByteBuffer srcImage, dstImage, tempImage; + int newImageWidth; + int newImageHeight; + int newImageDepth; + int memReq; + int maxSize; + int cmpts; + + boolean myswapBytes; + int groupsPerLine, elementSize, groupSize; + int rowsPerImage, imageSize; + int rowSize, padding; + PixelStorageModes psm = new PixelStorageModes(); + + assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); + assert( width >= 1 && height >= 1 && depth >= 1 ); + assert( type != GL.GL_BITMAP ); + + srcImage = dstImage = null; + + newWidth = widthPowerOf2; + newHeight = heightPowerOf2; + newDepth = depthPowerOf2; + levels = Mipmap.computeLog( newWidth ); + level = Mipmap.computeLog( newHeight ); + if( level > levels ) { + levels = level; + } + level = Mipmap.computeLog( newDepth ); + if( level > levels ) { + levels = level; + } + + levels += userLevel; + + Mipmap.retrieveStoreModes3D( gl, psm ); + myswapBytes = psm.getUnpackSwapBytes(); + cmpts = Mipmap.elements_per_group( format, type ); + if( psm.getUnpackRowLength() > 0 ) { + groupsPerLine = psm.getUnpackRowLength(); + } else { + groupsPerLine = width; + } + + elementSize = Mipmap.bytes_per_element( type ); + groupSize = elementSize * cmpts; + if( elementSize == 1 ) { + myswapBytes = false; + } + + // 3dstuff + if( psm.getUnpackImageHeight() > 0 ) { + rowsPerImage = psm.getUnpackImageHeight(); + } else { + rowsPerImage = height; + } + + rowSize = groupsPerLine * groupSize; + padding = ( rowSize % psm.getUnpackAlignment() ); + if( padding != 0 ) { + rowSize += psm.getUnpackAlignment() - padding; + } + + imageSize = rowsPerImage * rowSize; + + usersImage = data.duplicate(); + usersImage.position( psm.getUnpackSkipRows() * rowSize + + psm.getUnpackSkipPixels() * groupSize + + psm.getUnpackSkipImages() * imageSize ); + usersImage.mark(); + + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, 0 ); + + level = userLevel; + + if( width == newWidth && height == newHeight && depth == newDepth ) { + // use usersImage for level userlevel + if( baseLevel <= level && level <= maxLevel ) { + gl.glTexImage3D( target, level, internalFormat, width, height, depth, + 0, format, type, usersImage ); + } + if( levels == 0 ) { /* we're done. clean up and return */ + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + return( 0 ); + } + int nextWidth = newWidth / 2; + int nextHeight = newHeight / 2; + int nextDepth = newDepth / 2; + + // clamp to one + if( nextWidth < 1 ) { + nextWidth = 1; + } + if( nextHeight < 1 ) { + nextHeight = 1; + } + if( nextDepth < 1 ) { + nextDepth = 1; + } + memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + + if( dstImage != null ) { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, + usersImage, dstImage, elementSize, + groupSize, rowSize, imageSize, myswapBytes ); + } else { + HalveImage.halveImage_ubyte( cmpts, width, height, usersImage, + dstImage, elementSize, rowSize, groupSize ); + } + break; + case( GL.GL_BYTE ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_byte( cmpts, width, height, usersImage, + dstImage, elementSize, rowSize, groupSize ); + } + break; + case( GL.GL_UNSIGNED_SHORT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_ushort( cmpts, width, height, usersImage, + dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_SHORT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_short( cmpts, width, height, usersImage, + dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_UNSIGNED_INT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_uint( cmpts, width, height, usersImage, + dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_INT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_int( cmpts, width, height, usersImage, + dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_FLOAT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_float( cmpts, width, height, usersImage, + dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); + HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); + HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + default: + assert( false ); + break; + } + } + newWidth = width / 2; + newHeight = height / 2; + newDepth = depth / 2; + // clamp to 1 + if( newWidth < 1 ) { + newWidth = 1; + } + if( newHeight < 1 ) { + newHeight = 1; + } + if( newDepth < 1 ) { + newDepth = 1; + } + + myswapBytes = false; + rowSize = newWidth * groupSize; + imageSize = rowSize * newHeight; + memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); + // swap srcImage and dstImage + tempImage = srcImage; + srcImage = dstImage; + dstImage = tempImage; + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + + // level userLevel + 1 is in srcImage; level userLevel already saved + level = userLevel + 1; + } else { + memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + + ScaleInternal.gluScaleImage3D( gl, format, width, height, depth, type, + usersImage, newWidth, newHeight, newDepth, type, dstImage ); + + myswapBytes = false; + rowSize = newWidth * groupSize; + imageSize = rowSize * newHeight; + // swap dstImage and srcImage + tempImage = srcImage; + srcImage = dstImage; + dstImage = tempImage; + + if( levels != 0 ) { + int nextWidth = newWidth / 2; + int nextHeight = newHeight / 2; + int nextDepth = newDepth / 2; + if( nextWidth < 1 ) { + nextWidth = 1; + } + if( nextHeight < 1 ) { + nextHeight = 1; + } + if( nextDepth < 1 ) { + nextDepth = 1; + } + memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); + try { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); + break; + default: + return( GLU.GLU_INVALID_ENUM ); + } + } catch( OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + return( GLU.GLU_OUT_OF_MEMORY ); + } + } + // level userLevel is in srcImage; nothing saved yet + level = userLevel; + } + + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); + if( baseLevel <= level && level <= maxLevel ) { + usersImage.reset(); + gl.glTexImage3D( target, level, internalFormat, width, height, depth, + 0, format, type, usersImage ); + } + level++; + for( ; level <= levels; level++ ) { + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_ubyte( cmpts, width, height, usersImage, + dstImage, elementSize, rowSize, groupSize ); + } + break; + case( GL.GL_BYTE ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_byte( cmpts, width, height, usersImage, + dstImage, elementSize, rowSize, groupSize ); + } + break; + case( GL.GL_UNSIGNED_SHORT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_ushort( cmpts, width, height, usersImage, + dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_SHORT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_short( cmpts, width, height, usersImage, + dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_UNSIGNED_INT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_uint( cmpts, width, height, usersImage, + dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_INT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_int( cmpts, width, height, usersImage, + dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_FLOAT ): + if( depth > 1 ) { + HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, + usersImage, dstImage, elementSize, groupSize, rowSize, + imageSize, myswapBytes ); + } else { + HalveImage.halveImage_float( cmpts, width, height, usersImage, + dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); + } + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, + dstImage, elementSize, rowSize, imageSize, myswapBytes ); + break; + default: + assert( false ); + break; + } + + tempImage = srcImage; + srcImage = dstImage; + dstImage = tempImage; + + if( newWidth > 1 ) { + newWidth /= 2; + rowSize /= 2; + } + if( newHeight > 1 ) { + newHeight /= 2; + imageSize = rowSize * newHeight; + } + if( newDepth > 1 ) { + newDepth /= 2; + } + if( baseLevel <= level && level <= maxLevel ) { + usersImage.reset(); + gl.glTexImage3D( target, level, internalFormat, width, height, depth, + 0, format, type, usersImage ); + } + } + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + return( 0 ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract.java b/src/classes/com/sun/opengl/impl/mipmap/Extract.java new file mode 100644 index 000000000..12362011e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract.java @@ -0,0 +1,46 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public interface Extract { + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ); + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ); +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract1010102.java b/src/classes/com/sun/opengl/impl/mipmap/Extract1010102.java new file mode 100644 index 000000000..d337e5dcd --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract1010102.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class Extract1010102 implements Extract { + + /** Creates a new instance of Extract1010102 */ + public Extract1010102() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + long uint = 0; + + if( isSwap ) { + uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); + } else { + uint = 0x00000000FFFFFFFF & packedPixel.getInt(); + } + + // 11111111,11000000,00000000,00000000 == 0xFFC00000 + // 00000000,00111111,11110000,00000000 == 0x003F0000 + // 00000000,00000000,00001111,11111100 == 0x00000FFC + // 00000000,00000000,00000000,00000011 == 0x00000003 + + extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; + extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; + extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; + extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) << 22) & 0xFFC00000 ); + uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 12) & 0x003FF000 ); + uint |= (((int)((shoveComponents[2] * 1023) + 0.5f) << 2) & 0x00000FFC ); + uint |= (((int)((shoveComponents[3] * 3) + 0.5f) ) & 0x00000003 ); + packedPixel.asIntBuffer().put( index, (int)uint ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract1555rev.java b/src/classes/com/sun/opengl/impl/mipmap/Extract1555rev.java new file mode 100644 index 000000000..1b8372e84 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract1555rev.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class Extract1555rev implements Extract { + + /** Creates a new instance of Extract1555rev */ + public Extract1555rev() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + int ushort = 0; + + if( isSwap ) { + ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); + } else { + ushort = 0x0000FFFF & packedPixel.getShort(); + } + + // 00000000,00011111 == 0x001F + // 00000011,11100000 == 0x03E0 + // 01111100,00000000 == 0x7C00 + // 10000000,00000000 == 0x8000 + + extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; + extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; + extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 00000000,00011111 == 0x001F + // 00000011,11100000 == 0x03E0 + // 01111100,00000000 == 0x7C00 + // 10000000,00000000 == 0x8000 + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F ); + ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 5) & 0x000003E0 ); + ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) << 10) & 0x00007C00 ); + ushort |= (((int)((shoveComponents[3]) + 0.5f) << 15) & 0x00008000 ); + packedPixel.asShortBuffer().put( index, (short)ushort ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract2101010rev.java b/src/classes/com/sun/opengl/impl/mipmap/Extract2101010rev.java new file mode 100644 index 000000000..adef3d58d --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract2101010rev.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class Extract2101010rev implements Extract { + + /** Creates a new instance of Extract2101010 */ + public Extract2101010rev() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + long uint = 0; + + if( isSwap ) { + uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); + } else { + uint = 0x00000000FFFFFFFF & packedPixel.getInt(); + } + + // 11111111,11000000,00000000,00000000 == 0xFFC00000 + // 00000000,00111111,11110000,00000000 == 0x003F0000 + // 00000000,00000000,00001111,11111100 == 0x00000FFC + // 00000000,00000000,00000000,00000011 == 0x00000003 + + extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; + extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; + extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; + extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) ) & 0x000003FF ); + uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 10) & 0x000FFC00 ); + uint |= (((int)((shoveComponents[2] * 1023) + 0.5f) << 20) & 0x3FF00000 ); + uint |= (((int)((shoveComponents[3] * 3) + 0.5f) << 30) & 0xC0000000 ); + packedPixel.asIntBuffer().put( index, (int)uint ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract233rev.java b/src/classes/com/sun/opengl/impl/mipmap/Extract233rev.java new file mode 100644 index 000000000..1a3e9582e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract233rev.java @@ -0,0 +1,75 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class Extract233rev implements Extract { + + /** Creates a new instance of Extract223rev */ + public Extract233rev() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + // 11100000 == 0xe0 + // 00011100 == 0x1c + // 00000011 == 0x03 + byte ubyte = packedPixel.get(); + extractComponents[0] = (float)((ubyte & 0x07) ) / 7.0f; + extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; + extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11100000 == 0xE0 + // 00011100 == 0x1C + // 00000011 == 0x03 + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + + // due to limited precision, need to round before shoving + byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) ) & 0x07 ); + b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 3 ) & 0x38 ); + b |= (byte)( ( (int)( ( shoveComponents[2] * 3 ) + 0.5f ) << 6 ) & 0xC0 ); + packedPixel.position( index ); + packedPixel.put( b ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract332.java b/src/classes/com/sun/opengl/impl/mipmap/Extract332.java new file mode 100644 index 000000000..e925a2cc1 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract332.java @@ -0,0 +1,74 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class Extract332 implements Extract { + + /** Creates a new instance of Extract332 */ + public Extract332() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + // 11100000 == 0xe0 + // 00011100 == 0x1c + // 00000011 == 0x03 + byte ubyte = packedPixel.get(); + extractComponents[0] = (float)((ubyte & 0xe0) >> 5) / 7.0f; + extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; + extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11100000 == 0xE0 + // 00011100 == 0x1C + // 00000011 == 0x03 + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + + // due to limited precision, need to round before shoving + byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) << 5 ) & 0xE0 ); + b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 2 ) & 0x1C ); + b |= (byte)( ( (int)( ( shoveComponents[2] * 3 ) + 0.5f ) ) & 0x03 ); + packedPixel.put( index, b ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract4444.java b/src/classes/com/sun/opengl/impl/mipmap/Extract4444.java new file mode 100644 index 000000000..b4dff1b72 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract4444.java @@ -0,0 +1,86 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract4444 implements Extract { + + /** Creates a new instance of Extract4444 */ + public Extract4444() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + int ushort = 0; + + if( isSwap ) { + ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); + } else { + ushort = 0x0000FFFF & packedPixel.getShort(); + } + + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + + // due to limited precision, need to round before shoving + int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) << 12) & 0x0000F000 ); + ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 8) & 0x00000F00 ); + ushort |= (((int)((shoveComponents[2] * 15) + 0.5f) << 4) & 0x000000F0 ); + ushort |= (((int)((shoveComponents[3] * 15) + 0.5f) ) & 0x0000000F ); + packedPixel.asShortBuffer().put( index, (short)ushort ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract4444rev.java b/src/classes/com/sun/opengl/impl/mipmap/Extract4444rev.java new file mode 100644 index 000000000..761d057b1 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract4444rev.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract4444rev implements Extract { + + /** Creates a new instance of Extract4444rev */ + public Extract4444rev() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + int ushort = 0; + + if( isSwap ) { + ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); + } else { + ushort = 0x0000FFFF & packedPixel.getShort(); + } + + // 00000000,00001111 == 0x000F + // 00000000,11110000 == 0x00F0 + // 00001111,00000000 == 0x0F00 + // 11110000,00000000 == 0xF000 + + extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) ) & 0x0000000F ); + ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 4) & 0x000000F0 ); + ushort |= (((int)((shoveComponents[2] * 15) + 0.5f) << 8) & 0x00000F00 ); + ushort |= (((int)((shoveComponents[3] * 15) + 0.5f) << 12) & 0x0000F000 ); + packedPixel.asShortBuffer().put( index, (short)ushort ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract5551.java b/src/classes/com/sun/opengl/impl/mipmap/Extract5551.java new file mode 100644 index 000000000..047298152 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract5551.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract5551 implements Extract { + + /** Creates a new instance of Extract5551 */ + public Extract5551() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + int ushort = 0; + + if( isSwap ) { + ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); + } else { + ushort = 0x0000FFFF & packedPixel.getShort(); + } + + // 11111000,00000000 == 0xF800 + // 00000111,11000000 == 0x07C0 + // 00000000,00111110 == 0x003E + // 00000000,00000001 == 0x0001 + + extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; + extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; + extractComponents[3] = (float)( ( ushort & 0xF000 ) ); + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 ); + ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 6) & 0x000007C0 ); + ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) << 1) & 0x0000003E ); + ushort |= (((int)((shoveComponents[3]) + 0.5f)) & 0x00000001 ); + packedPixel.asShortBuffer().put( index, (short)ushort ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract565.java b/src/classes/com/sun/opengl/impl/mipmap/Extract565.java new file mode 100644 index 000000000..c9346ecf6 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract565.java @@ -0,0 +1,82 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract565 implements Extract { + + /** Creates a new instance of Extract565 */ + public Extract565() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + int ushort = 0; + + if( isSwap ) { + ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); + } else { + ushort = 0x0000FFFF & packedPixel.getShort(); + } + + // 11111000,00000000 == 0xF800 + // 00000111,11100000 == 0x07E0 + // 00000000,00111111 == 0x001F + + extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11111000,00000000 == 0xF800 + // 00000111,11100000 == 0x07E0 + // 00000000,00111111 == 0x001F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + + // due to limited precision, need to round before shoving + int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 ); + ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 ); + ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) ) & 0x0000001F ); + packedPixel.asShortBuffer().put( index, (short)ushort ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract565rev.java b/src/classes/com/sun/opengl/impl/mipmap/Extract565rev.java new file mode 100644 index 000000000..9b0596b3f --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract565rev.java @@ -0,0 +1,82 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract565rev implements Extract { + + /** Creates a new instance of Extract565rev */ + public Extract565rev() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + int ushort = 0; + + if( isSwap ) { + ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); + } else { + ushort = 0x0000FFFF & packedPixel.getShort(); + } + + // 00000000,00011111 == 0x001F + // 00000111,11100000 == 0x07E0 + // 11111000,00000000 == 0xF800 + + extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 00000000,00111111 == 0x001F + // 00000111,11100000 == 0x07E0 + // 11111000,00000000 == 0xF800 + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + + // due to limited precision, need to round before shoving + int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F ); + ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 ); + ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) << 11) & 0x0000F800 ); + packedPixel.asShortBuffer().put( index, (short)ushort ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract8888.java b/src/classes/com/sun/opengl/impl/mipmap/Extract8888.java new file mode 100644 index 000000000..9f57bc39e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract8888.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract8888 implements Extract { + + /** Creates a new instance of Extract8888 */ + public Extract8888() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + long uint = 0; + + if( isSwap ) { + uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); + } else { + uint = 0x00000000FFFFFFFF & packedPixel.getInt(); + } + + // 11111000,00000000 == 0xF800 + // 00000111,11000000 == 0x07C0 + // 00000000,00111110 == 0x003E + // 00000000,00000001 == 0x0001 + + extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + long uint = (((int)((shoveComponents[0] * 255) + 0.5f) << 24) & 0xFF000000 ); + uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 16) & 0x00FF0000 ); + uint |= (((int)((shoveComponents[2] * 255) + 0.5f) << 8) & 0x0000FF00 ); + uint |= (((int)((shoveComponents[3] * 255) + 0.5f) ) & 0x000000FF ); + packedPixel.asIntBuffer().put( index, (int)uint ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Extract8888rev.java b/src/classes/com/sun/opengl/impl/mipmap/Extract8888rev.java new file mode 100644 index 000000000..2c0d90595 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Extract8888rev.java @@ -0,0 +1,87 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Extract8888rev implements Extract { + + /** Creates a new instance of Extract8888rev */ + public Extract8888rev() { + } + + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + long uint = 0; + + if( isSwap ) { + uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); + } else { + uint = 0x00000000FFFFFFFF & packedPixel.getInt(); + } + + // 11111000,00000000 == 0xF800 + // 00000111,11000000 == 0x07C0 + // 00000000,00111110 == 0x003E + // 00000000,00000001 == 0x0001 + + extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + } + + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + // 11110000,00000000 == 0xF000 + // 00001111,00000000 == 0x0F00 + // 00000000,11110000 == 0x00F0 + // 00000000,00001111 == 0x000F + + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); + assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); + assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); + assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); + + // due to limited precision, need to round before shoving + long uint = (((int)((shoveComponents[0] * 255) + 0.5f) ) & 0x000000FF ); + uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 8) & 0x0000FF00 ); + uint |= (((int)((shoveComponents[2] * 255) + 0.5f) << 16) & 0x00FF0000 ); + uint |= (((int)((shoveComponents[3] * 255) + 0.5f) << 24) & 0xFF000000 ); + packedPixel.asIntBuffer().put( index, (int)uint ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractFloat.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractFloat.java new file mode 100644 index 000000000..b1a0ee51e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractFloat.java @@ -0,0 +1,64 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class ExtractFloat implements ExtractPrimitive { + + /** Creates a new instance of ExtractFloat */ + public ExtractFloat() { + } + + public double extract( boolean isSwap, ByteBuffer data ) { + float f = 0; + if( isSwap ) { + f = Mipmap.GLU_SWAP_4_BYTES( data.getInt() ); + } else { + f = data.getInt(); + } + assert( f <= 1.0f ); + return( f ); + } + + public void shove( double value, int index, ByteBuffer data ) { + assert(0.0 <= value && value < 1.0); + data.asFloatBuffer().put( index, (float)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractPrimitive.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractPrimitive.java new file mode 100644 index 000000000..4ba6f734e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractPrimitive.java @@ -0,0 +1,46 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public interface ExtractPrimitive { + public double extract( boolean isSwap, ByteBuffer pointer ); + public void shove( double value, int index, ByteBuffer pointer ); +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractSByte.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractSByte.java new file mode 100644 index 000000000..f8cfcda2e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractSByte.java @@ -0,0 +1,59 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class ExtractSByte implements ExtractPrimitive { + + /** Creates a new instance of ExtractUByte */ + public ExtractSByte() { + } + + public double extract( boolean isSwap, ByteBuffer sbyte ) { + byte b = sbyte.get(); + assert( b <= 127 ); + return( b ); + } + + public void shove( double value, int index, ByteBuffer data ) { + data.position( index ); + data.put( (byte)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractSInt.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractSInt.java new file mode 100644 index 000000000..5411f6daa --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractSInt.java @@ -0,0 +1,66 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class ExtractSInt implements ExtractPrimitive { + + /** Creates a new instance of ExtractSInt */ + public ExtractSInt() { + } + + public double extract( boolean isSwap, ByteBuffer uint ) { + int i = 0; + if( isSwap ) { + i = Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); + } else { + i = uint.getInt(); + } + assert( i <= 0x7FFFFFFF ); + return( i ); + } + + public void shove( double value, int index, ByteBuffer data ) { + assert(0.0 <= value && value < Integer.MAX_VALUE); + IntBuffer ib = data.asIntBuffer(); + ib.position( index ); + ib.put( (int)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractSShort.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractSShort.java new file mode 100644 index 000000000..ace44b3a9 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractSShort.java @@ -0,0 +1,66 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class ExtractSShort implements ExtractPrimitive { + + /** Creates a new instance of ExtractSShort */ + public ExtractSShort() { + } + + public double extract( boolean isSwap, ByteBuffer ushort ) { + short s = 0; + if( isSwap ) { + s = Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); + } else { + s = ushort.getShort(); + } + assert( s <= 32767 ); + return( s ); + } + + public void shove( double value, int index, ByteBuffer data ) { + assert(0.0 <= value && value < 32768.0); + ShortBuffer sb = data.asShortBuffer(); + sb.position( index ); + sb.put( (short)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractUByte.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractUByte.java new file mode 100644 index 000000000..0c0a2716b --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractUByte.java @@ -0,0 +1,60 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.ByteBuffer; + +/** + * + * @author Administrator + */ +public class ExtractUByte implements ExtractPrimitive { + + /** Creates a new instance of ExtractUByte */ + public ExtractUByte() { + } + + public double extract( boolean isSwap, ByteBuffer ubyte ) { + int i = 0x000000FF & ubyte.get(); + assert( i <= 255 ); + return( i ); + } + + public void shove( double value, int index, ByteBuffer data ) { + assert(0.0 <= value && value < 256.0); + data.position( index ); + data.put( (byte)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractUInt.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractUInt.java new file mode 100644 index 000000000..feba26f96 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractUInt.java @@ -0,0 +1,66 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class ExtractUInt implements ExtractPrimitive { + + /** Creates a new instance of ExtractUInt */ + public ExtractUInt() { + } + + public double extract( boolean isSwap, ByteBuffer uint ) { + long i = 0; + if( isSwap ) { + i = 0xFFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); + } else { + i = 0xFFFFFFFF & uint.getInt(); + } + assert( i <= 0xFFFFFFFF ); + return( i ); + } + + public void shove( double value, int index, ByteBuffer data ) { + assert(0.0 <= value && value < 0xFFFFFFFF); + IntBuffer ib = data.asIntBuffer(); + ib.position( index ); + ib.put( (int)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ExtractUShort.java b/src/classes/com/sun/opengl/impl/mipmap/ExtractUShort.java new file mode 100644 index 000000000..1b7abd70b --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ExtractUShort.java @@ -0,0 +1,66 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class ExtractUShort implements ExtractPrimitive { + + /** Creates a new instance of ExtracUShort */ + public ExtractUShort() { + } + + public double extract( boolean isSwap, ByteBuffer ushort ) { + int i = 0; + if( isSwap ) { + i = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); + } else { + i = 0x0000FFFF & ushort.getShort(); + } + assert( i <= 65535 ); + return( i ); + } + + public void shove( double value, int index, ByteBuffer data ) { + assert(0.0 <= value && value < 65536.0); + ShortBuffer sb = data.asShortBuffer(); + sb.position( index ); + sb.put( (short)value ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/HalveImage.java b/src/classes/com/sun/opengl/impl/mipmap/HalveImage.java new file mode 100644 index 000000000..5e854c13d --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/HalveImage.java @@ -0,0 +1,1523 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import javax.media.opengl.GL; +import java.nio.*; + +/** + * + * @author Administrator + */ +public class HalveImage { + + private static final int BOX2 = 2; + private static final int BOX4 = 4; + private static final int BOX8 = 8; + + public static void halveImage( int components, int width, int height, + ShortBuffer datain, ShortBuffer dataout ) { + int i, j, k; + int newwidth, newheight; + int delta; + int t = 0; + short temp = 0; + + newwidth = width / 2; + newheight = height /2; + delta = width * components; + + // Piece of cake + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = datain.get(); + datain.position( t + components ); + temp += datain.get(); + datain.position( t + delta ); + temp += datain.get(); + datain.position( t + delta + components ); + temp +=datain.get(); + temp += 2; + temp /= 4; + dataout.put( temp ); + t++; + } + t += components; + } + t += delta; + } + } + + public static void halveImage_ubyte( int components, int width, int height, + ByteBuffer datain, ByteBuffer dataout, + int element_size, int ysize, int group_size ) { + int i, j, k; + int newwidth, newheight; + int s; + int t; + + // Handle case where there is only 1 column/row + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); // can't be 1x1 + halve1Dimage_ubyte( components, width, height, datain, dataout, element_size, ysize, group_size ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + s = 0; + t = 0; + + int temp = 0; + // piece of cake + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = ( 0x000000FF & datain.get() ); + datain.position( t + group_size ); + temp += ( 0x000000FF & datain.get() ); + datain.position( t + ysize ); + temp += ( 0x000000FF & datain.get() ); + datain.position( t + ysize + group_size ); + temp += ( 0x000000FF & datain.get() ) + 2; + dataout.put( (byte)(temp / 4) ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + + public static void halve1Dimage_ubyte( int components, int width, int height, + ByteBuffer datain, ByteBuffer dataout, + int element_size, int ysize, int group_size ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int dest = 0; + int jj; + int temp = 0; + + assert( width == 1 || height == 1 ); // Must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // widthxheight can't be 1x1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + datain.position( src ); + temp = ( 0x000000FF & datain.get() ); + datain.position( src + group_size ); + temp += ( 0x000000FF & datain.get() ); + temp /= 2; + dataout.put( (byte)temp ); + /* + dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + + (0x000000FF & datain.setIndexInBytes( src + group_size ).getByte())) / 2 ) ); + */ + src += element_size; + //dataout.plusPlus(); + dest++; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assertion only + } else if( width == 1 ) { // 1 column + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + datain.position( src ); + temp = ( 0x000000FF & datain.get() ); + datain.position( src + ysize ); + temp += ( 0x000000FF & datain.get() ); + temp /= 2; + dataout.put( (byte)temp ); + /* + dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + + (0x000000FF & datain.setIndexInBytes(src + ysize).getByte()) ) / 2 ) ); + */ + src += element_size; + //dataout.plusPlus(); + dest++; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + } + assert( src == ysize * height ); + assert( dest == components * element_size * halfWidth * halfHeight ); + } + + public static void halveImage_byte( int components, int width, int height, + ByteBuffer datain, ByteBuffer dataout, int element_size, + int ysize, int group_size ) { + int i, j, k; + int newwidth, newheight; + int s = 0; + int t = 0; + byte temp = (byte)0; + + // handle case where there is only 1 column + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); + halve1Dimage_byte( components, width, height, datain, dataout, element_size, + ysize, group_size ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = datain.get(); + datain.position( t + group_size ); + temp += datain.get(); + datain.position( t + ysize ); + temp += datain.get(); + datain.position( t + ysize + group_size ); + temp += datain.get(); + temp += 2; + temp /= 4; + dataout.put( temp ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + + public static void halve1Dimage_byte( int components, int width, int height, + ByteBuffer datain, ByteBuffer dataout, + int element_size, int ysize, int group_size ) { + int halfWidth = width / 2; + int halfHeight = width / 2; + int src = 0; + int dest = 0; + int jj; + byte temp = (byte)0; + + assert( width == 1 || height == 1 ); // must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // widthxheight can't be 1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + datain.position( src ); + temp = datain.get(); + datain.position( src + group_size ); + temp += datain.get(); + temp /= 2; + dataout.put( temp ); + src += element_size; + dest++; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assert only + } else if( width == 1 ) { // 1 column + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); // widthxheight can't be 1 + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + datain.position( src ); + temp = datain.get(); + datain.position( src + ysize ); + temp += datain.get(); + temp /= 2; + src += element_size; + dest++; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + assert( src == ysize * height ); + } + assert( dest == components * element_size * halfWidth * halfHeight ); + } + + public static void halveImage_ushort( int components, int width, int height, + ByteBuffer datain, ShortBuffer dataout, int element_size, + int ysize, int group_size, boolean myswap_bytes ) { + int i, j, k, l; + int newwidth, newheight; + int s = 0; + int t = 0; + int temp = 0; + // handle case where there is only 1 column/row + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); // can't be 1x1 + halve1Dimage_ushort( components, width, height, datain, dataout, element_size, + ysize, group_size, myswap_bytes ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + + // Piece of cake + if( !myswap_bytes ) { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = ( 0x0000FFFF & datain.getShort() ); + datain.position( t + group_size ); + temp += ( 0x0000FFFF & datain.getShort() ); + datain.position( t + ysize ); + temp += ( 0x0000FFFF & datain.getShort() ); + datain.position( t + ysize + group_size ); + temp += ( 0x0000FFFF & datain.getShort() ); + dataout.put( (short)( ( temp + 2 ) / 4 ) ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } else { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + datain.position( t + group_size ); + temp += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + datain.position( t + ysize ); + temp += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + datain.position( t + ysize + group_size ); + temp += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + dataout.put( (short)( ( temp + 2 ) / 4 ) ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + } + + public static void halve1Dimage_ushort( int components, int width, int height, + ByteBuffer datain, ShortBuffer dataout, int element_size, + int ysize, int group_size, boolean myswap_bytes ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int dest = 0; + int jj; + + assert( width == 1 || height == 1 ); // must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // widthxheight can't be 1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < halfHeight; kk++ ) { + int[] ushort = new int[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + datain.position( src + group_size ); + ushort[1] = (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + } else { + datain.position( src ); + ushort[0] = (0x0000FFFF & datain.getShort() ); + datain.position( src + group_size ); + ushort[1] = (0x0000FFFF & datain.getShort() ); + } + dataout.put( (short)( (ushort[0] + ushort[1]) / 2 ) ); + src += element_size; + dest += 2; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assertion only + } else if( width == 1 ) { // 1 column + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); // widthxheight can't be 1 + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + int[] ushort = new int[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + datain.position( src + ysize ); + ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); + } else { + datain.position( src ); + ushort[0] = ( 0x0000FFFF & datain.getShort() ); + datain.position( src + ysize ); + ushort[1] = ( 0x0000FFFF & datain.getShort() ); + } + dataout.put( (short)((ushort[0] + ushort[1]) / 2) ); + src += element_size; + dest += 2; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + assert( src == ysize * height ); + } + assert( dest == components * element_size * halfWidth * halfHeight ); + } + + public static void halveImage_short( int components, int width, int height, + ByteBuffer datain, ShortBuffer dataout, int element_size, + int ysize, int group_size, boolean myswap_bytes ) { + int i, j, k, l; + int newwidth, newheight; + int s = 0; + int t = 0; + short temp = (short)0; + // handle case where there is only 1 column/row + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); // can't be 1x1 + halve1Dimage_short( components, width, height, datain, dataout, element_size, + ysize, group_size, myswap_bytes ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + + // Piece of cake + if( !myswap_bytes ) { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = datain.getShort(); + datain.position( t + group_size ); + temp += datain.getShort(); + datain.position( t + ysize ); + temp += datain.getShort(); + datain.position( t + ysize + group_size ); + temp += datain.getShort(); + temp += 2; + temp /= 4; + dataout.put( (short)temp ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } else { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + short b; + int buf; + datain.position( t ); + temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + datain.position( t + group_size ); + temp += Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + datain.position( t + ysize ); + temp += Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + datain.position( t + ysize + group_size ); + temp += Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + temp += 2; + temp /= 4; + dataout.put( temp ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + } + + public static void halve1Dimage_short( int components, int width, int height, + ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int dest = 0; + int jj; + + assert( width == 1 || height == 1 ); // must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // can't be 1x1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + short[] sshort = new short[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + datain.position( src + group_size ); + sshort[1] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + } else { + datain.position( src ); + sshort[0] = datain.getShort(); + datain.position( src + group_size ); + sshort[1] = datain.getShort(); + } + dataout.put( (short)(( sshort[0] + sshort[1] ) / 2) ); + src += element_size; + dest += 2; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assertion only + } else if( width == 1 ) { + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + short[] sshort = new short[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + datain.position( src + ysize ); + sshort[1] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + } else { + datain.position( src ); + sshort[0] = datain.getShort(); + datain.position( src + ysize ); + sshort[1] = datain.getShort(); + } + dataout.put( (short)(( sshort[0] + sshort[1] ) / 2) ); + src += element_size; + dest += 2; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + assert( src == ysize * height ); + } + assert( dest == ( components * element_size * halfWidth * halfHeight ) ); + } + + public static void halveImage_uint( int components, int width, int height, + ByteBuffer datain, IntBuffer dataout, int element_size, + int ysize, int group_size, boolean myswap_bytes ) { + int i, j, k, l; + int newwidth, newheight; + int s = 0; + int t = 0; + double temp = 0; + + // handle case where there is only 1 column/row + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); // can't be 1x1 + halve1Dimage_uint( components, width, height, datain, dataout, element_size, + ysize, group_size, myswap_bytes ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + + // Piece of cake + if( !myswap_bytes ) { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = (0x000000007FFFFFFFL & datain.getInt() ); + datain.position( t + group_size ); + temp += (0x000000007FFFFFFFL & datain.getInt() ); + datain.position( t + ysize ); + temp += (0x000000007FFFFFFFL & datain.getInt() ); + datain.position( t + ysize + group_size ); + temp += (0x000000007FFFFFFFL & datain.getInt() ); + dataout.put( (int)( ( temp / 4 ) + 0.5 ) ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } else { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + // need to cast to double to hold large unsigned ints + double buf; + datain.position( t ); + buf = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( t + group_size ); + buf += ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( t + ysize ); + buf += ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( t + ysize + group_size ); + buf += ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + temp /= 4; + temp += 0.5; + dataout.put( (int)temp ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + } + + public static void halve1Dimage_uint( int components, int width, int height, + ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int dest = 0; + int jj; + + assert( width == 1 || height == 1 ); // must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // widthxheight can't be 1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < halfHeight; kk++ ) { + long[] uint = new long[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( src + group_size ); + uint[1] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + } else { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); + datain.position( src + group_size ); + uint[1] = (0x00000000FFFFFFFF & datain.getInt() ); + } + dataout.put( (int)( ( uint[0] + uint[1] ) / 2.0 ) ); + src += element_size; + dest += 4; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assertion only + } else if( width == 1 ) { // 1 column + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); // widthxheight can't be 1 + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + long[] uint = new long[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( src + group_size ); + uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + } else { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); + datain.position( src + ysize ); + uint[1] = ( 0x00000000FFFFFFFF & datain.getInt() ); + } + dataout.put( (int)( ( uint[0] + uint[1] ) / 2.0 ) ); + src += element_size; + dest += 4; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + assert( src == ysize * height ); + } + assert( dest == components * element_size * halfWidth * halfHeight ); + } + + public static void halveImage_int( int components, int width, int height, + ByteBuffer datain, IntBuffer dataout, int element_size, + int ysize, int group_size, boolean myswap_bytes ) { + int i, j, k, l; + int newwidth, newheight; + int s = 0; + int t = 0; + int temp = 0; + + // handle case where there is only 1 column/row + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); // can't be 1x1 + halve1Dimage_int( components, width, height, datain, dataout, element_size, + ysize, group_size, myswap_bytes ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + + // Piece of cake + if( !myswap_bytes ) { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = datain.getInt(); + datain.position( t + group_size ); + temp += datain.getInt(); + datain.position( t + ysize ); + temp += datain.getInt(); + datain.position( t + ysize + group_size ); + temp += datain.getInt(); + temp = (int)( ( temp / 4.0f ) + 0.5f ); + dataout.put( temp ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } else { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + long b; + float buf; + datain.position( t ); + b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + buf = b; + datain.position( t + group_size ); + b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + buf += b; + datain.position( t + ysize ); + b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + buf += b; + datain.position( t + ysize + group_size ); + b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + buf += b; + dataout.put( (int)( ( buf / 4.0f ) + 0.5f ) ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + } + + public static void halve1Dimage_int( int components, int width, int height, + ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int dest = 0; + int jj; + + assert( width == 1 || height == 1 ); // must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // can't be 1x1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + long[] uint = new long[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( src + group_size ); + uint[1] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + } else { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); + datain.position( src + group_size ); + uint[1] = ( 0x00000000FFFFFFFF & datain.getInt() ); + } + dataout.put( (int)( ( (float)uint[0] + (float)uint[1] ) / 2.0f) ); + src += element_size; + dest += 4; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assertion only + } else if( width == 1 ) { + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + long[] uint = new long[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + datain.position( src + ysize ); + uint[1] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); + } else { + datain.position( src ); + uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); + datain.position( src + ysize ); + uint[1] = ( 0x00000000FFFFFFFF & datain.getInt() ); + } + dataout.put( (int)(( (float)uint[0] + (float)uint[1] ) / 2.0f) ); + src += element_size; + dest += 4; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + assert( src == ysize * height ); + } + assert( dest == ( components * element_size * halfWidth * halfHeight ) ); + } + + public static void halveImage_float( int components, int width, int height, + ByteBuffer datain, FloatBuffer dataout, int element_size, + int ysize, int group_size, boolean myswap_bytes ) { + int i, j, k, l; + int newwidth, newheight; + int s = 0; + int t = 0; + float temp = 0.0f; + // handle case where there is only 1 column/row + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); // can't be 1x1 + halve1Dimage_float( components, width, height, datain, dataout, element_size, + ysize, group_size, myswap_bytes ); + return; + } + + newwidth = width / 2; + newheight = height / 2; + + // Piece of cake + if( !myswap_bytes ) { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + datain.position( t ); + temp = datain.getFloat(); + datain.position( t + group_size ); + temp += datain.getFloat(); + datain.position( t + ysize ); + temp += datain.getFloat(); + datain.position( t + ysize + group_size ); + temp /= 4.0f; + dataout.put( temp ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } else { + for( i = 0; i < newheight; i++ ) { + for( j = 0; j < newwidth; j++ ) { + for( k = 0; k < components; k++ ) { + float buf; + datain.position( t ); + buf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + datain.position( t + group_size ); + buf += Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + datain.position( t + ysize ); + buf += Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + datain.position( t + ysize + group_size ); + buf += Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + dataout.put( buf / 4.0f ); + t += element_size; + } + t += group_size; + } + t += ysize; + } + } + } + + public static void halve1Dimage_float( int components, int width, int height, + ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int dest = 0; + int jj; + + assert( width == 1 || height == 1 ); // must be 1D + assert( width != height ); // can't be square + + if( height == 1 ) { // 1 row + assert( width != 1 ); // can't be 1x1 + halfHeight = 1; + + for( jj = 0; jj < halfWidth; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + float[] sfloat = new float[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + datain.position( src + group_size ); + sfloat[1] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + } else { + datain.position( src ); + sfloat[0] = datain.getFloat(); + datain.position( src + group_size ); + sfloat[1] = datain.getFloat(); + } + dataout.put( (sfloat[0] + sfloat[1]) / 2.0f ); + src += element_size; + dest += 4; + } + src += group_size; // skip to next 2 + } + int padBytes = ysize - ( width * group_size ); + src += padBytes; // for assertion only + } else if( width == 1 ) { + int padBytes = ysize - ( width * group_size ); + assert( height != 1 ); + halfWidth = 1; + // one vertical column with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + int kk; + for( kk = 0; kk < components; kk++ ) { + float[] sfloat = new float[BOX2]; + if( myswap_bytes ) { + datain.position( src ); + sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + datain.position( src + ysize ); + sfloat[1] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + } else { + datain.position( src ); + sfloat[0] = datain.getFloat(); + datain.position( src + ysize ); + sfloat[1] = datain.getFloat(); + } + dataout.put( ( sfloat[0] + sfloat[1] ) / 2.0f ); + src += element_size; + dest += 4; + } + src += padBytes; // add pad bytes, if any, to get to end of row + src += ysize; + } + assert( src == ysize * height ); + } + assert( dest == ( components * element_size * halfWidth * halfHeight ) ); + } + + public static void halveImagePackedPixel( int components, Extract extract, int width, + int height, ByteBuffer datain, ByteBuffer dataout, + int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + if( width == 1 || height == 1 ) { + assert( !( width == 1 && height == 1 ) ); + halve1DimagePackedPixel( components, extract, width, height, datain, dataout, + pixelSizeInBytes, rowSizeInBytes, isSwap ); + return; + } + int ii, jj; + + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + int outIndex = 0; + + for( ii = 0; ii < halfHeight; ii++ ) { + for( jj = 0; jj < halfWidth; jj++ ) { + float totals[] = new float[4]; + float extractTotals[][] = new float[BOX4][4]; + int cc; + + datain.position( src ); + extract.extract( isSwap, datain, extractTotals[0] ); + datain.position( src + pixelSizeInBytes ); + extract.extract( isSwap, datain, extractTotals[1] ); + datain.position( src + rowSizeInBytes ); + extract.extract( isSwap, datain, extractTotals[2] ); + datain.position( src + rowSizeInBytes + pixelSizeInBytes ); + extract.extract( isSwap, datain, extractTotals[3] ); + for( cc = 0; cc < components; cc++ ) { + int kk = 0; + // grab 4 pixels to average + totals[cc] = 0.0f; + for( kk = 0; kk < BOX4; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= BOX4; + } + extract.shove( totals, outIndex, dataout ); + outIndex++; + src += pixelSizeInBytes + pixelSizeInBytes; + } + // skip past pad bytes, if any, to get to next row + src += padBytes; + src += rowSizeInBytes; + } + assert( src == rowSizeInBytes * height ); + assert( outIndex == halfWidth * halfHeight ); + } + + public static void halve1DimagePackedPixel( int components, Extract extract, int width, + int height, ByteBuffer datain, ByteBuffer dataout, + int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + int halfWidth = width / 2; + int halfHeight = height / 2; + int src = 0; + int jj; + + assert( width == 1 || height == 1 ); + assert( width != height ); + + if( height == 1 ) { + int outIndex = 0; + + assert( width != 1 ); + halfHeight = 1; + + // one horizontal row with possible pad bytes + + for( jj = 0; jj < halfWidth; jj++ ) { + float[] totals = new float[4]; + float[][] extractTotals = new float[BOX2][4]; + int cc; + + datain.position( src ); + extract.extract( isSwap, datain, extractTotals[0] ); + datain.position( src + pixelSizeInBytes ); + extract.extract( isSwap, datain, extractTotals[1] ); + for( cc = 0; cc < components; cc++ ) { + int kk = 0; + // grab 4 pixels to average + totals[cc] = 0.0f; + for( kk = 0; kk < BOX2; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= BOX2; + } + extract.shove( totals, outIndex, dataout ); + outIndex++; + // skip over to next group of 2 + src += pixelSizeInBytes + pixelSizeInBytes; + } + int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + src += padBytes; + + assert( src == rowSizeInBytes ); + assert( outIndex == halfWidth * halfHeight ); + } else if( width == 1 ) { + int outIndex = 0; + + assert( height != 1 ); + halfWidth = 1; + // one vertical volumn with possible pad bytes per row + // average two at a time + + for( jj = 0; jj < halfHeight; jj++ ) { + float[] totals = new float[4]; + float[][] extractTotals = new float[BOX2][4]; + int cc; + // average two at a time, instead of four + datain.position( src ); + extract.extract( isSwap, datain, extractTotals[0] ); + datain.position( src + rowSizeInBytes ); + extract.extract( isSwap, datain, extractTotals[1] ); + for( cc = 0; cc < components; cc++ ) { + int kk = 0; + // grab 4 pixels to average + totals[cc] = 0.0f; + for( kk = 0; kk < BOX2; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= BOX2; + } + extract.shove( totals, outIndex, dataout ); + outIndex++; + // skip over to next group of 2 + src += rowSizeInBytes + rowSizeInBytes; + } + assert( src == rowSizeInBytes ); + assert( outIndex == halfWidth * halfHeight ); + } + } + + public static void halveImagePackedPixelSlice( int components, Extract extract, + int width, int height, int depth, ByteBuffer dataIn, + ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, + int imageSizeInBytes, boolean isSwap ) { + int ii, jj; + int halfWidth = width / 2; + int halfHeight = height / 2; + int halfDepth = depth / 2; + int src = 0; + int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + int outIndex = 0; + + assert( (width == 1 || height == 1) && depth >= 2 ); + + if( width == height ) { + assert( width == 1 && height == 1 ); + assert( depth >= 2 ); + + for( ii = 0; ii < halfDepth; ii++ ) { + float totals[] = new float[4]; + float extractTotals[][] = new float[BOX2][4]; + int cc; + + dataIn.position( src ); + extract.extract( isSwap, dataIn, extractTotals[0] ); + dataIn.position( src + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[1] ); + + for( cc = 0; cc < components; cc++ ) { + int kk; + + // average only 2 pixels since a column + totals[cc]= 0.0f; + for( kk = 0; kk < BOX2; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= BOX2; + } // for cc + + extract.shove( totals, outIndex, dataOut ); + outIndex++; + // skip over to next group of 2 + src += imageSizeInBytes + imageSizeInBytes; + } // for ii + } else if( height == 1 ) { + assert( width != 1 ); + + for( ii = 0; ii < halfDepth; ii++ ) { + for( jj = 0; jj < halfWidth; jj++ ) { + float totals[] = new float[4]; + float extractTotals[][] = new float[BOX4][4]; + int cc; + + dataIn.position( src ); + extract.extract( isSwap, dataIn, extractTotals[0] ); + dataIn.position( src + pixelSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[1] ); + dataIn.position( src + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[2] ); + dataIn.position( src + pixelSizeInBytes + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[3] ); + + for( cc = 0; cc < components; cc++ ) { + int kk; + + // grab 4 pixels to average + totals[cc] = 0.0f; + for( kk = 0; kk < BOX4; kk++ ) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX4; + } + extract.shove( totals, outIndex, dataOut ); + outIndex++; + // skip over to next horizontal square of 4 + src += imageSizeInBytes + imageSizeInBytes; + } + } + } else if( width == 1 ) { + assert( height != 1 ); + + for( ii = 0; ii < halfDepth; ii++ ) { + for( jj = 0; jj < halfWidth; jj++ ) { + float totals[] = new float[4]; + float extractTotals[][] = new float[BOX4][4]; + int cc; + + dataIn.position( src ); + extract.extract( isSwap, dataIn, extractTotals[0] ); + dataIn.position( src + rowSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[1] ); + dataIn.position( src + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[2] ); + dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[3] ); + + for( cc = 0; cc < components; cc++ ) { + int kk; + + // grab 4 pixels to average + totals[cc] = 0.0f; + for( kk = 0; kk < BOX4; kk++ ) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX4; + } + extract.shove( totals, outIndex, dataOut ); + outIndex++; + // skip over to next horizontal square of 4 + src += imageSizeInBytes + imageSizeInBytes; + } + } + } + } + + public static void halveImageSlice( int components, ExtractPrimitive extract, int width, + int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, + int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, + int imageSizeInBytes, boolean isSwap ) { + int ii, jj; + int halfWidth = width / 2; + int halfHeight = height / 2; + int halfDepth = depth / 2; + int src = 0; + int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + int outIndex = 0; + + assert( (width == 1 || height == 1) && depth >= 2 ); + + if( width == height ) { + assert( width == 1 && height == 1 ); + assert( depth >= 2 ); + + for( ii = 0; ii < halfDepth; ii++ ) { + int cc; + for( cc = 0; cc < components; cc++ ) { + double[] totals = new double[4]; + double[][] extractTotals = new double[BOX2][4]; + int kk; + + dataIn.position( src ); + extractTotals[0][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + imageSizeInBytes ); + extractTotals[1][cc] = extract.extract( isSwap, dataIn ); + + // average 2 pixels since only a column + totals[cc] = 0.0f; + // totals[red] = extractTotals[0][red] + extractTotals[1][red]; + // totals[red] = red / 2; + for( kk = 0; kk < BOX2; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= (double)BOX2; + + extract.shove( totals[cc], outIndex, dataOut ); + outIndex++; + src += elementSizeInBytes; + } // for cc + // skip over next group of 2 + src += rowSizeInBytes; + } // for ii + + assert( src == rowSizeInBytes * height * depth ); + assert( outIndex == halfDepth * components ); + } else if( height == 1 ) { + assert( width != 1 ); + + for( ii = 0; ii < halfDepth; ii++ ) { + for( jj = 0; jj < halfWidth; jj++ ) { + int cc; + for( cc = 0; cc < components; cc++ ) { + int kk; + double totals[] = new double[4]; + double extractTotals[][] = new double[BOX4][4]; + + dataIn.position( src ); + extractTotals[0][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + groupSizeInBytes ); + extractTotals[1][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + imageSizeInBytes ); + extractTotals[2][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + imageSizeInBytes + groupSizeInBytes ); + extractTotals[3][cc] = extract.extract( isSwap, dataIn ); + + // grab 4 pixels to average + totals[cc] = 0.0f; + // totals[red] = extractTotals[0][red] + extractTotals[1][red] + + // extractTotals[2][red] + extractTotals[3][red]; + // totals[red] /= (double)BOX4; + for( kk = 0; kk < BOX4; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= (double)BOX4; + + extract.shove( totals[cc], outIndex, dataOut ); + outIndex++; + src += elementSizeInBytes; + } // for cc + // skip over to next horizontal square of 4 + src += elementSizeInBytes; + } // for jj + src += padBytes; + src += rowSizeInBytes; + } // for ii + assert( src == rowSizeInBytes * height * depth ); + assert( outIndex == halfWidth * halfDepth * components ); + } else if( width == 1 ) { + assert( height != 1 ); + + for( ii = 0; ii < halfDepth; ii++ ) { + for( jj = 0; jj < halfHeight; jj++ ) { + int cc; + for( cc = 0; cc < components; cc++ ) { + int kk; + double totals[] = new double[4]; + double extractTotals[][] = new double[BOX4][4]; + + dataIn.position( src ); + extractTotals[0][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + rowSizeInBytes ); + extractTotals[1][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + imageSizeInBytes ); + extractTotals[2][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + imageSizeInBytes + groupSizeInBytes ); + extractTotals[3][cc] = extract.extract( isSwap, dataIn ); + + + // grab 4 pixels to average + totals[cc] = 0.0f; + // totals[red] = extractTotals[0][red] + extractTotals[1][red] + + // extractTotals[2][red] + extractTotals[3][red]; + // totals[red] /= (double)BOX4; + for( kk = 0; kk < BOX4; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= (double)BOX4; + + extract.shove( totals[cc], outIndex, dataOut ); + outIndex++; + src += elementSizeInBytes; + } // for cc + // skip over to next horizontal square of 4 + src += padBytes; + src += rowSizeInBytes; + } // for jj + src += imageSizeInBytes; + } // for ii + assert( src == rowSizeInBytes * height * depth ); + assert( outIndex == halfWidth * halfDepth * components ); + } + } + + public static void halveImage3D( int components, ExtractPrimitive extract, + int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, + int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, + int imageSizeInBytes, boolean isSwap ) { + assert( depth > 1 ); + + // horizontal/vertical/onecolumn slice viewed from top + if( width == 1 || height == 1 ) { + assert( 1 <= depth ); + + halveImageSlice( components, extract, width, height, depth, dataIn, dataOut, + elementSizeInBytes, groupSizeInBytes, rowSizeInBytes, imageSizeInBytes, + isSwap ); + return; + } + + int ii, jj, dd; + + int halfWidth = width / 2; + int halfHeight = height / 2; + int halfDepth = depth / 2; + int src = 0; + int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + int outIndex = 0; + + for( dd = 0; dd < halfDepth; dd++ ) { + for( ii = 0; ii < halfHeight; ii++ ) { + for( jj = 0; jj < halfWidth; jj++ ) { + int cc; + for( cc = 0; cc < components; cc++ ) { + int kk; + double totals[] = new double[4]; + double extractTotals[][] = new double[BOX8][4]; + + dataIn.position( src ); + extractTotals[0][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + groupSizeInBytes ); + extractTotals[1][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + rowSizeInBytes ); + extractTotals[2][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + rowSizeInBytes + groupSizeInBytes ); + extractTotals[3][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + imageSizeInBytes ); + extractTotals[4][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + groupSizeInBytes + imageSizeInBytes ); + extractTotals[5][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); + extractTotals[6][cc] = extract.extract( isSwap, dataIn ); + dataIn.position( src + rowSizeInBytes + imageSizeInBytes + groupSizeInBytes ); + extractTotals[7][cc] = extract.extract( isSwap, dataIn ); + + totals[cc] = 0.0f; + + for( kk = 0; kk < BOX8; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= (double)BOX8; + + extract.shove( totals[cc], outIndex, dataOut ); + outIndex++; + + src += elementSizeInBytes; + } // for cc + // skip over to next square of 4 + src += groupSizeInBytes; + } // for jj + // skip past pad bytes, if any, to get to next row + src += padBytes; + src += rowSizeInBytes; + } // for ii + src += imageSizeInBytes; + } // for dd + assert( src == rowSizeInBytes * height * depth ); + assert( outIndex == halfWidth * halfHeight * halfDepth * components ); + } + + public static void halveImagePackedPixel3D( int components, Extract extract, + int width, int height, int depth, ByteBuffer dataIn, + ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, + int imageSizeInBytes, boolean isSwap ) { + if( depth == 1 ) { + assert( 1 <= width && 1 <= height ); + + halveImagePackedPixel( components, extract, width, height, dataIn, dataOut, + pixelSizeInBytes, rowSizeInBytes, isSwap ); + return; + } else if( width == 1 || height == 1 ) { // a horizontal or vertical slice viewed from top + assert( 1 <= depth ); + + halveImagePackedPixelSlice( components, extract, width, height, depth, dataIn, + dataOut, pixelSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap ); + return; + } + int ii, jj, dd; + + int halfWidth = width / 2; + int halfHeight = height / 2; + int halfDepth = depth / 2; + int src = 0; + int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + int outIndex = 0; + + for( dd = 0; dd < halfDepth; dd++ ) { + for( ii = 0; ii < halfHeight; ii++ ) { + for( jj = 0; jj < halfWidth; jj++ ) { + float totals[] = new float[4]; // 4 is max components + float extractTotals[][] = new float[BOX8][4]; + int cc; + + dataIn.position( src ); + extract.extract( isSwap, dataIn, extractTotals[0] ); + dataIn.position( src + pixelSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[1] ); + dataIn.position( src + rowSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[2] ); + dataIn.position( src + rowSizeInBytes + pixelSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[3] ); + dataIn.position( src + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[4] ); + dataIn.position( src + pixelSizeInBytes + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[5] ); + dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[6] ); + dataIn.position( src + rowSizeInBytes + pixelSizeInBytes + imageSizeInBytes ); + extract.extract( isSwap, dataIn, extractTotals[7] ); + + for( cc = 0; cc < components; cc++ ) { + int kk; + // grab 8 pixels to average + totals[cc] = 0.0f; + for( kk = 0; kk < BOX8; kk++ ) { + totals[cc] += extractTotals[kk][cc]; + } + totals[cc] /= (float)BOX8; + } + extract.shove( totals, outIndex, dataOut ); + outIndex++; + // skip over to next square of 4 + src += pixelSizeInBytes + pixelSizeInBytes; + } + // skip past pad bytes, if any, to get to next row + src += padBytes; + src += rowSizeInBytes; + } + src += imageSizeInBytes; + } + assert( src == rowSizeInBytes * height * depth ); + assert( outIndex == halfWidth * halfHeight * halfDepth ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Image.java b/src/classes/com/sun/opengl/impl/mipmap/Image.java new file mode 100644 index 000000000..777434586 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Image.java @@ -0,0 +1,1402 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import javax.media.opengl.GL; +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Image { + + /** Creates a new instance of Image */ + public Image() { + } + + public static short getShortFromByteArray( byte[] array, int index ) { + short s; + s = (short)(array[index] << 8 ); + s |= (short)(0x00FF & array[index+1]); + return( s ); + } + + public static int getIntFromByteArray( byte[] array, int index ) { + int i; + i = ( array[index] << 24 ) & 0xFF000000; + i |= ( array[index+1] << 16 ) & 0x00FF0000; + i |= ( array[index+2] << 8 ) & 0x0000FF00; + i |= ( array[index+3] ) & 0x000000FF; + return( i ); + } + + public static float getFloatFromByteArray( byte[] array, int index ) { + int i = getIntFromByteArray( array, index ); + return( Float.intBitsToFloat(i) ); + } + + /* + * Extract array from user's data applying all pixel store modes. + * The internal format used is an array of unsigned shorts. + */ + public static void fill_image( PixelStorageModes psm, int width, int height, + int format, int type, boolean index_format, ByteBuffer userdata, + ShortBuffer newimage ) { + int components; + int element_size; + int rowsize; + int padding; + int groups_per_line; + int group_size; + int elements_per_line; + int start; + int iter = 0; + int iter2; + int i, j, k; + boolean myswap_bytes; + + // Create a Extract interface object + Extract extract = null; + switch( type ) { + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + extract = new Extract332(); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + extract = new Extract233rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + extract = new Extract565(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + extract = new Extract565rev(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + extract = new Extract4444(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + extract = new Extract4444rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + extract = new Extract5551(); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + extract = new Extract1555rev(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + extract = new Extract8888(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + extract = new Extract8888rev(); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + extract = new Extract1010102(); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + extract = new Extract2101010rev(); + break; + } + + myswap_bytes = psm.getUnpackSwapBytes(); + components = Mipmap.elements_per_group( format, type ); + if( psm.getUnpackRowLength() > 0 ) { + groups_per_line = psm.getUnpackRowLength(); + } else { + groups_per_line = width; + } + + // All formats except GL_BITMAP fall out trivially + if( type == GL.GL_BITMAP ) { + int bit_offset; + int current_bit; + + rowsize = ( groups_per_line * components + 7 ) / 8; + padding = ( rowsize % psm.getUnpackAlignment() ); + if( padding != 0 ) { + rowsize += psm.getUnpackAlignment() - padding; + } + start = psm.getUnpackSkipRows() * rowsize + ( psm.getUnpackSkipPixels() * components / 8 ); + elements_per_line = width * components; + iter2 = 0; + for( i = 0; i < height; i++ ) { + iter = start; + userdata.position( iter ); // **************************************** + bit_offset = (psm.getUnpackSkipPixels() * components) % 8; + for( j = 0; j < elements_per_line; j++ ) { + // retrieve bit + if( psm.getUnpackLsbFirst() ) { + userdata.position( iter ); + current_bit = ( userdata.get() & 0x000000FF ) & ( 1 << bit_offset );//userdata[iter] & ( 1 << bit_offset ); + } else { + current_bit = ( userdata.get() & 0x000000FF ) & ( 1 << ( 7 - bit_offset ) ); + } + if( current_bit != 0 ) { + if( index_format ) { + newimage.position( iter2 ); + newimage.put( (short)1 ); + } else { + newimage.position( iter2 ); + newimage.put( (short)65535 ); + } + } else { + newimage.position( iter2 ); + newimage.put( (short)0 ); + } + bit_offset++; + if( bit_offset == 8 ) { + bit_offset = 0; + iter++; + } + iter2++; + } + start += rowsize; + } + } else { + element_size = Mipmap.bytes_per_element( type ); + group_size = element_size * components; + if( element_size == 1 ) { + myswap_bytes = false; + } + + rowsize = groups_per_line * group_size; + padding = ( rowsize % psm.getUnpackAlignment() ); + if( padding != 0 ) { + rowsize += psm.getUnpackAlignment() - padding; + } + start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; + elements_per_line = width * components; + + iter2 = 0; + for( i = 0; i < height; i++ ) { + iter = start; + userdata.position( iter ); //*************************************** + for( j = 0; j < elements_per_line; j++ ) { + Type_Widget widget = new Type_Widget(); + float[] extractComponents = new float[4]; + userdata.position( iter ); + switch( type ) { + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); + for( k = 0; k < 3; k++ ) { + newimage.put( (short)(extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); + for( k = 0; k < 3; k++ ) { + newimage.put( (short)(extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_BYTE ): + if( index_format ) { + newimage.put( (short)( 0x000000FF & userdata.get() ) );//userdata[iter]; + } else { + newimage.put( (short)( 0x000000FF & userdata.get()/*userdata[iter]*/ * 257 ) ); + } + break; + case( GL.GL_BYTE ): + if( index_format ) { + newimage.put( userdata.get() ); //userdata[iter]; + } else { + newimage.put( (short)(userdata.get()/*userdata[iter]*/ * 516 ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + extract.extract( myswap_bytes, userdata/*userdata[iter]*/, extractComponents ); + for( k = 0; k < 3; k++ ) { + newimage.put( (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 3; k++ ) { + newimage.put( (short)(extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)(extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)(extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( myswap_bytes ) { + widget.setUB1( userdata.get() ); + widget.setUB0( userdata.get() ); + } else { + widget.setUB0( userdata.get() ); + widget.setUB1( userdata.get() ); + } + if( type == GL.GL_SHORT ) { + if( index_format ) { + newimage.put( widget.getS0() ); + } else { + newimage.put( (short)(widget.getS0() * 2) ); + } + } else { + newimage.put( widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + extract.extract( myswap_bytes, userdata, extractComponents ); + for( k = 0; k < 4; k++ ) { + newimage.put( (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( myswap_bytes ) { + widget.setUB3( userdata.get() ); + widget.setUB2( userdata.get() ); + widget.setUB1( userdata.get() ); + widget.setUB0( userdata.get() ); + } else { + widget.setUB0( userdata.get() ); + widget.setUB1( userdata.get() ); + widget.setUB2( userdata.get() ); + widget.setUB3( userdata.get() ); + } + if( type == GL.GL_FLOAT ) { + if( index_format ) { + newimage.put( (short)widget.getF() ); + } else { + newimage.put( (short)(widget.getF() * 65535 ) ); + } + } else if( type == GL.GL_UNSIGNED_INT ) { + if( index_format ) { + newimage.put( (short)( widget.getUI() ) ); + } else { + newimage.put( (short)( widget.getUI() >> 16 ) ); + } + } else { + if( index_format ) { + newimage.put( (short)( widget.getI() ) ); + } else { + newimage.put( (short)( widget.getI() >> 15 ) ); + } + } + break; + } + iter += element_size; + } // for j + start += rowsize; + // want iter pointing at start, not within, row for assertion purposes + iter = start; + } // for i + + // iterators should be one byte past end + if( !Mipmap.isTypePackedPixel( type ) ) { + assert( iter2 == ( width * height * components ) ); + } else { + assert( iter2 == ( width * height * Mipmap.elements_per_group( format, 0 ) ) ); + } + assert( iter == ( rowsize * height + psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size ) ); + } + } + + /* + * Insert array into user's data applying all pixel store modes. + * Theinternal format is an array of unsigned shorts. + * empty_image() because it is the opposet of fill_image(). + */ + public static void empty_image( PixelStorageModes psm, int width, int height, + int format, int type, boolean index_format, + ShortBuffer oldimage, ByteBuffer userdata ) { + + int components; + int element_size; + int rowsize; + int padding; + int groups_per_line; + int group_size; + int elements_per_line; + int start; + int iter = 0; + int iter2; + int i, j, k; + boolean myswap_bytes; + + // Create a Extract interface object + Extract extract = null; + switch( type ) { + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + extract = new Extract332(); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + extract = new Extract233rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + extract = new Extract565(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + extract = new Extract565rev(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + extract = new Extract4444(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + extract = new Extract4444rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + extract = new Extract5551(); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + extract = new Extract1555rev(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + extract = new Extract8888(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + extract = new Extract8888rev(); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + extract = new Extract1010102(); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + extract = new Extract2101010rev(); + break; + } + + myswap_bytes = psm.getPackSwapBytes(); + components = Mipmap.elements_per_group( format, type ); + if( psm.getPackRowLength() > 0 ) { + groups_per_line = psm.getPackRowLength(); + } else { + groups_per_line = width; + } + + // all formats except GL_BITMAP fall out trivially + if( type == GL.GL_BITMAP ) { + int bit_offset; + int current_bit; + + rowsize = ( groups_per_line * components + 7 ) / 8; + padding = ( rowsize % psm.getPackAlignment() ); + if( padding != 0 ) { + rowsize += psm.getPackAlignment() - padding; + } + start = psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * components / 8; + elements_per_line = width * components; + iter2 = 0; + for( i = 0; i < height; i++ ) { + iter = start; + bit_offset = ( psm.getPackSkipPixels() * components ) % 8; + for( j = 0; j < elements_per_line; j++ ) { + if( index_format ) { + current_bit = oldimage.get( iter2 ) & 1; + } else { + if( oldimage.get( iter2 ) < 0 ) { // must check for negative rather than 32767 + current_bit = 1; + } else { + current_bit = 0; + } + } + + if( current_bit != 0 ) { + if( psm.getPackLsbFirst() ) { + userdata.put( iter, (byte)( ( userdata.get( iter ) | ( 1 << bit_offset ) ) ) ); + } else { + userdata.put( iter, (byte)( ( userdata.get( iter ) | ( 7 - bit_offset ) ) ) ); + } + } else { + if( psm.getPackLsbFirst() ) { + //userdata[iter] &= ~( 1 << bit_offset ); + userdata.put( iter, (byte)( ( userdata.get( iter ) & ~( 1 << bit_offset ) ) ) ); + } else { + //userdata[iter] &= ~( 1 << ( 7 - bit_offset ) ); + userdata.put( iter, (byte)( ( userdata.get( iter ) & ~( 7 - bit_offset ) ) ) ); + } + } + + bit_offset++; + if( bit_offset == 8 ) { + bit_offset = 0; + iter++; + } + iter2++; + } + start += rowsize; + } + } else { + float shoveComponents[] = new float[4]; + + element_size = Mipmap.bytes_per_element( type ); + group_size = element_size * components; + if( element_size == 1 ) { + myswap_bytes = false; + } + + rowsize = groups_per_line * group_size; + padding = ( rowsize % psm.getPackAlignment() ); + if( padding != 0 ) { + rowsize += psm.getPackAlignment() - padding; + } + start = psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size; + elements_per_line = width * components; + + iter2 = 0; + for( i = 0; i < height; i++ ) { + iter = start; + for( j = 0; j < elements_per_line; j++ ) { + Type_Widget widget = new Type_Widget(); + + switch( type ) { + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + for( k = 0; k < 3; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, userdata ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + for( k = 0; k < 3; k++ ) { + shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; + } + extract.shove( shoveComponents, 0, userdata ); + break; + case( GL.GL_UNSIGNED_BYTE ): + if( index_format ) { + //userdata[iter] = (byte)oldimage[iter2++]; + userdata.put( iter, (byte)oldimage.get(iter2++) ); + } else { + //userdata[iter] = (byte)( oldimage[iter2++] >> 8 ); + userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); + } + break; + case( GL.GL_BYTE ): + if( index_format ) { + //userdata[iter] = (byte)oldimage[iter2++]; + userdata.put( iter, (byte)oldimage.get(iter2++) ); + } else { + //userdata[iter] = (byte)( oldimage[iter2++] >> 9 ); + userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + for( k = 0; k < 3; k++ ) { + shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1,widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter+1] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + for( k = 0; k < 3; k++ ) { + shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter+1] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter+1] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter+1] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter+1] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter+1] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { + if( index_format ) { + widget.setS0( oldimage.get( iter2++ ) ); + } else { + widget.setS0( (short)(oldimage.get( iter2++ ) >> 1) ); + } + } else { + widget.setUS0( oldimage.get( iter2++ ) ); + } + if( myswap_bytes ) { + //userdata[iter] = widget.getUB1(); + //userdata[iter+1] = widget.getUB0(); + userdata.put( iter, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB0() ); + } else { + //userdata[iter] = widget.getUB0(); + //userdata[iter] = widget.getUB1(); + userdata.put( iter, widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter+3] = widget.getUB0(); + //userdata[iter+2] = widget.getUB1(); + //userdata[iter+1] = widget.getUB2(); + //userdata[iter ] = widget.getUB3(); + userdata.put( iter + 3, widget.getUB0() ); + userdata.put( iter + 2, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB2() ); + userdata.put( iter , widget.getUB3() ); + } else { + userdata.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter+3] = widget.getUB0(); + //userdata[iter+2] = widget.getUB1(); + //userdata[iter+1] = widget.getUB2(); + //userdata[iter ] = widget.getUB3(); + userdata.put( iter + 3, widget.getUB0() ); + userdata.put( iter + 2, widget.getUB1() ); + userdata.put( iter + 2, widget.getUB2() ); + userdata.put( iter , widget.getUB3() ); + } else { + userdata.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter+3] = widget.getUB0(); + //userdata[iter+2] = widget.getUB1(); + //userdata[iter+1] = widget.getUB2(); + //userdata[iter ] = widget.getUB3(); + userdata.put( iter + 3, widget.getUB0() ); + userdata.put( iter + 2, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB2() ); + userdata.put( iter , widget.getUB3() ); + } else { + userdata.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswap_bytes ) { + //userdata[iter+3] = widget.getUB0(); + //userdata[iter+2] = widget.getUB1(); + //userdata[iter+1] = widget.getUB2(); + //userdata[iter ] = widget.getUB3(); + userdata.put( iter + 3, widget.getUB0() ); + userdata.put( iter + 2, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB2() ); + userdata.put( iter , widget.getUB3() ); + } else { + userdata.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { + if( index_format ) { + widget.setF( oldimage.get( iter2++ ) ); + } else { + widget.setF( oldimage.get( iter2++ ) / 65535.0f ); + } + } else if( type == GL.GL_UNSIGNED_INT ) { + if( index_format ) { + widget.setUI( oldimage.get( iter2++ ) ); + } else { + widget.setUI( oldimage.get( iter2++ ) * 65537 ); + } + } else { + if( index_format ) { + widget.setI( oldimage.get( iter2++ ) ); + } else { + widget.setI( (oldimage.get( iter2++ ) * 65537) / 2 ); + } + } + if( myswap_bytes ) { + userdata.put( iter + 3, widget.getUB0() ); + userdata.put( iter + 2, widget.getUB1() ); + userdata.put( iter + 1, widget.getUB2() ); + userdata.put( iter , widget.getUB3() ); + } else { + userdata.put( iter , widget.getUB0() ); + userdata.put( iter + 1, widget.getUB1() ); + userdata.put( iter + 2, widget.getUB2() ); + userdata.put( iter + 3, widget.getUB3() ); + } + break; + } + iter += element_size; + } // for j + start += rowsize; + // want iter pointing at start, not within, row for assertion purposes + iter = start; + } // for i + // iterators should be one byte past end + if( !Mipmap.isTypePackedPixel( type ) ) { + assert( iter2 == width * height * components ); + } else { + assert( iter2 == width * height * Mipmap.elements_per_group( format, 0 ) ); + } + assert( iter == rowsize * height + psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size ); + } + } + + public static void fillImage3D( PixelStorageModes psm, int width, int height, + int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, + ShortBuffer newImage ) { + boolean myswapBytes; + int components; + int groupsPerLine; + int elementSize; + int groupSize; + int rowSize; + int padding; + int elementsPerLine; + int rowsPerImage; + int imageSize; + int start, rowStart; + int iter = 0; + int iter2 = 0; + int ww, hh, dd, k; + Type_Widget widget = new Type_Widget(); + float extractComponents[] = new float[4]; + + // Create a Extract interface object + Extract extract = null; + switch( type ) { + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + extract = new Extract332(); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + extract = new Extract233rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + extract = new Extract565(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + extract = new Extract565rev(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + extract = new Extract4444(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + extract = new Extract4444rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + extract = new Extract5551(); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + extract = new Extract1555rev(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + extract = new Extract8888(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + extract = new Extract8888rev(); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + extract = new Extract1010102(); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + extract = new Extract2101010rev(); + break; + } + + myswapBytes = psm.getUnpackSwapBytes(); + components = Mipmap.elements_per_group( format, type ); + if( psm.getUnpackRowLength() > 0 ) { + groupsPerLine = psm.getUnpackRowLength(); + } else { + groupsPerLine = width; + } + elementSize = Mipmap.bytes_per_element( type ); + groupSize = elementSize * components; + if( elementSize == 1 ) { + myswapBytes = false; + } + + // 3dstuff begin + if( psm.getUnpackImageHeight() > 0 ) { + rowsPerImage = psm.getUnpackImageHeight(); + } else { + rowsPerImage = height; + } + // 3dstuff end + + rowSize = groupsPerLine * groupSize; + padding = rowSize % psm.getUnpackAlignment(); + if( padding != 0 ) { + rowSize += psm.getUnpackAlignment() - padding; + } + + imageSize = rowsPerImage * rowSize; // 3dstuff + + start = psm.getUnpackSkipRows() * rowSize + + psm.getUnpackSkipPixels() * groupSize + + psm.getUnpackSkipImages() * imageSize; + elementsPerLine = width * components; + + iter2 = 0; + for( dd = 0; dd < depth; dd++ ) { + rowStart = start; + for( hh = 0; hh < height; hh++ ) { + iter = rowStart; + for( ww = 0; ww < elementsPerLine; ww++ ) { + + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + if( indexFormat ) { + newImage.put( iter2++, (short)(0x000000FF & userImage.get( iter ) ) ); + } else { + newImage.put( iter2++, (short)((0x000000FF & userImage.get( iter ) ) * 257 ) ); + } + break; + case( GL.GL_BYTE ): + if( indexFormat ) { + newImage.put( iter2++, userImage.get( iter ) ); + } else { + newImage.put( iter2++, (short)(userImage.get( iter ) * 516 ) ); + } + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + userImage.position( iter ); + extract.extract( false, userImage, extractComponents ); + for( k = 0; k < 3; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + userImage.position( iter ); + extract.extract( false, userImage, extractComponents ); + for( k = 0; k < 3; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); + } + break; + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( myswapBytes ) { + widget.setUB0( userImage.get( iter + 1 ) ); + widget.setUB1( userImage.get( iter ) ); + } else { + widget.setUB0( userImage.get( iter ) ); + widget.setUB1( userImage.get( iter + 1 ) ); + } + if( type == GL.GL_SHORT ) { + if( indexFormat ) { + newImage.put( iter2++, widget.getUS0() ); + } else { + newImage.put( iter2++, (short)(widget.getUS0() * 2) ); + } + } else { + newImage.put( iter2++, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + userImage.position( iter ); + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + extract.extract( myswapBytes, userImage, extractComponents ); + for( k = 0; k < 4; k++ ) { + newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); + } + break; + case( GL.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( myswapBytes ) { + widget.setUB0( userImage.get( iter + 3 ) ); + widget.setUB1( userImage.get( iter + 2 ) ); + widget.setUB2( userImage.get( iter + 1 ) ); + widget.setUB3( userImage.get( iter ) ); + } else { + widget.setUB0( userImage.get( iter ) ); + widget.setUB1( userImage.get( iter + 1 ) ); + widget.setUB2( userImage.get( iter + 2 ) ); + widget.setUB3( userImage.get( iter + 3 ) ); + } + if( type == GL.GL_FLOAT ) { + if( indexFormat ) { + newImage.put( iter2++, (short)widget.getF() ); + } else { + newImage.put( iter2++, (short)( widget.getF() * 65535.0f ) ); + } + } else if( type == GL.GL_UNSIGNED_INT ) { + if( indexFormat ) { + newImage.put( iter2++, (short)widget.getUI() ); + } else { + newImage.put( iter2++, (short)(widget.getUI() >> 16) ); + } + } else { + if( indexFormat ) { + newImage.put( iter2++, (short)widget.getI() ); + } else { + newImage.put( iter2++, (short)(widget.getI() >> 15) ); + } + } + break; + default: + assert( false ); + } + iter += elementSize; + } // for ww + rowStart += rowSize; + iter = rowStart; // for assert + } // for hh + start += imageSize; + }// for dd + + // iterators should be one byte past end + if( !Mipmap.isTypePackedPixel( type ) ) { + assert( iter2 == width * height * depth * components ); + } else { + assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) ); + } + assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize + + psm.getUnpackSkipPixels() * groupSize + + psm.getUnpackSkipImages() * imageSize ); + } + + public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, + int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { + boolean myswapBytes; + int components; + int groupsPerLine; + int elementSize; + int groupSize; + int rowSize; + int padding; + int start, rowStart, iter; + int elementsPerLine; + int iter2; + int ii, jj, dd, k; + int rowsPerImage; + int imageSize; + Type_Widget widget = new Type_Widget(); + float[] shoveComponents = new float[4]; + + // Create a Extract interface object + Extract extract = null; + switch( type ) { + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + extract = new Extract332(); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + extract = new Extract233rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + extract = new Extract565(); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + extract = new Extract565rev(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + extract = new Extract4444(); + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + extract = new Extract4444rev(); + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + extract = new Extract5551(); + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + extract = new Extract1555rev(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + extract = new Extract8888(); + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + extract = new Extract8888rev(); + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + extract = new Extract1010102(); + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + extract = new Extract2101010rev(); + break; + } + + iter = 0; + + myswapBytes = psm.getPackSwapBytes(); + components = Mipmap.elements_per_group( format, type ); + if( psm.getPackRowLength() > 0 ) { + groupsPerLine = psm.getPackRowLength(); + } else { + groupsPerLine = width; + } + + elementSize = Mipmap.bytes_per_element( type ); + groupSize = elementSize * components; + if( elementSize == 1 ) { + myswapBytes = false; + } + + // 3dstuff begin + if( psm.getPackImageHeight() > 0 ) { + rowsPerImage = psm.getPackImageHeight(); + } else { + rowsPerImage = height; + } + + // 3dstuff end + + rowSize = groupsPerLine * groupSize; + padding = rowSize % psm.getPackAlignment(); + if( padding != 0 ) { + rowSize += psm.getPackAlignment() - padding; + } + + imageSize = rowsPerImage * rowSize; + + start = psm.getPackSkipRows() * rowSize + + psm.getPackSkipPixels() * groupSize + + psm.getPackSkipImages() * imageSize; + elementsPerLine = width * components; + + iter2 = 0; + for( dd = 0; dd < depth; dd++ ) { + rowStart = start; + + for( ii = 0; ii < height; ii++ ) { + iter = rowStart; + + for( jj = 0; jj < elementsPerLine; jj++ ) { + + switch( type ) { + case( GL.GL_UNSIGNED_BYTE ): + if( indexFormat ) { + userImage.put( iter, (byte)(oldImage.get( iter2++ ) ) ); + } else { + userImage.put( iter, (byte)(oldImage.get( iter2++ ) >> 8 ) ); + } + break; + case( GL.GL_BYTE ): + if( indexFormat ) { + userImage.put( iter, (byte)(oldImage.get(iter2++) ) ); + } else { + userImage.put( iter, (byte)(oldImage.get(iter2++) >> 9) ); + } + break; + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + for( k = 0; k < 3; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, userImage ); + break; + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + for( k = 0; k < 3; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, userImage ); + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.putShort( iter, widget.getUB1() ); + userImage.putShort( iter + 1, widget.getUB0() ); + } else { + userImage.putShort( iter, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB0() ); + } else { + userImage.putShort( iter, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB0() ); + } else { + userImage.putShort( iter, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB0() ); + } else { + userImage.putShort( iter, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB0() ); + } else { + userImage.putShort( iter, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB0() ); + } else { + userImage.putShort( iter, widget.getUS0() ); + } + break; + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { + if( indexFormat ) { + widget.setS0( (short)oldImage.get( iter2++ ) ); + } else { + widget.setS0( (short)(oldImage.get( iter2++ ) >> 1) ); + } + } else { + widget.setUS0( (short)oldImage.get( iter2++ ) ); + } + if( myswapBytes ) { + userImage.put( iter, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB0() ); + } else { + userImage.put( iter, widget.getUB0() ); + userImage.put( iter + 1, widget.getUB1() ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter + 3, widget.getUB0() ); + userImage.put( iter + 2, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB2() ); + userImage.put( iter , widget.getUB3() ); + } else { + userImage.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter + 3, widget.getUB0() ); + userImage.put( iter + 2, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB2() ); + userImage.put( iter , widget.getUB3() ); + } else { + userImage.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter + 3, widget.getUB0() ); + userImage.put( iter + 2, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB2() ); + userImage.put( iter ,widget.getUB3() ); + } else { + userImage.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + for( k = 0; k < 4; k++ ) { + shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; + } + extract.shove( shoveComponents, 0, widget.getBuffer() ); + if( myswapBytes ) { + userImage.put( iter + 3, widget.getUB0() ); + userImage.put( iter + 2, widget.getUB2() ); + userImage.put( iter + 1, widget.getUB1() ); + userImage.put( iter , widget.getUB0() ); + } else { + userImage.putInt( iter, widget.getUI() ); + } + break; + case( GL.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { + if( indexFormat ) { + widget.setF( oldImage.get( iter2++ ) ); + } else { + widget.setF( oldImage.get( iter2++ ) / 65535.0f ); + } + } else if( type == GL.GL_UNSIGNED_INT ) { + if( indexFormat ) { + widget.setUI( oldImage.get( iter2++ ) ); + } else { + widget.setUI( oldImage.get( iter2++ ) * 65537 ); + } + } else { + if( indexFormat ) { + widget.setI( oldImage.get( iter2++ ) ); + } else { + widget.setI( ( oldImage.get( iter2++ ) * 65535 ) / 2 ); + } + } + if( myswapBytes ) { + userImage.put( iter + 3, widget.getUB0() ); + userImage.put( iter + 2, widget.getUB1() ); + userImage.put( iter + 1, widget.getUB2() ); + userImage.put( iter , widget.getUB3() ); + } else { + userImage.put( iter , widget.getUB0() ); + userImage.put( iter + 1, widget.getUB1() ); + userImage.put( iter + 2, widget.getUB2() ); + userImage.put( iter + 3, widget.getUB3() ); + } + break; + default: + assert( false ); + } + + iter += elementSize; + } // for jj + rowStart += rowSize; + } // for ii + start += imageSize; + } // for dd + + if( !Mipmap.isTypePackedPixel( type ) ) { + assert( iter2 == width * height * depth * components ); + } else { + assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) ); + } + assert( iter == rowSize * height * depth + + psm.getUnpackSkipRows() * rowSize + + psm.getUnpackSkipPixels() * groupSize + + psm.getUnpackSkipImages() * imageSize ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Mipmap.java b/src/classes/com/sun/opengl/impl/mipmap/Mipmap.java new file mode 100644 index 000000000..2b4a30edc --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Mipmap.java @@ -0,0 +1,802 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import javax.media.opengl.GL; +import javax.media.opengl.glu.GLU; +import javax.media.opengl.GLException; +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Mipmap { + + /** Creates a new instance of Mipmap */ + public Mipmap() { + } + + public static int computeLog( int value ) { + int i = 0; + // Error + if( value == 0 ) { + return( -1 ); + } + for( ;; ) { + if( (value & 1) >= 1 ) { + if( value != 1 ) { + return( -1 ); + } + return( i ); + } + value = value >> 1; + i++; + } + } + + /* Compute the nearest power of 2 number. This algorithm is a little strange + * but it works quite well. + */ + public static int nearestPower( int value ) { + int i = 1; + // Error! + if( value == 0 ) { + return( -1 ); + } + for( ;; ) { + if( value == 1 ) { + return( i ); + } else if( value == 3 ) { + return( i * 4 ); + } + value = value >> 1; + i *= 2; + } + } + + public static short GLU_SWAP_2_BYTES( short s ) { + byte b = 0; + b = (byte)( s >>> 8 ); + s = (short)( s << 8 ); + s = (short)( s | (0x00FF & b) ); + return( s ); + } + + public static int GLU_SWAP_4_BYTES( int i ) { + int t = i << 24; + t |= 0x00FF0000 & ( i << 8 ); + t |= 0x0000FF00 & ( i >>> 8 ); + t |= 0x000000FF & ( i >>> 24 ); + return( t ); + } + + public static float GLU_SWAP_4_BYTES( float f ) { + int i = Float.floatToRawIntBits( f ); + float temp = Float.intBitsToFloat( i ); + return( temp ); + } + + public static int checkMipmapArgs( int internalFormat, int format, int type ) { + if( !legalFormat( format ) || !legalType( type ) ) { + return( GLU.GLU_INVALID_ENUM ); + } + if( format == GL.GL_STENCIL_INDEX ) { + return( GLU.GLU_INVALID_ENUM ); + } + if( !isLegalFormatForPackedPixelType( format, type ) ) { + return( GLU.GLU_INVALID_OPERATION ); + } + return( 0 ); + } + + public static boolean legalFormat( int format ) { + switch( format ) { + case( GL.GL_COLOR_INDEX ): + case( GL.GL_STENCIL_INDEX ): + case( GL.GL_DEPTH_COMPONENT ): + case( GL.GL_RED ): + case( GL.GL_GREEN ): + case( GL.GL_BLUE ): + case( GL.GL_ALPHA ): + case( GL.GL_RGB ): + case( GL.GL_RGBA ): + case( GL.GL_LUMINANCE ): + case( GL.GL_LUMINANCE_ALPHA ): + case( GL.GL_BGR ): + case( GL.GL_BGRA ): + return( true ); + default: + return( false ); + } + } + + public static boolean legalType( int type ) { + switch( type ) { + case( GL.GL_BITMAP ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + return( true ); + default: + return( false ); + } + } + + public static boolean isTypePackedPixel( int type ) { + assert( legalType( type ) ); + + if( type == GL.GL_UNSIGNED_BYTE_3_3_2 || + type == GL.GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5_REV || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL.GL_UNSIGNED_INT_8_8_8_8 || + type == GL.GL_UNSIGNED_INT_8_8_8_8_REV || + type == GL.GL_UNSIGNED_INT_10_10_10_2 || + type == GL.GL_UNSIGNED_INT_2_10_10_10_REV ) { + return( true ); + } + return( false ); + } + + public static boolean isLegalFormatForPackedPixelType( int format, int type ) { + // if not a packed pixel type then return true + if( isTypePackedPixel( type ) ) { + return( true ); + } + + // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB + if( (type == GL.GL_UNSIGNED_BYTE_3_3_2 || type == GL.GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL.GL_UNSIGNED_SHORT_5_6_5_REV ) + & format != GL.GL_RGB ) { + return( false ); + } + + // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & + // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT + if( ( type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL.GL_UNSIGNED_INT_8_8_8_8 || + type == GL.GL_UNSIGNED_INT_8_8_8_8_REV || + type == GL.GL_UNSIGNED_INT_10_10_10_2 || + type == GL.GL_UNSIGNED_INT_2_10_10_10_REV ) && + (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { + return( false ); + } + return( true ); + } + + public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, + int totalLevels ) { + if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || + (totalLevels < maxLevel) ) { + return( false ); + } + return( true ); + } + + /* Given user requested textures size, determine if it fits. If it doesn't then + * halve both sides and make the determination again until it does fit ( for + * IR only ). + * Note that proxy textures are not implemented in RE* even though they + * advertise the texture extension. + * Note that proxy textures are implemented but not according to spec in IMPACT* + */ + public static void closestFit( GL gl, int target, int width, int height, int internalFormat, + int format, int type, int[] newWidth, int[] newHeight ) { + // Use proxy textures if OpenGL version >= 1.1 + if( Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) ) >= 1.1 ) { + int widthPowerOf2 = nearestPower( width ); + int heightPowerOf2 = nearestPower( height ); + int[] proxyWidth = new int[1]; + boolean noProxyTextures = false; + + // Some drivers (in particular, ATI's) seem to set a GL error + // when proxy textures are used even though this is in violation + // of the spec. Guard against this and interactions with the + // DebugGL by watching for GLException. + try { + do { + // compute level 1 width & height, clamping each at 1 + int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); + int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); + int proxyTarget; + + assert( widthAtLevelOne > 0 ); + assert( heightAtLevelOne > 0 ); + + // does width x height at level 1 & all their mipmaps fit? + if( target == GL.GL_TEXTURE_2D || target == GL.GL_PROXY_TEXTURE_2D ) { + proxyTarget = GL.GL_PROXY_TEXTURE_2D; + gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, + heightAtLevelOne, 0, format, type, null ); + } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { + proxyTarget = GL.GL_PROXY_TEXTURE_CUBE_MAP; + gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, + heightAtLevelOne, 0, format, type, null ); + } else { + assert( target == GL.GL_TEXTURE_1D || target == GL.GL_PROXY_TEXTURE_1D ); + proxyTarget = GL.GL_PROXY_TEXTURE_1D; + gl.glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne, + 0, format, type, null ); + } + gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 ); + // does it fit? + if( proxyWidth[0] == 0 ) { // nope, so try again with theses sizes + if( widthPowerOf2 == 1 && heightPowerOf2 == 1 ) { + /* A 1x1 texture couldn't fit for some reason so break out. This + * should never happen. But things happen. The disadvantage with + * this if-statement is that we will never be aware of when this + * happens since it will silently branch out. + */ + noProxyTextures = true; + break; + } + widthPowerOf2 = widthAtLevelOne; + heightPowerOf2 = heightAtLevelOne; + } + // else it does fit + } while( proxyWidth[0] == 0 ); + } catch (GLException e) { + noProxyTextures = true; + } + // loop must terminate + // return the width & height at level 0 that fits + if( !noProxyTextures ) { + newWidth[0] = widthPowerOf2; + newHeight[0] = heightPowerOf2; + return; + } + } + int[] maxsize = new int[1]; + gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize , 0); + // clamp user's texture sizes to maximum sizes, if necessary + newWidth[0] = nearestPower( width ); + if( newWidth[0] > maxsize[0] ) { + newWidth[0] = maxsize[0]; + } + newHeight[0] = nearestPower( height ); + if( newHeight[0] > maxsize[0] ) { + newHeight[0] = maxsize[0]; + } + } + + public static void closestFit3D( GL gl, int target, int width, int height, int depth, + int internalFormat, int format, int type, int[] newWidth, int[] newHeight, + int[] newDepth ) { + int widthPowerOf2 = nearestPower( width ); + int heightPowerOf2 = nearestPower( height ); + int depthPowerOf2 = nearestPower( depth ); + int[] proxyWidth = new int[1]; + + do { + // compute level 1 width & height & depth, clamping each at 1 + int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; + int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; + int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; + int proxyTarget = 0; + assert( widthAtLevelOne > 0 ); + assert( heightAtLevelOne > 0 ); + assert( depthAtLevelOne > 0 ); + + // does width x height x depth at level 1 & all their mipmaps fit? + if( target == GL.GL_TEXTURE_3D || target == GL.GL_PROXY_TEXTURE_3D ) { + proxyTarget = GL.GL_PROXY_TEXTURE_3D; + gl.glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, + heightAtLevelOne, depthAtLevelOne, 0, format, type, null ); + } + gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 ); + // does it fit + if( proxyWidth[0] == 0 ) { + if( widthPowerOf2 == 1 && heightPowerOf2 == 1 && depthPowerOf2 == 1 ) { + newWidth[0] = newHeight[0] = newDepth[0] = 1; + return; + } + widthPowerOf2 = widthAtLevelOne; + heightPowerOf2 = heightAtLevelOne; + depthPowerOf2 = depthAtLevelOne; + } + } while( proxyWidth[0] == 0 ); + // loop must terminate + + // return the width & height at level 0 that fits + newWidth[0] = widthPowerOf2; + newHeight[0] = heightPowerOf2; + newDepth[0] = depthPowerOf2; + } + + public static int elements_per_group( int format, int type ) { + // Return the number of elements per grtoup of a specified gromat + + // If the type is packedpixels then answer is 1 + if( type == GL.GL_UNSIGNED_BYTE_3_3_2 || + type == GL.GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5_REV || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL.GL_UNSIGNED_INT_8_8_8_8 || + type == GL.GL_UNSIGNED_INT_8_8_8_8_REV || + type == GL.GL_UNSIGNED_INT_10_10_10_2 || + type == GL.GL_UNSIGNED_INT_2_10_10_10_REV ) { + return( 1 ); + } + + // Types are not packed pixels so get elements per group + switch( format ) { + case( GL.GL_RGB ): + case( GL.GL_BGR ): + return( 3 ); + case( GL.GL_LUMINANCE_ALPHA ): + return( 2 ); + case( GL.GL_RGBA ): + case( GL.GL_BGRA ): + return( 4 ); + default: + return( 1 ); + } + } + + public static int bytes_per_element( int type ) { + // return the number of bytes per element, based on the element type + + switch( type ) { + case( GL.GL_BITMAP ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): + return( 1 ); + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + return( 2 ); + case( GL.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_FLOAT ): + return( 4 ); + default: + return( 4 ); + } + } + + public static boolean is_index( int format ) { + return( format == GL.GL_COLOR_INDEX || format == GL.GL_STENCIL_INDEX ); + } + + /* Compute memory required for internal packed array of data of given type and format. */ + + public static int image_size( int width, int height, int format, int type ) { + int bytes_per_row; + int components; + + assert( width > 0 ); + assert( height > 0 ); + components = elements_per_group( format, type ); + if( type == GL.GL_BITMAP ) { + bytes_per_row = (width + 7) / 8; + } else { + bytes_per_row = bytes_per_element( type ) * width; + } + return( bytes_per_row * height * components ); + } + + public static int imageSize3D( int width, int height, int depth, int format, int type ) { + int components = elements_per_group( format, type ); + int bytes_per_row = bytes_per_element( type ) * width; + + assert( width > 0 && height > 0 && depth > 0 ); + assert( type != GL.GL_BITMAP ); + + return( bytes_per_row * height * depth * components ); + } + + public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { + int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); + psm.setUnpackAlignment( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a, 0); + psm.setUnpackRowLength( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a, 0); + psm.setUnpackSkipRows( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a, 0); + psm.setUnpackSkipPixels( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a, 0); + psm.setUnpackLsbFirst( ( a[0] == 1 ) ); + gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a, 0); + psm.setUnpackSwapBytes( ( a[0] == 1 ) ); + + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); + psm.setPackAlignment( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a, 0); + psm.setPackRowLength( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a, 0); + psm.setPackSkipRows( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a, 0); + psm.setPackSkipPixels( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a, 0); + psm.setPackLsbFirst( ( a[0] == 1 ) ); + gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a, 0); + psm.setPackSwapBytes( ( a[0] == 1 ) ); + } + + public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { + int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); + psm.setUnpackAlignment( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a, 0); + psm.setUnpackRowLength( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a, 0); + psm.setUnpackSkipRows( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a, 0); + psm.setUnpackSkipPixels( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a, 0); + psm.setUnpackLsbFirst( ( a[0] == 1 ) ); + gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a, 0); + psm.setUnpackSwapBytes( ( a[0] == 1 ) ); + gl.glGetIntegerv( GL.GL_UNPACK_SKIP_IMAGES, a, 0); + psm.setUnpackSkipImages( a[0] ); + gl.glGetIntegerv( GL.GL_UNPACK_IMAGE_HEIGHT, a, 0); + psm.setUnpackImageHeight( a[0] ); + + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); + psm.setPackAlignment( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a, 0); + psm.setPackRowLength( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a, 0); + psm.setPackSkipRows( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a, 0 ); + psm.setPackSkipPixels( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a, 0 ); + psm.setPackLsbFirst( ( a[0] == 1 ) ); + gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a, 0 ); + psm.setPackSwapBytes( ( a[0] == 1 ) ); + gl.glGetIntegerv( GL.GL_PACK_SKIP_IMAGES, a, 0 ); + psm.setPackSkipImages( a[0] ); + gl.glGetIntegerv( GL.GL_PACK_IMAGE_HEIGHT, a, 0 ); + psm.setPackImageHeight( a[0] ); + } + + public static int gluScaleImage( GL gl, int format, int widthin, int heightin, + int typein, ByteBuffer datain, int widthout, int heightout, + int typeout, ByteBuffer dataout ) { + int components; + ByteBuffer beforeimage; + ByteBuffer afterimage; + PixelStorageModes psm = new PixelStorageModes(); + + if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { + return( 0 ); + } + if( (widthin < 0) || (heightin < 0) || (widthout < 0) || (heightout < 0) ) { + return( GLU.GLU_INVALID_VALUE ); + } + if( !legalFormat( format ) || !legalType( typein ) || !legalType( typeout ) ) { + return( GLU.GLU_INVALID_ENUM ); + } + if( !isLegalFormatForPackedPixelType( format, typein ) ) { + return( GLU.GLU_INVALID_OPERATION ); + } + if( !isLegalFormatForPackedPixelType( format, typeout ) ) { + return( GLU.GLU_INVALID_OPERATION ); + } + beforeimage = ByteBuffer.allocateDirect( image_size( widthin, heightin, format, GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ); + afterimage = ByteBuffer.allocateDirect( image_size( widthout, heightout, format, GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ); + if( beforeimage == null || afterimage == null ) { + return( GLU.GLU_OUT_OF_MEMORY ); + } + + retrieveStoreModes( gl, psm ); + Image.fill_image( psm, widthin, heightin, format, typein, is_index( format ), datain, beforeimage.asShortBuffer() ); + components = elements_per_group( format, 0 ); + ScaleInternal.scale_internal( components, widthin, heightin, beforeimage.asShortBuffer(), widthout, heightout, afterimage.asShortBuffer() ); + Image.empty_image( psm, widthout, heightout, format, typeout, is_index( format ), afterimage.asShortBuffer(), dataout ); + + return( 0 ); + } + + public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, + int width, int format, int type, int userLevel, int baseLevel, + int maxLevel, ByteBuffer data ) { + int levels; + + int rc = checkMipmapArgs( internalFormat, format, type ); + if( rc != 0 ) { + return( rc ); + } + + if( width < 1 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + levels = computeLog( width ); + + levels += userLevel; + if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { + return( GLU.GLU_INVALID_VALUE ); + } + + return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, width, + width, format, type, userLevel, baseLevel, maxLevel, data ) ); + } + + public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, + int format, int type, ByteBuffer data ) { + int[] widthPowerOf2 = new int[1]; + int levels; + int[] dummy = new int[1]; + + int rc = checkMipmapArgs( internalFormat, format, type ); + if( rc != 0 ) { + return( rc ); + } + + if( width < 1 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + closestFit( gl, target, width, 1, internalFormat, format, type, widthPowerOf2, dummy ); + levels = computeLog( widthPowerOf2[0] ); + + return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, + width, widthPowerOf2[0], format, type, 0, 0, levels, data ) ); + } + + + public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, + int width, int height, int format, int type, int userLevel, + int baseLevel, int maxLevel, Object data ) { + int level, levels; + + int rc = checkMipmapArgs( internalFormat, format, type ); + if( rc != 0 ) { + return( rc ); + } + + if( width < 1 || height < 1 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + levels = computeLog( width ); + level = computeLog( height ); + if( level > levels ) { + levels = level; + } + + levels += userLevel; + if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { + return( GLU.GLU_INVALID_VALUE ); + } + + //PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data ); + ByteBuffer buffer = null; + if( data instanceof ByteBuffer ) { + buffer = (ByteBuffer)data; + } else if( data instanceof byte[] ) { + byte[] array = (byte[])data; + buffer = ByteBuffer.allocateDirect(array.length); + buffer.put(array); + } else if( data instanceof short[] ) { + short[] array = (short[])data; + buffer = ByteBuffer.allocateDirect( array.length * 2 ); + ShortBuffer sb = buffer.asShortBuffer(); + sb.put( array ); + } else if( data instanceof int[] ) { + int[] array = (int[])data; + buffer = ByteBuffer.allocateDirect( array.length * 4 ); + IntBuffer ib = buffer.asIntBuffer(); + ib.put( array ); + } else if( data instanceof float[] ) { + float[] array = (float[])data; + buffer = ByteBuffer.allocateDirect( array.length * 4 ); + FloatBuffer fb = buffer.asFloatBuffer(); + fb.put( array ); + } + + return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, + width, height, width, height, format, type, userLevel, baseLevel, + maxLevel, buffer ) ); + } + + + public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, + int width, int height, int format, int type, Object data ) { + int[] widthPowerOf2 = new int[1]; + int[] heightPowerOf2 = new int[1]; + int level, levels; + + int rc = checkMipmapArgs( internalFormat, format, type ); + if( rc != 0 ) { + return( rc ); + } + + if( width < 1 || height < 1 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + closestFit( gl, target, width, height, internalFormat, format, type, + widthPowerOf2, heightPowerOf2 ); + + levels = computeLog( widthPowerOf2[0] ); + level = computeLog( heightPowerOf2[0] ); + if( level > levels ) { + levels = level; + } + + //PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data ); + ByteBuffer buffer = null; + if( data instanceof ByteBuffer ) { + buffer = (ByteBuffer)data; + } else if( data instanceof byte[] ) { + byte[] array = (byte[])data; + buffer = ByteBuffer.allocateDirect(array.length); + buffer.put(array); + } else if( data instanceof short[] ) { + short[] array = (short[])data; + buffer = ByteBuffer.allocateDirect( array.length * 2 ); + ShortBuffer sb = buffer.asShortBuffer(); + sb.put( array ); + } else if( data instanceof int[] ) { + int[] array = (int[])data; + buffer = ByteBuffer.allocateDirect( array.length * 4 ); + IntBuffer ib = buffer.asIntBuffer(); + ib.put( array ); + } else if( data instanceof float[] ) { + float[] array = (float[])data; + buffer = ByteBuffer.allocateDirect( array.length * 4 ); + FloatBuffer fb = buffer.asFloatBuffer(); + fb.put( array ); + } + + return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, + width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0, + 0, levels, buffer ) ); + } + + + public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, + int width, int height, int depth, int format, int type, ByteBuffer data ) { + int[] widthPowerOf2 = new int[1]; + int[] heightPowerOf2 = new int[1]; + int[] depthPowerOf2 = new int[1]; + int level, levels; + + int rc = checkMipmapArgs( internalFormat, format, type ); + if( rc != 0 ) { + return( rc ); + } + + if( width < 1 || height < 1 || depth < 1 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + if( type == GL.GL_BITMAP ) { + return( GLU.GLU_INVALID_ENUM ); + } + + closestFit3D( gl, target, width, height, depth, internalFormat, format, + type, widthPowerOf2, heightPowerOf2, depthPowerOf2 ); + + levels = computeLog( widthPowerOf2[0] ); + level = computeLog( heightPowerOf2[0] ); + if( level > levels ) { + levels = level; + } + level = computeLog( depthPowerOf2[0] ); + if( level > levels ) { + levels = level; + } + + return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width, + height, depth, widthPowerOf2[0], heightPowerOf2[0], depthPowerOf2[0], + format, type, 0, 0, levels, data ) ); + } + + public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, + int width, int height, int depth, int format, int type, int userLevel, + int baseLevel, int maxLevel, ByteBuffer data ) { + int level, levels; + + int rc = checkMipmapArgs( internalFormat, format, type ); + if( rc != 0 ) { + return( rc ); + } + + if( width < 1 || height < 1 || depth < 1 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + if( type == GL.GL_BITMAP ) { + return( GLU.GLU_INVALID_ENUM ); + } + + levels = computeLog( width ); + level = computeLog( height ); + if( level > levels ) { + levels = level; + } + level = computeLog( depth ); + if( level > levels ) { + levels = level; + } + + levels += userLevel; + if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { + return( GLU.GLU_INVALID_VALUE ); + } + + return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width, + height, depth, width, height, depth, format, type, userLevel, + baseLevel, maxLevel, data ) ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/PixelStorageModes.java b/src/classes/com/sun/opengl/impl/mipmap/PixelStorageModes.java new file mode 100644 index 000000000..990e4b90a --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/PixelStorageModes.java @@ -0,0 +1,416 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +/** + * + * @author Administrator + */ +public class PixelStorageModes { + + /** + * Holds value of property packAlignment. + */ + private int packAlignment; + + /** + * Holds value of property packRowLength. + */ + private int packRowLength; + + /** + * Holds value of property packSkipRows. + */ + private int packSkipRows; + + /** + * Holds value of property packSkipPixels. + */ + private int packSkipPixels; + + /** + * Holds value of property packLsbFirst. + */ + private boolean packLsbFirst; + + /** + * Holds value of property packSwapBytes. + */ + private boolean packSwapBytes; + + /** + * Holds value of property packSkipImages. + */ + private int packSkipImages; + + /** + * Holds value of property packImageHeight. + */ + private int packImageHeight; + + /** + * Holds value of property unpackAlignment. + */ + private int unpackAlignment; + + /** + * Holds value of property unpackRowLength. + */ + private int unpackRowLength; + + /** + * Holds value of property unpackSkipRows. + */ + private int unpackSkipRows; + + /** + * Holds value of property unpackSkipPixels. + */ + private int unpackSkipPixels; + + /** + * Holds value of property unpackLsbFirst. + */ + private boolean unpackLsbFirst; + + /** + * Holds value of property unpackSwapBytes. + */ + private boolean unpackSwapBytes; + + /** + * Holds value of property unpackSkipImages. + */ + private int unpackSkipImages; + + /** + * Holds value of property unpackImageHeight. + */ + private int unpackImageHeight; + + /** Creates a new instance of PixelStorageModes */ + public PixelStorageModes() { + } + + /** + * Getter for property packAlignment. + * @return Value of property packAlignment. + */ + public int getPackAlignment() { + + return this.packAlignment; + } + + /** + * Setter for property packAlignment. + * @param packAlignment New value of property packAlignment. + */ + public void setPackAlignment(int packAlignment) { + + this.packAlignment = packAlignment; + } + + /** + * Getter for property packRowLength. + * @return Value of property packRowLength. + */ + public int getPackRowLength() { + + return this.packRowLength; + } + + /** + * Setter for property packRowLength. + * @param packRowLength New value of property packRowLength. + */ + public void setPackRowLength(int packRowLength) { + + this.packRowLength = packRowLength; + } + + /** + * Getter for property packSkipRows. + * @return Value of property packSkipRows. + */ + public int getPackSkipRows() { + + return this.packSkipRows; + } + + /** + * Setter for property packSkipRows. + * @param packSkipRows New value of property packSkipRows. + */ + public void setPackSkipRows(int packSkipRows) { + + this.packSkipRows = packSkipRows; + } + + /** + * Getter for property packSkipPixels. + * @return Value of property packSkipPixels. + */ + public int getPackSkipPixels() { + + return this.packSkipPixels; + } + + /** + * Setter for property packSkipPixels. + * @param packSkipPixels New value of property packSkipPixels. + */ + public void setPackSkipPixels(int packSkipPixels) { + + this.packSkipPixels = packSkipPixels; + } + + /** + * Getter for property packLsbFirst. + * @return Value of property packLsbFirst. + */ + public boolean getPackLsbFirst() { + + return this.packLsbFirst; + } + + /** + * Setter for property packLsbFirst. + * @param packLsbFirst New value of property packLsbFirst. + */ + public void setPackLsbFirst(boolean packLsbFirst) { + + this.packLsbFirst = packLsbFirst; + } + + /** + * Getter for property packSwapBytes. + * @return Value of property packSwapBytes. + */ + public boolean getPackSwapBytes() { + + return this.packSwapBytes; + } + + /** + * Setter for property packSwapBytes. + * @param packSwapBytes New value of property packSwapBytes. + */ + public void setPackSwapBytes(boolean packSwapBytes) { + + this.packSwapBytes = packSwapBytes; + } + + /** + * Getter for property packSkipImages. + * @return Value of property packSkipImages. + */ + public int getPackSkipImages() { + + return this.packSkipImages; + } + + /** + * Setter for property packSkipImages. + * @param packSkipImages New value of property packSkipImages. + */ + public void setPackSkipImages(int packSkipImages) { + + this.packSkipImages = packSkipImages; + } + + /** + * Getter for property packImageHeight. + * @return Value of property packImageHeight. + */ + public int getPackImageHeight() { + + return this.packImageHeight; + } + + /** + * Setter for property packImageHeight. + * @param packImageHeight New value of property packImageHeight. + */ + public void setPackImageHeight(int packImageHeight) { + + this.packImageHeight = packImageHeight; + } + + /** + * Getter for property unpackAlignment. + * @return Value of property unpackAlignment. + */ + public int getUnpackAlignment() { + + return this.unpackAlignment; + } + + /** + * Setter for property unpackAlignment. + * @param unpackAlignment New value of property unpackAlignment. + */ + public void setUnpackAlignment(int unpackAlignment) { + + this.unpackAlignment = unpackAlignment; + } + + /** + * Getter for property unpackRowLength. + * @return Value of property unpackRowLength. + */ + public int getUnpackRowLength() { + + return this.unpackRowLength; + } + + /** + * Setter for property unpackRowLength. + * @param unpackRowLength New value of property unpackRowLength. + */ + public void setUnpackRowLength(int unpackRowLength) { + + this.unpackRowLength = unpackRowLength; + } + + /** + * Getter for property unpackSkipRows. + * @return Value of property unpackSkipRows. + */ + public int getUnpackSkipRows() { + + return this.unpackSkipRows; + } + + /** + * Setter for property unpackSkipRows. + * @param unpackSkipRows New value of property unpackSkipRows. + */ + public void setUnpackSkipRows(int unpackSkipRows) { + + this.unpackSkipRows = unpackSkipRows; + } + + /** + * Getter for property unpackSkipPixels. + * @return Value of property unpackSkipPixels. + */ + public int getUnpackSkipPixels() { + + return this.unpackSkipPixels; + } + + /** + * Setter for property unpackSkipPixels. + * @param unpackSkipPixels New value of property unpackSkipPixels. + */ + public void setUnpackSkipPixels(int unpackSkipPixels) { + + this.unpackSkipPixels = unpackSkipPixels; + } + + /** + * Getter for property unpackLsbFirst. + * @return Value of property unpackLsbFirst. + */ + public boolean getUnpackLsbFirst() { + + return this.unpackLsbFirst; + } + + /** + * Setter for property unpackLsbFirst. + * @param unpackLsbFirst New value of property unpackLsbFirst. + */ + public void setUnpackLsbFirst(boolean unpackLsbFirst) { + + this.unpackLsbFirst = unpackLsbFirst; + } + + /** + * Getter for property unpackSwapBytes. + * @return Value of property unpackSwapBytes. + */ + public boolean getUnpackSwapBytes() { + + return this.unpackSwapBytes; + } + + /** + * Setter for property unpackSwapBytes. + * @param unpackSwapBytes New value of property unpackSwapBytes. + */ + public void setUnpackSwapBytes(boolean unpackSwapBytes) { + + this.unpackSwapBytes = unpackSwapBytes; + } + + /** + * Getter for property unpackSkipImages. + * @return Value of property unpackSkipImages. + */ + public int getUnpackSkipImages() { + + return this.unpackSkipImages; + } + + /** + * Setter for property unpackSkipImages. + * @param unpackSkipImages New value of property unpackSkipImages. + */ + public void setUnpackSkipImages(int unpackSkipImages) { + + this.unpackSkipImages = unpackSkipImages; + } + + /** + * Getter for property unpackImageHeight. + * @return Value of property unpackImageHeight. + */ + public int getUnpackImageHeight() { + + return this.unpackImageHeight; + } + + /** + * Setter for property unpackImageHeight. + * @param unpackImageHeight New value of property unpackImageHeight. + */ + public void setUnpackImageHeight(int unpackImageHeight) { + + this.unpackImageHeight = unpackImageHeight; + } + + +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java b/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java new file mode 100644 index 000000000..e000c2043 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java @@ -0,0 +1,2437 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import javax.media.opengl.GL; +import javax.media.opengl.glu.GLU; +import java.nio.*; + +/** + * + * @author Administrator + */ +public class ScaleInternal { + + public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); + + public static void scale_internal( int components, int widthin, int heightin, + ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { + float x, lowx, highx, convx, halfconvx; + float y, lowy, highy, convy, halfconvy; + float xpercent, ypercent; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, yint, xint, xindex, yindex; + int temp; + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage( components, widthin, heightin, datain, dataout ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + halfconvx = convx / 2; + halfconvy = convy / 2; + for( i = 0; i < heightout; i++ ) { + y = convy * ( i + 0.5f ); + if( heightin > heightout ) { + highy = y + halfconvy; + lowy = y - halfconvy; + } else { + highy = y + 0.5f; + lowy = y - 0.5f; + } + for( j = 0; j < widthout; j++ ) { + x = convx * ( j + 0.5f ); + if( widthin > widthout ) { + highx = x + halfconvx; + lowx = x - halfconvx; + } else { + highx = x + 0.5f; + lowx = x - 0.5f; + } + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + area = 0.0f; + + y = lowy; + yint = (int)Math.floor( y ); + while( y < highy ) { + yindex = ( yint + heightin ) % heightin; + if( highy < yint + 1 ) { + ypercent = highy - y; + } else { + ypercent = yint + 1 - y; + } + + x = lowx; + xint = (int)Math.floor( x ); + + while( x < highx ) { + xindex = ( xint + widthin ) % widthin; + if( highx < xint + 1 ) { + xpercent = highx -x; + } else { + xpercent = xint + 1 - x; + } + + percent = xpercent * ypercent; + area += percent; + temp = ( xindex + ( yindex * widthin) ) * components; + for( k = 0; k < components; k++ ) { + totals[k] += datain.get( temp + k ) * percent; + } + + xint++; + x = xint; + } + yint++; + y = yint; + } + + temp = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + // totals[] should be rounded in the case of enlarging an RGB + // ramp when the type is 332 or 4444 + dataout.put( temp + k, (short)((totals[k] + 0.5f) / area) ); + } + } + } + } + + public static void scale_internal_ubyte( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + ByteBuffer dataout, int element_size, int ysize, int group_size ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_ubyte( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size ); + return; + } + convy = (float)heightin / heightout; + convx = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * y_percent; + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + float f = 0.0f; + datain.position( left ); + f = ( 0x000000FF & datain.get() ) * ( 1.0f - lowx_float ); + datain.position( right ); + f += ( 0x000000FF & datain.get() ) * highx_float; + totals[k] += f; + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * x_percent; + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ) * percent; + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += ( 0x000000FF & datain.get() ); + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + dataout.position( outindex + k ); + dataout.put( (byte)(totals[k] / area) ); + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scale_internal_byte( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + ByteBuffer dataout, int element_size, int ysize, + int group_size ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_byte( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * y_percent; + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + float f = 0.0f; + datain.position( left ); + f = datain.get() * ( 1 - lowx_float ); + datain.position( right ); + f += datain.get() * highx_float; + totals[k] += f; + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * x_percent; + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get() * percent; + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + totals[k] += datain.get(); + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + dataout.position( outindex + k ); + dataout.put( (byte)(totals[k] / area) ); + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scale_internal_ushort( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + ShortBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_ushort( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size, myswap_bytes ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; + } else { + totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; + } + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; + } else { + totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; + } else { + totals[k] += ( 0x0000FFFF & datain.getShort()) * percent; + } + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; + } else { + totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * y_percent; + } else { + totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; + } else { + totals[k] += ( 0x0000FFFF & datain.getShort()) * percent; + } + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + if( myswap_bytes ) { + datain.position( left ); + float f = (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES(datain.getShort())) * ( 1 - lowx_float ); + datain.position( right ); + f += ((0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES(datain.getShort())) * highx_float); + totals[k] += f; + } else { + datain.position( left ); + float f = ((0x0000FFFF & datain.getShort()) * ( 1 - lowx_float )); + datain.position( right ); + f += ((0x0000FFFF & datain.getShort()) * highx_float); + totals[k] += f; + } + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() )) * percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * percent; + } + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * x_percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() )) * percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * percent; + } + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * y_percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * percent; + } + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; + } else { + totals[k] += (0x0000FFFF & datain.getShort()) * percent; + } + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort())); + } else { + totals[k] += (0x0000FFFF & datain.getShort()); + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + dataout.position( outindex + k ); + dataout.put( (short)(totals[k] / area) ); + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scale_internal_short( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + ShortBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + int swapbuf; // unsigned buffer + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_short( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size, myswap_bytes ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getShort() * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getShort() * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + if( myswap_bytes ) { + datain.position( left ); + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * ( 1 - lowx_float ); + datain.position( right ); + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * highx_float; + } else { + datain.position( left ); + totals[k] += datain.getShort() * ( 1 - lowx_float ); + datain.position( right ); + totals[k] += datain.getShort() * highx_float; + } + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort()); + totals[k] += swapbuf * x_percent; + } else { + totals[k] += datain.getShort() * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getShort() * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getShort() * percent; + } + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); + totals[k] += swapbuf; + } else { + totals[k] += datain.getShort(); + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + dataout.position( outindex + k ); + dataout.put( (short)(totals[k] / area) ); + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scale_internal_uint( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + IntBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_uint( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size, myswap_bytes ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * y_percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * y_percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + if( myswap_bytes ) { + datain.position( left ); + totals[k] += ((0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES(datain.getInt())) * ( 1 - lowx_float )); + datain.position( right ); + totals[k] += ((0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES(datain.getInt())) * highx_float); + } else { + datain.position( left ); + totals[k] += ((0x00000000FFFFFFFF & datain.getInt()) * ( 1 - lowx_float )); + datain.position( right ); + totals[k] += ((0x00000000FFFFFFFF & datain.getInt()) * highx_float); + } + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * x_percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * y_percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); + datain.position( temp_index ); + long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; + } + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())); + } else { + totals[k] += (0x00000000FFFFFFFF & datain.getInt()); + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + float value = 0.0f; + for( k = 0; k < components; k++ ) { + value = totals[k] / area; + dataout.position( outindex + k ); + if( value >= UINT_MAX ) { + dataout.put( (int)value ); + } else { + dataout.put( (int)(totals[k] / area) ); + } + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scale_internal_int( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + IntBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + long swapbuf; // unsigned buffer + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_int( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size, myswap_bytes ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getInt() * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getInt() * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + if( myswap_bytes ) { + datain.position( left ); + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * ( 1 - lowx_float ); + datain.position( right ); + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * highx_float; + } else { + datain.position( left ); + totals[k] += (datain.getInt() * ( 1 - lowx_float )); + datain.position( right ); + totals[k] += (datain.getInt() * highx_float); + } + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * x_percent; + } else { + totals[k] += datain.getInt() * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getInt() * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getInt() * percent; + } + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); + totals[k] += swapbuf; + } else { + totals[k] += datain.getInt(); + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + dataout.position( outindex + k ); + dataout.put( (int)(totals[k] / area) ); + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scale_internal_float( int components, int widthin, int heightin, + ByteBuffer datain, int widthout, int heightout, + FloatBuffer dataout, int element_size, int ysize, + int group_size, boolean myswap_bytes ) { + float x, convx; + float y, convy; + float percent; + // Max components in a format is 4, so... + float[] totals = new float[4]; + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + float swapbuf; // unsigned buffer + + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { + HalveImage.halveImage_float( components, widthin, heightin, datain, dataout, + element_size, ysize, group_size, myswap_bytes ); + return; + } + convx = (float)heightin / heightout; + convy = (float)widthin / widthout; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convy_float; + + for( i = 0; i < heightout; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthout; j++ ) { + + // Ok, now apply box filter to box that goes from (lowx, lowy) + // to (highx, highy) on input data into this pixel on output + // data. + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // caulate the value for pixels in the 1st row + xindex = lowx_int * group_size; + if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * ysize; + percent = y_percent * ( 1 - lowx_float ); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getFloat() * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + + // calculate the value for pixels in the last row + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getFloat() * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + + // calculate the value for the pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += ysize; + right += ysize; + for( k = 0; k < components; k++, left += element_size, right += element_size ) { + if( myswap_bytes ) { + datain.position( left ); + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * ( 1 - lowx_float ); + datain.position( right ); + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * highx_float; + } else { + datain.position( left ); + totals[k] += (datain.getFloat() * ( 1 - lowx_float )); + datain.position( right ); + totals[k] += (datain.getFloat() * highx_float); + } + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float) * x_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * x_percent; + } else { + totals[k] += datain.getFloat() * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += group_size; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * y_percent; + } else { + totals[k] += datain.getFloat() * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + (lowy_int * ysize); + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf * percent; + } else { + totals[k] += datain.getFloat() * percent; + } + } + } + + // this is for the pixels in the body + temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { + datain.position( temp_index ); + if( myswap_bytes ) { + swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); + totals[k] += swapbuf; + } else { + totals[k] += datain.getFloat(); + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = ( j + ( i * widthout ) ) * components; + for( k = 0; k < components; k++ ) { + dataout.position( outindex + k ); + dataout.put( (totals[k] / area) ); + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + } + + public static void scaleInternalPackedPixel( int components, Extract extract, + int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, + int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, + int rowSizeInBytes, boolean isSwap ) { + float x, convx; + float y, convy; + float percent; + + // max components in a format is 4, so + float[] totals = new float[4]; + float[] extractTotals = new float[4]; + float[] extractMoreTotals = new float[4]; + float[] shoveTotals = new float[4]; + + float area; + int i, j, k, xindex; + + int temp, temp0; + int temp_index; + int outIndex = 0; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + int left, right; + + if( widthIn == widthOut * 2 && heightIn == heightOut * 2 ) { + HalveImage.halveImagePackedPixel( components, extract, widthIn, heightIn, dataIn, dataOut, + pixelSizeInBytes, rowSizeInBytes, isSwap ); + return; + } + convy = (float)heightIn / (float)heightOut; + convx = (float)widthIn / (float)widthOut; + convy_int = (int)Math.floor( convy ); + convy_float = convy - convy_int; + convx_int = (int)Math.floor( convx ); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0.0f; + highy_int = convy_int; + highy_float = convx_float; + + for( i = 0; i < heightOut; i++ ) { + // Clamp here to be sure we don't read beyond input buffer. + if (highy_int >= heightIn) + highy_int = heightIn - 1; + lowx_int = 0; + lowx_float = 0.0f; + highx_int = convx_int; + highx_float = convx_float; + + for( j = 0; j < widthOut; j++ ) { + // ok now apply box filter to box that goes from( lowx, lowy ) + // to ( highx, highy ) on input data into this pixel on output data + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + + // calculate that value for pixels in the 1st row + xindex = lowx_int * pixelSizeInBytes; + if( (highy_int > lowy_int) && (highx_int > lowx_int) ) { + + y_percent = 1 - lowy_float; + temp = xindex + lowy_int * rowSizeInBytes; + percent = y_percent * ( 1 - lowx_float ); + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + left = temp; + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += pixelSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * y_percent; + } + } + temp += pixelSizeInBytes; + right = temp; + percent = y_percent * highx_float; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + // calculate the value for pixels in the last row + + y_percent = highy_float; + percent = y_percent * ( 1 - lowx_float ); + temp = xindex + highy_int * rowSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += pixelSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * y_percent; + } + } + temp += pixelSizeInBytes; + percent = y_percent * highx_float; + dataIn.position( temp ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + + // calculate the value for pixels in the 1st and last column + for( m = lowy_int + 1; m < highy_int; m++ ) { + left += rowSizeInBytes; + right += rowSizeInBytes; + dataIn.position( left ); + extract.extract( isSwap, dataIn, extractTotals ); + dataIn.position( right ); + extract.extract( isSwap, dataIn, extractMoreTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += ( extractTotals[k] * ( 1 - lowx_float ) + extractMoreTotals[k] * highx_float ); + } + } + } else if( highy_int > lowy_int ) { + x_percent = highx_float - lowx_float; + percent = ( 1 - lowy_float ) * x_percent; + temp = xindex + lowy_int * rowSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp += rowSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * x_percent; + } + } + percent = x_percent * highy_float; + temp += rowSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + } else if( highx_int > lowx_int ) { + y_percent = highy_float - lowy_float; + percent = ( 1 - lowx_float ) * y_percent; + temp = xindex + lowy_int * rowSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + for( l = lowx_int + 1; l < highx_int; l++ ) { + temp += pixelSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * y_percent; + } + } + temp += pixelSizeInBytes; + percent = y_percent * highx_float; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + } else { + percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); + temp = xindex + lowy_int * rowSizeInBytes; + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + } + + // this is for the pixels in the body + temp0 = xindex + pixelSizeInBytes + ( lowy_int + 1 ) * rowSizeInBytes; + for( m = lowy_int + 1; m < highy_int; m++ ) { + temp = temp0; + for( l = lowx_int + 1; l < highx_int; l++ ) { + dataIn.position( temp ); + extract.extract( isSwap, dataIn, extractTotals ); + for( k = 0; k < components; k++ ) { + totals[k] += extractTotals[k] * percent; + } + temp += pixelSizeInBytes; + } + temp0 += rowSizeInBytes; + } + + outIndex = ( j + ( i * widthOut ) ); + for( k = 0; k < components; k++ ) { + shoveTotals[k] = totals[k] / area; + } + extract.shove( shoveTotals, outIndex, dataOut ); + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if( highx_float > 1.0f ) { + highx_float -= 1.0f; + highx_int++; + } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthIn - 1) { + int delta = (highx_int - widthIn + 1); + lowx_int -= delta; + highx_int -= delta; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if( highy_float > 1.0f ) { + highy_float -= 1.0f; + highy_int++; + } + } + assert( outIndex == ( widthOut * heightOut - 1) ); + } + + public static void scaleInternal3D( int components, int widthIn, int heightIn, + int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, + int depthOut, ShortBuffer dataOut ) { + float x, lowx, highx, convx, halfconvx; + float y, lowy, highy, convy, halfconvy; + float z, lowz, highz, convz, halfconvz; + float xpercent, ypercent, zpercent; + float percent; + // max compnents in a format is 4 + float[] totals = new float[4]; + float volume; + int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; + int temp; + + lowy = highy = lowx = highx = 0.0f; + + convz = (float)depthIn / depthOut; + convy = (float)heightIn / heightOut; + convx = (float)widthIn / widthOut; + halfconvz = convz / 2.0f; + halfconvy = convy / 2.0f; + halfconvx = convx / 2.0f; + for( d = 0; d < depthOut; d++ ) { + z = convz * ( d + 0.5f ); + if( depthIn > depthOut ) { + highz = z + halfconvz; + lowz = z - halfconvz; + } else { + highz = z + 0.5f; + lowz = z - 0.5f; + } + for( i = 0; i < heightOut; i++ ) { + y = convy * ( i + 0.5f ); + if( heightIn > heightOut ) { + highz = y + halfconvy; + lowz = y - halfconvy; + } else { + highz = y + 0.5f; + lowz = y - 0.5f; + } + for( j = 0; j < widthOut; j++ ) { + x = convx * ( j + 0.5f ); + if( depthIn > depthOut ) { + highz = x + halfconvx; + lowz = x - halfconvx; + } else { + highz = x + 0.5f; + lowz = x - 0.5f; + } + + // Ok, now apply box filter to box that goes from ( lowx, lowy, lowz ) + // to ( highx, highy, highz ) on input data into this pixel on output data + + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; + volume = 0.0f; + + z = lowz; + zint = (int)(Math.floor( z ) ); + while( z < highz ) { + zindex = ( zint + depthIn ) % depthIn; + if( highz < zint + 1 ) { + zpercent = highz - z; + } else { + zpercent = zint + 1 - z; + } + + y = lowy; + yint = (int)(Math.floor( y ) ); + while( y < highy ) { + yindex = ( yint + heightIn ) % heightIn; + if( highy < yint + 1 ) { + ypercent = highy - y; + } else { + ypercent = yint + 1 - y; + } + + x = lowx; + xint = (int)(Math.floor( x ) ); + + while( x < highx ) { + xindex = (xint + widthIn ) % widthIn; + if( highx < xint + 1 ) { + xpercent = highx - x; + } else { + xpercent = xint + 1 - x; + } + + percent = xpercent * ypercent * zpercent; + volume += percent; + + temp = (xindex + ( yindex *widthIn) + (zindex * widthIn *heightIn)) * components; + for( k = 0; k < components; k++ ) { + assert( 0 <= (temp+k) && (temp+k) < (widthIn * heightIn * depthIn * components) ); + totals[k] += dataIn.get( temp + k ) * percent; + } + xint++; + x = xint; + } // while x + yint++; + y = yint; + } // while y + zint++; + z = zint; + } // while z + + temp = ( j + ( i * widthOut ) + (d * widthOut * heightOut ) ) * components; + for( k = 0; k < components; k++ ) { + // totals should be rounded in the case of enlarging an rgb ramp when the type is 332 or 4444 + assert( 0 <= ( temp + k ) && ( temp + k ) < (widthOut * heightOut* depthOut * components) ); + dataOut.put( temp + k, (short)((totals[k] + 0.5f) / volume ) ); + } + } + } + } + } + + public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, + int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, + int depthOut, int typeOut, ByteBuffer dataOut ) { + int components; + ShortBuffer beforeImage, afterImage; + PixelStorageModes psm = new PixelStorageModes(); + + if( widthIn == 0 || heightIn == 0 || depthIn == 0 || + widthOut == 0 || heightOut == 0 || depthOut == 0 ) { + return( 0 ); + } + + if( widthIn < 0 || heightIn < 0 || depthIn < 0 || + widthOut < 0 || heightOut < 0 || depthOut < 0 ) { + return( GLU.GLU_INVALID_VALUE ); + } + + if( !Mipmap.legalFormat(format) || !Mipmap.legalType(typeIn) || + !Mipmap.legalType(typeOut) || typeIn == GL.GL_BITMAP || + typeOut == GL.GL_BITMAP ) { + return( GLU.GLU_INVALID_ENUM ); + } + + if( !Mipmap.isLegalFormatForPackedPixelType( format, typeIn ) ) { + return( GLU.GLU_INVALID_OPERATION ); + } + + if( !Mipmap.isLegalFormatForPackedPixelType( format, typeOut ) ) { + return( GLU.GLU_INVALID_OPERATION ); + } + + try { + beforeImage = ByteBuffer.allocateDirect( Mipmap.imageSize3D( widthIn, + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).order( + ByteOrder.nativeOrder() ).asShortBuffer(); + afterImage = ByteBuffer.allocateDirect( Mipmap.imageSize3D( widthIn, + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).order( + ByteOrder.nativeOrder() ).asShortBuffer(); + } catch( OutOfMemoryError err ) { + return( GLU.GLU_OUT_OF_MEMORY ); + } + Mipmap.retrieveStoreModes3D( gl, psm ); + + Image.fillImage3D( psm, widthIn, heightIn, depthIn, format, typeIn, + Mipmap.is_index( format ), dataIn, beforeImage ); + components = Mipmap.elements_per_group( format, 0 ); + ScaleInternal.scaleInternal3D( components, widthIn, heightIn, depthIn, + beforeImage, widthOut, heightOut, depthOut, afterImage ); + Image.emptyImage3D( psm, widthOut, heightOut, depthOut, format, typeOut, + Mipmap.is_index( format ), afterImage, dataOut ); + + return( 0 ); + } +} diff --git a/src/classes/com/sun/opengl/impl/mipmap/Type_Widget.java b/src/classes/com/sun/opengl/impl/mipmap/Type_Widget.java new file mode 100644 index 000000000..0431748e9 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/mipmap/Type_Widget.java @@ -0,0 +1,214 @@ +/* + * License Applicability. Except to the extent portions of this file are + * made subject to an alternative license as permitted in the SGI Free + * Software License B, Version 1.1 (the "License"), the contents of this + * file are subject only to the provisions of the License. You may not use + * this file except in compliance with the License. You may obtain a copy + * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 + * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: + * + * http://oss.sgi.com/projects/FreeB + * + * Note that, as provided in the License, the Software is distributed on an + * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS + * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND + * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. + * + * Original Code. The Original Code is: OpenGL Sample Implementation, + * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, + * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. + * Copyright in any portions created by third parties is as indicated + * elsewhere herein. All Rights Reserved. + * + * Additional Notice Provisions: The application programming interfaces + * established by SGI in conjunction with the Original Code are The + * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released + * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version + * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X + * Window System(R) (Version 1.3), released October 19, 1998. This software + * was created using the OpenGL(R) version 1.2.1 Sample Implementation + * published by SGI, but has not been independently verified as being + * compliant with the OpenGL(R) version 1.2.1 Specification. + */ + +package com.sun.opengl.impl.mipmap; + +import java.nio.*; + +/** + * + * @author Administrator + */ +public class Type_Widget { + + ByteBuffer buffer; + + /** Creates a new instance of Type_Widget */ + public Type_Widget() { + buffer = ByteBuffer.allocate( 4 ); + } + + public void setUB0( byte b ) { + buffer.position( 0 ); + buffer.put( b ); + } + + public byte getUB0() { + buffer.position( 0 ); + return( buffer.get() ); + } + + public void setUB1( byte b ) { + buffer.position( 1 ); + buffer.put( b ); + } + + public byte getUB1() { + buffer.position( 1 ); + return( buffer.get() ); + } + + public void setUB2( byte b ) { + buffer.position( 2 ); + buffer.put( b ); + } + + public byte getUB2() { + buffer.position( 2 ); + return( buffer.get() ); + } + + public void setUB3( byte b ) { + buffer.position( 3 ); + buffer.put( b ); + } + + public byte getUB3() { + buffer.position( 3 ); + return( buffer.get() ); + } + + public void setUS0( short s ) { + buffer.position( 0 ); + buffer.putShort( s ); + } + + public short getUS0() { + buffer.position( 0 ); + return( buffer.getShort() ); + } + + public void setUS1( short s ) { + buffer.position( 2 ); + buffer.putShort( s ); + } + + public short getUS1() { + buffer.position( 2 ); + return( buffer.getShort() ); + } + + public void setUI( int i ) { + buffer.position( 0 ); + buffer.putInt( i ); + } + + public int getUI() { + buffer.position( 0 ); + return( buffer.getInt() ); + } + + public void setB0( byte b ) { + buffer.position( 0 ); + buffer.put( b ); + } + + public byte getB0() { + buffer.position( 0 ); + return( buffer.get() ); + } + + public void setB1( byte b ) { + buffer.position( 1 ); + buffer.put( b ); + } + + public byte getB1() { + buffer.position( 1 ); + return( buffer.get() ); + } + + public void setB2( byte b ) { + buffer.position( 2 ); + buffer.put( b ); + } + + public byte getB2() { + buffer.position( 2 ); + return( buffer.get() ); + } + + public void setB3( byte b ) { + buffer.position( 3 ); + buffer.put( b ); + } + + public byte getB3() { + buffer.position( 3 ); + return( buffer.get() ); + } + + public void setS0( short s ) { + buffer.position( 0 ); + buffer.putShort( s ); + } + + public short getS0() { + buffer.position( 0 ); + return( buffer.getShort() ); + } + + public void setS1( short s ) { + buffer.position( 2 ); + buffer.putShort( s ); + } + + public short getS1() { + buffer.position( 2 ); + return( buffer.getShort() ); + } + + public void setI( int i ) { + buffer.position( 0 ); + buffer.putInt( i ); + } + + public int getI() { + buffer.position( 0 ); + return( buffer.getInt() ); + } + + public void setF( float f ) { + buffer.position( 0 ); + buffer.putFloat( f ); + } + + public float getF() { + buffer.position( 0 ); + return( buffer.getFloat() ); + } + + public ByteBuffer getBuffer() { + buffer.rewind(); + return( buffer ); + } + + public static void main( String args[] ) { + Type_Widget t = new Type_Widget(); + t.setI( 1000000 ); + + System.out.println("int: " + Integer.toHexString( t.getI() ) ); + + } +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/README-PORTING.txt b/src/classes/com/sun/opengl/impl/nurbs/README-PORTING.txt new file mode 100644 index 000000000..df5f41782 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/README-PORTING.txt @@ -0,0 +1,40 @@ +This is a currently incomplete port of SGI's GLU NURBS library from +C++ to Java. There are a few reasons for doing such a port: + + - The C interface is structured around function pointers. It is + generally difficult to bind such interfaces up to Java. + + - Some people have reported crashes on certain Linux distributions + when trying to use any routines out of the C GLU library. To date + we have not been able to diagnose the root cause of these failures. + Porting the code involved from C++ to Java has solved these + problems. + +The port so far has been started in the internals/ directory. The C++ +sources have been gone through roughly alphabetically and +transliterated into the appropriate files. The large Subdivider class +was the current focus of attention at the time of this writing, and a +closer look indicates that at least a few classes were skipped on the +way down to some of the Subdivider's sources like intersect.cc. It may +be a good idea to continue the port in this directory first, since it +looks like the other directories' sources are built on top of these +and it would be good to firm up the Java interfaces for the internals +(and perhaps get the sources to compile) before porting lots of code +built on top of them. + +A couple of notes on the translation: + + - All object pool classes have been removed. The intention is to have + a static allocate() method on the appropriate classes which will + instantiate populated arrays of these types (not just arrays of + null references). See uses of TrimVertex.allocate(). + + - There are a significant number of places in the original C++ code + where pointer arithmetic is used. Some of these are not obvious + until the code has been ported and examined. Bin.java was a good + example of this where the algorithms needed some restructuring. At + the time of this writing intersect.cc was in the process of being + ported and it wasn't clear whether we would need to change some of + the APIs or add more utility routines to be able to do pointer + arithmetic on, for example, the TrimVertex arrays returned from the + allocate() routine. diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/Arc.java b/src/classes/com/sun/opengl/impl/nurbs/internals/Arc.java new file mode 100644 index 000000000..076c68b72 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/Arc.java @@ -0,0 +1,274 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* an arc, in two list, the trim list and bin */ +public class Arc { + public static final int SIDE_NONE = 0; + public static final int SIDE_RIGHT = 1; + public static final int SIDE_TOP = 2; + public static final int SIDE_LEFT = 3; + public static final int SIDE_BOTTOM = 4; + + public static final int bezier_tag = (1 << 13); + public static final int arc_tag = (1 << 3); + public static final int tail_tag = (1 << 6); + public Arc prev; /* trim list pointer */ + public Arc next; /* trim list pointer */ + public Arc link; /* bin pointers */ + public BezierArc bezierArc; /* associated bezier arc */ + public PwlArc pwlArc; /* associated pwl arc */ + public long type; /* curve type */ + public long nuid; + + private static final float ZERO = 0.00001f; + + public Arc(Arc j, PwlArc p) { + pwlArc = p; + type = j.type; + nuid = j.nuid; + } + + public Arc(int arcSide, long nuid) { + type = 0; + setside(arcSide); + this.nuid = nuid; + } + + public Arc append(Arc jarc) { + if ( jarc != null ) { + next = jarc.next; + prev = jarc; + next.prev = prev.next = this; + } else { + next = prev = this; + } + return this; + } + + public boolean check() { + Arc jarc = this; + do { + assert( (jarc.pwlArc != null) || (jarc.bezierArc != null) ); + + if (jarc.prev == 0 || jarc.next == 0) { + System.out.println( "checkjarc:null next/prev pointer"); + jarc.print( ); + return false; + } + + if (jarc.next.prev != jarc) { + System.out.println( "checkjarc: pointer linkage screwed up"); + jarc.print( ); + return false; + } + + if( jarc.pwlArc != null ) { + assert( jarc.pwlArc.npts >= 1 ); + assert( jarc.pwlArc.npts < 100000 ); + if( jarc.prev.pwlArc != null ) { + if( jarc.tail()[1] != jarc.prev.rhead()[1] ) { + System.out.println( "checkjarc: geometric linkage screwed up 1"); + jarc.prev.show(); + jarc.show(); + return false; + } + if( jarc.tail()[0] != jarc.prev.rhead()[0] ) { + System.out.println( "checkjarc: geometric linkage screwed up 2"); + jarc.prev.show(); + jarc.show(); + return false; + } + } + if( jarc.next.pwlArc ) { + if( jarc.next.tail()[0] != jarc.rhead()[0] ) { + System.out.println( "checkjarc: geometric linkage screwed up 3"); + jarc.show(); + jarc.next.show(); + return false; + } + if( jarc.next.tail()[1] != jarc.rhead()[1] ) { + System.out.println( "checkjarc: geometric linkage screwed up 4"); + jarc.show(); + jarc.next.show(); + return false; + } + } + if( jarc.isbezier() ) { + assert( jarc.pwlArc.npts == 2 ); + assert( (jarc.pwlArc.pts[0].param[0] == + jarc.pwlArc.pts[1].param[0]) || + (jarc.pwlArc.pts[0].param[1] == + jarc.pwlArc.pts[1].param[1]) ); + } + } + jarc = jarc.next; + } while (jarc != this); + return true; + } + + /** + * Checks if tail of arc and head of prev meet. + */ + public boolean isDisconnected() { + if( pwlArc == 0 ) return 0; + if( prev.pwlArc == 0 ) return 0; + + float[] p0 = tail(); + float[] p1 = prev.rhead(); + + if( ((p0[0] - p1[0]) > ZERO) || ((p1[0] - p0[0]) > ZERO) || + ((p0[1] - p1[1]) > ZERO) || ((p1[1] - p0[1]) > ZERO) ) { + return true; + } else { + /* average two points together */ + p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5f; + p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5f; + return false; + } + } + + /** + * Counts number of points on arc loop. + */ + public int numpts( ) { + Arc jarc = this; + int npts = 0; + do { + npts += jarc.pwlArc.npts; + jarc = jarc.next; + } while( jarc != this ); + return npts; + } + + /** + * Marks each point with id of arc. + */ + public void markverts( void ) { + Arc jarc = this; + + do { + TrimVertex p = jarc.pwlArc.pts; + for( int i=0; i rightpt || + (jarc.tail()[0] >= rightpt && jarc.rhead()[0] >= rightpt)) { + rightpt = jarc.pwlArc.pts.param[0]; + extrema[3] = jarc; + } + if ( jarc.tail()[1] < botpt || + (jarc.tail()[1] <= botpt && jarc.rhead()[1] <= botpt )) { + botpt = jarc.pwlArc.pts.param[1]; + extrema[2] = jarc; + } + if ( jarc.tail()[1] > toppt || + (jarc.tail()[1] >= toppt && jarc.rhead()[1] >= toppt)) { + toppt = jarc.pwlArc.pts.param[1]; + extrema[0] = jarc; + } + } + } + + /** + * Prints out the vertices of all pwl arcs on a loop. + */ + public void print( ) { + Arc jarc = this; + + do { + jarc.show( ); + jarc = jarc.next; + } while (jarc != this); + } + + public void show( ) { + System.out.println( "\tPWLARC NP: " + pwlArc.npts + " FL: 1"); + for( int i = 0; i < pwlArc.npts; i++ ) { + System.out.println( "\t\tVERTEX " + pwlArc.pts[i].param[0] + " " + + pwlArc.pts[i].param[1] ); + } + } + + /** + * Attaches a pwl arc to an arc and mark it as a border arc. + */ + public void makeSide( PwlArc pwl, int arcSide ) { + assert( pwl != 0); + assert( pwlArc == 0 ); + assert( pwl.npts > 0 ); + assert( pwl.pts != 0); + pwlArc = pwl; + clearbezier(); + setside( arcSide ); + } + + public boolean isTessellated() { return (pwlArc != null); } + public boolean isbezier() { return (type & bezier_tag) != 0; } + public void setbezier() { type |= bezier_tag; } + public void clearbezier() { type &= ~bezier_tag; } + public long npts() { return pwlArc.npts; } + public TrimVertex[] pts() { return pwlArc.pts; } + public float[] tail() { return pwlArc.pts[0].param; } + public float[] head() { return next.pwlArc.pts[0].param; } + public float[] rhead() { return pwlArc.pts[pwlArc.npts-1].param; } + public long ismarked() { return type & arc_tag; } + public void setmark() { type |= arc_tag; } + public void clearmark() { type &= (~arc_tag); } + public void clearside() { type &= ~(0x7 << 8); } + public void setside( int arcSide ) { clearside(); type |= (((long)arcSide)<<8); } + public int getside() { return ((type>>8) & 0x7); } + public int getitail() { return type & tail_tag; } + public void setitail() { type |= tail_tag; } + public void clearitail() { type &= (~tail_tag); } +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/ArcTesselator.java b/src/classes/com/sun/opengl/impl/nurbs/internals/ArcTesselator.java new file mode 100644 index 000000000..cb77dfbd0 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/ArcTesselator.java @@ -0,0 +1,449 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class ArcTessellator { + /** + * Constructs a bezier arc and attaches it to an Arc. + */ + public void bezier( Arc arc, float s1, float s2, float t1, float t2 ) { + assert( arc != null ); + assert( ! arc.isTessellated() ); + + switch( arc.getside() ) { + case Arc.SIDE_LEFT: + assert( s1 == s2 ); + assert( t2 < t1 ); + break; + case Arc.SIDE_RIGHT: + assert( s1 == s2 ); + assert( t1 < t2 ); + break; + case Arc.SIDE_TOP: + assert( t1 == t2 ); + assert( s2 < s1 ); + break; + case Arc.SIDE_BOTTOM: + assert( t1 == t2 ); + assert( s1 < s2 ); + break; + case Arc.SIDE_NONE: + throw new InternalError(); + break; + } + + TrimVertex[] p = TrimVertex.allocate(2); + arc.pwlArc = new PwlArc( p ); + p[0].param[0] = s1; + p[0].param[1] = t1; + p[1].param[0] = s2; + p[1].param[1] = t2; + assert( (s1 == s2) || (t1 == t2) ); + arc.setbezier(); + } + + /** + * Constructs a pwl arc and attaches it to an arc. + */ + public void pwl( Arc arc, float s1, float s2, float t1, float t2, float rate ) { + int snsteps = 1 + (int) (Math.abs(s2 - s1) / rate ); + int tnsteps = 1 + (int) (Math.abs(t2 - t1) / rate ); + int nsteps = (int) Math.max(1, Math.max( snsteps, tnsteps )); + + float sstepsize = (s2 - s1) / (float) nsteps; + float tstepsize = (t2 - t1) / (float) nsteps; + TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); + long i; + for( i = 0; i < nsteps; i++ ) { + newvert[i].param[0] = s1; + newvert[i].param[1] = t1; + s1 += sstepsize; + t1 += tstepsize; + } + newvert[i].param[0] = s2; + newvert[i].param[1] = t2; + + arc.pwlArc = new PwlArc( newvert ); + + arc.clearbezier(); + arc.clearside( ); + } + + /** + * Constructs a left boundary pwl arc and attaches it to an arc. + */ + public void pwl_left( Arc arc, float s, float t1, float t2, float rate ) { + assert( t2 < t1 ); + + int nsteps = steps_function(t1, t2, rate); + + float stepsize = (t1 - t2) / (float) nsteps; + + TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); + int i; + for( i = nsteps; i > 0; i-- ) { + newvert[i].param[0] = s; + newvert[i].param[1] = t2; + t2 += stepsize; + } + newvert[i].param[0] = s; + newvert[i].param[1] = t1; + + arc.makeSide( new PwlArc( newvert ), Arc.SIDE_LEFT ); + } + + /** + * Constructs a right boundary pwl arc and attaches it to an arc. + */ + public void pwl_right( Arc arc, float s, float t1, float t2, float rate ) { + assert( t1 < t2 ); + + int nsteps = steps_function(t2,t1,rate); + float stepsize = (t2 - t1) / (float) nsteps; + + TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); + int i; + for( i = 0; i < nsteps; i++ ) { + newvert[i].param[0] = s; + newvert[i].param[1] = t1; + t1 += stepsize; + } + newvert[i].param[0] = s; + newvert[i].param[1] = t2; + + arc.makeSide( new PwlArc( newvert ), Arc.SIDE_RIGHT ); + } + + /** + * Constructs a top boundary pwl arc and attaches it to an arc. + */ + public void pwl_top( Arc arc, float t, float s1, float s2, float rate ) { + assert( s2 < s1 ); + + int nsteps = steps_function(s1,s2,rate); + float stepsize = (s1 - s2) / (float) nsteps; + + TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); + int i; + for( i = nsteps; i > 0; i-- ) { + newvert[i].param[0] = s2; + newvert[i].param[1] = t; + s2 += stepsize; + } + newvert[i].param[0] = s1; + newvert[i].param[1] = t; + + arc.makeSide( new PwlArc( newvert ), Arc.SIDE_TOP ); + } + + /** + * Constructs a bottom boundary pwl arc and attaches it to an arc. + */ + public void pwl_bottom( Arc arc, float t, float s1, float s2, float rate ) { + assert( s1 < s2 ); + + int nsteps = steps_function(s2,s1,rate); + float stepsize = (s2 - s1) / (float) nsteps; + + TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); + int i; + for( i = 0; i < nsteps; i++ ) { + newvert[i].param[0] = s1; + newvert[i].param[1] = t; + s1 += stepsize; + } + newvert[i].param[0] = s2; + newvert[i].param[1] = t; + + arc.makeSide( new PwlArc( newvert ), Arc.SIDE_BOTTOM ); + } + + /** + * Constucts a linear pwl arc and attaches it to an Arc. + */ + public void tessellateLinear( Arc arc, float geo_stepsize, float arc_stepsize, boolean isrational ) { + assert( arc.pwlArc == null ); + float s1, s2, t1, t2; + + //we don't need to scale by arc_stepsize if the trim curve + //is piecewise linear. Reason: In pwl_right, pwl_left, pwl_top, pwl_left, + //and pwl, the nsteps is computed by deltaU (or V) /stepsize. + //The quantity deltaU/arc_stepsize doesn't have any meaning. And + //it causes problems: see bug 517641 + float stepsize = geo_stepsize; /* * arc_stepsize*/; + + BezierArc b = arc.bezierArc; + + if( isrational ) { + s1 = b.cpts[0] / b.cpts[2]; + t1 = b.cpts[1] / b.cpts[2]; + s2 = b.cpts[b.stride+0] / b.cpts[b.stride+2]; + t2 = b.cpts[b.stride+1] / b.cpts[b.stride+2]; + } else { + s1 = b.cpts[0]; + t1 = b.cpts[1]; + s2 = b.cpts[b.stride+0]; + t2 = b.cpts[b.stride+1]; + } + if( s1 == s2 ) + if( t1 < t2 ) + pwl_right( arc, s1, t1, t2, stepsize ); + else + pwl_left( arc, s1, t1, t2, stepsize ); + else if( t1 == t2 ) + if( s1 < s2 ) + pwl_bottom( arc, t1, s1, s2, stepsize ); + else + pwl_top( arc, t1, s1, s2, stepsize ); + else + pwl( arc, s1, s2, t1, t2, stepsize ); + } + + /** + * Constucts a nonlinear pwl arc and attaches it to an Arc. + */ + public void tessellateNonlinear( Arc arc, float geo_stepsize, float arc_stepsize, int isrational ) { + assert( arc.pwlArc == null ); + + float stepsize = geo_stepsize * arc_stepsize; + + BezierArc *bezierArc = arc.bezierArc; + + float size; //bounding box size of the curve in UV + { + int i,j; + float min_u, min_v, max_u,max_v; + min_u = max_u = bezierArc.cpts[0]; + min_v = max_v = bezierArc.cpts[1]; + for(i=1, j=2; i max_u) + max_u = bezierArc.cpts[j]; + if(bezierArc.cpts[j+1] < min_v) + min_v = bezierArc.cpts[j+1]; + if(bezierArc.cpts[j+1] > max_v) + max_v = bezierArc.cpts[j+1]; + } + + size = max_u - min_u; + if(size < max_v - min_v) + size = max_v - min_v; + } + + /*int nsteps = 1 + (int) (1.0/stepsize);*/ + + int nsteps = (int) (size/stepsize); + if(nsteps <=0) + nsteps=1; + + TrimVertex[] vert = TrimVertex.allocate( nsteps+1 ); + float dp = 1.0/nsteps; + int vi = 0; // vertIdx + + arc.pwlArc = new PwlArc(); + arc.pwlArc.pts = vert; + + if( isrational ) { + float[] pow_u = new float[Defines.MAXORDER]; + float[] pow_v = new float[Defines.MAXORDER]; + float[] pow_w = new float[Defines.MAXORDER]; + trim_power_coeffs( bezierArc, pow_u, 0 ); + trim_power_coeffs( bezierArc, pow_v, 1 ); + trim_power_coeffs( bezierArc, pow_w, 2 ); + + /* compute first point exactly */ + float[] b = bezierArc.cpts; + vert[vi].param[0] = b[0]/b[2]; + vert[vi].param[1] = b[1]/b[2]; + + /* strength reduction on p = dp * step would introduce error */ + long order = bezierArc.order; + for( int step=1, ++vi; step= 3 ) { + surfaceEvaluator.bgnclosedline(); + if( mesh[0][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[0][3], mesh[0][0], mesh[0][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); + if( mesh[1][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[1][3], mesh[1][0], mesh[1][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); + surfaceEvaluator.evalcoord2f( nuid, u, v ); + surfaceEvaluator.endclosedline(); + } + mesh[meshindex][0] = u; + mesh[meshindex][1] = v; + mesh[meshindex][2] = 0; + mesh[meshindex][3] = nuid; + meshindex = (meshindex+1) % 2; + } else { + surfaceEvaluator.evalcoord2f( nuid, u, v ); + } + } + /** + * tmeshvert - evaluate a grid point of a triangle mesh + */ + public void tmeshvert( GridVertex g ) { + long u = g->gparam[0]; + long v = g->gparam[1]; + + npts++; + if( wireframetris ) { + if( npts >= 3 ) { + surfaceEvaluator.bgnclosedline(); + if( mesh[0][2] == 0 ) + surfaceEvaluator.evalcoord2f( (long) mesh[0][3], mesh[0][0], mesh[0][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); + if( mesh[1][2] == 0 ) + surfaceEvaluator.evalcoord2f( (long) mesh[1][3], mesh[1][0], mesh[1][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); + surfaceEvaluator.evalpoint2i( u, v ); + surfaceEvaluator.endclosedline(); + } + mesh[meshindex][0] = u; + mesh[meshindex][1] = v; + mesh[meshindex][2] = 1; + meshindex = (meshindex+1) % 2; + } else { + surfaceEvaluator.evalpoint2i( u, v ); + } + } + /** the same as tmeshvert(trimvertex), for efficiency purpose */ + public void tmeshvert( float u, float v ) { + long nuid = 0; + + npts++; + if( wireframetris ) { + if( npts >= 3 ) { + surfaceEvaluator.bgnclosedline(); + if( mesh[0][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[0][3], mesh[0][0], mesh[0][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); + if( mesh[1][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[1][3], mesh[1][0], mesh[1][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); + surfaceEvaluator.evalcoord2f( nuid, u, v ); + surfaceEvaluator.endclosedline(); + } + mesh[meshindex][0] = u; + mesh[meshindex][1] = v; + mesh[meshindex][2] = 0; + mesh[meshindex][3] = nuid; + meshindex = (meshindex+1) % 2; + } else { + surfaceEvaluator.evalcoord2f( nuid, u, v ); + } + } + /** + * linevert - evaluate a point on an outlined contour + */ + public void linevert( TrimVertex t ) { + surfaceEvaluator.evalcoord2f( t.nuid, t.param[0], t.param[1] ); + } + /** + * linevert - evaluate a grid point of an outlined contour + */ + public void linevert( GridVertex g ) { + surfaceEvaluator.evalpoint2i( g.gparam[0], g.gparam[1] ); + } + /** + * bgnoutline - preamble to outlined rendering + */ + public void bgnoutline( ) { + surfaceEvaluator.bgnline(); + } + /** + * endoutline - postamble to outlined rendering + */ + public void endoutline( ) { + surfaceEvaluator.endline(); + } + /** + * endsurf - postamble to surface + */ + public void endsurf( ) { + surfaceEvaluator.endmap2f(); + } + /** + * triangle - output a triangle + */ + public void triangle( TrimVertex a, TrimVertex b, TrimVertex c ) { + bgntfan(); + tmeshvert( a ); + tmeshvert( b ); + tmeshvert( c ); + endtfan(); + } + + public void bgntfan() { + surfaceEvaluator.bgntfan(); + } + public void endtfan() { + surfaceEvaluator.endtfan(); + } + public void bgnqstrip() { + surfaceEvaluator.bgnqstrip(); + } + public void endqstrip() { + surfaceEvaluator.endqstrip(); + } + public void evalUStrip(int n_upper, float v_upper, float[] upper_val, + int n_lower, float v_lower, float[] lower_val) { + surfaceEvaluator.evalUStrip(n_upper, v_upper, upper_val, + n_lower, v_lower, lower_val); + } + public void evalVStrip(int n_left, float u_left, float[] left_val, + int n_right, float v_right, float[] right_val) { + surfaceEvaluator.evalVStrip(n_left, u_left, left_val, + n_right, u_right, right_val); + } + public void tmeshvertNOGE(TrimVertex *t) { + // NOTE: under undefined USE_OPTTT #ifdef + } + public void tmeshvertNOGE_BU(TrimVertex *t) { + // NOTE: under undefined USE_OPTTT #ifdef + } + public void tmeshvertNOGE_BV(TrimVertex *t) { + // NOTE: under undefined USE_OPTTT #ifdef + } + public void preEvaluateBU(float u) { + surfaceEvaluator.inPreEvaluateBU_intfac(u); + } + public void preEvaluateBV(float v) { + surfaceEvaluator.inPreEvaluateBV_intfac(v); + } + + /* curve backend routines */ + public void bgncurv( void ) { + curveEvaluator.bgnmap1f( 0 ); + } + public void segment( float ulo, float uhi ) { + curveEvaluator.domain1f( ulo, uhi ); + } + public void curvpts(long type, /* geometry, color, texture, normal */ + float[] pts, /* control points */ + long stride, /* distance to next point */ + int order, /* parametric order */ + float ulo, /* lower parametric bound */ + float uhi ) /* upper parametric bound */ { + curveEvaluator.map1f( type, ulo, uhi, stride, order, pts ); + curveEvaluator.enable( type ); + } + public void curvgrid( float u0, float u1, long nu ) { + curveEvaluator.mapgrid1f( nu, u0, u1 ); + } + public void curvmesh( long from, long n ) { + curveEvaluator.mapmesh1f( N_MESHFILL, from, from+n ); + } + public void curvpt( float u ) { + curveEvaluator.evalcoord1f( 0, u ); + } + public void bgnline( ) { + curveEvaluator.bgnline(); + } + public void endline( ) { + curveEvaluator.endline(); + } + public void endcurv( ) { + curveEvaluator.endmap1f(); + } + + private boolean wireframetris; + private boolean wireframequads; + private int npts; + private float[][] mesh = new float[3][4]; + private int meshindex; +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/BasicCurveEvaluator.java b/src/classes/com/sun/opengl/impl/nurbs/internals/BasicCurveEvaluator.java new file mode 100644 index 000000000..3aae3674b --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/BasicCurveEvaluator.java @@ -0,0 +1,50 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class BasicCurveEvaluator extends CachingEvaluator { + public void domain1f(float ulo, float uhi) {} + public void range1f(long type, float[] from, float[] to) {} + + public void enable(long type) {} + public void disable(long type) {} + public void bgnmap1f(long type) {} + public void map1f(long type, float ulo, float uhi, long stride, long order, float[] pts) {} + public void mapgrid1f(long nu, float u0, float u1) {} + public void mapmesh1f(long style, long from, long to) {} + public void evalcoord1f(long type, float u) {} + public void endmap1f() {} + + public void bgnline() {} + public void endline() {} +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/BasicSurfaceEvaluator.java b/src/classes/com/sun/opengl/impl/nurbs/internals/BasicSurfaceEvaluator.java new file mode 100644 index 000000000..f2b4a6679 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/BasicSurfaceEvaluator.java @@ -0,0 +1,76 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public abstract class BasicSurfaceEvaluator extends CachingEvaluator { + public void range2f(long, float[] from, float[] to) {} + public void domain2f(float ulo, float uhi, float vlo, float vhi) {} + + public void enable(long type) {} + public void disable(long type) {} + public void bgnmap2f(long type) {} + public void map2f(long type, float ulower, float uupper, long ustride, long uorder, + float vlower, float vupper, long vstride, long vorder, + float[] pts) {} + public void mapgrid2f(long nu, float u0, float u1, + long nv, float v0, float v1) {} + public void mapmesh2f(long style, long umin, long umax, + long vmin, long vmax) {} + public void evalcoord2f(long type, float u, float v) {} + public void evalpoint2i(long u, long v) {} + public void endmap2f() {} + + public void polymode(long style) {} + public void bgnline() {} + public void endline() {} + public void bgnclosedline() {} + public void endclosedline() {} + public void bgntmesh() {} + public void swaptmesh() {} + public void endtmesh() {} + public void bgnqstrip() {} + public void endqstrip() {} + + public void bgntfan() {} + public void endtfan() {} + + public abstract void evalUStrip(int n_upper, float v_upper, float[] upper_val, + int n_lower, float v_lower, float[] lower_val); + public abstract void evalVStrip(int n_left, float u_left, float[] left_val, + int n_right, float u_right, float[] right_val); + public abstract void inDoEvalCoord2NOGE(float u, float v, float[] ret_point, float[] ret_normal); + public abstract void inDoEvalCoord2NOGE_BU(float u, float v, float[] ret_point, float[] ret_normal); + public abstract void inDoEvalCoord2NOGE_BV(float u, float v, float[] ret_point, float[] ret_normal); + public abstract void inPreEvaluateBV_intfac(float v); + public abstract void inPreEvaluateBU_intfac(float u); +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/BezierArc.java b/src/classes/com/sun/opengl/impl/nurbs/internals/BezierArc.java new file mode 100644 index 000000000..feac7d544 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/BezierArc.java @@ -0,0 +1,42 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/** A bezier arc. */ +class BezierArc { + public float[] cpts; /* control points of arc */ + public int order; /* order of arc */ + public int stride; /* REAL distance between points */ + public long type; /* curve type */ + public Mapdesc mapdesc; +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/Bin.java b/src/classes/com/sun/opengl/impl/nurbs/internals/Bin.java new file mode 100644 index 000000000..55bec5eae --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/Bin.java @@ -0,0 +1,147 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class Bin { + private Arc head; /*first arc on list */ + private Arc current; /* current arc on list */ + + /** + * Sets current arc to first arc of bin; advances to next arc. + */ + public Arc firstarc( ) { + current = head; + return nextarc( ); + } + /** + * Returns current arc in bin and advances pointer to next arc. + */ + public Arc nextarc( ) { + Arc jarc = current; + + assert( (jarc == null) || jarc.check() ); + + if( jarc != null ) current = jarc.link; + return jarc; + } + /** + * Removes first Arc from bin. + */ + public Arc removearc( ) { + Arc jarc = head; + + if( jarc != null ) head = jarc.link; + return jarc; + } + public boolean isnonempty( ) { return (head != null); } + /** + * Adds an Arc to head of the linked list of Arcs. + */ + public void addarc( Arc jarc ) { + jarc.link = head; + head = jarc; + } + /** + * Removes given Arc from bin. + */ + public void remove_this_arc( Arc arc ) { + Arc j, prev; + for( j = head; (j != null) && (j != arc); prev = j, j = j.link ); + + if( j != null ) { + if( j == current ) + current = j.link; + if ( prev != null ) + prev.link = j.link; + } + } + /** + * Counts number of arcs in bin. + */ + public int numarcs( ) { + long count = 0; + for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) + count++; + return count; + } + /** + * Places an orphaned arc into its new parent's bin. + */ + public void adopt( ) { + markall(); + + Arc orphan; + while( (orphan = removearc()) != null ) { + for( Arc parent = orphan.next; parent != orphan; parent = parent.next ) { + if (! parent.ismarked() ) { + orphan.link = parent.link; + parent.link = orphan; + orphan.clearmark(); + break; + } + } + } + } + /** + * Marks all arcs with an identifying tag. + */ + public void markall( ) { + for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) + jarc.setmark(); + } + /** + * Prints out descriptions of the arcs in the bin. + */ + public void show( String name ) { + System.out.println( name ); + for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) + jarc.show( ); + } + /** + * Prints out all arcs that are untessellated border arcs. + */ + public void listBezier( ) { + for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) { + if( jarc.isbezier( ) ) { + assert( jarc.pwlArc.npts == 2 ); + TrimVertex[] pts = jarc.pwlArc.pts; + float s1 = pts[0].param[0]; + float t1 = pts[0].param[1]; + float s2 = pts[1].param[0]; + float t2 = pts[1].param[1]; + System.out.println( "arc ( " + s1 + "," + t1 + ") (" + + s2 + "," + t2 + ")"); + } + } + } +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/CachingEvaluator.java b/src/classes/com/sun/opengl/impl/nurbs/internals/CachingEvaluator.java new file mode 100644 index 000000000..c9c8c5cf9 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/CachingEvaluator.java @@ -0,0 +1,56 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class CachingEvaluator { + public int ServiceModePlay = 0; + public int ServiceModeRecord = 1; + public int ServiceModePlayAndRecord = 2; + + public int canRecord() { + return 0; + } + + public int canPlayAndRecord() { + return 0; + } + + public int createHandle( int handle ) { + return 0; + } + + public void beginOutput( int serviceMode, int handle ) {} + public void endOutput() {} + public void discardRecording(int handle) {} + public void playRecording(int handle) {} +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/Defines.java b/src/classes/com/sun/opengl/impl/nurbs/internals/Defines.java new file mode 100644 index 000000000..fc284abbd --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/Defines.java @@ -0,0 +1,46 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class Defines { + /* culling constants */ + public static final int CULL_TRIVIAL_REJECT = 0; + public static final int CULL_TRIVIAL_ACCEPT = 1; + public static final int CULL_ACCEPT = 2; + + /* maximum order of a B-Spline */ + public static final int MAXORDER = 24; + + /* maximum dimension of any B-spline range space */ + public static final int MAXCOORDS = 5; +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/NurbsConsts.java b/src/classes/com/sun/opengl/impl/nurbs/internals/NurbsConsts.java new file mode 100644 index 000000000..74c9c150c --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/NurbsConsts.java @@ -0,0 +1,117 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class NurbsConsts { + /* NURBS Properties - one set per map, + each takes a single INREAL arg */ + public static final int N_SAMPLING_TOLERANCE = 1; + public static final int N_S_RATE = 6; + public static final int N_T_RATE = 7; + public static final int N_CLAMPFACTOR = 13; + public static final float N_NOCLAMPING = 0.0f; + public static final int N_MINSAVINGS = 14; + public static final float N_NOSAVINGSSUBDIVISION = 0.0f; + + /* NURBS Properties - one set per map, + each takes an enumerated value */ + public static final int N_CULLING = 2; + public static final float N_NOCULLING = 0.0f; + public static final float N_CULLINGON = 1.0f; + public static final int N_SAMPLINGMETHOD 10; + public static final float N_NOSAMPLING = 0.0f; + public static final float N_FIXEDRATE = 3.0f; + public static final float N_DOMAINDISTANCE = 2.0f; + public static final float N_PARAMETRICDISTANCE = 5.0f; + public static final float N_PATHLENGTH = 6.0f; + public static final float N_SURFACEAREA = 7.0f; + public static final float N_OBJECTSPACE_PARA = 8.0f; + public static final float N_OBJECTSPACE_PATH = 9.0f; + public static final int N_BBOX_SUBDIVIDING = 17; + public static final float N_NOBBOXSUBDIVISION = 0.0f; + public static final float N_BBOXTIGHT = 1.0f; + public static final float N_BBOXROUND = 2.0f; + + /* NURBS Rendering Properties - one set per renderer + each takes an enumerated value */ +public static final int N_DISPLAY 3 +public static final int N_FILL 1.0 +public static final int N_OUTLINE_POLY 2.0 +public static final int N_OUTLINE_TRI 3.0 +public static final int N_OUTLINE_QUAD 4.0 +public static final int N_OUTLINE_PATCH 5.0 +public static final int N_OUTLINE_PARAM 6.0 +public static final int N_OUTLINE_PARAM_S 7.0 +public static final int N_OUTLINE_PARAM_ST 8.0 +public static final int N_OUTLINE_SUBDIV 9.0 +public static final int N_OUTLINE_SUBDIV_S 10.0 +public static final int N_OUTLINE_SUBDIV_ST 11.0 +public static final int N_ISOLINE_S 12.0 +public static final int N_ERRORCHECKING 4 +public static final int N_NOMSG 0.0 +public static final int N_MSG 1.0 + +/* GL 4.0 propeties not defined above */ +#ifndef N_PIXEL_TOLERANCE +public static final int N_PIXEL_TOLERANCE N_SAMPLING_TOLERANCE +public static final int N_ERROR_TOLERANCE 20 +public static final int N_SUBDIVISIONS 5 +public static final int N_TILES 8 +public static final int N_TMP1 9 +public static final int N_TMP2 N_SAMPLINGMETHOD +public static final int N_TMP3 11 +public static final int N_TMP4 12 +public static final int N_TMP5 N_CLAMPFACTOR +public static final int N_TMP6 N_MINSAVINGS +public static final int N_S_STEPS N_S_RATE +public static final int N_T_STEPS N_T_RATE +#endif + +/* NURBS Rendering Properties - one set per map, + each takes an INREAL matrix argument */ +public static final int N_CULLINGMATRIX 1 +public static final int N_SAMPLINGMATRIX 2 +public static final int N_BBOXMATRIX 3 + + +/* NURBS Rendering Properties - one set per map, + each takes an INREAL vector argument */ +public static final int N_BBOXSIZE 4 + +/* type argument for trimming curves */ +#ifndef N_P2D +public static final int N_P2D 0x8 +public static final int N_P2DR 0xd +#endif + +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/NurbsException.java b/src/classes/com/sun/opengl/impl/nurbs/internals/NurbsException.java new file mode 100644 index 000000000..5453807cd --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/NurbsException.java @@ -0,0 +1,30 @@ +/** Encapsulates functionality of the C GLU NURBS implementation's + setjmp/longjmp wrappers. */ + +public class NurbsException extends RuntimeException { + private int errorCode; + + public NurbsException(int code) { + super(); + errorCode = code; + } + + public NurbsException(String message, int code) { + super(message); + errorCode = code; + } + + public NurbsException(String message, Throwable cause, int code) { + super(message, cause); + errorCode = code; + } + + public NurbsException(Throwable cause, int code) { + super(cause); + errorCode = code; + } + + public int errorCode() { + return errorCode; + } +} diff --git a/src/classes/com/sun/opengl/impl/nurbs/internals/Subdivider.java b/src/classes/com/sun/opengl/impl/nurbs/internals/Subdivider.java new file mode 100644 index 000000000..155b6b7ac --- /dev/null +++ b/src/classes/com/sun/opengl/impl/nurbs/internals/Subdivider.java @@ -0,0 +1,1781 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +public class Subdivider { + + /** + * Constructs a subdivider. + */ + public Subdivider(RenderHints hints, Backend b) { + renderhints = hints; + arctessellator = new ArcTesselator(); + backend = b; + slicer = new Slicer(b); + } + + /** + * Resets all state after possible error condition. + */ + public void clear() { + // FIXME: looks like nothing to do given that we have no object pools + } + public void beginTrims() {} + public void beginLoop() { + pjarc = 0; + } + + /** + * Adds a bezier arc to a trim loop and to a bin. + */ + public void addArc(float[] cpts, Quilt quilt, long _nuid) { + BezierArc bezierArc = new BezierArc(); + Arc jarc = new Arc(Arc.SIDE_NONE, _nuid); + jarc.bezierArc = bezierArc; + bezierArc.order = quilt.qspec.order; + bezierArc.stride = quilt.qspec.stride; + bezierArc.mapdesc = quilt.mapdesc; + bezierArc.cpts = cpts; + initialbin.addarc( jarc ); + pjarc = jarc.append( pjarc ); + } + + /** + * Adds a pwl arc to a trim loop and to a bin. + */ + public void addArc(int npts, TrimVertex[] pts, long _nuid) { + Arc jarc = new Arc( Arc.SIDE_NONE, _nuid ); + jarc.pwlArc = new PwlArc( npts, pts ); + initialbin.addarc( jarc ); + pjarc = jarc.append( pjarc ); + } + public void endLoop() {} + public void endTrims() {} + + public void beginQuilts() { + qlist = null; + } + public void addQuilt( Quilt quilt ) { + quilt.next = qlist; + qlist = quilt; + } + public void endQuilts() {} + + /** + * Main curve rendering entry point + */ + public void drawCurves() { + float[] from = new float[1]; + float[] to = new float[1]; + Flist bpts = new Flist(); + qlist.getRange( from, to, bpts ); + + renderhints.init( ); + + backend.bgncurv(); + float[] pta = new float[0]; + float[] ptb = new float[1]; + for( int i=bpts.start; i v2.param[0] || v1next.param[0] > v1.param[0] ) + throw new NurbsException(28); + + if( v1.param[1] < v2.param[1] ) + return 1; + else if( v1.param[1] > v2.param[1] ) + return 0; + + while( true ) { + if( v1next.param[0] > v2next.param[0] ) { + assert( v1.param[0] >= v1next.param[0] ); + assert( v2.param[0] >= v1next.param[0] ); + switch( bbox( v2next, v2, v1next, 1 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) + return sgn; + else { + v1i = v1nexti--; + v1 = j1.pwlArc.pts[v1i]; + v1next = j1.pwlArc.pts[v1nexti]; + if( v1 == v1last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else if( v1next.param[0] < v2next.param[0] ) { + assert( v1.param[0] >= v2next.param[0] ); + assert( v2.param[0] >= v2next.param[0] ); + switch( bbox( v1next, v1, v2next, 1 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) + return sgn; + else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else { + if( v1next.param[1] < v2next.param[1] ) + return 1; + else if( v1next.param[1] > v2next.param[1] ) + return 0; + else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + } + } + } + + public int ccwTurn_sr(Arc j1, Arc j2 ) { + // dir = 1 + int v1i = j1.pwlArc.npts-1; + int v1lasti = 0; + int v2i = 0; + int v2lasti = j2.pwlArc.npts-1; + int v1nexti = v1i-1; + int v2nexti = v2i+1; + TrimVertex v1 = j1.pwlArc.pts[v1i]; + TrimVertex v1last = j1.pwlArc.pts[v1lasti]; + TrimVertex v2 = j2.pwlArc.pts[v2i]; + TrimVertex v2last = j2.pwlArc.pts[v2lasti]; + TrimVertex v1next = j1.pwlArc.pts[v1nexti]; + TrimVertex v2next = j2.pwlArc.pts[v2nexti]; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + + // the arcs lie on the line (0 == v1.param[0]) + if( v1.param[0] == v1next.param[0] && v2.param[0] == v2next.param[0] ) + return 0; + + if( v2next.param[0] < v2.param[0] || v1next.param[0] < v1.param[0] ) + throw new NurbsException(28); + + if( v1.param[1] < v2.param[1] ) + return 0; + else if( v1.param[1] > v2.param[1] ) + return 1; + + while( true ) { + if( v1next.param[0] < v2next.param[0] ) { + assert( v1.param[0] <= v1next.param[0] ); + assert( v2.param[0] <= v1next.param[0] ); + switch( bbox( v2, v2next, v1next, 1 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) { + return sgn; + } else { + v1i = v1nexti--; + v1 = j1.pwlArc.pts[v1i]; + v1next = j1.pwlArc.pts[v1nexti]; + if( v1 == v1last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else if( v1next.param[0] > v2next.param[0] ) { + assert( v1.param[0] <= v2next.param[0] ); + assert( v2.param[0] <= v2next.param[0] ); + switch( bbox( v1, v1next, v2next, 1 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) { + return sgn; + } else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else { + if( v1next.param[1] < v2next.param[1] ) + return 0; + else if( v1next.param[1] > v2next.param[1] ) + return 1; + else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + } + } + } + + public int ccwTurn_tl(Arc j1, Arc j2 ) { + int v1i = j1.pwlArc.npts-1; + int v1lasti = 0; + int v2i = 0; + int v2lasti = j2.pwlArc.npts-1; + int v1nexti = v1i-1; + int v2nexti = v2i+1; + TrimVertex v1 = j1.pwlArc.pts[v1i]; + TrimVertex v1last = j1.pwlArc.pts[v1lasti]; + TrimVertex v2 = j2.pwlArc.pts[v2i]; + TrimVertex v2last = j2.pwlArc.pts[v2lasti]; + TrimVertex v1next = j1.pwlArc.pts[v1nexti]; + TrimVertex v2next = j2.pwlArc.pts[v2nexti]; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + + // the arcs lie on the line (1 == v1.param[1]) + if( v1.param[1] == v1next.param[1] && v2.param[1] == v2next.param[1] ) + return 0; + + if( v2next.param[1] > v2.param[1] || v1next.param[1] > v1.param[1] ) + throw new NurbsException(28 ); + + if( v1.param[0] < v2.param[0] ) + return 0; + else if( v1.param[0] > v2.param[0] ) + return 1; + + while( true ) { + if( v1next.param[1] > v2next.param[1] ) { + assert( v1.param[1] >= v1next.param[1] ); + assert( v2.param[1] >= v1next.param[1] ); + switch( bbox( v2next, v2, v1next, 0 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) + return sgn; + else { + v1i = v1nexti--; + v1 = j1.pwlArc.pts[v1i]; + v1next = j1.pwlArc.pts[v1nexti]; + if( v1 == v1last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else if( v1next.param[1] < v2next.param[1] ) { + switch( bbox( v1next, v1, v2next, 0 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) + return sgn; + else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else { + if( v1next.param[0] < v2next.param[0] ) + return 0; + else if( v1next.param[0] > v2next.param[0] ) + return 1; + else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + } + } + } + + public int ccwTurn_tr(Arc j1, Arc j2) { + int v1i = j1.pwlArc.npts-1; + int v1lasti = 0; + int v2i = 0; + int v2lasti = j2.pwlArc.npts-1; + int v1nexti = v1i-1; + int v2nexti = v2i+1; + TrimVertex v1 = j1.pwlArc.pts[v1i]; + TrimVertex v1last = j1.pwlArc.pts[v1lasti]; + TrimVertex v2 = j2.pwlArc.pts[v2i]; + TrimVertex v2last = j2.pwlArc.pts[v2lasti]; + TrimVertex v1next = j1.pwlArc.pts[v1nexti]; + TrimVertex v2next = j2.pwlArc.pts[v2nexti]; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + + // the arcs lie on the line (1 == v1.param[1]) + if( v1.param[1] == v1next.param[1] && v2.param[1] == v2next.param[1] ) + return 0; + + if( v2next.param[1] < v2.param[1] || v1next.param[1] < v1.param[1] ) + throw new NurbsException( 28 ); + + if( v1.param[0] < v2.param[0] ) + return 1; + else if( v1.param[0] > v2.param[0] ) + return 0; + + while( 1 ) { + if( v1next.param[1] < v2next.param[1] ) { + assert( v1.param[1] <= v1next.param[1] ); + assert( v2.param[1] <= v1next.param[1] ); + switch( bbox( v2, v2next, v1next, 0 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) { + return sgn; + } else { + v1i = v1nexti--; + v1 = j1.pwlArc.pts[v1i]; + v1next = j1.pwlArc.pts[v1nexti]; + if( v1 == v1last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else if( v1next.param[1] > v2next.param[1] ) { + assert( v1.param[1] <= v2next.param[1] ); + assert( v2.param[1] <= v2next.param[1] ); + switch( bbox( v1, v1next, v2next, 0 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) { + return sgn; + } else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else { + if( v1next.param[0] < v2next.param[0] ) + return 1; + else if( v1next.param[0] > v2next.param[0] ) + return 0; + else { + v2i = v2nexti++; + v2 = j2.pwlArc.pts[v2i]; + v2next = j2.pwlArc.pts[v2nexti]; + if( v2 == v2last ) { + return 0; // ill-conditioned, guess answer + } + } + } + } + } + + public void set_domain_distance_u_rate(float u_rate) { + domain_distance_u_rate = u_rate; + } + + public void set_domain_distance_v_rate(float v_rate) { + domain_distance_v_rate = v_rate; + } + + public void set_is_domain_distance_sampling(int flag) { + is_domain_distance_sampling = flag; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + /** + * Determine which side of a line a jarc lies (for debugging only) + */ + private int arc_classify( Arc jarc, int param, float value ) + { + float tdiff, hdiff; + if( param == 0 ) { + tdiff = jarc.tail()[0] - value; + hdiff = jarc.head()[0] - value; + } else { + tdiff = jarc.tail()[1] - value; + hdiff = jarc.head()[1] - value; + } + + if( tdiff > 0.0 ) { + if( hdiff > 0.0 ) { + return 0x11; + } else if( hdiff == 0.0 ) { + return 0x12; + } else { + return 0x10; + } + } else if( tdiff == 0.0 ) { + if( hdiff > 0.0 ) { + return 0x21; + } else if( hdiff == 0.0 ) { + return 0x22; + } else { + return 0x20; + } + } else { + if( hdiff > 0.0 ) { + return 0x01; + } else if( hdiff == 0.0 ) { + return 0x02; + } else { + return 0; + } + } + } + + private void classify_headonleft_s( Bin bin, Bin in, Bin out, float val ) { + /* tail on line, head at left */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 0, val ) == 0x20 ); + + j.setitail(); + + float diff = j.prev.tail()[0] - val; + if( diff > 0.0 ) { + out.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_sl( j.prev, j ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if( j.prev.tail()[1] > j.prev.head()[1] ) + in.addarc( j ); + else + out.addarc( j ); + } + } + } + + private void classify_tailonleft_s( Bin bin, Bin in, Bin out, float val ) { + /* tail at left, head on line */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 1, val ) == 0x02 ); + j.clearitail(); + + float diff = j.next.head()[1] - val; + if( diff > 0.0 ) { + in.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_tl( j, j.next ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if (j.next.tail()[0] > j.next.head()[0] ) + out.addarc( j ); + else + in.addarc( j ); + } + } + } + + private void classify_headonright_s( Bin bin, Bin in, Bin out, float val ) { + /* tail on line, head at right */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 0, val ) == 0x21 ); + + j.setitail(); + + float diff = j.prev.tail()[0] - val; + if( diff > 0.0 ) { + if( ccwTurn_sr( j.prev, j ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + out.addarc( j ); + } else { + if( j.prev.tail()[1] > j.prev.head()[1] ) + out.addarc( j ); + else + in.addarc( j ); + } + } + } + + private void classify_tailonright_s( Bin bin, Bin in, Bin out, float val ) { + /* tail at right, head on line */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 0, val ) == 0x12); + + j.clearitail(); + + float diff = j.next.head()[0] - val; + if( diff > 0.0 ) { + if( ccwTurn_sr( j, j.next ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + in.addarc( j ); + } else { + if( j.next.tail()[1] > j.next.head()[1] ) + out.addarc( j ); + else + in.addarc( j ); + } + } + } + + private void classify_headonleft_t( Bin bin, Bin in, Bin out, float val ) { + /* tail on line, head at left */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 1, val ) == 0x20 ); + j.setitail(); + + float diff = j.prev.tail()[1] - val; + if( diff > 0.0 ) { + out.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_tl( j.prev, j ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if( j.prev.tail()[0] > j.prev.head()[0] ) + out.addarc( j ); + else + in.addarc( j ); + } + } + } + + private void classify_tailonleft_t( Bin bin, Bin in, Bin out, float val ) { + /* tail at left, head on line */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 1, val ) == 0x02 ); + j.clearitail(); + + float diff = j.next.head()[1] - val; + if( diff > 0.0 ) { + in.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_tl( j, j.next ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if (j.next.tail()[0] > j.next.head()[0] ) + out.addarc( j ); + else + in.addarc( j ); + } + } + } + + private void classify_headonright_t( Bin bin, Bin in, Bin out, float val ) { + /* tail on line, head at right */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 1, val ) == 0x21 ); + + j.setitail(); + + float diff = j.prev.tail()[1] - val; + if( diff > 0.0 ) { + if( ccwTurn_tr( j.prev, j ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + out.addarc( j ); + } else { + if( j.prev.tail()[0] > j.prev.head()[0] ) + in.addarc( j ); + else + out.addarc( j ); + } + } + } + + private void classify_tailonright_t( Bin bin, Bin in, Bin out, float val ) { + /* tail at right, head on line */ + Arc j; + + while( (j = bin.removearc()) != null ) { + assert( arc_classify( j, 1, val ) == 0x12); + + j.clearitail(); + + float diff = j.next.head()[1] - val; + if( diff > 0.0 ) { + if( ccwTurn_tr( j, j.next ) != 0 ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + in.addarc( j ); + } else { + if( j.next.tail()[0] > j.next.head()[0] ) + in.addarc( j ); + else + out.addarc( j ); + } + } + } + + private int DIR_DOWN = 0; + private int DIR_SAME = 1; + private int DIR_UP = 2; + private int DIR_NONE = 3; + + private void tessellate( Arc_ptr, float ); + private void monotonize( Arc_ptr , Bin & ); + private int isMonotone( Arc_ptr ); + private int decompose( Bin &, float ); + + + private Slicer slicer; + private ArcTessellator arctessellator; + // private Pool arcpool; + // private Pool bezierarcpool; + // private Pool pwlarcpool; + // private TrimVertexPool trimvertexpool; + + private JumpBuffer* jumpbuffer; + private Renderhints& renderhints; + private Backend& backend; + + private Bin initialbin; + private Arc pjarc; + private int s_index; + private int t_index; + private Quilt *qlist; + private Flist spbrkpts; + private Flist tpbrkpts; + private Flist smbrkpts; + private Flist tmbrkpts; + private float stepsizes[4]; + private int showDegenerate; + private int isArcTypeBezier; + + // FIXME: NOT FINISHED + private void samplingSplit( Curvelist&, int ); + + private void subdivideInS( Bin source ) { + if( renderhints.display_method == N_OUTLINE_PARAM ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypeBezier(); + setNonDegenerate(); + splitInS( source, spbrkpts.start, spbrkpts.end ); + } + } + + /** + * Splits a patch and a bin by an isoparametric line. + */ + private void splitInS( Bin source, int start, int end ) { + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left = new Bin(); + Bin right = new Bin(); + split( source, left, right, 0, spbrkpts.pts[i] ); + splitInS( left, start, i ); + splitInS( right, i+1, end ); + } else { + if( start == spbrkpts.start || start == spbrkpts.end ) { + freejarcs( source ); + } else if( renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM_S ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypeBezier(); + setNonDegenerate(); + s_index = start; + splitInT( source, tpbrkpts.start, tpbrkpts.end ); + } + } + } + } + + /** + * Splits a patch and a bin by an isoparametric line. + */ + private void splitInT( Bin source, int start, int end ) { + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left = new Bin(); + Bin right = new Bin(); + split( source, left, right, 1, tpbrkpts.pts[i] ); + splitInT( left, start, i ); + splitInT( right, i+1, end ); + } else { + if( start == tpbrkpts.start || start == tpbrkpts.end ) { + freejarcs( source ); + } else if( renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM_ST ) { + outline( source ); + freejarcs( source ); + } else { + t_index = start; + setArcTypeBezier(); + setDegenerate(); + + float[] pta = new float[2]; + float[] ptb = new float[2]; + pta[0] = spbrkpts.pts[s_index-1]; + pta[1] = tpbrkpts.pts[t_index-1]; + + ptb[0] = spbrkpts.pts[s_index]; + ptb[1] = tpbrkpts.pts[t_index]; + qlist.downloadAll( pta, ptb, backend ); + + Patchlist patchlist = new Patchlist( qlist, pta, ptb ); + /* + printf("-------samplingSplit-----\n"); + source.show("samplingSplit source"); + */ + samplingSplit( source, patchlist, renderhints.maxsubdivisions, 0 ); + setNonDegenerate(); + setArcTypeBezier(); + } + } + } + } + + /** + * Recursively subdivides patch, cull checks each subpatch + */ + private void samplingSplit( Bin source, Patchlist patchlist, int subdivisions, int param ) { + if( ! source.isnonempty() ) return; + + if( patchlist.cullCheck() == Defines.CULL_TRIVIAL_REJECT ) { + freejarcs( source ); + return; + } + + patchlist.getstepsize(); + + if( renderhints.display_method == NurbsConsts.N_OUTLINE_PATCH ) { + tessellation( source, patchlist ); + outline( source ); + freejarcs( source ); + return; + } + + //patchlist.clamp(); + + tessellation( source, patchlist ); + + if( patchlist.needsSamplingSubdivision() && (subdivisions > 0) ) { + if( ! patchlist.needsSubdivision( 0 ) ) + param = 1; + else if( ! patchlist.needsSubdivision( 1 ) ) + param = 0; + else + param = 1 - param; + + Bin left = new Bin(); + Bin right = new Bin(); + float mid = ( patchlist.pspec[param].range[0] + + patchlist.pspec[param].range[1] ) * 0.5; + split( source, left, right, param, mid ); + Patchlist subpatchlist = new Patchlist( patchlist, param, mid ); + samplingSplit( left, subpatchlist, subdivisions-1, param ); + samplingSplit( right, patchlist, subdivisions-1, param ); + } else { + setArcTypePwl(); + setDegenerate(); + nonSamplingSplit( source, patchlist, subdivisions, param ); + setDegenerate(); + setArcTypeBezier(); + } + } + + private void nonSamplingSplit( Bin source, Patchlist patchlist, int subdivisions, int param ) { + if( patchlist.needsNonSamplingSubdivision() && (subdivisions > 0) ) { + param = 1 - param; + + Bin left = new Bin(); + Bin right = new Bin(); + float mid = ( patchlist.pspec[param].range[0] + + patchlist.pspec[param].range[1] ) * 0.5; + split( source, left, right, param, mid ); + Patchlist subpatchlist = new Patchlist( patchlist, param, mid ); + if( left.isnonempty() ) + if( subpatchlist.cullCheck() == Defines.CULL_TRIVIAL_REJECT ) + freejarcs( left ); + else + nonSamplingSplit( left, subpatchlist, subdivisions-1, param ); + if( right.isnonempty() ) + if( patchlist.cullCheck() == Defines.CULL_TRIVIAL_REJECT ) + freejarcs( right ); + else + nonSamplingSplit( right, patchlist, subdivisions-1, param ); + + } else { + // make bbox calls + patchlist.bbox(); + backend.patch( patchlist.pspec[0].range[0], patchlist.pspec[0].range[1], + patchlist.pspec[1].range[0], patchlist.pspec[1].range[1] ); + + if( renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypePwl(); + setDegenerate(); + findIrregularS( source ); + monosplitInS( source, smbrkpts.start, smbrkpts.end ); + } + } + } + + /** + * Sets tessellation of interior and boundary of patch. + */ + private void tessellation( Bin bin, Patchlist patchlist ) { + // tessellate unsampled trim curves + tessellate( bin, patchlist.pspec[1].sidestep[1], patchlist.pspec[0].sidestep[1], + patchlist.pspec[1].sidestep[0], patchlist.pspec[0].sidestep[0] ); + + // set interior sampling rates + slicer.setstriptessellation( patchlist.pspec[0].stepsize, patchlist.pspec[1].stepsize ); + + //added by zl: set the order which will be used in slicer.c++ + slicer.set_ulinear( (patchlist.get_uorder() == 2)); + slicer.set_vlinear( (patchlist.get_vorder() == 2)); + + // set boundary sampling rates + stepsizes[0] = patchlist.pspec[1].stepsize; + stepsizes[1] = patchlist.pspec[0].stepsize; + stepsizes[2] = patchlist.pspec[1].stepsize; + stepsizes[3] = patchlist.pspec[0].stepsize; + } + + /** + * Splits a patch and a bin by an isoparametric line. + */ + private void monosplitInS( Bin source, int start, int end ) { + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left = new Bin(); + Bin right = new Bin(); + split( source, left, right, 0, smbrkpts.pts[i] ); + monosplitInS( left, start, i ); + monosplitInS( right, i+1, end ); + } else { + if( renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV_S ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypePwl(); + setDegenerate(); + findIrregularT( source ); + monosplitInT( source, tmbrkpts.start, tmbrkpts.end ); + } + } + } + } + + /** + * Splits a patch and a bin by an isoparametric line. + */ + private void monosplitInT( Bin source, int start, int end ) { + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left = new Bin(); + Bin right = new Bin(); + split( source, left, right, 1, tmbrkpts.pts[i] ); + monosplitInT( left, start, i ); + monosplitInT( right, i+1, end ); + } else { + if( renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV_ST ) { + outline( source ); + freejarcs( source ); + } else { + /* + printf("*******render\n"); + source.show("source\n"); + */ + render( source ); + freejarcs( source ); + } + } + } + } + + /** + * Renders the trimmed patch by outlining the boundary . + */ + private void outline( Bin bin ) { + bin.markall(); + for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { + if( jarc.ismarked() ) { + assert( jarc.check( ) ); + Arc jarchead = jarc; + do { + slicer.outline( jarc ); + jarc.clearmark(); + jarc = jarc.prev; + } while (jarc != jarchead); + } + } + } + + /** + * Frees all arcs in a bin. + */ + private void freejarcs( Bin & ) { + bin.adopt(); /* XXX - should not be necessary */ + + Arc jarc; + while( (jarc = bin.removearc()) != null ) { + if( jarc.pwlArc != null ) jarc.pwlArc.deleteMe( ); jarc.pwlArc = null; + if( jarc.bezierArc != null) jarc.bezierArc.deleteMe( ); jarc.bezierArc = null; + jarc.deleteMe( ); + } + } + + /** + * Renders all monotone regions in a bin and frees the bin. + */ + private void render( Bin bin ) { + bin.markall(); + + slicer.setisolines( ( renderhints.display_method == N_ISOLINE_S ) ? 1 : 0 ); + + for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { + if( jarc.ismarked() ) { + assert( jarc.check( ) != 0 ); + Arc jarchead = jarc; + do { + jarc.clearmark(); + jarc = jarc.next; + } while (jarc != jarchead); + slicer.slice( jarc ); + } + } + } + + private void split( Bin &, Bin &, Bin &, int, float ); + + /** + * Tessellates all Bezier arcs in a bin. + *

    + *
  1. only accepts linear Bezier arcs as input + *
  2. the Bezier arcs are stored in the pwlArc structure + *
  3. only vertical or horizontal lines work + *
+ * should: + *
    + *
  1. represent Bezier arcs in BezierArc structure + * (this requires a multitude of changes to the code) + *
  2. accept high degree Bezier arcs (hard) + * map the curve onto the surface to determine tessellation + *
  3. work for curves of arbitrary geometry + *
+ *---------------------------------------------------------------------------- + */ + private void tessellate( Bin bin, float rrate, float trate, float lrate, float brate ) { + for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { + if( jarc.isbezier( ) ) { + assert( jarc.pwlArc.npts == 2 ); + TrimVertex[] pts = jarc.pwlArc.pts; + float s1 = pts[0].param[0]; + float t1 = pts[0].param[1]; + float s2 = pts[1].param[0]; + float t2 = pts[1].param[1]; + + jarc.pwlArc.deleteMe( ); + jarc.pwlArc = null; + + switch( jarc.getside() ) { + case Arc.SIDE_LEFT: + assert( s1 == s2 ); + arctessellator.pwl_left( jarc, s1, t1, t2, lrate ); + break; + case Arc.SIDE_RIGHT: + assert( s1 == s2 ); + arctessellator.pwl_right( jarc, s1, t1, t2, rrate ); + break; + case Arc.SIDE_TOP: + assert( t1 == t2 ); + arctessellator.pwl_top( jarc, t1, s1, s2, trate ); + break; + case Arc.SIDE_BOTTOM: + assert( t1 == t2 ); + arctessellator.pwl_bottom( jarc, t1, s1, s2, brate ); + break; + case Arc.SIDE_NONE: + throw new InternalError("Incorrect tesselation state"); + break; + } + assert( ! jarc.isbezier() ); + assert( jarc.check() != 0 ); + } + } + } + + private inline void setDegenerate( void ) { showDegenerate = 1; } + private inline void setNonDegenerate( void ) { showDegenerate = 0; } + private inline int showingDegenerate( void ) { return showDegenerate; } + private inline void setArcTypeBezier( void ) { isArcTypeBezier = 1; } + private inline void setArcTypePwl( void ) { isArcTypeBezier = 0; } + private inline int isBezierArcType( void ) { return isArcTypeBezier; } + + /** + * If no user input trimming data, then create a trimming curve + * around the boundaries of the Quilt. The curve consists of four + * Jordan arcs, one for each side of the Quilt, connected, of + * course, head to tail. + */ + private void makeBorderTrim( float[] from, float[] to ) { + float smin = from[0]; + float smax = to[0]; + float tmin = from[1]; + float tmax = to[1]; + + pjarc = null; + + Arc jarc = new Arc( Arc.SIDE_BOTTOM, 0 ); + arctessellator.bezier( jarc, smin, smax, tmin, tmin ); + initialbin.addarc( jarc ); + pjarc = jarc.append( pjarc ); + + jarc = new Arc( Arc.SIDE_RIGHT, 0 ); + arctessellator.bezier( jarc, smax, smax, tmin, tmax ); + initialbin.addarc( jarc ); + pjarc = jarc.append( pjarc ); + + jarc = new Arc( Arc.SIDE_TOP, 0 ); + arctessellator.bezier( jarc, smax, smin, tmax, tmax ); + initialbin.addarc( jarc ); + pjarc = jarc.append( pjarc ); + + jarc = new Arc( Arc.SIDE_LEFT, 0 ); + arctessellator.bezier( jarc, smin, smin, tmax, tmin ); + initialbin.addarc( jarc ); + jarc.append( pjarc ); + + assert( jarc.check() ); + } + + private void split( Bin &, int, const float *, int, int ); + private void partition( Bin bin, Bin left, Bin intersections, Bin right, Bin unknown, int param, float value ) { + Bin headonleft = new Bin(); + Bin headonright = new Bin(); + Bin tailonleft = new Bin(); + Bin tailonright = new Bin(); + + for( Arc jarc = bin.removearc(); jarc != null; jarc = bin.removearc() ) { + + float tdiff = jarc.tail()[param] - value; + float hdiff = jarc.head()[param] - value; + + if( tdiff > 0.0 ) { + if( hdiff > 0.0 ) { + right.addarc( jarc ); + } else if( hdiff == 0.0 ) { + tailonright.addarc( jarc ); + } else { + Arc jtemp; + switch( arc_split(jarc, param, value, 0) ) { + case 2: + tailonright.addarc( jarc ); + headonleft.addarc( jarc.next ); + break; + case 31: + assert( jarc.head()[param] > value ); + right.addarc( jarc ); + tailonright.addarc( jtemp = jarc.next ); + headonleft.addarc( jtemp.next ); + break; + case 32: + assert( jarc.head()[param] <= value ); + tailonright .addarc( jarc ); + headonleft.addarc( jtemp = jarc.next ); + left.addarc( jtemp.next ); + break; + case 4: + right.addarc( jarc ); + tailonright.addarc( jtemp = jarc.next ); + headonleft.addarc( jtemp = jtemp.next ); + left.addarc( jtemp.next ); + } + } + } else if( tdiff == 0.0 ) { + if( hdiff > 0.0 ) { + headonright.addarc( jarc ); + } else if( hdiff == 0.0 ) { + unknown.addarc( jarc ); + } else { + headonleft.addarc( jarc ); + } + } else { + if( hdiff > 0.0 ) { + Arc jtemp; + switch( arc_split(jarc, param, value, 1) ) { + case 2: + tailonleft.addarc( jarc ); + headonright.addarc( jarc.next ); + break; + case 31: + assert( jarc.head()[param] < value ); + left.addarc( jarc ); + tailonleft.addarc( jtemp = jarc.next ); + headonright.addarc( jtemp.next ); + break; + case 32: + assert( jarc.head()[param] >= value ); + tailonleft.addarc( jarc ); + headonright.addarc( jtemp = jarc.next ); + right.addarc( jtemp.next ); + break; + case 4: + left.addarc( jarc ); + tailonleft.addarc( jtemp = jarc.next ); + headonright.addarc( jtemp = jtemp.next ); + right.addarc( jtemp.next ); + } + } else if( hdiff == 0.0 ) { + tailonleft.addarc( jarc ); + } else { + left.addarc( jarc ); + } + } + } + if( param == 0 ) { + classify_headonleft_s( headonleft, intersections, left, value ); + classify_tailonleft_s( tailonleft, intersections, left, value ); + classify_headonright_s( headonright, intersections, right, value ); + classify_tailonright_s( tailonright, intersections, right, value ); + } else { + classify_headonleft_t( headonleft, intersections, left, value ); + classify_tailonleft_t( tailonleft, intersections, left, value ); + classify_headonright_t( headonright, intersections, right, value ); + classify_tailonright_t( tailonright, intersections, right, value ); + } + } + + /** + * Determine points of non-monotonicity in s direction. + */ + private void findIrregularS( Bin bin ) { + assert( bin.firstarc() == null || bin.firstarc().check() ); + + smbrkpts.grow( bin.numarcs() ); + + for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { + float[] a = jarc.prev.tail(); + float[] b = jarc.tail(); + float[] c = jarc.head(); + + if( b[1] == a[1] && b[1] == c[1] ) continue; + + //corrected code + if((b[1]<=a[1] && b[1] <= c[1]) || + (b[1]>=a[1] && b[1] >= c[1])) + { + //each arc (jarc, jarc.prev, jarc.next) is a + //monotone arc consisting of multiple line segements. + //it may happen that jarc.prev and jarc.next are the same, + //that is, jarc.prev and jarc form a closed loop. + //In such case, a and c will be the same. + if(a[0]==c[0] && a[1] == c[1]) + { + if(jarc.pwlArc.npts >2) + { + c = jarc.pwlArc.pts[jarc.pwlArc.npts-2].param; + } + else + { + assert(jarc.prev.pwlArc.npts>2); + a = jarc.prev.pwlArc.pts[jarc.prev.pwlArc.npts-2].param; + } + + } + if(area(a,b,c) < 0) + { + smbrkpts.add(b[0]); + } + + } + + /* old code, + if( b[1] <= a[1] && b[1] <= c[1] ) { + if( ! ccwTurn_tr( jarc.prev, jarc ) ) + smbrkpts.add( b[0] ); + } else if( b[1] >= a[1] && b[1] >= c[1] ) { + if( ! ccwTurn_tl( jarc.prev, jarc ) ) + smbrkpts.add( b[0] ); + } + */ + + } + + smbrkpts.filter(); + } + + /** + * Determines points of non-monotonicity in t direction where one + * arc is parallel to the s axis. + */ + private void findIrregularT( Bin bin ) { + assert( bin.firstarc() == null || bin.firstarc().check() ); + + tmbrkpts.grow( bin.numarcs() ); + + for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { + float[] a = jarc.prev.tail(); + float[] b = jarc.tail(); + float[] c = jarc.head(); + + if( b[0] == a[0] && b[0] == c[0] ) continue; + + if( b[0] <= a[0] && b[0] <= c[0] ) { + if( a[1] != b[1] && b[1] != c[1] ) continue; + if( ccwTurn_sr( jarc.prev, jarc ) == 0) + tmbrkpts.add( b[1] ); + } else if ( b[0] >= a[0] && b[0] >= c[0] ) { + if( a[1] != b[1] && b[1] != c[1] ) continue; + if( ccwTurn_sl( jarc.prev, jarc ) == 0) + tmbrkpts.add( b[1] ); + } + } + tmbrkpts.filter( ); + } + + + private int bbox( TrimVertex a, TrimVertex b, TrimVertex c, int p ) { + return bbox( a.param[p], b.param[p], c.param[p], + a.param[1-p], b.param[1-p], c.param[1-p] ); + } + + private static int bbox( float sa, float sb, float sc, float ta, float tb, float tc ) { + assert( tc >= ta ); + assert( tc <= tb ); + + if( sa < sb ) { + if( sc <= sa ) { + return -1; + } else if( sb <= sc ) { + return 1; + } else { + return 0; + } + } else if( sa > sb ) { + if( sc >= sa ) { + return 1; + } else if( sb >= sc ) { + return -1; + } else { + return 0; + } + } else { + if( sc > sa ) { + return 1; + } else if( sb > sc ) { + return -1; + } else { + return 0; + } + } + } + /** + * Determines how three points are oriented by computing their + * determinant. + * + * @return 1 if the vertices are ccw oriented, 0 if they are cw + * oriented, or -1 if the computation is ill-conditioned. + */ + private static int ccw( TrimVertex a, TrimVertex b, TrimVertex c ) { + float d = TrimVertex.det3( a, b, c ); + if( Math.abs(d) < 0.0001 ) return -1; + return (d < 0.0) ? 0 : 1; + } + private void join_s( Bin &, Bin &, Arc_ptr, Arc_ptr ); + private void join_t( Bin &, Bin &, Arc_ptr , Arc_ptr ); + + private static void vert_interp( TrimVertex n, TrimVertex l, TrimVertex r, int p, float val ) { + assert( val > l.param[p]); + assert( val < r.param[p]); + + n.nuid = l.nuid; + + n.param[p] = val; + if( l.param[1-p] != r.param[1-p] ) { + float ratio = (val - l.param[p]) / (r.param[p] - l.param[p]); + n.param[1-p] = l.param[1-p] + + ratio * (r.param[1-p] - l.param[1-p]); + } else { + n.param[1-p] = l.param[1-p]; + } + } + + private static final int INTERSECT_VERTEX = 1; + private static final int INTERSECT_EDGE = 2; + + /** + * Finds intersection of pwlArc and isoparametric line. + */ + private static int pwlarc_intersect( PwlArc pwlArc, int param, float value, int dir, int[] loc ) { + assert( pwlArc.npts > 0 ); + + if( dir != 0 ) { + TrimVertex[] v = pwlArc.pts; + int imin = 0; + int imax = pwlArc.npts - 1; + assert( value > v[imin].param[param] ); + assert( value < v[imax].param[param] ); + while( (imax - imin) > 1 ) { + int imid = (imax + imin)/2; + if( v[imid].param[param] > value ) + imax = imid; + else if( v[imid].param[param] < value ) + imin = imid; + else { + loc[1] = imid; + return INTERSECT_VERTEX; + } + } + loc[0] = imin; + loc[2] = imax; + return INTERSECT_EDGE; + } else { + TrimVertex[] v = pwlArc.pts; + int imax = 0; + int imin = pwlArc.npts - 1; + assert( value > v[imin].param[param] ); + assert( value < v[imax].param[param] ); + while( (imin - imax) > 1 ) { + int imid = (imax + imin)/2; + if( v[imid].param[param] > value ) + imax = imid; + else if( v[imid].param[param] < value ) + imin = imid; + else { + loc[1] = imid; + return INTERSECT_VERTEX; + } + } + loc[0] = imin; + loc[2] = imax; + return INTERSECT_EDGE; + } + } + + private int arc_split( Arc jarc , int param, float value, int dir ) { + int maxvertex = jarc.pwlArc.npts; + Arc jarc1, jarc2, jarc3; + TrimVertex v = jarc.pwlArc.pts; + + int[] loc = new int[3]; + switch( pwlarc_intersect( jarc.pwlArc, param, value, dir, loc ) ) { + + // When the parameter value lands on a vertex, life is sweet + case INTERSECT_VERTEX: { + jarc1 = new Arc( jarc, new PwlArc( maxvertex-loc[1], /* &v[loc[1]] */ v, loc[1] ) ); + jarc.pwlArc.npts = loc[1] + 1; + jarc1.next = jarc.next; + jarc1.next.prev = jarc1; + jarc.next = jarc1; + jarc1.prev = jarc; + assert(jarc.check()); + return 2; + } + + // When the parameter value intersects an edge, we have to + // interpolate a new vertex. There are special cases + // if the new vertex is adjacent to one or both of the + // endpoints of the arc. + case INTERSECT_EDGE: { + int i, j; + if( dir == 0 ) { + i = loc[0]; + j = loc[2]; + } else { + i = loc[2]; + j = loc[0]; + } + + // The split is between vertices at index j and i, in that + // order (j < i) + + // JEB: This code is my idea of how to do the split without + // increasing the number of links. I'm doing this so that + // the is_rect routine can recognize rectangles created by + // subdivision. In exchange for simplifying the curve list, + // however, it costs in allocated space and vertex copies. + + TrimVertex[] newjunk = TrimVertex.allocate(maxvertex -i+1 /*-j*/); + int k; + for(k=0; knext) */ + public GLUhalfEdge Sym; /* same edge, opposite direction */ + public GLUhalfEdge Onext; /* next edge CCW around origin */ + public GLUhalfEdge Lnext; /* next edge CCW around left face */ + public GLUvertex Org; /* origin vertex (Overtex too long) */ + public com.sun.opengl.impl.tessellator.GLUface Lface; /* left face */ + + /* Internal data (keep hidden) */ + public com.sun.opengl.impl.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */ + public int winding; /* change in winding number when crossing */ + public boolean first; + + public GLUhalfEdge(boolean first) { + this.first = first; + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/GLUmesh.java b/src/classes/com/sun/opengl/impl/tessellator/GLUmesh.java new file mode 100644 index 000000000..d1ed8286b --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/GLUmesh.java @@ -0,0 +1,52 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + + + +class GLUmesh { + GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */ + com.sun.opengl.impl.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */ + com.sun.opengl.impl.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */ + com.sun.opengl.impl.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */ +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/GLUtessellatorImpl.java b/src/classes/com/sun/opengl/impl/tessellator/GLUtessellatorImpl.java new file mode 100644 index 000000000..98a0fba3a --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/GLUtessellatorImpl.java @@ -0,0 +1,625 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; +import com.sun.opengl.impl.tessellator.*; + +public class GLUtessellatorImpl implements GLUtessellator { + public static final int TESS_MAX_CACHE = 100; + + private int state; /* what begin/end calls have we seen? */ + + private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */ + GLUmesh mesh; /* stores the input contours, and eventually + the tessellation itself */ + + /*** state needed for projecting onto the sweep plane ***/ + + double[] normal = new double[3]; /* user-specified normal (if provided) */ + double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */ + double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */ + + /*** state needed for the line sweep ***/ + + private double relTolerance; /* tolerance for merging features */ + int windingRule; /* rule for determining polygon interior */ + boolean fatalError; /* fatal error: needed combine callback */ + + Dict dict; /* edge dictionary for sweep line */ + PriorityQ pq; /* priority queue of vertex events */ + GLUvertex event; /* current sweep event being processed */ + + /*** state needed for rendering callbacks (see render.c) ***/ + + boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ + boolean boundaryOnly; /* Extract contours, not triangles */ + GLUface lonelyTriList; + /* list of triangles which could not be rendered as strips or fans */ + + + + /*** state needed to cache single-contour polygons for renderCache() */ + + private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */ + int cacheCount; /* number of cached vertices */ + CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */ + + /*** rendering callbacks that also pass polygon data ***/ + private Object polygonData; /* client data for current polygon */ + + private GLUtessellatorCallback callBegin; + private GLUtessellatorCallback callEdgeFlag; + private GLUtessellatorCallback callVertex; + private GLUtessellatorCallback callEnd; +// private GLUtessellatorCallback callMesh; + private GLUtessellatorCallback callError; + private GLUtessellatorCallback callCombine; + + private GLUtessellatorCallback callBeginData; + private GLUtessellatorCallback callEdgeFlagData; + private GLUtessellatorCallback callVertexData; + private GLUtessellatorCallback callEndData; +// private GLUtessellatorCallback callMeshData; + private GLUtessellatorCallback callErrorData; + private GLUtessellatorCallback callCombineData; + + private static final double GLU_TESS_DEFAULT_TOLERANCE = 0.0; +// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */ + private static GLUtessellatorCallback NULL_CB = new GLUtessellatorCallbackAdapter(); + +// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ +// MAX(sizeof(GLUvertex),sizeof(GLUface)))) + + private GLUtessellatorImpl() { + state = TessState.T_DORMANT; + + normal[0] = 0; + normal[1] = 0; + normal[2] = 0; + + relTolerance = GLU_TESS_DEFAULT_TOLERANCE; + windingRule = GLU.GLU_TESS_WINDING_ODD; + flagBoundary = false; + boundaryOnly = false; + + callBegin = NULL_CB; + callEdgeFlag = NULL_CB; + callVertex = NULL_CB; + callEnd = NULL_CB; + callError = NULL_CB; + callCombine = NULL_CB; +// callMesh = NULL_CB; + + callBeginData = NULL_CB; + callEdgeFlagData = NULL_CB; + callVertexData = NULL_CB; + callEndData = NULL_CB; + callErrorData = NULL_CB; + callCombineData = NULL_CB; + + polygonData = null; + + for (int i = 0; i < cache.length; i++) { + cache[i] = new CachedVertex(); + } + } + + static public GLUtessellator gluNewTess() + { + return new GLUtessellatorImpl(); + } + + + private void makeDormant() { + /* Return the tessellator to its original dormant state. */ + + if (mesh != null) { + Mesh.__gl_meshDeleteMesh(mesh); + } + state = TessState.T_DORMANT; + lastEdge = null; + mesh = null; + } + + private void requireState(int newState) { + if (state != newState) gotoState(newState); + } + + private void gotoState(int newState) { + while (state != newState) { + /* We change the current state one level at a time, to get to + * the desired state. + */ + if (state < newState) { + if (state == TessState.T_DORMANT) { + callErrorOrErrorData(GLU.GLU_TESS_MISSING_BEGIN_POLYGON); + gluTessBeginPolygon(null); + } else if (state == TessState.T_IN_POLYGON) { + callErrorOrErrorData(GLU.GLU_TESS_MISSING_BEGIN_CONTOUR); + gluTessBeginContour(); + } + } else { + if (state == TessState.T_IN_CONTOUR) { + callErrorOrErrorData(GLU.GLU_TESS_MISSING_END_CONTOUR); + gluTessEndContour(); + } else if (state == TessState.T_IN_POLYGON) { + callErrorOrErrorData(GLU.GLU_TESS_MISSING_END_POLYGON); + /* gluTessEndPolygon( tess ) is too much work! */ + makeDormant(); + } + } + } + } + + public void gluDeleteTess() { + requireState(TessState.T_DORMANT); + } + + public void gluTessProperty(int which, double value) { + switch (which) { + case GLU.GLU_TESS_TOLERANCE: + if (value < 0.0 || value > 1.0) break; + relTolerance = value; + return; + + case GLU.GLU_TESS_WINDING_RULE: + int windingRule = (int) value; + if (windingRule != value) break; /* not an integer */ + + switch (windingRule) { + case GLU.GLU_TESS_WINDING_ODD: + case GLU.GLU_TESS_WINDING_NONZERO: + case GLU.GLU_TESS_WINDING_POSITIVE: + case GLU.GLU_TESS_WINDING_NEGATIVE: + case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO: + this.windingRule = windingRule; + return; + default: + break; + } + + case GLU.GLU_TESS_BOUNDARY_ONLY: + boundaryOnly = (value != 0); + return; + + default: + callErrorOrErrorData(GLU.GLU_INVALID_ENUM); + return; + } + callErrorOrErrorData(GLU.GLU_INVALID_VALUE); + } + +/* Returns tessellator property */ + public void gluGetTessProperty(int which, double[] value, int value_offset) { + switch (which) { + case GLU.GLU_TESS_TOLERANCE: +/* tolerance should be in range [0..1] */ + assert (0.0 <= relTolerance && relTolerance <= 1.0); + value[value_offset] = relTolerance; + break; + case GLU.GLU_TESS_WINDING_RULE: + assert (windingRule == GLU.GLU_TESS_WINDING_ODD || + windingRule == GLU.GLU_TESS_WINDING_NONZERO || + windingRule == GLU.GLU_TESS_WINDING_POSITIVE || + windingRule == GLU.GLU_TESS_WINDING_NEGATIVE || + windingRule == GLU.GLU_TESS_WINDING_ABS_GEQ_TWO); + value[value_offset] = windingRule; + break; + case GLU.GLU_TESS_BOUNDARY_ONLY: + assert (boundaryOnly == true || boundaryOnly == false); + value[value_offset] = boundaryOnly ? 1 : 0; + break; + default: + value[value_offset] = 0.0; + callErrorOrErrorData(GLU.GLU_INVALID_ENUM); + break; + } + } /* gluGetTessProperty() */ + + public void gluTessNormal(double x, double y, double z) { + normal[0] = x; + normal[1] = y; + normal[2] = z; + } + + public void gluTessCallback(int which, GLUtessellatorCallback aCallback) { + switch (which) { + case GLU.GLU_TESS_BEGIN: + callBegin = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_BEGIN_DATA: + callBeginData = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_EDGE_FLAG: + callEdgeFlag = aCallback == null ? NULL_CB : aCallback; +/* If the client wants boundary edges to be flagged, + * we render everything as separate triangles (no strips or fans). + */ + flagBoundary = aCallback != null; + return; + case GLU.GLU_TESS_EDGE_FLAG_DATA: + callEdgeFlagData = callBegin = aCallback == null ? NULL_CB : aCallback; +/* If the client wants boundary edges to be flagged, + * we render everything as separate triangles (no strips or fans). + */ + flagBoundary = (aCallback != null); + return; + case GLU.GLU_TESS_VERTEX: + callVertex = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_VERTEX_DATA: + callVertexData = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_END: + callEnd = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_END_DATA: + callEndData = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_ERROR: + callError = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_ERROR_DATA: + callErrorData = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_COMBINE: + callCombine = aCallback == null ? NULL_CB : aCallback; + return; + case GLU.GLU_TESS_COMBINE_DATA: + callCombineData = aCallback == null ? NULL_CB : aCallback; + return; +// case GLU_TESS_MESH: +// callMesh = aCallback == null ? NULL_CB : aCallback; +// return; + default: + callErrorOrErrorData(GLU.GLU_INVALID_ENUM); + return; + } + } + + private boolean addVertex(double[] coords, Object vertexData) { + GLUhalfEdge e; + + e = lastEdge; + if (e == null) { +/* Make a self-loop (one vertex, one edge). */ + + e = Mesh.__gl_meshMakeEdge(mesh); + if (e == null) return false; + if (!Mesh.__gl_meshSplice(e, e.Sym)) return false; + } else { +/* Create a new vertex and edge which immediately follow e + * in the ordering around the left face. + */ + if (Mesh.__gl_meshSplitEdge(e) == null) return false; + e = e.Lnext; + } + +/* The new vertex is now e.Org. */ + e.Org.data = vertexData; + e.Org.coords[0] = coords[0]; + e.Org.coords[1] = coords[1]; + e.Org.coords[2] = coords[2]; + +/* The winding of an edge says how the winding number changes as we + * cross from the edge''s right face to its left face. We add the + * vertices in such an order that a CCW contour will add +1 to + * the winding number of the region inside the contour. + */ + e.winding = 1; + e.Sym.winding = -1; + + lastEdge = e; + + return true; + } + + private void cacheVertex(double[] coords, Object vertexData) { + if (cache[cacheCount] == null) { + cache[cacheCount] = new CachedVertex(); + } + + CachedVertex v = cache[cacheCount]; + + v.data = vertexData; + v.coords[0] = coords[0]; + v.coords[1] = coords[1]; + v.coords[2] = coords[2]; + ++cacheCount; + } + + + private boolean flushCache() { + CachedVertex[] v = cache; + + mesh = Mesh.__gl_meshNewMesh(); + if (mesh == null) return false; + + for (int i = 0; i < cacheCount; i++) { + CachedVertex vertex = v[i]; + if (!addVertex(vertex.coords, vertex.data)) return false; + } + cacheCount = 0; + flushCacheOnNextVertex = false; + + return true; + } + + public void gluTessVertex(double[] coords, int coords_offset, Object vertexData) { + int i; + boolean tooLarge = false; + double x; + double[] clamped = new double[3]; + + requireState(TessState.T_IN_CONTOUR); + + if (flushCacheOnNextVertex) { + if (!flushCache()) { + callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); + return; + } + lastEdge = null; + } + for (i = 0; i < 3; ++i) { + x = coords[i+coords_offset]; + if (x < -GLU.GLU_TESS_MAX_COORD) { + x = -GLU.GLU_TESS_MAX_COORD; + tooLarge = true; + } + if (x > GLU.GLU_TESS_MAX_COORD) { + x = GLU.GLU_TESS_MAX_COORD; + tooLarge = true; + } + clamped[i] = x; + } + if (tooLarge) { + callErrorOrErrorData(GLU.GLU_TESS_COORD_TOO_LARGE); + } + + if (mesh == null) { + if (cacheCount < TESS_MAX_CACHE) { + cacheVertex(clamped, vertexData); + return; + } + if (!flushCache()) { + callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); + return; + } + } + + if (!addVertex(clamped, vertexData)) { + callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); + } + } + + + public void gluTessBeginPolygon(Object data) { + requireState(TessState.T_DORMANT); + + state = TessState.T_IN_POLYGON; + cacheCount = 0; + flushCacheOnNextVertex = false; + mesh = null; + + polygonData = data; + } + + + public void gluTessBeginContour() { + requireState(TessState.T_IN_POLYGON); + + state = TessState.T_IN_CONTOUR; + lastEdge = null; + if (cacheCount > 0) { +/* Just set a flag so we don't get confused by empty contours + * -- these can be generated accidentally with the obsolete + * NextContour() interface. + */ + flushCacheOnNextVertex = true; + } + } + + + public void gluTessEndContour() { + requireState(TessState.T_IN_CONTOUR); + state = TessState.T_IN_POLYGON; + } + + public void gluTessEndPolygon() { + GLUmesh mesh; + + try { + requireState(TessState.T_IN_POLYGON); + state = TessState.T_DORMANT; + + if (this.mesh == null) { + if (!flagBoundary /*&& callMesh == NULL_CB*/) { + +/* Try some special code to make the easy cases go quickly + * (eg. convex polygons). This code does NOT handle multiple contours, + * intersections, edge flags, and of course it does not generate + * an explicit mesh either. + */ + if (Render.__gl_renderCache(this)) { + polygonData = null; + return; + } + } + if (!flushCache()) throw new RuntimeException(); /* could've used a label*/ + } + +/* Determine the polygon normal and project vertices onto the plane + * of the polygon. + */ + Normal.__gl_projectPolygon(this); + +/* __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by windingRule. + * Each interior region is guaranteed be monotone. + */ + if (!Sweep.__gl_computeInterior(this)) { + throw new RuntimeException(); /* could've used a label */ + } + + mesh = this.mesh; + if (!fatalError) { + boolean rc = true; + +/* If the user wants only the boundary contours, we throw away all edges + * except those which separate the interior from the exterior. + * Otherwise we tessellate all the regions marked "inside". + */ + if (boundaryOnly) { + rc = TessMono.__gl_meshSetWindingNumber(mesh, 1, true); + } else { + rc = TessMono.__gl_meshTessellateInterior(mesh); + } + if (!rc) throw new RuntimeException(); /* could've used a label */ + + Mesh.__gl_meshCheckMesh(mesh); + + if (callBegin != NULL_CB || callEnd != NULL_CB + || callVertex != NULL_CB || callEdgeFlag != NULL_CB + || callBeginData != NULL_CB + || callEndData != NULL_CB + || callVertexData != NULL_CB + || callEdgeFlagData != NULL_CB) { + if (boundaryOnly) { + Render.__gl_renderBoundary(this, mesh); /* output boundary contours */ + } else { + Render.__gl_renderMesh(this, mesh); /* output strips and fans */ + } + } +// if (callMesh != NULL_CB) { +// +///* Throw away the exterior faces, so that all faces are interior. +// * This way the user doesn't have to check the "inside" flag, +// * and we don't need to even reveal its existence. It also leaves +// * the freedom for an implementation to not generate the exterior +// * faces in the first place. +// */ +// TessMono.__gl_meshDiscardExterior(mesh); +// callMesh.mesh(mesh); /* user wants the mesh itself */ +// mesh = null; +// polygonData = null; +// return; +// } + } + Mesh.__gl_meshDeleteMesh(mesh); + polygonData = null; + mesh = null; + } catch (Exception e) { + e.printStackTrace(); + callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); + } + } + + /*******************************************************/ + +/* Obsolete calls -- for backward compatibility */ + + public void gluBeginPolygon() { + gluTessBeginPolygon(null); + gluTessBeginContour(); + } + + +/*ARGSUSED*/ + public void gluNextContour(int type) { + gluTessEndContour(); + gluTessBeginContour(); + } + + + public void gluEndPolygon() { + gluTessEndContour(); + gluTessEndPolygon(); + } + + void callBeginOrBeginData(int a) { + if (callBeginData != NULL_CB) + callBeginData.beginData(a, polygonData); + else + callBegin.begin(a); + } + + void callVertexOrVertexData(Object a) { + if (callVertexData != NULL_CB) + callVertexData.vertexData(a, polygonData); + else + callVertex.vertex(a); + } + + void callEdgeFlagOrEdgeFlagData(boolean a) { + if (callEdgeFlagData != NULL_CB) + callEdgeFlagData.edgeFlagData(a, polygonData); + else + callEdgeFlag.edgeFlag(a); + } + + void callEndOrEndData() { + if (callEndData != NULL_CB) + callEndData.endData(polygonData); + else + callEnd.end(); + } + + void callCombineOrCombineData(double[] coords, Object[] vertexData, float[] weights, Object[] outData) { + if (callCombineData != NULL_CB) + callCombineData.combineData(coords, vertexData, weights, outData, polygonData); + else + callCombine.combine(coords, vertexData, weights, outData); + } + + void callErrorOrErrorData(int a) { + if (callErrorData != NULL_CB) + callErrorData.errorData(a, polygonData); + else + callError.error(a); + } + +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/GLUvertex.java b/src/classes/com/sun/opengl/impl/tessellator/GLUvertex.java new file mode 100644 index 000000000..05836beda --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/GLUvertex.java @@ -0,0 +1,55 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +class GLUvertex { + public GLUvertex next; /* next vertex (never NULL) */ + public GLUvertex prev; /* previous vertex (never NULL) */ + public com.sun.opengl.impl.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */ + public Object data; /* client's data */ + + /* Internal data (keep hidden) */ + public double[] coords = new double[3]; /* vertex location in 3D */ + public double s, t; /* projection onto the sweep plane */ + public int pqHandle; /* to allow deletion from priority queue */ +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/Geom.java b/src/classes/com/sun/opengl/impl/tessellator/Geom.java new file mode 100644 index 000000000..10e3d8050 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/Geom.java @@ -0,0 +1,308 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +class Geom { + private Geom() { + } + + /* Given three vertices u,v,w such that VertLeq(u,v) && VertLeq(v,w), + * evaluates the t-coord of the edge uw at the s-coord of the vertex v. + * Returns v->t - (uw)(v->s), ie. the signed distance from uw to v. + * If uw is vertical (and thus passes thru v), the result is zero. + * + * The calculation is extremely accurate and stable, even when v + * is very close to u or w. In particular if we set v->t = 0 and + * let r be the negated result (this evaluates (uw)(v->s)), then + * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). + */ + static double EdgeEval(GLUvertex u, GLUvertex v, GLUvertex w) { + double gapL, gapR; + + assert (VertLeq(u, v) && VertLeq(v, w)); + + gapL = v.s - u.s; + gapR = w.s - v.s; + + if (gapL + gapR > 0) { + if (gapL < gapR) { + return (v.t - u.t) + (u.t - w.t) * (gapL / (gapL + gapR)); + } else { + return (v.t - w.t) + (w.t - u.t) * (gapR / (gapL + gapR)); + } + } + /* vertical line */ + return 0; + } + + static double EdgeSign(GLUvertex u, GLUvertex v, GLUvertex w) { + double gapL, gapR; + + assert (VertLeq(u, v) && VertLeq(v, w)); + + gapL = v.s - u.s; + gapR = w.s - v.s; + + if (gapL + gapR > 0) { + return (v.t - w.t) * gapL + (v.t - u.t) * gapR; + } + /* vertical line */ + return 0; + } + + + /*********************************************************************** + * Define versions of EdgeSign, EdgeEval with s and t transposed. + */ + + static double TransEval(GLUvertex u, GLUvertex v, GLUvertex w) { + /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), + * evaluates the t-coord of the edge uw at the s-coord of the vertex v. + * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. + * If uw is vertical (and thus passes thru v), the result is zero. + * + * The calculation is extremely accurate and stable, even when v + * is very close to u or w. In particular if we set v->s = 0 and + * let r be the negated result (this evaluates (uw)(v->t)), then + * r is guaranteed to satisfy MIN(u->s,w->s) <= r <= MAX(u->s,w->s). + */ + double gapL, gapR; + + assert (TransLeq(u, v) && TransLeq(v, w)); + + gapL = v.t - u.t; + gapR = w.t - v.t; + + if (gapL + gapR > 0) { + if (gapL < gapR) { + return (v.s - u.s) + (u.s - w.s) * (gapL / (gapL + gapR)); + } else { + return (v.s - w.s) + (w.s - u.s) * (gapR / (gapL + gapR)); + } + } + /* vertical line */ + return 0; + } + + static double TransSign(GLUvertex u, GLUvertex v, GLUvertex w) { + /* Returns a number whose sign matches TransEval(u,v,w) but which + * is cheaper to evaluate. Returns > 0, == 0 , or < 0 + * as v is above, on, or below the edge uw. + */ + double gapL, gapR; + + assert (TransLeq(u, v) && TransLeq(v, w)); + + gapL = v.t - u.t; + gapR = w.t - v.t; + + if (gapL + gapR > 0) { + return (v.s - w.s) * gapL + (v.s - u.s) * gapR; + } + /* vertical line */ + return 0; + } + + + static boolean VertCCW(GLUvertex u, GLUvertex v, GLUvertex w) { + /* For almost-degenerate situations, the results are not reliable. + * Unless the floating-point arithmetic can be performed without + * rounding errors, *any* implementation will give incorrect results + * on some degenerate inputs, so the client must have some way to + * handle this situation. + */ + return (u.s * (v.t - w.t) + v.s * (w.t - u.t) + w.s * (u.t - v.t)) >= 0; + } + +/* Given parameters a,x,b,y returns the value (b*x+a*y)/(a+b), + * or (x+y)/2 if a==b==0. It requires that a,b >= 0, and enforces + * this in the rare case that one argument is slightly negative. + * The implementation is extremely stable numerically. + * In particular it guarantees that the result r satisfies + * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate + * even when a and b differ greatly in magnitude. + */ + static double Interpolate(double a, double x, double b, double y) { + a = (a < 0) ? 0 : a; + b = (b < 0) ? 0 : b; + if (a <= b) { + if (b == 0) { + return (x + y) / 2.0; + } else { + return (x + (y - x) * (a / (a + b))); + } + } else { + return (y + (x - y) * (b / (a + b))); + } + } + + static void EdgeIntersect(GLUvertex o1, GLUvertex d1, + GLUvertex o2, GLUvertex d2, + GLUvertex v) +/* Given edges (o1,d1) and (o2,d2), compute their point of intersection. + * The computed point is guaranteed to lie in the intersection of the + * bounding rectangles defined by each edge. + */ { + double z1, z2; + + /* This is certainly not the most efficient way to find the intersection + * of two line segments, but it is very numerically stable. + * + * Strategy: find the two middle vertices in the VertLeq ordering, + * and interpolate the intersection s-value from these. Then repeat + * using the TransLeq ordering to find the intersection t-value. + */ + + if (!VertLeq(o1, d1)) { + GLUvertex temp = o1; + o1 = d1; + d1 = temp; + } + if (!VertLeq(o2, d2)) { + GLUvertex temp = o2; + o2 = d2; + d2 = temp; + } + if (!VertLeq(o1, o2)) { + GLUvertex temp = o1; + o1 = o2; + o2 = temp; + temp = d1; + d1 = d2; + d2 = temp; + } + + if (!VertLeq(o2, d1)) { + /* Technically, no intersection -- do our best */ + v.s = (o2.s + d1.s) / 2.0; + } else if (VertLeq(d1, d2)) { + /* Interpolate between o2 and d1 */ + z1 = EdgeEval(o1, o2, d1); + z2 = EdgeEval(o2, d1, d2); + if (z1 + z2 < 0) { + z1 = -z1; + z2 = -z2; + } + v.s = Interpolate(z1, o2.s, z2, d1.s); + } else { + /* Interpolate between o2 and d2 */ + z1 = EdgeSign(o1, o2, d1); + z2 = -EdgeSign(o1, d2, d1); + if (z1 + z2 < 0) { + z1 = -z1; + z2 = -z2; + } + v.s = Interpolate(z1, o2.s, z2, d2.s); + } + + /* Now repeat the process for t */ + + if (!TransLeq(o1, d1)) { + GLUvertex temp = o1; + o1 = d1; + d1 = temp; + } + if (!TransLeq(o2, d2)) { + GLUvertex temp = o2; + o2 = d2; + d2 = temp; + } + if (!TransLeq(o1, o2)) { + GLUvertex temp = o2; + o2 = o1; + o1 = temp; + temp = d2; + d2 = d1; + d1 = temp; + } + + if (!TransLeq(o2, d1)) { + /* Technically, no intersection -- do our best */ + v.t = (o2.t + d1.t) / 2.0; + } else if (TransLeq(d1, d2)) { + /* Interpolate between o2 and d1 */ + z1 = TransEval(o1, o2, d1); + z2 = TransEval(o2, d1, d2); + if (z1 + z2 < 0) { + z1 = -z1; + z2 = -z2; + } + v.t = Interpolate(z1, o2.t, z2, d1.t); + } else { + /* Interpolate between o2 and d2 */ + z1 = TransSign(o1, o2, d1); + z2 = -TransSign(o1, d2, d1); + if (z1 + z2 < 0) { + z1 = -z1; + z2 = -z2; + } + v.t = Interpolate(z1, o2.t, z2, d2.t); + } + } + + static boolean VertEq(GLUvertex u, GLUvertex v) { + return u.s == v.s && u.t == v.t; + } + + static boolean VertLeq(GLUvertex u, GLUvertex v) { + return u.s < v.s || (u.s == v.s && u.t <= v.t); + } + +/* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ + + static boolean TransLeq(GLUvertex u, GLUvertex v) { + return u.t < v.t || (u.t == v.t && u.s <= v.s); + } + + static boolean EdgeGoesLeft(GLUhalfEdge e) { + return VertLeq(e.Sym.Org, e.Org); + } + + static boolean EdgeGoesRight(GLUhalfEdge e) { + return VertLeq(e.Org, e.Sym.Org); + } + + static double VertL1dist(GLUvertex u, GLUvertex v) { + return Math.abs(u.s - v.s) + Math.abs(u.t - v.t); + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/Mesh.java b/src/classes/com/sun/opengl/impl/tessellator/Mesh.java new file mode 100644 index 000000000..f5a81f65d --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/Mesh.java @@ -0,0 +1,724 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +class Mesh { + private Mesh() { + } + + /************************ Utility Routines ************************/ +/* MakeEdge creates a new pair of half-edges which form their own loop. + * No vertex or face structures are allocated, but these must be assigned + * before the current edge operation is completed. + */ + static com.sun.opengl.impl.tessellator.GLUhalfEdge MakeEdge(com.sun.opengl.impl.tessellator.GLUhalfEdge eNext) { + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + com.sun.opengl.impl.tessellator.GLUhalfEdge eSym; + com.sun.opengl.impl.tessellator.GLUhalfEdge ePrev; + +// EdgePair * pair = (EdgePair *) +// memAlloc(sizeof(EdgePair)); +// if (pair == NULL) return NULL; +// +// e = &pair - > e; + e = new com.sun.opengl.impl.tessellator.GLUhalfEdge(true); +// eSym = &pair - > eSym; + eSym = new com.sun.opengl.impl.tessellator.GLUhalfEdge(false); + + + /* Make sure eNext points to the first edge of the edge pair */ + if (!eNext.first) { + eNext = eNext.Sym; + } + + /* Insert in circular doubly-linked list before eNext. + * Note that the prev pointer is stored in Sym->next. + */ + ePrev = eNext.Sym.next; + eSym.next = ePrev; + ePrev.Sym.next = e; + e.next = eNext; + eNext.Sym.next = eSym; + + e.Sym = eSym; + e.Onext = e; + e.Lnext = eSym; + e.Org = null; + e.Lface = null; + e.winding = 0; + e.activeRegion = null; + + eSym.Sym = e; + eSym.Onext = eSym; + eSym.Lnext = e; + eSym.Org = null; + eSym.Lface = null; + eSym.winding = 0; + eSym.activeRegion = null; + + return e; + } + +/* Splice( a, b ) is best described by the Guibas/Stolfi paper or the + * CS348a notes (see mesh.h). Basically it modifies the mesh so that + * a->Onext and b->Onext are exchanged. This can have various effects + * depending on whether a and b belong to different face or vertex rings. + * For more explanation see __gl_meshSplice() below. + */ + static void Splice(com.sun.opengl.impl.tessellator.GLUhalfEdge a, com.sun.opengl.impl.tessellator.GLUhalfEdge b) { + com.sun.opengl.impl.tessellator.GLUhalfEdge aOnext = a.Onext; + com.sun.opengl.impl.tessellator.GLUhalfEdge bOnext = b.Onext; + + aOnext.Sym.Lnext = b; + bOnext.Sym.Lnext = a; + a.Onext = bOnext; + b.Onext = aOnext; + } + +/* MakeVertex( newVertex, eOrig, vNext ) attaches a new vertex and makes it the + * origin of all edges in the vertex loop to which eOrig belongs. "vNext" gives + * a place to insert the new vertex in the global vertex list. We insert + * the new vertex *before* vNext so that algorithms which walk the vertex + * list will not see the newly created vertices. + */ + static void MakeVertex(com.sun.opengl.impl.tessellator.GLUvertex newVertex, + com.sun.opengl.impl.tessellator.GLUhalfEdge eOrig, com.sun.opengl.impl.tessellator.GLUvertex vNext) { + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + com.sun.opengl.impl.tessellator.GLUvertex vPrev; + com.sun.opengl.impl.tessellator.GLUvertex vNew = newVertex; + + assert (vNew != null); + + /* insert in circular doubly-linked list before vNext */ + vPrev = vNext.prev; + vNew.prev = vPrev; + vPrev.next = vNew; + vNew.next = vNext; + vNext.prev = vNew; + + vNew.anEdge = eOrig; + vNew.data = null; + /* leave coords, s, t undefined */ + + /* fix other edges on this vertex loop */ + e = eOrig; + do { + e.Org = vNew; + e = e.Onext; + } while (e != eOrig); + } + +/* MakeFace( newFace, eOrig, fNext ) attaches a new face and makes it the left + * face of all edges in the face loop to which eOrig belongs. "fNext" gives + * a place to insert the new face in the global face list. We insert + * the new face *before* fNext so that algorithms which walk the face + * list will not see the newly created faces. + */ + static void MakeFace(com.sun.opengl.impl.tessellator.GLUface newFace, com.sun.opengl.impl.tessellator.GLUhalfEdge eOrig, com.sun.opengl.impl.tessellator.GLUface fNext) { + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + com.sun.opengl.impl.tessellator.GLUface fPrev; + com.sun.opengl.impl.tessellator.GLUface fNew = newFace; + + assert (fNew != null); + + /* insert in circular doubly-linked list before fNext */ + fPrev = fNext.prev; + fNew.prev = fPrev; + fPrev.next = fNew; + fNew.next = fNext; + fNext.prev = fNew; + + fNew.anEdge = eOrig; + fNew.data = null; + fNew.trail = null; + fNew.marked = false; + + /* The new face is marked "inside" if the old one was. This is a + * convenience for the common case where a face has been split in two. + */ + fNew.inside = fNext.inside; + + /* fix other edges on this face loop */ + e = eOrig; + do { + e.Lface = fNew; + e = e.Lnext; + } while (e != eOrig); + } + +/* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym), + * and removes from the global edge list. + */ + static void KillEdge(com.sun.opengl.impl.tessellator.GLUhalfEdge eDel) { + com.sun.opengl.impl.tessellator.GLUhalfEdge ePrev, eNext; + + /* Half-edges are allocated in pairs, see EdgePair above */ + if (!eDel.first) { + eDel = eDel.Sym; + } + + /* delete from circular doubly-linked list */ + eNext = eDel.next; + ePrev = eDel.Sym.next; + eNext.Sym.next = ePrev; + ePrev.Sym.next = eNext; + } + + +/* KillVertex( vDel ) destroys a vertex and removes it from the global + * vertex list. It updates the vertex loop to point to a given new vertex. + */ + static void KillVertex(com.sun.opengl.impl.tessellator.GLUvertex vDel, com.sun.opengl.impl.tessellator.GLUvertex newOrg) { + com.sun.opengl.impl.tessellator.GLUhalfEdge e, eStart = vDel.anEdge; + com.sun.opengl.impl.tessellator.GLUvertex vPrev, vNext; + + /* change the origin of all affected edges */ + e = eStart; + do { + e.Org = newOrg; + e = e.Onext; + } while (e != eStart); + + /* delete from circular doubly-linked list */ + vPrev = vDel.prev; + vNext = vDel.next; + vNext.prev = vPrev; + vPrev.next = vNext; + } + +/* KillFace( fDel ) destroys a face and removes it from the global face + * list. It updates the face loop to point to a given new face. + */ + static void KillFace(com.sun.opengl.impl.tessellator.GLUface fDel, com.sun.opengl.impl.tessellator.GLUface newLface) { + com.sun.opengl.impl.tessellator.GLUhalfEdge e, eStart = fDel.anEdge; + com.sun.opengl.impl.tessellator.GLUface fPrev, fNext; + + /* change the left face of all affected edges */ + e = eStart; + do { + e.Lface = newLface; + e = e.Lnext; + } while (e != eStart); + + /* delete from circular doubly-linked list */ + fPrev = fDel.prev; + fNext = fDel.next; + fNext.prev = fPrev; + fPrev.next = fNext; + } + + + /****************** Basic Edge Operations **********************/ + +/* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). + * The loop consists of the two new half-edges. + */ + public static com.sun.opengl.impl.tessellator.GLUhalfEdge __gl_meshMakeEdge(com.sun.opengl.impl.tessellator.GLUmesh mesh) { + com.sun.opengl.impl.tessellator.GLUvertex newVertex1 = new com.sun.opengl.impl.tessellator.GLUvertex(); + com.sun.opengl.impl.tessellator.GLUvertex newVertex2 = new com.sun.opengl.impl.tessellator.GLUvertex(); + com.sun.opengl.impl.tessellator.GLUface newFace = new com.sun.opengl.impl.tessellator.GLUface(); + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + + e = MakeEdge(mesh.eHead); + if (e == null) return null; + + MakeVertex(newVertex1, e, mesh.vHead); + MakeVertex(newVertex2, e.Sym, mesh.vHead); + MakeFace(newFace, e, mesh.fHead); + return e; + } + + +/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the + * mesh connectivity and topology. It changes the mesh so that + * eOrg->Onext <- OLD( eDst->Onext ) + * eDst->Onext <- OLD( eOrg->Onext ) + * where OLD(...) means the value before the meshSplice operation. + * + * This can have two effects on the vertex structure: + * - if eOrg->Org != eDst->Org, the two vertices are merged together + * - if eOrg->Org == eDst->Org, the origin is split into two vertices + * In both cases, eDst->Org is changed and eOrg->Org is untouched. + * + * Similarly (and independently) for the face structure, + * - if eOrg->Lface == eDst->Lface, one loop is split into two + * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one + * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. + * + * Some special cases: + * If eDst == eOrg, the operation has no effect. + * If eDst == eOrg->Lnext, the new face will have a single edge. + * If eDst == eOrg->Lprev, the old face will have a single edge. + * If eDst == eOrg->Onext, the new vertex will have a single edge. + * If eDst == eOrg->Oprev, the old vertex will have a single edge. + */ + public static boolean __gl_meshSplice(com.sun.opengl.impl.tessellator.GLUhalfEdge eOrg, com.sun.opengl.impl.tessellator.GLUhalfEdge eDst) { + boolean joiningLoops = false; + boolean joiningVertices = false; + + if (eOrg == eDst) return true; + + if (eDst.Org != eOrg.Org) { + /* We are merging two disjoint vertices -- destroy eDst->Org */ + joiningVertices = true; + KillVertex(eDst.Org, eOrg.Org); + } + if (eDst.Lface != eOrg.Lface) { + /* We are connecting two disjoint loops -- destroy eDst.Lface */ + joiningLoops = true; + KillFace(eDst.Lface, eOrg.Lface); + } + + /* Change the edge structure */ + Splice(eDst, eOrg); + + if (!joiningVertices) { + com.sun.opengl.impl.tessellator.GLUvertex newVertex = new com.sun.opengl.impl.tessellator.GLUvertex(); + + /* We split one vertex into two -- the new vertex is eDst.Org. + * Make sure the old vertex points to a valid half-edge. + */ + MakeVertex(newVertex, eDst, eOrg.Org); + eOrg.Org.anEdge = eOrg; + } + if (!joiningLoops) { + com.sun.opengl.impl.tessellator.GLUface newFace = new com.sun.opengl.impl.tessellator.GLUface(); + + /* We split one loop into two -- the new loop is eDst.Lface. + * Make sure the old face points to a valid half-edge. + */ + MakeFace(newFace, eDst, eOrg.Lface); + eOrg.Lface.anEdge = eOrg; + } + + return true; + } + + +/* __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: + * if (eDel.Lface != eDel.Rface), we join two loops into one; the loop + * eDel.Lface is deleted. Otherwise, we are splitting one loop into two; + * the newly created loop will contain eDel.Dst. If the deletion of eDel + * would create isolated vertices, those are deleted as well. + * + * This function could be implemented as two calls to __gl_meshSplice + * plus a few calls to memFree, but this would allocate and delete + * unnecessary vertices and faces. + */ + static boolean __gl_meshDelete(com.sun.opengl.impl.tessellator.GLUhalfEdge eDel) { + com.sun.opengl.impl.tessellator.GLUhalfEdge eDelSym = eDel.Sym; + boolean joiningLoops = false; + + /* First step: disconnect the origin vertex eDel.Org. We make all + * changes to get a consistent mesh in this "intermediate" state. + */ + if (eDel.Lface != eDel.Sym.Lface) { + /* We are joining two loops into one -- remove the left face */ + joiningLoops = true; + KillFace(eDel.Lface, eDel.Sym.Lface); + } + + if (eDel.Onext == eDel) { + KillVertex(eDel.Org, null); + } else { + /* Make sure that eDel.Org and eDel.Sym.Lface point to valid half-edges */ + eDel.Sym.Lface.anEdge = eDel.Sym.Lnext; + eDel.Org.anEdge = eDel.Onext; + + Splice(eDel, eDel.Sym.Lnext); + if (!joiningLoops) { + com.sun.opengl.impl.tessellator.GLUface newFace = new com.sun.opengl.impl.tessellator.GLUface(); + + /* We are splitting one loop into two -- create a new loop for eDel. */ + MakeFace(newFace, eDel, eDel.Lface); + } + } + + /* Claim: the mesh is now in a consistent state, except that eDel.Org + * may have been deleted. Now we disconnect eDel.Dst. + */ + if (eDelSym.Onext == eDelSym) { + KillVertex(eDelSym.Org, null); + KillFace(eDelSym.Lface, null); + } else { + /* Make sure that eDel.Dst and eDel.Lface point to valid half-edges */ + eDel.Lface.anEdge = eDelSym.Sym.Lnext; + eDelSym.Org.anEdge = eDelSym.Onext; + Splice(eDelSym, eDelSym.Sym.Lnext); + } + + /* Any isolated vertices or faces have already been freed. */ + KillEdge(eDel); + + return true; + } + + + /******************** Other Edge Operations **********************/ + +/* All these routines can be implemented with the basic edge + * operations above. They are provided for convenience and efficiency. + */ + + +/* __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that + * eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex. + * eOrg and eNew will have the same left face. + */ + static com.sun.opengl.impl.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(com.sun.opengl.impl.tessellator.GLUhalfEdge eOrg) { + com.sun.opengl.impl.tessellator.GLUhalfEdge eNewSym; + com.sun.opengl.impl.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + + eNewSym = eNew.Sym; + + /* Connect the new edge appropriately */ + Splice(eNew, eOrg.Lnext); + + /* Set the vertex and face information */ + eNew.Org = eOrg.Sym.Org; + { + com.sun.opengl.impl.tessellator.GLUvertex newVertex = new com.sun.opengl.impl.tessellator.GLUvertex(); + + MakeVertex(newVertex, eNewSym, eNew.Org); + } + eNew.Lface = eNewSym.Lface = eOrg.Lface; + + return eNew; + } + + +/* __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, + * such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org. + * eOrg and eNew will have the same left face. + */ + public static com.sun.opengl.impl.tessellator.GLUhalfEdge __gl_meshSplitEdge(com.sun.opengl.impl.tessellator.GLUhalfEdge eOrg) { + com.sun.opengl.impl.tessellator.GLUhalfEdge eNew; + com.sun.opengl.impl.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); + + eNew = tempHalfEdge.Sym; + + /* Disconnect eOrg from eOrg.Sym.Org and connect it to eNew.Org */ + Splice(eOrg.Sym, eOrg.Sym.Sym.Lnext); + Splice(eOrg.Sym, eNew); + + /* Set the vertex and face information */ + eOrg.Sym.Org = eNew.Org; + eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */ + eNew.Sym.Lface = eOrg.Sym.Lface; + eNew.winding = eOrg.winding; /* copy old winding information */ + eNew.Sym.winding = eOrg.Sym.winding; + + return eNew; + } + + +/* __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg.Sym.Org + * to eDst.Org, and returns the corresponding half-edge eNew. + * If eOrg.Lface == eDst.Lface, this splits one loop into two, + * and the newly created loop is eNew.Lface. Otherwise, two disjoint + * loops are merged into one, and the loop eDst.Lface is destroyed. + * + * If (eOrg == eDst), the new face will have only two edges. + * If (eOrg.Lnext == eDst), the old face is reduced to a single edge. + * If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges. + */ + static com.sun.opengl.impl.tessellator.GLUhalfEdge __gl_meshConnect(com.sun.opengl.impl.tessellator.GLUhalfEdge eOrg, com.sun.opengl.impl.tessellator.GLUhalfEdge eDst) { + com.sun.opengl.impl.tessellator.GLUhalfEdge eNewSym; + boolean joiningLoops = false; + com.sun.opengl.impl.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + + eNewSym = eNew.Sym; + + if (eDst.Lface != eOrg.Lface) { + /* We are connecting two disjoint loops -- destroy eDst.Lface */ + joiningLoops = true; + KillFace(eDst.Lface, eOrg.Lface); + } + + /* Connect the new edge appropriately */ + Splice(eNew, eOrg.Lnext); + Splice(eNewSym, eDst); + + /* Set the vertex and face information */ + eNew.Org = eOrg.Sym.Org; + eNewSym.Org = eDst.Org; + eNew.Lface = eNewSym.Lface = eOrg.Lface; + + /* Make sure the old face points to a valid half-edge */ + eOrg.Lface.anEdge = eNewSym; + + if (!joiningLoops) { + com.sun.opengl.impl.tessellator.GLUface newFace = new com.sun.opengl.impl.tessellator.GLUface(); + + /* We split one loop into two -- the new loop is eNew.Lface */ + MakeFace(newFace, eNew, eOrg.Lface); + } + return eNew; + } + + + /******************** Other Operations **********************/ + +/* __gl_meshZapFace( fZap ) destroys a face and removes it from the + * global face list. All edges of fZap will have a null pointer as their + * left face. Any edges which also have a null pointer as their right face + * are deleted entirely (along with any isolated vertices this produces). + * An entire mesh can be deleted by zapping its faces, one at a time, + * in any order. Zapped faces cannot be used in further mesh operations! + */ + static void __gl_meshZapFace(com.sun.opengl.impl.tessellator.GLUface fZap) { + com.sun.opengl.impl.tessellator.GLUhalfEdge eStart = fZap.anEdge; + com.sun.opengl.impl.tessellator.GLUhalfEdge e, eNext, eSym; + com.sun.opengl.impl.tessellator.GLUface fPrev, fNext; + + /* walk around face, deleting edges whose right face is also null */ + eNext = eStart.Lnext; + do { + e = eNext; + eNext = e.Lnext; + + e.Lface = null; + if (e.Sym.Lface == null) { + /* delete the edge -- see __gl_MeshDelete above */ + + if (e.Onext == e) { + KillVertex(e.Org, null); + } else { + /* Make sure that e.Org points to a valid half-edge */ + e.Org.anEdge = e.Onext; + Splice(e, e.Sym.Lnext); + } + eSym = e.Sym; + if (eSym.Onext == eSym) { + KillVertex(eSym.Org, null); + } else { + /* Make sure that eSym.Org points to a valid half-edge */ + eSym.Org.anEdge = eSym.Onext; + Splice(eSym, eSym.Sym.Lnext); + } + KillEdge(e); + } + } while (e != eStart); + + /* delete from circular doubly-linked list */ + fPrev = fZap.prev; + fNext = fZap.next; + fNext.prev = fPrev; + fPrev.next = fNext; + } + + +/* __gl_meshNewMesh() creates a new mesh with no edges, no vertices, + * and no loops (what we usually call a "face"). + */ + public static com.sun.opengl.impl.tessellator.GLUmesh __gl_meshNewMesh() { + com.sun.opengl.impl.tessellator.GLUvertex v; + com.sun.opengl.impl.tessellator.GLUface f; + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + com.sun.opengl.impl.tessellator.GLUhalfEdge eSym; + com.sun.opengl.impl.tessellator.GLUmesh mesh = new com.sun.opengl.impl.tessellator.GLUmesh(); + + v = mesh.vHead; + f = mesh.fHead; + e = mesh.eHead; + eSym = mesh.eHeadSym; + + v.next = v.prev = v; + v.anEdge = null; + v.data = null; + + f.next = f.prev = f; + f.anEdge = null; + f.data = null; + f.trail = null; + f.marked = false; + f.inside = false; + + e.next = e; + e.Sym = eSym; + e.Onext = null; + e.Lnext = null; + e.Org = null; + e.Lface = null; + e.winding = 0; + e.activeRegion = null; + + eSym.next = eSym; + eSym.Sym = e; + eSym.Onext = null; + eSym.Lnext = null; + eSym.Org = null; + eSym.Lface = null; + eSym.winding = 0; + eSym.activeRegion = null; + + return mesh; + } + + +/* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in + * both meshes, and returns the new mesh (the old meshes are destroyed). + */ + static com.sun.opengl.impl.tessellator.GLUmesh __gl_meshUnion(com.sun.opengl.impl.tessellator.GLUmesh mesh1, com.sun.opengl.impl.tessellator.GLUmesh mesh2) { + com.sun.opengl.impl.tessellator.GLUface f1 = mesh1.fHead; + com.sun.opengl.impl.tessellator.GLUvertex v1 = mesh1.vHead; + com.sun.opengl.impl.tessellator.GLUhalfEdge e1 = mesh1.eHead; + com.sun.opengl.impl.tessellator.GLUface f2 = mesh2.fHead; + com.sun.opengl.impl.tessellator.GLUvertex v2 = mesh2.vHead; + com.sun.opengl.impl.tessellator.GLUhalfEdge e2 = mesh2.eHead; + + /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ + if (f2.next != f2) { + f1.prev.next = f2.next; + f2.next.prev = f1.prev; + f2.prev.next = f1; + f1.prev = f2.prev; + } + + if (v2.next != v2) { + v1.prev.next = v2.next; + v2.next.prev = v1.prev; + v2.prev.next = v1; + v1.prev = v2.prev; + } + + if (e2.next != e2) { + e1.Sym.next.Sym.next = e2.next; + e2.next.Sym.next = e1.Sym.next; + e2.Sym.next.Sym.next = e1; + e1.Sym.next = e2.Sym.next; + } + + return mesh1; + } + + +/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + */ + static void __gl_meshDeleteMeshZap(com.sun.opengl.impl.tessellator.GLUmesh mesh) { + com.sun.opengl.impl.tessellator.GLUface fHead = mesh.fHead; + + while (fHead.next != fHead) { + __gl_meshZapFace(fHead.next); + } + assert (mesh.vHead.next == mesh.vHead); + } + +/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + */ + public static void __gl_meshDeleteMesh(com.sun.opengl.impl.tessellator.GLUmesh mesh) { + com.sun.opengl.impl.tessellator.GLUface f, fNext; + com.sun.opengl.impl.tessellator.GLUvertex v, vNext; + com.sun.opengl.impl.tessellator.GLUhalfEdge e, eNext; + + for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) { + fNext = f.next; + } + + for (v = mesh.vHead.next; v != mesh.vHead; v = vNext) { + vNext = v.next; + } + + for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { + /* One call frees both e and e.Sym (see EdgePair above) */ + eNext = e.next; + } + } + +/* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. + */ + public static void __gl_meshCheckMesh(com.sun.opengl.impl.tessellator.GLUmesh mesh) { + com.sun.opengl.impl.tessellator.GLUface fHead = mesh.fHead; + com.sun.opengl.impl.tessellator.GLUvertex vHead = mesh.vHead; + com.sun.opengl.impl.tessellator.GLUhalfEdge eHead = mesh.eHead; + com.sun.opengl.impl.tessellator.GLUface f, fPrev; + com.sun.opengl.impl.tessellator.GLUvertex v, vPrev; + com.sun.opengl.impl.tessellator.GLUhalfEdge e, ePrev; + + fPrev = fHead; + for (fPrev = fHead; (f = fPrev.next) != fHead; fPrev = f) { + assert (f.prev == fPrev); + e = f.anEdge; + do { + assert (e.Sym != e); + assert (e.Sym.Sym == e); + assert (e.Lnext.Onext.Sym == e); + assert (e.Onext.Sym.Lnext == e); + assert (e.Lface == f); + e = e.Lnext; + } while (e != f.anEdge); + } + assert (f.prev == fPrev && f.anEdge == null && f.data == null); + + vPrev = vHead; + for (vPrev = vHead; (v = vPrev.next) != vHead; vPrev = v) { + assert (v.prev == vPrev); + e = v.anEdge; + do { + assert (e.Sym != e); + assert (e.Sym.Sym == e); + assert (e.Lnext.Onext.Sym == e); + assert (e.Onext.Sym.Lnext == e); + assert (e.Org == v); + e = e.Onext; + } while (e != v.anEdge); + } + assert (v.prev == vPrev && v.anEdge == null && v.data == null); + + ePrev = eHead; + for (ePrev = eHead; (e = ePrev.next) != eHead; ePrev = e) { + assert (e.Sym.next == ePrev.Sym); + assert (e.Sym != e); + assert (e.Sym.Sym == e); + assert (e.Org != null); + assert (e.Sym.Org != null); + assert (e.Lnext.Onext.Sym == e); + assert (e.Onext.Sym.Lnext == e); + } + assert (e.Sym.next == ePrev.Sym + && e.Sym == mesh.eHeadSym + && e.Sym.Sym == e + && e.Org == null && e.Sym.Org == null + && e.Lface == null && e.Sym.Lface == null); + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/Normal.java b/src/classes/com/sun/opengl/impl/tessellator/Normal.java new file mode 100644 index 000000000..98d4c50a1 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/Normal.java @@ -0,0 +1,278 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; + +class Normal { + private Normal() { + } + + static boolean SLANTED_SWEEP = false; + static double S_UNIT_X; /* Pre-normalized */ + static double S_UNIT_Y; + private static final boolean TRUE_PROJECT = false; + + static { + if (SLANTED_SWEEP) { +/* The "feature merging" is not intended to be complete. There are + * special cases where edges are nearly parallel to the sweep line + * which are not implemented. The algorithm should still behave + * robustly (ie. produce a reasonable tesselation) in the presence + * of such edges, however it may miss features which could have been + * merged. We could minimize this effect by choosing the sweep line + * direction to be something unusual (ie. not parallel to one of the + * coordinate axes). + */ + S_UNIT_X = 0.50941539564955385; /* Pre-normalized */ + S_UNIT_Y = 0.86052074622010633; + } else { + S_UNIT_X = 1.0; + S_UNIT_Y = 0.0; + } + } + + private static double Dot(double[] u, double[] v) { + return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]); + } + + static void Normalize(double[] v) { + double len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; + + assert (len > 0); + len = Math.sqrt(len); + v[0] /= len; + v[1] /= len; + v[2] /= len; + } + + static int LongAxis(double[] v) { + int i = 0; + + if (Math.abs(v[1]) > Math.abs(v[0])) { + i = 1; + } + if (Math.abs(v[2]) > Math.abs(v[i])) { + i = 2; + } + return i; + } + + static void ComputeNormal(GLUtessellatorImpl tess, double[] norm) { + com.sun.opengl.impl.tessellator.GLUvertex v, v1, v2; + double c, tLen2, maxLen2; + double[] maxVal, minVal, d1, d2, tNorm; + com.sun.opengl.impl.tessellator.GLUvertex[] maxVert, minVert; + com.sun.opengl.impl.tessellator.GLUvertex vHead = tess.mesh.vHead; + int i; + + maxVal = new double[3]; + minVal = new double[3]; + minVert = new com.sun.opengl.impl.tessellator.GLUvertex[3]; + maxVert = new com.sun.opengl.impl.tessellator.GLUvertex[3]; + d1 = new double[3]; + d2 = new double[3]; + tNorm = new double[3]; + + maxVal[0] = maxVal[1] = maxVal[2] = -2 * GLU.GLU_TESS_MAX_COORD; + minVal[0] = minVal[1] = minVal[2] = 2 * GLU.GLU_TESS_MAX_COORD; + + for (v = vHead.next; v != vHead; v = v.next) { + for (i = 0; i < 3; ++i) { + c = v.coords[i]; + if (c < minVal[i]) { + minVal[i] = c; + minVert[i] = v; + } + if (c > maxVal[i]) { + maxVal[i] = c; + maxVert[i] = v; + } + } + } + +/* Find two vertices separated by at least 1/sqrt(3) of the maximum + * distance between any two vertices + */ + i = 0; + if (maxVal[1] - minVal[1] > maxVal[0] - minVal[0]) { + i = 1; + } + if (maxVal[2] - minVal[2] > maxVal[i] - minVal[i]) { + i = 2; + } + if (minVal[i] >= maxVal[i]) { +/* All vertices are the same -- normal doesn't matter */ + norm[0] = 0; + norm[1] = 0; + norm[2] = 1; + return; + } + +/* Look for a third vertex which forms the triangle with maximum area + * (Length of normal == twice the triangle area) + */ + maxLen2 = 0; + v1 = minVert[i]; + v2 = maxVert[i]; + d1[0] = v1.coords[0] - v2.coords[0]; + d1[1] = v1.coords[1] - v2.coords[1]; + d1[2] = v1.coords[2] - v2.coords[2]; + for (v = vHead.next; v != vHead; v = v.next) { + d2[0] = v.coords[0] - v2.coords[0]; + d2[1] = v.coords[1] - v2.coords[1]; + d2[2] = v.coords[2] - v2.coords[2]; + tNorm[0] = d1[1] * d2[2] - d1[2] * d2[1]; + tNorm[1] = d1[2] * d2[0] - d1[0] * d2[2]; + tNorm[2] = d1[0] * d2[1] - d1[1] * d2[0]; + tLen2 = tNorm[0] * tNorm[0] + tNorm[1] * tNorm[1] + tNorm[2] * tNorm[2]; + if (tLen2 > maxLen2) { + maxLen2 = tLen2; + norm[0] = tNorm[0]; + norm[1] = tNorm[1]; + norm[2] = tNorm[2]; + } + } + + if (maxLen2 <= 0) { +/* All points lie on a single line -- any decent normal will do */ + norm[0] = norm[1] = norm[2] = 0; + norm[LongAxis(d1)] = 1; + } + } + + static void CheckOrientation(GLUtessellatorImpl tess) { + double area; + com.sun.opengl.impl.tessellator.GLUface f, fHead = tess.mesh.fHead; + com.sun.opengl.impl.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + +/* When we compute the normal automatically, we choose the orientation + * so that the the sum of the signed areas of all contours is non-negative. + */ + area = 0; + for (f = fHead.next; f != fHead; f = f.next) { + e = f.anEdge; + if (e.winding <= 0) continue; + do { + area += (e.Org.s - e.Sym.Org.s) * (e.Org.t + e.Sym.Org.t); + e = e.Lnext; + } while (e != f.anEdge); + } + if (area < 0) { +/* Reverse the orientation by flipping all the t-coordinates */ + for (v = vHead.next; v != vHead; v = v.next) { + v.t = -v.t; + } + tess.tUnit[0] = -tess.tUnit[0]; + tess.tUnit[1] = -tess.tUnit[1]; + tess.tUnit[2] = -tess.tUnit[2]; + } + } + +/* Determine the polygon normal and project vertices onto the plane + * of the polygon. + */ + public static void __gl_projectPolygon(GLUtessellatorImpl tess) { + com.sun.opengl.impl.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + double w; + double[] norm = new double[3]; + double[] sUnit, tUnit; + int i; + boolean computedNormal = false; + + norm[0] = tess.normal[0]; + norm[1] = tess.normal[1]; + norm[2] = tess.normal[2]; + if (norm[0] == 0 && norm[1] == 0 && norm[2] == 0) { + ComputeNormal(tess, norm); + computedNormal = true; + } + sUnit = tess.sUnit; + tUnit = tess.tUnit; + i = LongAxis(norm); + + if (TRUE_PROJECT) { +/* Choose the initial sUnit vector to be approximately perpendicular + * to the normal. + */ + Normalize(norm); + + sUnit[i] = 0; + sUnit[(i + 1) % 3] = S_UNIT_X; + sUnit[(i + 2) % 3] = S_UNIT_Y; + +/* Now make it exactly perpendicular */ + w = Dot(sUnit, norm); + sUnit[0] -= w * norm[0]; + sUnit[1] -= w * norm[1]; + sUnit[2] -= w * norm[2]; + Normalize(sUnit); + +/* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */ + tUnit[0] = norm[1] * sUnit[2] - norm[2] * sUnit[1]; + tUnit[1] = norm[2] * sUnit[0] - norm[0] * sUnit[2]; + tUnit[2] = norm[0] * sUnit[1] - norm[1] * sUnit[0]; + Normalize(tUnit); + } else { +/* Project perpendicular to a coordinate axis -- better numerically */ + sUnit[i] = 0; + sUnit[(i + 1) % 3] = S_UNIT_X; + sUnit[(i + 2) % 3] = S_UNIT_Y; + + tUnit[i] = 0; + tUnit[(i + 1) % 3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y; + tUnit[(i + 2) % 3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X; + } + +/* Project the vertices onto the sweep plane */ + for (v = vHead.next; v != vHead; v = v.next) { + v.s = Dot(v.coords, sUnit); + v.t = Dot(v.coords, tUnit); + } + if (computedNormal) { + CheckOrientation(tess); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/PriorityQ.java b/src/classes/com/sun/opengl/impl/tessellator/PriorityQ.java new file mode 100644 index 000000000..84c00eb82 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/PriorityQ.java @@ -0,0 +1,90 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +abstract class PriorityQ { + public static final int INIT_SIZE = 32; + + public static class PQnode { + int handle; + } + + public static class PQhandleElem { + Object key; + int node; + } + + public static interface Leq { + boolean leq(Object key1, Object key2); + } + + // #ifdef FOR_TRITE_TEST_PROGRAM +// private static boolean LEQ(PriorityQCommon.Leq leq, Object x,Object y) { +// return pq.leq.leq(x,y); +// } +// #else +/* Violates modularity, but a little faster */ +// #include "geom.h" + public static boolean LEQ(Leq leq, Object x, Object y) { + return com.sun.opengl.impl.tessellator.Geom.VertLeq((com.sun.opengl.impl.tessellator.GLUvertex) x, (com.sun.opengl.impl.tessellator.GLUvertex) y); + } + + static PriorityQ pqNewPriorityQ(Leq leq) { + return new PriorityQSort(leq); + } + + abstract void pqDeletePriorityQ(); + + abstract boolean pqInit(); + + abstract int pqInsert(Object keyNew); + + abstract Object pqExtractMin(); + + abstract void pqDelete(int hCurr); + + abstract Object pqMinimum(); + + abstract boolean pqIsEmpty(); +// #endif +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/PriorityQHeap.java b/src/classes/com/sun/opengl/impl/tessellator/PriorityQHeap.java new file mode 100644 index 000000000..f220a207e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/PriorityQHeap.java @@ -0,0 +1,254 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + + + +class PriorityQHeap extends com.sun.opengl.impl.tessellator.PriorityQ { + com.sun.opengl.impl.tessellator.PriorityQ.PQnode[] nodes; + com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[] handles; + int size, max; + int freeList; + boolean initialized; + com.sun.opengl.impl.tessellator.PriorityQ.Leq leq; + +/* really __gl_pqHeapNewPriorityQ */ + public PriorityQHeap(com.sun.opengl.impl.tessellator.PriorityQ.Leq leq) { + size = 0; + max = com.sun.opengl.impl.tessellator.PriorityQ.INIT_SIZE; + nodes = new com.sun.opengl.impl.tessellator.PriorityQ.PQnode[com.sun.opengl.impl.tessellator.PriorityQ.INIT_SIZE + 1]; + for (int i = 0; i < nodes.length; i++) { + nodes[i] = new PQnode(); + } + handles = new com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[com.sun.opengl.impl.tessellator.PriorityQ.INIT_SIZE + 1]; + for (int i = 0; i < handles.length; i++) { + handles[i] = new PQhandleElem(); + } + initialized = false; + freeList = 0; + this.leq = leq; + + nodes[1].handle = 1; /* so that Minimum() returns NULL */ + handles[1].key = null; + } + +/* really __gl_pqHeapDeletePriorityQ */ + void pqDeletePriorityQ() { + handles = null; + nodes = null; + } + + void FloatDown(int curr) { + com.sun.opengl.impl.tessellator.PriorityQ.PQnode[] n = nodes; + com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[] h = handles; + int hCurr, hChild; + int child; + + hCurr = n[curr].handle; + for (; ;) { + child = curr << 1; + if (child < size && LEQ(leq, h[n[child + 1].handle].key, + h[n[child].handle].key)) { + ++child; + } + + assert (child <= max); + + hChild = n[child].handle; + if (child > size || LEQ(leq, h[hCurr].key, h[hChild].key)) { + n[curr].handle = hCurr; + h[hCurr].node = curr; + break; + } + n[curr].handle = hChild; + h[hChild].node = curr; + curr = child; + } + } + + + void FloatUp(int curr) { + com.sun.opengl.impl.tessellator.PriorityQ.PQnode[] n = nodes; + com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[] h = handles; + int hCurr, hParent; + int parent; + + hCurr = n[curr].handle; + for (; ;) { + parent = curr >> 1; + hParent = n[parent].handle; + if (parent == 0 || LEQ(leq, h[hParent].key, h[hCurr].key)) { + n[curr].handle = hCurr; + h[hCurr].node = curr; + break; + } + n[curr].handle = hParent; + h[hParent].node = curr; + curr = parent; + } + } + +/* really __gl_pqHeapInit */ + boolean pqInit() { + int i; + + /* This method of building a heap is O(n), rather than O(n lg n). */ + + for (i = size; i >= 1; --i) { + FloatDown(i); + } + initialized = true; + + return true; + } + +/* really __gl_pqHeapInsert */ +/* returns LONG_MAX iff out of memory */ + int pqInsert(Object keyNew) { + int curr; + int free; + + curr = ++size; + if ((curr * 2) > max) { + com.sun.opengl.impl.tessellator.PriorityQ.PQnode[] saveNodes = nodes; + com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; + + /* If the heap overflows, double its size. */ + max <<= 1; +// pq->nodes = (PQnode *)memRealloc( pq->nodes, (size_t) ((pq->max + 1) * sizeof( pq->nodes[0] ))); + PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; + System.arraycopy( nodes, 0, pqNodes, 0, nodes.length ); + for (int i = nodes.length; i < pqNodes.length; i++) { + pqNodes[i] = new PQnode(); + } + nodes = pqNodes; + if (nodes == null) { + nodes = saveNodes; /* restore ptr to free upon return */ + return Integer.MAX_VALUE; + } + +// pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); + PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; + System.arraycopy( handles, 0, pqHandles, 0, handles.length ); + for (int i = handles.length; i < pqHandles.length; i++) { + pqHandles[i] = new PQhandleElem(); + } + handles = pqHandles; + if (handles == null) { + handles = saveHandles; /* restore ptr to free upon return */ + return Integer.MAX_VALUE; + } + } + + if (freeList == 0) { + free = curr; + } else { + free = freeList; + freeList = handles[free].node; + } + + nodes[curr].handle = free; + handles[free].node = curr; + handles[free].key = keyNew; + + if (initialized) { + FloatUp(curr); + } + assert (free != Integer.MAX_VALUE); + return free; + } + +/* really __gl_pqHeapExtractMin */ + Object pqExtractMin() { + com.sun.opengl.impl.tessellator.PriorityQ.PQnode[] n = nodes; + com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[] h = handles; + int hMin = n[1].handle; + Object min = h[hMin].key; + + if (size > 0) { + n[1].handle = n[size].handle; + h[n[1].handle].node = 1; + + h[hMin].key = null; + h[hMin].node = freeList; + freeList = hMin; + + if (--size > 0) { + FloatDown(1); + } + } + return min; + } + +/* really __gl_pqHeapDelete */ + void pqDelete(int hCurr) { + com.sun.opengl.impl.tessellator.PriorityQ.PQnode[] n = nodes; + com.sun.opengl.impl.tessellator.PriorityQ.PQhandleElem[] h = handles; + int curr; + + assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null); + + curr = h[hCurr].node; + n[curr].handle = n[size].handle; + h[n[curr].handle].node = curr; + + if (curr <= --size) { + if (curr <= 1 || LEQ(leq, h[n[curr >> 1].handle].key, h[n[curr].handle].key)) { + FloatDown(curr); + } else { + FloatUp(curr); + } + } + h[hCurr].key = null; + h[hCurr].node = freeList; + freeList = hCurr; + } + + Object pqMinimum() { + return handles[nodes[1].handle].key; + } + + boolean pqIsEmpty() { + return size == 0; + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/PriorityQSort.java b/src/classes/com/sun/opengl/impl/tessellator/PriorityQSort.java new file mode 100644 index 000000000..426c2d4ca --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/PriorityQSort.java @@ -0,0 +1,270 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + + + +class PriorityQSort extends com.sun.opengl.impl.tessellator.PriorityQ { + com.sun.opengl.impl.tessellator.PriorityQHeap heap; + Object[] keys; + + // JAVA: 'order' contains indices into the keys array. + // This simulates the indirect pointers used in the original C code + // (from Frank Suykens, Luciad.com). + int[] order; + int size, max; + boolean initialized; + com.sun.opengl.impl.tessellator.PriorityQ.Leq leq; + + public PriorityQSort(com.sun.opengl.impl.tessellator.PriorityQ.Leq leq) { + heap = new com.sun.opengl.impl.tessellator.PriorityQHeap(leq); + + keys = new Object[com.sun.opengl.impl.tessellator.PriorityQ.INIT_SIZE]; + + size = 0; + max = com.sun.opengl.impl.tessellator.PriorityQ.INIT_SIZE; + initialized = false; + this.leq = leq; + } + +/* really __gl_pqSortDeletePriorityQ */ + void pqDeletePriorityQ() { + if (heap != null) heap.pqDeletePriorityQ(); + order = null; + keys = null; + } + + private static boolean LT(com.sun.opengl.impl.tessellator.PriorityQ.Leq leq, Object x, Object y) { + return (!com.sun.opengl.impl.tessellator.PriorityQHeap.LEQ(leq, y, x)); + } + + private static boolean GT(com.sun.opengl.impl.tessellator.PriorityQ.Leq leq, Object x, Object y) { + return (!com.sun.opengl.impl.tessellator.PriorityQHeap.LEQ(leq, x, y)); + } + + private static void Swap(int[] array, int a, int b) { + if (true) { + int tmp = array[a]; + array[a] = array[b]; + array[b] = tmp; + } else { + + } + } + + private static class Stack { + int p, r; + } + +/* really __gl_pqSortInit */ + boolean pqInit() { + int p, r, i, j; + int piv; + Stack[] stack = new Stack[50]; + for (int k = 0; k < stack.length; k++) { + stack[k] = new Stack(); + } + int top = 0; + + int seed = 2016473283; + + /* Create an array of indirect pointers to the keys, so that we + * the handles we have returned are still valid. + */ + order = new int[size + 1]; +/* the previous line is a patch to compensate for the fact that IBM */ +/* machines return a null on a malloc of zero bytes (unlike SGI), */ +/* so we have to put in this defense to guard against a memory */ +/* fault four lines down. from fossum@austin.ibm.com. */ + p = 0; + r = size - 1; + for (piv = 0, i = p; i <= r; ++piv, ++i) { + // indirect pointers: keep an index into the keys array, not a direct pointer to its contents + order[i] = piv; + } + + /* Sort the indirect pointers in descending order, + * using randomized Quicksort + */ + stack[top].p = p; + stack[top].r = r; + ++top; + while (--top >= 0) { + p = stack[top].p; + r = stack[top].r; + while (r > p + 10) { + seed = Math.abs( seed * 1539415821 + 1 ); + i = p + seed % (r - p + 1); + piv = order[i]; + order[i] = order[p]; + order[p] = piv; + i = p - 1; + j = r + 1; + do { + do { + ++i; + } while (GT(leq, keys[order[i]], keys[piv])); + do { + --j; + } while (LT(leq, keys[order[j]], keys[piv])); + Swap(order, i, j); + } while (i < j); + Swap(order, i, j); /* Undo last swap */ + if (i - p < r - j) { + stack[top].p = j + 1; + stack[top].r = r; + ++top; + r = i - 1; + } else { + stack[top].p = p; + stack[top].r = i - 1; + ++top; + p = j + 1; + } + } + /* Insertion sort small lists */ + for (i = p + 1; i <= r; ++i) { + piv = order[i]; + for (j = i; j > p && LT(leq, keys[order[j - 1]], keys[piv]); --j) { + order[j] = order[j - 1]; + } + order[j] = piv; + } + } + max = size; + initialized = true; + heap.pqInit(); /* always succeeds */ + +/* #ifndef NDEBUG + p = order; + r = p + size - 1; + for (i = p; i < r; ++i) { + Assertion.doAssert(LEQ( * * (i + 1), **i )); + } + #endif*/ + + return true; + } + +/* really __gl_pqSortInsert */ +/* returns LONG_MAX iff out of memory */ + int pqInsert(Object keyNew) { + int curr; + + if (initialized) { + return heap.pqInsert(keyNew); + } + curr = size; + if (++size >= max) { + Object[] saveKey = keys; + + /* If the heap overflows, double its size. */ + max <<= 1; +// pq->keys = (PQHeapKey *)memRealloc( pq->keys,(size_t)(pq->max * sizeof( pq->keys[0] ))); + Object[] pqKeys = new Object[max]; + System.arraycopy( keys, 0, pqKeys, 0, keys.length ); + keys = pqKeys; + if (keys == null) { + keys = saveKey; /* restore ptr to free upon return */ + return Integer.MAX_VALUE; + } + } + assert curr != Integer.MAX_VALUE; + keys[curr] = keyNew; + + /* Negative handles index the sorted array. */ + return -(curr + 1); + } + +/* really __gl_pqSortExtractMin */ + Object pqExtractMin() { + Object sortMin, heapMin; + + if (size == 0) { + return heap.pqExtractMin(); + } + sortMin = keys[order[size - 1]]; + if (!heap.pqIsEmpty()) { + heapMin = heap.pqMinimum(); + if (LEQ(leq, heapMin, sortMin)) { + return heap.pqExtractMin(); + } + } + do { + --size; + } while (size > 0 && keys[order[size - 1]] == null); + return sortMin; + } + +/* really __gl_pqSortMinimum */ + Object pqMinimum() { + Object sortMin, heapMin; + + if (size == 0) { + return heap.pqMinimum(); + } + sortMin = keys[order[size - 1]]; + if (!heap.pqIsEmpty()) { + heapMin = heap.pqMinimum(); + if (com.sun.opengl.impl.tessellator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) { + return heapMin; + } + } + return sortMin; + } + +/* really __gl_pqSortIsEmpty */ + boolean pqIsEmpty() { + return (size == 0) && heap.pqIsEmpty(); + } + +/* really __gl_pqSortDelete */ + void pqDelete(int curr) { + if (curr >= 0) { + heap.pqDelete(curr); + return; + } + curr = -(curr + 1); + assert curr < max && keys[curr] != null; + + keys[curr] = null; + while (size > 0 && keys[order[size - 1]] == null) { + --size; + } + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/Render.java b/src/classes/com/sun/opengl/impl/tessellator/Render.java new file mode 100644 index 000000000..a7a126a4c --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/Render.java @@ -0,0 +1,547 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; + +class Render { + private static final boolean USE_OPTIMIZED_CODE_PATH = false; + + private Render() { + } + + private static final RenderFan renderFan = new RenderFan(); + private static final RenderStrip renderStrip = new RenderStrip(); + private static final RenderTriangle renderTriangle = new RenderTriangle(); + +/* This structure remembers the information we need about a primitive + * to be able to render it later, once we have determined which + * primitive is able to use the most triangles. + */ + private static class FaceCount { + public FaceCount() { + } + + public FaceCount(long size, com.sun.opengl.impl.tessellator.GLUhalfEdge eStart, renderCallBack render) { + this.size = size; + this.eStart = eStart; + this.render = render; + } + + long size; /* number of triangles used */ + com.sun.opengl.impl.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */ + renderCallBack render; + }; + + private static interface renderCallBack { + void render(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUhalfEdge e, long size); + } + + /************************ Strips and Fans decomposition ******************/ + +/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle + * fans, strips, and separate triangles. A substantial effort is made + * to use as few rendering primitives as possible (ie. to make the fans + * and strips as large as possible). + * + * The rendering output is provided as callbacks (see the api). + */ + public static void __gl_renderMesh(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUmesh mesh) { + com.sun.opengl.impl.tessellator.GLUface f; + + /* Make a list of separate triangles so we can render them all at once */ + tess.lonelyTriList = null; + + for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { + f.marked = false; + } + for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { + + /* We examine all faces in an arbitrary order. Whenever we find + * an unprocessed face F, we output a group of faces including F + * whose size is maximum. + */ + if (f.inside && !f.marked) { + RenderMaximumFaceGroup(tess, f); + assert (f.marked); + } + } + if (tess.lonelyTriList != null) { + RenderLonelyTriangles(tess, tess.lonelyTriList); + tess.lonelyTriList = null; + } + } + + + static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUface fOrig) { + /* We want to find the largest triangle fan or strip of unmarked faces + * which includes the given face fOrig. There are 3 possible fans + * passing through fOrig (one centered at each vertex), and 3 possible + * strips (one for each CCW permutation of the vertices). Our strategy + * is to try all of these, and take the primitive which uses the most + * triangles (a greedy approach). + */ + com.sun.opengl.impl.tessellator.GLUhalfEdge e = fOrig.anEdge; + FaceCount max = new FaceCount(); + FaceCount newFace = new FaceCount(); + + max.size = 1; + max.eStart = e; + max.render = renderTriangle; + + if (!tess.flagBoundary) { + newFace = MaximumFan(e); + if (newFace.size > max.size) { + max = newFace; + } + newFace = MaximumFan(e.Lnext); + if (newFace.size > max.size) { + max = newFace; + } + newFace = MaximumFan(e.Onext.Sym); + if (newFace.size > max.size) { + max = newFace; + } + + newFace = MaximumStrip(e); + if (newFace.size > max.size) { + max = newFace; + } + newFace = MaximumStrip(e.Lnext); + if (newFace.size > max.size) { + max = newFace; + } + newFace = MaximumStrip(e.Onext.Sym); + if (newFace.size > max.size) { + max = newFace; + } + } + max.render.render(tess, max.eStart, max.size); + } + + +/* Macros which keep track of faces we have marked temporarily, and allow + * us to backtrack when necessary. With triangle fans, this is not + * really necessary, since the only awkward case is a loop of triangles + * around a single origin vertex. However with strips the situation is + * more complicated, and we need a general tracking method like the + * one here. + */ + private static boolean Marked(com.sun.opengl.impl.tessellator.GLUface f) { + return !f.inside || f.marked; + } + + private static GLUface AddToTrail(com.sun.opengl.impl.tessellator.GLUface f, com.sun.opengl.impl.tessellator.GLUface t) { + f.trail = t; + f.marked = true; + return f; + } + + private static void FreeTrail(com.sun.opengl.impl.tessellator.GLUface t) { + if (true) { + while (t != null) { + t.marked = false; + t = t.trail; + } + } else { + /* absorb trailing semicolon */ + } + } + + static FaceCount MaximumFan(com.sun.opengl.impl.tessellator.GLUhalfEdge eOrig) { + /* eOrig.Lface is the face we want to render. We want to find the size + * of a maximal fan around eOrig.Org. To do this we just walk around + * the origin vertex as far as possible in both directions. + */ + FaceCount newFace = new FaceCount(0, null, renderFan); + com.sun.opengl.impl.tessellator.GLUface trail = null; + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + + for (e = eOrig; !Marked(e.Lface); e = e.Onext) { + trail = AddToTrail(e.Lface, trail); + ++newFace.size; + } + for (e = eOrig; !Marked(e.Sym.Lface); e = e.Sym.Lnext) { + trail = AddToTrail(e.Sym.Lface, trail); + ++newFace.size; + } + newFace.eStart = e; + /*LINTED*/ + FreeTrail(trail); + return newFace; + } + + + private static boolean IsEven(long n) { + return (n & 0x1L) == 0; + } + + static FaceCount MaximumStrip(com.sun.opengl.impl.tessellator.GLUhalfEdge eOrig) { + /* Here we are looking for a maximal strip that contains the vertices + * eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the + * reverse, such that all triangles are oriented CCW). + * + * Again we walk forward and backward as far as possible. However for + * strips there is a twist: to get CCW orientations, there must be + * an *even* number of triangles in the strip on one side of eOrig. + * We walk the strip starting on a side with an even number of triangles; + * if both side have an odd number, we are forced to shorten one side. + */ + FaceCount newFace = new FaceCount(0, null, renderStrip); + long headSize = 0, tailSize = 0; + com.sun.opengl.impl.tessellator.GLUface trail = null; + com.sun.opengl.impl.tessellator.GLUhalfEdge e, eTail, eHead; + + for (e = eOrig; !Marked(e.Lface); ++tailSize, e = e.Onext) { + trail = AddToTrail(e.Lface, trail); + ++tailSize; + e = e.Lnext.Sym; + if (Marked(e.Lface)) break; + trail = AddToTrail(e.Lface, trail); + } + eTail = e; + + for (e = eOrig; !Marked(e.Sym.Lface); ++headSize, e = e.Sym.Onext.Sym) { + trail = AddToTrail(e.Sym.Lface, trail); + ++headSize; + e = e.Sym.Lnext; + if (Marked(e.Sym.Lface)) break; + trail = AddToTrail(e.Sym.Lface, trail); + } + eHead = e; + + newFace.size = tailSize + headSize; + if (IsEven(tailSize)) { + newFace.eStart = eTail.Sym; + } else if (IsEven(headSize)) { + newFace.eStart = eHead; + } else { + /* Both sides have odd length, we must shorten one of them. In fact, + * we must start from eHead to guarantee inclusion of eOrig.Lface. + */ + --newFace.size; + newFace.eStart = eHead.Onext; + } + /*LINTED*/ + FreeTrail(trail); + return newFace; + } + + private static class RenderTriangle implements renderCallBack { + public void render(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUhalfEdge e, long size) { + /* Just add the triangle to a triangle list, so we can render all + * the separate triangles at once. + */ + assert (size == 1); + tess.lonelyTriList = AddToTrail(e.Lface, tess.lonelyTriList); + } + } + + + static void RenderLonelyTriangles(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUface f) { + /* Now we render all the separate triangles which could not be + * grouped into a triangle fan or strip. + */ + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + int newState; + int edgeState = -1; /* force edge state output for first vertex */ + + tess.callBeginOrBeginData(GL.GL_TRIANGLES); + + for (; f != null; f = f.trail) { + /* Loop once for each edge (there will always be 3 edges) */ + + e = f.anEdge; + do { + if (tess.flagBoundary) { + /* Set the "edge state" to true just before we output the + * first vertex of each edge on the polygon boundary. + */ + newState = (!e.Sym.Lface.inside) ? 1 : 0; + if (edgeState != newState) { + edgeState = newState; + tess.callEdgeFlagOrEdgeFlagData( edgeState != 0); + } + } + tess.callVertexOrVertexData( e.Org.data); + + e = e.Lnext; + } while (e != f.anEdge); + } + tess.callEndOrEndData(); + } + + private static class RenderFan implements renderCallBack { + public void render(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUhalfEdge e, long size) { + /* Render as many CCW triangles as possible in a fan starting from + * edge "e". The fan *should* contain exactly "size" triangles + * (otherwise we've goofed up somewhere). + */ + tess.callBeginOrBeginData( GL.GL_TRIANGLE_FAN); + tess.callVertexOrVertexData( e.Org.data); + tess.callVertexOrVertexData( e.Sym.Org.data); + + while (!Marked(e.Lface)) { + e.Lface.marked = true; + --size; + e = e.Onext; + tess.callVertexOrVertexData( e.Sym.Org.data); + } + + assert (size == 0); + tess.callEndOrEndData(); + } + } + + private static class RenderStrip implements renderCallBack { + public void render(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUhalfEdge e, long size) { + /* Render as many CCW triangles as possible in a strip starting from + * edge "e". The strip *should* contain exactly "size" triangles + * (otherwise we've goofed up somewhere). + */ + tess.callBeginOrBeginData( GL.GL_TRIANGLE_STRIP); + tess.callVertexOrVertexData( e.Org.data); + tess.callVertexOrVertexData( e.Sym.Org.data); + + while (!Marked(e.Lface)) { + e.Lface.marked = true; + --size; + e = e.Lnext.Sym; + tess.callVertexOrVertexData( e.Org.data); + if (Marked(e.Lface)) break; + + e.Lface.marked = true; + --size; + e = e.Onext; + tess.callVertexOrVertexData( e.Sym.Org.data); + } + + assert (size == 0); + tess.callEndOrEndData(); + } + } + + /************************ Boundary contour decomposition ******************/ + +/* __gl_renderBoundary( tess, mesh ) takes a mesh, and outputs one + * contour for each face marked "inside". The rendering output is + * provided as callbacks (see the api). + */ + public static void __gl_renderBoundary(GLUtessellatorImpl tess, com.sun.opengl.impl.tessellator.GLUmesh mesh) { + com.sun.opengl.impl.tessellator.GLUface f; + com.sun.opengl.impl.tessellator.GLUhalfEdge e; + + for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { + if (f.inside) { + tess.callBeginOrBeginData( GL.GL_LINE_LOOP); + e = f.anEdge; + do { + tess.callVertexOrVertexData( e.Org.data); + e = e.Lnext; + } while (e != f.anEdge); + tess.callEndOrEndData(); + } + } + } + + + /************************ Quick-and-dirty decomposition ******************/ + + private static final int SIGN_INCONSISTENT = 2; + + static int ComputeNormal(GLUtessellatorImpl tess, double[] norm, boolean check) +/* + * If check==false, we compute the polygon normal and place it in norm[]. + * If check==true, we check that each triangle in the fan from v0 has a + * consistent orientation with respect to norm[]. If triangles are + * consistently oriented CCW, return 1; if CW, return -1; if all triangles + * are degenerate return 0; otherwise (no consistent orientation) return + * SIGN_INCONSISTENT. + */ { + com.sun.opengl.impl.tessellator.CachedVertex[] v = tess.cache; +// CachedVertex vn = v0 + tess.cacheCount; + int vn = tess.cacheCount; +// CachedVertex vc; + int vc; + double dot, xc, yc, zc, xp, yp, zp; + double[] n = new double[3]; + int sign = 0; + + /* Find the polygon normal. It is important to get a reasonable + * normal even when the polygon is self-intersecting (eg. a bowtie). + * Otherwise, the computed normal could be very tiny, but perpendicular + * to the true plane of the polygon due to numerical noise. Then all + * the triangles would appear to be degenerate and we would incorrectly + * decompose the polygon as a fan (or simply not render it at all). + * + * We use a sum-of-triangles normal algorithm rather than the more + * efficient sum-of-trapezoids method (used in CheckOrientation() + * in normal.c). This lets us explicitly reverse the signed area + * of some triangles to get a reasonable normal in the self-intersecting + * case. + */ + if (!check) { + norm[0] = norm[1] = norm[2] = 0.0; + } + + vc = 1; + xc = v[vc].coords[0] - v[0].coords[0]; + yc = v[vc].coords[1] - v[0].coords[1]; + zc = v[vc].coords[2] - v[0].coords[2]; + while (++vc < vn) { + xp = xc; + yp = yc; + zp = zc; + xc = v[vc].coords[0] - v[0].coords[0]; + yc = v[vc].coords[1] - v[0].coords[1]; + zc = v[vc].coords[2] - v[0].coords[2]; + + /* Compute (vp - v0) cross (vc - v0) */ + n[0] = yp * zc - zp * yc; + n[1] = zp * xc - xp * zc; + n[2] = xp * yc - yp * xc; + + dot = n[0] * norm[0] + n[1] * norm[1] + n[2] * norm[2]; + if (!check) { + /* Reverse the contribution of back-facing triangles to get + * a reasonable normal for self-intersecting polygons (see above) + */ + if (dot >= 0) { + norm[0] += n[0]; + norm[1] += n[1]; + norm[2] += n[2]; + } else { + norm[0] -= n[0]; + norm[1] -= n[1]; + norm[2] -= n[2]; + } + } else if (dot != 0) { + /* Check the new orientation for consistency with previous triangles */ + if (dot > 0) { + if (sign < 0) return SIGN_INCONSISTENT; + sign = 1; + } else { + if (sign > 0) return SIGN_INCONSISTENT; + sign = -1; + } + } + } + return sign; + } + +/* __gl_renderCache( tess ) takes a single contour and tries to render it + * as a triangle fan. This handles convex polygons, as well as some + * non-convex polygons if we get lucky. + * + * Returns true if the polygon was successfully rendered. The rendering + * output is provided as callbacks (see the api). + */ + public static boolean __gl_renderCache(GLUtessellatorImpl tess) { + com.sun.opengl.impl.tessellator.CachedVertex[] v = tess.cache; +// CachedVertex vn = v0 + tess.cacheCount; + int vn = tess.cacheCount; +// CachedVertex vc; + int vc; + double[] norm = new double[3]; + int sign; + + if (tess.cacheCount < 3) { + /* Degenerate contour -- no output */ + return true; + } + + norm[0] = tess.normal[0]; + norm[1] = tess.normal[1]; + norm[2] = tess.normal[2]; + if (norm[0] == 0 && norm[1] == 0 && norm[2] == 0) { + ComputeNormal( tess, norm, false); + } + + sign = ComputeNormal( tess, norm, true); + if (sign == SIGN_INCONSISTENT) { + /* Fan triangles did not have a consistent orientation */ + return false; + } + if (sign == 0) { + /* All triangles were degenerate */ + return true; + } + + if ( !USE_OPTIMIZED_CODE_PATH ) { + return false; + } else { + /* Make sure we do the right thing for each winding rule */ + switch (tess.windingRule) { + case GLU.GLU_TESS_WINDING_ODD: + case GLU.GLU_TESS_WINDING_NONZERO: + break; + case GLU.GLU_TESS_WINDING_POSITIVE: + if (sign < 0) return true; + break; + case GLU.GLU_TESS_WINDING_NEGATIVE: + if (sign > 0) return true; + break; + case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO: + return true; + } + + tess.callBeginOrBeginData( tess.boundaryOnly ? GL.GL_LINE_LOOP + : (tess.cacheCount > 3) ? GL.GL_TRIANGLE_FAN + : GL.GL_TRIANGLES); + + tess.callVertexOrVertexData( v[0].data); + if (sign > 0) { + for (vc = 1; vc < vn; ++vc) { + tess.callVertexOrVertexData( v[vc].data); + } + } else { + for (vc = vn - 1; vc > 0; --vc) { + tess.callVertexOrVertexData( v[vc].data); + } + } + tess.callEndOrEndData(); + return true; + } + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/Sweep.java b/src/classes/com/sun/opengl/impl/tessellator/Sweep.java new file mode 100644 index 000000000..901207d31 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/Sweep.java @@ -0,0 +1,1343 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; + +class Sweep { + private Sweep() { + } + +// #ifdef FOR_TRITE_TEST_PROGRAM +// extern void DebugEvent( GLUtessellator *tess ); +// #else + private static void DebugEvent(GLUtessellatorImpl tess) { + + } +// #endif + +/* + * Invariants for the Edge Dictionary. + * - each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2) + * at any valid location of the sweep event + * - if EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2 + * share a common endpoint + * - for each e, e.Dst has been processed, but not e.Org + * - each edge e satisfies VertLeq(e.Dst,event) && VertLeq(event,e.Org) + * where "event" is the current sweep line event. + * - no edge e has zero length + * + * Invariants for the Mesh (the processed portion). + * - the portion of the mesh left of the sweep line is a planar graph, + * ie. there is *some* way to embed it in the plane + * - no processed edge has zero length + * - no two processed vertices have identical coordinates + * - each "inside" region is monotone, ie. can be broken into two chains + * of monotonically increasing vertices according to VertLeq(v1,v2) + * - a non-invariant: these chains may intersect (very slightly) + * + * Invariants for the Sweep. + * - if none of the edges incident to the event vertex have an activeRegion + * (ie. none of these edges are in the edge dictionary), then the vertex + * has only right-going edges. + * - if an edge is marked "fixUpperEdge" (it is a temporary edge introduced + * by ConnectRightVertex), then it is the only right-going edge from + * its associated vertex. (This says that these edges exist only + * when it is necessary.) + */ + +/* When we merge two edges into one, we need to compute the combined + * winding of the new edge. + */ + private static void AddWinding(GLUhalfEdge eDst, GLUhalfEdge eSrc) { + eDst.winding += eSrc.winding; + eDst.Sym.winding += eSrc.Sym.winding; + } + + + private static ActiveRegion RegionBelow(ActiveRegion r) { + return ((ActiveRegion) Dict.dictKey(Dict.dictPred(r.nodeUp))); + } + + private static ActiveRegion RegionAbove(ActiveRegion r) { + return ((ActiveRegion) Dict.dictKey(Dict.dictSucc(r.nodeUp))); + } + + static boolean EdgeLeq(GLUtessellatorImpl tess, ActiveRegion reg1, ActiveRegion reg2) +/* + * Both edges must be directed from right to left (this is the canonical + * direction for the upper edge of each region). + * + * The strategy is to evaluate a "t" value for each edge at the + * current sweep line position, given by tess.event. The calculations + * are designed to be very stable, but of course they are not perfect. + * + * Special case: if both edge destinations are at the sweep event, + * we sort the edges by slope (they would otherwise compare equally). + */ { + GLUvertex event = tess.event; + GLUhalfEdge e1, e2; + double t1, t2; + + e1 = reg1.eUp; + e2 = reg2.eUp; + + if (e1.Sym.Org == event) { + if (e2.Sym.Org == event) { + /* Two edges right of the sweep line which meet at the sweep event. + * Sort them by slope. + */ + if (Geom.VertLeq(e1.Org, e2.Org)) { + return Geom.EdgeSign(e2.Sym.Org, e1.Org, e2.Org) <= 0; + } + return Geom.EdgeSign(e1.Sym.Org, e2.Org, e1.Org) >= 0; + } + return Geom.EdgeSign(e2.Sym.Org, event, e2.Org) <= 0; + } + if (e2.Sym.Org == event) { + return Geom.EdgeSign(e1.Sym.Org, event, e1.Org) >= 0; + } + + /* General case - compute signed distance *from* e1, e2 to event */ + t1 = Geom.EdgeEval(e1.Sym.Org, event, e1.Org); + t2 = Geom.EdgeEval(e2.Sym.Org, event, e2.Org); + return (t1 >= t2); + } + + + static void DeleteRegion(GLUtessellatorImpl tess, ActiveRegion reg) { + if (reg.fixUpperEdge) { + /* It was created with zero winding number, so it better be + * deleted with zero winding number (ie. it better not get merged + * with a real edge). + */ + assert (reg.eUp.winding == 0); + } + reg.eUp.activeRegion = null; + Dict.dictDelete(tess.dict, reg.nodeUp); /* __gl_dictListDelete */ + } + + + static boolean FixUpperEdge(ActiveRegion reg, GLUhalfEdge newEdge) +/* + * Replace an upper edge which needs fixing (see ConnectRightVertex). + */ { + assert (reg.fixUpperEdge); + if (!Mesh.__gl_meshDelete(reg.eUp)) return false; + reg.fixUpperEdge = false; + reg.eUp = newEdge; + newEdge.activeRegion = reg; + + return true; + } + + static ActiveRegion TopLeftRegion(ActiveRegion reg) { + GLUvertex org = reg.eUp.Org; + GLUhalfEdge e; + + /* Find the region above the uppermost edge with the same origin */ + do { + reg = RegionAbove(reg); + } while (reg.eUp.Org == org); + + /* If the edge above was a temporary edge introduced by ConnectRightVertex, + * now is the time to fix it. + */ + if (reg.fixUpperEdge) { + e = Mesh.__gl_meshConnect(RegionBelow(reg).eUp.Sym, reg.eUp.Lnext); + if (e == null) return null; + if (!FixUpperEdge(reg, e)) return null; + reg = RegionAbove(reg); + } + return reg; + } + + static ActiveRegion TopRightRegion(ActiveRegion reg) { + GLUvertex dst = reg.eUp.Sym.Org; + + /* Find the region above the uppermost edge with the same destination */ + do { + reg = RegionAbove(reg); + } while (reg.eUp.Sym.Org == dst); + return reg; + } + + static ActiveRegion AddRegionBelow(GLUtessellatorImpl tess, + ActiveRegion regAbove, + GLUhalfEdge eNewUp) +/* + * Add a new active region to the sweep line, *somewhere* below "regAbove" + * (according to where the new edge belongs in the sweep-line dictionary). + * The upper edge of the new region will be "eNewUp". + * Winding number and "inside" flag are not updated. + */ { + ActiveRegion regNew = new ActiveRegion(); + if (regNew == null) throw new RuntimeException(); + + regNew.eUp = eNewUp; + /* __gl_dictListInsertBefore */ + regNew.nodeUp = Dict.dictInsertBefore(tess.dict, regAbove.nodeUp, regNew); + if (regNew.nodeUp == null) throw new RuntimeException(); + regNew.fixUpperEdge = false; + regNew.sentinel = false; + regNew.dirty = false; + + eNewUp.activeRegion = regNew; + return regNew; + } + + static boolean IsWindingInside(GLUtessellatorImpl tess, int n) { + switch (tess.windingRule) { + case GLU.GLU_TESS_WINDING_ODD: + return (n & 1) != 0; + case GLU.GLU_TESS_WINDING_NONZERO: + return (n != 0); + case GLU.GLU_TESS_WINDING_POSITIVE: + return (n > 0); + case GLU.GLU_TESS_WINDING_NEGATIVE: + return (n < 0); + case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO: + return (n >= 2) || (n <= -2); + } + /*LINTED*/ +// assert (false); + throw new InternalError(); + /*NOTREACHED*/ + } + + + static void ComputeWinding(GLUtessellatorImpl tess, ActiveRegion reg) { + reg.windingNumber = RegionAbove(reg).windingNumber + reg.eUp.winding; + reg.inside = IsWindingInside(tess, reg.windingNumber); + } + + + static void FinishRegion(GLUtessellatorImpl tess, ActiveRegion reg) +/* + * Delete a region from the sweep line. This happens when the upper + * and lower chains of a region meet (at a vertex on the sweep line). + * The "inside" flag is copied to the appropriate mesh face (we could + * not do this before -- since the structure of the mesh is always + * changing, this face may not have even existed until now). + */ { + GLUhalfEdge e = reg.eUp; + GLUface f = e.Lface; + + f.inside = reg.inside; + f.anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ + DeleteRegion(tess, reg); + } + + + static GLUhalfEdge FinishLeftRegions(GLUtessellatorImpl tess, + ActiveRegion regFirst, ActiveRegion regLast) +/* + * We are given a vertex with one or more left-going edges. All affected + * edges should be in the edge dictionary. Starting at regFirst.eUp, + * we walk down deleting all regions where both edges have the same + * origin vOrg. At the same time we copy the "inside" flag from the + * active region to the face, since at this point each face will belong + * to at most one region (this was not necessarily true until this point + * in the sweep). The walk stops at the region above regLast; if regLast + * is null we walk as far as possible. At the same time we relink the + * mesh if necessary, so that the ordering of edges around vOrg is the + * same as in the dictionary. + */ { + ActiveRegion reg, regPrev; + GLUhalfEdge e, ePrev; + + regPrev = regFirst; + ePrev = regFirst.eUp; + while (regPrev != regLast) { + regPrev.fixUpperEdge = false; /* placement was OK */ + reg = RegionBelow(regPrev); + e = reg.eUp; + if (e.Org != ePrev.Org) { + if (!reg.fixUpperEdge) { + /* Remove the last left-going edge. Even though there are no further + * edges in the dictionary with this origin, there may be further + * such edges in the mesh (if we are adding left edges to a vertex + * that has already been processed). Thus it is important to call + * FinishRegion rather than just DeleteRegion. + */ + FinishRegion(tess, regPrev); + break; + } + /* If the edge below was a temporary edge introduced by + * ConnectRightVertex, now is the time to fix it. + */ + e = Mesh.__gl_meshConnect(ePrev.Onext.Sym, e.Sym); + if (e == null) throw new RuntimeException(); + if (!FixUpperEdge(reg, e)) throw new RuntimeException(); + } + + /* Relink edges so that ePrev.Onext == e */ + if (ePrev.Onext != e) { + if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(ePrev, e)) throw new RuntimeException(); + } + FinishRegion(tess, regPrev); /* may change reg.eUp */ + ePrev = reg.eUp; + regPrev = reg; + } + return ePrev; + } + + + static void AddRightEdges(GLUtessellatorImpl tess, ActiveRegion regUp, + GLUhalfEdge eFirst, GLUhalfEdge eLast, GLUhalfEdge eTopLeft, + boolean cleanUp) +/* + * Purpose: insert right-going edges into the edge dictionary, and update + * winding numbers and mesh connectivity appropriately. All right-going + * edges share a common origin vOrg. Edges are inserted CCW starting at + * eFirst; the last edge inserted is eLast.Sym.Lnext. If vOrg has any + * left-going edges already processed, then eTopLeft must be the edge + * such that an imaginary upward vertical segment from vOrg would be + * contained between eTopLeft.Sym.Lnext and eTopLeft; otherwise eTopLeft + * should be null. + */ { + ActiveRegion reg, regPrev; + GLUhalfEdge e, ePrev; + boolean firstTime = true; + + /* Insert the new right-going edges in the dictionary */ + e = eFirst; + do { + assert (Geom.VertLeq(e.Org, e.Sym.Org)); + AddRegionBelow(tess, regUp, e.Sym); + e = e.Onext; + } while (e != eLast); + + /* Walk *all* right-going edges from e.Org, in the dictionary order, + * updating the winding numbers of each region, and re-linking the mesh + * edges to match the dictionary ordering (if necessary). + */ + if (eTopLeft == null) { + eTopLeft = RegionBelow(regUp).eUp.Sym.Onext; + } + regPrev = regUp; + ePrev = eTopLeft; + for (; ;) { + reg = RegionBelow(regPrev); + e = reg.eUp.Sym; + if (e.Org != ePrev.Org) break; + + if (e.Onext != ePrev) { + /* Unlink e from its current position, and relink below ePrev */ + if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(ePrev.Sym.Lnext, e)) throw new RuntimeException(); + } + /* Compute the winding number and "inside" flag for the new regions */ + reg.windingNumber = regPrev.windingNumber - e.winding; + reg.inside = IsWindingInside(tess, reg.windingNumber); + + /* Check for two outgoing edges with same slope -- process these + * before any intersection tests (see example in __gl_computeInterior). + */ + regPrev.dirty = true; + if (!firstTime && CheckForRightSplice(tess, regPrev)) { + AddWinding(e, ePrev); + DeleteRegion(tess, regPrev); + if (!Mesh.__gl_meshDelete(ePrev)) throw new RuntimeException(); + } + firstTime = false; + regPrev = reg; + ePrev = e; + } + regPrev.dirty = true; + assert (regPrev.windingNumber - e.winding == reg.windingNumber); + + if (cleanUp) { + /* Check for intersections between newly adjacent edges. */ + WalkDirtyRegions(tess, regPrev); + } + } + + + static void CallCombine(GLUtessellatorImpl tess, GLUvertex isect, + Object[] data, float[] weights, boolean needed) { + double[] coords = new double[3]; + + /* Copy coord data in case the callback changes it. */ + coords[0] = isect.coords[0]; + coords[1] = isect.coords[1]; + coords[2] = isect.coords[2]; + + Object[] outData = new Object[1]; + tess.callCombineOrCombineData(coords, data, weights, outData); + isect.data = outData[0]; + if (isect.data == null) { + if (!needed) { + isect.data = data[0]; + } else if (!tess.fatalError) { + /* The only way fatal error is when two edges are found to intersect, + * but the user has not provided the callback necessary to handle + * generated intersection points. + */ + tess.callErrorOrErrorData(GLU.GLU_TESS_NEED_COMBINE_CALLBACK); + tess.fatalError = true; + } + } + } + + static void SpliceMergeVertices(GLUtessellatorImpl tess, GLUhalfEdge e1, + GLUhalfEdge e2) +/* + * Two vertices with idential coordinates are combined into one. + * e1.Org is kept, while e2.Org is discarded. + */ { + Object[] data = new Object[4]; + float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; + + data[0] = e1.Org.data; + data[1] = e2.Org.data; + CallCombine(tess, e1.Org, data, weights, false); + if (!Mesh.__gl_meshSplice(e1, e2)) throw new RuntimeException(); + } + + static void VertexWeights(GLUvertex isect, GLUvertex org, GLUvertex dst, + float[] weights) +/* + * Find some weights which describe how the intersection vertex is + * a linear combination of "org" and "dest". Each of the two edges + * which generated "isect" is allocated 50% of the weight; each edge + * splits the weight between its org and dst according to the + * relative distance to "isect". + */ { + double t1 = Geom.VertL1dist(org, isect); + double t2 = Geom.VertL1dist(dst, isect); + + weights[0] = (float) (0.5 * t2 / (t1 + t2)); + weights[1] = (float) (0.5 * t1 / (t1 + t2)); + isect.coords[0] += weights[0] * org.coords[0] + weights[1] * dst.coords[0]; + isect.coords[1] += weights[0] * org.coords[1] + weights[1] * dst.coords[1]; + isect.coords[2] += weights[0] * org.coords[2] + weights[1] * dst.coords[2]; + } + + + static void GetIntersectData(GLUtessellatorImpl tess, GLUvertex isect, + GLUvertex orgUp, GLUvertex dstUp, + GLUvertex orgLo, GLUvertex dstLo) +/* + * We've computed a new intersection point, now we need a "data" pointer + * from the user so that we can refer to this new vertex in the + * rendering callbacks. + */ { + Object[] data = new Object[4]; + float[] weights = new float[4]; + float[] weights1 = new float[2]; + float[] weights2 = new float[2]; + + data[0] = orgUp.data; + data[1] = dstUp.data; + data[2] = orgLo.data; + data[3] = dstLo.data; + + isect.coords[0] = isect.coords[1] = isect.coords[2] = 0; + VertexWeights(isect, orgUp, dstUp, weights1); + VertexWeights(isect, orgLo, dstLo, weights2); + System.arraycopy(weights1, 0, weights, 0, 2); + System.arraycopy(weights2, 0, weights, 2, 2); + + CallCombine(tess, isect, data, weights, true); + } + + static boolean CheckForRightSplice(GLUtessellatorImpl tess, ActiveRegion regUp) +/* + * Check the upper and lower edge of "regUp", to make sure that the + * eUp.Org is above eLo, or eLo.Org is below eUp (depending on which + * origin is leftmost). + * + * The main purpose is to splice right-going edges with the same + * dest vertex and nearly identical slopes (ie. we can't distinguish + * the slopes numerically). However the splicing can also help us + * to recover from numerical errors. For example, suppose at one + * point we checked eUp and eLo, and decided that eUp.Org is barely + * above eLo. Then later, we split eLo into two edges (eg. from + * a splice operation like this one). This can change the result of + * our test so that now eUp.Org is incident to eLo, or barely below it. + * We must correct this condition to maintain the dictionary invariants. + * + * One possibility is to check these edges for intersection again + * (ie. CheckForIntersect). This is what we do if possible. However + * CheckForIntersect requires that tess.event lies between eUp and eLo, + * so that it has something to fall back on when the intersection + * calculation gives us an unusable answer. So, for those cases where + * we can't check for intersection, this routine fixes the problem + * by just splicing the offending vertex into the other edge. + * This is a guaranteed solution, no matter how degenerate things get. + * Basically this is a combinatorial solution to a numerical problem. + */ { + ActiveRegion regLo = RegionBelow(regUp); + GLUhalfEdge eUp = regUp.eUp; + GLUhalfEdge eLo = regLo.eUp; + + if (Geom.VertLeq(eUp.Org, eLo.Org)) { + if (Geom.EdgeSign(eLo.Sym.Org, eUp.Org, eLo.Org) > 0) return false; + + /* eUp.Org appears to be below eLo */ + if (!Geom.VertEq(eUp.Org, eLo.Org)) { + /* Splice eUp.Org into eLo */ + if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eUp, eLo.Sym.Lnext)) throw new RuntimeException(); + regUp.dirty = regLo.dirty = true; + + } else if (eUp.Org != eLo.Org) { + /* merge the two vertices, discarding eUp.Org */ + tess.pq.pqDelete(eUp.Org.pqHandle); /* __gl_pqSortDelete */ + SpliceMergeVertices(tess, eLo.Sym.Lnext, eUp); + } + } else { + if (Geom.EdgeSign(eUp.Sym.Org, eLo.Org, eUp.Org) < 0) return false; + + /* eLo.Org appears to be above eUp, so splice eLo.Org into eUp */ + RegionAbove(regUp).dirty = regUp.dirty = true; + if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eLo.Sym.Lnext, eUp)) throw new RuntimeException(); + } + return true; + } + + static boolean CheckForLeftSplice(GLUtessellatorImpl tess, ActiveRegion regUp) +/* + * Check the upper and lower edge of "regUp", to make sure that the + * eUp.Sym.Org is above eLo, or eLo.Sym.Org is below eUp (depending on which + * destination is rightmost). + * + * Theoretically, this should always be true. However, splitting an edge + * into two pieces can change the results of previous tests. For example, + * suppose at one point we checked eUp and eLo, and decided that eUp.Sym.Org + * is barely above eLo. Then later, we split eLo into two edges (eg. from + * a splice operation like this one). This can change the result of + * the test so that now eUp.Sym.Org is incident to eLo, or barely below it. + * We must correct this condition to maintain the dictionary invariants + * (otherwise new edges might get inserted in the wrong place in the + * dictionary, and bad stuff will happen). + * + * We fix the problem by just splicing the offending vertex into the + * other edge. + */ { + ActiveRegion regLo = RegionBelow(regUp); + GLUhalfEdge eUp = regUp.eUp; + GLUhalfEdge eLo = regLo.eUp; + GLUhalfEdge e; + + assert (!Geom.VertEq(eUp.Sym.Org, eLo.Sym.Org)); + + if (Geom.VertLeq(eUp.Sym.Org, eLo.Sym.Org)) { + if (Geom.EdgeSign(eUp.Sym.Org, eLo.Sym.Org, eUp.Org) < 0) return false; + + /* eLo.Sym.Org is above eUp, so splice eLo.Sym.Org into eUp */ + RegionAbove(regUp).dirty = regUp.dirty = true; + e = Mesh.__gl_meshSplitEdge(eUp); + if (e == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eLo.Sym, e)) throw new RuntimeException(); + e.Lface.inside = regUp.inside; + } else { + if (Geom.EdgeSign(eLo.Sym.Org, eUp.Sym.Org, eLo.Org) > 0) return false; + + /* eUp.Sym.Org is below eLo, so splice eUp.Sym.Org into eLo */ + regUp.dirty = regLo.dirty = true; + e = Mesh.__gl_meshSplitEdge(eLo); + if (e == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eUp.Lnext, eLo.Sym)) throw new RuntimeException(); + e.Sym.Lface.inside = regUp.inside; + } + return true; + } + + + static boolean CheckForIntersect(GLUtessellatorImpl tess, ActiveRegion regUp) +/* + * Check the upper and lower edges of the given region to see if + * they intersect. If so, create the intersection and add it + * to the data structures. + * + * Returns true if adding the new intersection resulted in a recursive + * call to AddRightEdges(); in this case all "dirty" regions have been + * checked for intersections, and possibly regUp has been deleted. + */ { + ActiveRegion regLo = RegionBelow(regUp); + GLUhalfEdge eUp = regUp.eUp; + GLUhalfEdge eLo = regLo.eUp; + GLUvertex orgUp = eUp.Org; + GLUvertex orgLo = eLo.Org; + GLUvertex dstUp = eUp.Sym.Org; + GLUvertex dstLo = eLo.Sym.Org; + double tMinUp, tMaxLo; + GLUvertex isect = new GLUvertex(); + GLUvertex orgMin; + GLUhalfEdge e; + + assert (!Geom.VertEq(dstLo, dstUp)); + assert (Geom.EdgeSign(dstUp, tess.event, orgUp) <= 0); + assert (Geom.EdgeSign(dstLo, tess.event, orgLo) >= 0); + assert (orgUp != tess.event && orgLo != tess.event); + assert (!regUp.fixUpperEdge && !regLo.fixUpperEdge); + + if (orgUp == orgLo) return false; /* right endpoints are the same */ + + tMinUp = Math.min(orgUp.t, dstUp.t); + tMaxLo = Math.max(orgLo.t, dstLo.t); + if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */ + + if (Geom.VertLeq(orgUp, orgLo)) { + if (Geom.EdgeSign(dstLo, orgUp, orgLo) > 0) return false; + } else { + if (Geom.EdgeSign(dstUp, orgLo, orgUp) < 0) return false; + } + + /* At this point the edges intersect, at least marginally */ + DebugEvent(tess); + + Geom.EdgeIntersect(dstUp, orgUp, dstLo, orgLo, isect); + /* The following properties are guaranteed: */ + assert (Math.min(orgUp.t, dstUp.t) <= isect.t); + assert (isect.t <= Math.max(orgLo.t, dstLo.t)); + assert (Math.min(dstLo.s, dstUp.s) <= isect.s); + assert (isect.s <= Math.max(orgLo.s, orgUp.s)); + + if (Geom.VertLeq(isect, tess.event)) { + /* The intersection point lies slightly to the left of the sweep line, + * so move it until it''s slightly to the right of the sweep line. + * (If we had perfect numerical precision, this would never happen + * in the first place). The easiest and safest thing to do is + * replace the intersection by tess.event. + */ + isect.s = tess.event.s; + isect.t = tess.event.t; + } + /* Similarly, if the computed intersection lies to the right of the + * rightmost origin (which should rarely happen), it can cause + * unbelievable inefficiency on sufficiently degenerate inputs. + * (If you have the test program, try running test54.d with the + * "X zoom" option turned on). + */ + orgMin = Geom.VertLeq(orgUp, orgLo) ? orgUp : orgLo; + if (Geom.VertLeq(orgMin, isect)) { + isect.s = orgMin.s; + isect.t = orgMin.t; + } + + if (Geom.VertEq(isect, orgUp) || Geom.VertEq(isect, orgLo)) { + /* Easy case -- intersection at one of the right endpoints */ + CheckForRightSplice(tess, regUp); + return false; + } + + if ((!Geom.VertEq(dstUp, tess.event) + && Geom.EdgeSign(dstUp, tess.event, isect) >= 0) + || (!Geom.VertEq(dstLo, tess.event) + && Geom.EdgeSign(dstLo, tess.event, isect) <= 0)) { + /* Very unusual -- the new upper or lower edge would pass on the + * wrong side of the sweep event, or through it. This can happen + * due to very small numerical errors in the intersection calculation. + */ + if (dstLo == tess.event) { + /* Splice dstLo into eUp, and process the new region(s) */ + if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eLo.Sym, eUp)) throw new RuntimeException(); + regUp = TopLeftRegion(regUp); + if (regUp == null) throw new RuntimeException(); + eUp = RegionBelow(regUp).eUp; + FinishLeftRegions(tess, RegionBelow(regUp), regLo); + AddRightEdges(tess, regUp, eUp.Sym.Lnext, eUp, eUp, true); + return true; + } + if (dstUp == tess.event) { + /* Splice dstUp into eLo, and process the new region(s) */ + if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eUp.Lnext, eLo.Sym.Lnext)) throw new RuntimeException(); + regLo = regUp; + regUp = TopRightRegion(regUp); + e = RegionBelow(regUp).eUp.Sym.Onext; + regLo.eUp = eLo.Sym.Lnext; + eLo = FinishLeftRegions(tess, regLo, null); + AddRightEdges(tess, regUp, eLo.Onext, eUp.Sym.Onext, e, true); + return true; + } + /* Special case: called from ConnectRightVertex. If either + * edge passes on the wrong side of tess.event, split it + * (and wait for ConnectRightVertex to splice it appropriately). + */ + if (Geom.EdgeSign(dstUp, tess.event, isect) >= 0) { + RegionAbove(regUp).dirty = regUp.dirty = true; + if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); + eUp.Org.s = tess.event.s; + eUp.Org.t = tess.event.t; + } + if (Geom.EdgeSign(dstLo, tess.event, isect) <= 0) { + regUp.dirty = regLo.dirty = true; + if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); + eLo.Org.s = tess.event.s; + eLo.Org.t = tess.event.t; + } + /* leave the rest for ConnectRightVertex */ + return false; + } + + /* General case -- split both edges, splice into new vertex. + * When we do the splice operation, the order of the arguments is + * arbitrary as far as correctness goes. However, when the operation + * creates a new face, the work done is proportional to the size of + * the new face. We expect the faces in the processed part of + * the mesh (ie. eUp.Lface) to be smaller than the faces in the + * unprocessed original contours (which will be eLo.Sym.Lnext.Lface). + */ + if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); + if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); + if (!Mesh.__gl_meshSplice(eLo.Sym.Lnext, eUp)) throw new RuntimeException(); + eUp.Org.s = isect.s; + eUp.Org.t = isect.t; + eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */ + if (eUp.Org.pqHandle == Long.MAX_VALUE) { + tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ + tess.pq = null; + throw new RuntimeException(); + } + GetIntersectData(tess, eUp.Org, orgUp, dstUp, orgLo, dstLo); + RegionAbove(regUp).dirty = regUp.dirty = regLo.dirty = true; + return false; + } + + static void WalkDirtyRegions(GLUtessellatorImpl tess, ActiveRegion regUp) +/* + * When the upper or lower edge of any region changes, the region is + * marked "dirty". This routine walks through all the dirty regions + * and makes sure that the dictionary invariants are satisfied + * (see the comments at the beginning of this file). Of course + * new dirty regions can be created as we make changes to restore + * the invariants. + */ { + ActiveRegion regLo = RegionBelow(regUp); + GLUhalfEdge eUp, eLo; + + for (; ;) { + /* Find the lowest dirty region (we walk from the bottom up). */ + while (regLo.dirty) { + regUp = regLo; + regLo = RegionBelow(regLo); + } + if (!regUp.dirty) { + regLo = regUp; + regUp = RegionAbove(regUp); + if (regUp == null || !regUp.dirty) { + /* We've walked all the dirty regions */ + return; + } + } + regUp.dirty = false; + eUp = regUp.eUp; + eLo = regLo.eUp; + + if (eUp.Sym.Org != eLo.Sym.Org) { + /* Check that the edge ordering is obeyed at the Dst vertices. */ + if (CheckForLeftSplice(tess, regUp)) { + + /* If the upper or lower edge was marked fixUpperEdge, then + * we no longer need it (since these edges are needed only for + * vertices which otherwise have no right-going edges). + */ + if (regLo.fixUpperEdge) { + DeleteRegion(tess, regLo); + if (!Mesh.__gl_meshDelete(eLo)) throw new RuntimeException(); + regLo = RegionBelow(regUp); + eLo = regLo.eUp; + } else if (regUp.fixUpperEdge) { + DeleteRegion(tess, regUp); + if (!Mesh.__gl_meshDelete(eUp)) throw new RuntimeException(); + regUp = RegionAbove(regLo); + eUp = regUp.eUp; + } + } + } + if (eUp.Org != eLo.Org) { + if (eUp.Sym.Org != eLo.Sym.Org + && !regUp.fixUpperEdge && !regLo.fixUpperEdge + && (eUp.Sym.Org == tess.event || eLo.Sym.Org == tess.event)) { + /* When all else fails in CheckForIntersect(), it uses tess.event + * as the intersection location. To make this possible, it requires + * that tess.event lie between the upper and lower edges, and also + * that neither of these is marked fixUpperEdge (since in the worst + * case it might splice one of these edges into tess.event, and + * violate the invariant that fixable edges are the only right-going + * edge from their associated vertex). + */ + if (CheckForIntersect(tess, regUp)) { + /* WalkDirtyRegions() was called recursively; we're done */ + return; + } + } else { + /* Even though we can't use CheckForIntersect(), the Org vertices + * may violate the dictionary edge ordering. Check and correct this. + */ + CheckForRightSplice(tess, regUp); + } + } + if (eUp.Org == eLo.Org && eUp.Sym.Org == eLo.Sym.Org) { + /* A degenerate loop consisting of only two edges -- delete it. */ + AddWinding(eLo, eUp); + DeleteRegion(tess, regUp); + if (!Mesh.__gl_meshDelete(eUp)) throw new RuntimeException(); + regUp = RegionAbove(regLo); + } + } + } + + + static void ConnectRightVertex(GLUtessellatorImpl tess, ActiveRegion regUp, + GLUhalfEdge eBottomLeft) +/* + * Purpose: connect a "right" vertex vEvent (one where all edges go left) + * to the unprocessed portion of the mesh. Since there are no right-going + * edges, two regions (one above vEvent and one below) are being merged + * into one. "regUp" is the upper of these two regions. + * + * There are two reasons for doing this (adding a right-going edge): + * - if the two regions being merged are "inside", we must add an edge + * to keep them separated (the combined region would not be monotone). + * - in any case, we must leave some record of vEvent in the dictionary, + * so that we can merge vEvent with features that we have not seen yet. + * For example, maybe there is a vertical edge which passes just to + * the right of vEvent; we would like to splice vEvent into this edge. + * + * However, we don't want to connect vEvent to just any vertex. We don''t + * want the new edge to cross any other edges; otherwise we will create + * intersection vertices even when the input data had no self-intersections. + * (This is a bad thing; if the user's input data has no intersections, + * we don't want to generate any false intersections ourselves.) + * + * Our eventual goal is to connect vEvent to the leftmost unprocessed + * vertex of the combined region (the union of regUp and regLo). + * But because of unseen vertices with all right-going edges, and also + * new vertices which may be created by edge intersections, we don''t + * know where that leftmost unprocessed vertex is. In the meantime, we + * connect vEvent to the closest vertex of either chain, and mark the region + * as "fixUpperEdge". This flag says to delete and reconnect this edge + * to the next processed vertex on the boundary of the combined region. + * Quite possibly the vertex we connected to will turn out to be the + * closest one, in which case we won''t need to make any changes. + */ { + GLUhalfEdge eNew; + GLUhalfEdge eTopLeft = eBottomLeft.Onext; + ActiveRegion regLo = RegionBelow(regUp); + GLUhalfEdge eUp = regUp.eUp; + GLUhalfEdge eLo = regLo.eUp; + boolean degenerate = false; + + if (eUp.Sym.Org != eLo.Sym.Org) { + CheckForIntersect(tess, regUp); + } + + /* Possible new degeneracies: upper or lower edge of regUp may pass + * through vEvent, or may coincide with new intersection vertex + */ + if (Geom.VertEq(eUp.Org, tess.event)) { + if (!Mesh.__gl_meshSplice(eTopLeft.Sym.Lnext, eUp)) throw new RuntimeException(); + regUp = TopLeftRegion(regUp); + if (regUp == null) throw new RuntimeException(); + eTopLeft = RegionBelow(regUp).eUp; + FinishLeftRegions(tess, RegionBelow(regUp), regLo); + degenerate = true; + } + if (Geom.VertEq(eLo.Org, tess.event)) { + if (!Mesh.__gl_meshSplice(eBottomLeft, eLo.Sym.Lnext)) throw new RuntimeException(); + eBottomLeft = FinishLeftRegions(tess, regLo, null); + degenerate = true; + } + if (degenerate) { + AddRightEdges(tess, regUp, eBottomLeft.Onext, eTopLeft, eTopLeft, true); + return; + } + + /* Non-degenerate situation -- need to add a temporary, fixable edge. + * Connect to the closer of eLo.Org, eUp.Org. + */ + if (Geom.VertLeq(eLo.Org, eUp.Org)) { + eNew = eLo.Sym.Lnext; + } else { + eNew = eUp; + } + eNew = Mesh.__gl_meshConnect(eBottomLeft.Onext.Sym, eNew); + if (eNew == null) throw new RuntimeException(); + + /* Prevent cleanup, otherwise eNew might disappear before we've even + * had a chance to mark it as a temporary edge. + */ + AddRightEdges(tess, regUp, eNew, eNew.Onext, eNew.Onext, false); + eNew.Sym.activeRegion.fixUpperEdge = true; + WalkDirtyRegions(tess, regUp); + } + +/* Because vertices at exactly the same location are merged together + * before we process the sweep event, some degenerate cases can't occur. + * However if someone eventually makes the modifications required to + * merge features which are close together, the cases below marked + * TOLERANCE_NONZERO will be useful. They were debugged before the + * code to merge identical vertices in the main loop was added. + */ + private static final boolean TOLERANCE_NONZERO = false; + + static void ConnectLeftDegenerate(GLUtessellatorImpl tess, + ActiveRegion regUp, GLUvertex vEvent) +/* + * The event vertex lies exacty on an already-processed edge or vertex. + * Adding the new vertex involves splicing it into the already-processed + * part of the mesh. + */ { + GLUhalfEdge e, eTopLeft, eTopRight, eLast; + ActiveRegion reg; + + e = regUp.eUp; + if (Geom.VertEq(e.Org, vEvent)) { + /* e.Org is an unprocessed vertex - just combine them, and wait + * for e.Org to be pulled from the queue + */ + assert (TOLERANCE_NONZERO); + SpliceMergeVertices(tess, e, vEvent.anEdge); + return; + } + + if (!Geom.VertEq(e.Sym.Org, vEvent)) { + /* General case -- splice vEvent into edge e which passes through it */ + if (Mesh.__gl_meshSplitEdge(e.Sym) == null) throw new RuntimeException(); + if (regUp.fixUpperEdge) { + /* This edge was fixable -- delete unused portion of original edge */ + if (!Mesh.__gl_meshDelete(e.Onext)) throw new RuntimeException(); + regUp.fixUpperEdge = false; + } + if (!Mesh.__gl_meshSplice(vEvent.anEdge, e)) throw new RuntimeException(); + SweepEvent(tess, vEvent); /* recurse */ + return; + } + + /* vEvent coincides with e.Sym.Org, which has already been processed. + * Splice in the additional right-going edges. + */ + assert (TOLERANCE_NONZERO); + regUp = TopRightRegion(regUp); + reg = RegionBelow(regUp); + eTopRight = reg.eUp.Sym; + eTopLeft = eLast = eTopRight.Onext; + if (reg.fixUpperEdge) { + /* Here e.Sym.Org has only a single fixable edge going right. + * We can delete it since now we have some real right-going edges. + */ + assert (eTopLeft != eTopRight); /* there are some left edges too */ + DeleteRegion(tess, reg); + if (!Mesh.__gl_meshDelete(eTopRight)) throw new RuntimeException(); + eTopRight = eTopLeft.Sym.Lnext; + } + if (!Mesh.__gl_meshSplice(vEvent.anEdge, eTopRight)) throw new RuntimeException(); + if (!Geom.EdgeGoesLeft(eTopLeft)) { + /* e.Sym.Org had no left-going edges -- indicate this to AddRightEdges() */ + eTopLeft = null; + } + AddRightEdges(tess, regUp, eTopRight.Onext, eLast, eTopLeft, true); + } + + + static void ConnectLeftVertex(GLUtessellatorImpl tess, GLUvertex vEvent) +/* + * Purpose: connect a "left" vertex (one where both edges go right) + * to the processed portion of the mesh. Let R be the active region + * containing vEvent, and let U and L be the upper and lower edge + * chains of R. There are two possibilities: + * + * - the normal case: split R into two regions, by connecting vEvent to + * the rightmost vertex of U or L lying to the left of the sweep line + * + * - the degenerate case: if vEvent is close enough to U or L, we + * merge vEvent into that edge chain. The subcases are: + * - merging with the rightmost vertex of U or L + * - merging with the active edge of U or L + * - merging with an already-processed portion of U or L + */ { + ActiveRegion regUp, regLo, reg; + GLUhalfEdge eUp, eLo, eNew; + ActiveRegion tmp = new ActiveRegion(); + + /* assert ( vEvent.anEdge.Onext.Onext == vEvent.anEdge ); */ + + /* Get a pointer to the active region containing vEvent */ + tmp.eUp = vEvent.anEdge.Sym; + /* __GL_DICTLISTKEY */ /* __gl_dictListSearch */ + regUp = (ActiveRegion) Dict.dictKey(Dict.dictSearch(tess.dict, tmp)); + regLo = RegionBelow(regUp); + eUp = regUp.eUp; + eLo = regLo.eUp; + + /* Try merging with U or L first */ + if (Geom.EdgeSign(eUp.Sym.Org, vEvent, eUp.Org) == 0) { + ConnectLeftDegenerate(tess, regUp, vEvent); + return; + } + + /* Connect vEvent to rightmost processed vertex of either chain. + * e.Sym.Org is the vertex that we will connect to vEvent. + */ + reg = Geom.VertLeq(eLo.Sym.Org, eUp.Sym.Org) ? regUp : regLo; + + if (regUp.inside || reg.fixUpperEdge) { + if (reg == regUp) { + eNew = Mesh.__gl_meshConnect(vEvent.anEdge.Sym, eUp.Lnext); + if (eNew == null) throw new RuntimeException(); + } else { + GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); + if (tempHalfEdge == null) throw new RuntimeException(); + + eNew = tempHalfEdge.Sym; + } + if (reg.fixUpperEdge) { + if (!FixUpperEdge(reg, eNew)) throw new RuntimeException(); + } else { + ComputeWinding(tess, AddRegionBelow(tess, regUp, eNew)); + } + SweepEvent(tess, vEvent); + } else { + /* The new vertex is in a region which does not belong to the polygon. + * We don''t need to connect this vertex to the rest of the mesh. + */ + AddRightEdges(tess, regUp, vEvent.anEdge, vEvent.anEdge, null, true); + } + } + + + static void SweepEvent(GLUtessellatorImpl tess, GLUvertex vEvent) +/* + * Does everything necessary when the sweep line crosses a vertex. + * Updates the mesh and the edge dictionary. + */ { + ActiveRegion regUp, reg; + GLUhalfEdge e, eTopLeft, eBottomLeft; + + tess.event = vEvent; /* for access in EdgeLeq() */ + DebugEvent(tess); + + /* Check if this vertex is the right endpoint of an edge that is + * already in the dictionary. In this case we don't need to waste + * time searching for the location to insert new edges. + */ + e = vEvent.anEdge; + while (e.activeRegion == null) { + e = e.Onext; + if (e == vEvent.anEdge) { + /* All edges go right -- not incident to any processed edges */ + ConnectLeftVertex(tess, vEvent); + return; + } + } + + /* Processing consists of two phases: first we "finish" all the + * active regions where both the upper and lower edges terminate + * at vEvent (ie. vEvent is closing off these regions). + * We mark these faces "inside" or "outside" the polygon according + * to their winding number, and delete the edges from the dictionary. + * This takes care of all the left-going edges from vEvent. + */ + regUp = TopLeftRegion(e.activeRegion); + if (regUp == null) throw new RuntimeException(); + reg = RegionBelow(regUp); + eTopLeft = reg.eUp; + eBottomLeft = FinishLeftRegions(tess, reg, null); + + /* Next we process all the right-going edges from vEvent. This + * involves adding the edges to the dictionary, and creating the + * associated "active regions" which record information about the + * regions between adjacent dictionary edges. + */ + if (eBottomLeft.Onext == eTopLeft) { + /* No right-going edges -- add a temporary "fixable" edge */ + ConnectRightVertex(tess, regUp, eBottomLeft); + } else { + AddRightEdges(tess, regUp, eBottomLeft.Onext, eTopLeft, eTopLeft, true); + } + } + + +/* Make the sentinel coordinates big enough that they will never be + * merged with real input features. (Even with the largest possible + * input contour and the maximum tolerance of 1.0, no merging will be + * done with coordinates larger than 3 * GLU_TESS_MAX_COORD). + */ + private static final double SENTINEL_COORD = (4.0 * GLU.GLU_TESS_MAX_COORD); + + static void AddSentinel(GLUtessellatorImpl tess, double t) +/* + * We add two sentinel edges above and below all other edges, + * to avoid special cases at the top and bottom. + */ { + GLUhalfEdge e; + ActiveRegion reg = new ActiveRegion(); + if (reg == null) throw new RuntimeException(); + + e = Mesh.__gl_meshMakeEdge(tess.mesh); + if (e == null) throw new RuntimeException(); + + e.Org.s = SENTINEL_COORD; + e.Org.t = t; + e.Sym.Org.s = -SENTINEL_COORD; + e.Sym.Org.t = t; + tess.event = e.Sym.Org; /* initialize it */ + + reg.eUp = e; + reg.windingNumber = 0; + reg.inside = false; + reg.fixUpperEdge = false; + reg.sentinel = true; + reg.dirty = false; + reg.nodeUp = Dict.dictInsert(tess.dict, reg); /* __gl_dictListInsertBefore */ + if (reg.nodeUp == null) throw new RuntimeException(); + } + + + static void InitEdgeDict(final GLUtessellatorImpl tess) +/* + * We maintain an ordering of edge intersections with the sweep line. + * This order is maintained in a dynamic dictionary. + */ { + /* __gl_dictListNewDict */ + tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() { + public boolean leq(Object frame, Object key1, Object key2) { + return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2); + } + }); + if (tess.dict == null) throw new RuntimeException(); + + AddSentinel(tess, -SENTINEL_COORD); + AddSentinel(tess, SENTINEL_COORD); + } + + + static void DoneEdgeDict(GLUtessellatorImpl tess) { + ActiveRegion reg; + int fixedEdges = 0; + + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + while ((reg = (ActiveRegion) Dict.dictKey(Dict.dictMin(tess.dict))) != null) { + /* + * At the end of all processing, the dictionary should contain + * only the two sentinel edges, plus at most one "fixable" edge + * created by ConnectRightVertex(). + */ + if (!reg.sentinel) { + assert (reg.fixUpperEdge); + assert (++fixedEdges == 1); + } + assert (reg.windingNumber == 0); + DeleteRegion(tess, reg); +/* __gl_meshDelete( reg.eUp );*/ + } + Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */ + } + + + static void RemoveDegenerateEdges(GLUtessellatorImpl tess) +/* + * Remove zero-length edges, and contours with fewer than 3 vertices. + */ { + GLUhalfEdge e, eNext, eLnext; + GLUhalfEdge eHead = tess.mesh.eHead; + + /*LINTED*/ + for (e = eHead.next; e != eHead; e = eNext) { + eNext = e.next; + eLnext = e.Lnext; + + if (Geom.VertEq(e.Org, e.Sym.Org) && e.Lnext.Lnext != e) { + /* Zero-length edge, contour has at least 3 edges */ + + SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */ + if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); /* e is a self-loop */ + e = eLnext; + eLnext = e.Lnext; + } + if (eLnext.Lnext == e) { + /* Degenerate contour (one or two edges) */ + + if (eLnext != e) { + if (eLnext == eNext || eLnext == eNext.Sym) { + eNext = eNext.next; + } + if (!Mesh.__gl_meshDelete(eLnext)) throw new RuntimeException(); + } + if (e == eNext || e == eNext.Sym) { + eNext = eNext.next; + } + if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); + } + } + } + + static boolean InitPriorityQ(GLUtessellatorImpl tess) +/* + * Insert all vertices into the priority queue which determines the + * order in which vertices cross the sweep line. + */ { + PriorityQ pq; + GLUvertex v, vHead; + + /* __gl_pqSortNewPriorityQ */ + pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() { + public boolean leq(Object key1, Object key2) { + return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); + } + }); + if (pq == null) return false; + + vHead = tess.mesh.vHead; + for (v = vHead.next; v != vHead; v = v.next) { + v.pqHandle = pq.pqInsert(v); /* __gl_pqSortInsert */ + if (v.pqHandle == Long.MAX_VALUE) break; + } + if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */ + tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ + tess.pq = null; + return false; + } + + return true; + } + + + static void DonePriorityQ(GLUtessellatorImpl tess) { + tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ + } + + + static boolean RemoveDegenerateFaces(GLUmesh mesh) +/* + * Delete any degenerate faces with only two edges. WalkDirtyRegions() + * will catch almost all of these, but it won't catch degenerate faces + * produced by splice operations on already-processed edges. + * The two places this can happen are in FinishLeftRegions(), when + * we splice in a "temporary" edge produced by ConnectRightVertex(), + * and in CheckForLeftSplice(), where we splice already-processed + * edges to ensure that our dictionary invariants are not violated + * by numerical errors. + * + * In both these cases it is *very* dangerous to delete the offending + * edge at the time, since one of the routines further up the stack + * will sometimes be keeping a pointer to that edge. + */ { + GLUface f, fNext; + GLUhalfEdge e; + + /*LINTED*/ + for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) { + fNext = f.next; + e = f.anEdge; + assert (e.Lnext != e); + + if (e.Lnext.Lnext == e) { + /* A face with only two edges */ + AddWinding(e.Onext, e); + if (!Mesh.__gl_meshDelete(e)) return false; + } + } + return true; + } + + public static boolean __gl_computeInterior(GLUtessellatorImpl tess) +/* + * __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess.windingRule. + * Each interior region is guaranteed be monotone. + */ { + GLUvertex v, vNext; + + tess.fatalError = false; + + /* Each vertex defines an event for our sweep line. Start by inserting + * all the vertices in a priority queue. Events are processed in + * lexicographic order, ie. + * + * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) + */ + RemoveDegenerateEdges(tess); + if (!InitPriorityQ(tess)) return false; /* if error */ + InitEdgeDict(tess); + + /* __gl_pqSortExtractMin */ + while ((v = (GLUvertex) tess.pq.pqExtractMin()) != null) { + for (; ;) { + vNext = (GLUvertex) tess.pq.pqMinimum(); /* __gl_pqSortMinimum */ + if (vNext == null || !Geom.VertEq(vNext, v)) break; + + /* Merge together all vertices at exactly the same location. + * This is more efficient than processing them one at a time, + * simplifies the code (see ConnectLeftDegenerate), and is also + * important for correct handling of certain degenerate cases. + * For example, suppose there are two identical edges A and B + * that belong to different contours (so without this code they would + * be processed by separate sweep events). Suppose another edge C + * crosses A and B from above. When A is processed, we split it + * at its intersection point with C. However this also splits C, + * so when we insert B we may compute a slightly different + * intersection point. This might leave two edges with a small + * gap between them. This kind of error is especially obvious + * when using boundary extraction (GLU_TESS_BOUNDARY_ONLY). + */ + vNext = (GLUvertex) tess.pq.pqExtractMin(); /* __gl_pqSortExtractMin*/ + SpliceMergeVertices(tess, v.anEdge, vNext.anEdge); + } + SweepEvent(tess, v); + } + + /* Set tess.event for debugging purposes */ + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + tess.event = ((ActiveRegion) Dict.dictKey(Dict.dictMin(tess.dict))).eUp.Org; + DebugEvent(tess); + DoneEdgeDict(tess); + DonePriorityQ(tess); + + if (!RemoveDegenerateFaces(tess.mesh)) return false; + Mesh.__gl_meshCheckMesh(tess.mesh); + + return true; + } +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/TessMono.java b/src/classes/com/sun/opengl/impl/tessellator/TessMono.java new file mode 100644 index 000000000..ef2230c35 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/TessMono.java @@ -0,0 +1,199 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + +class TessMono { +/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region + * (what else would it do??) The region must consist of a single + * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this + * case means that any vertical line intersects the interior of the + * region in a single interval. + * + * Tessellation consists of adding interior edges (actually pairs of + * half-edges), to split the region into non-overlapping triangles. + * + * The basic idea is explained in Preparata and Shamos (which I don''t + * have handy right now), although their implementation is more + * complicated than this one. The are two edge chains, an upper chain + * and a lower chain. We process all vertices from both chains in order, + * from right to left. + * + * The algorithm ensures that the following invariant holds after each + * vertex is processed: the untessellated region consists of two + * chains, where one chain (say the upper) is a single edge, and + * the other chain is concave. The left vertex of the single edge + * is always to the left of all vertices in the concave chain. + * + * Each step consists of adding the rightmost unprocessed vertex to one + * of the two chains, and forming a fan of triangles from the rightmost + * of two chain endpoints. Determining whether we can add each triangle + * to the fan is a simple orientation test. By making the fan as large + * as possible, we restore the invariant (check it yourself). + */ + static boolean __gl_meshTessellateMonoRegion(GLUface face) { + GLUhalfEdge up, lo; + + /* All edges are oriented CCW around the boundary of the region. + * First, find the half-edge whose origin vertex is rightmost. + * Since the sweep goes from left to right, face->anEdge should + * be close to the edge we want. + */ + up = face.anEdge; + assert (up.Lnext != up && up.Lnext.Lnext != up); + + for (; Geom.VertLeq(up.Sym.Org, up.Org); up = up.Onext.Sym) + ; + for (; Geom.VertLeq(up.Org, up.Sym.Org); up = up.Lnext) + ; + lo = up.Onext.Sym; + + while (up.Lnext != lo) { + if (Geom.VertLeq(up.Sym.Org, lo.Org)) { + /* up.Sym.Org is on the left. It is safe to form triangles from lo.Org. + * The EdgeGoesLeft test guarantees progress even when some triangles + * are CW, given that the upper and lower chains are truly monotone. + */ + while (lo.Lnext != up && (Geom.EdgeGoesLeft(lo.Lnext) + || Geom.EdgeSign(lo.Org, lo.Sym.Org, lo.Lnext.Sym.Org) <= 0)) { + GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + if (tempHalfEdge == null) return false; + lo = tempHalfEdge.Sym; + } + lo = lo.Onext.Sym; + } else { + /* lo.Org is on the left. We can make CCW triangles from up.Sym.Org. */ + while (lo.Lnext != up && (Geom.EdgeGoesRight(up.Onext.Sym) + || Geom.EdgeSign(up.Sym.Org, up.Org, up.Onext.Sym.Org) >= 0)) { + GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); + if (tempHalfEdge == null) return false; + up = tempHalfEdge.Sym; + } + up = up.Lnext; + } + } + + /* Now lo.Org == up.Sym.Org == the leftmost vertex. The remaining region + * can be tessellated in a fan from this leftmost vertex. + */ + assert (lo.Lnext != up); + while (lo.Lnext.Lnext != up) { + GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + if (tempHalfEdge == null) return false; + lo = tempHalfEdge.Sym; + } + + return true; + } + + +/* __gl_meshTessellateInterior( mesh ) tessellates each region of + * the mesh which is marked "inside" the polygon. Each such region + * must be monotone. + */ + public static boolean __gl_meshTessellateInterior(GLUmesh mesh) { + GLUface f, next; + + /*LINTED*/ + for (f = mesh.fHead.next; f != mesh.fHead; f = next) { + /* Make sure we don''t try to tessellate the new triangles. */ + next = f.next; + if (f.inside) { + if (!__gl_meshTessellateMonoRegion(f)) return false; + } + } + + return true; + } + + +/* __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces + * which are not marked "inside" the polygon. Since further mesh operations + * on NULL faces are not allowed, the main purpose is to clean up the + * mesh so that exterior loops are not represented in the data structure. + */ + public static void __gl_meshDiscardExterior(GLUmesh mesh) { + GLUface f, next; + + /*LINTED*/ + for (f = mesh.fHead.next; f != mesh.fHead; f = next) { + /* Since f will be destroyed, save its next pointer. */ + next = f.next; + if (!f.inside) { + Mesh.__gl_meshZapFace(f); + } + } + } + + private static final int MARKED_FOR_DELETION = 0x7fffffff; + +/* __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the + * winding numbers on all edges so that regions marked "inside" the + * polygon have a winding number of "value", and regions outside + * have a winding number of 0. + * + * If keepOnlyBoundary is TRUE, it also deletes all edges which do not + * separate an interior region from an exterior one. + */ + public static boolean __gl_meshSetWindingNumber(GLUmesh mesh, int value, boolean keepOnlyBoundary) { + GLUhalfEdge e, eNext; + + for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { + eNext = e.next; + if (e.Sym.Lface.inside != e.Lface.inside) { + + /* This is a boundary edge (one side is interior, one is exterior). */ + e.winding = (e.Lface.inside) ? value : -value; + } else { + + /* Both regions are interior, or both are exterior. */ + if (!keepOnlyBoundary) { + e.winding = 0; + } else { + if (!Mesh.__gl_meshDelete(e)) return false; + } + } + } + return true; + } + +} diff --git a/src/classes/com/sun/opengl/impl/tessellator/TessState.java b/src/classes/com/sun/opengl/impl/tessellator/TessState.java new file mode 100644 index 000000000..5e96a20a1 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/tessellator/TessState.java @@ -0,0 +1,50 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package com.sun.opengl.impl.tessellator; + + +class TessState { + public static final int T_DORMANT = 0; + public static final int T_IN_POLYGON = 1; + public static final int T_IN_CONTOUR = 2; +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java new file mode 100644 index 000000000..d57ddec2a --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsDummyGLDrawable extends WindowsGLDrawable { + private long hwnd; + + public WindowsDummyGLDrawable() { + super(null, new GLCapabilities(), null); + // All entries to CreateDummyWindow must synchronize on one object + // to avoid accidentally registering the dummy window class twice + synchronized (WindowsDummyGLDrawable.class) { + hwnd = WGL.CreateDummyWindow(0, 0, 1, 1); + } + hdc = WGL.GetDC(hwnd); + // Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context + GLCapabilities caps = new GLCapabilities(); + caps.setDepthBits(16); + PIXELFORMATDESCRIPTOR pfd = glCapabilities2PFD(caps, true); + int pixelFormat = WGL.ChoosePixelFormat(hdc, pfd); + if ((pixelFormat == 0) || + (!WGL.SetPixelFormat(hdc, pixelFormat, pfd))) { + destroy(); + } + } + + public void setSize(int width, int height) { + } + + public int getWidth() { + return 1; + } + + public int getHeight() { + return 1; + } + + public GLContext createContext(GLContext shareWith) { + if (hdc == 0) { + // Construction failed + return null; + } + return new WindowsGLContext(this, shareWith); + } + + public void destroy() { + if (hdc != 0) { + WGL.ReleaseDC(hwnd, hdc); + hdc = 0; + } + if (hwnd != 0) { + WGL.ShowWindow(hwnd, WGL.SW_HIDE); + WGL.DestroyWindow(hwnd); + hwnd = 0; + } + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java new file mode 100755 index 000000000..694aa6b0d --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import java.nio.*; +import java.util.*; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsExternalGLContext extends WindowsGLContext { + private boolean firstMakeCurrent = true; + private boolean created = true; + + public WindowsExternalGLContext() { + super(null, null); + hglrc = WGL.wglGetCurrentContext(); + GLContextShareSet.contextCreated(this); + resetGLFunctionAvailability(); + } + + protected int makeCurrentImpl() throws GLException { + if (firstMakeCurrent) { + firstMakeCurrent = false; + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } + + protected void releaseImpl() throws GLException { + } + + protected void destroyImpl() throws GLException { + created = false; + GLContextShareSet.contextDestroyed(this); + } + + public boolean isCreated() { + return created; + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLDrawable.java new file mode 100755 index 000000000..f934c1d23 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLDrawable.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsExternalGLDrawable extends WindowsGLDrawable { + public WindowsExternalGLDrawable() { + super(null, new GLCapabilities(), null); + hdc = WGL.wglGetCurrentDC(); + } + + public GLContext createContext(GLContext shareWith) { + return new WindowsGLContext(this, shareWith); + } + + public void setSize(int newWidth, int newHeight) { + throw new GLException("Should not call this"); + } + + public int getWidth() { + throw new GLException("Should not call this"); + } + + public int getHeight() { + throw new GLException("Should not call this"); + } + + public void destroy() { + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java new file mode 100644 index 000000000..d4b10dbfb --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import java.nio.*; +import java.util.*; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsGLContext extends GLContextImpl { + protected WindowsGLDrawable drawable; + protected long hglrc; + private boolean wglGetExtensionsStringEXTInitialized; + private boolean wglGetExtensionsStringEXTAvailable; + private static final Map/**/ functionNameMap; + private static final Map/**/ extensionNameMap; + private WGLExt wglExt; + // Table that holds the addresses of the native C-language entry points for + // WGL extension functions. + private WGLExtProcAddressTable wglExtProcAddressTable; + + static { + functionNameMap = new HashMap(); + functionNameMap.put("glAllocateMemoryNV", "wglAllocateMemoryNV"); + functionNameMap.put("glFreeMemoryNV", "wglFreeMemoryNV"); + + extensionNameMap = new HashMap(); + extensionNameMap.put("GL_ARB_pbuffer", "WGL_ARB_pbuffer"); + extensionNameMap.put("GL_ARB_pixel_format", "WGL_ARB_pixel_format"); + } + + public WindowsGLContext(WindowsGLDrawable drawable, + GLContext shareWith) { + super(shareWith); + this.drawable = drawable; + } + + public Object getPlatformGLExtensions() { + return getWGLExt(); + } + + public WGLExt getWGLExt() { + if (wglExt == null) { + wglExt = new WGLExtImpl(this); + } + return wglExt; + } + + public GLDrawable getGLDrawable() { + return drawable; + } + + protected String mapToRealGLFunctionName(String glFunctionName) { + String lookup = (String) functionNameMap.get(glFunctionName); + if (lookup != null) { + return lookup; + } + return glFunctionName; + } + + protected String mapToRealGLExtensionName(String glExtensionName) { + String lookup = (String) extensionNameMap.get(glExtensionName); + if (lookup != null) { + return lookup; + } + return glExtensionName; + } + + /** + * Creates and initializes an appropriate OpenGL context. Should only be + * called by {@link #makeCurrentImpl()}. + */ + protected void create() { + if (drawable.getHDC() == 0) { + throw new GLException("Internal error: attempted to create OpenGL context without an associated drawable"); + } + hglrc = WGL.wglCreateContext(drawable.getHDC()); + if (hglrc == 0) { + throw new GLException("Unable to create OpenGL context for device context " + toHexString(drawable.getHDC())); + } + // Windows can set up sharing of display lists after creation time + WindowsGLContext other = (WindowsGLContext) GLContextShareSet.getShareContext(this); + long hglrc2 = 0; + if (other != null) { + hglrc2 = other.getHGLRC(); + if (hglrc2 == 0) { + throw new GLException("GLContextShareSet returned an invalid OpenGL context"); + } + if (!WGL.wglShareLists(hglrc2, hglrc)) { + throw new GLException("wglShareLists(" + toHexString(hglrc2) + + ", " + toHexString(hglrc) + ") failed: error code " + + WGL.GetLastError()); + } + } + GLContextShareSet.contextCreated(this); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Created OpenGL context " + toHexString(hglrc) + " for " + this + ", device context " + toHexString(drawable.getHDC()) + ", sharing with " + toHexString(hglrc2)); + } + } + + protected int makeCurrentImpl() throws GLException { + boolean created = false; + if (hglrc == 0) { + create(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName()); + } + created = true; + } + + boolean skipMakeCurrent = false; + if (NO_FREE) { + if (WGL.wglGetCurrentContext() == hglrc) { + if (DEBUG && VERBOSE) { + System.err.println(getThreadName() + ": skipping wglMakeCurrent because context already current"); + } + skipMakeCurrent = true; + } + } + + if (!skipMakeCurrent) { + if (!WGL.wglMakeCurrent(drawable.getHDC(), hglrc)) { + throw new GLException("Error making context current: " + WGL.GetLastError()); + } else { + if (DEBUG && VERBOSE) { + System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getHDC()) + + ", hglrc " + toHexString(hglrc) + ") succeeded"); + } + } + } + + if (created) { + resetGLFunctionAvailability(); + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } + + protected void releaseImpl() throws GLException { + if (!NO_FREE) { + if (!WGL.wglMakeCurrent(0, 0)) { + throw new GLException("Error freeing OpenGL context: " + WGL.GetLastError()); + } + } + } + + protected void destroyImpl() throws GLException { + if (hglrc != 0) { + if (!WGL.wglDeleteContext(hglrc)) { + throw new GLException("Unable to delete OpenGL context"); + } + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(hglrc)); + } + hglrc = 0; + GLContextShareSet.contextDestroyed(this); + } + } + + public boolean isCreated() { + return (hglrc != 0); + } + + protected void resetGLFunctionAvailability() { + super.resetGLFunctionAvailability(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Initializing WGL extension address table for " + this); + } + resetProcAddressTable(getWGLExtProcAddressTable()); + } + + public WGLExtProcAddressTable getWGLExtProcAddressTable() { + if (wglExtProcAddressTable == null) { + // FIXME: cache ProcAddressTables by capability bits so we can + // share them among contexts with the same capabilities + wglExtProcAddressTable = new WGLExtProcAddressTable(); + } + return wglExtProcAddressTable; + } + + public String getPlatformExtensionsString() { + if (!wglGetExtensionsStringEXTInitialized) { + wglGetExtensionsStringEXTAvailable = (WGL.wglGetProcAddress("wglGetExtensionsStringEXT") != 0); + wglGetExtensionsStringEXTInitialized = true; + } + if (wglGetExtensionsStringEXTAvailable) { + return getWGLExt().wglGetExtensionsStringEXT(); + } else { + return ""; + } + } + + protected boolean isFunctionAvailable(String glFunctionName) + { + boolean available = super.isFunctionAvailable(glFunctionName); + + // Sanity check for implementations that use proc addresses for run-time + // linking: if the function IS available, then make sure there's a proc + // address for it if it's an extension or not part of the OpenGL 1.1 core + // (post GL 1.1 functions are run-time linked on windows). + assert(!available || + (getGLProcAddressTable().getAddressFor(mapToRealGLFunctionName(glFunctionName)) != 0 || + FunctionAvailabilityCache.isPartOfGLCore("1.1", mapToRealGLFunctionName(glFunctionName))) + ); + + return available; + } + + public void setSwapInterval(int interval) { + // FIXME: make the context current first? Currently assumes that + // will not be necessary. Make the caller do this? + WGLExt wglExt = getWGLExt(); + if (wglExt.isExtensionAvailable("WGL_EXT_swap_control")) { + wglExt.wglSwapIntervalEXT(interval); + } + } + + public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { + return getWGLExt().wglAllocateMemoryNV(arg0, arg1, arg2, arg3); + } + + public int getOffscreenContextPixelDataType() { + throw new GLException("Should not call this"); + } + + public int getOffscreenContextReadBuffer() { + throw new GLException("Should not call this"); + } + + public boolean offscreenImageNeedsVerticalFlip() { + throw new GLException("Should not call this"); + } + + public void bindPbufferToTexture() { + throw new GLException("Should not call this"); + } + + public void releasePbufferFromTexture() { + throw new GLException("Should not call this"); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + protected long getHGLRC() { + return hglrc; + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java new file mode 100644 index 000000000..ae95f5505 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java @@ -0,0 +1,502 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import java.awt.Component; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public abstract class WindowsGLDrawable extends GLDrawableImpl { + protected static final boolean DEBUG = Debug.debug("WindowsGLDrawable"); + + protected long hdc; + protected Component component; + protected GLCapabilities capabilities; + protected GLCapabilitiesChooser chooser; + protected boolean pixelFormatChosen; + + protected static final int MAX_PFORMATS = 256; + protected static final int MAX_ATTRIBS = 256; + + public WindowsGLDrawable(Component component, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + this.component = component; + this.capabilities = (GLCapabilities) capabilities.clone(); + this.chooser = chooser; + } + + public void setRealized(boolean val) { + throw new GLException("Should not call this (should only be called for onscreen GLDrawables)"); + } + + public void destroy() { + throw new GLException("Should not call this (should only be called for offscreen GLDrawables)"); + } + + public void swapBuffers() throws GLException { + } + + public long getHDC() { + return hdc; + } + + public void choosePixelFormat(boolean onscreen) { + PIXELFORMATDESCRIPTOR pfd = null; + int pixelFormat = 0; + if (onscreen) { + if (WGL.GetPixelFormat(hdc) != 0) { + // The Java2D/OpenGL pipeline probably already set a pixel + // format for this canvas. + if (DEBUG) { + System.err.println("NOTE: pixel format already chosen (by Java2D/OpenGL pipeline?) for window: " + + WGL.GetPixelFormat(hdc)); + } + pixelFormatChosen = true; + return; + } + + GLCapabilities[] availableCaps = null; + int numFormats = 0; + pfd = newPixelFormatDescriptor(); + GraphicsConfiguration config = component.getGraphicsConfiguration(); + GraphicsDevice device = config.getDevice(); + // Produce a recommended pixel format selection for the GLCapabilitiesChooser. + // Use wglChoosePixelFormatARB if user requested multisampling and if we have it available + WindowsGLDrawable dummyDrawable = null; + GLContextImpl dummyContext = null; + WGLExt dummyWGLExt = null; + if (capabilities.getSampleBuffers()) { + dummyDrawable = new WindowsDummyGLDrawable(); + dummyContext = (GLContextImpl) dummyDrawable.createContext(null); + if (dummyContext != null) { + dummyContext.makeCurrent(); + dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions(); + } + } + int recommendedPixelFormat = -1; + boolean haveWGLChoosePixelFormatARB = false; + boolean haveWGLARBMultisample = false; + boolean gotAvailableCaps = false; + if (dummyWGLExt != null) { + haveWGLChoosePixelFormatARB = dummyWGLExt.isExtensionAvailable("WGL_ARB_pixel_format"); + haveWGLARBMultisample = dummyWGLExt.isExtensionAvailable("WGL_ARB_multisample"); + + try { + if (haveWGLChoosePixelFormatARB) { + int[] iattributes = new int [2 * MAX_ATTRIBS]; + int[] iresults = new int [2 * MAX_ATTRIBS]; + float[] fattributes = new float[2 * MAX_ATTRIBS]; + int niattribs = 0; + int nfattribs = 0; + iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; + iattributes[niattribs++] = WGLExt.WGL_TYPE_RGBA_ARB; + iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; + if (capabilities.getDoubleBuffered()) { + iattributes[niattribs++] = GL.GL_TRUE; + } else { + iattributes[niattribs++] = GL.GL_FALSE; + } + iattributes[niattribs++] = WGLExt.WGL_STEREO_ARB; + if (capabilities.getStereo()) { + iattributes[niattribs++] = GL.GL_TRUE; + } else { + iattributes[niattribs++] = GL.GL_FALSE; + } + iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; + iattributes[niattribs++] = capabilities.getDepthBits(); + iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; + iattributes[niattribs++] = capabilities.getRedBits(); + iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; + iattributes[niattribs++] = capabilities.getGreenBits(); + iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; + iattributes[niattribs++] = capabilities.getBlueBits(); + iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; + iattributes[niattribs++] = capabilities.getAlphaBits(); + iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; + iattributes[niattribs++] = capabilities.getStencilBits(); + if (capabilities.getAccumRedBits() > 0 || + capabilities.getAccumGreenBits() > 0 || + capabilities.getAccumBlueBits() > 0 || + capabilities.getAccumAlphaBits() > 0) { + iattributes[niattribs++] = WGLExt.WGL_ACCUM_BITS_ARB; + iattributes[niattribs++] = (capabilities.getAccumRedBits() + + capabilities.getAccumGreenBits() + + capabilities.getAccumBlueBits() + + capabilities.getAccumAlphaBits()); + iattributes[niattribs++] = WGLExt.WGL_ACCUM_RED_BITS_ARB; + iattributes[niattribs++] = capabilities.getAccumRedBits(); + iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB; + iattributes[niattribs++] = capabilities.getAccumGreenBits(); + iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; + iattributes[niattribs++] = capabilities.getAccumBlueBits(); + iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; + iattributes[niattribs++] = capabilities.getAccumAlphaBits(); + } + if (haveWGLARBMultisample) { + if (capabilities.getSampleBuffers()) { + iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; + iattributes[niattribs++] = capabilities.getNumSamples(); + } + } + + int[] pformats = new int[MAX_PFORMATS]; + int[] numFormatsTmp = new int[1]; + if (dummyWGLExt.wglChoosePixelFormatARB(hdc, + iattributes, 0, + fattributes, 0, + MAX_PFORMATS, + pformats, 0, + numFormatsTmp, 0)) { + numFormats = numFormatsTmp[0]; + if (numFormats > 0) { + // Remove one-basing of pixel format (added on later) + recommendedPixelFormat = pformats[0] - 1; + if (DEBUG) { + System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat); + } + } + } else { + if (DEBUG) { + System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + WGL.GetLastError() ); + Thread.dumpStack(); + } + } + if (DEBUG) { + if (recommendedPixelFormat < 0) { + System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format"); + if (capabilities.getSampleBuffers()) { + System.err.print(" for multisampled GLCapabilities"); + } + System.err.println(); + } + } + + // Produce a list of GLCapabilities to give to the + // GLCapabilitiesChooser. + // Use wglGetPixelFormatAttribivARB instead of + // DescribePixelFormat to get higher-precision information + // about the pixel format (should make the GLCapabilities + // more precise as well...i.e., remove the + // "HardwareAccelerated" bit, which is basically + // meaningless, and put in whether it can render to a + // window, to a pbuffer, or to a pixmap) + niattribs = 0; + iattributes[0] = WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB; + if (dummyWGLExt.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, 0, iresults, 0)) { + numFormats = iresults[0]; + // Should we be filtering out the pixel formats which aren't + // applicable, as we are doing here? + // We don't have enough information in the GLCapabilities to + // represent those that aren't... + iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCELERATION_ARB; + iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; + iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; + iattributes[niattribs++] = WGLExt.WGL_STEREO_ARB; + iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; + iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_RED_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; + if (haveWGLARBMultisample) { + iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; + iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; + } + + availableCaps = new GLCapabilities[numFormats]; + for (int i = 0; i < numFormats; i++) { + if (!dummyWGLExt.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { + throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); + } + availableCaps[i] = iattributes2GLCapabilities(iattributes, iresults, niattribs, true); + } + gotAvailableCaps = true; + } else { + int lastErr = WGL.GetLastError(); + // Intel Extreme graphics fails with a zero error code + if (lastErr != 0) { + throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError()); + } + } + } + } finally { + dummyContext.release(); + dummyContext.destroy(); + dummyDrawable.destroy(); + } + } + + // Fallback path for older cards, in particular Intel Extreme motherboard graphics + if (!gotAvailableCaps) { + if (DEBUG) { + if (!capabilities.getSampleBuffers()) { + System.err.println(getThreadName() + ": Using ChoosePixelFormat because multisampling not requested"); + } else { + System.err.println(getThreadName() + ": Using ChoosePixelFormat because no wglChoosePixelFormatARB"); + } + } + pfd = glCapabilities2PFD(capabilities, onscreen); + // Remove one-basing of pixel format (added on later) + recommendedPixelFormat = WGL.ChoosePixelFormat(hdc, pfd) - 1; + + numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null); + if (numFormats == 0) { + throw new GLException("Unable to enumerate pixel formats of window for GLCapabilitiesChooser"); + } + availableCaps = new GLCapabilities[numFormats]; + for (int i = 0; i < numFormats; i++) { + if (WGL.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) { + throw new GLException("Error describing pixel format " + (1 + i) + " of device context"); + } + availableCaps[i] = pfd2GLCapabilities(pfd); + } + } + + // Supply information to chooser + pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); + if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { + throw new GLException("Invalid result " + pixelFormat + + " from GLCapabilitiesChooser (should be between 0 and " + + (numFormats - 1) + ")"); + } + if (DEBUG) { + System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):"); + System.err.println(availableCaps[pixelFormat]); + } + pixelFormat += 1; // one-base the index + if (WGL.DescribePixelFormat(hdc, pixelFormat, pfd.size(), pfd) == 0) { + throw new GLException("Error re-describing the chosen pixel format: " + WGL.GetLastError()); + } + } else { + // For now, use ChoosePixelFormat for offscreen surfaces until + // we figure out how to properly choose an offscreen- + // compatible pixel format + pfd = glCapabilities2PFD(capabilities, onscreen); + pixelFormat = WGL.ChoosePixelFormat(hdc, pfd); + } + if (!WGL.SetPixelFormat(hdc, pixelFormat, pfd)) { + int lastError = WGL.GetLastError(); + if (DEBUG) { + System.err.println(getThreadName() + ": SetPixelFormat failed: current context = " + WGL.wglGetCurrentContext() + + ", current DC = " + WGL.wglGetCurrentDC()); + System.err.println(getThreadName() + ": GetPixelFormat(hdc " + toHexString(hdc) + ") returns " + WGL.GetPixelFormat(hdc)); + } + throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + toHexString(hdc) + ": error code " + lastError); + } + pixelFormatChosen = true; + } + + static PIXELFORMATDESCRIPTOR glCapabilities2PFD(GLCapabilities caps, boolean onscreen) { + int colorDepth = (caps.getRedBits() + + caps.getGreenBits() + + caps.getBlueBits()); + if (colorDepth < 15) { + throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported"); + } + PIXELFORMATDESCRIPTOR pfd = newPixelFormatDescriptor(); + int pfdFlags = (WGL.PFD_SUPPORT_OPENGL | + WGL.PFD_GENERIC_ACCELERATED); + if (caps.getDoubleBuffered()) { + pfdFlags |= WGL.PFD_DOUBLEBUFFER; + } + if (onscreen) { + pfdFlags |= WGL.PFD_DRAW_TO_WINDOW; + } else { + pfdFlags |= WGL.PFD_DRAW_TO_BITMAP; + } + pfd.dwFlags(pfdFlags); + pfd.iPixelType((byte) WGL.PFD_TYPE_RGBA); + pfd.cColorBits((byte) colorDepth); + pfd.cRedBits ((byte) caps.getRedBits()); + pfd.cGreenBits((byte) caps.getGreenBits()); + pfd.cBlueBits ((byte) caps.getBlueBits()); + pfd.cAlphaBits((byte) caps.getAlphaBits()); + int accumDepth = (caps.getAccumRedBits() + + caps.getAccumGreenBits() + + caps.getAccumBlueBits()); + pfd.cAccumBits ((byte) accumDepth); + pfd.cAccumRedBits ((byte) caps.getAccumRedBits()); + pfd.cAccumGreenBits((byte) caps.getAccumGreenBits()); + pfd.cAccumBlueBits ((byte) caps.getAccumBlueBits()); + pfd.cAccumAlphaBits((byte) caps.getAccumAlphaBits()); + pfd.cDepthBits((byte) caps.getDepthBits()); + pfd.cStencilBits((byte) caps.getStencilBits()); + pfd.iLayerType((byte) WGL.PFD_MAIN_PLANE); + return pfd; + } + + static PIXELFORMATDESCRIPTOR newPixelFormatDescriptor() { + PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR(); + pfd.nSize((short) pfd.size()); + pfd.nVersion((short) 1); + return pfd; + } + + static GLCapabilities pfd2GLCapabilities(PIXELFORMATDESCRIPTOR pfd) { + if ((pfd.dwFlags() & WGL.PFD_SUPPORT_OPENGL) == 0) { + return null; + } + GLCapabilities res = new GLCapabilities(); + res.setRedBits (pfd.cRedBits()); + res.setGreenBits (pfd.cGreenBits()); + res.setBlueBits (pfd.cBlueBits()); + res.setAlphaBits (pfd.cAlphaBits()); + res.setAccumRedBits (pfd.cAccumRedBits()); + res.setAccumGreenBits(pfd.cAccumGreenBits()); + res.setAccumBlueBits (pfd.cAccumBlueBits()); + res.setAccumAlphaBits(pfd.cAccumAlphaBits()); + res.setDepthBits (pfd.cDepthBits()); + res.setStencilBits (pfd.cStencilBits()); + res.setDoubleBuffered((pfd.dwFlags() & WGL.PFD_DOUBLEBUFFER) != 0); + res.setStereo ((pfd.dwFlags() & WGL.PFD_STEREO) != 0); + res.setHardwareAccelerated(((pfd.dwFlags() & WGL.PFD_GENERIC_FORMAT) == 0) || + ((pfd.dwFlags() & WGL.PFD_GENERIC_ACCELERATED) != 0)); + return res; + } + + static GLCapabilities iattributes2GLCapabilities(int[] iattribs, + int[] iresults, + int niattribs, + boolean requireRenderToWindow) { + GLCapabilities res = new GLCapabilities(); + for (int i = 0; i < niattribs; i++) { + switch (iattribs[i]) { + case WGLExt.WGL_DRAW_TO_WINDOW_ARB: + if (iresults[i] != GL.GL_TRUE) + return null; + break; + + case WGLExt.WGL_ACCELERATION_ARB: + res.setHardwareAccelerated(iresults[i] == WGLExt.WGL_FULL_ACCELERATION_ARB); + break; + + case WGLExt.WGL_SUPPORT_OPENGL_ARB: + if (iresults[i] != GL.GL_TRUE) + return null; + break; + + case WGLExt.WGL_DEPTH_BITS_ARB: + res.setDepthBits(iresults[i]); + break; + + case WGLExt.WGL_STENCIL_BITS_ARB: + res.setStencilBits(iresults[i]); + break; + + case WGLExt.WGL_DOUBLE_BUFFER_ARB: + res.setDoubleBuffered(iresults[i] == GL.GL_TRUE); + break; + + case WGLExt.WGL_STEREO_ARB: + res.setStereo(iresults[i] == GL.GL_TRUE); + break; + + case WGLExt.WGL_PIXEL_TYPE_ARB: + if (iresults[i] != WGLExt.WGL_TYPE_RGBA_ARB) + return null; + break; + + case WGLExt.WGL_RED_BITS_ARB: + res.setRedBits(iresults[i]); + break; + + case WGLExt.WGL_GREEN_BITS_ARB: + res.setGreenBits(iresults[i]); + break; + + case WGLExt.WGL_BLUE_BITS_ARB: + res.setBlueBits(iresults[i]); + break; + + case WGLExt.WGL_ALPHA_BITS_ARB: + res.setAlphaBits(iresults[i]); + break; + + case WGLExt.WGL_ACCUM_RED_BITS_ARB: + res.setAccumRedBits(iresults[i]); + break; + + case WGLExt.WGL_ACCUM_GREEN_BITS_ARB: + res.setAccumGreenBits(iresults[i]); + break; + + case WGLExt.WGL_ACCUM_BLUE_BITS_ARB: + res.setAccumBlueBits(iresults[i]); + break; + + case WGLExt.WGL_ACCUM_ALPHA_BITS_ARB: + res.setAccumAlphaBits(iresults[i]); + break; + + case WGLExt.WGL_SAMPLE_BUFFERS_ARB: + res.setSampleBuffers(iresults[i] == GL.GL_TRUE); + break; + + case WGLExt.WGL_SAMPLES_ARB: + res.setNumSamples(iresults[i]); + break; + + default: + throw new GLException("Unknown pixel format attribute " + iattribs[i]); + } + } + return res; + } + + protected static String getThreadName() { + return Thread.currentThread().getName(); + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java new file mode 100644 index 000000000..ae48be999 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import java.awt.Component; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.Rectangle; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.List; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsGLDrawableFactory extends GLDrawableFactoryImpl { + private static final boolean DEBUG = Debug.debug("WindowsGLDrawableFactory"); + private static final boolean VERBOSE = Debug.verbose(); + + // Handle to GLU32.dll + // FIXME: this should go away once we delete support for the C GLU library + private long hglu32; + + static { + NativeLibLoader.load(); + } + + public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GraphicsDevice device) { + return null; + } + + public GLDrawable getGLDrawable(Object target, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + if (target == null) { + throw new IllegalArgumentException("Null target"); + } + if (!(target instanceof Component)) { + throw new IllegalArgumentException("GLDrawables not supported for objects of type " + + target.getClass().getName() + " (only Components are supported in this implementation)"); + } + if (capabilities == null) { + capabilities = new GLCapabilities(); + } + if (chooser == null) { + chooser = new DefaultGLCapabilitiesChooser(); + } + return new WindowsOnscreenGLDrawable((Component) target, capabilities, chooser); + } + + public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + return new WindowsOffscreenGLDrawable(capabilities, chooser); + } + + private boolean pbufferSupportInitialized = false; + private boolean canCreateGLPbuffer = false; + public boolean canCreateGLPbuffer() { + if (!pbufferSupportInitialized) { + Runnable r = new Runnable() { + public void run() { + WindowsDummyGLDrawable dummyDrawable = new WindowsDummyGLDrawable(); + GLContext dummyContext = dummyDrawable.createContext(null); + if (dummyContext != null) { + GLContext lastContext = GLContext.getCurrent(); + if (lastContext != null) { + lastContext.release(); + } + dummyContext.makeCurrent(); + GL dummyGL = dummyContext.getGL(); + canCreateGLPbuffer = dummyGL.isExtensionAvailable("GL_ARB_pbuffer"); + pbufferSupportInitialized = true; + dummyContext.release(); + dummyContext.destroy(); + dummyDrawable.destroy(); + if (lastContext != null) { + lastContext.makeCurrent(); + } + } + } + }; + maybeDoSingleThreadedWorkaround(r); + } + return canCreateGLPbuffer; + } + + public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, + final int initialWidth, + final int initialHeight, + final GLContext shareWith) { + if (!canCreateGLPbuffer()) { + throw new GLException("Pbuffer support not available with current graphics card"); + } + final List returnList = new ArrayList(); + Runnable r = new Runnable() { + public void run() { + WindowsDummyGLDrawable dummyDrawable = new WindowsDummyGLDrawable(); + WindowsGLContext dummyContext = (WindowsGLContext) dummyDrawable.createContext(null); + GLContext lastContext = GLContext.getCurrent(); + if (lastContext != null) { + lastContext.release(); + } + dummyContext.makeCurrent(); + WGLExt dummyWGLExt = dummyContext.getWGLExt(); + try { + WindowsPbufferGLDrawable pbufferDrawable = new WindowsPbufferGLDrawable(capabilities, + initialWidth, + initialHeight, + dummyDrawable, + dummyWGLExt); + GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith); + returnList.add(pbuffer); + dummyContext.release(); + dummyContext.destroy(); + dummyDrawable.destroy(); + } finally { + if (lastContext != null) { + lastContext.makeCurrent(); + } + } + } + }; + maybeDoSingleThreadedWorkaround(r); + return (GLPbuffer) returnList.get(0); + } + + public GLContext createExternalGLContext() { + return new WindowsExternalGLContext(); + } + + public boolean canCreateExternalGLDrawable() { + return true; + } + + public GLDrawable createExternalGLDrawable() { + return new WindowsExternalGLDrawable(); + } + + public long dynamicLookupFunction(String glFuncName) { + long res = WGL.wglGetProcAddress(glFuncName); + if (res == 0) { + // GLU routines aren't known to the OpenGL function lookup + if (hglu32 == 0) { + hglu32 = WGL.LoadLibraryA("GLU32"); + if (hglu32 == 0) { + throw new GLException("Error loading GLU32.DLL"); + } + } + res = WGL.GetProcAddress(hglu32, glFuncName); + } + return res; + } + + static String wglGetLastError() { + int err = WGL.GetLastError(); + String detail = null; + switch (err) { + case WGL.ERROR_INVALID_PIXEL_FORMAT: detail = "ERROR_INVALID_PIXEL_FORMAT"; break; + case WGL.ERROR_NO_SYSTEM_RESOURCES: detail = "ERROR_NO_SYSTEM_RESOURCES"; break; + case WGL.ERROR_INVALID_DATA: detail = "ERROR_INVALID_DATA"; break; + case WGL.ERROR_PROC_NOT_FOUND: detail = "ERROR_PROC_NOT_FOUND"; break; + case WGL.ERROR_INVALID_WINDOW_HANDLE:detail = "ERROR_INVALID_WINDOW_HANDLE"; break; + default: detail = "(Unknown error code " + err + ")"; break; + } + return detail; + } + + private void maybeDoSingleThreadedWorkaround(Runnable action) { + if (Threading.isSingleThreaded() && + !Threading.isOpenGLThread()) { + Threading.invokeOnOpenGLThread(action); + } else { + action.run(); + } + } + + public void lockAWTForJava2D() { + } + + public void unlockAWTForJava2D() { + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLContext.java new file mode 100644 index 000000000..d9430638c --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLContext.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsOffscreenGLContext extends WindowsGLContext { + public WindowsOffscreenGLContext(WindowsOffscreenGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + } + + public int getOffscreenContextPixelDataType() { + return GL.GL_UNSIGNED_BYTE; + } + + public int getOffscreenContextReadBuffer() { + // On Windows these contexts are always single-buffered + return GL.GL_FRONT; + } + + public boolean offscreenImageNeedsVerticalFlip() { + // We can take care of this in the DIB creation (see below) + return false; + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLDrawable.java new file mode 100644 index 000000000..7dd6d2361 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOffscreenGLDrawable.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsOffscreenGLDrawable extends WindowsGLDrawable { + private long origbitmap; + private long hbitmap; + // Width and height of the underlying bitmap + private int width; + private int height; + + public WindowsOffscreenGLDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + super(null, capabilities, chooser); + } + + public GLContext createContext(GLContext shareWith) { + return new WindowsOffscreenGLContext(this, shareWith); + } + + public void setSize(int newWidth, int newHeight) { + width = newWidth; + height = newHeight; + if (hdc != 0) { + destroy(); + } + create(); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + private void create() { + BITMAPINFO info = new BITMAPINFO(); + BITMAPINFOHEADER header = info.bmiHeader(); + int bitsPerPixel = (capabilities.getRedBits() + + capabilities.getGreenBits() + + capabilities.getBlueBits()); + header.biSize(header.size()); + header.biWidth(width); + // NOTE: negating the height causes the DIB to be in top-down row + // order rather than bottom-up; ends up being correct during pixel + // readback + header.biHeight(-1 * height); + header.biPlanes((short) 1); + header.biBitCount((short) bitsPerPixel); + header.biXPelsPerMeter(0); + header.biYPelsPerMeter(0); + header.biClrUsed(0); + header.biClrImportant(0); + header.biCompression(WGL.BI_RGB); + header.biSizeImage(width * height * bitsPerPixel / 8); + + hdc = WGL.CreateCompatibleDC(0); + if (hdc == 0) { + System.out.println("LastError: " + WGL.GetLastError()); + throw new GLException("Error creating device context for offscreen OpenGL context"); + } + hbitmap = WGL.CreateDIBSection(hdc, info, WGL.DIB_RGB_COLORS, 0, 0, 0); + if (hbitmap == 0) { + WGL.DeleteDC(hdc); + hdc = 0; + throw new GLException("Error creating offscreen bitmap of width " + width + + ", height " + height); + } + if ((origbitmap = WGL.SelectObject(hdc, hbitmap)) == 0) { + WGL.DeleteObject(hbitmap); + hbitmap = 0; + WGL.DeleteDC(hdc); + hdc = 0; + throw new GLException("Error selecting bitmap into new device context"); + } + + choosePixelFormat(false); + } + + public void destroy() { + if (hdc != 0) { + // Must destroy bitmap and device context + WGL.SelectObject(hdc, origbitmap); + WGL.DeleteObject(hbitmap); + WGL.DeleteDC(hdc); + origbitmap = 0; + hbitmap = 0; + hdc = 0; + } + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java new file mode 100644 index 000000000..00647e7dd --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLContext.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import java.util.*; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsOnscreenGLContext extends WindowsGLContext { + protected WindowsOnscreenGLDrawable drawable; + + public WindowsOnscreenGLContext(WindowsOnscreenGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + protected int makeCurrentImpl() throws GLException { + try { + int lockRes = drawable.lockSurface(); + if (lockRes == WindowsOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { + return CONTEXT_NOT_CURRENT; + } + if (lockRes == WindowsOnscreenGLDrawable.LOCK_SURFACE_CHANGED) { + if (hglrc != 0) { + if (!WGL.wglDeleteContext(hglrc)) { + throw new GLException("Unable to delete old GL context after surface changed"); + } + GLContextShareSet.contextDestroyed(this); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(hglrc) + " due to JAWT_LOCK_SURFACE_CHANGED"); + } + hglrc = 0; + } + } + int ret = super.makeCurrentImpl(); + return ret; + } catch (RuntimeException e) { + try { + drawable.unlockSurface(); + } catch (Exception e2) { + // do nothing if unlockSurface throws + } + throw(e); + } + } + + protected void releaseImpl() throws GLException { + try { + super.releaseImpl(); + } finally { + drawable.unlockSurface(); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java new file mode 100644 index 000000000..b1f2d57a1 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import java.awt.Component; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { + public static final int LOCK_SURFACE_NOT_READY = 1; + public static final int LOCK_SURFACE_CHANGED = 2; + public static final int LOCK_SUCCESS = 3; + private static JAWT jawt; + + // Variables for lockSurface/unlockSurface + private JAWT_DrawingSurface ds; + private JAWT_DrawingSurfaceInfo dsi; + private JAWT_Win32DrawingSurfaceInfo win32dsi; + + // Indicates whether the component (if an onscreen context) has been + // realized. Plausibly, before the component is realized the JAWT + // should return an error or NULL object from some of its + // operations; this appears to be the case on Win32 but is not true + // at least with Sun's current X11 implementation (1.4.x), which + // crashes with no other error reported if the DrawingSurfaceInfo is + // fetched from a locked DrawingSurface during the validation as a + // result of calling show() on the main thread. To work around this + // we prevent any JAWT or OpenGL operations from being done until + // addNotify() is called on the component. + protected boolean realized; + + public WindowsOnscreenGLDrawable(Component component, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + super(component, capabilities, chooser); + } + + public GLContext createContext(GLContext shareWith) { + return new WindowsOnscreenGLContext(this, shareWith); + } + + public void setRealized(boolean realized) { + this.realized = realized; + if (!realized) { + // Assume heavyweight widget was destroyed + pixelFormatChosen = false; + } + } + + public void setSize(int width, int height) { + component.setSize(width, height); + } + + public int getWidth() { + return component.getWidth(); + } + + public int getHeight() { + return component.getHeight(); + } + + public void swapBuffers() throws GLException { + boolean didLock = false; + + if (hdc == 0) { + if (lockSurface() == LOCK_SURFACE_NOT_READY) { + return; + } + didLock = true; + } + + if (!WGL.SwapBuffers(hdc) && (WGL.GetLastError() != 0)) { + throw new GLException("Error swapping buffers"); + } + + if (didLock) { + unlockSurface(); + } + } + + public int lockSurface() throws GLException { + if (!realized) { + return LOCK_SURFACE_NOT_READY; + } + if (hdc != 0) { + throw new GLException("Surface already locked"); + } + ds = getJAWT().GetDrawingSurface(component); + if (ds == null) { + // Widget not yet realized + return LOCK_SURFACE_NOT_READY; + } + int res = ds.Lock(); + if ((res & JAWTFactory.JAWT_LOCK_ERROR) != 0) { + throw new GLException("Unable to lock surface"); + } + // See whether the surface changed and if so destroy the old + // OpenGL context so it will be recreated (NOTE: removeNotify + // should handle this case, but it may be possible that race + // conditions can cause this code to be triggered -- should test + // more) + int ret = LOCK_SUCCESS; + if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { + ret = LOCK_SURFACE_CHANGED; + } + dsi = ds.GetDrawingSurfaceInfo(); + if (dsi == null) { + // Widget not yet realized + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + return LOCK_SURFACE_NOT_READY; + } + win32dsi = (JAWT_Win32DrawingSurfaceInfo) dsi.platformInfo(); + hdc = win32dsi.hdc(); + if (hdc == 0) { + // Widget not yet realized + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + win32dsi = null; + return LOCK_SURFACE_NOT_READY; + } + if (!pixelFormatChosen) { + choosePixelFormat(true); + } + return ret; + } + + public void unlockSurface() { + if (hdc == 0) { + throw new GLException("Surface already unlocked"); + } + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + win32dsi = null; + hdc = 0; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private JAWT getJAWT() { + if (jawt == null) { + JAWT j = new JAWT(); + j.version(JAWTFactory.JAWT_VERSION_1_4); + if (!JAWTFactory.JAWT_GetAWT(j)) { + throw new RuntimeException("Unable to initialize JAWT"); + } + jawt = j; + } + return jawt; + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLContext.java new file mode 100644 index 000000000..edfc70e5f --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLContext.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsPbufferGLContext extends WindowsGLContext { + private static final boolean DEBUG = Debug.debug("WindowsPbufferGLContext"); + + // State for render-to-texture and render-to-texture-rectangle support + private WindowsPbufferGLDrawable drawable; + private boolean rtt; // render-to-texture? + private boolean hasRTT; // render-to-texture extension available? + private boolean rect; // render-to-texture-rectangle? + private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV + private int texture; // actual texture object + + public WindowsPbufferGLContext(WindowsPbufferGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + public void bindPbufferToTexture() { + if (!rtt) { + throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + + "specified in its GLCapabilities"); + } + GL gl = getGL(); + WGLExt wglExt = getWGLExt(); + gl.glBindTexture(textureTarget, texture); + if (rtt && hasRTT) { + if (!wglExt.wglBindTexImageARB(drawable.getPbuffer(), WGLExt.WGL_FRONT_LEFT_ARB)) { + throw new GLException("Binding of pbuffer to texture failed: " + wglGetLastError()); + } + } + // FIXME: comment is wrong now + // Note that if the render-to-texture extension is not supported, + // we perform a glCopyTexImage2D in swapBuffers(). + } + + public void releasePbufferFromTexture() { + if (!rtt) { + throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + + "specified in its GLCapabilities"); + } + if (rtt && hasRTT) { + WGLExt wglExt = getWGLExt(); + if (!wglExt.wglReleaseTexImageARB(drawable.getPbuffer(), WGLExt.WGL_FRONT_LEFT_ARB)) { + throw new GLException("Releasing of pbuffer from texture failed: " + wglGetLastError()); + } + } + } + + protected int makeCurrentImpl() throws GLException { + if (drawable.getHDC() == 0) { + // pbuffer not instantiated (yet?) + if (DEBUG) { + System.err.println("pbuffer not instantiated"); + } + return CONTEXT_NOT_CURRENT; + } + + int res = super.makeCurrentImpl(); + if (DEBUG && VERBOSE) { + System.err.println("WindowsPbufferGLContext: super.makeCurrentImpl() = " + res); + } + if (res == CONTEXT_CURRENT_NEW) { + GLCapabilities capabilities = drawable.getCapabilities(); + + // Initialize render-to-texture support if requested + rtt = capabilities.getOffscreenRenderToTexture(); + rect = capabilities.getOffscreenRenderToTextureRectangle(); + GL gl = getGL(); + + if (rtt) { + if (DEBUG) { + System.err.println("Initializing render-to-texture support"); + } + + if (!gl.isExtensionAvailable("WGL_ARB_render_texture")) { + System.err.println("WindowsPbufferGLContext: WARNING: WGL_ARB_render_texture extension not " + + "supported; implementing render_to_texture support using slow texture readback"); + } else { + hasRTT = true; + + if (rect && !gl.isExtensionAvailable("GL_NV_texture_rectangle")) { + System.err.println("WindowsPbufferGLContext: WARNING: GL_NV_texture_rectangle extension not " + + "supported; skipping requested render_to_texture_rectangle support for pbuffer"); + rect = false; + } + if (rect) { + if (DEBUG) { + System.err.println(" Using render-to-texture-rectangle"); + } + textureTarget = GL.GL_TEXTURE_RECTANGLE_NV; + } else { + if (DEBUG) { + System.err.println(" Using vanilla render-to-texture"); + } + textureTarget = GL.GL_TEXTURE_2D; + } + int[] tmp = new int[1]; + gl.glGenTextures(1, tmp, 0); + texture = tmp[0]; + gl.glBindTexture(textureTarget, texture); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); + gl.glCopyTexImage2D(textureTarget, 0, GL.GL_RGB, 0, 0, drawable.getWidth(), drawable.getHeight(), 0); + } + } + } + return res; + } + + public int getFloatingPointMode() { + return drawable.getFloatingPointMode(); + } + + private static String wglGetLastError() { + return WindowsGLDrawableFactory.wglGetLastError(); + } +} diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java new file mode 100644 index 000000000..8e660cc51 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.windows; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class WindowsPbufferGLDrawable extends WindowsGLDrawable { + private int initWidth; + private int initHeight; + + private WGLExt cachedWGLExt; // cached WGLExt instance from parent GLCanvas, + // needed to destroy pbuffer + private long buffer; // pbuffer handle + private int width; + private int height; + + private int floatMode; + + public WindowsPbufferGLDrawable(GLCapabilities capabilities, + int initialWidth, + int initialHeight, + WindowsGLDrawable dummyDrawable, + WGLExt wglExt) { + super(null, capabilities, null); + this.initWidth = initialWidth; + this.initHeight = initialHeight; + if (initWidth <= 0 || initHeight <= 0) { + throw new GLException("Initial width and height of pbuffer must be positive (were (" + + initWidth + ", " + initHeight + "))"); + } + + if (DEBUG) { + System.out.println("Pbuffer caps on init: " + capabilities + + (capabilities.getOffscreenRenderToTexture() ? " [rtt]" : "") + + (capabilities.getOffscreenRenderToTextureRectangle() ? " [rect]" : "") + + (capabilities.getOffscreenFloatingPointBuffers() ? " [float]" : "")); + } + + createPbuffer(dummyDrawable.getHDC(), wglExt); + } + + public GLContext createContext(GLContext shareWith) { + return new WindowsPbufferGLContext(this, shareWith); + } + + public void destroy() { + if (hdc != 0) { + // Must release DC and pbuffer + // NOTE that since the context is not current, glGetError() can + // not be called here, so we skip the use of any composable + // pipelines (see WindowsOnscreenGLContext.makeCurrentImpl) + WGLExt wglExt = cachedWGLExt; + if (wglExt.wglReleasePbufferDCARB(buffer, hdc) == 0) { + throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError()); + } + hdc = 0; + if (!wglExt.wglDestroyPbufferARB(buffer)) { + throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError()); + } + buffer = 0; + } + } + + public void setSize(int width, int height) { + // FIXME + throw new GLException("Not yet implemented"); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public GLCapabilities getCapabilities() { + return capabilities; + } + + public long getPbuffer() { + return buffer; + } + + public int getFloatingPointMode() { + return floatMode; + } + + public void swapBuffers() throws GLException { + // FIXME: this doesn't make sense any more because we don't have + // access to our OpenGL context here + /* + // FIXME: do we need to do anything if the pbuffer is double-buffered? + // For now, just grab the pixels for the render-to-texture support. + if (rtt && !hasRTT) { + if (DEBUG) { + System.err.println("Copying pbuffer data to GL_TEXTURE_2D state"); + } + + GL gl = getGL(); + gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, width, height); + } + */ + } + + private void createPbuffer(long parentHdc, WGLExt wglExt) { + int[] iattributes = new int [2*MAX_ATTRIBS]; + float[] fattributes = new float[2*MAX_ATTRIBS]; + int nfattribs = 0; + int niattribs = 0; + + if (DEBUG) { + System.out.println("Pbuffer parentHdc = " + toHexString(parentHdc)); + System.out.println("Pbuffer caps: " + capabilities + + (capabilities.getOffscreenRenderToTexture() ? " [rtt]" : "") + + (capabilities.getOffscreenRenderToTextureRectangle() ? " [rect]" : "") + + (capabilities.getOffscreenFloatingPointBuffers() ? " [float]" : "")); + } + + boolean rtt = capabilities.getOffscreenRenderToTexture(); + boolean rect = capabilities.getOffscreenRenderToTextureRectangle(); + boolean useFloat = capabilities.getOffscreenFloatingPointBuffers(); + boolean ati = false; + + // Since we are trying to create a pbuffer, the pixel format we + // request (and subsequently use) must be "p-buffer capable". + iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_PBUFFER_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + + if (rtt && !rect) { + throw new GLException("Render-to-texture-rectangle requires render-to-texture to be specified"); + } + + if (rect) { + if (!wglExt.isExtensionAvailable("GL_NV_texture_rectangle")) { + throw new GLException("Render-to-texture-rectangle requires GL_NV_texture_rectangle extension"); + } + } + + if (useFloat) { + if (!wglExt.isExtensionAvailable("WGL_ATI_pixel_format_float") && + !wglExt.isExtensionAvailable("WGL_NV_float_buffer")) { + throw new GLException("Floating-point pbuffers not supported by this hardware"); + } + + // Prefer NVidia extension over ATI + if (wglExt.isExtensionAvailable("WGL_NV_float_buffer")) { + ati = false; + floatMode = GLPbuffer.NV_FLOAT; + } else { + ati = true; + floatMode = GLPbuffer.ATI_FLOAT; + } + if (DEBUG) { + System.err.println("Using " + (ati ? "ATI" : "NVidia") + " floating-point extension"); + } + } + + if (useFloat && ati) { + if (rtt) { + throw new GLException("Render-to-floating-point-texture not supported on ATI hardware"); + } else { + iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; + iattributes[niattribs++] = WGLExt.WGL_TYPE_RGBA_FLOAT_ATI; + } + } else { + if (!rtt) { + // Currently we don't support non-truecolor visuals in the + // GLCapabilities, so we don't offer the option of making + // color-index pbuffers. + iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; + iattributes[niattribs++] = WGLExt.WGL_TYPE_RGBA_ARB; + } + } + + iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; + if (capabilities.getDoubleBuffered()) { + iattributes[niattribs++] = GL.GL_TRUE; + } else { + iattributes[niattribs++] = GL.GL_FALSE; + } + + iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; + iattributes[niattribs++] = capabilities.getDepthBits(); + + iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; + iattributes[niattribs++] = capabilities.getRedBits(); + + iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; + iattributes[niattribs++] = capabilities.getGreenBits(); + + iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; + iattributes[niattribs++] = capabilities.getBlueBits(); + + iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; + iattributes[niattribs++] = capabilities.getAlphaBits(); + + iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; + if (capabilities.getStencilBits() > 0) { + iattributes[niattribs++] = GL.GL_TRUE; + } else { + iattributes[niattribs++] = GL.GL_FALSE; + } + + if (capabilities.getAccumRedBits() > 0 || + capabilities.getAccumGreenBits() > 0 || + capabilities.getAccumBlueBits() > 0) { + iattributes[niattribs++] = WGLExt.WGL_ACCUM_BITS_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + } + + if (useFloat && !ati) { + iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV; + iattributes[niattribs++] = GL.GL_TRUE; + } + + if (rtt) { + if (useFloat) { + assert(!ati); + if (!rect) { + throw new GLException("Render-to-floating-point-texture only supported on NVidia hardware with render-to-texture-rectangle"); + } + iattributes[niattribs++] = WGLExt.WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV; + iattributes[niattribs++] = GL.GL_TRUE; + } else { + iattributes[niattribs++] = rect ? WGLExt.WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV : WGLExt.WGL_BIND_TO_TEXTURE_RGB_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + } + } + + iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; + iattributes[niattribs++] = GL.GL_TRUE; + + int[] pformats = new int[MAX_PFORMATS]; + int nformats; + int[] nformatsTmp = new int[1]; + if (!wglExt.wglChoosePixelFormatARB(parentHdc, + iattributes, 0, + fattributes, 0, + MAX_PFORMATS, + pformats, 0, + nformatsTmp, 0)) { + throw new GLException("pbuffer creation error: wglChoosePixelFormatARB() failed"); + } + nformats = nformatsTmp[0]; + if (nformats <= 0) { + throw new GLException("pbuffer creation error: Couldn't find a suitable pixel format"); + } + + if (DEBUG) { + System.err.println("" + nformats + " suitable pixel formats found"); + // query pixel format + iattributes[0] = WGLExt.WGL_RED_BITS_ARB; + iattributes[1] = WGLExt.WGL_GREEN_BITS_ARB; + iattributes[2] = WGLExt.WGL_BLUE_BITS_ARB; + iattributes[3] = WGLExt.WGL_ALPHA_BITS_ARB; + iattributes[4] = WGLExt.WGL_DEPTH_BITS_ARB; + iattributes[5] = (useFloat ? (ati ? WGLExt.WGL_PIXEL_TYPE_ARB : WGLExt.WGL_FLOAT_COMPONENTS_NV) : WGLExt.WGL_RED_BITS_ARB); + iattributes[6] = WGLExt.WGL_SAMPLE_BUFFERS_EXT; + iattributes[7] = WGLExt.WGL_SAMPLES_EXT; + iattributes[8] = WGLExt.WGL_DRAW_TO_PBUFFER_ARB; + int[] ivalues = new int[9]; + for (int i = 0; i < nformats; i++) { + if (!wglExt.wglGetPixelFormatAttribivARB(parentHdc, pformats[i], 0, 9, iattributes, 0, ivalues, 0)) { + throw new GLException("Error while querying pixel format " + pformats[i] + + "'s (index " + i + "'s) capabilities for debugging"); + } + System.err.print("pixel format " + pformats[i] + " (index " + i + "): "); + System.err.print( "r: " + ivalues[0]); + System.err.print(" g: " + ivalues[1]); + System.err.print(" b: " + ivalues[2]); + System.err.print(" a: " + ivalues[3]); + System.err.print(" depth: " + ivalues[4]); + System.err.print(" multisample: " + ivalues[6]); + System.err.print(" samples: " + ivalues[7]); + if (useFloat) { + if (ati) { + if (ivalues[5] == WGLExt.WGL_TYPE_RGBA_FLOAT_ATI) { + System.err.print(" [ati float]"); + } else if (ivalues[5] != WGLExt.WGL_TYPE_RGBA_ARB) { + System.err.print(" [unknown pixel type " + ivalues[5] + "]"); + } + } else { + if (ivalues[5] != 0) { + System.err.print(" [float]"); + } + } + } + + if (ivalues[8] != 0) { + System.err.print(" [pbuffer]"); + } + System.err.println(); + } + } + + long tmpBuffer = 0; + int whichFormat = 0; + // Loop is a workaround for bugs in NVidia's recent drivers + do { + int format = pformats[whichFormat]; + + // Create the p-buffer. + niattribs = 0; + + if (rtt) { + iattributes[niattribs++] = WGLExt.WGL_TEXTURE_FORMAT_ARB; + if (useFloat) { + iattributes[niattribs++] = WGLExt.WGL_TEXTURE_FLOAT_RGB_NV; + } else { + iattributes[niattribs++] = WGLExt.WGL_TEXTURE_RGBA_ARB; + } + + iattributes[niattribs++] = WGLExt.WGL_TEXTURE_TARGET_ARB; + iattributes[niattribs++] = rect ? WGLExt.WGL_TEXTURE_RECTANGLE_NV : WGLExt.WGL_TEXTURE_2D_ARB; + + iattributes[niattribs++] = WGLExt.WGL_MIPMAP_TEXTURE_ARB; + iattributes[niattribs++] = GL.GL_FALSE; + + iattributes[niattribs++] = WGLExt.WGL_PBUFFER_LARGEST_ARB; + iattributes[niattribs++] = GL.GL_FALSE; + } + + iattributes[niattribs++] = 0; + + tmpBuffer = wglExt.wglCreatePbufferARB(parentHdc, format, initWidth, initHeight, iattributes, 0); + ++whichFormat; + } while ((tmpBuffer == 0) && (whichFormat < nformats)); + + if (tmpBuffer == 0) { + throw new GLException("pbuffer creation error: wglCreatePbufferARB() failed: tried " + nformats + + " pixel formats, last error was: " + wglGetLastError()); + } + + // Get the device context. + long tmpHdc = wglExt.wglGetPbufferDCARB(tmpBuffer); + if (tmpHdc == 0) { + throw new GLException("pbuffer creation error: wglGetPbufferDCARB() failed"); + } + + // Set up instance variables + buffer = tmpBuffer; + hdc = tmpHdc; + cachedWGLExt = wglExt; + + // Determine the actual width and height we were able to create. + int[] tmp = new int[1]; + wglExt.wglQueryPbufferARB( buffer, WGLExt.WGL_PBUFFER_WIDTH_ARB, tmp, 0 ); + width = tmp[0]; + wglExt.wglQueryPbufferARB( buffer, WGLExt.WGL_PBUFFER_HEIGHT_ARB, tmp, 0 ); + height = tmp[0]; + + if (DEBUG) { + System.err.println("Created pbuffer " + width + " x " + height); + } + } + + private static String wglGetLastError() { + return WindowsGLDrawableFactory.wglGetLastError(); + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java b/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java new file mode 100755 index 000000000..4d329ba24 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11ExternalGLContext extends X11GLContext { + private boolean firstMakeCurrent = true; + private boolean created = true; + + public X11ExternalGLContext() { + super(null, null); + lockAWT(); + try { + context = GLX.glXGetCurrentContext(); + } finally { + unlockAWT(); + } + GLContextShareSet.contextCreated(this); + resetGLFunctionAvailability(); + } + + protected void create() { + } + + protected int makeCurrentImpl() throws GLException { + if (firstMakeCurrent) { + firstMakeCurrent = false; + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } + + protected void releaseImpl() throws GLException { + } + + protected void destroyImpl() throws GLException { + created = false; + GLContextShareSet.contextDestroyed(this); + } + + public boolean isCreated() { + return created; + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11ExternalGLDrawable.java b/src/classes/com/sun/opengl/impl/x11/X11ExternalGLDrawable.java new file mode 100755 index 000000000..371930013 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11ExternalGLDrawable.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11ExternalGLDrawable extends X11GLDrawable { + private int fbConfigID; + private int renderType; + private int screen; + private long readDrawable; + + public X11ExternalGLDrawable() { + super(null, null, null); + lockAWT(); + try { + display = GLX.glXGetCurrentDisplay(); + drawable = GLX.glXGetCurrentDrawable(); + readDrawable = GLX.glXGetCurrentReadDrawable(); + + // Need GLXFBConfig ID in order to properly create new contexts + // on this drawable + long context = GLX.glXGetCurrentContext(); + int[] val = new int[1]; + GLX.glXQueryContext(display, context, GLX.GLX_FBCONFIG_ID, val, 0); + fbConfigID = val[0]; + renderType = GLX.GLX_RGBA_TYPE; + GLX.glXQueryContext(display, context, GLX.GLX_RENDER_TYPE, val, 0); + if ((val[0] & GLX.GLX_RGBA_BIT) == 0) { + if (DEBUG) { + System.err.println("X11ExternalGLDrawable: WARNING: forcing GLX_RGBA_TYPE for newly created contexts"); + } + } + GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val, 0); + screen = val[0]; + } finally { + unlockAWT(); + } + } + + public GLContext createContext(GLContext shareWith) { + return new Context(shareWith); + } + + public void setSize(int newWidth, int newHeight) { + throw new GLException("Should not call this"); + } + + public int getWidth() { + throw new GLException("Should not call this"); + } + + public int getHeight() { + throw new GLException("Should not call this"); + } + + public void destroy() { + } + + class Context extends X11GLContext { + Context(GLContext shareWith) { + super(X11ExternalGLDrawable.this, shareWith); + this.drawable = drawable; + } + + protected int makeCurrentImpl() throws GLException { + if (drawable.getDrawable() == 0) { + // parent drawable not properly initialized + // FIXME: signal error? + if (DEBUG) { + System.err.println("parent drawable not properly initialized"); + } + return CONTEXT_NOT_CURRENT; + } + + // Note that we have to completely override makeCurrentImpl + // because the underlying makeCurrent call differs from the norm + lockAWT(); + try { + boolean created = false; + if (context == 0) { + create(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName()); + } + created = true; + } + + if (!GLX.glXMakeContextCurrent(drawable.getDisplay(), + drawable.getDrawable(), + readDrawable, + context)) { + throw new GLException("Error making context current"); + } else { + mostRecentDisplay = drawable.getDisplay(); + if (DEBUG && VERBOSE) { + System.err.println(getThreadName() + ": glXMakeCurrent(display " + toHexString(drawable.getDisplay()) + + ", drawable " + toHexString(drawable.getDrawable()) + + ", context " + toHexString(context) + ") succeeded"); + } + } + + if (created) { + resetGLFunctionAvailability(); + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } finally { + unlockAWT(); + } + } + + protected void releaseImpl() throws GLException { + lockAWT(); + try { + if (!GLX.glXMakeContextCurrent(drawable.getDisplay(), 0, 0, 0)) { + throw new GLException("Error freeing OpenGL context"); + } + } finally { + unlockAWT(); + } + } + + protected void create() { + // We already have the GLXFBConfig ID for the context. All we + // need to do is use it to choose the GLXFBConfig and then + // create a context with it. + int[] iattributes = new int[] { + GLX.GLX_FBCONFIG_ID, + fbConfigID, + 0, + 0 + }; + float[] fattributes = new float[0]; + int[] nelementsTmp = new int[1]; + GLXFBConfig[] fbConfigs = GLX.glXChooseFBConfig(display, screen, iattributes, 0, nelementsTmp, 0); + int nelements = nelementsTmp[0]; + if (nelements <= 0) { + throw new GLException("context creation error: couldn't find a suitable frame buffer configuration"); + } + if (nelements != 1) { + throw new GLException("context creation error: shouldn't get more than one GLXFBConfig"); + } + // Note that we currently don't allow selection of anything but + // the first GLXFBConfig in the returned list (there should be only one) + GLXFBConfig fbConfig = fbConfigs[0]; + // Create a gl context for the drawable + X11GLContext other = (X11GLContext) GLContextShareSet.getShareContext(this); + long share = 0; + if (other != null) { + share = other.getContext(); + if (share == 0) { + throw new GLException("GLContextShareSet returned an invalid OpenGL context"); + } + } + // FIXME: how to determine "direct" bit? + context = GLX.glXCreateNewContext(display, fbConfig, renderType, share, true); + if (context == 0) { + String detail = " display=" + toHexString(display) + + " fbconfig=" + fbConfig + + " fbconfigID=" + toHexString(fbConfigID) + + " renderType=" + toHexString(renderType) + + " share=" + toHexString(share); + throw new GLException("context creation error: glXCreateNewContext() failed: " + detail); + } + GLContextShareSet.contextCreated(this); + + if (DEBUG) { + System.err.println("Created context " + toHexString(context) + + " for GLXDrawable " + toHexString(drawable.getDrawable())); + } + } + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLContext.java b/src/classes/com/sun/opengl/impl/x11/X11GLContext.java new file mode 100644 index 000000000..ed9736f22 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11GLContext.java @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import java.nio.*; +import java.util.*; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public abstract class X11GLContext extends GLContextImpl { + protected X11GLDrawable drawable; + protected long context; + private boolean glXQueryExtensionsStringInitialized; + private boolean glXQueryExtensionsStringAvailable; + private static final Map/**/ functionNameMap; + private GLXExt glXExt; + // Table that holds the addresses of the native C-language entry points for + // GLX extension functions. + private GLXExtProcAddressTable glXExtProcAddressTable; + // Cache the most recent value of the "display" variable (which we + // only guarantee to be valid in between makeCurrent / free pairs) + // so that we can implement displayImpl() (which must be done when + // the context is not current) + protected long mostRecentDisplay; + + static { + functionNameMap = new HashMap(); + functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV"); + functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV"); + } + + public X11GLContext(X11GLDrawable drawable, + GLContext shareWith) { + super(shareWith); + this.drawable = drawable; + } + + public Object getPlatformGLExtensions() { + return getGLXExt(); + } + + public GLXExt getGLXExt() { + if (glXExt == null) { + glXExt = new GLXExtImpl(this); + } + return glXExt; + } + + public GLDrawable getGLDrawable() { + return drawable; + } + + protected String mapToRealGLFunctionName(String glFunctionName) { + String lookup = (String) functionNameMap.get(glFunctionName); + if (lookup != null) { + return lookup; + } + return glFunctionName; + } + + protected String mapToRealGLExtensionName(String glExtensionName) { + return glExtensionName; + } + + /** Helper routine which usually just turns around and calls + * createContext (except for pbuffers, which use a different context + * creation mechanism). Should only be called by {@link + * makeCurrentImpl()}. + */ + protected abstract void create(); + + /** + * Creates and initializes an appropriate OpenGL context. Should only be + * called by {@link create()}. + */ + protected void createContext(boolean onscreen) { + XVisualInfo vis = drawable.chooseVisual(onscreen); + X11GLContext other = (X11GLContext) GLContextShareSet.getShareContext(this); + long share = 0; + if (other != null) { + share = other.getContext(); + if (share == 0) { + throw new GLException("GLContextShareSet returned an invalid OpenGL context"); + } + } + context = GLX.glXCreateContext(drawable.getDisplay(), vis, share, onscreen); + if (context == 0) { + throw new GLException("Unable to create OpenGL context"); + } + GLContextShareSet.contextCreated(this); + } + + protected int makeCurrentImpl() throws GLException { + // FIXME: in offscreen (non-pbuffer) case this is run without the + // AWT lock held + boolean created = false; + if (context == 0) { + create(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName()); + } + created = true; + } + + if (!GLX.glXMakeCurrent(drawable.getDisplay(), drawable.getDrawable(), context)) { + throw new GLException("Error making context current"); + } else { + mostRecentDisplay = drawable.getDisplay(); + if (DEBUG && VERBOSE) { + System.err.println(getThreadName() + ": glXMakeCurrent(display " + toHexString(drawable.getDisplay()) + + ", drawable " + toHexString(drawable.getDrawable()) + + ", context " + toHexString(context) + ") succeeded"); + } + } + + if (created) { + resetGLFunctionAvailability(); + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } + + protected void releaseImpl() throws GLException { + if (!GLX.glXMakeCurrent(drawable.getDisplay(), 0, 0)) { + throw new GLException("Error freeing OpenGL context"); + } + } + + protected void destroyImpl() throws GLException { + lockAWT(); + if (context != 0) { + GLX.glXDestroyContext(mostRecentDisplay, context); + if (DEBUG) { + System.err.println("!!! Destroyed OpenGL context " + context); + } + context = 0; + mostRecentDisplay = 0; + GLContextShareSet.contextDestroyed(this); + } + unlockAWT(); + } + + public boolean isCreated() { + return (context != 0); + } + + protected void resetGLFunctionAvailability() { + super.resetGLFunctionAvailability(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Initializing GLX extension address table"); + } + resetProcAddressTable(getGLXExtProcAddressTable()); + } + + public GLXExtProcAddressTable getGLXExtProcAddressTable() { + if (glXExtProcAddressTable == null) { + // FIXME: cache ProcAddressTables by capability bits so we can + // share them among contexts with the same capabilities + glXExtProcAddressTable = new GLXExtProcAddressTable(); + } + return glXExtProcAddressTable; + } + + public synchronized String getPlatformExtensionsString() { + if (drawable.getDisplay() == 0) { + throw new GLException("Context not current"); + } + if (!glXQueryExtensionsStringInitialized) { + glXQueryExtensionsStringAvailable = + (GLDrawableFactoryImpl.getFactoryImpl().dynamicLookupFunction("glXQueryExtensionsString") != 0); + glXQueryExtensionsStringInitialized = true; + } + if (glXQueryExtensionsStringAvailable) { + lockAWT(); + try { + String ret = GLX.glXQueryExtensionsString(drawable.getDisplay(), GLX.DefaultScreen(drawable.getDisplay())); + if (DEBUG) { + System.err.println("!!! GLX extensions: " + ret); + } + return ret; + } finally { + unlockAWT(); + } + } else { + return ""; + } + } + + protected boolean isFunctionAvailable(String glFunctionName) + { + boolean available = super.isFunctionAvailable(glFunctionName); + + // Sanity check for implementations that use proc addresses for run-time + // linking: if the function IS available, then make sure there's a proc + // address for it if it's an extension or not part of the OpenGL 1.1 core + // (post GL 1.1 functions are run-time linked on windows). + assert(!available || + (getGLProcAddressTable().getAddressFor(mapToRealGLFunctionName(glFunctionName)) != 0 || + FunctionAvailabilityCache.isPartOfGLCore("1.1", mapToRealGLFunctionName(glFunctionName))) + ); + + return available; + } + + public boolean isExtensionAvailable(String glExtensionName) { + if (glExtensionName.equals("GL_ARB_pbuffer") || + glExtensionName.equals("GL_ARB_pixel_format")) { + return GLDrawableFactory.getFactory().canCreateGLPbuffer(); + } + return super.isExtensionAvailable(glExtensionName); + } + + + public void setSwapInterval(int interval) { + // FIXME: make the context current first? Currently assumes that + // will not be necessary. Make the caller do this? + GLXExt glXExt = getGLXExt(); + if (glXExt.isExtensionAvailable("GLX_SGI_swap_control")) { + glXExt.glXSwapIntervalSGI(interval); + } + } + + public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { + return getGLXExt().glXAllocateMemoryNV(arg0, arg1, arg2, arg3); + } + + public int getOffscreenContextPixelDataType() { + throw new GLException("Should not call this"); + } + + public int getOffscreenContextReadBuffer() { + throw new GLException("Should not call this"); + } + + public boolean offscreenImageNeedsVerticalFlip() { + throw new GLException("Should not call this"); + } + + public void bindPbufferToTexture() { + throw new GLException("Should not call this"); + } + + public void releasePbufferFromTexture() { + throw new GLException("Should not call this"); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + protected long getContext() { + return context; + } + + // These synchronization primitives prevent the AWT from making + // requests from the X server asynchronously to this code. + protected void lockAWT() { + X11GLDrawableFactory.lockAWT(); + } + + protected void unlockAWT() { + X11GLDrawableFactory.unlockAWT(); + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawable.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawable.java new file mode 100644 index 000000000..1d4f5389b --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawable.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import java.awt.Component; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public abstract class X11GLDrawable extends GLDrawableImpl { + protected static final boolean DEBUG = Debug.debug("X11GLDrawable"); + + protected long display; + protected long drawable; + protected long visualID; + protected Component component; + protected GLCapabilities capabilities; + protected GLCapabilitiesChooser chooser; + + public X11GLDrawable(Component component, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + this.component = component; + this.capabilities = (capabilities == null) ? null : + ((GLCapabilities) capabilities.clone()); + this.chooser = chooser; + } + + public void setRealized(boolean val) { + throw new GLException("Should not call this (should only be called for onscreen GLDrawables)"); + } + + public void destroy() { + throw new GLException("Should not call this (should only be called for offscreen GLDrawables)"); + } + + public void swapBuffers() throws GLException { + } + + public long getDisplay() { + return display; + } + + public long getDrawable() { + return drawable; + } + + //--------------------------------------------------------------------------- + // Internals only below this point + // + + protected XVisualInfo chooseVisual(boolean onscreen) { + if (display == 0) { + throw new GLException("null display"); + } + + // FIXME + if (onscreen) { + // The visual has already been chosen by the time we get here; + // it's specified by the GraphicsConfiguration of the + // GLCanvas. Fortunately, the JAWT supplies the visual ID for + // the component in a portable fashion, so all we have to do is + // use XGetVisualInfo with a VisualIDMask to get the + // corresponding XVisualInfo to pass into glXChooseVisual. + int[] count = new int[1]; + XVisualInfo template = new XVisualInfo(); + // FIXME: probably not 64-bit clean + template.visualid((int) visualID); + lockAWT(); + XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualIDMask, template, count, 0); + unlockAWT(); + if (infos == null || infos.length == 0) { + throw new GLException("Error while getting XVisualInfo for visual ID " + visualID); + } + // FIXME: the storage for the infos array is leaked (should + // clean it up somehow when we're done with the visual we're + // returning) + return infos[0]; + } else { + // It isn't clear to me whether we need this much code to handle + // the offscreen case, where we're creating a pixmap into which + // to render...this is what we (incorrectly) used to do for the + // onscreen case + + int screen = 0; // FIXME: provide way to specify this? + XVisualInfo vis = null; + int[] count = new int[1]; + XVisualInfo template = new XVisualInfo(); + template.screen(screen); + XVisualInfo[] infos = null; + GLCapabilities[] caps = null; + lockAWT(); + try { + infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0); + if (infos == null) { + throw new GLException("Error while enumerating available XVisualInfos"); + } + caps = new GLCapabilities[infos.length]; + for (int i = 0; i < infos.length; i++) { + caps[i] = X11GLDrawableFactory.xvi2GLCapabilities(display, infos[i]); + } + } finally { + unlockAWT(); + } + int chosen = chooser.chooseCapabilities(capabilities, caps, -1); + if (chosen < 0 || chosen >= caps.length) { + throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); + } + if (DEBUG) { + System.err.println("Chosen visual (" + chosen + "):"); + System.err.println(caps[chosen]); + } + vis = infos[chosen]; + if (vis == null) { + throw new GLException("GLCapabilitiesChooser chose an invalid visual"); + } + // FIXME: the storage for the infos array is leaked (should + // clean it up somehow when we're done with the visual we're + // returning) + + return vis; + } + } + + + // These synchronization primitives prevent the AWT from making + // requests from the X server asynchronously to this code. + protected void lockAWT() { + X11GLDrawableFactory.lockAWT(); + } + + protected void unlockAWT() { + X11GLDrawableFactory.unlockAWT(); + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java new file mode 100644 index 000000000..f4523c95e --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java @@ -0,0 +1,439 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import java.awt.Component; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.security.*; +import java.util.ArrayList; +import java.util.List; +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11GLDrawableFactory extends GLDrawableFactoryImpl { + private static final boolean DEBUG = Debug.debug("X11GLDrawableFactory"); + + // There is currently a bug on Linux/AMD64 distributions in glXGetProcAddressARB + private static boolean isLinuxAMD64; + + static { + NativeLibLoader.load(); + + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String os = System.getProperty("os.name").toLowerCase(); + String arch = System.getProperty("os.arch").toLowerCase(); + if (os.startsWith("linux") && arch.equals("amd64")) { + isLinuxAMD64 = true; + } + return null; + } + }); + } + + public X11GLDrawableFactory() { + // Must initialize GLX support eagerly in case a pbuffer is the + // first thing instantiated + resetProcAddressTable(GLX.getGLXProcAddressTable()); + } + + private static final int MAX_ATTRIBS = 128; + + public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GraphicsDevice device) { + if (capabilities == null) { + capabilities = new GLCapabilities(); + } + if (chooser == null) { + chooser = new DefaultGLCapabilitiesChooser(); + } + if (device == null) { + device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + } + + int screen = X11SunJDKReflection.graphicsDeviceGetScreen(device); + // Until we have a rock-solid visual selection algorithm written + // in pure Java, we're going to provide the underlying window + // system's selection to the chooser as a hint + + int[] attribs = glCapabilities2AttribList(capabilities, isMultisampleAvailable()); + XVisualInfo[] infos = null; + GLCapabilities[] caps = null; + int recommendedIndex = -1; + lockAWT(); + try { + long display = getDisplayConnection(); + XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs, 0); + int[] count = new int[1]; + XVisualInfo template = new XVisualInfo(); + template.screen(screen); + infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0); + if (infos == null) { + throw new GLException("Error while enumerating available XVisualInfos"); + } + caps = new GLCapabilities[infos.length]; + for (int i = 0; i < infos.length; i++) { + caps[i] = xvi2GLCapabilities(display, infos[i]); + // Attempt to find the visual chosen by glXChooseVisual + if (recommendedVis != null && recommendedVis.visualid() == infos[i].visualid()) { + recommendedIndex = i; + } + } + } finally { + unlockAWT(); + } + int chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); + if (chosen < 0 || chosen >= caps.length) { + throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); + } + XVisualInfo vis = infos[chosen]; + if (vis == null) { + throw new GLException("GLCapabilitiesChooser chose an invalid visual"); + } + // FIXME: need to look at glue code and see type of this field + long visualID = vis.visualid(); + // FIXME: the storage for the infos array, as well as that for the + // recommended visual, is leaked; should free them here with XFree() + + // Now figure out which GraphicsConfiguration corresponds to this + // visual by matching the visual ID + GraphicsConfiguration[] configs = device.getConfigurations(); + for (int i = 0; i < configs.length; i++) { + GraphicsConfiguration config = configs[i]; + if (config != null) { + if (X11SunJDKReflection.graphicsConfigurationGetVisualID(config) == visualID) { + return config; + } + } + } + + // Either we weren't able to reflectively introspect on the + // X11GraphicsConfig or something went wrong in the steps above; + // we're going to return null without signaling an error condition + // in this case (although we should distinguish between the two + // and possibly report more of an error in the latter case) + return null; + } + + public GLDrawable getGLDrawable(Object target, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + if (target == null) { + throw new IllegalArgumentException("Null target"); + } + if (!(target instanceof Component)) { + throw new IllegalArgumentException("GLDrawables not supported for objects of type " + + target.getClass().getName() + " (only Components are supported in this implementation)"); + } + return new X11OnscreenGLDrawable((Component) target); + } + + public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + return new X11OffscreenGLDrawable(capabilities, chooser); + } + + private boolean pbufferSupportInitialized = false; + private boolean canCreateGLPbuffer = false; + public boolean canCreateGLPbuffer() { + if (!pbufferSupportInitialized) { + Runnable r = new Runnable() { + public void run() { + long display = getDisplayConnection(); + lockAWT(); + try { + int[] major = new int[1]; + int[] minor = new int[1]; + if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) { + throw new GLException("glXQueryVersion failed"); + } + if (DEBUG) { + System.err.println("!!! GLX version: major " + major[0] + + ", minor " + minor[0]); + } + + int screen = 0; // FIXME: provide way to specify this? + + // Work around bugs in ATI's Linux drivers where they report they + // only implement GLX version 1.2 but actually do support pbuffers + if (major[0] == 1 && minor[0] == 2) { + String str = GLX.glXQueryServerString(display, screen, GLX.GLX_VENDOR); + if (str != null && str.indexOf("ATI") >= 0) { + canCreateGLPbuffer = true; + } + } else { + canCreateGLPbuffer = ((major[0] > 1) || (minor[0] > 2)); + } + + pbufferSupportInitialized = true; + } finally { + unlockAWT(); + } + } + }; + maybeDoSingleThreadedWorkaround(r); + } + return canCreateGLPbuffer; + } + + public GLPbuffer createGLPbuffer(final GLCapabilities capabilities, + final int initialWidth, + final int initialHeight, + final GLContext shareWith) { + if (!canCreateGLPbuffer()) { + throw new GLException("Pbuffer support not available with current graphics card"); + } + final List returnList = new ArrayList(); + Runnable r = new Runnable() { + public void run() { + X11PbufferGLDrawable pbufferDrawable = new X11PbufferGLDrawable(capabilities, + initialWidth, + initialHeight); + GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith); + returnList.add(pbuffer); + } + }; + maybeDoSingleThreadedWorkaround(r); + return (GLPbuffer) returnList.get(0); + } + + public GLContext createExternalGLContext() { + return new X11ExternalGLContext(); + } + + public boolean canCreateExternalGLDrawable() { + return canCreateGLPbuffer(); + } + + public GLDrawable createExternalGLDrawable() { + return new X11ExternalGLDrawable(); + } + + public long dynamicLookupFunction(String glFuncName) { + long res = 0; + if (!isLinuxAMD64) { + res = GLX.glXGetProcAddressARB(glFuncName); + } + if (res == 0) { + // GLU routines aren't known to the OpenGL function lookup + res = GLX.dlsym(glFuncName); + } + return res; + } + + public static GLCapabilities xvi2GLCapabilities(long display, XVisualInfo info) { + int[] tmp = new int[1]; + int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0); + if (val == 0) { + // Visual does not support OpenGL + return null; + } + val = glXGetConfig(display, info, GLX.GLX_RGBA, tmp, 0); + if (val == 0) { + // Visual does not support RGBA + return null; + } + GLCapabilities res = new GLCapabilities(); + res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp, 0) != 0); + res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp, 0) != 0); + // Note: use of hardware acceleration is determined by + // glXCreateContext, not by the XVisualInfo. Optimistically claim + // that all GLCapabilities have the capability to be hardware + // accelerated. + res.setHardwareAccelerated(true); + res.setDepthBits (glXGetConfig(display, info, GLX.GLX_DEPTH_SIZE, tmp, 0)); + res.setStencilBits (glXGetConfig(display, info, GLX.GLX_STENCIL_SIZE, tmp, 0)); + res.setRedBits (glXGetConfig(display, info, GLX.GLX_RED_SIZE, tmp, 0)); + res.setGreenBits (glXGetConfig(display, info, GLX.GLX_GREEN_SIZE, tmp, 0)); + res.setBlueBits (glXGetConfig(display, info, GLX.GLX_BLUE_SIZE, tmp, 0)); + res.setAlphaBits (glXGetConfig(display, info, GLX.GLX_ALPHA_SIZE, tmp, 0)); + res.setAccumRedBits (glXGetConfig(display, info, GLX.GLX_ACCUM_RED_SIZE, tmp, 0)); + res.setAccumGreenBits(glXGetConfig(display, info, GLX.GLX_ACCUM_GREEN_SIZE, tmp, 0)); + res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp, 0)); + res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp, 0)); + if (isMultisampleAvailable()) { + res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS_ARB, tmp, 0) != 0); + res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES_ARB, tmp, 0)); + } + return res; + } + + public static int[] glCapabilities2AttribList(GLCapabilities caps, + boolean isMultisampleAvailable) { + int colorDepth = (caps.getRedBits() + + caps.getGreenBits() + + caps.getBlueBits()); + if (colorDepth < 15) { + throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported"); + } + int[] res = new int[MAX_ATTRIBS]; + int idx = 0; + res[idx++] = GLX.GLX_RGBA; + if (caps.getDoubleBuffered()) { + res[idx++] = GLX.GLX_DOUBLEBUFFER; + } + if (caps.getStereo()) { + res[idx++] = GLX.GLX_STEREO; + } + res[idx++] = GLX.GLX_RED_SIZE; + res[idx++] = caps.getRedBits(); + res[idx++] = GLX.GLX_GREEN_SIZE; + res[idx++] = caps.getGreenBits(); + res[idx++] = GLX.GLX_BLUE_SIZE; + res[idx++] = caps.getBlueBits(); + res[idx++] = GLX.GLX_ALPHA_SIZE; + res[idx++] = caps.getAlphaBits(); + res[idx++] = GLX.GLX_DEPTH_SIZE; + res[idx++] = caps.getDepthBits(); + res[idx++] = GLX.GLX_STENCIL_SIZE; + res[idx++] = caps.getStencilBits(); + res[idx++] = GLX.GLX_ACCUM_RED_SIZE; + res[idx++] = caps.getAccumRedBits(); + res[idx++] = GLX.GLX_ACCUM_GREEN_SIZE; + res[idx++] = caps.getAccumGreenBits(); + res[idx++] = GLX.GLX_ACCUM_BLUE_SIZE; + res[idx++] = caps.getAccumBlueBits(); + if (isMultisampleAvailable && caps.getSampleBuffers()) { + res[idx++] = GLXExt.GLX_SAMPLE_BUFFERS_ARB; + res[idx++] = GL.GL_TRUE; + res[idx++] = GLXExt.GLX_SAMPLES_ARB; + res[idx++] = caps.getNumSamples(); + } + res[idx++] = 0; + return res; + } + + // JAWT access + private static JAWT jawt; + public static JAWT getJAWT() { + if (jawt == null) { + JAWT j = new JAWT(); + j.version(JAWTFactory.JAWT_VERSION_1_4); + if (!JAWTFactory.JAWT_GetAWT(j)) { + throw new RuntimeException("Unable to initialize JAWT"); + } + jawt = j; + } + return jawt; + } + + public static void lockAWT() { + if (!Java2D.isOGLPipelineActive() || !Java2D.isQueueFlusherThread()) { + getJAWT().Lock(); + } + } + + public static void unlockAWT() { + if (!Java2D.isOGLPipelineActive() || !Java2D.isQueueFlusherThread()) { + getJAWT().Unlock(); + } + } + + public void lockAWTForJava2D() { + lockAWT(); + } + public void unlockAWTForJava2D() { + unlockAWT(); + } + + // Display connection for use by visual selection algorithm and by all offscreen surfaces + private static long staticDisplay; + public static long getDisplayConnection() { + if (staticDisplay == 0) { + lockAWT(); + try { + staticDisplay = GLX.XOpenDisplay(null); + } finally { + unlockAWT(); + } + if (staticDisplay == 0) { + throw new GLException("Unable to open default display, needed for visual selection and offscreen surface handling"); + } + } + return staticDisplay; + } + + private static boolean checkedMultisample; + private static boolean multisampleAvailable; + public static boolean isMultisampleAvailable() { + if (!checkedMultisample) { + long display = getDisplayConnection(); + String exts = GLX.glXGetClientString(display, GLX.GLX_EXTENSIONS); + if (exts != null) { + multisampleAvailable = (exts.indexOf("GLX_ARB_multisample") >= 0); + } + checkedMultisample = true; + } + return multisampleAvailable; + } + + private static String glXGetConfigErrorCode(int err) { + switch (err) { + case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; + case GLX.GLX_BAD_SCREEN: return "GLX_BAD_SCREEN"; + case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE"; + case GLX.GLX_BAD_VISUAL: return "GLX_BAD_VISUAL"; + default: return "Unknown error code " + err; + } + } + + public static int glXGetConfig(long display, XVisualInfo info, int attrib, int[] tmp, int tmp_offset) { + if (display == 0) { + throw new GLException("No display connection"); + } + int res = GLX.glXGetConfig(display, info, attrib, tmp, tmp_offset); + if (res != 0) { + throw new GLException("glXGetConfig failed: error code " + glXGetConfigErrorCode(res)); + } + return tmp[tmp_offset]; + } + + private void maybeDoSingleThreadedWorkaround(Runnable action) { + if (Threading.isSingleThreaded() && + !Threading.isOpenGLThread()) { + Threading.invokeOnOpenGLThread(action); + } else { + action.run(); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11OffscreenGLContext.java b/src/classes/com/sun/opengl/impl/x11/X11OffscreenGLContext.java new file mode 100644 index 000000000..e1c8eb3d1 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11OffscreenGLContext.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11OffscreenGLContext extends X11GLContext { + private X11OffscreenGLDrawable drawable; + + public X11OffscreenGLContext(X11OffscreenGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + public int getOffscreenContextPixelDataType() { + return GL.GL_UNSIGNED_INT_8_8_8_8_REV; + } + + public int getOffscreenContextReadBuffer() { + if (drawable.isDoubleBuffered()) { + return GL.GL_BACK; + } + return GL.GL_FRONT; + } + + public boolean offscreenImageNeedsVerticalFlip() { + // There doesn't seem to be a way to do this in the construction + // of the Pixmap or GLXPixmap + return true; + } + + protected void create() { + createContext(false); + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11OffscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/x11/X11OffscreenGLDrawable.java new file mode 100644 index 000000000..2d7dedd7f --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11OffscreenGLDrawable.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11OffscreenGLDrawable extends X11GLDrawable { + private long pixmap; + private boolean isDoubleBuffered; + // Width and height of the underlying bitmap + private int width; + private int height; + + public X11OffscreenGLDrawable(GLCapabilities capabilities, + GLCapabilitiesChooser chooser) { + super(null, capabilities, chooser); + } + + public GLContext createContext(GLContext shareWith) { + return new X11OffscreenGLContext(this, shareWith); + } + + public void setSize(int newWidth, int newHeight) { + width = newWidth; + height = newHeight; + if (pixmap != 0) { + destroy(); + } + create(); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + private void create() { + display = X11GLDrawableFactory.getDisplayConnection(); + XVisualInfo vis = chooseVisual(false); + int bitsPerPixel = vis.depth(); + + lockAWT(); + try { + int screen = GLX.DefaultScreen(display); + pixmap = GLX.XCreatePixmap(display, (int) GLX.RootWindow(display, screen), width, height, bitsPerPixel); + if (pixmap == 0) { + throw new GLException("XCreatePixmap failed"); + } + drawable = GLX.glXCreateGLXPixmap(display, vis, pixmap); + if (drawable == 0) { + GLX.XFreePixmap(display, pixmap); + pixmap = 0; + throw new GLException("glXCreateGLXPixmap failed"); + } + isDoubleBuffered = (X11GLDrawableFactory.glXGetConfig(display, vis, GLX.GLX_DOUBLEBUFFER, new int[1], 0) != 0); + if (DEBUG) { + System.err.println("Created pixmap " + toHexString(pixmap) + + ", GLXPixmap " + toHexString(drawable) + + ", display " + toHexString(display)); + } + } finally { + unlockAWT(); + } + } + + public void destroy() { + if (pixmap != 0) { + if (DEBUG) { + System.err.println("Destroying pixmap " + toHexString(pixmap) + + ", GLXPixmap " + toHexString(drawable) + + ", display " + toHexString(display)); + } + + // Must destroy pixmap and GLXPixmap + lockAWT(); + + if (DEBUG) { + long cur = GLX.glXGetCurrentContext(); + if (cur != 0) { + System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction"); + } + } + + // FIXME: workaround for crashes on NVidia hardware when + // destroying pixmap (no context is current at the point of the + // crash, at least from the point of view of + // glXGetCurrentContext) + GLX.glXMakeCurrent(display, 0, 0); + + GLX.glXDestroyGLXPixmap(display, drawable); + GLX.XFreePixmap(display, pixmap); + unlockAWT(); + drawable = 0; + pixmap = 0; + display = 0; + } + } + + public boolean isDoubleBuffered() { + return isDoubleBuffered; + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java b/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java new file mode 100644 index 000000000..d6b79cb8f --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLContext.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import java.util.*; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11OnscreenGLContext extends X11GLContext { + protected X11OnscreenGLDrawable drawable; + + public X11OnscreenGLContext(X11OnscreenGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + protected int makeCurrentImpl() throws GLException { + try { + int lockRes = drawable.lockSurface(); + if (lockRes == X11OnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { + return CONTEXT_NOT_CURRENT; + } + if (lockRes == X11OnscreenGLDrawable.LOCK_SURFACE_CHANGED) { + if (context != 0) { + GLX.glXDestroyContext(mostRecentDisplay, context); + GLContextShareSet.contextDestroyed(this); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(context) + " due to JAWT_LOCK_SURFACE_CHANGED"); + } + context = 0; + } + } + int ret = super.makeCurrentImpl(); + return ret; + } catch (RuntimeException e) { + try { + drawable.unlockSurface(); + } catch (Exception e2) { + // do nothing if unlockSurface throws + } + throw(e); + } + } + + protected void releaseImpl() throws GLException { + try { + super.releaseImpl(); + } finally { + drawable.unlockSurface(); + } + } + + protected void create() { + createContext(true); + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLDrawable.java new file mode 100644 index 000000000..49000fc14 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11OnscreenGLDrawable.java @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import java.awt.Component; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11OnscreenGLDrawable extends X11GLDrawable { + public static final int LOCK_SURFACE_NOT_READY = 1; + public static final int LOCK_SURFACE_CHANGED = 2; + public static final int LOCK_SUCCESS = 3; + + // Variables for lockSurface/unlockSurface + private JAWT_DrawingSurface ds; + private JAWT_DrawingSurfaceInfo dsi; + private JAWT_X11DrawingSurfaceInfo x11dsi; + + // Indicates whether the component (if an onscreen context) has been + // realized. Plausibly, before the component is realized the JAWT + // should return an error or NULL object from some of its + // operations; this appears to be the case on Win32 but is not true + // at least with Sun's current X11 implementation (1.4.x), which + // crashes with no other error reported if the DrawingSurfaceInfo is + // fetched from a locked DrawingSurface during the validation as a + // result of calling show() on the main thread. To work around this + // we prevent any JAWT or OpenGL operations from being done until + // addNotify() is called on the component. + protected boolean realized; + + public X11OnscreenGLDrawable(Component component) { + super(component, null, null); + } + + public GLContext createContext(GLContext shareWith) { + return new X11OnscreenGLContext(this, shareWith); + } + + public void setRealized(boolean realized) { + this.realized = realized; + } + + public void setSize(int width, int height) { + component.setSize(width, height); + } + + public int getWidth() { + return component.getWidth(); + } + + public int getHeight() { + return component.getHeight(); + } + + public void swapBuffers() throws GLException { + lockAWT(); + try { + boolean didLock = false; + + if (drawable == 0) { + if (lockSurface() == LOCK_SURFACE_NOT_READY) { + return; + } + + didLock = true; + } + + GLX.glXSwapBuffers(display, drawable); + + if (didLock) { + unlockSurface(); + } + } finally { + unlockAWT(); + } + } + + public int lockSurface() throws GLException { + if (!realized) { + return LOCK_SURFACE_NOT_READY; + } + if (drawable != 0) { + throw new GLException("Surface already locked"); + } + ds = getJAWT().GetDrawingSurface(component); + if (ds == null) { + // Widget not yet realized + return LOCK_SURFACE_NOT_READY; + } + int res = ds.Lock(); + if ((res & JAWTFactory.JAWT_LOCK_ERROR) != 0) { + throw new GLException("Unable to lock surface"); + } + // See whether the surface changed and if so destroy the old + // OpenGL context so it will be recreated (NOTE: removeNotify + // should handle this case, but it may be possible that race + // conditions can cause this code to be triggered -- should test + // more) + int ret = LOCK_SUCCESS; + if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { + ret = LOCK_SURFACE_CHANGED; + } + dsi = ds.GetDrawingSurfaceInfo(); + if (dsi == null) { + // Widget not yet realized + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + return LOCK_SURFACE_NOT_READY; + } + x11dsi = (JAWT_X11DrawingSurfaceInfo) dsi.platformInfo(); + display = x11dsi.display(); + drawable = x11dsi.drawable(); + visualID = x11dsi.visualID(); + if (display == 0 || drawable == 0) { + // Widget not yet realized + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + x11dsi = null; + display = 0; + drawable = 0; + visualID = 0; + return LOCK_SURFACE_NOT_READY; + } + return ret; + } + + public void unlockSurface() { + if (drawable == 0) { + throw new GLException("Surface already unlocked"); + } + ds.FreeDrawingSurfaceInfo(dsi); + ds.Unlock(); + getJAWT().FreeDrawingSurface(ds); + ds = null; + dsi = null; + x11dsi = null; + display = 0; + drawable = 0; + visualID = 0; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private JAWT getJAWT() { + return X11GLDrawableFactory.getJAWT(); + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11PbufferGLContext.java b/src/classes/com/sun/opengl/impl/x11/X11PbufferGLContext.java new file mode 100644 index 000000000..0cb945de7 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11PbufferGLContext.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11PbufferGLContext extends X11GLContext { + private X11PbufferGLDrawable drawable; + + public X11PbufferGLContext(X11PbufferGLDrawable drawable, + GLContext shareWith) { + super(drawable, shareWith); + this.drawable = drawable; + } + + public void bindPbufferToTexture() { + // FIXME: figure out how to implement this + throw new GLException("Not yet implemented"); + } + + public void releasePbufferFromTexture() { + // FIXME: figure out how to implement this + throw new GLException("Not yet implemented"); + } + + protected int makeCurrentImpl() throws GLException { + if (drawable.getDrawable() == 0) { + // pbuffer not instantiated (yet?) + if (DEBUG) { + System.err.println("pbuffer not instantiated"); + } + return CONTEXT_NOT_CURRENT; + } + + // Note that we have to completely override makeCurrentImpl + // because the underlying makeCurrent call differs for pbuffers + lockAWT(); + try { + boolean created = false; + if (context == 0) { + create(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName()); + } + created = true; + } + + if (!GLX.glXMakeContextCurrent(drawable.getDisplay(), + drawable.getDrawable(), + drawable.getDrawable(), + context)) { + throw new GLException("Error making context current"); + } else { + mostRecentDisplay = drawable.getDisplay(); + if (DEBUG && VERBOSE) { + System.err.println(getThreadName() + ": glXMakeCurrent(display " + toHexString(drawable.getDisplay()) + + ", drawable " + toHexString(drawable.getDrawable()) + + ", context " + toHexString(context) + ") succeeded"); + } + } + + if (created) { + resetGLFunctionAvailability(); + return CONTEXT_CURRENT_NEW; + } + return CONTEXT_CURRENT; + } finally { + unlockAWT(); + } + } + + protected void releaseImpl() throws GLException { + lockAWT(); + try { + if (!GLX.glXMakeContextCurrent(drawable.getDisplay(), 0, 0, 0)) { + throw new GLException("Error freeing OpenGL context"); + } + } finally { + unlockAWT(); + } + } + + public int getFloatingPointMode() { + return drawable.getFloatingPointMode(); + } + + protected void create() { + if (DEBUG) { + System.err.println("Creating context for pbuffer " + drawable.getWidth() + + " x " + drawable.getHeight()); + } + + // Create a gl context for the p-buffer. + X11GLContext other = (X11GLContext) GLContextShareSet.getShareContext(this); + long share = 0; + if (other != null) { + share = other.getContext(); + if (share == 0) { + throw new GLException("GLContextShareSet returned an invalid OpenGL context"); + } + } + context = GLX.glXCreateNewContext(drawable.getDisplay(), drawable.getFBConfig(), GLXExt.GLX_RGBA_TYPE, share, true); + if (context == 0) { + throw new GLException("pbuffer creation error: glXCreateNewContext() failed"); + } + GLContextShareSet.contextCreated(this); + + if (DEBUG) { + System.err.println("Created context for pbuffer " + drawable.getWidth() + + " x " + drawable.getHeight()); + } + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11PbufferGLDrawable.java b/src/classes/com/sun/opengl/impl/x11/X11PbufferGLDrawable.java new file mode 100644 index 000000000..2a1248405 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11PbufferGLDrawable.java @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import javax.media.opengl.*; +import com.sun.opengl.impl.*; + +public class X11PbufferGLDrawable extends X11GLDrawable { + private int initWidth; + private int initHeight; + + // drawable in superclass is a GLXPbuffer + private GLXFBConfig fbConfig; + private int width; + private int height; + + protected static final int MAX_PFORMATS = 256; + protected static final int MAX_ATTRIBS = 256; + + public X11PbufferGLDrawable(GLCapabilities capabilities, int initialWidth, int initialHeight) { + super(null, capabilities, null); + this.initWidth = initialWidth; + this.initHeight = initialHeight; + if (initWidth <= 0 || initHeight <= 0) { + throw new GLException("Initial width and height of pbuffer must be positive (were (" + + initWidth + ", " + initHeight + "))"); + } + + if (DEBUG) { + System.out.println("Pbuffer caps on init: " + capabilities + + (capabilities.getOffscreenRenderToTexture() ? " [rtt]" : "") + + (capabilities.getOffscreenRenderToTextureRectangle() ? " [rect]" : "") + + (capabilities.getOffscreenFloatingPointBuffers() ? " [float]" : "")); + } + + createPbuffer(X11GLDrawableFactory.getDisplayConnection()); + } + + public GLContext createContext(GLContext shareWith) { + return new X11PbufferGLContext(this, shareWith); + } + + public void destroy() { + lockAWT(); + if (drawable != 0) { + GLX.glXDestroyPbuffer(display, drawable); + } + unlockAWT(); + display = 0; + } + + public void setSize(int width, int height) { + // FIXME + throw new GLException("Not yet implemented"); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public void createPbuffer(long display) { + lockAWT(); + try { + if (display == 0) { + throw new GLException("Null display"); + } + + if (capabilities.getOffscreenRenderToTexture()) { + throw new GLException("Render-to-texture pbuffers not supported yet on X11"); + } + + if (capabilities.getOffscreenRenderToTextureRectangle()) { + throw new GLException("Render-to-texture-rectangle pbuffers not supported yet on X11"); + } + + int[] iattributes = new int [2*MAX_ATTRIBS]; + float[] fattributes = new float[2*MAX_ATTRIBS]; + int nfattribs = 0; + int niattribs = 0; + + // Since we are trying to create a pbuffer, the GLXFBConfig we + // request (and subsequently use) must be "p-buffer capable". + iattributes[niattribs++] = GLXExt.GLX_DRAWABLE_TYPE; + iattributes[niattribs++] = GLXExt.GLX_PBUFFER_BIT; + + iattributes[niattribs++] = GLXExt.GLX_RENDER_TYPE; + iattributes[niattribs++] = GLXExt.GLX_RGBA_BIT; + + iattributes[niattribs++] = GLX.GLX_DOUBLEBUFFER; + if (capabilities.getDoubleBuffered()) { + iattributes[niattribs++] = GL.GL_TRUE; + } else { + iattributes[niattribs++] = GL.GL_FALSE; + } + + iattributes[niattribs++] = GLX.GLX_DEPTH_SIZE; + iattributes[niattribs++] = capabilities.getDepthBits(); + + iattributes[niattribs++] = GLX.GLX_RED_SIZE; + iattributes[niattribs++] = capabilities.getRedBits(); + + iattributes[niattribs++] = GLX.GLX_GREEN_SIZE; + iattributes[niattribs++] = capabilities.getGreenBits(); + + iattributes[niattribs++] = GLX.GLX_BLUE_SIZE; + iattributes[niattribs++] = capabilities.getBlueBits(); + + iattributes[niattribs++] = GLX.GLX_ALPHA_SIZE; + iattributes[niattribs++] = capabilities.getAlphaBits(); + + if (capabilities.getStencilBits() > 0) { + iattributes[niattribs++] = GLX.GLX_STENCIL_SIZE; + iattributes[niattribs++] = capabilities.getStencilBits(); + } + + if (capabilities.getAccumRedBits() > 0 || + capabilities.getAccumGreenBits() > 0 || + capabilities.getAccumBlueBits() > 0) { + iattributes[niattribs++] = GLX.GLX_ACCUM_RED_SIZE; + iattributes[niattribs++] = capabilities.getAccumRedBits(); + iattributes[niattribs++] = GLX.GLX_ACCUM_GREEN_SIZE; + iattributes[niattribs++] = capabilities.getAccumGreenBits(); + iattributes[niattribs++] = GLX.GLX_ACCUM_BLUE_SIZE; + iattributes[niattribs++] = capabilities.getAccumBlueBits(); + } + + int screen = 0; // FIXME: provide way to specify this? + + if (capabilities.getOffscreenFloatingPointBuffers()) { + String glXExtensions = GLX.glXQueryExtensionsString(display, screen); + if (glXExtensions == null || + glXExtensions.indexOf("GLX_NV_float_buffer") < 0) { + throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware"); + } + iattributes[niattribs++] = GLX.GLX_FLOAT_COMPONENTS_NV; + iattributes[niattribs++] = GL.GL_TRUE; + } + + // FIXME: add FSAA support? Don't want to get into a situation + // where we have to retry the glXChooseFBConfig call if it fails + // due to a lack of an antialiased visual... + + iattributes[niattribs++] = 0; // null-terminate + + int[] nelementsTmp = new int[1]; + GLXFBConfig[] fbConfigs = GLX.glXChooseFBConfig(display, screen, iattributes, 0, nelementsTmp, 0); + if (fbConfigs == null || fbConfigs.length == 0 || fbConfigs[0] == null) { + throw new GLException("pbuffer creation error: glXChooseFBConfig() failed"); + } + int nelements = nelementsTmp[0]; + if (nelements <= 0) { + throw new GLException("pbuffer creation error: couldn't find a suitable frame buffer configuration"); + } + // Note that we currently don't allow selection of anything but + // the first GLXFBConfig in the returned list + GLXFBConfig fbConfig = fbConfigs[0]; + + if (DEBUG) { + System.err.println("Found " + fbConfigs.length + " matching GLXFBConfigs"); + System.err.println("Parameters of default one:"); + System.err.println("render type: 0x" + Integer.toHexString(queryFBConfig(display, fbConfig, GLX.GLX_RENDER_TYPE))); + System.err.println("rgba: " + ((queryFBConfig(display, fbConfig, GLX.GLX_RENDER_TYPE) & GLX.GLX_RGBA_BIT) != 0)); + System.err.println("r: " + queryFBConfig(display, fbConfig, GLX.GLX_RED_SIZE)); + System.err.println("g: " + queryFBConfig(display, fbConfig, GLX.GLX_GREEN_SIZE)); + System.err.println("b: " + queryFBConfig(display, fbConfig, GLX.GLX_BLUE_SIZE)); + System.err.println("a: " + queryFBConfig(display, fbConfig, GLX.GLX_ALPHA_SIZE)); + System.err.println("depth: " + queryFBConfig(display, fbConfig, GLX.GLX_DEPTH_SIZE)); + System.err.println("double buffered: " + queryFBConfig(display, fbConfig, GLX.GLX_DOUBLEBUFFER)); + } + + // Create the p-buffer. + niattribs = 0; + + iattributes[niattribs++] = GLXExt.GLX_PBUFFER_WIDTH; + iattributes[niattribs++] = initWidth; + iattributes[niattribs++] = GLXExt.GLX_PBUFFER_HEIGHT; + iattributes[niattribs++] = initHeight; + + iattributes[niattribs++] = 0; + + long tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes, 0); + if (tmpBuffer == 0) { + // FIXME: query X error code for detail error message + throw new GLException("pbuffer creation error: glXCreatePbuffer() failed"); + } + + // Set up instance variables + this.display = display; + drawable = tmpBuffer; + this.fbConfig = fbConfig; + + // Determine the actual width and height we were able to create. + int[] tmp = new int[1]; + GLX.glXQueryDrawable(display, drawable, GLXExt.GLX_WIDTH, tmp, 0); + width = tmp[0]; + GLX.glXQueryDrawable(display, drawable, GLXExt.GLX_HEIGHT, tmp, 0); + height = tmp[0]; + + if (DEBUG) { + System.err.println("Created pbuffer " + width + " x " + height); + } + } finally { + unlockAWT(); + } + } + + public int getFloatingPointMode() { + // Floating-point pbuffers currently require NVidia hardware on X11 + return GLPbuffer.NV_FLOAT; + } + + public GLXFBConfig getFBConfig() { + return fbConfig; + } + + private int queryFBConfig(long display, GLXFBConfig fbConfig, int attrib) { + int[] tmp = new int[1]; + if (GLX.glXGetFBConfigAttrib(display, fbConfig, attrib, tmp, 0) != 0) { + throw new GLException("glXGetFBConfigAttrib failed"); + } + return tmp[0]; + } +} diff --git a/src/classes/com/sun/opengl/impl/x11/X11SunJDKReflection.java b/src/classes/com/sun/opengl/impl/x11/X11SunJDKReflection.java new file mode 100644 index 000000000..0760399ab --- /dev/null +++ b/src/classes/com/sun/opengl/impl/x11/X11SunJDKReflection.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.impl.x11; + +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.lang.reflect.*; +import java.security.*; + +/** This class encapsulates the reflection routines necessary to peek + inside a few data structures in the AWT implementation on X11 for + the purposes of correctly enumerating the available visuals. */ + +public class X11SunJDKReflection { + private static Class x11GraphicsDeviceClass; + private static Method x11GraphicsDeviceGetScreenMethod; + private static Class x11GraphicsConfigClass; + private static Method x11GraphicsConfigGetVisualMethod; + private static boolean initted; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + try { + x11GraphicsDeviceClass = Class.forName("sun.awt.X11GraphicsDevice"); + x11GraphicsDeviceGetScreenMethod = x11GraphicsDeviceClass.getDeclaredMethod("getScreen", new Class[] {}); + x11GraphicsDeviceGetScreenMethod.setAccessible(true); + + x11GraphicsConfigClass = Class.forName("sun.awt.X11GraphicsConfig"); + x11GraphicsConfigGetVisualMethod = x11GraphicsConfigClass.getDeclaredMethod("getVisual", new Class[] {}); + x11GraphicsConfigGetVisualMethod.setAccessible(true); + initted = true; + } catch (Exception e) { + // Either not a Sun JDK or the interfaces have changed since 1.4.2 / 1.5 + } + return null; + } + }); + } + + public static int graphicsDeviceGetScreen(GraphicsDevice device) { + if (!initted) { + return 0; + } + + try { + return ((Integer) x11GraphicsDeviceGetScreenMethod.invoke(device, new Object[] {})).intValue(); + } catch (Exception e) { + return 0; + } + } + + public static int graphicsConfigurationGetVisualID(GraphicsConfiguration config) { + if (!initted) { + return 0; + } + + try { + return ((Integer) x11GraphicsConfigGetVisualMethod.invoke(config, new Object[] {})).intValue(); + } catch (Exception e) { + return 0; + } + } +} diff --git a/src/classes/com/sun/opengl/utils/Animator.java b/src/classes/com/sun/opengl/utils/Animator.java new file mode 100755 index 000000000..5920b93b9 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/Animator.java @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.Rectangle; +import java.util.*; +import javax.swing.*; + +import javax.media.opengl.*; + +/**

An Animator can be attached to one or more {@link + GLAutoDrawable}s to drive their display() methods in a loop.

+ +

The Animator class creates a background thread in which the + calls to display() are performed. After each drawable + has been redrawn, a brief pause is performed to avoid swamping the + CPU, unless {@link #setRunAsFastAsPossible} has been called.

+*/ + +public class Animator { + private volatile ArrayList/**/ drawables = new ArrayList(); + private Runnable runnable; + private Thread thread; + private volatile boolean shouldStop; + protected boolean ignoreExceptions; + protected boolean printExceptions; + private boolean runAsFastAsPossible; + + // For efficient rendering of Swing components, in particular when + // they overlap one another + private List lightweights = new ArrayList(); + private Map repaintManagers = new IdentityHashMap(); + private Map dirtyRegions = new IdentityHashMap(); + + /** Creates a new, empty Animator. */ + public Animator() { + } + + /** Creates a new Animator for a particular drawable. */ + public Animator(GLAutoDrawable drawable) { + add(drawable); + } + + /** Adds a drawable to the list managed by this Animator. */ + public synchronized void add(GLAutoDrawable drawable) { + ArrayList newList = (ArrayList) drawables.clone(); + newList.add(drawable); + drawables = newList; + notifyAll(); + } + + /** Removes a drawable from the list managed by this Animator. */ + public synchronized void remove(GLAutoDrawable drawable) { + ArrayList newList = (ArrayList) drawables.clone(); + newList.remove(drawable); + drawables = newList; + } + + /** Returns an iterator over the drawables managed by this + Animator. */ + public Iterator/**/ drawableIterator() { + return drawables.iterator(); + } + + /** Sets a flag causing this Animator to ignore exceptions produced + while redrawing the drawables. By default this flag is set to + false, causing any exception thrown to halt the Animator. */ + public void setIgnoreExceptions(boolean ignoreExceptions) { + this.ignoreExceptions = ignoreExceptions; + } + + /** Sets a flag indicating that when exceptions are being ignored by + this Animator (see {@link #setIgnoreExceptions}), to print the + exceptions' stack traces for diagnostic information. Defaults to + false. */ + public void setPrintExceptions(boolean printExceptions) { + this.printExceptions = printExceptions; + } + + /** Sets a flag in this Animator indicating that it is to run as + fast as possible. By default there is a brief pause in the + animation loop which prevents the CPU from getting swamped. + This method may not have an effect on subclasses. */ + public final void setRunAsFastAsPossible(boolean runFast) { + runAsFastAsPossible = runFast; + } + + /** Called every frame to cause redrawing of all of the + GLAutoDrawables this Animator manages. Subclasses should call + this to get the most optimized painting behavior for the set of + components this Animator manages, in particular when multiple + lightweight widgets are continually being redrawn. */ + protected void display() { + Iterator iter = drawableIterator(); + while (iter.hasNext()) { + GLAutoDrawable drawable = (GLAutoDrawable) iter.next(); + if (drawable instanceof JComponent) { + // Lightweight components need a more efficient drawing + // scheme than simply forcing repainting of each one in + // turn since drawing one can force another one to be + // drawn in turn + lightweights.add(drawable); + } else { + try { + drawable.display(); + } catch (RuntimeException e) { + if (ignoreExceptions) { + if (printExceptions) { + e.printStackTrace(); + } + } else { + throw(e); + } + } + } + } + if (lightweights.size() > 0) { + try { + SwingUtilities.invokeAndWait(drawWithRepaintManagerRunnable); + } catch (Exception e) { + e.printStackTrace(); + } + lightweights.clear(); + } + } + + class MainLoop implements Runnable { + public void run() { + try { + while (!shouldStop) { + // Don't consume CPU unless there is work to be done + if (drawables.size() == 0) { + synchronized (Animator.this) { + while (drawables.size() == 0 && !shouldStop) { + try { + Animator.this.wait(); + } catch (InterruptedException e) { + } + } + } + } + display(); + if (!runAsFastAsPossible) { + // Avoid swamping the CPU + Thread.yield(); + } + } + } finally { + shouldStop = false; + synchronized (Animator.this) { + thread = null; + Animator.this.notify(); + } + } + } + } + + /** Starts this animator. */ + public synchronized void start() { + if (thread != null) { + throw new GLException("Already started"); + } + if (runnable == null) { + runnable = new MainLoop(); + } + thread = new Thread(runnable); + thread.start(); + } + + /** Indicates whether this animator is currently running. This + should only be used as a heuristic to applications because in + some circumstances the Animator may be in the process of + shutting down and this method will still return true. */ + public synchronized boolean isAnimating() { + return (thread != null); + } + + /** Stops this animator. In most situations this method blocks until + completion, except when called from the animation thread itself + or in some cases from an implementation-internal thread like the + AWT event queue thread. */ + public synchronized void stop() { + shouldStop = true; + notifyAll(); + // It's hard to tell whether the thread which calls stop() has + // dependencies on the Animator's internal thread. Currently we + // use a couple of heuristics to determine whether we should do + // the blocking wait(). + if ((Thread.currentThread() == thread) || EventQueue.isDispatchThread()) { + return; + } + while (shouldStop && thread != null) { + try { + wait(); + } catch (InterruptedException ie) { + } + } + } + + // Uses RepaintManager APIs to implement more efficient redrawing of + // the Swing widgets we're animating + private Runnable drawWithRepaintManagerRunnable = new Runnable() { + public void run() { + for (Iterator iter = lightweights.iterator(); iter.hasNext(); ) { + JComponent comp = (JComponent) iter.next(); + RepaintManager rm = RepaintManager.currentManager(comp); + rm.markCompletelyDirty(comp); + repaintManagers.put(rm, rm); + + // RepaintManagers don't currently optimize the case of + // overlapping sibling components. If we have two + // JInternalFrames in a JDesktopPane, the redraw of the + // bottom one will cause the top one to be redrawn as + // well. The top one will then be redrawn separately. In + // order to optimize this case we need to compute the union + // of all of the dirty regions on a particular JComponent if + // optimized drawing isn't enabled for it. + + // Walk up the hierarchy trying to find a non-optimizable + // ancestor + Rectangle visible = comp.getVisibleRect(); + int x = visible.x; + int y = visible.y; + while (comp != null) { + x += comp.getX(); + y += comp.getY(); + Component c = comp.getParent(); + if ((c == null) || (!(c instanceof JComponent))) { + comp = null; + } else { + comp = (JComponent) c; + if (!comp.isOptimizedDrawingEnabled()) { + rm = RepaintManager.currentManager(comp); + repaintManagers.put(rm, rm); + // Need to dirty this region + Rectangle dirty = (Rectangle) dirtyRegions.get(comp); + if (dirty == null) { + dirty = new Rectangle(x, y, visible.width, visible.height); + dirtyRegions.put(comp, dirty); + } else { + // Compute union with already dirty region + // Note we could compute multiple non-overlapping + // regions: might want to do that in the future + // (prob. need more complex algorithm -- dynamic + // programming?) + dirty.add(new Rectangle(x, y, visible.width, visible.height)); + } + } + } + } + } + + // Dirty any needed regions on non-optimizable components + for (Iterator iter = dirtyRegions.keySet().iterator(); iter.hasNext(); ) { + JComponent comp = (JComponent) iter.next(); + Rectangle rect = (Rectangle) dirtyRegions.get(comp); + RepaintManager rm = RepaintManager.currentManager(comp); + rm.addDirtyRegion(comp, rect.x, rect.y, rect.width, rect.height); + } + + // Draw all dirty regions + for (Iterator iter = repaintManagers.keySet().iterator(); iter.hasNext(); ) { + ((RepaintManager) iter.next()).paintDirtyRegions(); + } + dirtyRegions.clear(); + repaintManagers.clear(); + } + }; +} diff --git a/src/classes/com/sun/opengl/utils/BitmapCharRec.java b/src/classes/com/sun/opengl/utils/BitmapCharRec.java new file mode 100644 index 000000000..a24ab1122 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/BitmapCharRec.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +class BitmapCharRec { + int width; + int height; + float xorig; + float yorig; + float advance; + byte[] bitmap; + + BitmapCharRec(int width, + int height, + float xorig, + float yorig, + float advance, + byte[] bitmap) { + this.width = width; + this.height = height; + this.xorig = xorig; + this.yorig = yorig; + this.advance = advance; + this.bitmap = bitmap; + } +} diff --git a/src/classes/com/sun/opengl/utils/BitmapFontRec.java b/src/classes/com/sun/opengl/utils/BitmapFontRec.java new file mode 100644 index 000000000..c300ad159 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/BitmapFontRec.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +class BitmapFontRec { + String name; + int num_chars; + int first; + BitmapCharRec[] ch; + + BitmapFontRec(String name, + int num_chars, + int first, + BitmapCharRec[] ch) { + this.name = name; + this.num_chars = num_chars; + this.first = first; + this.ch = ch; + } +} diff --git a/src/classes/com/sun/opengl/utils/BufferUtils.java b/src/classes/com/sun/opengl/utils/BufferUtils.java new file mode 100644 index 000000000..995fa0646 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/BufferUtils.java @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +import java.nio.*; +import java.util.*; + +/** Utility routines for dealing with direct buffers. */ + +public class BufferUtils { + public static final int SIZEOF_BYTE = 1; + public static final int SIZEOF_SHORT = 2; + public static final int SIZEOF_INT = 4; + public static final int SIZEOF_FLOAT = 4; + public static final int SIZEOF_LONG = 8; + public static final int SIZEOF_DOUBLE = 8; + + //---------------------------------------------------------------------- + // Allocation routines + // + + /** Allocates a new direct ByteBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static ByteBuffer newByteBuffer(int numElements) { + ByteBuffer bb = ByteBuffer.allocateDirect(numElements); + bb.order(ByteOrder.nativeOrder()); + return bb; + } + + /** Allocates a new direct DoubleBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static DoubleBuffer newDoubleBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE); + return bb.asDoubleBuffer(); + } + + /** Allocates a new direct FloatBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static FloatBuffer newFloatBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT); + return bb.asFloatBuffer(); + } + + /** Allocates a new direct IntBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static IntBuffer newIntBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT); + return bb.asIntBuffer(); + } + + /** Allocates a new direct LongBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static LongBuffer newLongBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG); + return bb.asLongBuffer(); + } + + /** Allocates a new direct ShortBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static ShortBuffer newShortBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT); + return bb.asShortBuffer(); + } + + //---------------------------------------------------------------------- + // Copy routines (type-to-type) + // + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed ByteBuffer into + a newly-allocated direct ByteBuffer. The returned buffer will + have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyByteBuffer(ByteBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining()); + orig.mark(); + dest.put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed DoubleBuffer + into a newly-allocated direct DoubleBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static DoubleBuffer copyDoubleBuffer(DoubleBuffer orig) { + return copyDoubleBufferAsByteBuffer(orig).asDoubleBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed FloatBuffer + into a newly-allocated direct FloatBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static FloatBuffer copyFloatBuffer(FloatBuffer orig) { + return copyFloatBufferAsByteBuffer(orig).asFloatBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed IntBuffer + into a newly-allocated direct IntBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static IntBuffer copyIntBuffer(IntBuffer orig) { + return copyIntBufferAsByteBuffer(orig).asIntBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed LongBuffer + into a newly-allocated direct LongBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static LongBuffer copyLongBuffer(LongBuffer orig) { + return copyLongBufferAsByteBuffer(orig).asLongBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed ShortBuffer + into a newly-allocated direct ShortBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ShortBuffer copyShortBuffer(ShortBuffer orig) { + return copyShortBufferAsByteBuffer(orig).asShortBuffer(); + } + + //---------------------------------------------------------------------- + // Copy routines (type-to-ByteBuffer) + // + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed DoubleBuffer + into a newly-allocated direct ByteBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyDoubleBufferAsByteBuffer(DoubleBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_DOUBLE); + orig.mark(); + dest.asDoubleBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed FloatBuffer + into a newly-allocated direct ByteBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT); + orig.mark(); + dest.asFloatBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed IntBuffer into + a newly-allocated direct ByteBuffer. The returned buffer will + have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT); + orig.mark(); + dest.asIntBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed LongBuffer into + a newly-allocated direct ByteBuffer. The returned buffer will + have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyLongBufferAsByteBuffer(LongBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_LONG); + orig.mark(); + dest.asLongBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed ShortBuffer + into a newly-allocated direct ByteBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT); + orig.mark(); + dest.asShortBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } +} diff --git a/src/classes/com/sun/opengl/utils/CoordRec.java b/src/classes/com/sun/opengl/utils/CoordRec.java new file mode 100644 index 000000000..44f786377 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/CoordRec.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +class CoordRec { + float x; + float y; + + CoordRec(float x, float y) { + this.x = x; + this.y = y; + } +} diff --git a/src/classes/com/sun/opengl/utils/FPSAnimator.java b/src/classes/com/sun/opengl/utils/FPSAnimator.java new file mode 100755 index 000000000..c45ff15c4 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/FPSAnimator.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +import java.util.*; +import javax.media.opengl.*; + +/** An Animator subclass which attempts to achieve a target + frames-per-second rate to avoid using all CPU time. The target FPS + is only an estimate and is not guaranteed. */ + +public class FPSAnimator extends Animator { + private Timer timer; + private int fps; + + /** Creates an FPSAnimator with a given target frames-per-second value. */ + public FPSAnimator(int fps) { + this(null, fps); + } + + /** Creates an FPSAnimator with a given target frames-per-second + value and an initial drawable to animate. */ + public FPSAnimator(GLAutoDrawable drawable, int fps) { + this.fps = fps; + if (drawable != null) { + add(drawable); + } + } + + /** Starts this FPSAnimator. */ + public synchronized void start() { + if (timer != null) { + throw new GLException("Already started"); + } + timer = new Timer(); + long delay = (long) (1000.0f / (float) fps); + timer.schedule(new TimerTask() { + public void run() { + display(); + } + }, 0, delay); + } + + /** Indicates whether this FPSAnimator is currently running. This + should only be used as a heuristic to applications because in + some circumstances the FPSAnimator may be in the process of + shutting down and this method will still return true. */ + public synchronized boolean isAnimating() { + return (timer != null); + } + + /** Stops this FPSAnimator. Due to the implementation of the + FPSAnimator it is not guaranteed that the FPSAnimator will be + completely stopped by the time this method returns. */ + public synchronized void stop() { + if (timer == null) { + throw new GLException("Already stopped"); + } + timer.cancel(); + timer = null; + } +} diff --git a/src/classes/com/sun/opengl/utils/GLUT.java b/src/classes/com/sun/opengl/utils/GLUT.java new file mode 100644 index 000000000..2896729e2 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUT.java @@ -0,0 +1,1197 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +import javax.media.opengl.*; +import javax.media.opengl.glu.*; + +/** Subset of the routines provided by the GLUT interface. Note the + signatures of many of the methods are necessarily different than + the corresponding C version. A GLUT object must only be used from + one particular thread at a time.

+ + Copyright (c) Mark J. Kilgard, 1994, 1997.

+ + (c) Copyright 1993, Silicon Graphics, Inc.

+ + ALL RIGHTS RESERVED

+ + Permission to use, copy, modify, and distribute this software + for any purpose and without fee is hereby granted, provided + that the above copyright notice appear in all copies and that + both the copyright notice and this permission notice appear in + supporting documentation, and that the name of Silicon + Graphics, Inc. not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission.

+ + THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU + "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR + OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO + EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE + ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR + CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, + INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, + SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR + NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY + OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR + PERFORMANCE OF THIS SOFTWARE.

+ + US Government Users Restricted Rights

+ + Use, duplication, or disclosure by the Government is subject to + restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + (c)(1)(ii) of the Rights in Technical Data and Computer + Software clause at DFARS 252.227-7013 and/or in similar or + successor clauses in the FAR or the DOD or NASA FAR + Supplement. Unpublished-- rights reserved under the copyright + laws of the United States. Contractor/manufacturer is Silicon + Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA + 94039-7311.

+ + OpenGL(TM) is a trademark of Silicon Graphics, Inc.

+*/ + +public class GLUT { + public static final int STROKE_ROMAN = 0; + public static final int STROKE_MONO_ROMAN = 1; + public static final int BITMAP_9_BY_15 = 2; + public static final int BITMAP_8_BY_13 = 3; + public static final int BITMAP_TIMES_ROMAN_10 = 4; + public static final int BITMAP_TIMES_ROMAN_24 = 5; + public static final int BITMAP_HELVETICA_10 = 6; + public static final int BITMAP_HELVETICA_12 = 7; + public static final int BITMAP_HELVETICA_18 = 8; + + private GLU glu = new GLU(); + + //---------------------------------------------------------------------- + // Shapes + // + + public void glutWireSphere(double radius, int slices, int stacks) { + quadObjInit(glu); + glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); + glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); + /* If we ever changed/used the texture or orientation state + of quadObj, we'd need to change it to the defaults here + with gluQuadricTexture and/or gluQuadricOrientation. */ + glu.gluSphere(quadObj, radius, slices, stacks); + } + + public void glutSolidSphere(double radius, int slices, int stacks) { + quadObjInit(glu); + glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); + glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); + /* If we ever changed/used the texture or orientation state + of quadObj, we'd need to change it to the defaults here + with gluQuadricTexture and/or gluQuadricOrientation. */ + glu.gluSphere(quadObj, radius, slices, stacks); + } + + public void glutWireCone(double base, double height, + int slices, int stacks) { + quadObjInit(glu); + glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); + glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); + /* If we ever changed/used the texture or orientation state + of quadObj, we'd need to change it to the defaults here + with gluQuadricTexture and/or gluQuadricOrientation. */ + glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); + } + + public void glutSolidCone(double base, double height, + int slices, int stacks) { + quadObjInit(glu); + glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); + glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); + /* If we ever changed/used the texture or orientation state + of quadObj, we'd need to change it to the defaults here + with gluQuadricTexture and/or gluQuadricOrientation. */ + glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); + } + + public void glutWireCube(float size) { + drawBox(GLU.getCurrentGL(), size, GL.GL_LINE_LOOP); + } + + public void glutSolidCube(float size) { + drawBox(GLU.getCurrentGL(), size, GL.GL_QUADS); + } + + public void glutWireTorus(double innerRadius, double outerRadius, + int nsides, int rings) { + GL gl = GLU.getCurrentGL(); + gl.glPushAttrib(GL.GL_POLYGON_BIT); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE); + doughnut(gl, innerRadius, outerRadius, nsides, rings); + gl.glPopAttrib(); + } + + public void glutSolidTorus(double innerRadius, double outerRadius, + int nsides, int rings) { + doughnut(GLU.getCurrentGL(), innerRadius, outerRadius, nsides, rings); + } + + public void glutWireDodecahedron() { + dodecahedron(GLU.getCurrentGL(), GL.GL_LINE_LOOP); + } + + public void glutSolidDodecahedron() { + dodecahedron(GLU.getCurrentGL(), GL.GL_TRIANGLE_FAN); + } + + public void glutWireOctahedron() { + octahedron(GLU.getCurrentGL(), GL.GL_LINE_LOOP); + } + + public void glutSolidOctahedron() { + octahedron(GLU.getCurrentGL(), GL.GL_TRIANGLES); + } + + public void glutWireIcosahedron() { + icosahedron(GLU.getCurrentGL(), GL.GL_LINE_LOOP); + } + + public void glutSolidIcosahedron() { + icosahedron(GLU.getCurrentGL(), GL.GL_TRIANGLES); + } + + public void glutWireTetrahedron() { + tetrahedron(GLU.getCurrentGL(), GL.GL_LINE_LOOP); + } + + public void glutSolidTetrahedron() { + tetrahedron(GLU.getCurrentGL(), GL.GL_TRIANGLES); + } + +/** + * Renders the teapot as a solid shape of the specified size. The teapot is + * created in a way that replicates the C GLUT implementation. + * + * @param scale + * the factor by which to scale the teapot + */ + public void glutSolidTeapot(double scale) { + glutSolidTeapot(scale, true); + } + + /** + * Renders the teapot as a solid shape of the specified size. The teapot can + * either be created in a way that is backward-compatible with the standard + * C glut library (i.e. broken), or in a more pleasing way (i.e. with + * surfaces whose front-faces point outwards and standing on the z=0 plane, + * instead of the y=-1 plane). Both surface normals and texture coordinates + * for the teapot are generated. The teapot is generated with OpenGL + * evaluators. + * + * @param scale + * the factor by which to scale the teapot + * @param cStyle + * whether to create the teapot in exactly the same way as in the C + * implementation of GLUT + */ + public void glutSolidTeapot(double scale, boolean cStyle) { + teapot(GLU.getCurrentGL(), 14, scale, GL.GL_FILL, cStyle); + } + + /** + * Renders the teapot as a wireframe shape of the specified size. The teapot + * is created in a way that replicates the C GLUT implementation. + * + * @param scale + * the factor by which to scale the teapot + */ + public void glutWireTeapot(double scale) { + glutWireTeapot(scale, true); + } + + /** + * Renders the teapot as a wireframe shape of the specified size. The teapot + * can either be created in a way that is backward-compatible with the + * standard C glut library (i.e. broken), or in a more pleasing way (i.e. + * with surfaces whose front-faces point outwards and standing on the z=0 + * plane, instead of the y=-1 plane). Both surface normals and texture + * coordinates for the teapot are generated. The teapot is generated with + * OpenGL evaluators. + * + * @param scale + * the factor by which to scale the teapot + * @param cStyle + * whether to create the teapot in exactly the same way as in the C + * implementation of GLUT + */ + public void glutWireTeapot(double scale, boolean cStyle) { + teapot(GLU.getCurrentGL(), 10, scale, GL.GL_LINE, cStyle); + } + + //---------------------------------------------------------------------- + // Fonts + // + + public void glutBitmapCharacter(int font, char character) { + GL gl = GLU.getCurrentGL(); + int[] swapbytes = new int[1]; + int[] lsbfirst = new int[1]; + int[] rowlength = new int[1]; + int[] skiprows = new int[1]; + int[] skippixels = new int[1]; + int[] alignment = new int[1]; + beginBitmap(gl, + swapbytes, + lsbfirst, + rowlength, + skiprows, + skippixels, + alignment); + bitmapCharacterImpl(gl, font, character); + endBitmap(gl, + swapbytes, + lsbfirst, + rowlength, + skiprows, + skippixels, + alignment); + } + + public void glutBitmapString (int font, String string) { + GL gl = GLU.getCurrentGL(); + int[] swapbytes = new int[1]; + int[] lsbfirst = new int[1]; + int[] rowlength = new int[1]; + int[] skiprows = new int[1]; + int[] skippixels = new int[1]; + int[] alignment = new int[1]; + beginBitmap(gl, + swapbytes, + lsbfirst, + rowlength, + skiprows, + skippixels, + alignment); + int len = string.length(); + for (int i = 0; i < len; i++) { + bitmapCharacterImpl(gl, font, string.charAt(i)); + } + endBitmap(gl, + swapbytes, + lsbfirst, + rowlength, + skiprows, + skippixels, + alignment); + } + + public int glutBitmapWidth (int font, char character) { + BitmapFontRec fontinfo = getBitmapFont(font); + int c = character & 0xFFFF; + if (c < fontinfo.first || c >= fontinfo.first + fontinfo.num_chars) + return 0; + BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + if (ch != null) + return (int) ch.advance; + else + return 0; + } + + public void glutStrokeCharacter(int font, char character) { + GL gl = GLU.getCurrentGL(); + StrokeFontRec fontinfo = getStrokeFont(font); + int c = character & 0xFFFF; + if (c < 0 || c >= fontinfo.num_chars) + return; + StrokeCharRec ch = fontinfo.ch[c]; + if (ch != null) { + for (int i = 0; i < ch.num_strokes; i++) { + StrokeRec stroke = ch.stroke[i]; + gl.glBegin(GL.GL_LINE_STRIP); + for (int j = 0; j < stroke.num_coords; j++) { + CoordRec coord = stroke.coord[j]; + gl.glVertex2f(coord.x, coord.y); + } + gl.glEnd(); + } + gl.glTranslatef(ch.right, 0.0f, 0.0f); + } + } + + public void glutStrokeString(int font, String string) { + GL gl = GLU.getCurrentGL(); + StrokeFontRec fontinfo = getStrokeFont(font); + int len = string.length(); + for (int pos = 0; pos < len; pos++) { + int c = string.charAt(pos) & 0xFFFF; + if (c < 0 || c >= fontinfo.num_chars) + continue; + StrokeCharRec ch = fontinfo.ch[c]; + if (ch != null) { + for (int i = 0; i < ch.num_strokes; i++) { + StrokeRec stroke = ch.stroke[i]; + gl.glBegin(GL.GL_LINE_STRIP); + for (int j = 0; j < stroke.num_coords; j++) { + CoordRec coord = stroke.coord[j]; + gl.glVertex2f(coord.x, coord.y); + } + gl.glEnd(); + } + gl.glTranslatef(ch.right, 0.0f, 0.0f); + } + } + } + + public int glutStrokeWidth (int font, char character) { + return (int) glutStrokeWidthf(font, character); + } + + public float glutStrokeWidthf (int font, char character) { + StrokeFontRec fontinfo = getStrokeFont(font); + int c = character & 0xFFFF; + if (c < 0 || c >= fontinfo.num_chars) + return 0; + StrokeCharRec ch = fontinfo.ch[c]; + if (ch != null) + return ch.right; + else + return 0; + } + + public int glutBitmapLength (int font, String string) { + BitmapFontRec fontinfo = getBitmapFont(font); + int length = 0; + int len = string.length(); + for (int pos = 0; pos < len; pos++) { + int c = string.charAt(pos) & 0xFFFF; + if (c >= fontinfo.first && c < fontinfo.first + fontinfo.num_chars) { + BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + if (ch != null) + length += ch.advance; + } + } + return length; + } + + public int glutStrokeLength (int font, String string) { + return (int) glutStrokeLengthf(font, string); + } + + public float glutStrokeLengthf (int font, String string) { + StrokeFontRec fontinfo = getStrokeFont(font); + float length = 0; + int len = string.length(); + for (int i = 0; i < len; i++) { + char c = string.charAt(i); + if (c >= 0 && c < fontinfo.num_chars) { + StrokeCharRec ch = fontinfo.ch[c]; + if (ch != null) + length += ch.right; + } + } + return length; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + //---------------------------------------------------------------------- + // Shape implementation + // + + private GLUquadric quadObj; + private void quadObjInit(GLU glu) { + if (quadObj == null) { + quadObj = glu.gluNewQuadric(); + } + if (quadObj == null) { + throw new GLException("Out of memory"); + } + } + + private static void doughnut(GL gl, double r, double R, int nsides, int rings) { + int i, j; + float theta, phi, theta1; + float cosTheta, sinTheta; + float cosTheta1, sinTheta1; + float ringDelta, sideDelta; + + ringDelta = (float) (2.0 * Math.PI / rings); + sideDelta = (float) (2.0 * Math.PI / nsides); + + theta = 0.0f; + cosTheta = 1.0f; + sinTheta = 0.0f; + for (i = rings - 1; i >= 0; i--) { + theta1 = theta + ringDelta; + cosTheta1 = (float) Math.cos(theta1); + sinTheta1 = (float) Math.sin(theta1); + gl.glBegin(GL.GL_QUAD_STRIP); + phi = 0.0f; + for (j = nsides; j >= 0; j--) { + float cosPhi, sinPhi, dist; + + phi += sideDelta; + cosPhi = (float) Math.cos(phi); + sinPhi = (float) Math.sin(phi); + dist = (float) (R + r * cosPhi); + + gl.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); + gl.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, (float) r * sinPhi); + gl.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); + gl.glVertex3f(cosTheta * dist, -sinTheta * dist, (float) r * sinPhi); + } + gl.glEnd(); + theta = theta1; + cosTheta = cosTheta1; + sinTheta = sinTheta1; + } + } + + private static float[][] boxVertices; + private static final float[][] boxNormals = { + {-1.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f}, + {1.0f, 0.0f, 0.0f}, + {0.0f, -1.0f, 0.0f}, + {0.0f, 0.0f, 1.0f}, + {0.0f, 0.0f, -1.0f} + }; + private static final int[][] boxFaces = { + {0, 1, 2, 3}, + {3, 2, 6, 7}, + {7, 6, 5, 4}, + {4, 5, 1, 0}, + {5, 6, 2, 1}, + {7, 4, 0, 3} + }; + private void drawBox(GL gl, float size, int type) { + if (boxVertices == null) { + float[][] v = new float[8][]; + for (int i = 0; i < 8; i++) { + v[i] = new float[3]; + } + v[0][0] = v[1][0] = v[2][0] = v[3][0] = -0.5f; + v[4][0] = v[5][0] = v[6][0] = v[7][0] = 0.5f; + v[0][1] = v[1][1] = v[4][1] = v[5][1] = -0.5f; + v[2][1] = v[3][1] = v[6][1] = v[7][1] = 0.5f; + v[0][2] = v[3][2] = v[4][2] = v[7][2] = -0.5f; + v[1][2] = v[2][2] = v[5][2] = v[6][2] = 0.5f; + boxVertices = v; + } + float[][] v = boxVertices; + float[][] n = boxNormals; + int[][] faces = boxFaces; + for (int i = 5; i >= 0; i--) { + gl.glBegin(type); + gl.glNormal3fv(n[i], 0); + float[] vt = v[faces[i][0]]; + gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); + vt = v[faces[i][1]]; + gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); + vt = v[faces[i][2]]; + gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); + vt = v[faces[i][3]]; + gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); + gl.glEnd(); + } + } + + private float[][] dodec; + + private void initDodecahedron() { + dodec = new float[20][]; + for (int i = 0; i < dodec.length; i++) { + dodec[i] = new float[3]; + } + + float alpha, beta; + + alpha = (float) Math.sqrt(2.0f / (3.0f + Math.sqrt(5.0))); + beta = 1.0f + (float) Math.sqrt(6.0 / (3.0 + Math.sqrt(5.0)) - + 2.0 + 2.0 * Math.sqrt(2.0 / (3.0 + Math.sqrt(5.0)))); + dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; + dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; + dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; + dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; + dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; + dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; + dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; + dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; + dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; + dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; + dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; + dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; + dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; + dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; + dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; + dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; + dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; + dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; + dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; + dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; + } + + private static void diff3(float[] a, float[] b, float[] c) { + c[0] = a[0] - b[0]; + c[1] = a[1] - b[1]; + c[2] = a[2] - b[2]; + } + + private static void crossprod(float[] v1, float[] v2, float[] prod) { + float[] p = new float[3]; /* in case prod == v1 or v2 */ + + p[0] = v1[1] * v2[2] - v2[1] * v1[2]; + p[1] = v1[2] * v2[0] - v2[2] * v1[0]; + p[2] = v1[0] * v2[1] - v2[0] * v1[1]; + prod[0] = p[0]; + prod[1] = p[1]; + prod[2] = p[2]; + } + + private static void normalize(float[] v) { + float d; + + d = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); + if (d == 0.0) { + v[0] = d = 1.0f; + } + d = 1 / d; + v[0] *= d; + v[1] *= d; + v[2] *= d; + } + + private void pentagon(GL gl, int a, int b, int c, int d, int e, int shadeType) { + float[] n0 = new float[3]; + float[] d1 = new float[3]; + float[] d2 = new float[3]; + + diff3(dodec[a], dodec[b], d1); + diff3(dodec[b], dodec[c], d2); + crossprod(d1, d2, n0); + normalize(n0); + + gl.glBegin(shadeType); + gl.glNormal3fv(n0, 0); + gl.glVertex3fv(dodec[a], 0); + gl.glVertex3fv(dodec[b], 0); + gl.glVertex3fv(dodec[c], 0); + gl.glVertex3fv(dodec[d], 0); + gl.glVertex3fv(dodec[e], 0); + gl.glEnd(); + } + + private void dodecahedron(GL gl, int type) { + if (dodec == null) { + initDodecahedron(); + } + pentagon(gl, 0, 1, 9, 16, 5, type); + pentagon(gl, 1, 0, 3, 18, 7, type); + pentagon(gl, 1, 7, 11, 10, 9, type); + pentagon(gl, 11, 7, 18, 19, 6, type); + pentagon(gl, 8, 17, 16, 9, 10, type); + pentagon(gl, 2, 14, 15, 6, 19, type); + pentagon(gl, 2, 13, 12, 4, 14, type); + pentagon(gl, 2, 19, 18, 3, 13, type); + pentagon(gl, 3, 0, 5, 12, 13, type); + pentagon(gl, 6, 15, 8, 10, 11, type); + pentagon(gl, 4, 17, 8, 15, 14, type); + pentagon(gl, 4, 12, 5, 16, 17, type); + } + + private static void recorditem(GL gl, float[] n1, float[] n2, float[] n3, int shadeType) { + float[] q0 = new float[3]; + float[] q1 = new float[3]; + + diff3(n1, n2, q0); + diff3(n2, n3, q1); + crossprod(q0, q1, q1); + normalize(q1); + + gl.glBegin(shadeType); + gl.glNormal3fv(q1, 0); + gl.glVertex3fv(n1, 0); + gl.glVertex3fv(n2, 0); + gl.glVertex3fv(n3, 0); + gl.glEnd(); + } + + private static void subdivide(GL gl, float[] v0, float[] v1, float[] v2, int shadeType) { + int depth; + float[] w0 = new float[3]; + float[] w1 = new float[3]; + float[] w2 = new float[3]; + float l; + int i, j, k, n; + + depth = 1; + for (i = 0; i < depth; i++) { + for (j = 0; i + j < depth; j++) { + k = depth - i - j; + for (n = 0; n < 3; n++) { + w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; + w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) + / depth; + w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) + / depth; + } + l = (float) Math.sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); + w0[0] /= l; + w0[1] /= l; + w0[2] /= l; + l = (float) Math.sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); + w1[0] /= l; + w1[1] /= l; + w1[2] /= l; + l = (float) Math.sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); + w2[0] /= l; + w2[1] /= l; + w2[2] /= l; + recorditem(gl, w1, w0, w2, shadeType); + } + } + } + + private static void drawtriangle(GL gl, int i, float[][] data, int[][] ndx, int shadeType) { + float[] x0 = data[ndx[i][0]]; + float[] x1 = data[ndx[i][1]]; + float[] x2 = data[ndx[i][2]]; + subdivide(gl, x0, x1, x2, shadeType); + } + + /* octahedron data: The octahedron produced is centered at the + origin and has radius 1.0 */ + private static final float[][] odata = + { + {1.0f, 0.0f, 0.0f}, + {-1.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f}, + {0.0f, -1.0f, 0.0f}, + {0.0f, 0.0f, 1.0f}, + {0.0f, 0.0f, -1.0f} + }; + + private static final int[][] ondex = + { + {0, 4, 2}, + {1, 2, 4}, + {0, 3, 4}, + {1, 4, 3}, + {0, 2, 5}, + {1, 5, 2}, + {0, 5, 3}, + {1, 3, 5} + }; + + private static void octahedron(GL gl, int shadeType) { + int i; + + for (i = 7; i >= 0; i--) { + drawtriangle(gl, i, odata, ondex, shadeType); + } + } + + /* icosahedron data: These numbers are rigged to make an + icosahedron of radius 1.0 */ + + private static final float X = .525731112119133606f; + private static final float Z = .850650808352039932f; + + private static final float[][] idata = + { + {-X, 0, Z}, + {X, 0, Z}, + {-X, 0, -Z}, + {X, 0, -Z}, + {0, Z, X}, + {0, Z, -X}, + {0, -Z, X}, + {0, -Z, -X}, + {Z, X, 0}, + {-Z, X, 0}, + {Z, -X, 0}, + {-Z, -X, 0} + }; + + private static final int[][] index = + { + {0, 4, 1}, + {0, 9, 4}, + {9, 5, 4}, + {4, 5, 8}, + {4, 8, 1}, + {8, 10, 1}, + {8, 3, 10}, + {5, 3, 8}, + {5, 2, 3}, + {2, 7, 3}, + {7, 10, 3}, + {7, 6, 10}, + {7, 11, 6}, + {11, 0, 6}, + {0, 1, 6}, + {6, 1, 10}, + {9, 0, 11}, + {9, 11, 2}, + {9, 2, 5}, + {7, 2, 11}, + }; + + private static void icosahedron(GL gl, int shadeType) { + int i; + + for (i = 19; i >= 0; i--) { + drawtriangle(gl, i, idata, index, shadeType); + } + } + + /* tetrahedron data: */ + + private static final float T = 1.73205080756887729f; + + private static final float[][] tdata = + { + {T, T, T}, + {T, -T, -T}, + {-T, T, -T}, + {-T, -T, T} + }; + + private static final int[][] tndex = + { + {0, 1, 3}, + {2, 1, 0}, + {3, 2, 0}, + {1, 2, 3} + }; + + private static final void tetrahedron(GL gl, int shadeType) { + for (int i = 3; i >= 0; i--) + drawtriangle(gl, i, tdata, tndex, shadeType); + } + + // Teapot implementation (a modified port of glut_teapot.c) + // + // Rim, body, lid, and bottom data must be reflected in x and + // y; handle and spout data across the y axis only. + private static final int[][] teapotPatchData = { + /* rim */ + {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + /* body */ + {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, + {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}, + /* lid */ + {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, 101, 0, 1, 2, 3,}, + {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117}, + /* bottom */ + {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, 125, 120, 40, 39, 38, 37}, + /* handle */ + {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56}, + {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 65, 66, 67}, + /* spout */ + {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83}, + {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95} + }; + private static final float[][] teapotCPData = { + {0.2f, 0f, 2.7f}, + {0.2f, -0.112f, 2.7f}, + {0.112f, -0.2f, 2.7f}, + {0f, -0.2f, 2.7f}, + {1.3375f, 0f, 2.53125f}, + {1.3375f, -0.749f, 2.53125f}, + {0.749f, -1.3375f, 2.53125f}, + {0f, -1.3375f, 2.53125f}, + {1.4375f, 0f, 2.53125f}, + {1.4375f, -0.805f, 2.53125f}, + {0.805f, -1.4375f, 2.53125f}, + {0f, -1.4375f, 2.53125f}, + {1.5f, 0f, 2.4f}, + {1.5f, -0.84f, 2.4f}, + {0.84f, -1.5f, 2.4f}, + {0f, -1.5f, 2.4f}, + {1.75f, 0f, 1.875f}, + {1.75f, -0.98f, 1.875f}, + {0.98f, -1.75f, 1.875f}, + {0f, -1.75f, 1.875f}, + {2f, 0f, 1.35f}, + {2f, -1.12f, 1.35f}, + {1.12f, -2f, 1.35f}, + {0f, -2f, 1.35f}, + {2f, 0f, 0.9f}, + {2f, -1.12f, 0.9f}, + {1.12f, -2f, 0.9f}, + {0f, -2f, 0.9f}, + {-2f, 0f, 0.9f}, + {2f, 0f, 0.45f}, + {2f, -1.12f, 0.45f}, + {1.12f, -2f, 0.45f}, + {0f, -2f, 0.45f}, + {1.5f, 0f, 0.225f}, + {1.5f, -0.84f, 0.225f}, + {0.84f, -1.5f, 0.225f}, + {0f, -1.5f, 0.225f}, + {1.5f, 0f, 0.15f}, + {1.5f, -0.84f, 0.15f}, + {0.84f, -1.5f, 0.15f}, + {0f, -1.5f, 0.15f}, + {-1.6f, 0f, 2.025f}, + {-1.6f, -0.3f, 2.025f}, + {-1.5f, -0.3f, 2.25f}, + {-1.5f, 0f, 2.25f}, + {-2.3f, 0f, 2.025f}, + {-2.3f, -0.3f, 2.025f}, + {-2.5f, -0.3f, 2.25f}, + {-2.5f, 0f, 2.25f}, + {-2.7f, 0f, 2.025f}, + {-2.7f, -0.3f, 2.025f}, + {-3f, -0.3f, 2.25f}, + {-3f, 0f, 2.25f}, + {-2.7f, 0f, 1.8f}, + {-2.7f, -0.3f, 1.8f}, + {-3f, -0.3f, 1.8f}, + {-3f, 0f, 1.8f}, + {-2.7f, 0f, 1.575f}, + {-2.7f, -0.3f, 1.575f}, + {-3f, -0.3f, 1.35f}, + {-3f, 0f, 1.35f}, + {-2.5f, 0f, 1.125f}, + {-2.5f, -0.3f, 1.125f}, + {-2.65f, -0.3f, 0.9375f}, + {-2.65f, 0f, 0.9375f}, + {-2f, -0.3f, 0.9f}, + {-1.9f, -0.3f, 0.6f}, + {-1.9f, 0f, 0.6f}, + {1.7f, 0f, 1.425f}, + {1.7f, -0.66f, 1.425f}, + {1.7f, -0.66f, 0.6f}, + {1.7f, 0f, 0.6f}, + {2.6f, 0f, 1.425f}, + {2.6f, -0.66f, 1.425f}, + {3.1f, -0.66f, 0.825f}, + {3.1f, 0f, 0.825f}, + {2.3f, 0f, 2.1f}, + {2.3f, -0.25f, 2.1f}, + {2.4f, -0.25f, 2.025f}, + {2.4f, 0f, 2.025f}, + {2.7f, 0f, 2.4f}, + {2.7f, -0.25f, 2.4f}, + {3.3f, -0.25f, 2.4f}, + {3.3f, 0f, 2.4f}, + {2.8f, 0f, 2.475f}, + {2.8f, -0.25f, 2.475f}, + {3.525f, -0.25f, 2.49375f}, + {3.525f, 0f, 2.49375f}, + {2.9f, 0f, 2.475f}, + {2.9f, -0.15f, 2.475f}, + {3.45f, -0.15f, 2.5125f}, + {3.45f, 0f, 2.5125f}, + {2.8f, 0f, 2.4f}, + {2.8f, -0.15f, 2.4f}, + {3.2f, -0.15f, 2.4f}, + {3.2f, 0f, 2.4f}, + {0f, 0f, 3.15f}, + {0.8f, 0f, 3.15f}, + {0.8f, -0.45f, 3.15f}, + {0.45f, -0.8f, 3.15f}, + {0f, -0.8f, 3.15f}, + {0f, 0f, 2.85f}, + {1.4f, 0f, 2.4f}, + {1.4f, -0.784f, 2.4f}, + {0.784f, -1.4f, 2.4f}, + {0f, -1.4f, 2.4f}, + {0.4f, 0f, 2.55f}, + {0.4f, -0.224f, 2.55f}, + {0.224f, -0.4f, 2.55f}, + {0f, -0.4f, 2.55f}, + {1.3f, 0f, 2.55f}, + {1.3f, -0.728f, 2.55f}, + {0.728f, -1.3f, 2.55f}, + {0f, -1.3f, 2.55f}, + {1.3f, 0f, 2.4f}, + {1.3f, -0.728f, 2.4f}, + {0.728f, -1.3f, 2.4f}, + {0f, -1.3f, 2.4f}, + {0f, 0f, 0f}, + {1.425f, -0.798f, 0f}, + {1.5f, 0f, 0.075f}, + {1.425f, 0f, 0f}, + {0.798f, -1.425f, 0f}, + {0f, -1.5f, 0.075f}, + {0f, -1.425f, 0f}, + {1.5f, -0.84f, 0.075f}, + {0.84f, -1.5f, 0.075f} + }; + // Since GL.glMap2f expects a packed array of floats, we must convert + // from a 3-dimensional array to a 1-dimensional array + private static final float[] teapotTex = { + 0, 0, 1, 0, 0, 1, 1, 1 + }; + + private static void teapot(GL gl, + int grid, + double scale, + int type, + boolean backCompatible) + { + // As mentioned above, GL.glMap2f expects a packed array of floats + float[] p = new float[4*4*3]; + float[] q = new float[4*4*3]; + float[] r = new float[4*4*3]; + float[] s = new float[4*4*3]; + int i, j, k, l; + + gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_EVAL_BIT | GL.GL_POLYGON_BIT); + gl.glEnable(GL.GL_AUTO_NORMAL); + gl.glEnable(GL.GL_NORMALIZE); + gl.glEnable(GL.GL_MAP2_VERTEX_3); + gl.glEnable(GL.GL_MAP2_TEXTURE_COORD_2); + if (!backCompatible) { + // The time has come to have the teapot no longer be inside out + gl.glFrontFace(GL.GL_CW); + gl.glScaled(0.5*scale, 0.5*scale, 0.5*scale); + } else { + // We want the teapot in it's backward compatible position and + // orientation + gl.glPushMatrix(); + gl.glRotatef(270.0f, 1, 0, 0); + gl.glScalef((float)(0.5 * scale), + (float)(0.5 * scale), + (float)(0.5 * scale)); + gl.glTranslatef(0.0f, 0.0f, -1.5f); + } + for (i = 0; i < 10; i++) { + for (j = 0; j < 4; j++) { + for (k = 0; k < 4; k++) { + for (l = 0; l < 3; l++) { + p[(j*4+k)*3+l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l]; + q[(j*4+k)*3+l] = + teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l]; + if (l == 1) + q[(j*4+k)*3+l] *= -1.0; + if (i < 6) { + r[(j*4+k)*3+l] = + teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l]; + if (l == 0) + r[(j*4+k)*3+l] *= -1.0; + s[(j*4+k)*3+l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l]; + if (l == 0) + s[(j*4+k)*3+l] *= -1.0; + if (l == 1) + s[(j*4+k)*3+l] *= -1.0; + } + } + } + } + gl.glMap2f(GL.GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, teapotTex, 0); + gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, p, 0); + gl.glMapGrid2f(grid, 0.0f, 1.0f, grid, 0.0f, 1.0f); + evaluateTeapotMesh(gl, grid, type, i, !backCompatible); + gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, q, 0); + evaluateTeapotMesh(gl, grid, type, i, !backCompatible); + if (i < 6) { + gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, r, 0); + evaluateTeapotMesh(gl, grid, type, i, !backCompatible); + gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, s, 0); + evaluateTeapotMesh(gl, grid, type, i, !backCompatible); + } + } + if (backCompatible) { + gl.glPopMatrix(); + } + gl.glPopAttrib(); + } + + private static void evaluateTeapotMesh(GL gl, + int grid, + int type, + int partNum, + boolean repairSingularities) + { + if (repairSingularities && (partNum == 5 || partNum == 3)) { + // Instead of using evaluators that give bad results at singularities, + // evaluate by hand + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, type); + for (int nv = 0; nv < grid; nv++) { + if (nv == 0) { + // Draw a small triangle-fan to fill the hole + gl.glDisable(GL.GL_AUTO_NORMAL); + gl.glNormal3f(0, 0, partNum == 3 ? 1 : -1); + gl.glBegin(GL.GL_TRIANGLE_FAN); + { + gl.glEvalCoord2f(0, 0); + // Note that we draw in clock-wise order to match the evaluator + // method + for (int nu = 0; nu <= grid; nu++) + { + gl.glEvalCoord2f(nu / (float)grid, (1f / grid) / (float)grid); + } + } + gl.glEnd(); + gl.glEnable(GL.GL_AUTO_NORMAL); + } + // Draw the rest of the piece as an evaluated quad-strip + gl.glBegin(GL.GL_QUAD_STRIP); + { + // Note that we draw in clock-wise order to match the evaluator method + for (int nu = grid; nu >= 0; nu--) { + gl.glEvalCoord2f(nu / (float)grid, (nv + 1) / (float)grid); + gl.glEvalCoord2f(nu / (float)grid, Math.max(nv, 1f / grid) + / (float)grid); + } + } + gl.glEnd(); + } + } else { + gl.glEvalMesh2(type, 0, grid, 0, grid); + } + } + + //---------------------------------------------------------------------- + // Font implementation + // + + private static void bitmapCharacterImpl(GL gl, int font, char cin) { + BitmapFontRec fontinfo = getBitmapFont(font); + int c = cin & 0xFFFF; + if (c < fontinfo.first || + c >= fontinfo.first + fontinfo.num_chars) + return; + BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + if (ch != null) { + gl.glBitmap(ch.width, ch.height, ch.xorig, ch.yorig, + ch.advance, 0, ch.bitmap, 0); + } + } + + private static final BitmapFontRec[] bitmapFonts = new BitmapFontRec[9]; + private static final StrokeFontRec[] strokeFonts = new StrokeFontRec[9]; + + private static BitmapFontRec getBitmapFont(int font) { + BitmapFontRec rec = bitmapFonts[font]; + if (rec == null) { + switch (font) { + case BITMAP_9_BY_15: + rec = GLUTBitmap9x15.glutBitmap9By15; + break; + case BITMAP_8_BY_13: + rec = GLUTBitmap8x13.glutBitmap8By13; + break; + case BITMAP_TIMES_ROMAN_10: + rec = GLUTBitmapTimesRoman10.glutBitmapTimesRoman10; + break; + case BITMAP_TIMES_ROMAN_24: + rec = GLUTBitmapTimesRoman24.glutBitmapTimesRoman24; + break; + case BITMAP_HELVETICA_10: + rec = GLUTBitmapHelvetica10.glutBitmapHelvetica10; + break; + case BITMAP_HELVETICA_12: + rec = GLUTBitmapHelvetica12.glutBitmapHelvetica12; + break; + case BITMAP_HELVETICA_18: + rec = GLUTBitmapHelvetica18.glutBitmapHelvetica18; + break; + default: + throw new GLException("Unknown bitmap font number " + font); + } + bitmapFonts[font] = rec; + } + return rec; + } + + private static StrokeFontRec getStrokeFont(int font) { + StrokeFontRec rec = strokeFonts[font]; + if (rec == null) { + switch (font) { + case STROKE_ROMAN: + rec = GLUTStrokeRoman.glutStrokeRoman; + break; + case STROKE_MONO_ROMAN: + rec = GLUTStrokeMonoRoman.glutStrokeMonoRoman; + break; + default: + throw new GLException("Unknown stroke font number " + font); + } + } + return rec; + } + + private static void beginBitmap(GL gl, + int[] swapbytes, + int[] lsbfirst, + int[] rowlength, + int[] skiprows, + int[] skippixels, + int[] alignment) { + gl.glGetIntegerv(GL.GL_UNPACK_SWAP_BYTES, swapbytes, 0); + gl.glGetIntegerv(GL.GL_UNPACK_LSB_FIRST, lsbfirst, 0); + gl.glGetIntegerv(GL.GL_UNPACK_ROW_LENGTH, rowlength, 0); + gl.glGetIntegerv(GL.GL_UNPACK_SKIP_ROWS, skiprows, 0); + gl.glGetIntegerv(GL.GL_UNPACK_SKIP_PIXELS, skippixels, 0); + gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, alignment, 0); + /* Little endian machines (DEC Alpha for example) could + benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE + instead of GL_FALSE, but this would require changing the + generated bitmaps too. */ + gl.glPixelStorei(GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE); + gl.glPixelStorei(GL.GL_UNPACK_LSB_FIRST, GL.GL_FALSE); + gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, 0); + gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, 0); + gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, 0); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); + } + + private static void endBitmap(GL gl, + int[] swapbytes, + int[] lsbfirst, + int[] rowlength, + int[] skiprows, + int[] skippixels, + int[] alignment) { + /* Restore saved modes. */ + gl.glPixelStorei(GL.GL_UNPACK_SWAP_BYTES, swapbytes[0]); + gl.glPixelStorei(GL.GL_UNPACK_LSB_FIRST, lsbfirst[0]); + gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, rowlength[0]); + gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, skiprows[0]); + gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, skippixels[0]); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, alignment[0]); + } +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmap8x13.java b/src/classes/com/sun/opengl/utils/GLUTBitmap8x13.java new file mode 100644 index 000000000..a373aeb8d --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmap8x13.java @@ -0,0 +1,2078 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmap8x13 { + +/* GENERATED FILE -- DO NOT MODIFY */ + + +static final BitmapCharRec ch0 = new BitmapCharRec(0,0,0,0,8,null); + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,8,null); + +static final BitmapCharRec ch127 = new BitmapCharRec(0,0,0,0,8,null); + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,8,null); + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(6,12,-1,2,8,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0x80,(byte) 0x80,(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(6,10,-1,2,8,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(6,12,-1,2,8,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(6,10,-1,0,8,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(6,10,-1,0,8,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(6,10,-1,0,8,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(6,10,-1,0,8,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0x80,(byte) 0x78,(byte) 0xc4,(byte) 0xa4,(byte) 0x94,(byte) 0x8c,(byte) 0x78,(byte) 0x4, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(6,8,-1,1,8,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(5,7,-1,-1,8,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(6,10,-1,0,8,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(6,10,-1,0,8,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(6,10,-1,0,8,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(6,10,-1,0,8,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(6,10,-1,0,8,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(6,10,-1,0,8,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x8,(byte) 0x50,(byte) 0x30,(byte) 0x48, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(6,10,-1,0,8,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x50, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(5,10,-1,0,8,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(5,10,-1,0,8,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(5,10,-1,0,8,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(5,10,-1,0,8,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(6,10,-1,0,8,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(6,10,-1,0,8,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(6,10,-1,0,8,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(6,10,-1,0,8,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0x20,(byte) 0x10,(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(6,8,-1,2,8,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0x6c,(byte) 0x92,(byte) 0x90,(byte) 0x7c,(byte) 0x12,(byte) 0x6c, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(7,6,0,0,8,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x30,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(6,10,-1,0,8,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(6,10,-1,0,8,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(6,10,-1,0,8,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(6,10,-1,0,8,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(6,10,-1,0,8,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(6,10,-1,0,8,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0x80,(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(6,9,-1,1,8,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x80, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(6,9,-1,0,8,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(5,10,-1,0,8,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(6,10,-1,0,8,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(6,10,-1,0,8,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(6,10,-1,0,8,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(6,10,-1,0,8,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0x80,(byte) 0x78,(byte) 0xc4,(byte) 0xa4,(byte) 0xa4,(byte) 0xa4,(byte) 0x94,(byte) 0x94,(byte) 0x8c,(byte) 0x78,(byte) 0x4, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(6,11,-1,1,8,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x84, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(6,6,-1,-1,8,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(7,10,0,0,8,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(7,10,0,0,8,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x24,(byte) 0x18, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(7,10,0,0,8,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(7,10,0,0,8,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x8,(byte) 0x10, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(7,10,0,0,8,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(7,10,0,0,8,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xe2,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(7,9,0,0,8,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x50, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(5,10,-1,0,8,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(5,10,-1,0,8,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(5,10,-1,0,8,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(5,10,-1,0,8,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(6,10,-1,0,8,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(6,10,-1,0,8,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(6,10,-1,0,8,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(6,10,-1,0,8,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x20,(byte) 0x10,(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(6,11,-1,2,8,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0x9e,(byte) 0x90,(byte) 0x90,(byte) 0xf0,(byte) 0x9c,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x6e, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(7,9,0,0,8,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(6,10,-1,0,8,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(6,10,-1,0,8,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(6,10,-1,0,8,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(6,10,-1,0,8,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(6,10,-1,0,8,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(6,10,-1,0,8,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(6,9,-1,0,8,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0x66,(byte) 0x92,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(7,10,0,0,8,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x1e,(byte) 0x10,(byte) 0xc,(byte) 0x2,(byte) 0xf2,(byte) 0x4c,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(7,10,0,0,8,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0xe6,(byte) 0x42,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(7,10,0,0,8,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(7,7,0,-1,8,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xf0,(byte) 0x0,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(4,6,-1,-3,8,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(3,6,-1,-4,8,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(2,2,-3,2,8,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0xc0, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(2,1,-3,-4,8,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x7c, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(6,9,-1,0,8,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0x80,(byte) 0xb4,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(6,7,-1,1,8,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(2,2,-3,-8,8,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(4,6,-1,-4,8,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x60,(byte) 0x10,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(4,6,-1,-4,8,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(5,7,-1,-1,8,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(4,4,-2,-5,8,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xfc, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(6,1,-1,-8,8,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0x38,(byte) 0x44,(byte) 0xaa,(byte) 0xb2,(byte) 0xaa,(byte) 0xaa,(byte) 0x92,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(7,9,0,-1,8,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xfc, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(6,1,-1,-4,8,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfc, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(6,4,-1,-1,8,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(7,7,0,-1,8,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x78,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x70, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(5,7,-1,-2,8,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0x38,(byte) 0x44,(byte) 0x92,(byte) 0xaa,(byte) 0xa2,(byte) 0xaa,(byte) 0x92,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(7,9,0,-1,8,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xd8, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(5,1,-1,-8,8,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x80,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(4,10,-2,0,8,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(1,9,-3,0,8,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0x10,(byte) 0x10,(byte) 0x7c,(byte) 0x10,(byte) 0x7c,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(7,9,0,0,8,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0x84,(byte) 0x78,(byte) 0x48,(byte) 0x48,(byte) 0x78,(byte) 0x84, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(6,6,-1,-1,8,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0xdc,(byte) 0x62,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x70,(byte) 0x20,(byte) 0x22,(byte) 0x1c, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(7,9,0,0,8,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x20,(byte) 0x70,(byte) 0xa8,(byte) 0xa0,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x20, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(5,8,-1,-1,8,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(1,9,-3,0,8,ch161data); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0x90,(byte) 0xa8,(byte) 0x48, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(5,3,-1,-6,8,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0xe0,(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x18,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0xe0, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(5,9,-1,0,8,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(1,9,-3,0,8,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0x38,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x38, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(5,9,-2,0,8,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xfc,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0xfc, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(6,6,-1,0,8,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(6,8,-1,2,8,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x84, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(6,6,-1,0,8,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(7,6,0,0,8,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(5,6,-1,0,8,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(6,6,-1,0,8,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x38,(byte) 0x44,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xf8,(byte) 0x40,(byte) 0x40, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(6,8,-1,0,8,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0x78,(byte) 0x84,(byte) 0x18,(byte) 0x60,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(6,6,-1,0,8,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x44,(byte) 0xb8, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(6,6,-1,0,8,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x8c,(byte) 0x74, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(6,8,-1,2,8,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0xc4,(byte) 0xb8, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(6,8,-1,2,8,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(6,6,-1,0,8,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(6,6,-1,0,8,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(7,6,0,0,8,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(5,9,-1,0,8,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xe0,(byte) 0x90,(byte) 0x88,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(6,9,-1,0,8,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x18,(byte) 0x0,(byte) 0x8, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(5,10,-1,2,8,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(5,8,-1,0,8,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(6,9,-1,0,8,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0x78,(byte) 0x84,(byte) 0x78,(byte) 0x80,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x74, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(6,8,-1,2,8,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xf8,(byte) 0x40,(byte) 0x40,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(6,9,-1,0,8,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(6,6,-1,0,8,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x8c,(byte) 0x74,(byte) 0x4,(byte) 0x4,(byte) 0x4, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(6,9,-1,0,8,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(6,6,-1,0,8,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(6,9,-1,0,8,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(6,6,-1,0,8,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0x10,(byte) 0x60,(byte) 0xe0, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(4,3,-2,-6,8,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xfe, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(7,1,0,1,8,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0x88,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(5,3,-1,-6,8,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(4,9,-1,0,8,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x2,(byte) 0x2,(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(7,9,0,0,8,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(4,9,-2,0,8,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfc, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(6,9,-1,0,8,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(7,9,0,0,8,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(7,9,0,0,8,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(7,9,0,0,8,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(7,9,0,0,8,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(6,9,-1,0,8,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(7,9,0,0,8,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x78,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(6,9,-1,0,8,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(6,9,-1,0,8,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0x4,(byte) 0x78,(byte) 0x94,(byte) 0xa4,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(6,10,-1,1,8,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(6,9,-1,0,8,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(6,9,-1,0,8,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x8c,(byte) 0x94,(byte) 0xa4,(byte) 0xc4,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(6,9,-1,0,8,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0xaa,(byte) 0xc6,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(7,9,0,0,8,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(6,9,-1,0,8,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xc0,(byte) 0xa0,(byte) 0x90,(byte) 0x88,(byte) 0x84, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(6,9,-1,0,8,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3c, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(6,9,-1,0,8,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(5,9,-1,0,8,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(6,9,-1,0,8,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x9c,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(6,9,-1,0,8,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(6,9,-1,0,8,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(6,9,-1,0,8,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(7,9,0,0,8,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(6,9,-1,0,8,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x7c,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(7,9,0,0,8,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(6,9,-1,0,8,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x78,(byte) 0x80,(byte) 0x94,(byte) 0xac,(byte) 0xa4,(byte) 0x9c,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(6,9,-1,0,8,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(6,9,-1,0,8,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(5,9,-1,0,8,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xfc,(byte) 0x0,(byte) 0x0,(byte) 0xfc, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(6,4,-1,-2,8,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(5,9,-2,0,8,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0x80,(byte) 0x60,(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x70,(byte) 0x20, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(4,8,-1,1,8,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0xe0,(byte) 0x40, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(3,8,-2,1,8,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0x70,(byte) 0x8,(byte) 0x4,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(6,9,-1,0,8,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(6,9,-1,0,8,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfc, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(6,9,-1,0,8,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x38, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(6,9,-1,0,8,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0xfc, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(6,9,-1,0,8,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x8,(byte) 0x8,(byte) 0xfc,(byte) 0x88,(byte) 0x88,(byte) 0x48,(byte) 0x28,(byte) 0x18,(byte) 0x8, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(6,9,-1,0,8,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x38,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfc, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(6,9,-1,0,8,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x40,(byte) 0x30,(byte) 0x8,(byte) 0x4,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(6,9,-1,0,8,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x60,(byte) 0x20, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(5,9,-1,0,8,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x30,(byte) 0x48,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(6,9,-1,0,8,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x2, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(7,9,0,0,8,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0x40,(byte) 0xe0,(byte) 0x40, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(3,3,-2,1,8,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xfc, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(6,1,-1,-4,8,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0x80,(byte) 0x60,(byte) 0x70, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(4,3,-1,1,8,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(5,5,-1,-2,8,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0x48,(byte) 0x30,(byte) 0xfc,(byte) 0x30,(byte) 0x48, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(6,5,-1,-2,8,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(3,9,-2,0,8,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(3,9,-3,0,8,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0x80,(byte) 0x60,(byte) 0x70, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(4,3,-1,-6,8,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x74,(byte) 0x88,(byte) 0x94,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(6,7,-1,0,8,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x88,(byte) 0x54,(byte) 0x48,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x48,(byte) 0xa4,(byte) 0x44, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(6,9,-1,0,8,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x20,(byte) 0xf0,(byte) 0x28,(byte) 0x70,(byte) 0xa0,(byte) 0x78,(byte) 0x20, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(5,7,-1,-1,8,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x48,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(6,7,-1,-1,8,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0x90,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(4,3,-2,-6,8,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(1,9,-3,0,8,ch33data); + +/* char: 0x1f */ + +static final byte[] ch31data = { +(byte) 0x80, +}; + +static final BitmapCharRec ch31 = new BitmapCharRec(1,1,-3,-3,8,ch31data); + +/* char: 0x1e */ + +static final byte[] ch30data = { +(byte) 0xdc,(byte) 0x62,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x70,(byte) 0x20,(byte) 0x22,(byte) 0x1c, +}; + +static final BitmapCharRec ch30 = new BitmapCharRec(7,9,0,0,8,ch30data); + +/* char: 0x1d */ + +static final byte[] ch29data = { +(byte) 0x80,(byte) 0x40,(byte) 0xfe,(byte) 0x10,(byte) 0xfe,(byte) 0x4,(byte) 0x2, +}; + +static final BitmapCharRec ch29 = new BitmapCharRec(7,7,0,0,8,ch29data); + +/* char: 0x1c */ + +static final byte[] ch28data = { +(byte) 0x88,(byte) 0x48,(byte) 0x48,(byte) 0x48,(byte) 0x48,(byte) 0xfc, +}; + +static final BitmapCharRec ch28 = new BitmapCharRec(6,6,-1,0,8,ch28data); + +/* char: 0x1b */ + +static final byte[] ch27data = { +(byte) 0xfe,(byte) 0x80,(byte) 0x20,(byte) 0x8,(byte) 0x2,(byte) 0x8,(byte) 0x20,(byte) 0x80, +}; + +static final BitmapCharRec ch27 = new BitmapCharRec(7,8,0,0,8,ch27data); + +/* char: 0x1a */ + +static final byte[] ch26data = { +(byte) 0xfe,(byte) 0x2,(byte) 0x8,(byte) 0x20,(byte) 0x80,(byte) 0x20,(byte) 0x8,(byte) 0x2, +}; + +static final BitmapCharRec ch26 = new BitmapCharRec(7,8,0,0,8,ch26data); + +/* char: 0x19 */ + +static final byte[] ch25data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch25 = new BitmapCharRec(1,13,-3,2,8,ch25data); + +/* char: 0x18 */ + +static final byte[] ch24data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xff, +}; + +static final BitmapCharRec ch24 = new BitmapCharRec(8,6,0,2,8,ch24data); + +/* char: 0x17 */ + +static final byte[] ch23data = { +(byte) 0xff,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch23 = new BitmapCharRec(8,8,0,-3,8,ch23data); + +/* char: 0x16 */ + +static final byte[] ch22data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch22 = new BitmapCharRec(4,13,0,2,8,ch22data); + +/* char: 0x15 */ + +static final byte[] ch21data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch21 = new BitmapCharRec(5,13,-3,2,8,ch21data); + +/* char: 0x14 */ + +static final byte[] ch20data = { +(byte) 0xff, +}; + +static final BitmapCharRec ch20 = new BitmapCharRec(8,1,0,1,8,ch20data); + +/* char: 0x13 */ + +static final byte[] ch19data = { +(byte) 0xff, +}; + +static final BitmapCharRec ch19 = new BitmapCharRec(8,1,0,-1,8,ch19data); + +/* char: 0x12 */ + +static final byte[] ch18data = { +(byte) 0xff, +}; + +static final BitmapCharRec ch18 = new BitmapCharRec(8,1,0,-3,8,ch18data); + +/* char: 0x11 */ + +static final byte[] ch17data = { +(byte) 0xff, +}; + +static final BitmapCharRec ch17 = new BitmapCharRec(8,1,0,-5,8,ch17data); + +/* char: 0x10 */ + +static final byte[] ch16data = { +(byte) 0xff, +}; + +static final BitmapCharRec ch16 = new BitmapCharRec(8,1,0,-7,8,ch16data); + +/* char: 0xf */ + +static final byte[] ch15data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xff,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch15 = new BitmapCharRec(8,13,0,2,8,ch15data); + +/* char: 0xe */ + +static final byte[] ch14data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch14 = new BitmapCharRec(5,8,-3,-3,8,ch14data); + +/* char: 0xd */ + +static final byte[] ch13data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8, +}; + +static final BitmapCharRec ch13 = new BitmapCharRec(5,6,-3,2,8,ch13data); + +/* char: 0xc */ + +static final byte[] ch12data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0, +}; + +static final BitmapCharRec ch12 = new BitmapCharRec(4,6,0,2,8,ch12data); + +/* char: 0xb */ + +static final byte[] ch11data = { +(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch11 = new BitmapCharRec(4,8,0,-3,8,ch11data); + +/* char: 0xa */ + +static final byte[] ch10data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch10 = new BitmapCharRec(7,9,0,2,8,ch10data); + +/* char: 0x9 */ + +static final byte[] ch9data = { +(byte) 0x3e,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x88,(byte) 0x98,(byte) 0xa8,(byte) 0xc8,(byte) 0x88, +}; + +static final BitmapCharRec ch9 = new BitmapCharRec(7,9,0,2,8,ch9data); + +/* char: 0x8 */ + +static final byte[] ch8data = { +(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch8 = new BitmapCharRec(7,6,0,0,8,ch8data); + +/* char: 0x7 */ + +static final byte[] ch7data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch7 = new BitmapCharRec(5,4,-1,-5,8,ch7data); + +/* char: 0x6 */ + +static final byte[] ch6data = { +(byte) 0x20,(byte) 0x20,(byte) 0x3c,(byte) 0x20,(byte) 0x3e,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch6 = new BitmapCharRec(7,9,0,2,8,ch6data); + +/* char: 0x5 */ + +static final byte[] ch5data = { +(byte) 0x22,(byte) 0x22,(byte) 0x3c,(byte) 0x22,(byte) 0x3c,(byte) 0x78,(byte) 0x80,(byte) 0x80,(byte) 0x78, +}; + +static final BitmapCharRec ch5 = new BitmapCharRec(7,9,0,2,8,ch5data); + +/* char: 0x4 */ + +static final byte[] ch4data = { +(byte) 0x10,(byte) 0x10,(byte) 0x1c,(byte) 0x10,(byte) 0x9e,(byte) 0x80,(byte) 0xe0,(byte) 0x80,(byte) 0xf0, +}; + +static final BitmapCharRec ch4 = new BitmapCharRec(7,9,0,2,8,ch4data); + +/* char: 0x3 */ + +static final byte[] ch3data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x88,(byte) 0x88,(byte) 0xf8,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch3 = new BitmapCharRec(7,9,0,2,8,ch3data); + +/* char: 0x2 */ + +static final byte[] ch2data = { +(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa, +}; + +static final BitmapCharRec ch2 = new BitmapCharRec(8,12,0,2,8,ch2data); + +/* char: 0x1 */ + +static final byte[] ch1data = { +(byte) 0x10,(byte) 0x38,(byte) 0x7c,(byte) 0xfe,(byte) 0x7c,(byte) 0x38,(byte) 0x10, +}; + +static final BitmapCharRec ch1 = new BitmapCharRec(7,7,0,-1,8,ch1data); + +static final BitmapCharRec[] chars = { +ch0, +ch1, +ch2, +ch3, +ch4, +ch5, +ch6, +ch7, +ch8, +ch9, +ch10, +ch11, +ch12, +ch13, +ch14, +ch15, +ch16, +ch17, +ch18, +ch19, +ch20, +ch21, +ch22, +ch23, +ch24, +ch25, +ch26, +ch27, +ch28, +ch29, +ch30, +ch31, +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +ch127, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmap8By13 = new BitmapFontRec("-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1", + 256, + 0, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmap9x15.java b/src/classes/com/sun/opengl/utils/GLUTBitmap9x15.java new file mode 100644 index 000000000..c1668967d --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmap9x15.java @@ -0,0 +1,2079 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmap9x15 { + +/* GENERATED FILE -- DO NOT MODIFY */ + +static final BitmapCharRec ch0 = new BitmapCharRec(0,0,0,0,9,null); + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,9,null); + +static final BitmapCharRec ch127 = new BitmapCharRec(0,0,0,0,9,null); + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,9,null); + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(6,14,-1,3,9,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(7,12,-1,3,9,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(6,14,-1,3,9,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(7,11,-1,0,9,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(7,11,-1,0,9,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(7,11,-1,0,9,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(7,11,-1,0,9,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0x80,(byte) 0x7c,(byte) 0xa2,(byte) 0xa2,(byte) 0x92,(byte) 0x8a,(byte) 0x8a,(byte) 0x7c,(byte) 0x2, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(7,9,-1,1,9,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x10,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0xfe,(byte) 0x0,(byte) 0x10,(byte) 0x38,(byte) 0x10, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(7,9,-1,0,9,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(7,11,-1,0,9,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(7,11,-1,0,9,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(7,11,-1,0,9,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(7,11,-1,0,9,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(7,11,-1,0,9,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(7,11,-1,0,9,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x8,(byte) 0x50,(byte) 0x30,(byte) 0x48, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(7,11,-1,0,9,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x50, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(5,11,-2,0,9,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(5,11,-2,0,9,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x60,(byte) 0x10, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(5,11,-2,0,9,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x40, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(5,11,-2,0,9,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(7,11,-1,0,9,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(7,11,-1,0,9,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(7,11,-1,0,9,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(7,11,-1,0,9,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0x30,(byte) 0x48,(byte) 0x18,(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(7,10,-1,3,9,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0x6e,(byte) 0x92,(byte) 0x90,(byte) 0x7c,(byte) 0x12,(byte) 0x92,(byte) 0x6c, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(7,7,-1,0,9,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x18,(byte) 0x24,(byte) 0x18, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(7,11,-1,0,9,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(7,11,-1,0,9,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(7,11,-1,0,9,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(7,11,-1,0,9,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(7,11,-1,0,9,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(7,11,-1,0,9,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0x80,(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(7,9,-1,1,9,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfc,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(7,10,-1,0,9,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(7,11,-1,0,9,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(7,11,-1,0,9,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(7,11,-1,0,9,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(7,11,-1,0,9,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(7,11,-1,0,9,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0x80,(byte) 0x7c,(byte) 0xc2,(byte) 0xa2,(byte) 0xa2,(byte) 0x92,(byte) 0x92,(byte) 0x8a,(byte) 0x8a,(byte) 0x86,(byte) 0x7c,(byte) 0x2, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(7,12,-1,1,9,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(7,7,-1,-1,9,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(7,11,-1,0,9,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(7,11,-1,0,9,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(7,11,-1,0,9,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(7,11,-1,0,9,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(7,11,-1,0,9,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x92,(byte) 0x92,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(7,11,-1,0,9,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xf2,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(7,10,-1,0,9,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x50, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(5,11,-2,0,9,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(5,11,-2,0,9,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x60,(byte) 0x10, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(5,11,-2,0,9,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x30,(byte) 0x40, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(5,11,-2,0,9,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(7,11,-1,0,9,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(7,11,-1,0,9,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(7,11,-1,0,9,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(7,11,-1,0,9,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x30,(byte) 0x48,(byte) 0x18,(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(7,13,-1,3,9,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0x9e,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xfc,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x6e, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(7,10,-1,0,9,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x10,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(7,11,-1,0,9,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(7,11,-1,0,9,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(7,11,-1,0,9,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(7,11,-1,0,9,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x30,(byte) 0x8, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(7,11,-1,0,9,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x18,(byte) 0x20, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(7,11,-1,0,9,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(7,10,-1,0,9,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0x66,(byte) 0x92,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(7,10,-1,0,9,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x1e,(byte) 0x10,(byte) 0xc,(byte) 0x2,(byte) 0xf2,(byte) 0x4c,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(7,10,-1,0,9,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0xe6,(byte) 0x42,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(7,10,-1,0,9,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12,(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(7,8,-1,-1,9,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(5,6,-1,-5,9,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(3,6,-1,-4,9,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0x60,(byte) 0x90,(byte) 0x30, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(4,3,-2,3,9,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(2,2,-4,-4,9,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0xa,(byte) 0xa,(byte) 0xa,(byte) 0xa,(byte) 0xa,(byte) 0x7a,(byte) 0x8a,(byte) 0x8a,(byte) 0x8a,(byte) 0x7e, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(7,10,-1,0,9,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0x80,(byte) 0x80,(byte) 0xba,(byte) 0xc6,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(7,9,-1,2,9,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0xc0,(byte) 0x20, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(3,2,-3,-9,9,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(4,6,-1,-4,9,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x60,(byte) 0x10,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(4,6,-1,-4,9,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xfe,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(7,9,-1,-1,9,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(4,4,-3,-6,9,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xfc, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(6,1,-1,-9,9,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0x3c,(byte) 0x42,(byte) 0xa5,(byte) 0xa9,(byte) 0xbd,(byte) 0xa5,(byte) 0xb9,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(8,9,0,-1,9,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xfc, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(6,1,-1,-4,9,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfc, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(6,4,-1,-2,9,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90,(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(7,8,-1,-1,9,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x78,(byte) 0x90,(byte) 0x70,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(5,7,-3,-3,9,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x99,(byte) 0xa5,(byte) 0xa1,(byte) 0xa5,(byte) 0x99,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(8,9,0,-1,9,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xa0,(byte) 0xa0, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(3,2,-3,-9,9,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(5,11,-2,1,9,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(1,11,-4,1,9,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x7c,(byte) 0x10,(byte) 0x7c,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(7,10,-1,0,9,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x7c,(byte) 0x82, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(7,6,-1,-3,9,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0x5c,(byte) 0xa2,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x22,(byte) 0x1c, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(7,10,-1,0,9,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x40,(byte) 0x78,(byte) 0xa4,(byte) 0xa0,(byte) 0x90,(byte) 0x94,(byte) 0x78,(byte) 0x8, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(6,8,-1,0,9,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(1,11,-4,0,9,ch161data); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0x8c,(byte) 0x92,(byte) 0x62, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(7,3,-1,-7,9,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0xe0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x18,(byte) 0x18,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xe0, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(5,12,-1,1,9,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(1,12,-4,1,9,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0x38,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0xc0,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x38, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(5,12,-3,1,9,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xfe,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfe, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(7,7,-1,0,9,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(6,10,-1,3,9,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(7,7,-1,0,9,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(7,7,-1,0,9,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(7,7,-1,0,9,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(7,7,-1,0,9,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x1c,(byte) 0x22,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xfc,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(7,9,-1,0,9,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x2,(byte) 0x7c,(byte) 0x80,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(7,7,-1,0,9,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x42,(byte) 0x62,(byte) 0x9c, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(7,7,-1,0,9,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x2,(byte) 0x2,(byte) 0x2,(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x86,(byte) 0x7a, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(7,10,-1,3,9,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(7,10,-1,3,9,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(7,7,-1,0,9,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(7,7,-1,0,9,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(7,7,-1,0,9,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(5,10,-2,0,9,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0x82,(byte) 0x8c,(byte) 0xb0,(byte) 0xc0,(byte) 0xb0,(byte) 0x8c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(7,10,-1,0,9,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x1c,(byte) 0x0,(byte) 0x0,(byte) 0xc, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(6,13,-1,3,9,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x60, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(5,10,-2,0,9,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(7,10,-1,0,9,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x80,(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x7a, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(7,10,-1,3,9,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x22,(byte) 0x22,(byte) 0x1c, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(7,10,-1,0,9,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(7,7,-1,0,9,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x86,(byte) 0x7a,(byte) 0x2,(byte) 0x2,(byte) 0x2, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(7,10,-1,0,9,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(7,7,-1,0,9,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(7,10,-1,0,9,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(7,7,-1,0,9,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(4,4,-3,-6,9,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xff, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(8,1,0,1,9,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(7,4,-1,-6,9,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(4,12,-2,1,9,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x2,(byte) 0x4,(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(7,10,-1,0,9,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(4,12,-3,1,9,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xfe,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0xfe, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(7,10,-1,0,9,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(7,10,-1,0,9,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(7,10,-1,0,9,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(7,10,-1,0,9,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(7,10,-1,0,9,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(7,10,-1,0,9,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(7,10,-1,0,9,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x2,(byte) 0xc,(byte) 0x70,(byte) 0x80,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(7,10,-1,0,9,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0x82,(byte) 0x82,(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfc, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(7,10,-1,0,9,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0x6,(byte) 0x8,(byte) 0x7c,(byte) 0x92,(byte) 0xa2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(7,12,-1,2,9,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfc, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(7,10,-1,0,9,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(7,10,-1,0,9,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(7,10,-1,0,9,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0xaa,(byte) 0xaa,(byte) 0xc6,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(7,10,-1,0,9,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xfe,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(7,10,-1,0,9,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0x82,(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xe0,(byte) 0x90,(byte) 0x88,(byte) 0x84,(byte) 0x82, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(7,10,-1,0,9,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x1e, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(7,10,-1,0,9,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(5,10,-2,0,9,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(7,10,-1,0,9,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x8e,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(7,10,-1,0,9,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xfe, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(7,10,-1,0,9,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xfe, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(7,10,-1,0,9,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(7,10,-1,0,9,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(7,10,-1,0,9,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x7c,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(7,10,-1,0,9,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(7,10,-1,0,9,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0x9a,(byte) 0xa6,(byte) 0xa2,(byte) 0x9e,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(7,10,-1,0,9,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(7,10,-1,0,9,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(5,10,-2,0,9,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xfe,(byte) 0x0,(byte) 0x0,(byte) 0xfe, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(7,4,-1,-2,9,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(5,10,-2,0,9,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(2,10,-4,3,9,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(2,7,-4,0,9,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0x78,(byte) 0x4,(byte) 0x2,(byte) 0x2,(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(7,10,-1,0,9,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(7,10,-1,0,9,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x2,(byte) 0xfe, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(7,10,-1,0,9,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x3c, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(7,10,-1,0,9,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x2,(byte) 0x2,(byte) 0x2,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0xfe, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(7,10,-1,0,9,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfe,(byte) 0x84,(byte) 0x44,(byte) 0x24,(byte) 0x14,(byte) 0xc,(byte) 0x4, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(7,10,-1,0,9,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0x7c,(byte) 0x82,(byte) 0x2,(byte) 0x2,(byte) 0x2,(byte) 0x1c,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0xfe, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(7,10,-1,0,9,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xfe,(byte) 0x80,(byte) 0x40,(byte) 0x30,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x82,(byte) 0x82,(byte) 0x7c, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(7,10,-1,0,9,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x90,(byte) 0x50,(byte) 0x30,(byte) 0x10, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(7,10,-1,0,9,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(7,10,-1,0,9,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x4,(byte) 0x2, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(7,10,-1,0,9,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(2,2,-4,0,9,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xfe, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(7,1,-1,-4,9,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(2,5,-4,3,9,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(7,7,-1,-1,9,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0x10,(byte) 0x92,(byte) 0x54,(byte) 0x38,(byte) 0x54,(byte) 0x92,(byte) 0x10, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(7,7,-1,-1,9,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(3,12,-3,1,9,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(3,12,-3,1,9,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x30, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(4,4,-3,-6,9,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x62,(byte) 0x94,(byte) 0x88,(byte) 0x94,(byte) 0x62,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(7,10,-1,0,9,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x84,(byte) 0x4a,(byte) 0x4a,(byte) 0x24,(byte) 0x10,(byte) 0x10,(byte) 0x48,(byte) 0xa4,(byte) 0xa4,(byte) 0x42, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(7,10,-1,0,9,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x10,(byte) 0x7c,(byte) 0x92,(byte) 0x12,(byte) 0x12,(byte) 0x14,(byte) 0x38,(byte) 0x50,(byte) 0x90,(byte) 0x92,(byte) 0x7c,(byte) 0x10, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(7,12,-1,1,9,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x48,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0x48, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(6,8,-1,-1,9,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0x90,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(4,3,-3,-7,9,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(1,11,-4,0,9,ch33data); + +/* char: 0x1f */ + +static final byte[] ch31data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch31 = new BitmapCharRec(2,2,-4,-2,9,ch31data); + +/* char: 0x1e */ + +static final byte[] ch30data = { +(byte) 0x5c,(byte) 0xa2,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x22,(byte) 0x1c, +}; + +static final BitmapCharRec ch30 = new BitmapCharRec(7,10,-1,0,9,ch30data); + +/* char: 0x1d */ + +static final byte[] ch29data = { +(byte) 0x80,(byte) 0x40,(byte) 0xfe,(byte) 0x10,(byte) 0xfe,(byte) 0x4,(byte) 0x2, +}; + +static final BitmapCharRec ch29 = new BitmapCharRec(7,7,-1,0,9,ch29data); + +/* char: 0x1c */ + +static final byte[] ch28data = { +(byte) 0x44,(byte) 0x24,(byte) 0x24,(byte) 0x24,(byte) 0x24,(byte) 0x24,(byte) 0xfe, +}; + +static final BitmapCharRec ch28 = new BitmapCharRec(7,7,-1,0,9,ch28data); + +/* char: 0x1b */ + +static final byte[] ch27data = { +(byte) 0xfe,(byte) 0x0,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch27 = new BitmapCharRec(7,12,-1,2,9,ch27data); + +/* char: 0x1a */ + +static final byte[] ch26data = { +(byte) 0xfc,(byte) 0x0,(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4, +}; + +static final BitmapCharRec ch26 = new BitmapCharRec(6,12,-2,2,9,ch26data); + +/* char: 0x19 */ + +static final byte[] ch25data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch25 = new BitmapCharRec(1,15,-4,3,9,ch25data); + +/* char: 0x18 */ + +static final byte[] ch24data = { +(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch24 = new BitmapCharRec(9,7,0,3,9,ch24data); + +/* char: 0x17 */ + +static final byte[] ch23data = { +(byte) 0xff,(byte) 0x80,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0, +(byte) 0x8,(byte) 0x0, +}; + +static final BitmapCharRec ch23 = new BitmapCharRec(9,9,0,-3,9,ch23data); + +/* char: 0x16 */ + +static final byte[] ch22data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0xf8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8, +}; + +static final BitmapCharRec ch22 = new BitmapCharRec(5,15,0,3,9,ch22data); + +/* char: 0x15 */ + +static final byte[] ch21data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch21 = new BitmapCharRec(5,15,-4,3,9,ch21data); + +/* char: 0x14 */ + +static final byte[] ch20data = { +(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch20 = new BitmapCharRec(9,1,0,1,9,ch20data); + +/* char: 0x13 */ + +static final byte[] ch19data = { +(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch19 = new BitmapCharRec(9,1,0,-1,9,ch19data); + +/* char: 0x12 */ + +static final byte[] ch18data = { +(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch18 = new BitmapCharRec(9,1,0,-3,9,ch18data); + +/* char: 0x11 */ + +static final byte[] ch17data = { +(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch17 = new BitmapCharRec(9,1,0,-5,9,ch17data); + +/* char: 0x10 */ + +static final byte[] ch16data = { +(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch16 = new BitmapCharRec(9,1,0,-7,9,ch16data); + +/* char: 0xf */ + +static final byte[] ch15data = { +(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0x8,(byte) 0x0, +(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0, +}; + +static final BitmapCharRec ch15 = new BitmapCharRec(9,15,0,3,9,ch15data); + +/* char: 0xe */ + +static final byte[] ch14data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch14 = new BitmapCharRec(5,9,-4,-3,9,ch14data); + +/* char: 0xd */ + +static final byte[] ch13data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8, +}; + +static final BitmapCharRec ch13 = new BitmapCharRec(5,7,-4,3,9,ch13data); + +/* char: 0xc */ + +static final byte[] ch12data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0xf8, +}; + +static final BitmapCharRec ch12 = new BitmapCharRec(5,7,0,3,9,ch12data); + +/* char: 0xb */ + +static final byte[] ch11data = { +(byte) 0xf8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8, +}; + +static final BitmapCharRec ch11 = new BitmapCharRec(5,9,0,-3,9,ch11data); + +/* char: 0xa */ + +static final byte[] ch10data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x0,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch10 = new BitmapCharRec(7,10,-1,2,9,ch10data); + +/* char: 0x9 */ + +static final byte[] ch9data = { +(byte) 0x3e,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x88,(byte) 0x98,(byte) 0xa8,(byte) 0xc8,(byte) 0x88, +}; + +static final BitmapCharRec ch9 = new BitmapCharRec(7,10,-1,2,9,ch9data); + +/* char: 0x8 */ + +static final byte[] ch8data = { +(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch8 = new BitmapCharRec(7,6,-1,0,9,ch8data); + +/* char: 0x7 */ + +static final byte[] ch7data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch7 = new BitmapCharRec(5,4,-2,-6,9,ch7data); + +/* char: 0x6 */ + +static final byte[] ch6data = { +(byte) 0x20,(byte) 0x20,(byte) 0x3c,(byte) 0x20,(byte) 0x3e,(byte) 0x0,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch6 = new BitmapCharRec(7,10,-1,2,9,ch6data); + +/* char: 0x5 */ + +static final byte[] ch5data = { +(byte) 0x22,(byte) 0x22,(byte) 0x3c,(byte) 0x22,(byte) 0x3c,(byte) 0x0,(byte) 0x78,(byte) 0x80,(byte) 0x80,(byte) 0x78, +}; + +static final BitmapCharRec ch5 = new BitmapCharRec(7,10,-1,2,9,ch5data); + +/* char: 0x4 */ + +static final byte[] ch4data = { +(byte) 0x10,(byte) 0x10,(byte) 0x1c,(byte) 0x10,(byte) 0x1e,(byte) 0x80,(byte) 0x80,(byte) 0xe0,(byte) 0x80,(byte) 0xf0, +}; + +static final BitmapCharRec ch4 = new BitmapCharRec(7,10,-1,2,9,ch4data); + +/* char: 0x3 */ + +static final byte[] ch3data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x0,(byte) 0x88,(byte) 0x88,(byte) 0xf8,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch3 = new BitmapCharRec(7,10,-1,2,9,ch3data); + +/* char: 0x2 */ + +static final byte[] ch2data = { +(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa, +}; + +static final BitmapCharRec ch2 = new BitmapCharRec(8,14,0,3,9,ch2data); + +/* char: 0x1 */ + +static final byte[] ch1data = { +(byte) 0x10,(byte) 0x38,(byte) 0x7c,(byte) 0xfe,(byte) 0x7c,(byte) 0x38,(byte) 0x10, +}; + +static final BitmapCharRec ch1 = new BitmapCharRec(7,7,-1,0,9,ch1data); + +static final BitmapCharRec[] chars = { +ch0, +ch1, +ch2, +ch3, +ch4, +ch5, +ch6, +ch7, +ch8, +ch9, +ch10, +ch11, +ch12, +ch13, +ch14, +ch15, +ch16, +ch17, +ch18, +ch19, +ch20, +ch21, +ch22, +ch23, +ch24, +ch25, +ch26, +ch27, +ch28, +ch29, +ch30, +ch31, +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +ch127, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmap9By15 = new BitmapFontRec("-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1", + 256, + 0, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica10.java b/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica10.java new file mode 100644 index 000000000..9a329f6a3 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica10.java @@ -0,0 +1,1798 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmapHelvetica10 { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(4,10,0,2,5,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(5,10,0,2,6,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(4,11,0,2,5,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(4,8,0,0,5,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(4,9,0,0,5,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(4,9,0,0,5,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(4,9,0,0,5,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0x70,(byte) 0x88,(byte) 0xc8,(byte) 0xa8,(byte) 0x98,(byte) 0x74, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(6,6,0,0,6,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(5,5,0,-1,6,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(5,8,0,0,6,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(5,9,0,0,6,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(5,9,0,0,6,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(5,9,0,0,6,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(5,9,0,0,6,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(4,9,0,0,5,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x90,(byte) 0x60,(byte) 0x50, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(5,9,0,0,6,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(3,8,0,0,2,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(3,9,1,0,2,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(2,9,0,0,2,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(2,9,1,0,2,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(4,8,0,0,5,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(4,9,0,0,5,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(4,9,0,0,5,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(4,9,0,0,5,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0x60,(byte) 0x20,(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0x80,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(4,8,0,2,5,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0x6c,(byte) 0x92,(byte) 0x90,(byte) 0x7e,(byte) 0x12,(byte) 0xec, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(7,6,0,0,8,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x20,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(5,9,0,0,5,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(5,8,0,0,5,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(5,9,0,0,5,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(5,9,0,0,5,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(5,9,0,0,5,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(5,9,0,0,5,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(4,8,0,0,5,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(5,8,-1,0,7,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(7,11,0,0,7,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(6,10,-1,0,8,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(6,11,-1,0,8,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(6,11,-1,0,8,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(6,11,-1,0,8,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0x80,(byte) 0x78,(byte) 0xc4,(byte) 0xa4,(byte) 0xa4,(byte) 0x94,(byte) 0x94,(byte) 0x8c,(byte) 0x78,(byte) 0x4, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(6,10,-1,1,8,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(5,5,0,-1,6,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x48, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(6,10,-1,0,8,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(6,11,-1,0,8,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(6,11,-1,0,8,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(6,11,-1,0,8,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(6,11,-1,0,8,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0x8c,(byte) 0x8c,(byte) 0x94,(byte) 0x94,(byte) 0xa4,(byte) 0xa4,(byte) 0xc4,(byte) 0xc4,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(6,11,-1,0,8,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0x78,(byte) 0x44,(byte) 0x42,(byte) 0x42,(byte) 0xf2,(byte) 0x42,(byte) 0x44,(byte) 0x78, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(7,8,0,0,8,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(3,10,0,0,3,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(3,11,0,0,3,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(2,11,-1,0,3,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(2,11,0,0,3,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(5,10,-1,0,7,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(5,11,-1,0,7,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(5,11,-1,0,7,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(5,11,-1,0,7,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x30,(byte) 0x10,(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(6,10,-1,2,8,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0x8f,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x48,(byte) 0x0,(byte) 0x2f,(byte) 0x80,(byte) 0x28,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x1f,(byte) 0x80, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(9,8,0,0,10,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(7,11,0,0,7,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(7,10,0,0,7,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(7,11,0,0,7,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(7,11,0,0,7,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(7,11,0,0,7,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(7,11,0,0,7,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(4,8,-1,2,6,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x21,(byte) 0x0,(byte) 0x17,(byte) 0x80,(byte) 0x13,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0xc8,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xe2,(byte) 0x0, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(9,8,0,0,9,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x27,(byte) 0x12,(byte) 0x15,(byte) 0xb,(byte) 0x48,(byte) 0x44,(byte) 0xc4,(byte) 0x42, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(8,8,0,0,9,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x21,(byte) 0x0,(byte) 0x17,(byte) 0x80,(byte) 0x13,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x48,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xc4,(byte) 0x0,(byte) 0x42,(byte) 0x0, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(9,8,0,0,9,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0xa0,(byte) 0x50,(byte) 0x28,(byte) 0x50,(byte) 0xa0, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(5,5,0,0,6,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xe0,(byte) 0xa0,(byte) 0xe0, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(3,5,0,-3,4,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(2,4,0,-3,3,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(2,2,0,2,3,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0xc0, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(2,1,0,-3,3,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x7c, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(6,10,0,2,6,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(4,8,0,2,5,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(2,2,0,-6,3,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0xe0, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(3,4,0,-3,3,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xe0,(byte) 0x40,(byte) 0xa0,(byte) 0x60, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(3,4,0,-3,3,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(5,7,0,0,6,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(4,4,0,-3,4,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xe0, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(3,1,0,-7,3,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0x38,(byte) 0x44,(byte) 0xaa,(byte) 0xb2,(byte) 0xba,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(7,7,-1,0,9,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xe0, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(3,1,0,-3,4,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x8,(byte) 0x8,(byte) 0xf8, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(5,3,-1,-2,7,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x28,(byte) 0x50,(byte) 0xa0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(5,5,0,0,6,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x20,(byte) 0xe0, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(3,5,0,-3,4,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0x38,(byte) 0x44,(byte) 0x9a,(byte) 0xa2,(byte) 0x9a,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(7,7,-1,0,9,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xa0, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(3,1,0,-7,3,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0x70,(byte) 0x88,(byte) 0x18,(byte) 0x70,(byte) 0xc8,(byte) 0x98,(byte) 0x70,(byte) 0xc0,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(5,10,0,2,6,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(1,10,-1,2,3,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0xf8,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(5,8,0,0,6,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0x90,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x90, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(4,6,0,-1,5,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0xb0,(byte) 0x48,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(5,8,0,0,6,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x40,(byte) 0x70,(byte) 0xa8,(byte) 0xa0,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x10, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(5,8,0,1,6,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(1,8,-1,2,3,ch161data); + +/* char: 0xa0 */ + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,3,null); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0x98,(byte) 0x64, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(6,2,0,-3,7,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(3,10,0,2,3,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(1,10,-1,2,3,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(3,10,0,2,3,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0xf0, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(4,6,0,0,5,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0xa0,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(4,8,0,2,5,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0x88,(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(5,6,0,0,6,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x28,(byte) 0x28,(byte) 0x54,(byte) 0x54,(byte) 0x92,(byte) 0x92, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(7,6,0,0,8,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(5,6,0,0,6,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(4,6,0,0,5,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x60,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x40, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(3,8,0,0,4,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(4,6,0,0,5,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0,(byte) 0xa0, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(3,6,0,0,4,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x8,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(5,8,0,2,6,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(5,8,0,2,6,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(5,6,0,0,6,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(5,6,0,0,6,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(7,6,0,0,8,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(1,8,0,0,2,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0x90,(byte) 0x90,(byte) 0xa0,(byte) 0xc0,(byte) 0xa0,(byte) 0x90,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(4,8,0,0,5,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(1,9,0,1,2,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(1,8,0,0,2,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(5,8,0,0,6,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0x70,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(5,8,0,2,6,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x30, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(4,8,0,0,4,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(4,6,0,0,5,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68,(byte) 0x8,(byte) 0x8, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(5,8,0,0,6,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0x80,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(4,6,0,0,5,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(5,8,0,0,6,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(5,6,0,0,5,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0x80,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(2,3,0,-5,3,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xfc, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(6,1,0,2,6,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0x88,(byte) 0x50,(byte) 0x50,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(5,5,0,-3,6,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(2,10,0,2,3,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(3,8,0,0,3,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(2,10,-1,2,3,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0xf8, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(5,8,-1,0,7,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(7,8,0,0,7,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0x88,(byte) 0x88,(byte) 0x50,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(5,8,-1,0,7,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(9,8,0,0,9,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(7,8,0,0,7,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(6,8,-1,0,8,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(5,8,0,0,5,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x70,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(5,8,-1,0,7,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(5,8,-1,0,7,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0x2,(byte) 0x7c,(byte) 0x8c,(byte) 0x94,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(7,9,-1,1,8,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(5,8,-1,0,7,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(6,8,-1,0,8,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0x8c,(byte) 0x8c,(byte) 0x94,(byte) 0x94,(byte) 0xa4,(byte) 0xa4,(byte) 0xc4,(byte) 0xc4, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(6,8,-1,0,8,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xaa,(byte) 0xaa,(byte) 0xc6,(byte) 0xc6,(byte) 0x82, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(7,8,-1,0,9,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(4,8,-1,0,6,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0x88,(byte) 0x88,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0xa0,(byte) 0x90,(byte) 0x88, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(5,8,-1,0,7,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(4,8,0,0,5,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(1,8,-1,0,3,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(6,8,-1,0,8,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x8c,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(6,8,-1,0,8,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xf8, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(5,8,-1,0,6,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(5,8,-1,0,7,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xf0,(byte) 0x88,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x88,(byte) 0xf0, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(6,8,-1,0,8,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(6,8,-1,0,8,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(5,8,-1,0,7,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(7,8,0,0,7,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x9b,(byte) 0x0,(byte) 0xa4,(byte) 0x80,(byte) 0xa4,(byte) 0x80,(byte) 0xa2,(byte) 0x40,(byte) 0x92,(byte) 0x40,(byte) 0x4d,(byte) 0x40, +(byte) 0x20,(byte) 0x80,(byte) 0x1f,(byte) 0x0, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(10,10,0,2,11,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(4,8,-1,0,6,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(3,5,-1,-1,6,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xf0,(byte) 0x0,(byte) 0xf0, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(4,3,0,-2,5,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(3,5,-1,-1,6,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(2,8,0,2,3,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(1,6,-1,0,3,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(5,8,0,0,6,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(5,8,0,0,6,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0xf8, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(5,8,0,0,6,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(5,8,0,0,6,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xf8, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(5,8,0,0,6,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x10,(byte) 0x10,(byte) 0xf8,(byte) 0x90,(byte) 0x50,(byte) 0x50,(byte) 0x30,(byte) 0x10, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(5,8,0,0,6,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(5,8,0,0,6,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x40,(byte) 0x30,(byte) 0x8,(byte) 0x8,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(5,8,0,0,6,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(2,8,-1,0,6,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(5,8,0,0,6,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(3,8,0,0,3,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0x80, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(1,1,-1,0,3,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xf8, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(5,1,-1,-3,7,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(2,3,0,2,3,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(5,5,0,-1,6,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0xa0,(byte) 0x40,(byte) 0xa0, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(3,3,0,-5,4,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(3,10,-1,2,4,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(3,10,0,2,4,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(2,3,-1,-5,3,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x64,(byte) 0x98,(byte) 0x98,(byte) 0xa4,(byte) 0x60,(byte) 0x50,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(6,8,-1,0,8,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x26,(byte) 0x29,(byte) 0x16,(byte) 0x10,(byte) 0x8,(byte) 0x68,(byte) 0x94,(byte) 0x64, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(8,8,0,0,9,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x20,(byte) 0x70,(byte) 0xa8,(byte) 0x28,(byte) 0x70,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x20, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(5,9,0,1,6,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x50,(byte) 0x50,(byte) 0xf8,(byte) 0x28,(byte) 0x7c,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(6,7,0,0,6,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0xa0,(byte) 0xa0, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(3,2,-1,-6,4,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(1,8,-1,0,3,ch33data); + +/* char: 0x20 ' ' */ + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,3,null); + +static final BitmapCharRec[] chars = { +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmapHelvetica10 = new BitmapFontRec("-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1", + 224, + 32, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica12.java b/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica12.java new file mode 100644 index 000000000..e27431c4e --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica12.java @@ -0,0 +1,1808 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmapHelvetica12 { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x30,(byte) 0x50,(byte) 0x50,(byte) 0x48,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(5,12,-1,3,7,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(5,12,-1,3,7,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x90,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(5,13,-1,3,7,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(5,9,-1,0,7,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(5,10,-1,0,7,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(5,10,-1,0,7,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(5,10,-1,0,7,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0xb8,(byte) 0x44,(byte) 0x64,(byte) 0x54,(byte) 0x4c,(byte) 0x44,(byte) 0x3a, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(7,7,0,0,7,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(5,5,-1,-1,7,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(5,9,-1,0,7,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(5,10,-1,0,7,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(5,10,-1,0,7,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(5,10,-1,0,7,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(5,10,-1,0,7,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(5,10,-1,0,7,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x50,(byte) 0x30,(byte) 0x68, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(5,10,-1,0,7,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(3,9,0,0,3,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(3,10,0,0,3,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(2,10,-1,0,3,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(2,10,0,0,3,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(5,9,-1,0,7,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(5,10,-1,0,7,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(5,10,-1,0,7,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(5,10,-1,0,7,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0x60,(byte) 0x10,(byte) 0x20,(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(5,10,-1,3,7,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0x77,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x7f,(byte) 0x80,(byte) 0x8,(byte) 0x80,(byte) 0x88,(byte) 0x80,(byte) 0x77,(byte) 0x0, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(9,7,-1,0,11,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x30,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(6,10,-1,0,7,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(6,9,-1,0,7,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(6,10,-1,0,7,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(6,10,-1,0,7,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(6,10,-1,0,7,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(6,10,-1,0,7,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0xb0,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xb0,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(5,9,-1,0,7,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(6,9,-1,0,8,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(7,12,-1,0,9,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(6,11,-1,0,8,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(6,12,-1,0,8,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(6,12,-1,0,8,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(6,12,-1,0,8,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0x80,(byte) 0x0,(byte) 0x5e,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x50,(byte) 0x80,(byte) 0x48,(byte) 0x80,(byte) 0x44,(byte) 0x80,(byte) 0x44,(byte) 0x80,(byte) 0x42,(byte) 0x80, +(byte) 0x21,(byte) 0x0,(byte) 0x1e,(byte) 0x80,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(10,11,0,1,10,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(5,5,-1,-1,7,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x24, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(8,11,-1,0,10,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(8,12,-1,0,10,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x14,(byte) 0x8, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(8,12,-1,0,10,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x8,(byte) 0x4, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(8,12,-1,0,10,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x8,(byte) 0x10, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(8,12,-1,0,10,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(7,12,-1,0,9,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0x7c,(byte) 0x42,(byte) 0x41,(byte) 0x41,(byte) 0xf1,(byte) 0x41,(byte) 0x41,(byte) 0x42,(byte) 0x7c, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(8,9,0,0,9,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(3,11,0,0,3,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(3,12,0,0,3,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(2,12,-1,0,3,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(2,12,0,0,3,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x28, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(6,11,-1,0,8,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(6,12,-1,0,8,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(6,12,-1,0,8,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(6,12,-1,0,8,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x30,(byte) 0x8,(byte) 0x8,(byte) 0x3c,(byte) 0x42,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(7,12,-1,3,9,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0x8f,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x88,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x4f,(byte) 0x80,(byte) 0x48,(byte) 0x0,(byte) 0x28,(byte) 0x0,(byte) 0x28,(byte) 0x0, +(byte) 0x1f,(byte) 0x80, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(9,9,-1,0,11,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(7,12,-1,0,9,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(7,11,-1,0,9,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(7,12,-1,0,9,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(7,12,-1,0,9,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(7,12,-1,0,9,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(7,12,-1,0,9,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(5,9,-1,3,7,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x21,(byte) 0x0,(byte) 0x17,(byte) 0x80,(byte) 0x15,(byte) 0x0,(byte) 0xb,(byte) 0x0,(byte) 0xc9,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0x22,(byte) 0x0, +(byte) 0xe1,(byte) 0x0, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(9,9,0,0,10,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x47,(byte) 0x80,(byte) 0x22,(byte) 0x0,(byte) 0x11,(byte) 0x0,(byte) 0x14,(byte) 0x80,(byte) 0x4b,(byte) 0x0,(byte) 0x48,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xc2,(byte) 0x0, +(byte) 0x41,(byte) 0x0, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(9,9,0,0,10,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x41,(byte) 0x0,(byte) 0x27,(byte) 0x80,(byte) 0x15,(byte) 0x0,(byte) 0x13,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xc2,(byte) 0x0, +(byte) 0x41,(byte) 0x0, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(9,9,0,0,10,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0xa0,(byte) 0x50,(byte) 0x28,(byte) 0x50,(byte) 0xa0, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(5,5,-1,-1,7,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xe0,(byte) 0xa0,(byte) 0xe0, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(3,5,-1,-4,5,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(2,5,-1,-3,4,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(3,4,0,3,3,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0x80, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(1,1,-1,-3,3,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x68,(byte) 0x3c, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(6,12,0,3,7,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xe8,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(5,10,-1,3,7,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(2,2,0,-8,2,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x20,(byte) 0xe0, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(3,5,0,-3,4,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xf0,(byte) 0x40,(byte) 0x20,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(4,5,0,-3,4,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(5,7,-1,0,7,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(4,4,0,-4,5,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xf0, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(4,1,0,-8,4,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x41,(byte) 0x0,(byte) 0x94,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0x98,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0x9c,(byte) 0x80,(byte) 0x41,(byte) 0x0, +(byte) 0x3e,(byte) 0x0, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(9,9,-1,0,11,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xf0, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(4,1,0,-3,5,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfc, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(6,4,-1,-2,8,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x28,(byte) 0x50,(byte) 0xa0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(5,5,-1,-1,7,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x20,(byte) 0xe0, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(3,5,-1,-4,5,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x41,(byte) 0x0,(byte) 0x9c,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0xa0,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0x9c,(byte) 0x80,(byte) 0x41,(byte) 0x0, +(byte) 0x3e,(byte) 0x0, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(9,9,-1,0,11,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xa0, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(3,1,0,-8,3,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x30,(byte) 0x48,(byte) 0x88,(byte) 0x88,(byte) 0x90,(byte) 0x60,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(5,12,0,3,6,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(1,11,-1,2,3,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(5,9,-1,0,7,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0x84,(byte) 0x78,(byte) 0x48,(byte) 0x48,(byte) 0x78,(byte) 0x84, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(6,6,0,-1,7,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0xb0,(byte) 0x48,(byte) 0x20,(byte) 0x20,(byte) 0xf0,(byte) 0x40,(byte) 0x40,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(5,9,-1,0,7,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x40,(byte) 0x70,(byte) 0xc8,(byte) 0xa0,(byte) 0xa0,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x10, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(5,9,-1,1,7,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(1,10,-1,3,3,ch161data); + +/* char: 0xa0 */ + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,4,null); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0x98,(byte) 0x64, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(6,2,0,-3,7,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xc0, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(4,12,0,3,4,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(1,12,-1,3,3,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0x30,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x30, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(4,12,0,3,4,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xf0,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0xf0, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(4,7,-1,0,6,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x90,(byte) 0x88,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(5,10,-1,3,7,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x84, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(6,7,0,0,6,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(9,7,0,0,9,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(5,7,-1,0,7,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(5,7,-1,0,7,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x60,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x40, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(3,9,0,0,3,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x80,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(4,7,-1,0,6,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0,(byte) 0xa0, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(3,7,-1,0,4,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(5,10,-1,3,7,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(5,10,-1,3,7,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(5,7,-1,0,7,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(5,7,-1,0,7,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xda,(byte) 0xa4, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(7,7,-1,0,9,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(1,9,-1,0,3,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xc0,(byte) 0xc0,(byte) 0xa0,(byte) 0x90,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(5,9,-1,0,6,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(2,12,0,3,3,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(1,9,-1,0,3,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(5,9,-1,0,7,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(5,10,-1,3,7,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x30, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(4,9,0,0,3,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(5,7,-1,0,7,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68,(byte) 0x8,(byte) 0x8, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(5,9,-1,0,7,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(5,7,-1,0,7,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(5,9,-1,0,7,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(6,7,-1,0,7,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0xc0,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(2,3,0,-6,3,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xfe, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(7,1,0,2,7,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0x88,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(5,3,0,-5,6,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(2,12,0,3,3,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(4,9,0,0,4,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(2,12,-1,3,3,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xfe,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0xfe, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(7,9,-1,0,9,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(7,9,-1,0,9,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0x82,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(7,9,-1,0,9,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80, +(byte) 0x88,(byte) 0x80, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(9,9,-1,0,11,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(7,9,-1,0,9,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(6,9,-1,0,8,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(7,9,0,0,7,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x4,(byte) 0x18,(byte) 0x60,(byte) 0x80,(byte) 0x84,(byte) 0x78, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(6,9,-1,0,8,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x88,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(6,9,-1,0,8,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0x3d,(byte) 0x42,(byte) 0x85,(byte) 0x89,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(8,9,-1,0,10,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(6,9,-1,0,8,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(8,9,-1,0,10,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xa2,(byte) 0xc2,(byte) 0x82, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(7,9,-1,0,9,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80, +(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(9,9,-1,0,11,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(5,9,-1,0,7,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0x82,(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xe0,(byte) 0xa0,(byte) 0x90,(byte) 0x88,(byte) 0x84, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(7,9,-1,0,8,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(5,9,-1,0,7,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(1,9,-1,0,3,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(7,9,-1,0,9,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0x3a,(byte) 0x46,(byte) 0x82,(byte) 0x82,(byte) 0x8e,(byte) 0x80,(byte) 0x80,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(7,9,-1,0,9,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(6,9,-1,0,8,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(6,9,-1,0,8,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xf8,(byte) 0x84,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x84,(byte) 0xf8, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(7,9,-1,0,9,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0x3c,(byte) 0x42,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(7,9,-1,0,9,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(6,9,-1,0,8,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(7,9,-1,0,9,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x9b,(byte) 0x0,(byte) 0xa6,(byte) 0x80,(byte) 0xa2,(byte) 0x40,(byte) 0xa2,(byte) 0x40,(byte) 0x92,(byte) 0x40,(byte) 0x4d,(byte) 0x40, +(byte) 0x60,(byte) 0x80,(byte) 0x1f,(byte) 0x0, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(10,10,-1,1,12,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x20,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(5,9,-1,0,7,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc0, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(6,5,-1,-1,7,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xf8,(byte) 0x0,(byte) 0xf8, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(5,3,-1,-2,7,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0xc,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(6,5,0,-1,7,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(2,8,0,2,3,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(1,6,-1,0,3,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x78,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(5,9,-1,0,7,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(5,9,-1,0,7,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0xf8, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(5,9,-1,0,7,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(5,9,-1,0,7,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xf8, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(5,9,-1,0,7,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x8,(byte) 0x8,(byte) 0xfc,(byte) 0x88,(byte) 0x48,(byte) 0x28,(byte) 0x28,(byte) 0x18,(byte) 0x8, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(6,9,0,0,7,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(5,9,-1,0,7,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(5,9,-1,0,7,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x20, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(3,9,-1,0,7,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(5,9,-1,0,7,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(4,9,0,0,4,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0x80, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(1,1,-1,0,3,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xf8, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(5,1,-1,-3,8,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(2,3,-1,2,4,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(5,5,-1,-1,7,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0xa0,(byte) 0x40,(byte) 0xa0, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(3,3,-1,-6,5,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(3,12,0,3,4,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(3,12,-1,3,4,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0x80,(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(2,3,-1,-6,3,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x72,(byte) 0x8c,(byte) 0x84,(byte) 0x8a,(byte) 0x50,(byte) 0x30,(byte) 0x48,(byte) 0x48,(byte) 0x30, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(7,9,-1,0,9,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x23,(byte) 0x0,(byte) 0x14,(byte) 0x80,(byte) 0x14,(byte) 0x80,(byte) 0x13,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x68,(byte) 0x0,(byte) 0x94,(byte) 0x0,(byte) 0x94,(byte) 0x0, +(byte) 0x62,(byte) 0x0, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(9,9,-1,0,11,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x20,(byte) 0x70,(byte) 0xa8,(byte) 0xa8,(byte) 0x28,(byte) 0x70,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x20, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(5,10,-1,1,7,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x50,(byte) 0x50,(byte) 0x50,(byte) 0xfc,(byte) 0x28,(byte) 0xfc,(byte) 0x28,(byte) 0x28, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(6,8,0,0,7,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0xa0,(byte) 0xa0,(byte) 0xa0, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(3,3,-1,-6,5,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(1,9,-1,0,3,ch33data); + +/* char: 0x20 ' ' */ + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,4,null); + +static final BitmapCharRec[] chars = { +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmapHelvetica12 = new BitmapFontRec("-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", + 224, + 32, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica18.java b/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica18.java new file mode 100644 index 000000000..baf95d818 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmapHelvetica18.java @@ -0,0 +1,1917 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmapHelvetica18 { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0x70,(byte) 0x70,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x66, +(byte) 0x66, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(8,17,-1,4,10,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xe3,(byte) 0x0,(byte) 0xc1,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xe3,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(9,18,-1,4,11,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0x70,(byte) 0x70,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x18, +(byte) 0xc,(byte) 0x6, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(8,18,-1,4,10,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x66,(byte) 0x66, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(8,13,-1,0,10,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x66,(byte) 0x3c,(byte) 0x18, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(8,14,-1,0,10,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x6, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(8,14,-1,0,10,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x30, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(8,14,-1,0,10,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0xce,(byte) 0x0,(byte) 0x7f,(byte) 0x80,(byte) 0x31,(byte) 0x80,(byte) 0x78,(byte) 0xc0,(byte) 0x6c,(byte) 0xc0,(byte) 0x66,(byte) 0xc0,(byte) 0x63,(byte) 0xc0,(byte) 0x31,(byte) 0x80, +(byte) 0x3f,(byte) 0xc0,(byte) 0xe,(byte) 0x60, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(11,10,0,0,11,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x18,(byte) 0x18,(byte) 0x0,(byte) 0xff,(byte) 0xff,(byte) 0x0,(byte) 0x18,(byte) 0x18, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(8,8,-1,-1,10,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x36,(byte) 0x0,(byte) 0x36,(byte) 0x0, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(9,13,-1,0,11,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x26,(byte) 0x0,(byte) 0x2d,(byte) 0x0,(byte) 0x19,(byte) 0x0, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(9,14,-1,0,11,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(9,14,-1,0,11,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(9,14,-1,0,11,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x30,(byte) 0x0, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(9,14,-1,0,11,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xe3,(byte) 0xdf,(byte) 0xce,(byte) 0x0,(byte) 0x4c,(byte) 0x5a,(byte) 0x32, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(8,14,-1,0,10,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x4c,(byte) 0x0,(byte) 0x38,(byte) 0x0,(byte) 0x36,(byte) 0x0,(byte) 0x60,(byte) 0x0, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(9,14,-1,0,11,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x0,(byte) 0xd8,(byte) 0xd8, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(5,13,0,0,4,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0xcc,(byte) 0x78,(byte) 0x30, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(6,14,1,0,4,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x0,(byte) 0xc0,(byte) 0x60,(byte) 0x30, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(4,14,0,0,4,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x0,(byte) 0x30,(byte) 0x60,(byte) 0xc0, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(4,14,0,0,4,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x36,(byte) 0x36, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(8,13,-1,0,10,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x66,(byte) 0x3c,(byte) 0x18, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(8,14,-1,0,10,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x6, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(8,14,-1,0,10,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x18,(byte) 0x30,(byte) 0x60, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(8,14,-1,0,10,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0x78,(byte) 0x6c,(byte) 0xc,(byte) 0x38,(byte) 0x3e,(byte) 0x7f,(byte) 0x63,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0x7f,(byte) 0x3e, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(8,14,-1,4,10,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0x75,(byte) 0xe0,(byte) 0xef,(byte) 0xf8,(byte) 0xc7,(byte) 0x18,(byte) 0xc6,(byte) 0x0,(byte) 0xe6,(byte) 0x0,(byte) 0x7f,(byte) 0xf8,(byte) 0xe,(byte) 0x18,(byte) 0xc6,(byte) 0x18, +(byte) 0xef,(byte) 0xf0,(byte) 0x7d,(byte) 0xe0, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(13,10,-1,0,15,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x38,(byte) 0x6c,(byte) 0x6c,(byte) 0x38, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(7,14,-1,0,9,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x6c,(byte) 0x6c, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(7,13,-1,0,9,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x4c,(byte) 0x5a,(byte) 0x32, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(7,14,-1,0,9,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x66,(byte) 0x3c,(byte) 0x18, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(7,14,-1,0,9,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x30,(byte) 0x18,(byte) 0xc, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(7,14,-1,0,9,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x18,(byte) 0x30,(byte) 0x60, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(7,14,-1,0,9,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0xdc,(byte) 0xde,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0xdc,(byte) 0xdc,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0x7c,(byte) 0x38, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(7,14,-1,0,9,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(10,14,-1,0,12,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(12,18,-1,0,14,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0x19,(byte) 0x80, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(11,17,-1,0,13,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(11,18,-1,0,13,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(11,18,-1,0,13,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(11,18,-1,0,13,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0xc7,(byte) 0xc0,(byte) 0xff,(byte) 0xf0,(byte) 0x78,(byte) 0x38,(byte) 0x38,(byte) 0x18,(byte) 0x6c,(byte) 0x1c,(byte) 0x6e,(byte) 0xc,(byte) 0x67,(byte) 0xc,(byte) 0x63,(byte) 0x8c, +(byte) 0x61,(byte) 0xcc,(byte) 0x70,(byte) 0xdc,(byte) 0x30,(byte) 0x78,(byte) 0x38,(byte) 0x38,(byte) 0x1f,(byte) 0xfc,(byte) 0x7,(byte) 0xcc, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(14,14,0,0,15,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80, +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(10,9,0,0,10,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xd,(byte) 0x80, +(byte) 0xd,(byte) 0x80, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(13,17,-1,0,15,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x9,(byte) 0x80, +(byte) 0xb,(byte) 0x40,(byte) 0x6,(byte) 0x40, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(13,18,-1,0,15,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0xc0, +(byte) 0x7,(byte) 0x80,(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(13,18,-1,0,15,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x3,(byte) 0x0, +(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0xc0, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(13,18,-1,0,15,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x3,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(13,18,-1,0,15,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc3,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xcc,(byte) 0x60, +(byte) 0xcc,(byte) 0x60,(byte) 0xd8,(byte) 0x60,(byte) 0xd8,(byte) 0x60,(byte) 0xf0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x13,(byte) 0x0, +(byte) 0x16,(byte) 0x80,(byte) 0xc,(byte) 0x80, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(11,18,-1,0,13,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0x7f,(byte) 0x80,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0xfc,(byte) 0x30,(byte) 0xfc,(byte) 0x30, +(byte) 0x60,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0x7f,(byte) 0xc0,(byte) 0x7f,(byte) 0x80, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(12,14,0,0,13,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0xcc, +(byte) 0xcc, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(6,17,0,0,6,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0xcc, +(byte) 0x78,(byte) 0x30, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(6,18,0,0,6,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0, +(byte) 0x60,(byte) 0x30, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(4,18,-2,0,6,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x30, +(byte) 0x60,(byte) 0xc0, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(4,18,0,0,6,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0, +(byte) 0x33,(byte) 0x0, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(9,17,-1,0,11,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0, +(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(9,18,-1,0,11,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(9,18,-1,0,11,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0, +(byte) 0x18,(byte) 0x0,(byte) 0x30,(byte) 0x0, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(9,18,-1,0,11,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x1b,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30, +(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70, +(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(12,18,-1,4,14,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0xc1,(byte) 0xff,(byte) 0xc1,(byte) 0xff,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x3f,(byte) 0x80,(byte) 0x31,(byte) 0xfe,(byte) 0x31,(byte) 0xfe, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xd,(byte) 0x80,(byte) 0xd,(byte) 0x80,(byte) 0x7,(byte) 0xff,(byte) 0x7,(byte) 0xff, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(16,14,-1,0,18,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(12,18,0,0,12,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0x19,(byte) 0x80, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(12,17,0,0,12,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x13,(byte) 0x0, +(byte) 0x16,(byte) 0x80,(byte) 0xc,(byte) 0x80, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(12,18,0,0,12,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(12,18,0,0,12,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(12,18,0,0,12,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(12,18,0,0,12,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0x7c,(byte) 0xfe,(byte) 0xc6,(byte) 0xc6,(byte) 0xe0,(byte) 0x70,(byte) 0x38,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x18, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(7,14,-1,4,10,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xfc,(byte) 0x6,(byte) 0xd8,(byte) 0x6,(byte) 0x78,(byte) 0x73,(byte) 0x38,(byte) 0xf9,(byte) 0x18,(byte) 0x99,(byte) 0x88, +(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x98,(byte) 0x60,(byte) 0xf8,(byte) 0x30,(byte) 0x70,(byte) 0x30, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(14,13,0,0,15,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x30,(byte) 0xf8,(byte) 0x30,(byte) 0xf8,(byte) 0x18,(byte) 0x60,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x18,(byte) 0x66,(byte) 0x98,(byte) 0x62,(byte) 0xf8,(byte) 0x63,(byte) 0x70, +(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0xe0,(byte) 0x60,(byte) 0x60,(byte) 0x60, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(13,13,-1,0,15,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x19,(byte) 0xf8,(byte) 0xd,(byte) 0xb0,(byte) 0xc,(byte) 0xf0,(byte) 0x66,(byte) 0x70,(byte) 0x62,(byte) 0x30,(byte) 0x63,(byte) 0x10, +(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0xe0,(byte) 0x60,(byte) 0x60,(byte) 0x60, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(13,13,-1,0,15,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0x90,(byte) 0xd8,(byte) 0x6c,(byte) 0x36,(byte) 0x36,(byte) 0x6c,(byte) 0xd8,(byte) 0x90, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(7,8,-1,-1,9,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x70,(byte) 0xd8,(byte) 0x88,(byte) 0x88,(byte) 0xd8,(byte) 0x70, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(5,8,-1,-6,7,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0xe0,(byte) 0x60, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(3,8,-1,-5,6,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0xf0,(byte) 0xd8,(byte) 0x18,(byte) 0x70,(byte) 0x60, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(5,5,0,4,5,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(2,2,-1,-4,4,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x32,(byte) 0x72,(byte) 0xf2,(byte) 0xf2,(byte) 0xf2,(byte) 0xf2, +(byte) 0x72,(byte) 0x3f, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(8,18,-1,4,10,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xdb,(byte) 0xff,(byte) 0xe7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(8,14,-1,4,10,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0xc0,(byte) 0x60,(byte) 0x30, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(4,3,0,-11,4,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0x70,(byte) 0xf8,(byte) 0x98,(byte) 0x30,(byte) 0x30,(byte) 0x98,(byte) 0xf8,(byte) 0x70, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(5,8,0,-5,6,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xf8,(byte) 0xf8,(byte) 0x60,(byte) 0x30,(byte) 0x18,(byte) 0x98,(byte) 0xf8,(byte) 0x70, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(5,8,0,-5,6,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xff,(byte) 0xff,(byte) 0x0,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xff,(byte) 0xff,(byte) 0x18,(byte) 0x18,(byte) 0x18, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(8,11,-1,0,10,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x70,(byte) 0xd8,(byte) 0x88,(byte) 0xd8,(byte) 0x70, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(5,5,-1,-8,7,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xf8, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(5,1,0,-12,5,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0xf,(byte) 0x80,(byte) 0x30,(byte) 0x60,(byte) 0x40,(byte) 0x10,(byte) 0x48,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x89,(byte) 0x8,(byte) 0x8f,(byte) 0x88,(byte) 0x88,(byte) 0x48, +(byte) 0x88,(byte) 0x48,(byte) 0x4f,(byte) 0x90,(byte) 0x40,(byte) 0x10,(byte) 0x30,(byte) 0x60,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(13,13,-1,0,14,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xf8,(byte) 0xf8, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(5,2,-1,-4,7,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(9,5,-1,-3,11,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x12,(byte) 0x36,(byte) 0x6c,(byte) 0xd8,(byte) 0xd8,(byte) 0x6c,(byte) 0x36,(byte) 0x12, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(7,8,-1,-1,9,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x68,(byte) 0xd8,(byte) 0x48,(byte) 0x38,(byte) 0xc8,(byte) 0x70, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(5,8,-1,-6,7,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0xf,(byte) 0x80,(byte) 0x30,(byte) 0x60,(byte) 0x40,(byte) 0x10,(byte) 0x47,(byte) 0x10,(byte) 0x88,(byte) 0x88,(byte) 0x90,(byte) 0x8,(byte) 0x90,(byte) 0x8,(byte) 0x90,(byte) 0x8, +(byte) 0x88,(byte) 0x88,(byte) 0x47,(byte) 0x10,(byte) 0x40,(byte) 0x10,(byte) 0x30,(byte) 0x60,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(13,13,-1,0,15,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xd8,(byte) 0xd8, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(5,2,0,-11,6,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0x3c,(byte) 0x7e,(byte) 0xc3,(byte) 0xc3,(byte) 0x7,(byte) 0xe,(byte) 0x3e,(byte) 0x73,(byte) 0xe3,(byte) 0xc3,(byte) 0xc7,(byte) 0x6e,(byte) 0x7c,(byte) 0xf0,(byte) 0xc3,(byte) 0xc3, +(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(8,18,-1,4,10,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(2,17,-1,3,4,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xff,(byte) 0x18,(byte) 0xff,(byte) 0x3c,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(8,13,-1,0,10,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0xc3,(byte) 0xff,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xff,(byte) 0xc3, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(8,7,-1,-3,10,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0xdf,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x7e,(byte) 0x0,(byte) 0x30,(byte) 0x0, +(byte) 0x60,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x3f,(byte) 0x0,(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(9,13,0,0,10,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x10,(byte) 0x10,(byte) 0x3e,(byte) 0x7f,(byte) 0x6b,(byte) 0xc8,(byte) 0xc8,(byte) 0xc8,(byte) 0xc8,(byte) 0x6b,(byte) 0x7f,(byte) 0x3e,(byte) 0x4,(byte) 0x4, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(8,14,-1,2,10,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(2,14,-2,4,6,ch161data); + +/* char: 0xa0 */ + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,5,null); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0xcc,(byte) 0x7e,(byte) 0x33, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(8,3,-1,-4,10,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0xc0,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0xc,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0x60,(byte) 0xc0, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(6,18,0,4,6,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(2,18,-1,4,4,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0xc,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0x18,(byte) 0xc, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(6,18,0,4,6,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xfe,(byte) 0xfe,(byte) 0xc0,(byte) 0x60,(byte) 0x30,(byte) 0x18,(byte) 0xc,(byte) 0x6,(byte) 0xfe,(byte) 0xfe, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(7,10,-1,0,9,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0x70,(byte) 0x70,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(8,14,-1,4,10,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0xc3,(byte) 0xe7,(byte) 0x66,(byte) 0x3c,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x66,(byte) 0xe7,(byte) 0xc3, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(8,10,-1,0,10,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x39,(byte) 0xc0,(byte) 0x29,(byte) 0x40,(byte) 0x69,(byte) 0x60,(byte) 0x66,(byte) 0x60,(byte) 0x66,(byte) 0x60,(byte) 0xc6,(byte) 0x30, +(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(12,10,-1,0,14,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(8,10,-1,0,10,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(8,10,-1,0,10,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x18,(byte) 0x38,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfc,(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(6,13,0,0,6,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0x78,(byte) 0xfc,(byte) 0xc6,(byte) 0x6,(byte) 0x3e,(byte) 0xfc,(byte) 0xc0,(byte) 0xc6,(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(7,10,-1,0,9,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xe0,(byte) 0xd8,(byte) 0xd8, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(5,10,-1,0,6,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3d,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0xc1,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x3d,(byte) 0x80, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(9,14,-1,4,11,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xe3,(byte) 0x0,(byte) 0xc1,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xe3,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xde,(byte) 0x0, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(9,14,-1,4,11,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, +(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(9,10,-1,0,11,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xe3,(byte) 0xdf,(byte) 0xce, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(8,10,-1,0,10,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xe7,(byte) 0x30, +(byte) 0xde,(byte) 0xf0,(byte) 0xcc,(byte) 0x60, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(12,10,-1,0,14,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(2,14,-1,0,4,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0xc7,(byte) 0xc6,(byte) 0xce,(byte) 0xcc,(byte) 0xd8,(byte) 0xf8,(byte) 0xf0,(byte) 0xd8,(byte) 0xcc,(byte) 0xc6,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(8,14,-1,0,9,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0xe0,(byte) 0xf0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x0, +(byte) 0x30,(byte) 0x30, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(4,18,1,4,4,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(2,14,-1,0,4,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xe3,(byte) 0xdf,(byte) 0xce,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(8,14,-1,0,10,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0x1c,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x3d,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0xc1,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x3d,(byte) 0x80, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(9,14,-1,4,11,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfc,(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x3c,(byte) 0x1c, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(6,14,0,0,6,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(8,10,-1,0,10,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x3d,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x80, +(byte) 0x7f,(byte) 0x80,(byte) 0x3d,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(9,14,-1,0,11,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x3e,(byte) 0x7f,(byte) 0x63,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0x7f,(byte) 0x3e, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(8,10,-1,0,10,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0xde,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xe3,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xe3,(byte) 0x0, +(byte) 0xff,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(9,14,-1,0,11,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(7,10,-1,0,9,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(2,5,-1,-9,4,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(10,2,0,4,10,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0x82,(byte) 0xc6,(byte) 0x6c,(byte) 0x38,(byte) 0x10, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(7,5,-1,-8,9,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xf0,(byte) 0xf0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0xf0,(byte) 0xf0, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(4,18,0,4,5,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x10,(byte) 0x30,(byte) 0x30,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(5,14,0,0,5,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xf0,(byte) 0xf0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xf0,(byte) 0xf0, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(4,18,-1,4,5,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0xc,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(10,14,-1,0,12,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80, +(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(12,14,-1,0,14,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0xc0,(byte) 0x60,(byte) 0xe0,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x31,(byte) 0x80,(byte) 0x1b,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, +(byte) 0x1b,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xe0,(byte) 0xc0,(byte) 0x60, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(11,14,-1,0,13,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x1c,(byte) 0x38,(byte) 0x34,(byte) 0x2c,(byte) 0x36,(byte) 0x6c,(byte) 0x36,(byte) 0x6c,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0x66, +(byte) 0x62,(byte) 0x46,(byte) 0x63,(byte) 0xc6,(byte) 0xc3,(byte) 0xc3,(byte) 0xc1,(byte) 0x83,(byte) 0xc1,(byte) 0x83,(byte) 0xc1,(byte) 0x83, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(16,14,-1,0,18,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x30,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(12,14,-1,0,14,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(11,14,-1,0,13,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0, +(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(10,14,-1,0,12,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0x3f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0xe0,(byte) 0xe0,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0xe0,(byte) 0x3,(byte) 0xc0,(byte) 0x1f,(byte) 0x0, +(byte) 0x7c,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x60,(byte) 0xe0,(byte) 0xe0,(byte) 0x7f,(byte) 0xc0,(byte) 0x1f,(byte) 0x0, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(11,14,-1,0,13,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(10,14,-1,0,12,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0x0,(byte) 0x30,(byte) 0xf,(byte) 0xb0,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0xf0,(byte) 0x61,(byte) 0xb0,(byte) 0xe1,(byte) 0xb8,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(13,15,-1,1,15,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(10,14,-1,0,12,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, +(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(13,14,-1,0,15,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc3,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xcc,(byte) 0x60, +(byte) 0xcc,(byte) 0x60,(byte) 0xd8,(byte) 0x60,(byte) 0xf0,(byte) 0x60,(byte) 0xf0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(11,14,-1,0,13,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0xc3,(byte) 0xc,(byte) 0xc3,(byte) 0xc,(byte) 0xc7,(byte) 0x8c,(byte) 0xc4,(byte) 0x8c,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xd8,(byte) 0x6c,(byte) 0xd8,(byte) 0x6c, +(byte) 0xf0,(byte) 0x3c,(byte) 0xf0,(byte) 0x3c,(byte) 0xe0,(byte) 0x1c,(byte) 0xe0,(byte) 0x1c,(byte) 0xc0,(byte) 0xc,(byte) 0xc0,(byte) 0xc, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(14,14,-1,0,16,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xff,(byte) 0xff,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(8,14,-1,0,10,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0xc0,(byte) 0x70,(byte) 0xc0,(byte) 0xe0,(byte) 0xc1,(byte) 0xc0,(byte) 0xc3,(byte) 0x80,(byte) 0xc7,(byte) 0x0,(byte) 0xce,(byte) 0x0,(byte) 0xfc,(byte) 0x0,(byte) 0xf8,(byte) 0x0, +(byte) 0xdc,(byte) 0x0,(byte) 0xce,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x80,(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xe0, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(12,14,-1,0,13,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0x3c,(byte) 0x7e,(byte) 0xe7,(byte) 0xc3,(byte) 0xc3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(8,14,-1,0,10,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(2,14,-2,0,6,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xff,(byte) 0xe0,(byte) 0xff,(byte) 0xe0, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(11,14,-1,0,13,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0xf,(byte) 0xb0,(byte) 0x3f,(byte) 0xf0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x30,(byte) 0xc1,(byte) 0xf0,(byte) 0xc1,(byte) 0xf0,(byte) 0xc0,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xe0,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(12,14,-1,0,14,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(9,14,-1,0,11,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(9,14,-1,0,11,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, +(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(11,14,-1,0,13,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(12,14,-1,0,14,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0xc0,(byte) 0xc0,(byte) 0xe0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(11,14,-1,0,13,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, +(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(12,14,0,0,12,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1f,(byte) 0xf0,(byte) 0x38,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x67,(byte) 0x70,(byte) 0xcf,(byte) 0xf8,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0x66, +(byte) 0xcc,(byte) 0x66,(byte) 0xcc,(byte) 0x63,(byte) 0xc6,(byte) 0x33,(byte) 0x67,(byte) 0x73,(byte) 0x63,(byte) 0xb3,(byte) 0x30,(byte) 0x6,(byte) 0x1c,(byte) 0xe,(byte) 0xf,(byte) 0xfc, +(byte) 0x3,(byte) 0xf0, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(16,17,-1,3,18,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x38,(byte) 0x1c,(byte) 0xe,(byte) 0xc6,(byte) 0xc6,(byte) 0xfe,(byte) 0x7c, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(7,14,-1,0,10,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0xc0,(byte) 0xf0,(byte) 0x3c,(byte) 0xe,(byte) 0x3,(byte) 0xe,(byte) 0x3c,(byte) 0xf0,(byte) 0xc0, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(8,9,-1,0,10,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xfe,(byte) 0xfe,(byte) 0x0,(byte) 0x0,(byte) 0xfe,(byte) 0xfe, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(7,6,-2,-2,11,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0x3,(byte) 0xf,(byte) 0x3c,(byte) 0x70,(byte) 0xc0,(byte) 0x70,(byte) 0x3c,(byte) 0xf,(byte) 0x3, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(8,9,-1,0,10,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(2,13,-1,3,5,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(2,10,-1,0,5,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0x7c,(byte) 0xfe,(byte) 0xc6,(byte) 0x3,(byte) 0x3,(byte) 0x3b,(byte) 0x7f,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc7,(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(8,13,-1,0,10,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x3c,(byte) 0x7e,(byte) 0xe7,(byte) 0xc3,(byte) 0xc3,(byte) 0x66,(byte) 0x7e,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xe7,(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(8,13,-1,0,10,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x60,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xc,(byte) 0x6,(byte) 0x3,(byte) 0xff,(byte) 0xff, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(8,13,-1,0,10,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x3c,(byte) 0x7e,(byte) 0xe3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xfe,(byte) 0xdc,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0x7f,(byte) 0x3c, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(8,13,-1,0,10,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0x7c,(byte) 0xfe,(byte) 0xc7,(byte) 0xc3,(byte) 0x3,(byte) 0x3,(byte) 0xc7,(byte) 0xfe,(byte) 0xfc,(byte) 0xc0,(byte) 0xc0,(byte) 0xfe,(byte) 0xfe, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(8,13,-1,0,10,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x33,(byte) 0x0, +(byte) 0x33,(byte) 0x0,(byte) 0x1b,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(9,13,-1,0,10,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0x3c,(byte) 0x7e,(byte) 0xc7,(byte) 0xc3,(byte) 0x3,(byte) 0x7,(byte) 0x1e,(byte) 0x1c,(byte) 0x6,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(8,13,-1,0,10,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xff,(byte) 0xff,(byte) 0xc0,(byte) 0xe0,(byte) 0x70,(byte) 0x38,(byte) 0x1c,(byte) 0xe,(byte) 0x7,(byte) 0x3,(byte) 0xc3,(byte) 0xfe,(byte) 0x3c, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(8,13,-1,0,10,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xf8,(byte) 0xf8,(byte) 0x18, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(5,13,-2,0,10,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x3c,(byte) 0x7e,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x66,(byte) 0x7e,(byte) 0x3c, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(8,13,-1,0,10,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0x30,(byte) 0x30,(byte) 0x10,(byte) 0x10,(byte) 0x18,(byte) 0x18, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(5,14,0,0,5,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(2,2,-1,0,5,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xff,(byte) 0xff, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(8,2,-1,-4,11,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(2,5,-1,3,5,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xff,(byte) 0xff,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(8,10,-1,0,10,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0x88,(byte) 0x70,(byte) 0x70,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(5,6,-1,-8,7,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x60,(byte) 0x60, +(byte) 0xc0,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(4,18,-1,4,6,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x10,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0x60, +(byte) 0x30,(byte) 0x10, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(4,18,-1,4,6,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(2,5,-1,-9,4,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x3c,(byte) 0x70,(byte) 0x7e,(byte) 0xe0,(byte) 0xe7,(byte) 0xc0,(byte) 0xc3,(byte) 0x80,(byte) 0xc3,(byte) 0xc0,(byte) 0xc6,(byte) 0xc0,(byte) 0xee,(byte) 0xc0,(byte) 0x7c,(byte) 0x0, +(byte) 0x3c,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x7e,(byte) 0x0,(byte) 0x3c,(byte) 0x0, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(12,13,-1,0,13,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x18,(byte) 0x78,(byte) 0x18,(byte) 0xfc,(byte) 0xc,(byte) 0xcc,(byte) 0xc,(byte) 0xcc,(byte) 0x6,(byte) 0xfc,(byte) 0x6,(byte) 0x78,(byte) 0x3,(byte) 0x0,(byte) 0x7b,(byte) 0x0, +(byte) 0xfd,(byte) 0x80,(byte) 0xcd,(byte) 0x80,(byte) 0xcc,(byte) 0xc0,(byte) 0xfc,(byte) 0xc0,(byte) 0x78,(byte) 0x60, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(14,13,-1,0,16,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0xeb,(byte) 0x80,(byte) 0xc9,(byte) 0x80,(byte) 0x9,(byte) 0x80,(byte) 0xf,(byte) 0x0, +(byte) 0x3e,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0xe8,(byte) 0x0,(byte) 0xc8,(byte) 0x0,(byte) 0xcb,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x8,(byte) 0x0, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(9,16,-1,2,10,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x24,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x12,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x12,(byte) 0x0, +(byte) 0x7f,(byte) 0xc0,(byte) 0x7f,(byte) 0xc0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(10,13,0,0,10,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0x90,(byte) 0x90,(byte) 0xd8,(byte) 0xd8,(byte) 0xd8, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(5,5,0,-9,5,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(2,14,-2,0,6,ch33data); + +/* char: 0x20 ' ' */ + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,5,null); + +static final BitmapCharRec[] chars = { +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmapHelvetica18 = new BitmapFontRec("-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1", + 224, + 32, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman10.java b/src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman10.java new file mode 100644 index 000000000..00cf2975c --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman10.java @@ -0,0 +1,1797 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmapTimesRoman10 { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0x80,(byte) 0xc0,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0x90,(byte) 0xb8,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(5,9,0,2,5,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0xc0,(byte) 0x80,(byte) 0xe0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(4,9,0,2,5,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0x80,(byte) 0xc0,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0x90,(byte) 0xb8,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(5,10,0,2,5,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(5,7,0,0,5,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(5,8,0,0,5,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(5,8,0,0,5,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(5,8,0,0,5,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0x80,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0x48,(byte) 0x38,(byte) 0x4, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(6,7,1,1,5,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(5,5,0,0,6,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(4,7,0,0,5,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0xa0,(byte) 0x50, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(4,8,0,0,5,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(4,8,0,0,5,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(4,8,0,0,5,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(4,8,0,0,5,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0xd8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(5,8,0,0,5,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0xa0,(byte) 0x70,(byte) 0x40, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(4,8,0,0,5,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(3,7,0,0,4,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(3,8,0,0,4,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(3,8,0,0,4,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(3,8,0,0,4,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(3,7,0,0,4,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(3,8,0,0,4,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(3,8,0,0,4,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(3,8,0,0,4,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x60,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x60, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(3,8,0,3,4,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0xd8,(byte) 0xa0,(byte) 0x70,(byte) 0x28,(byte) 0xd8, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(5,5,0,0,6,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x40,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(3,8,0,0,4,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(3,7,0,0,4,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(4,8,0,0,4,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(3,8,0,0,4,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(3,8,0,0,4,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(3,8,0,0,4,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0xe0,(byte) 0x50,(byte) 0x50,(byte) 0x60,(byte) 0x50,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(4,7,0,0,5,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x70,(byte) 0x48,(byte) 0x70,(byte) 0x40,(byte) 0xe0, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(5,7,0,0,6,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x38,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(7,10,0,0,8,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x28, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(7,9,0,0,8,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(7,10,0,0,8,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(7,10,0,0,8,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(7,10,0,0,8,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0x80,(byte) 0x7c,(byte) 0x66,(byte) 0x52,(byte) 0x52,(byte) 0x4a,(byte) 0x66,(byte) 0x3e,(byte) 0x1, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(8,9,0,1,8,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(5,5,0,0,6,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(6,9,0,0,7,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(6,10,0,0,7,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(6,10,0,0,7,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(6,10,0,0,7,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(6,10,0,0,7,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0xe4,(byte) 0x4c,(byte) 0x4c,(byte) 0x54,(byte) 0x54,(byte) 0x64,(byte) 0xee,(byte) 0x0,(byte) 0x50,(byte) 0x28, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(7,10,0,0,8,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0xf8,(byte) 0x4c,(byte) 0x44,(byte) 0xe4,(byte) 0x44,(byte) 0x4c,(byte) 0xf8, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(6,7,0,0,7,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0xa0, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(3,9,0,0,4,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(3,10,0,0,4,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(3,10,0,0,4,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(3,10,0,0,4,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x50, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(5,9,0,0,6,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x20, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(5,10,0,0,6,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x10, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(5,10,0,0,6,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(5,10,0,0,6,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x60,(byte) 0x10,(byte) 0x20,(byte) 0x78,(byte) 0xc4,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc4,(byte) 0x7c, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(6,10,0,3,7,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0xef,(byte) 0x49,(byte) 0x78,(byte) 0x2e,(byte) 0x28,(byte) 0x39,(byte) 0x1f, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(8,7,0,0,9,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(7,10,0,0,8,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x28, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(7,9,0,0,8,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x14, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(7,10,0,0,8,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x10, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(7,10,0,0,8,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x8, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(7,10,0,0,8,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x20, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(7,10,0,0,8,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(3,7,0,2,4,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x44,(byte) 0x3e,(byte) 0x2c,(byte) 0xd4,(byte) 0x28,(byte) 0x48,(byte) 0xe4, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(7,7,0,0,8,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x4e,(byte) 0x24,(byte) 0x2a,(byte) 0xf6,(byte) 0x48,(byte) 0xc8,(byte) 0x44, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(7,7,0,0,8,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x44,(byte) 0x3e,(byte) 0x2c,(byte) 0xf4,(byte) 0x48,(byte) 0xc8,(byte) 0x44, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(7,7,0,0,8,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0xa0,(byte) 0x50,(byte) 0x50,(byte) 0xa0, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(4,4,0,-1,5,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xe0,(byte) 0x0,(byte) 0x40,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(3,5,0,-2,4,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0xe0,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(3,4,0,-3,3,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x40, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(3,3,0,3,4,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0x80, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(1,1,0,-2,2,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x7c, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(6,9,0,2,6,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0x80,(byte) 0x80,(byte) 0xe8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(5,7,0,2,5,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(2,2,0,-5,3,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0xe0, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(3,4,0,-3,3,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xe0,(byte) 0x40,(byte) 0xa0,(byte) 0x60, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(3,4,0,-3,3,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(5,7,0,0,6,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(4,4,0,-3,4,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xe0, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(3,1,0,-6,4,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0x38,(byte) 0x44,(byte) 0xaa,(byte) 0xb2,(byte) 0xba,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(7,7,-1,0,9,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xe0, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(3,1,0,-2,4,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x8,(byte) 0x8,(byte) 0xf8, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(5,3,-1,-1,7,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x50,(byte) 0xa0,(byte) 0xa0,(byte) 0x50, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(4,4,0,-1,5,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x20,(byte) 0xc0, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(3,5,0,-2,4,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0x38,(byte) 0x44,(byte) 0x9a,(byte) 0xa2,(byte) 0x9a,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(7,7,-1,0,9,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xa0, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(3,1,-1,-6,5,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0xe0,(byte) 0x90,(byte) 0x20,(byte) 0x50,(byte) 0x90,(byte) 0xa0,(byte) 0x40,(byte) 0x90,(byte) 0x70, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(4,9,0,1,5,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(1,7,0,0,2,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0x70,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0xd8,(byte) 0x50,(byte) 0x88, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(5,7,0,0,5,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0x88,(byte) 0x70,(byte) 0x50,(byte) 0x50,(byte) 0x70,(byte) 0x88, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(5,6,0,-1,5,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0xf0,(byte) 0xc8,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x50,(byte) 0x30, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(5,7,0,0,5,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x80,(byte) 0xe0,(byte) 0x90,(byte) 0x80,(byte) 0x90,(byte) 0x70,(byte) 0x10, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(4,7,0,1,5,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(1,7,-1,2,3,ch161data); + +/* char: 0xa0 */ + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,2,null); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0x98,(byte) 0x64, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(6,2,0,-2,7,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(3,9,0,2,4,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(1,9,0,2,2,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(3,9,0,2,4,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xf0,(byte) 0x90,(byte) 0x40,(byte) 0x20,(byte) 0xf0, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(4,5,0,0,5,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x30,(byte) 0x50,(byte) 0x48,(byte) 0xdc, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(6,7,1,2,5,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0xd8,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0xd8, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(5,5,0,0,6,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x28,(byte) 0x6c,(byte) 0x54,(byte) 0x92,(byte) 0xdb, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(8,5,0,0,8,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x20,(byte) 0x60,(byte) 0x50,(byte) 0x90,(byte) 0xd8, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(5,5,0,0,5,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(5,5,0,0,5,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x30,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(4,6,0,0,4,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0xe0,(byte) 0x20,(byte) 0x60,(byte) 0x80,(byte) 0xe0, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(3,5,0,0,4,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(3,5,0,0,4,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x38,(byte) 0x10,(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x70, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(5,7,0,2,5,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0xc0,(byte) 0x80,(byte) 0xe0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(4,7,0,2,5,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(4,5,0,0,5,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0xd8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(5,5,0,0,5,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0xdb,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(8,5,0,0,8,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(3,7,0,0,4,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0x98,(byte) 0x90,(byte) 0xe0,(byte) 0xa0,(byte) 0x90,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(5,7,0,0,5,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(2,9,0,2,3,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(2,7,0,0,3,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0xd8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(5,7,0,0,5,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0xe0,(byte) 0x90,(byte) 0x60,(byte) 0x40,(byte) 0xa0,(byte) 0xa0,(byte) 0x70, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(4,7,0,2,5,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x30, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(4,7,0,0,4,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(3,5,0,0,4,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0x30, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(5,7,0,0,5,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x60,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x60, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(3,5,0,0,4,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0xe0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(4,7,0,0,5,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(3,5,0,0,4,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0xc0,(byte) 0x80, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(2,2,0,-5,3,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xf8, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(5,1,0,3,5,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0xa0,(byte) 0xa0,(byte) 0x40, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(3,3,-1,-4,5,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(2,9,0,2,3,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(3,7,0,0,3,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(2,9,0,2,3,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xf8,(byte) 0x88,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x88,(byte) 0xf8, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(5,7,0,0,6,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x38,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0xee, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(7,7,0,0,8,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0xee,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0xee, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(7,7,0,0,8,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0xc9,(byte) 0x80,(byte) 0x88,(byte) 0x80,(byte) 0xdd,(byte) 0xc0, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(10,7,0,0,10,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x6c,(byte) 0x44,(byte) 0xee, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(7,7,0,0,8,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(7,7,0,0,8,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0x70,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xa8,(byte) 0xf8, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(5,7,0,0,6,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0xe0,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0xc0,(byte) 0x90,(byte) 0x70, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(4,7,0,0,5,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0xec,(byte) 0x48,(byte) 0x50,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0xf0, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(6,7,0,0,7,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0xc,(byte) 0x18,(byte) 0x70,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(6,9,0,2,7,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0xf0, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(5,7,0,0,6,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(6,7,0,0,7,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0xe4,(byte) 0x4c,(byte) 0x4c,(byte) 0x54,(byte) 0x54,(byte) 0x64,(byte) 0xee, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(7,7,0,0,8,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0xeb,(byte) 0x80,(byte) 0x49,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xe3,(byte) 0x80, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(9,7,0,0,10,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(5,7,0,0,6,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0xec,(byte) 0x48,(byte) 0x50,(byte) 0x60,(byte) 0x50,(byte) 0x48,(byte) 0xec, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(6,7,0,0,7,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0xc0,(byte) 0xa0,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x70, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(4,7,0,0,4,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(3,7,0,0,4,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0xee,(byte) 0x44,(byte) 0x44,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0xee, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(7,7,0,0,8,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0x78,(byte) 0xc4,(byte) 0x84,(byte) 0x9c,(byte) 0x80,(byte) 0xc4,(byte) 0x7c, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(6,7,0,0,7,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(5,7,0,0,6,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(5,7,0,0,6,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xf8,(byte) 0x4c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x4c,(byte) 0xf8, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(6,7,0,0,7,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0x78,(byte) 0xc4,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc4,(byte) 0x7c, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(6,7,0,0,7,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xf0,(byte) 0x48,(byte) 0x48,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0xf0, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(5,7,0,0,6,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(7,7,0,0,8,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x3e,(byte) 0x40,(byte) 0x92,(byte) 0xad,(byte) 0xa5,(byte) 0xa5,(byte) 0x9d,(byte) 0x42,(byte) 0x3c, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(8,9,0,2,9,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0xa0,(byte) 0xe0, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(3,7,0,0,4,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(3,5,0,0,5,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xf8,(byte) 0x0,(byte) 0xf8, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(5,3,0,-1,6,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(3,5,-1,0,5,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(1,7,-1,2,3,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(1,5,-1,0,3,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0xc0,(byte) 0x20,(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(4,7,0,0,5,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(4,7,0,0,5,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x90,(byte) 0xf0, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(4,7,0,0,5,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x40,(byte) 0x30, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(4,7,0,0,5,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0xe0,(byte) 0x90,(byte) 0x10,(byte) 0x10,(byte) 0xe0,(byte) 0x40,(byte) 0x70, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(4,7,0,0,5,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x10,(byte) 0x10,(byte) 0xf8,(byte) 0x90,(byte) 0x50,(byte) 0x30,(byte) 0x10, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(5,7,0,0,5,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0xe0,(byte) 0x10,(byte) 0x10,(byte) 0x60,(byte) 0x10,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(4,7,0,0,5,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xf0,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(4,7,0,0,5,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(3,7,-1,0,5,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(4,7,0,0,5,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(3,7,0,0,3,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0x80, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(1,1,-1,0,3,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xf0, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(4,1,-1,-2,7,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(1,3,-1,2,3,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(5,5,0,0,6,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0xa0,(byte) 0x40,(byte) 0xa0, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(3,3,0,-4,5,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(3,9,0,2,4,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(3,9,0,2,4,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0x40,(byte) 0xc0, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(2,2,0,-5,3,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x76,(byte) 0x8d,(byte) 0x98,(byte) 0x74,(byte) 0x6e,(byte) 0x50,(byte) 0x30, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(8,7,0,0,8,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x44,(byte) 0x2a,(byte) 0x2a,(byte) 0x56,(byte) 0xa8,(byte) 0xa4,(byte) 0x7e, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(7,7,0,0,8,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x20,(byte) 0xe0,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x80,(byte) 0x90,(byte) 0x70,(byte) 0x20, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(4,9,0,1,5,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x50,(byte) 0x50,(byte) 0xf8,(byte) 0x50,(byte) 0xf8,(byte) 0x50,(byte) 0x50, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(5,7,0,0,5,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0xa0,(byte) 0xa0, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(3,2,0,-5,4,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(1,7,-1,0,3,ch33data); + +/* char: 0x20 ' ' */ + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,2,null); + +static final BitmapCharRec[] chars = { +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmapTimesRoman10 = new BitmapFontRec("-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", + 224, + 32, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman24.java b/src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman24.java new file mode 100644 index 000000000..22d2a19a2 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTBitmapTimesRoman24.java @@ -0,0 +1,2080 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTBitmapTimesRoman24 { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 0xff */ + +static final byte[] ch255data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xf0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, +(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80,(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0, +(byte) 0xf1,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, +}; + +static final BitmapCharRec ch255 = new BitmapCharRec(11,21,0,5,11,ch255data); + +/* char: 0xfe */ + +static final byte[] ch254data = { +(byte) 0xf0,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x6e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80, +(byte) 0x6e,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0xe0,(byte) 0x0, +}; + +static final BitmapCharRec ch254 = new BitmapCharRec(10,22,-1,5,12,ch254data); + +/* char: 0xfd */ + +static final byte[] ch253data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xf0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, +(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80,(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0, +(byte) 0xf1,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch253 = new BitmapCharRec(11,22,0,5,11,ch253data); + +/* char: 0xfc */ + +static final byte[] ch252data = { +(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, +}; + +static final BitmapCharRec ch252 = new BitmapCharRec(11,16,-1,0,13,ch252data); + +/* char: 0xfb */ + +static final byte[] ch251data = { +(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x1e,(byte) 0x0, +(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch251 = new BitmapCharRec(11,17,-1,0,13,ch251data); + +/* char: 0xfa */ + +static final byte[] ch250data = { +(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x80, +(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch250 = new BitmapCharRec(11,17,-1,0,13,ch250data); + +/* char: 0xf9 */ + +static final byte[] ch249data = { +(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x2,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x38,(byte) 0x0, +(byte) 0x30,(byte) 0x0, +}; + +static final BitmapCharRec ch249 = new BitmapCharRec(11,17,-1,0,13,ch249data); + +/* char: 0xf8 */ + +static final byte[] ch248data = { +(byte) 0xc0,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x71,(byte) 0x80,(byte) 0xd0,(byte) 0xc0,(byte) 0xd8,(byte) 0xc0,(byte) 0xc8,(byte) 0xc0,(byte) 0xcc,(byte) 0xc0, +(byte) 0xc4,(byte) 0xc0,(byte) 0xc6,(byte) 0xc0,(byte) 0x63,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0xc0,(byte) 0x0,(byte) 0xc0, +}; + +static final BitmapCharRec ch248 = new BitmapCharRec(10,14,-1,1,12,ch248data); + +/* char: 0xf7 */ + +static final byte[] ch247data = { +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch247 = new BitmapCharRec(12,10,-1,-2,14,ch247data); + +/* char: 0xf6 */ + +static final byte[] ch246data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, +}; + +static final BitmapCharRec ch246 = new BitmapCharRec(10,16,-1,0,12,ch246data); + +/* char: 0xf5 */ + +static final byte[] ch245data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x27,(byte) 0x0,(byte) 0x1c,(byte) 0x80, +}; + +static final BitmapCharRec ch245 = new BitmapCharRec(10,16,-1,0,12,ch245data); + +/* char: 0xf4 */ + +static final byte[] ch244data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x1e,(byte) 0x0, +(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch244 = new BitmapCharRec(10,17,-1,0,12,ch244data); + +/* char: 0xf3 */ + +static final byte[] ch243data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x80, +(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch243 = new BitmapCharRec(10,17,-1,0,12,ch243data); + +/* char: 0xf2 */ + +static final byte[] ch242data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x2,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x38,(byte) 0x0, +(byte) 0x30,(byte) 0x0, +}; + +static final BitmapCharRec ch242 = new BitmapCharRec(10,17,-1,0,12,ch242data); + +/* char: 0xf1 */ + +static final byte[] ch241data = { +(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x6f,(byte) 0x80,(byte) 0xe7,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x27,(byte) 0x0,(byte) 0x1c,(byte) 0x80, +}; + +static final BitmapCharRec ch241 = new BitmapCharRec(11,16,-1,0,13,ch241data); + +/* char: 0xf0 */ + +static final byte[] ch240data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1f,(byte) 0x0,(byte) 0xc6,(byte) 0x0,(byte) 0x3c,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x71,(byte) 0x80, +(byte) 0xc0,(byte) 0x0, +}; + +static final BitmapCharRec ch240 = new BitmapCharRec(10,17,-1,0,12,ch240data); + +/* char: 0xef */ + +static final byte[] ch239data = { +(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0xcc,(byte) 0xcc, +}; + +static final BitmapCharRec ch239 = new BitmapCharRec(6,16,0,0,6,ch239data); + +/* char: 0xee */ + +static final byte[] ch238data = { +(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x0,(byte) 0x84,(byte) 0x48,(byte) 0x78, +(byte) 0x30, +}; + +static final BitmapCharRec ch238 = new BitmapCharRec(6,17,0,0,6,ch238data); + +/* char: 0xed */ + +static final byte[] ch237data = { +(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0x0,(byte) 0x80,(byte) 0x60,(byte) 0x38, +(byte) 0x18, +}; + +static final BitmapCharRec ch237 = new BitmapCharRec(5,17,-1,0,6,ch237data); + +/* char: 0xec */ + +static final byte[] ch236data = { +(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x0,(byte) 0x8,(byte) 0x30,(byte) 0xe0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch236 = new BitmapCharRec(5,17,0,0,6,ch236data); + +/* char: 0xeb */ + +static final byte[] ch235data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, +}; + +static final BitmapCharRec ch235 = new BitmapCharRec(9,16,-1,0,11,ch235data); + +/* char: 0xea */ + +static final byte[] ch234data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x1e,(byte) 0x0, +(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch234 = new BitmapCharRec(9,17,-1,0,11,ch234data); + +/* char: 0xe9 */ + +static final byte[] ch233data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x7,(byte) 0x0, +(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch233 = new BitmapCharRec(9,17,-1,0,11,ch233data); + +/* char: 0xe8 */ + +static final byte[] ch232data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x70,(byte) 0x0, +(byte) 0x60,(byte) 0x0, +}; + +static final BitmapCharRec ch232 = new BitmapCharRec(9,17,-1,0,11,ch232data); + +/* char: 0xe7 */ + +static final byte[] ch231data = { +(byte) 0x3c,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0, +(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x41,(byte) 0x80, +(byte) 0x63,(byte) 0x80,(byte) 0x1f,(byte) 0x0, +}; + +static final BitmapCharRec ch231 = new BitmapCharRec(9,18,-1,6,11,ch231data); + +/* char: 0xe6 */ + +static final byte[] ch230data = { +(byte) 0x70,(byte) 0xf0,(byte) 0xfb,(byte) 0xf8,(byte) 0xc7,(byte) 0x84,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0xfc, +(byte) 0x3,(byte) 0xc,(byte) 0x63,(byte) 0xc,(byte) 0x67,(byte) 0x98,(byte) 0x3c,(byte) 0xf0, +}; + +static final BitmapCharRec ch230 = new BitmapCharRec(14,12,-1,0,16,ch230data); + +/* char: 0xe5 */ + +static final byte[] ch229data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0, +(byte) 0x1c,(byte) 0x0, +}; + +static final BitmapCharRec ch229 = new BitmapCharRec(9,17,-1,0,11,ch229data); + +/* char: 0xe4 */ + +static final byte[] ch228data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x66,(byte) 0x0, +}; + +static final BitmapCharRec ch228 = new BitmapCharRec(9,16,-1,0,11,ch228data); + +/* char: 0xe3 */ + +static final byte[] ch227data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x5c,(byte) 0x0,(byte) 0x3a,(byte) 0x0, +}; + +static final BitmapCharRec ch227 = new BitmapCharRec(9,16,-1,0,11,ch227data); + +/* char: 0xe2 */ + +static final byte[] ch226data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x42,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x3c,(byte) 0x0, +(byte) 0x18,(byte) 0x0, +}; + +static final BitmapCharRec ch226 = new BitmapCharRec(9,17,-1,0,11,ch226data); + +/* char: 0xe1 */ + +static final byte[] ch225data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x7,(byte) 0x0, +(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch225 = new BitmapCharRec(9,17,-1,0,11,ch225data); + +/* char: 0xe0 */ + +static final byte[] ch224data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x70,(byte) 0x0, +(byte) 0x60,(byte) 0x0, +}; + +static final BitmapCharRec ch224 = new BitmapCharRec(9,17,-1,0,11,ch224data); + +/* char: 0xdf */ + +static final byte[] ch223data = { +(byte) 0xe7,(byte) 0x0,(byte) 0x6c,(byte) 0x80,(byte) 0x6c,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x63,(byte) 0x80, +(byte) 0x67,(byte) 0x0,(byte) 0x6c,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, +(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch223 = new BitmapCharRec(10,17,-1,0,12,ch223data); + +/* char: 0xde */ + +static final byte[] ch222data = { +(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18, +(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, +(byte) 0xfc,(byte) 0x0, +}; + +static final BitmapCharRec ch222 = new BitmapCharRec(13,17,-1,0,15,ch222data); + +/* char: 0xdd */ + +static final byte[] ch221data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3,(byte) 0xc0, +(byte) 0x3,(byte) 0x40,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x20,(byte) 0xc,(byte) 0x30,(byte) 0x1c,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0x38,(byte) 0x8,(byte) 0x30,(byte) 0xc, +(byte) 0xfc,(byte) 0x3f,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30, +}; + +static final BitmapCharRec ch221 = new BitmapCharRec(16,22,0,0,16,ch221data); + +/* char: 0xdc */ + +static final byte[] ch220data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30, +}; + +static final BitmapCharRec ch220 = new BitmapCharRec(16,21,-1,0,18,ch220data); + +/* char: 0xdb */ + +static final byte[] ch219data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x6,(byte) 0x60,(byte) 0x3,(byte) 0xc0,(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch219 = new BitmapCharRec(16,22,-1,0,18,ch219data); + +/* char: 0xda */ + +static final byte[] ch218data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30, +}; + +static final BitmapCharRec ch218 = new BitmapCharRec(16,22,-1,0,18,ch218data); + +/* char: 0xd9 */ + +static final byte[] ch217data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0x1,(byte) 0x80,(byte) 0x7,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch217 = new BitmapCharRec(16,22,-1,0,18,ch217data); + +/* char: 0xd8 */ + +static final byte[] ch216data = { +(byte) 0x20,(byte) 0x0,(byte) 0x27,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x68,(byte) 0x6,(byte) 0x64,(byte) 0x6,(byte) 0xc2,(byte) 0x3,(byte) 0xc2,(byte) 0x3, +(byte) 0xc1,(byte) 0x3,(byte) 0xc1,(byte) 0x3,(byte) 0xc0,(byte) 0x83,(byte) 0xc0,(byte) 0x83,(byte) 0xc0,(byte) 0x43,(byte) 0x60,(byte) 0x46,(byte) 0x60,(byte) 0x26,(byte) 0x38,(byte) 0x1c, +(byte) 0x1c,(byte) 0x38,(byte) 0x7,(byte) 0xe4,(byte) 0x0,(byte) 0x4, +}; + +static final BitmapCharRec ch216 = new BitmapCharRec(16,19,-1,1,18,ch216data); + +/* char: 0xd7 */ + +static final byte[] ch215data = { +(byte) 0x80,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0, +(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0x80,(byte) 0x40, +}; + +static final BitmapCharRec ch215 = new BitmapCharRec(10,11,-2,-1,14,ch215data); + +/* char: 0xd6 */ + +static final byte[] ch214data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, +(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x60, +}; + +static final BitmapCharRec ch214 = new BitmapCharRec(16,21,-1,0,18,ch214data); + +/* char: 0xd5 */ + +static final byte[] ch213data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, +(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0xe0,(byte) 0x3,(byte) 0x90, +}; + +static final BitmapCharRec ch213 = new BitmapCharRec(16,21,-1,0,18,ch213data); + +/* char: 0xd4 */ + +static final byte[] ch212data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, +(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x6,(byte) 0x60,(byte) 0x3,(byte) 0xc0,(byte) 0x1,(byte) 0x80, +}; + +static final BitmapCharRec ch212 = new BitmapCharRec(16,22,-1,0,18,ch212data); + +/* char: 0xd3 */ + +static final byte[] ch211data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, +(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30, +}; + +static final BitmapCharRec ch211 = new BitmapCharRec(16,22,-1,0,18,ch211data); + +/* char: 0xd2 */ + +static final byte[] ch210data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, +(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0x1,(byte) 0x80,(byte) 0x7,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch210 = new BitmapCharRec(16,22,-1,0,18,ch210data); + +/* char: 0xd1 */ + +static final byte[] ch209data = { +(byte) 0xf8,(byte) 0xc,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x34,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0xc4,(byte) 0x21,(byte) 0x84, +(byte) 0x21,(byte) 0x84,(byte) 0x23,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x2c,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xf0,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0xe0,(byte) 0x3,(byte) 0x90, +}; + +static final BitmapCharRec ch209 = new BitmapCharRec(16,21,-1,0,18,ch209data); + +/* char: 0xd0 */ + +static final byte[] ch208data = { +(byte) 0x7f,(byte) 0xe0,(byte) 0x18,(byte) 0x38,(byte) 0x18,(byte) 0x1c,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3, +(byte) 0xff,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x1c,(byte) 0x18,(byte) 0x38, +(byte) 0x7f,(byte) 0xe0, +}; + +static final BitmapCharRec ch208 = new BitmapCharRec(16,17,0,0,17,ch208data); + +/* char: 0xcf */ + +static final byte[] ch207data = { +(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0xfc,(byte) 0x0,(byte) 0x0,(byte) 0xcc,(byte) 0xcc, +}; + +static final BitmapCharRec ch207 = new BitmapCharRec(6,21,-1,0,8,ch207data); + +/* char: 0xce */ + +static final byte[] ch206data = { +(byte) 0x7e,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18, +(byte) 0x7e,(byte) 0x0,(byte) 0x81,(byte) 0x66,(byte) 0x3c,(byte) 0x18, +}; + +static final BitmapCharRec ch206 = new BitmapCharRec(8,22,-1,0,8,ch206data); + +/* char: 0xcd */ + +static final byte[] ch205data = { +(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0xfc,(byte) 0x0,(byte) 0x40,(byte) 0x30,(byte) 0x1c,(byte) 0xc, +}; + +static final BitmapCharRec ch205 = new BitmapCharRec(6,22,-1,0,8,ch205data); + +/* char: 0xcc */ + +static final byte[] ch204data = { +(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0xfc,(byte) 0x0,(byte) 0x8,(byte) 0x30,(byte) 0xe0,(byte) 0xc0, +}; + +static final BitmapCharRec ch204 = new BitmapCharRec(6,22,-1,0,8,ch204data); + +/* char: 0xcb */ + +static final byte[] ch203data = { +(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, +(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80, +}; + +static final BitmapCharRec ch203 = new BitmapCharRec(13,21,-1,0,15,ch203data); + +/* char: 0xca */ + +static final byte[] ch202data = { +(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, +(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20,(byte) 0xc,(byte) 0xc0,(byte) 0x7,(byte) 0x80,(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch202 = new BitmapCharRec(13,22,-1,0,15,ch202data); + +/* char: 0xc9 */ + +static final byte[] ch201data = { +(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, +(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0xc0, +}; + +static final BitmapCharRec ch201 = new BitmapCharRec(13,22,-1,0,15,ch201data); + +/* char: 0xc8 */ + +static final byte[] ch200data = { +(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, +(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x18,(byte) 0x0, +}; + +static final BitmapCharRec ch200 = new BitmapCharRec(13,22,-1,0,15,ch200data); + +/* char: 0xc7 */ + +static final byte[] ch199data = { +(byte) 0x7,(byte) 0x80,(byte) 0xc,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x7,(byte) 0xe0,(byte) 0x1e,(byte) 0x38, +(byte) 0x38,(byte) 0x8,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x4,(byte) 0x38,(byte) 0xc,(byte) 0x1c,(byte) 0x3c,(byte) 0x7,(byte) 0xe4, +}; + +static final BitmapCharRec ch199 = new BitmapCharRec(14,23,-1,6,16,ch199data); + +/* char: 0xc6 */ + +static final byte[] ch198data = { +(byte) 0xf9,(byte) 0xff,(byte) 0xf0,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x10,(byte) 0x60,(byte) 0x10,(byte) 0x10,(byte) 0x60,(byte) 0x10,(byte) 0x18,(byte) 0x60,(byte) 0x0,(byte) 0x8, +(byte) 0x60,(byte) 0x0,(byte) 0xf,(byte) 0xe0,(byte) 0x80,(byte) 0xc,(byte) 0x60,(byte) 0x80,(byte) 0x4,(byte) 0x7f,(byte) 0x80,(byte) 0x4,(byte) 0x60,(byte) 0x80,(byte) 0x6,(byte) 0x60, +(byte) 0x80,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x20,(byte) 0x1,(byte) 0x60,(byte) 0x20,(byte) 0x1,(byte) 0xe0,(byte) 0x60, +(byte) 0x3,(byte) 0xff,(byte) 0xe0, +}; + +static final BitmapCharRec ch198 = new BitmapCharRec(20,17,0,0,21,ch198data); + +/* char: 0xc5 */ + +static final byte[] ch197data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x2,(byte) 0x20,(byte) 0x0,(byte) 0x2,(byte) 0x20,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +}; + +static final BitmapCharRec ch197 = new BitmapCharRec(17,21,0,0,17,ch197data); + +/* char: 0xc4 */ + +static final byte[] ch196data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x0, +}; + +static final BitmapCharRec ch196 = new BitmapCharRec(17,21,0,0,17,ch196data); + +/* char: 0xc3 */ + +static final byte[] ch195data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x7,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0xe0,(byte) 0x0,(byte) 0x3,(byte) 0x90,(byte) 0x0, +}; + +static final BitmapCharRec ch195 = new BitmapCharRec(17,21,0,0,17,ch195data); + +/* char: 0xc2 */ + +static final byte[] ch194data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x0,(byte) 0x6,(byte) 0x60,(byte) 0x0,(byte) 0x3,(byte) 0xc0,(byte) 0x0,(byte) 0x1, +(byte) 0x80,(byte) 0x0, +}; + +static final BitmapCharRec ch194 = new BitmapCharRec(17,22,0,0,17,ch194data); + +/* char: 0xc1 */ + +static final byte[] ch193data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x0, +(byte) 0x30,(byte) 0x0, +}; + +static final BitmapCharRec ch193 = new BitmapCharRec(17,22,0,0,17,ch193data); + +/* char: 0xc0 */ + +static final byte[] ch192data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x0,(byte) 0x3, +(byte) 0x0,(byte) 0x0, +}; + +static final BitmapCharRec ch192 = new BitmapCharRec(17,22,0,0,17,ch192data); + +/* char: 0xbf */ + +static final byte[] ch191data = { +(byte) 0x3e,(byte) 0x63,(byte) 0xc1,(byte) 0xc3,(byte) 0xc3,(byte) 0xe0,(byte) 0x70,(byte) 0x30,(byte) 0x38,(byte) 0x18,(byte) 0x18,(byte) 0x8,(byte) 0x8,(byte) 0x0,(byte) 0x0,(byte) 0xc, +(byte) 0xc, +}; + +static final BitmapCharRec ch191 = new BitmapCharRec(8,17,-1,5,11,ch191data); + +/* char: 0xbe */ + +static final byte[] ch190data = { +(byte) 0x18,(byte) 0x2,(byte) 0x0,(byte) 0x8,(byte) 0x2,(byte) 0x0,(byte) 0xc,(byte) 0x7f,(byte) 0x80,(byte) 0x4,(byte) 0x22,(byte) 0x0,(byte) 0x6,(byte) 0x32,(byte) 0x0,(byte) 0x3, +(byte) 0x12,(byte) 0x0,(byte) 0x1,(byte) 0xa,(byte) 0x0,(byte) 0x71,(byte) 0x8e,(byte) 0x0,(byte) 0x88,(byte) 0x86,(byte) 0x0,(byte) 0x8c,(byte) 0xc2,(byte) 0x0,(byte) 0xc,(byte) 0x60, +(byte) 0x0,(byte) 0x8,(byte) 0x20,(byte) 0x0,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x0,(byte) 0x8c,(byte) 0x18,(byte) 0x0,(byte) 0x4c,(byte) 0xc,(byte) 0x0, +(byte) 0x38,(byte) 0x4,(byte) 0x0, +}; + +static final BitmapCharRec ch190 = new BitmapCharRec(17,17,0,0,18,ch190data); + +/* char: 0xbd */ + +static final byte[] ch189data = { +(byte) 0x30,(byte) 0x7e,(byte) 0x10,(byte) 0x22,(byte) 0x18,(byte) 0x10,(byte) 0x8,(byte) 0x18,(byte) 0xc,(byte) 0x8,(byte) 0x6,(byte) 0x4,(byte) 0x2,(byte) 0x6,(byte) 0xfb,(byte) 0x46, +(byte) 0x21,(byte) 0x26,(byte) 0x21,(byte) 0x9c,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x20,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x30,(byte) 0x60,(byte) 0x18, +(byte) 0x20,(byte) 0x8, +}; + +static final BitmapCharRec ch189 = new BitmapCharRec(15,17,-1,0,18,ch189data); + +/* char: 0xbc */ + +static final byte[] ch188data = { +(byte) 0x30,(byte) 0x4,(byte) 0x10,(byte) 0x4,(byte) 0x18,(byte) 0xff,(byte) 0x8,(byte) 0x44,(byte) 0xc,(byte) 0x64,(byte) 0x6,(byte) 0x24,(byte) 0x2,(byte) 0x14,(byte) 0xfb,(byte) 0x1c, +(byte) 0x21,(byte) 0xc,(byte) 0x21,(byte) 0x84,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x20,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x30,(byte) 0x60,(byte) 0x18, +(byte) 0x20,(byte) 0x8, +}; + +static final BitmapCharRec ch188 = new BitmapCharRec(16,17,-1,0,18,ch188data); + +/* char: 0xbb */ + +static final byte[] ch187data = { +(byte) 0x88,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x66,(byte) 0x0, +(byte) 0xcc,(byte) 0x0,(byte) 0x88,(byte) 0x0, +}; + +static final BitmapCharRec ch187 = new BitmapCharRec(9,10,-2,-1,12,ch187data); + +/* char: 0xba */ + +static final byte[] ch186data = { +(byte) 0xfc,(byte) 0x0,(byte) 0x78,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0x78, +}; + +static final BitmapCharRec ch186 = new BitmapCharRec(6,9,-1,-8,8,ch186data); + +/* char: 0xb9 */ + +static final byte[] ch185data = { +(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x60,(byte) 0x20, +}; + +static final BitmapCharRec ch185 = new BitmapCharRec(5,10,-1,-7,7,ch185data); + +/* char: 0xb8 */ + +static final byte[] ch184data = { +(byte) 0x78,(byte) 0xcc,(byte) 0xc,(byte) 0x3c,(byte) 0x30,(byte) 0x10, +}; + +static final BitmapCharRec ch184 = new BitmapCharRec(6,6,-1,6,8,ch184data); + +/* char: 0xb7 */ + +static final byte[] ch183data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch183 = new BitmapCharRec(2,2,-2,-6,6,ch183data); + +/* char: 0xb6 */ + +static final byte[] ch182data = { +(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0, +(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x39,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0xf9,(byte) 0x0, +(byte) 0xf9,(byte) 0x0,(byte) 0xf9,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0x39,(byte) 0x0,(byte) 0x1f,(byte) 0x80, +}; + +static final BitmapCharRec ch182 = new BitmapCharRec(9,22,-1,5,11,ch182data); + +/* char: 0xb5 */ + +static final byte[] ch181data = { +(byte) 0x40,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x5c,(byte) 0xe0,(byte) 0x7e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0xe1,(byte) 0xc0, +}; + +static final BitmapCharRec ch181 = new BitmapCharRec(11,17,-1,5,13,ch181data); + +/* char: 0xb4 */ + +static final byte[] ch180data = { +(byte) 0x80,(byte) 0x60,(byte) 0x38,(byte) 0x18, +}; + +static final BitmapCharRec ch180 = new BitmapCharRec(5,4,-2,-13,8,ch180data); + +/* char: 0xb3 */ + +static final byte[] ch179data = { +(byte) 0x70,(byte) 0x88,(byte) 0x8c,(byte) 0xc,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x8c,(byte) 0x4c,(byte) 0x38, +}; + +static final BitmapCharRec ch179 = new BitmapCharRec(6,10,0,-7,7,ch179data); + +/* char: 0xb2 */ + +static final byte[] ch178data = { +(byte) 0xfc,(byte) 0x44,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x8,(byte) 0xc,(byte) 0x8c,(byte) 0x4c,(byte) 0x38, +}; + +static final BitmapCharRec ch178 = new BitmapCharRec(6,10,0,-7,7,ch178data); + +/* char: 0xb1 */ + +static final byte[] ch177data = { +(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch177 = new BitmapCharRec(12,15,-1,0,14,ch177data); + +/* char: 0xb0 */ + +static final byte[] ch176data = { +(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38, +}; + +static final BitmapCharRec ch176 = new BitmapCharRec(7,7,-1,-10,9,ch176data); + +/* char: 0xaf */ + +static final byte[] ch175data = { +(byte) 0xfc,(byte) 0xfc, +}; + +static final BitmapCharRec ch175 = new BitmapCharRec(6,2,-1,-14,8,ch175data); + +/* char: 0xae */ + +static final byte[] ch174data = { +(byte) 0x7,(byte) 0xf0,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x60,(byte) 0x3,(byte) 0x0,(byte) 0x47,(byte) 0x19,(byte) 0x0,(byte) 0xc2, +(byte) 0x31,(byte) 0x80,(byte) 0x82,(byte) 0x20,(byte) 0x80,(byte) 0x82,(byte) 0x40,(byte) 0x80,(byte) 0x83,(byte) 0xe0,(byte) 0x80,(byte) 0x82,(byte) 0x30,(byte) 0x80,(byte) 0x82,(byte) 0x10, +(byte) 0x80,(byte) 0xc2,(byte) 0x11,(byte) 0x80,(byte) 0x42,(byte) 0x31,(byte) 0x0,(byte) 0x67,(byte) 0xe3,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0, +(byte) 0x7,(byte) 0xf0,(byte) 0x0, +}; + +static final BitmapCharRec ch174 = new BitmapCharRec(17,17,-1,0,19,ch174data); + +/* char: 0xad */ + +static final byte[] ch173data = { +(byte) 0xfe,(byte) 0xfe, +}; + +static final BitmapCharRec ch173 = new BitmapCharRec(7,2,-1,-5,9,ch173data); + +/* char: 0xac */ + +static final byte[] ch172data = { +(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0, +}; + +static final BitmapCharRec ch172 = new BitmapCharRec(12,7,-1,-3,14,ch172data); + +/* char: 0xab */ + +static final byte[] ch171data = { +(byte) 0x8,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x33,(byte) 0x0, +(byte) 0x19,(byte) 0x80,(byte) 0x8,(byte) 0x80, +}; + +static final BitmapCharRec ch171 = new BitmapCharRec(9,10,-2,-1,13,ch171data); + +/* char: 0xaa */ + +static final byte[] ch170data = { +(byte) 0x7e,(byte) 0x0,(byte) 0x76,(byte) 0xcc,(byte) 0xcc,(byte) 0x7c,(byte) 0xc,(byte) 0xcc,(byte) 0x78, +}; + +static final BitmapCharRec ch170 = new BitmapCharRec(7,9,0,-8,8,ch170data); + +/* char: 0xa9 */ + +static final byte[] ch169data = { +(byte) 0x7,(byte) 0xf0,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x61,(byte) 0xc3,(byte) 0x0,(byte) 0x47,(byte) 0x71,(byte) 0x0,(byte) 0xc4, +(byte) 0x19,(byte) 0x80,(byte) 0x8c,(byte) 0x0,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x80,(byte) 0x8c,(byte) 0x0, +(byte) 0x80,(byte) 0xc4,(byte) 0x19,(byte) 0x80,(byte) 0x47,(byte) 0x31,(byte) 0x0,(byte) 0x61,(byte) 0xe3,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0, +(byte) 0x7,(byte) 0xf0,(byte) 0x0, +}; + +static final BitmapCharRec ch169 = new BitmapCharRec(17,17,-1,0,19,ch169data); + +/* char: 0xa8 */ + +static final byte[] ch168data = { +(byte) 0xcc,(byte) 0xcc, +}; + +static final BitmapCharRec ch168 = new BitmapCharRec(6,2,-1,-14,8,ch168data); + +/* char: 0xa7 */ + +static final byte[] ch167data = { +(byte) 0x38,(byte) 0x64,(byte) 0x62,(byte) 0x6,(byte) 0xe,(byte) 0x1c,(byte) 0x38,(byte) 0x74,(byte) 0xe2,(byte) 0xc3,(byte) 0x83,(byte) 0x87,(byte) 0x4e,(byte) 0x3c,(byte) 0x38,(byte) 0x70, +(byte) 0x60,(byte) 0x46,(byte) 0x26,(byte) 0x1c, +}; + +static final BitmapCharRec ch167 = new BitmapCharRec(8,20,-2,2,12,ch167data); + +/* char: 0xa6 */ + +static final byte[] ch166data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch166 = new BitmapCharRec(2,17,-2,0,6,ch166data); + +/* char: 0xa5 */ + +static final byte[] ch165data = { +(byte) 0xf,(byte) 0xc0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1f,(byte) 0xe0,(byte) 0x3,(byte) 0x0,(byte) 0x1f,(byte) 0xe0, +(byte) 0x3,(byte) 0x0,(byte) 0x7,(byte) 0x80,(byte) 0xc,(byte) 0x80,(byte) 0xc,(byte) 0xc0,(byte) 0x18,(byte) 0x40,(byte) 0x18,(byte) 0x60,(byte) 0x30,(byte) 0x20,(byte) 0x70,(byte) 0x30, +(byte) 0xf8,(byte) 0x7c, +}; + +static final BitmapCharRec ch165 = new BitmapCharRec(14,17,0,0,14,ch165data); + +/* char: 0xa4 */ + +static final byte[] ch164data = { +(byte) 0xc0,(byte) 0x60,(byte) 0xee,(byte) 0xe0,(byte) 0x7f,(byte) 0xc0,(byte) 0x31,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x31,(byte) 0x80,(byte) 0x7f,(byte) 0xc0,(byte) 0xee,(byte) 0xe0,(byte) 0xc0,(byte) 0x60, +}; + +static final BitmapCharRec ch164 = new BitmapCharRec(11,12,-1,-3,13,ch164data); + +/* char: 0xa3 */ + +static final byte[] ch163data = { +(byte) 0xe7,(byte) 0x80,(byte) 0xbe,(byte) 0xc0,(byte) 0x78,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, +(byte) 0x30,(byte) 0x0,(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x19,(byte) 0x80, +(byte) 0xf,(byte) 0x0, +}; + +static final BitmapCharRec ch163 = new BitmapCharRec(10,17,-1,0,12,ch163data); + +/* char: 0xa2 */ + +static final byte[] ch162data = { +(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xd0,(byte) 0x0,(byte) 0xc8,(byte) 0x0,(byte) 0xc8,(byte) 0x0, +(byte) 0xc8,(byte) 0x0,(byte) 0xc4,(byte) 0x0,(byte) 0xc4,(byte) 0x0,(byte) 0x43,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0x1f,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x1,(byte) 0x0, +}; + +static final BitmapCharRec ch162 = new BitmapCharRec(9,16,-1,2,12,ch162data); + +/* char: 0xa1 */ + +static final byte[] ch161data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch161 = new BitmapCharRec(2,17,-4,5,8,ch161data); + +/* char: 0xa0 */ + +static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,6,null); + +/* char: 0x7e '~' */ + +static final byte[] ch126data = { +(byte) 0x83,(byte) 0x80,(byte) 0xc7,(byte) 0xc0,(byte) 0x7c,(byte) 0x60,(byte) 0x38,(byte) 0x20, +}; + +static final BitmapCharRec ch126 = new BitmapCharRec(11,4,-1,-5,13,ch126data); + +/* char: 0x7d '}' */ + +static final byte[] ch125data = { +(byte) 0xe0,(byte) 0x30,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x8,(byte) 0xc,(byte) 0x4,(byte) 0x3,(byte) 0x4,(byte) 0xc,(byte) 0x8,(byte) 0x18, +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x30,(byte) 0xe0, +}; + +static final BitmapCharRec ch125 = new BitmapCharRec(8,22,-1,5,10,ch125data); + +/* char: 0x7c '|' */ + +static final byte[] ch124data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch124 = new BitmapCharRec(2,17,-2,0,6,ch124data); + +/* char: 0x7b '{' */ + +static final byte[] ch123data = { +(byte) 0x7,(byte) 0xc,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x18, +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0x7, +}; + +static final BitmapCharRec ch123 = new BitmapCharRec(8,22,-1,5,10,ch123data); + +/* char: 0x7a 'z' */ + +static final byte[] ch122data = { +(byte) 0xff,(byte) 0xc3,(byte) 0x61,(byte) 0x70,(byte) 0x30,(byte) 0x38,(byte) 0x18,(byte) 0x1c,(byte) 0xe,(byte) 0x86,(byte) 0xc3,(byte) 0xff, +}; + +static final BitmapCharRec ch122 = new BitmapCharRec(8,12,-1,0,10,ch122data); + +/* char: 0x79 'y' */ + +static final byte[] ch121data = { +(byte) 0xe0,(byte) 0x0,(byte) 0xf0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, +(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80,(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0, +(byte) 0xf1,(byte) 0xe0, +}; + +static final BitmapCharRec ch121 = new BitmapCharRec(11,17,0,5,11,ch121data); + +/* char: 0x78 'x' */ + +static final byte[] ch120data = { +(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x21,(byte) 0x80,(byte) 0x33,(byte) 0x80,(byte) 0x1b,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x1a,(byte) 0x0, +(byte) 0x39,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0xf1,(byte) 0xe0, +}; + +static final BitmapCharRec ch120 = new BitmapCharRec(11,12,-1,0,13,ch120data); + +/* char: 0x77 'w' */ + +static final byte[] ch119data = { +(byte) 0x4,(byte) 0x10,(byte) 0x0,(byte) 0xe,(byte) 0x38,(byte) 0x0,(byte) 0xe,(byte) 0x38,(byte) 0x0,(byte) 0x1a,(byte) 0x28,(byte) 0x0,(byte) 0x1a,(byte) 0x64,(byte) 0x0,(byte) 0x19, +(byte) 0x64,(byte) 0x0,(byte) 0x31,(byte) 0x64,(byte) 0x0,(byte) 0x30,(byte) 0xc2,(byte) 0x0,(byte) 0x30,(byte) 0xc2,(byte) 0x0,(byte) 0x60,(byte) 0xc2,(byte) 0x0,(byte) 0x60,(byte) 0xc3, +(byte) 0x0,(byte) 0xf1,(byte) 0xe7,(byte) 0x80, +}; + +static final BitmapCharRec ch119 = new BitmapCharRec(17,12,0,0,17,ch119data); + +/* char: 0x76 'v' */ + +static final byte[] ch118data = { +(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80, +(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0xf1,(byte) 0xe0, +}; + +static final BitmapCharRec ch118 = new BitmapCharRec(11,12,0,0,11,ch118data); + +/* char: 0x75 'u' */ + +static final byte[] ch117data = { +(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0, +}; + +static final BitmapCharRec ch117 = new BitmapCharRec(11,12,-1,0,13,ch117data); + +/* char: 0x74 't' */ + +static final byte[] ch116data = { +(byte) 0x1c,(byte) 0x32,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfe,(byte) 0x70,(byte) 0x30,(byte) 0x10, +}; + +static final BitmapCharRec ch116 = new BitmapCharRec(7,15,0,0,7,ch116data); + +/* char: 0x73 's' */ + +static final byte[] ch115data = { +(byte) 0xf8,(byte) 0xc6,(byte) 0x83,(byte) 0x3,(byte) 0x7,(byte) 0x1e,(byte) 0x7c,(byte) 0x70,(byte) 0xe0,(byte) 0xc2,(byte) 0x66,(byte) 0x3e, +}; + +static final BitmapCharRec ch115 = new BitmapCharRec(8,12,-1,0,10,ch115data); + +/* char: 0x72 'r' */ + +static final byte[] ch114data = { +(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x76,(byte) 0x6e,(byte) 0xe6, +}; + +static final BitmapCharRec ch114 = new BitmapCharRec(7,12,-1,0,8,ch114data); + +/* char: 0x71 'q' */ + +static final byte[] ch113data = { +(byte) 0x3,(byte) 0xc0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1d,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80, +(byte) 0x1d,(byte) 0x80, +}; + +static final BitmapCharRec ch113 = new BitmapCharRec(10,17,-1,5,12,ch113data); + +/* char: 0x70 'p' */ + +static final byte[] ch112data = { +(byte) 0xf0,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x6e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80, +(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80, +(byte) 0xee,(byte) 0x0, +}; + +static final BitmapCharRec ch112 = new BitmapCharRec(10,17,-1,5,12,ch112data); + +/* char: 0x6f 'o' */ + +static final byte[] ch111data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch111 = new BitmapCharRec(10,12,-1,0,12,ch111data); + +/* char: 0x6e 'n' */ + +static final byte[] ch110data = { +(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x6f,(byte) 0x80,(byte) 0xe7,(byte) 0x0, +}; + +static final BitmapCharRec ch110 = new BitmapCharRec(11,12,-1,0,13,ch110data); + +/* char: 0x6d 'm' */ + +static final byte[] ch109data = { +(byte) 0xf1,(byte) 0xe3,(byte) 0xc0,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60, +(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x71,(byte) 0xe3,(byte) 0x80,(byte) 0x6f,(byte) 0x9f, +(byte) 0x0,(byte) 0xe7,(byte) 0xe,(byte) 0x0, +}; + +static final BitmapCharRec ch109 = new BitmapCharRec(18,12,-1,0,20,ch109data); + +/* char: 0x6c 'l' */ + +static final byte[] ch108data = { +(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60, +(byte) 0xe0, +}; + +static final BitmapCharRec ch108 = new BitmapCharRec(4,17,-1,0,6,ch108data); + +/* char: 0x6b 'k' */ + +static final byte[] ch107data = { +(byte) 0xf3,(byte) 0xe0,(byte) 0x61,(byte) 0xc0,(byte) 0x63,(byte) 0x80,(byte) 0x67,(byte) 0x0,(byte) 0x6e,(byte) 0x0,(byte) 0x6c,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x68,(byte) 0x0, +(byte) 0x64,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0, +(byte) 0xe0,(byte) 0x0, +}; + +static final BitmapCharRec ch107 = new BitmapCharRec(11,17,-1,0,12,ch107data); + +/* char: 0x6a 'j' */ + +static final byte[] ch106data = { +(byte) 0xc0,(byte) 0xe0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x30, +}; + +static final BitmapCharRec ch106 = new BitmapCharRec(4,22,0,5,6,ch106data); + +/* char: 0x69 'i' */ + +static final byte[] ch105data = { +(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x60, +(byte) 0x60, +}; + +static final BitmapCharRec ch105 = new BitmapCharRec(4,17,-1,0,6,ch105data); + +/* char: 0x68 'h' */ + +static final byte[] ch104data = { +(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x6f,(byte) 0x80,(byte) 0x67,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0, +(byte) 0xe0,(byte) 0x0, +}; + +static final BitmapCharRec ch104 = new BitmapCharRec(11,17,-1,0,13,ch104data); + +/* char: 0x67 'g' */ + +static final byte[] ch103data = { +(byte) 0x3f,(byte) 0x0,(byte) 0xf1,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x3f,(byte) 0xc0,(byte) 0x7f,(byte) 0x0,(byte) 0x60,(byte) 0x0, +(byte) 0x30,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, +(byte) 0x1f,(byte) 0xc0, +}; + +static final BitmapCharRec ch103 = new BitmapCharRec(11,17,-1,5,12,ch103data); + +/* char: 0x66 'f' */ + +static final byte[] ch102data = { +(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfe,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x16, +(byte) 0xe, +}; + +static final BitmapCharRec ch102 = new BitmapCharRec(7,17,0,0,7,ch102data); + +/* char: 0x65 'e' */ + +static final byte[] ch101data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch101 = new BitmapCharRec(9,12,-1,0,11,ch101data); + +/* char: 0x64 'd' */ + +static final byte[] ch100data = { +(byte) 0x1e,(byte) 0xc0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80, +(byte) 0xc1,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1d,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80, +(byte) 0x3,(byte) 0x80, +}; + +static final BitmapCharRec ch100 = new BitmapCharRec(10,17,-1,0,12,ch100data); + +/* char: 0x63 'c' */ + +static final byte[] ch99data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0x1f,(byte) 0x0, +}; + +static final BitmapCharRec ch99 = new BitmapCharRec(9,12,-1,0,11,ch99data); + +/* char: 0x62 'b' */ + +static final byte[] ch98data = { +(byte) 0x5e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, +(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x6e,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0, +(byte) 0xe0,(byte) 0x0, +}; + +static final BitmapCharRec ch98 = new BitmapCharRec(10,17,-1,0,12,ch98data); + +/* char: 0x61 'a' */ + +static final byte[] ch97data = { +(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0, +}; + +static final BitmapCharRec ch97 = new BitmapCharRec(9,12,-1,0,11,ch97data); + +/* char: 0x60 '`' */ + +static final byte[] ch96data = { +(byte) 0x60,(byte) 0xe0,(byte) 0x80,(byte) 0xc0,(byte) 0x60, +}; + +static final BitmapCharRec ch96 = new BitmapCharRec(3,5,-2,-12,7,ch96data); + +/* char: 0x5f '_' */ + +static final byte[] ch95data = { +(byte) 0xff,(byte) 0xf8,(byte) 0xff,(byte) 0xf8, +}; + +static final BitmapCharRec ch95 = new BitmapCharRec(13,2,0,5,13,ch95data); + +/* char: 0x5e '^' */ + +static final byte[] ch94data = { +(byte) 0x80,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x36,(byte) 0x0,(byte) 0x14,(byte) 0x0,(byte) 0x1c,(byte) 0x0, +(byte) 0x8,(byte) 0x0, +}; + +static final BitmapCharRec ch94 = new BitmapCharRec(9,9,-1,-8,11,ch94data); + +/* char: 0x5d ']' */ + +static final byte[] ch93data = { +(byte) 0xf8,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18, +(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xf8, +}; + +static final BitmapCharRec ch93 = new BitmapCharRec(5,21,-1,4,8,ch93data); + +/* char: 0x5c '\' */ + +static final byte[] ch92data = { +(byte) 0x6,(byte) 0x6,(byte) 0x4,(byte) 0xc,(byte) 0xc,(byte) 0x8,(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x30,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x40,(byte) 0xc0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch92 = new BitmapCharRec(7,17,0,0,7,ch92data); + +/* char: 0x5b '[' */ + +static final byte[] ch91data = { +(byte) 0xf8,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xf8, +}; + +static final BitmapCharRec ch91 = new BitmapCharRec(5,21,-2,4,8,ch91data); + +/* char: 0x5a 'Z' */ + +static final byte[] ch90data = { +(byte) 0xff,(byte) 0xf8,(byte) 0xe0,(byte) 0x18,(byte) 0x70,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x38,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0xe,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x1,(byte) 0xc0,(byte) 0x80,(byte) 0xc0,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0x70, +(byte) 0xff,(byte) 0xf0, +}; + +static final BitmapCharRec ch90 = new BitmapCharRec(13,17,-1,0,15,ch90data); + +/* char: 0x59 'Y' */ + +static final byte[] ch89data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3,(byte) 0xc0, +(byte) 0x3,(byte) 0x40,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x20,(byte) 0xc,(byte) 0x30,(byte) 0x1c,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0x38,(byte) 0x8,(byte) 0x30,(byte) 0xc, +(byte) 0xfc,(byte) 0x3f, +}; + +static final BitmapCharRec ch89 = new BitmapCharRec(16,17,0,0,16,ch89data); + +/* char: 0x58 'X' */ + +static final byte[] ch88data = { +(byte) 0xfc,(byte) 0xf,(byte) 0xc0,(byte) 0x30,(byte) 0x3,(byte) 0x80,(byte) 0x18,(byte) 0x7,(byte) 0x0,(byte) 0x8,(byte) 0xe,(byte) 0x0,(byte) 0x4,(byte) 0xc,(byte) 0x0,(byte) 0x6, +(byte) 0x18,(byte) 0x0,(byte) 0x2,(byte) 0x38,(byte) 0x0,(byte) 0x1,(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0, +(byte) 0x0,(byte) 0x3,(byte) 0xa0,(byte) 0x0,(byte) 0x3,(byte) 0x10,(byte) 0x0,(byte) 0x6,(byte) 0x8,(byte) 0x0,(byte) 0xe,(byte) 0xc,(byte) 0x0,(byte) 0x1c,(byte) 0x6,(byte) 0x0, +(byte) 0x7e,(byte) 0xf,(byte) 0x80, +}; + +static final BitmapCharRec ch88 = new BitmapCharRec(18,17,0,0,18,ch88data); + +/* char: 0x57 'W' */ + +static final byte[] ch87data = { +(byte) 0x1,(byte) 0x83,(byte) 0x0,(byte) 0x1,(byte) 0x83,(byte) 0x0,(byte) 0x1,(byte) 0x83,(byte) 0x80,(byte) 0x3,(byte) 0x87,(byte) 0x80,(byte) 0x3,(byte) 0x46,(byte) 0x80,(byte) 0x3, +(byte) 0x46,(byte) 0xc0,(byte) 0x6,(byte) 0x46,(byte) 0x40,(byte) 0x6,(byte) 0x4c,(byte) 0x40,(byte) 0x6,(byte) 0x4c,(byte) 0x60,(byte) 0xc,(byte) 0x2c,(byte) 0x60,(byte) 0xc,(byte) 0x2c, +(byte) 0x20,(byte) 0x18,(byte) 0x2c,(byte) 0x20,(byte) 0x18,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x18,(byte) 0x18, +(byte) 0xfc,(byte) 0x7e,(byte) 0x7e, +}; + +static final BitmapCharRec ch87 = new BitmapCharRec(23,17,0,0,23,ch87data); + +/* char: 0x56 'V' */ + +static final byte[] ch86data = { +(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0x3,(byte) 0xc0,(byte) 0x0,(byte) 0x3,(byte) 0x40,(byte) 0x0,(byte) 0x3, +(byte) 0x60,(byte) 0x0,(byte) 0x6,(byte) 0x20,(byte) 0x0,(byte) 0x6,(byte) 0x20,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x0,(byte) 0xc,(byte) 0x10,(byte) 0x0,(byte) 0xc,(byte) 0x18, +(byte) 0x0,(byte) 0x18,(byte) 0x8,(byte) 0x0,(byte) 0x18,(byte) 0x8,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x30,(byte) 0x4,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0, +(byte) 0xfc,(byte) 0x1f,(byte) 0x80, +}; + +static final BitmapCharRec ch86 = new BitmapCharRec(17,17,0,0,17,ch86data); + +/* char: 0x55 'U' */ + +static final byte[] ch85data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xfc,(byte) 0x1f, +}; + +static final BitmapCharRec ch85 = new BitmapCharRec(16,17,-1,0,18,ch85data); + +/* char: 0x54 'T' */ + +static final byte[] ch84data = { +(byte) 0xf,(byte) 0xc0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x83,(byte) 0x4,(byte) 0x83,(byte) 0x4,(byte) 0xc3,(byte) 0xc, +(byte) 0xff,(byte) 0xfc, +}; + +static final BitmapCharRec ch84 = new BitmapCharRec(14,17,-1,0,16,ch84data); + +/* char: 0x53 'S' */ + +static final byte[] ch83data = { +(byte) 0x9e,(byte) 0x0,(byte) 0xf1,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0xe0,(byte) 0x3,(byte) 0xc0, +(byte) 0xf,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x40,(byte) 0xc0,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0xc0, +(byte) 0x1e,(byte) 0x40, +}; + +static final BitmapCharRec ch83 = new BitmapCharRec(11,17,-1,0,13,ch83data); + +/* char: 0x52 'R' */ + +static final byte[] ch82data = { +(byte) 0xfc,(byte) 0x1e,(byte) 0x30,(byte) 0x1c,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0xc0,(byte) 0x31,(byte) 0xc0,(byte) 0x33,(byte) 0x80, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70, +(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch82 = new BitmapCharRec(15,17,-1,0,16,ch82data); + +/* char: 0x51 'Q' */ + +static final byte[] ch81data = { +(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x38,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0xe0,(byte) 0x1,(byte) 0xc0,(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c, +(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38,(byte) 0x7,(byte) 0xe0, +}; + +static final BitmapCharRec ch81 = new BitmapCharRec(16,22,-1,5,18,ch81data); + +/* char: 0x50 'P' */ + +static final byte[] ch80data = { +(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70, +(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch80 = new BitmapCharRec(13,17,-1,0,15,ch80data); + +/* char: 0x4f 'O' */ + +static final byte[] ch79data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, +(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, +(byte) 0x7,(byte) 0xe0, +}; + +static final BitmapCharRec ch79 = new BitmapCharRec(16,17,-1,0,18,ch79data); + +/* char: 0x4e 'N' */ + +static final byte[] ch78data = { +(byte) 0xf8,(byte) 0xc,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x34,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0xc4,(byte) 0x21,(byte) 0x84, +(byte) 0x21,(byte) 0x84,(byte) 0x23,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x2c,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x30,(byte) 0x4, +(byte) 0xf0,(byte) 0x1f, +}; + +static final BitmapCharRec ch78 = new BitmapCharRec(16,17,-1,0,18,ch78data); + +/* char: 0x4d 'M' */ + +static final byte[] ch77data = { +(byte) 0xf8,(byte) 0x21,(byte) 0xf8,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0xd0,(byte) 0x60,(byte) 0x20,(byte) 0xd0,(byte) 0x60,(byte) 0x21, +(byte) 0x88,(byte) 0x60,(byte) 0x21,(byte) 0x88,(byte) 0x60,(byte) 0x23,(byte) 0x8,(byte) 0x60,(byte) 0x23,(byte) 0x4,(byte) 0x60,(byte) 0x26,(byte) 0x4,(byte) 0x60,(byte) 0x26,(byte) 0x2, +(byte) 0x60,(byte) 0x2c,(byte) 0x2,(byte) 0x60,(byte) 0x2c,(byte) 0x2,(byte) 0x60,(byte) 0x38,(byte) 0x1,(byte) 0x60,(byte) 0x38,(byte) 0x1,(byte) 0x60,(byte) 0x30,(byte) 0x0,(byte) 0xe0, +(byte) 0xf0,(byte) 0x0,(byte) 0xf8, +}; + +static final BitmapCharRec ch77 = new BitmapCharRec(21,17,-1,0,22,ch77data); + +/* char: 0x4c 'L' */ + +static final byte[] ch76data = { +(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, +(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, +(byte) 0xfc,(byte) 0x0, +}; + +static final BitmapCharRec ch76 = new BitmapCharRec(13,17,-1,0,14,ch76data); + +/* char: 0x4b 'K' */ + +static final byte[] ch75data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x30,(byte) 0xe,(byte) 0x30,(byte) 0x1c,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0xe0,(byte) 0x31,(byte) 0xc0,(byte) 0x33,(byte) 0x80, +(byte) 0x3f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18, +(byte) 0xfc,(byte) 0x7e, +}; + +static final BitmapCharRec ch75 = new BitmapCharRec(16,17,-1,0,17,ch75data); + +/* char: 0x4a 'J' */ + +static final byte[] ch74data = { +(byte) 0x78,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0xc6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0x1f,(byte) 0x80, +}; + +static final BitmapCharRec ch74 = new BitmapCharRec(9,17,-1,0,11,ch74data); + +/* char: 0x49 'I' */ + +static final byte[] ch73data = { +(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, +(byte) 0xfc, +}; + +static final BitmapCharRec ch73 = new BitmapCharRec(6,17,-1,0,8,ch73data); + +/* char: 0x48 'H' */ + +static final byte[] ch72data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30, +(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x3f,(byte) 0xfe,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6, +(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0, +(byte) 0xfc,(byte) 0x1f,(byte) 0x80, +}; + +static final BitmapCharRec ch72 = new BitmapCharRec(17,17,-1,0,19,ch72data); + +/* char: 0x47 'G' */ + +static final byte[] ch71data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1e,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0xc,(byte) 0x60,(byte) 0xc,(byte) 0xc0,(byte) 0xc,(byte) 0xc0,(byte) 0xc,(byte) 0xc0,(byte) 0x3f, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x4,(byte) 0x38,(byte) 0xc,(byte) 0x1c,(byte) 0x3c, +(byte) 0x7,(byte) 0xe4, +}; + +static final BitmapCharRec ch71 = new BitmapCharRec(16,17,-1,0,18,ch71data); + +/* char: 0x46 'F' */ + +static final byte[] ch70data = { +(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x20,(byte) 0x30,(byte) 0x20, +(byte) 0x3f,(byte) 0xe0,(byte) 0x30,(byte) 0x20,(byte) 0x30,(byte) 0x20,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, +(byte) 0xff,(byte) 0xf0, +}; + +static final BitmapCharRec ch70 = new BitmapCharRec(12,17,-1,0,14,ch70data); + +/* char: 0x45 'E' */ + +static final byte[] ch69data = { +(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, +(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, +(byte) 0xff,(byte) 0xf0, +}; + +static final BitmapCharRec ch69 = new BitmapCharRec(13,17,-1,0,15,ch69data); + +/* char: 0x44 'D' */ + +static final byte[] ch68data = { +(byte) 0xff,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6, +(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x70, +(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch68 = new BitmapCharRec(15,17,-1,0,17,ch68data); + +/* char: 0x43 'C' */ + +static final byte[] ch67data = { +(byte) 0x7,(byte) 0xe0,(byte) 0x1e,(byte) 0x38,(byte) 0x38,(byte) 0x8,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x4,(byte) 0x38,(byte) 0xc,(byte) 0x1c,(byte) 0x3c, +(byte) 0x7,(byte) 0xe4, +}; + +static final BitmapCharRec ch67 = new BitmapCharRec(14,17,-1,0,16,ch67data); + +/* char: 0x42 'B' */ + +static final byte[] ch66data = { +(byte) 0xff,(byte) 0xe0,(byte) 0x30,(byte) 0x78,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x38, +(byte) 0x3f,(byte) 0xe0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70, +(byte) 0xff,(byte) 0xc0, +}; + +static final BitmapCharRec ch66 = new BitmapCharRec(14,17,-1,0,16,ch66data); + +/* char: 0x41 'A' */ + +static final byte[] ch65data = { +(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, +(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, +(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, +(byte) 0x0,(byte) 0x80,(byte) 0x0, +}; + +static final BitmapCharRec ch65 = new BitmapCharRec(17,17,0,0,17,ch65data); + +/* char: 0x40 '@' */ + +static final byte[] ch64data = { +(byte) 0x3,(byte) 0xf0,(byte) 0x0,(byte) 0xe,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x61,(byte) 0xde,(byte) 0x0,(byte) 0x63, +(byte) 0x7b,(byte) 0x0,(byte) 0xc6,(byte) 0x39,(byte) 0x80,(byte) 0xc6,(byte) 0x18,(byte) 0x80,(byte) 0xc6,(byte) 0x18,(byte) 0xc0,(byte) 0xc6,(byte) 0x18,(byte) 0x40,(byte) 0xc6,(byte) 0xc, +(byte) 0x40,(byte) 0xc3,(byte) 0xc,(byte) 0x40,(byte) 0xc3,(byte) 0x8c,(byte) 0x40,(byte) 0xe1,(byte) 0xfc,(byte) 0x40,(byte) 0x60,(byte) 0xec,(byte) 0xc0,(byte) 0x70,(byte) 0x0,(byte) 0x80, +(byte) 0x38,(byte) 0x1,(byte) 0x80,(byte) 0x1c,(byte) 0x3,(byte) 0x0,(byte) 0xf,(byte) 0xe,(byte) 0x0,(byte) 0x3,(byte) 0xf8,(byte) 0x0, +}; + +static final BitmapCharRec ch64 = new BitmapCharRec(18,20,-2,3,22,ch64data); + +/* char: 0x3f '?' */ + +static final byte[] ch63data = { +(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xe,(byte) 0x7,(byte) 0xc3,(byte) 0xc3,(byte) 0x83,(byte) 0xc6, +(byte) 0x7c, +}; + +static final BitmapCharRec ch63 = new BitmapCharRec(8,17,-2,0,11,ch63data); + +/* char: 0x3e '>' */ + +static final byte[] ch62data = { +(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x1,(byte) 0xc0,(byte) 0x7,(byte) 0x0, +(byte) 0x1c,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0xc0,(byte) 0x0, +}; + +static final BitmapCharRec ch62 = new BitmapCharRec(11,11,-1,-1,13,ch62data); + +/* char: 0x3d '=' */ + +static final byte[] ch61data = { +(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0, +}; + +static final BitmapCharRec ch61 = new BitmapCharRec(12,6,-1,-4,14,ch61data); + +/* char: 0x3c '<' */ + +static final byte[] ch60data = { +(byte) 0x0,(byte) 0x60,(byte) 0x1,(byte) 0xc0,(byte) 0x7,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x1c,(byte) 0x0, +(byte) 0x7,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x60, +}; + +static final BitmapCharRec ch60 = new BitmapCharRec(11,11,-1,-1,13,ch60data); + +/* char: 0x3b ';' */ + +static final byte[] ch59data = { +(byte) 0xc0,(byte) 0x60,(byte) 0x20,(byte) 0xe0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch59 = new BitmapCharRec(3,14,-2,3,7,ch59data); + +/* char: 0x3a ':' */ + +static final byte[] ch58data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch58 = new BitmapCharRec(2,11,-2,0,6,ch58data); + +/* char: 0x39 '9' */ + +static final byte[] ch57data = { +(byte) 0xf0,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1d,(byte) 0x80,(byte) 0x73,(byte) 0xc0, +(byte) 0x61,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x77,(byte) 0x80, +(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch57 = new BitmapCharRec(10,17,-1,0,12,ch57data); + +/* char: 0x38 '8' */ + +static final byte[] ch56data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0xe1,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x41,(byte) 0xc0,(byte) 0x61,(byte) 0x80, +(byte) 0x37,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, +(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch56 = new BitmapCharRec(10,17,-1,0,12,ch56data); + +/* char: 0x37 '7' */ + +static final byte[] ch55data = { +(byte) 0x18,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0x2,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x81,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, +(byte) 0x7f,(byte) 0xc0, +}; + +static final BitmapCharRec ch55 = new BitmapCharRec(10,17,-1,0,12,ch55data); + +/* char: 0x36 '6' */ + +static final byte[] ch54data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x7b,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc1,(byte) 0x80,(byte) 0xf3,(byte) 0x80,(byte) 0xee,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xe,(byte) 0x0, +(byte) 0x3,(byte) 0xc0, +}; + +static final BitmapCharRec ch54 = new BitmapCharRec(10,17,-1,0,12,ch54data); + +/* char: 0x35 '5' */ + +static final byte[] ch53data = { +(byte) 0x7e,(byte) 0x0,(byte) 0xe3,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x1,(byte) 0xc0, +(byte) 0x3,(byte) 0x80,(byte) 0xf,(byte) 0x80,(byte) 0x7e,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x20,(byte) 0x0,(byte) 0x20,(byte) 0x0,(byte) 0x1f,(byte) 0x80, +(byte) 0x1f,(byte) 0xc0, +}; + +static final BitmapCharRec ch53 = new BitmapCharRec(10,17,-1,0,12,ch53data); + +/* char: 0x34 '4' */ + +static final byte[] ch52data = { +(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0xc3,(byte) 0x0,(byte) 0x43,(byte) 0x0, +(byte) 0x63,(byte) 0x0,(byte) 0x23,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x13,(byte) 0x0,(byte) 0x1b,(byte) 0x0,(byte) 0xb,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x7,(byte) 0x0, +(byte) 0x3,(byte) 0x0, +}; + +static final BitmapCharRec ch52 = new BitmapCharRec(10,17,-1,0,12,ch52data); + +/* char: 0x33 '3' */ + +static final byte[] ch51data = { +(byte) 0x78,(byte) 0x0,(byte) 0xe6,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3,(byte) 0x80, +(byte) 0x7,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x83,(byte) 0x0,(byte) 0x83,(byte) 0x0,(byte) 0x47,(byte) 0x0,(byte) 0x7e,(byte) 0x0, +(byte) 0x1c,(byte) 0x0, +}; + +static final BitmapCharRec ch51 = new BitmapCharRec(9,17,-1,0,12,ch51data); + +/* char: 0x32 '2' */ + +static final byte[] ch50data = { +(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0xc0,(byte) 0x60,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x6,(byte) 0x0, +(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x81,(byte) 0x80,(byte) 0x81,(byte) 0x80,(byte) 0x43,(byte) 0x80,(byte) 0x7f,(byte) 0x0, +(byte) 0x1c,(byte) 0x0, +}; + +static final BitmapCharRec ch50 = new BitmapCharRec(10,17,-1,0,12,ch50data); + +/* char: 0x31 '1' */ + +static final byte[] ch49data = { +(byte) 0xff,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x78,(byte) 0x18, +(byte) 0x8, +}; + +static final BitmapCharRec ch49 = new BitmapCharRec(8,17,-2,0,12,ch49data); + +/* char: 0x30 '0' */ + +static final byte[] ch48data = { +(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, +(byte) 0x1e,(byte) 0x0, +}; + +static final BitmapCharRec ch48 = new BitmapCharRec(10,17,-1,0,12,ch48data); + +/* char: 0x2f '/' */ + +static final byte[] ch47data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0x30,(byte) 0x30,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0x8,(byte) 0xc,(byte) 0xc,(byte) 0x4,(byte) 0x6, +(byte) 0x6,(byte) 0x3,(byte) 0x3,(byte) 0x3, +}; + +static final BitmapCharRec ch47 = new BitmapCharRec(8,20,1,3,7,ch47data); + +/* char: 0x2e '.' */ + +static final byte[] ch46data = { +(byte) 0xc0,(byte) 0xc0, +}; + +static final BitmapCharRec ch46 = new BitmapCharRec(2,2,-2,0,6,ch46data); + +/* char: 0x2d '-' */ + +static final byte[] ch45data = { +(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0, +}; + +static final BitmapCharRec ch45 = new BitmapCharRec(12,2,-1,-6,14,ch45data); + +/* char: 0x2c ',' */ + +static final byte[] ch44data = { +(byte) 0xc0,(byte) 0x60,(byte) 0x20,(byte) 0xe0,(byte) 0xc0, +}; + +static final BitmapCharRec ch44 = new BitmapCharRec(3,5,-2,3,7,ch44data); + +/* char: 0x2b '+' */ + +static final byte[] ch43data = { +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x6,(byte) 0x0, +(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, +}; + +static final BitmapCharRec ch43 = new BitmapCharRec(12,12,-1,-1,14,ch43data); + +/* char: 0x2a '*' */ + +static final byte[] ch42data = { +(byte) 0x8,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0xc9,(byte) 0x80,(byte) 0xeb,(byte) 0x80,(byte) 0x1c,(byte) 0x0,(byte) 0xeb,(byte) 0x80,(byte) 0xc9,(byte) 0x80,(byte) 0x1c,(byte) 0x0, +(byte) 0x8,(byte) 0x0, +}; + +static final BitmapCharRec ch42 = new BitmapCharRec(9,9,-2,-8,12,ch42data); + +/* char: 0x29 ')' */ + +static final byte[] ch41data = { +(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0x18, +(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x20,(byte) 0x40,(byte) 0x80, +}; + +static final BitmapCharRec ch41 = new BitmapCharRec(6,22,-1,5,8,ch41data); + +/* char: 0x28 '(' */ + +static final byte[] ch40data = { +(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x30,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60, +(byte) 0x60,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x8,(byte) 0x4, +}; + +static final BitmapCharRec ch40 = new BitmapCharRec(6,22,-1,5,8,ch40data); + +/* char: 0x27 ''' */ + +static final byte[] ch39data = { +(byte) 0xc0,(byte) 0x60,(byte) 0x20,(byte) 0xe0,(byte) 0xc0, +}; + +static final BitmapCharRec ch39 = new BitmapCharRec(3,5,-3,-12,8,ch39data); + +/* char: 0x26 '&' */ + +static final byte[] ch38data = { +(byte) 0x3c,(byte) 0x3c,(byte) 0x7f,(byte) 0x7e,(byte) 0xe1,(byte) 0xe1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xc1,(byte) 0xa0,(byte) 0x63,(byte) 0x20,(byte) 0x37,(byte) 0x10, +(byte) 0x1e,(byte) 0x18,(byte) 0xe,(byte) 0x3e,(byte) 0xf,(byte) 0x0,(byte) 0x1d,(byte) 0x80,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0x40,(byte) 0x18,(byte) 0x40,(byte) 0xc,(byte) 0xc0, +(byte) 0x7,(byte) 0x80, +}; + +static final BitmapCharRec ch38 = new BitmapCharRec(16,17,-1,0,18,ch38data); + +/* char: 0x25 '%' */ + +static final byte[] ch37data = { +(byte) 0x30,(byte) 0x3c,(byte) 0x0,(byte) 0x18,(byte) 0x72,(byte) 0x0,(byte) 0xc,(byte) 0x61,(byte) 0x0,(byte) 0x4,(byte) 0x60,(byte) 0x80,(byte) 0x6,(byte) 0x60,(byte) 0x80,(byte) 0x3, +(byte) 0x30,(byte) 0x80,(byte) 0x1,(byte) 0x19,(byte) 0x80,(byte) 0x1,(byte) 0x8f,(byte) 0x0,(byte) 0x78,(byte) 0xc0,(byte) 0x0,(byte) 0xe4,(byte) 0x40,(byte) 0x0,(byte) 0xc2,(byte) 0x60, +(byte) 0x0,(byte) 0xc1,(byte) 0x30,(byte) 0x0,(byte) 0xc1,(byte) 0x10,(byte) 0x0,(byte) 0x61,(byte) 0x18,(byte) 0x0,(byte) 0x33,(byte) 0xfc,(byte) 0x0,(byte) 0x1e,(byte) 0xc,(byte) 0x0, +}; + +static final BitmapCharRec ch37 = new BitmapCharRec(17,16,-1,0,19,ch37data); + +/* char: 0x24 '$' */ + +static final byte[] ch36data = { +(byte) 0x4,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x3f,(byte) 0x0,(byte) 0xe5,(byte) 0xc0,(byte) 0xc4,(byte) 0xc0,(byte) 0x84,(byte) 0x60,(byte) 0x84,(byte) 0x60,(byte) 0x4,(byte) 0x60, +(byte) 0x4,(byte) 0xe0,(byte) 0x7,(byte) 0xc0,(byte) 0x7,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x3c,(byte) 0x0,(byte) 0x74,(byte) 0x0,(byte) 0x64,(byte) 0x0,(byte) 0x64,(byte) 0x20, +(byte) 0x64,(byte) 0x60,(byte) 0x34,(byte) 0xe0,(byte) 0x1f,(byte) 0x80,(byte) 0x4,(byte) 0x0,(byte) 0x4,(byte) 0x0, +}; + +static final BitmapCharRec ch36 = new BitmapCharRec(11,21,0,2,12,ch36data); + +/* char: 0x23 '#' */ + +static final byte[] ch35data = { +(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0x11,(byte) 0x0, +(byte) 0x11,(byte) 0x0,(byte) 0x11,(byte) 0x0,(byte) 0x7f,(byte) 0xe0,(byte) 0x7f,(byte) 0xe0,(byte) 0x8,(byte) 0x80,(byte) 0x8,(byte) 0x80,(byte) 0x8,(byte) 0x80,(byte) 0x8,(byte) 0x80, +(byte) 0x8,(byte) 0x80, +}; + +static final BitmapCharRec ch35 = new BitmapCharRec(11,17,-1,0,13,ch35data); + +/* char: 0x22 '"' */ + +static final byte[] ch34data = { +(byte) 0x88,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc, +}; + +static final BitmapCharRec ch34 = new BitmapCharRec(6,5,-1,-12,10,ch34data); + +/* char: 0x21 '!' */ + +static final byte[] ch33data = { +(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, +(byte) 0xc0, +}; + +static final BitmapCharRec ch33 = new BitmapCharRec(2,17,-3,0,8,ch33data); + +/* char: 0x20 ' ' */ + +static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,6,null); + +static final BitmapCharRec[] chars = { +ch32, +ch33, +ch34, +ch35, +ch36, +ch37, +ch38, +ch39, +ch40, +ch41, +ch42, +ch43, +ch44, +ch45, +ch46, +ch47, +ch48, +ch49, +ch50, +ch51, +ch52, +ch53, +ch54, +ch55, +ch56, +ch57, +ch58, +ch59, +ch60, +ch61, +ch62, +ch63, +ch64, +ch65, +ch66, +ch67, +ch68, +ch69, +ch70, +ch71, +ch72, +ch73, +ch74, +ch75, +ch76, +ch77, +ch78, +ch79, +ch80, +ch81, +ch82, +ch83, +ch84, +ch85, +ch86, +ch87, +ch88, +ch89, +ch90, +ch91, +ch92, +ch93, +ch94, +ch95, +ch96, +ch97, +ch98, +ch99, +ch100, +ch101, +ch102, +ch103, +ch104, +ch105, +ch106, +ch107, +ch108, +ch109, +ch110, +ch111, +ch112, +ch113, +ch114, +ch115, +ch116, +ch117, +ch118, +ch119, +ch120, +ch121, +ch122, +ch123, +ch124, +ch125, +ch126, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +null, +ch160, +ch161, +ch162, +ch163, +ch164, +ch165, +ch166, +ch167, +ch168, +ch169, +ch170, +ch171, +ch172, +ch173, +ch174, +ch175, +ch176, +ch177, +ch178, +ch179, +ch180, +ch181, +ch182, +ch183, +ch184, +ch185, +ch186, +ch187, +ch188, +ch189, +ch190, +ch191, +ch192, +ch193, +ch194, +ch195, +ch196, +ch197, +ch198, +ch199, +ch200, +ch201, +ch202, +ch203, +ch204, +ch205, +ch206, +ch207, +ch208, +ch209, +ch210, +ch211, +ch212, +ch213, +ch214, +ch215, +ch216, +ch217, +ch218, +ch219, +ch220, +ch221, +ch222, +ch223, +ch224, +ch225, +ch226, +ch227, +ch228, +ch229, +ch230, +ch231, +ch232, +ch233, +ch234, +ch235, +ch236, +ch237, +ch238, +ch239, +ch240, +ch241, +ch242, +ch243, +ch244, +ch245, +ch246, +ch247, +ch248, +ch249, +ch250, +ch251, +ch252, +ch253, +ch254, +ch255, +}; + + static final BitmapFontRec glutBitmapTimesRoman24 = new BitmapFontRec("-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", + 224, + 32, + chars); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTStrokeMonoRoman.java b/src/classes/com/sun/opengl/utils/GLUTStrokeMonoRoman.java new file mode 100644 index 000000000..39aaf8a18 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTStrokeMonoRoman.java @@ -0,0 +1,2491 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTStrokeMonoRoman { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 33 '!' */ + +static final CoordRec char33_stroke0[] = { + new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, (float) 33.3333 ), +}; + +static final CoordRec char33_stroke1[] = { + new CoordRec((float) 52.381, (float) 9.5238 ), + new CoordRec((float) 47.6191, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 9.5238 ), +}; + +static final StrokeRec char33[] = { + new StrokeRec( 2, char33_stroke0 ), + new StrokeRec( 5, char33_stroke1 ), +}; + +/* char: 34 '"' */ + +static final CoordRec char34_stroke0[] = { + new CoordRec((float) 33.3334, (float) 100 ), + new CoordRec((float) 33.3334, (float) 66.6667 ), +}; + +static final CoordRec char34_stroke1[] = { + new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 71.4286, (float) 66.6667 ), +}; + +static final StrokeRec char34[] = { + new StrokeRec( 2, char34_stroke0 ), + new StrokeRec( 2, char34_stroke1 ), +}; + +/* char: 35 '#' */ + +static final CoordRec char35_stroke0[] = { + new CoordRec((float) 54.7619, (float) 119.048 ), + new CoordRec((float) 21.4286, (float) -33.3333 ), +}; + +static final CoordRec char35_stroke1[] = { + new CoordRec((float) 83.3334, (float) 119.048 ), + new CoordRec((float) 50, (float) -33.3333 ), +}; + +static final CoordRec char35_stroke2[] = { + new CoordRec((float) 21.4286, (float) 57.1429 ), + new CoordRec((float) 88.0952, (float) 57.1429 ), +}; + +static final CoordRec char35_stroke3[] = { + new CoordRec((float) 16.6667, (float) 28.5714 ), + new CoordRec((float) 83.3334, (float) 28.5714 ), +}; + +static final StrokeRec char35[] = { + new StrokeRec( 2, char35_stroke0 ), + new StrokeRec( 2, char35_stroke1 ), + new StrokeRec( 2, char35_stroke2 ), + new StrokeRec( 2, char35_stroke3 ), +}; + +/* char: 36 '$' */ + +static final CoordRec char36_stroke0[] = { + new CoordRec((float) 42.8571, (float) 119.048 ), + new CoordRec((float) 42.8571, (float) -19.0476 ), +}; + +static final CoordRec char36_stroke1[] = { + new CoordRec((float) 61.9047, (float) 119.048 ), + new CoordRec((float) 61.9047, (float) -19.0476 ), +}; + +static final CoordRec char36_stroke2[] = { + new CoordRec((float) 85.7143, (float) 85.7143 ), + new CoordRec((float) 76.1905, (float) 95.2381 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 28.5714, (float) 95.2381 ), + new CoordRec((float) 19.0476, (float) 85.7143 ), + new CoordRec((float) 19.0476, (float) 76.1905 ), + new CoordRec((float) 23.8095, (float) 66.6667 ), + new CoordRec((float) 28.5714, (float) 61.9048 ), + new CoordRec((float) 38.0952, (float) 57.1429 ), + new CoordRec((float) 66.6666, (float) 47.619 ), + new CoordRec((float) 76.1905, (float) 42.8571 ), + new CoordRec((float) 80.9524, (float) 38.0952 ), + new CoordRec((float) 85.7143, (float) 28.5714 ), + new CoordRec((float) 85.7143, (float) 14.2857 ), + new CoordRec((float) 76.1905, (float) 4.7619 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 28.5714, (float) 4.7619 ), + new CoordRec((float) 19.0476, (float) 14.2857 ), +}; + +static final StrokeRec char36[] = { + new StrokeRec( 2, char36_stroke0 ), + new StrokeRec( 2, char36_stroke1 ), + new StrokeRec( 20, char36_stroke2 ), +}; + +/* char: 37 '%' */ + +static final CoordRec char37_stroke0[] = { + new CoordRec((float) 95.2381, (float) 100 ), + new CoordRec((float) 9.5238, (float) 0 ), +}; + +static final CoordRec char37_stroke1[] = { + new CoordRec((float) 33.3333, (float) 100 ), + new CoordRec((float) 42.8571, (float) 90.4762 ), + new CoordRec((float) 42.8571, (float) 80.9524 ), + new CoordRec((float) 38.0952, (float) 71.4286 ), + new CoordRec((float) 28.5714, (float) 66.6667 ), + new CoordRec((float) 19.0476, (float) 66.6667 ), + new CoordRec((float) 9.5238, (float) 76.1905 ), + new CoordRec((float) 9.5238, (float) 85.7143 ), + new CoordRec((float) 14.2857, (float) 95.2381 ), + new CoordRec((float) 23.8095, (float) 100 ), + new CoordRec((float) 33.3333, (float) 100 ), + new CoordRec((float) 42.8571, (float) 95.2381 ), + new CoordRec((float) 57.1428, (float) 90.4762 ), + new CoordRec((float) 71.4286, (float) 90.4762 ), + new CoordRec((float) 85.7143, (float) 95.2381 ), + new CoordRec((float) 95.2381, (float) 100 ), +}; + +static final CoordRec char37_stroke2[] = { + new CoordRec((float) 76.1905, (float) 33.3333 ), + new CoordRec((float) 66.6667, (float) 28.5714 ), + new CoordRec((float) 61.9048, (float) 19.0476 ), + new CoordRec((float) 61.9048, (float) 9.5238 ), + new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 90.4762, (float) 4.7619 ), + new CoordRec((float) 95.2381, (float) 14.2857 ), + new CoordRec((float) 95.2381, (float) 23.8095 ), + new CoordRec((float) 85.7143, (float) 33.3333 ), + new CoordRec((float) 76.1905, (float) 33.3333 ), +}; + +static final StrokeRec char37[] = { + new StrokeRec( 2, char37_stroke0 ), + new StrokeRec( 16, char37_stroke1 ), + new StrokeRec( 11, char37_stroke2 ), +}; + +/* char: 38 '&' */ + +static final CoordRec char38_stroke0[] = { + new CoordRec((float) 100, (float) 57.1429 ), + new CoordRec((float) 100, (float) 61.9048 ), + new CoordRec((float) 95.2381, (float) 66.6667 ), + new CoordRec((float) 90.4762, (float) 66.6667 ), + new CoordRec((float) 85.7143, (float) 61.9048 ), + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4286, (float) 28.5714 ), + new CoordRec((float) 61.9048, (float) 14.2857 ), + new CoordRec((float) 52.3809, (float) 4.7619 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 14.2857, (float) 4.7619 ), + new CoordRec((float) 9.5238, (float) 9.5238 ), + new CoordRec((float) 4.7619, (float) 19.0476 ), + new CoordRec((float) 4.7619, (float) 28.5714 ), + new CoordRec((float) 9.5238, (float) 38.0952 ), + new CoordRec((float) 14.2857, (float) 42.8571 ), + new CoordRec((float) 47.619, (float) 61.9048 ), + new CoordRec((float) 52.3809, (float) 66.6667 ), + new CoordRec((float) 57.1429, (float) 76.1905 ), + new CoordRec((float) 57.1429, (float) 85.7143 ), + new CoordRec((float) 52.3809, (float) 95.2381 ), + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 33.3333, (float) 95.2381 ), + new CoordRec((float) 28.5714, (float) 85.7143 ), + new CoordRec((float) 28.5714, (float) 76.1905 ), + new CoordRec((float) 33.3333, (float) 61.9048 ), + new CoordRec((float) 42.8571, (float) 47.619 ), + new CoordRec((float) 66.6667, (float) 14.2857 ), + new CoordRec((float) 76.1905, (float) 4.7619 ), + new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 95.2381, (float) 0 ), + new CoordRec((float) 100, (float) 4.7619 ), + new CoordRec((float) 100, (float) 9.5238 ), +}; + +static final StrokeRec char38[] = { + new StrokeRec( 34, char38_stroke0 ), +}; + +/* char: 39 ''' */ + +static final CoordRec char39_stroke0[] = { + new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, (float) 66.6667 ), +}; + +static final StrokeRec char39[] = { + new StrokeRec( 2, char39_stroke0 ), +}; + +/* char: 40 '(' */ + +static final CoordRec char40_stroke0[] = { + new CoordRec((float) 69.0476, (float) 119.048 ), + new CoordRec((float) 59.5238, (float) 109.524 ), + new CoordRec((float) 50, (float) 95.2381 ), + new CoordRec((float) 40.4762, (float) 76.1905 ), + new CoordRec((float) 35.7143, (float) 52.381 ), + new CoordRec((float) 35.7143, (float) 33.3333 ), + new CoordRec((float) 40.4762, (float) 9.5238 ), + new CoordRec((float) 50, (float) -9.5238 ), + new CoordRec((float) 59.5238, (float) -23.8095 ), + new CoordRec((float) 69.0476, (float) -33.3333 ), +}; + +static final StrokeRec char40[] = { + new StrokeRec( 10, char40_stroke0 ), +}; + +/* char: 41 ')' */ + +static final CoordRec char41_stroke0[] = { + new CoordRec((float) 35.7143, (float) 119.048 ), + new CoordRec((float) 45.2381, (float) 109.524 ), + new CoordRec((float) 54.7619, (float) 95.2381 ), + new CoordRec((float) 64.2857, (float) 76.1905 ), + new CoordRec((float) 69.0476, (float) 52.381 ), + new CoordRec((float) 69.0476, (float) 33.3333 ), + new CoordRec((float) 64.2857, (float) 9.5238 ), + new CoordRec((float) 54.7619, (float) -9.5238 ), + new CoordRec((float) 45.2381, (float) -23.8095 ), + new CoordRec((float) 35.7143, (float) -33.3333 ), +}; + +static final StrokeRec char41[] = { + new StrokeRec( 10, char41_stroke0 ), +}; + +/* char: 42 '*' */ + +static final CoordRec char42_stroke0[] = { + new CoordRec((float) 52.381, (float) 71.4286 ), + new CoordRec((float) 52.381, (float) 14.2857 ), +}; + +static final CoordRec char42_stroke1[] = { + new CoordRec((float) 28.5715, (float) 57.1429 ), + new CoordRec((float) 76.1905, (float) 28.5714 ), +}; + +static final CoordRec char42_stroke2[] = { + new CoordRec((float) 76.1905, (float) 57.1429 ), + new CoordRec((float) 28.5715, (float) 28.5714 ), +}; + +static final StrokeRec char42[] = { + new StrokeRec( 2, char42_stroke0 ), + new StrokeRec( 2, char42_stroke1 ), + new StrokeRec( 2, char42_stroke2 ), +}; + +/* char: 43 '+' */ + +static final CoordRec char43_stroke0[] = { + new CoordRec((float) 52.3809, (float) 85.7143 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char43_stroke1[] = { + new CoordRec((float) 9.5238, (float) 42.8571 ), + new CoordRec((float) 95.2381, (float) 42.8571 ), +}; + +static final StrokeRec char43[] = { + new StrokeRec( 2, char43_stroke0 ), + new StrokeRec( 2, char43_stroke1 ), +}; + +/* char: 44 ',' */ + +static final CoordRec char44_stroke0[] = { + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 47.6191, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 9.5238 ), + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 57.1429, (float) -4.7619 ), + new CoordRec((float) 52.381, (float) -14.2857 ), + new CoordRec((float) 47.6191, (float) -19.0476 ), +}; + +static final StrokeRec char44[] = { + new StrokeRec( 8, char44_stroke0 ), +}; + +/* char: 45 '-' */ + +static final CoordRec char45_stroke0[] = { + new CoordRec((float) 9.5238, (float) 42.8571 ), + new CoordRec((float) 95.2381, (float) 42.8571 ), +}; + +static final StrokeRec char45[] = { + new StrokeRec( 2, char45_stroke0 ), +}; + +/* char: 46 '.' */ + +static final CoordRec char46_stroke0[] = { + new CoordRec((float) 52.381, (float) 9.5238 ), + new CoordRec((float) 47.6191, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 9.5238 ), +}; + +static final StrokeRec char46[] = { + new StrokeRec( 5, char46_stroke0 ), +}; + +/* char: 47 '/' */ + +static final CoordRec char47_stroke0[] = { + new CoordRec((float) 19.0476, (float) -14.2857 ), + new CoordRec((float) 85.7143, (float) 100 ), +}; + +static final StrokeRec char47[] = { + new StrokeRec( 2, char47_stroke0 ), +}; + +/* char: 48 '0' */ + +static final CoordRec char48_stroke0[] = { + new CoordRec((float) 47.619, (float) 100 ), + new CoordRec((float) 33.3333, (float) 95.2381 ), + new CoordRec((float) 23.8095, (float) 80.9524 ), + new CoordRec((float) 19.0476, (float) 57.1429 ), + new CoordRec((float) 19.0476, (float) 42.8571 ), + new CoordRec((float) 23.8095, (float) 19.0476 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 19.0476 ), + new CoordRec((float) 85.7143, (float) 42.8571 ), + new CoordRec((float) 85.7143, (float) 57.1429 ), + new CoordRec((float) 80.9524, (float) 80.9524 ), + new CoordRec((float) 71.4286, (float) 95.2381 ), + new CoordRec((float) 57.1428, (float) 100 ), + new CoordRec((float) 47.619, (float) 100 ), +}; + +static final StrokeRec char48[] = { + new StrokeRec( 17, char48_stroke0 ), +}; + +/* char: 49 '1' */ + +static final CoordRec char49_stroke0[] = { + new CoordRec((float) 40.4762, (float) 80.9524 ), + new CoordRec((float) 50, (float) 85.7143 ), + new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 64.2857, (float) 0 ), +}; + +static final StrokeRec char49[] = { + new StrokeRec( 4, char49_stroke0 ), +}; + +/* char: 50 '2' */ + +static final CoordRec char50_stroke0[] = { + new CoordRec((float) 23.8095, (float) 76.1905 ), + new CoordRec((float) 23.8095, (float) 80.9524 ), + new CoordRec((float) 28.5714, (float) 90.4762 ), + new CoordRec((float) 33.3333, (float) 95.2381 ), + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 71.4286, (float) 95.2381 ), + new CoordRec((float) 76.1905, (float) 90.4762 ), + new CoordRec((float) 80.9524, (float) 80.9524 ), + new CoordRec((float) 80.9524, (float) 71.4286 ), + new CoordRec((float) 76.1905, (float) 61.9048 ), + new CoordRec((float) 66.6666, (float) 47.619 ), + new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final StrokeRec char50[] = { + new StrokeRec( 14, char50_stroke0 ), +}; + +/* char: 51 '3' */ + +static final CoordRec char51_stroke0[] = { + new CoordRec((float) 28.5714, (float) 100 ), + new CoordRec((float) 80.9524, (float) 100 ), + new CoordRec((float) 52.3809, (float) 61.9048 ), + new CoordRec((float) 66.6666, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 57.1429 ), + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 85.7143, (float) 38.0952 ), + new CoordRec((float) 85.7143, (float) 28.5714 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 28.5714, (float) 4.7619 ), + new CoordRec((float) 23.8095, (float) 9.5238 ), + new CoordRec((float) 19.0476, (float) 19.0476 ), +}; + +static final StrokeRec char51[] = { + new StrokeRec( 15, char51_stroke0 ), +}; + +/* char: 52 '4' */ + +static final CoordRec char52_stroke0[] = { + new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 16.6667, (float) 33.3333 ), + new CoordRec((float) 88.0952, (float) 33.3333 ), +}; + +static final CoordRec char52_stroke1[] = { + new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 64.2857, (float) 0 ), +}; + +static final StrokeRec char52[] = { + new StrokeRec( 3, char52_stroke0 ), + new StrokeRec( 2, char52_stroke1 ), +}; + +/* char: 53 '5' */ + +static final CoordRec char53_stroke0[] = { + new CoordRec((float) 76.1905, (float) 100 ), + new CoordRec((float) 28.5714, (float) 100 ), + new CoordRec((float) 23.8095, (float) 57.1429 ), + new CoordRec((float) 28.5714, (float) 61.9048 ), + new CoordRec((float) 42.8571, (float) 66.6667 ), + new CoordRec((float) 57.1428, (float) 66.6667 ), + new CoordRec((float) 71.4286, (float) 61.9048 ), + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 85.7143, (float) 38.0952 ), + new CoordRec((float) 85.7143, (float) 28.5714 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 28.5714, (float) 4.7619 ), + new CoordRec((float) 23.8095, (float) 9.5238 ), + new CoordRec((float) 19.0476, (float) 19.0476 ), +}; + +static final StrokeRec char53[] = { + new StrokeRec( 17, char53_stroke0 ), +}; + +/* char: 54 '6' */ + +static final CoordRec char54_stroke0[] = { + new CoordRec((float) 78.5714, (float) 85.7143 ), + new CoordRec((float) 73.8096, (float) 95.2381 ), + new CoordRec((float) 59.5238, (float) 100 ), + new CoordRec((float) 50, (float) 100 ), + new CoordRec((float) 35.7143, (float) 95.2381 ), + new CoordRec((float) 26.1905, (float) 80.9524 ), + new CoordRec((float) 21.4286, (float) 57.1429 ), + new CoordRec((float) 21.4286, (float) 33.3333 ), + new CoordRec((float) 26.1905, (float) 14.2857 ), + new CoordRec((float) 35.7143, (float) 4.7619 ), + new CoordRec((float) 50, (float) 0 ), + new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 69.0476, (float) 4.7619 ), + new CoordRec((float) 78.5714, (float) 14.2857 ), + new CoordRec((float) 83.3334, (float) 28.5714 ), + new CoordRec((float) 83.3334, (float) 33.3333 ), + new CoordRec((float) 78.5714, (float) 47.619 ), + new CoordRec((float) 69.0476, (float) 57.1429 ), + new CoordRec((float) 54.7619, (float) 61.9048 ), + new CoordRec((float) 50, (float) 61.9048 ), + new CoordRec((float) 35.7143, (float) 57.1429 ), + new CoordRec((float) 26.1905, (float) 47.619 ), + new CoordRec((float) 21.4286, (float) 33.3333 ), +}; + +static final StrokeRec char54[] = { + new StrokeRec( 23, char54_stroke0 ), +}; + +/* char: 55 '7' */ + +static final CoordRec char55_stroke0[] = { + new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 38.0952, (float) 0 ), +}; + +static final CoordRec char55_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 85.7143, (float) 100 ), +}; + +static final StrokeRec char55[] = { + new StrokeRec( 2, char55_stroke0 ), + new StrokeRec( 2, char55_stroke1 ), +}; + +/* char: 56 '8' */ + +static final CoordRec char56_stroke0[] = { + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 28.5714, (float) 95.2381 ), + new CoordRec((float) 23.8095, (float) 85.7143 ), + new CoordRec((float) 23.8095, (float) 76.1905 ), + new CoordRec((float) 28.5714, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 57.1428, (float) 57.1429 ), + new CoordRec((float) 71.4286, (float) 52.381 ), + new CoordRec((float) 80.9524, (float) 42.8571 ), + new CoordRec((float) 85.7143, (float) 33.3333 ), + new CoordRec((float) 85.7143, (float) 19.0476 ), + new CoordRec((float) 80.9524, (float) 9.5238 ), + new CoordRec((float) 76.1905, (float) 4.7619 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 28.5714, (float) 4.7619 ), + new CoordRec((float) 23.8095, (float) 9.5238 ), + new CoordRec((float) 19.0476, (float) 19.0476 ), + new CoordRec((float) 19.0476, (float) 33.3333 ), + new CoordRec((float) 23.8095, (float) 42.8571 ), + new CoordRec((float) 33.3333, (float) 52.381 ), + new CoordRec((float) 47.619, (float) 57.1429 ), + new CoordRec((float) 66.6666, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 66.6667 ), + new CoordRec((float) 80.9524, (float) 76.1905 ), + new CoordRec((float) 80.9524, (float) 85.7143 ), + new CoordRec((float) 76.1905, (float) 95.2381 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, (float) 100 ), +}; + +static final StrokeRec char56[] = { + new StrokeRec( 29, char56_stroke0 ), +}; + +/* char: 57 '9' */ + +static final CoordRec char57_stroke0[] = { + new CoordRec((float) 83.3334, (float) 66.6667 ), + new CoordRec((float) 78.5714, (float) 52.381 ), + new CoordRec((float) 69.0476, (float) 42.8571 ), + new CoordRec((float) 54.7619, (float) 38.0952 ), + new CoordRec((float) 50, (float) 38.0952 ), + new CoordRec((float) 35.7143, (float) 42.8571 ), + new CoordRec((float) 26.1905, (float) 52.381 ), + new CoordRec((float) 21.4286, (float) 66.6667 ), + new CoordRec((float) 21.4286, (float) 71.4286 ), + new CoordRec((float) 26.1905, (float) 85.7143 ), + new CoordRec((float) 35.7143, (float) 95.2381 ), + new CoordRec((float) 50, (float) 100 ), + new CoordRec((float) 54.7619, (float) 100 ), + new CoordRec((float) 69.0476, (float) 95.2381 ), + new CoordRec((float) 78.5714, (float) 85.7143 ), + new CoordRec((float) 83.3334, (float) 66.6667 ), + new CoordRec((float) 83.3334, (float) 42.8571 ), + new CoordRec((float) 78.5714, (float) 19.0476 ), + new CoordRec((float) 69.0476, (float) 4.7619 ), + new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 30.9524, (float) 4.7619 ), + new CoordRec((float) 26.1905, (float) 14.2857 ), +}; + +static final StrokeRec char57[] = { + new StrokeRec( 23, char57_stroke0 ), +}; + +/* char: 58 ':' */ + +static final CoordRec char58_stroke0[] = { + new CoordRec((float) 52.381, (float) 66.6667 ), + new CoordRec((float) 47.6191, (float) 61.9048 ), + new CoordRec((float) 52.381, (float) 57.1429 ), + new CoordRec((float) 57.1429, (float) 61.9048 ), + new CoordRec((float) 52.381, (float) 66.6667 ), +}; + +static final CoordRec char58_stroke1[] = { + new CoordRec((float) 52.381, (float) 9.5238 ), + new CoordRec((float) 47.6191, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 9.5238 ), +}; + +static final StrokeRec char58[] = { + new StrokeRec( 5, char58_stroke0 ), + new StrokeRec( 5, char58_stroke1 ), +}; + +/* char: 59 ';' */ + +static final CoordRec char59_stroke0[] = { + new CoordRec((float) 52.381, (float) 66.6667 ), + new CoordRec((float) 47.6191, (float) 61.9048 ), + new CoordRec((float) 52.381, (float) 57.1429 ), + new CoordRec((float) 57.1429, (float) 61.9048 ), + new CoordRec((float) 52.381, (float) 66.6667 ), +}; + +static final CoordRec char59_stroke1[] = { + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 47.6191, (float) 4.7619 ), + new CoordRec((float) 52.381, (float) 9.5238 ), + new CoordRec((float) 57.1429, (float) 4.7619 ), + new CoordRec((float) 57.1429, (float) -4.7619 ), + new CoordRec((float) 52.381, (float) -14.2857 ), + new CoordRec((float) 47.6191, (float) -19.0476 ), +}; + +static final StrokeRec char59[] = { + new StrokeRec( 5, char59_stroke0 ), + new StrokeRec( 8, char59_stroke1 ), +}; + +/* char: 60 '<' */ + +static final CoordRec char60_stroke0[] = { + new CoordRec((float) 90.4762, (float) 85.7143 ), + new CoordRec((float) 14.2857, (float) 42.8571 ), + new CoordRec((float) 90.4762, (float) 0 ), +}; + +static final StrokeRec char60[] = { + new StrokeRec( 3, char60_stroke0 ), +}; + +/* char: 61 '=' */ + +static final CoordRec char61_stroke0[] = { + new CoordRec((float) 9.5238, (float) 57.1429 ), + new CoordRec((float) 95.2381, (float) 57.1429 ), +}; + +static final CoordRec char61_stroke1[] = { + new CoordRec((float) 9.5238, (float) 28.5714 ), + new CoordRec((float) 95.2381, (float) 28.5714 ), +}; + +static final StrokeRec char61[] = { + new StrokeRec( 2, char61_stroke0 ), + new StrokeRec( 2, char61_stroke1 ), +}; + +/* char: 62 '>' */ + +static final CoordRec char62_stroke0[] = { + new CoordRec((float) 14.2857, (float) 85.7143 ), + new CoordRec((float) 90.4762, (float) 42.8571 ), + new CoordRec((float) 14.2857, (float) 0 ), +}; + +static final StrokeRec char62[] = { + new StrokeRec( 3, char62_stroke0 ), +}; + +/* char: 63 '?' */ + +static final CoordRec char63_stroke0[] = { + new CoordRec((float) 23.8095, (float) 76.1905 ), + new CoordRec((float) 23.8095, (float) 80.9524 ), + new CoordRec((float) 28.5714, (float) 90.4762 ), + new CoordRec((float) 33.3333, (float) 95.2381 ), + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 71.4285, (float) 95.2381 ), + new CoordRec((float) 76.1905, (float) 90.4762 ), + new CoordRec((float) 80.9524, (float) 80.9524 ), + new CoordRec((float) 80.9524, (float) 71.4286 ), + new CoordRec((float) 76.1905, (float) 61.9048 ), + new CoordRec((float) 71.4285, (float) 57.1429 ), + new CoordRec((float) 52.3809, (float) 47.619 ), + new CoordRec((float) 52.3809, (float) 33.3333 ), +}; + +static final CoordRec char63_stroke1[] = { + new CoordRec((float) 52.3809, (float) 9.5238 ), + new CoordRec((float) 47.619, (float) 4.7619 ), + new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 57.1428, (float) 4.7619 ), + new CoordRec((float) 52.3809, (float) 9.5238 ), +}; + +static final StrokeRec char63[] = { + new StrokeRec( 14, char63_stroke0 ), + new StrokeRec( 5, char63_stroke1 ), +}; + +/* char: 64 '@' */ + +static final CoordRec char64_stroke0[] = { + new CoordRec((float) 64.2857, (float) 52.381 ), + new CoordRec((float) 54.7619, (float) 57.1429 ), + new CoordRec((float) 45.2381, (float) 57.1429 ), + new CoordRec((float) 40.4762, (float) 47.619 ), + new CoordRec((float) 40.4762, (float) 42.8571 ), + new CoordRec((float) 45.2381, (float) 33.3333 ), + new CoordRec((float) 54.7619, (float) 33.3333 ), + new CoordRec((float) 64.2857, (float) 38.0952 ), +}; + +static final CoordRec char64_stroke1[] = { + new CoordRec((float) 64.2857, (float) 57.1429 ), + new CoordRec((float) 64.2857, (float) 38.0952 ), + new CoordRec((float) 69.0476, (float) 33.3333 ), + new CoordRec((float) 78.5714, (float) 33.3333 ), + new CoordRec((float) 83.3334, (float) 42.8571 ), + new CoordRec((float) 83.3334, (float) 47.619 ), + new CoordRec((float) 78.5714, (float) 61.9048 ), + new CoordRec((float) 69.0476, (float) 71.4286 ), + new CoordRec((float) 54.7619, (float) 76.1905 ), + new CoordRec((float) 50, (float) 76.1905 ), + new CoordRec((float) 35.7143, (float) 71.4286 ), + new CoordRec((float) 26.1905, (float) 61.9048 ), + new CoordRec((float) 21.4286, (float) 47.619 ), + new CoordRec((float) 21.4286, (float) 42.8571 ), + new CoordRec((float) 26.1905, (float) 28.5714 ), + new CoordRec((float) 35.7143, (float) 19.0476 ), + new CoordRec((float) 50, (float) 14.2857 ), + new CoordRec((float) 54.7619, (float) 14.2857 ), + new CoordRec((float) 69.0476, (float) 19.0476 ), +}; + +static final StrokeRec char64[] = { + new StrokeRec( 8, char64_stroke0 ), + new StrokeRec( 19, char64_stroke1 ), +}; + +/* char: 65 'A' */ + +static final CoordRec char65_stroke0[] = { + new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 14.2857, (float) 0 ), +}; + +static final CoordRec char65_stroke1[] = { + new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 90.4762, (float) 0 ), +}; + +static final CoordRec char65_stroke2[] = { + new CoordRec((float) 28.5714, (float) 33.3333 ), + new CoordRec((float) 76.1905, (float) 33.3333 ), +}; + +static final StrokeRec char65[] = { + new StrokeRec( 2, char65_stroke0 ), + new StrokeRec( 2, char65_stroke1 ), + new StrokeRec( 2, char65_stroke2 ), +}; + +/* char: 66 'B' */ + +static final CoordRec char66_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char66_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 76.1905, (float) 95.2381 ), + new CoordRec((float) 80.9524, (float) 90.4762 ), + new CoordRec((float) 85.7143, (float) 80.9524 ), + new CoordRec((float) 85.7143, (float) 71.4286 ), + new CoordRec((float) 80.9524, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 57.1429 ), + new CoordRec((float) 61.9047, (float) 52.381 ), +}; + +static final CoordRec char66_stroke2[] = { + new CoordRec((float) 19.0476, (float) 52.381 ), + new CoordRec((float) 61.9047, (float) 52.381 ), + new CoordRec((float) 76.1905, (float) 47.619 ), + new CoordRec((float) 80.9524, (float) 42.8571 ), + new CoordRec((float) 85.7143, (float) 33.3333 ), + new CoordRec((float) 85.7143, (float) 19.0476 ), + new CoordRec((float) 80.9524, (float) 9.5238 ), + new CoordRec((float) 76.1905, (float) 4.7619 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final StrokeRec char66[] = { + new StrokeRec( 2, char66_stroke0 ), + new StrokeRec( 9, char66_stroke1 ), + new StrokeRec( 10, char66_stroke2 ), +}; + +/* char: 67 'C' */ + +static final CoordRec char67_stroke0[] = { + new CoordRec((float) 88.0952, (float) 76.1905 ), + new CoordRec((float) 83.3334, (float) 85.7143 ), + new CoordRec((float) 73.8096, (float) 95.2381 ), + new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 35.7143, (float) 95.2381 ), + new CoordRec((float) 26.1905, (float) 85.7143 ), + new CoordRec((float) 21.4286, (float) 76.1905 ), + new CoordRec((float) 16.6667, (float) 61.9048 ), + new CoordRec((float) 16.6667, (float) 38.0952 ), + new CoordRec((float) 21.4286, (float) 23.8095 ), + new CoordRec((float) 26.1905, (float) 14.2857 ), + new CoordRec((float) 35.7143, (float) 4.7619 ), + new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 73.8096, (float) 4.7619 ), + new CoordRec((float) 83.3334, (float) 14.2857 ), + new CoordRec((float) 88.0952, (float) 23.8095 ), +}; + +static final StrokeRec char67[] = { + new StrokeRec( 18, char67_stroke0 ), +}; + +/* char: 68 'D' */ + +static final CoordRec char68_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char68_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 66.6666, (float) 95.2381 ), + new CoordRec((float) 76.1905, (float) 85.7143 ), + new CoordRec((float) 80.9524, (float) 76.1905 ), + new CoordRec((float) 85.7143, (float) 61.9048 ), + new CoordRec((float) 85.7143, (float) 38.0952 ), + new CoordRec((float) 80.9524, (float) 23.8095 ), + new CoordRec((float) 76.1905, (float) 14.2857 ), + new CoordRec((float) 66.6666, (float) 4.7619 ), + new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final StrokeRec char68[] = { + new StrokeRec( 2, char68_stroke0 ), + new StrokeRec( 12, char68_stroke1 ), +}; + +/* char: 69 'E' */ + +static final CoordRec char69_stroke0[] = { + new CoordRec((float) 21.4286, (float) 100 ), + new CoordRec((float) 21.4286, (float) 0 ), +}; + +static final CoordRec char69_stroke1[] = { + new CoordRec((float) 21.4286, (float) 100 ), + new CoordRec((float) 83.3334, (float) 100 ), +}; + +static final CoordRec char69_stroke2[] = { + new CoordRec((float) 21.4286, (float) 52.381 ), + new CoordRec((float) 59.5238, (float) 52.381 ), +}; + +static final CoordRec char69_stroke3[] = { + new CoordRec((float) 21.4286, (float) 0 ), + new CoordRec((float) 83.3334, (float) 0 ), +}; + +static final StrokeRec char69[] = { + new StrokeRec( 2, char69_stroke0 ), + new StrokeRec( 2, char69_stroke1 ), + new StrokeRec( 2, char69_stroke2 ), + new StrokeRec( 2, char69_stroke3 ), +}; + +/* char: 70 'F' */ + +static final CoordRec char70_stroke0[] = { + new CoordRec((float) 21.4286, (float) 100 ), + new CoordRec((float) 21.4286, (float) 0 ), +}; + +static final CoordRec char70_stroke1[] = { + new CoordRec((float) 21.4286, (float) 100 ), + new CoordRec((float) 83.3334, (float) 100 ), +}; + +static final CoordRec char70_stroke2[] = { + new CoordRec((float) 21.4286, (float) 52.381 ), + new CoordRec((float) 59.5238, (float) 52.381 ), +}; + +static final StrokeRec char70[] = { + new StrokeRec( 2, char70_stroke0 ), + new StrokeRec( 2, char70_stroke1 ), + new StrokeRec( 2, char70_stroke2 ), +}; + +/* char: 71 'G' */ + +static final CoordRec char71_stroke0[] = { + new CoordRec((float) 88.0952, (float) 76.1905 ), + new CoordRec((float) 83.3334, (float) 85.7143 ), + new CoordRec((float) 73.8096, (float) 95.2381 ), + new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 35.7143, (float) 95.2381 ), + new CoordRec((float) 26.1905, (float) 85.7143 ), + new CoordRec((float) 21.4286, (float) 76.1905 ), + new CoordRec((float) 16.6667, (float) 61.9048 ), + new CoordRec((float) 16.6667, (float) 38.0952 ), + new CoordRec((float) 21.4286, (float) 23.8095 ), + new CoordRec((float) 26.1905, (float) 14.2857 ), + new CoordRec((float) 35.7143, (float) 4.7619 ), + new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 73.8096, (float) 4.7619 ), + new CoordRec((float) 83.3334, (float) 14.2857 ), + new CoordRec((float) 88.0952, (float) 23.8095 ), + new CoordRec((float) 88.0952, (float) 38.0952 ), +}; + +static final CoordRec char71_stroke1[] = { + new CoordRec((float) 64.2857, (float) 38.0952 ), + new CoordRec((float) 88.0952, (float) 38.0952 ), +}; + +static final StrokeRec char71[] = { + new StrokeRec( 19, char71_stroke0 ), + new StrokeRec( 2, char71_stroke1 ), +}; + +/* char: 72 'H' */ + +static final CoordRec char72_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char72_stroke1[] = { + new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final CoordRec char72_stroke2[] = { + new CoordRec((float) 19.0476, (float) 52.381 ), + new CoordRec((float) 85.7143, (float) 52.381 ), +}; + +static final StrokeRec char72[] = { + new StrokeRec( 2, char72_stroke0 ), + new StrokeRec( 2, char72_stroke1 ), + new StrokeRec( 2, char72_stroke2 ), +}; + +/* char: 73 'I' */ + +static final CoordRec char73_stroke0[] = { + new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, (float) 0 ), +}; + +static final StrokeRec char73[] = { + new StrokeRec( 2, char73_stroke0 ), +}; + +/* char: 74 'J' */ + +static final CoordRec char74_stroke0[] = { + new CoordRec((float) 76.1905, (float) 100 ), + new CoordRec((float) 76.1905, (float) 23.8095 ), + new CoordRec((float) 71.4286, (float) 9.5238 ), + new CoordRec((float) 66.6667, (float) 4.7619 ), + new CoordRec((float) 57.1429, (float) 0 ), + new CoordRec((float) 47.6191, (float) 0 ), + new CoordRec((float) 38.0953, (float) 4.7619 ), + new CoordRec((float) 33.3334, (float) 9.5238 ), + new CoordRec((float) 28.5715, (float) 23.8095 ), + new CoordRec((float) 28.5715, (float) 33.3333 ), +}; + +static final StrokeRec char74[] = { + new StrokeRec( 10, char74_stroke0 ), +}; + +/* char: 75 'K' */ + +static final CoordRec char75_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char75_stroke1[] = { + new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, (float) 33.3333 ), +}; + +static final CoordRec char75_stroke2[] = { + new CoordRec((float) 42.8571, (float) 57.1429 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final StrokeRec char75[] = { + new StrokeRec( 2, char75_stroke0 ), + new StrokeRec( 2, char75_stroke1 ), + new StrokeRec( 2, char75_stroke2 ), +}; + +/* char: 76 'L' */ + +static final CoordRec char76_stroke0[] = { + new CoordRec((float) 23.8095, (float) 100 ), + new CoordRec((float) 23.8095, (float) 0 ), +}; + +static final CoordRec char76_stroke1[] = { + new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 80.9524, (float) 0 ), +}; + +static final StrokeRec char76[] = { + new StrokeRec( 2, char76_stroke0 ), + new StrokeRec( 2, char76_stroke1 ), +}; + +/* char: 77 'M' */ + +static final CoordRec char77_stroke0[] = { + new CoordRec((float) 14.2857, (float) 100 ), + new CoordRec((float) 14.2857, (float) 0 ), +}; + +static final CoordRec char77_stroke1[] = { + new CoordRec((float) 14.2857, (float) 100 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char77_stroke2[] = { + new CoordRec((float) 90.4762, (float) 100 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char77_stroke3[] = { + new CoordRec((float) 90.4762, (float) 100 ), + new CoordRec((float) 90.4762, (float) 0 ), +}; + +static final StrokeRec char77[] = { + new StrokeRec( 2, char77_stroke0 ), + new StrokeRec( 2, char77_stroke1 ), + new StrokeRec( 2, char77_stroke2 ), + new StrokeRec( 2, char77_stroke3 ), +}; + +/* char: 78 'N' */ + +static final CoordRec char78_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char78_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final CoordRec char78_stroke2[] = { + new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final StrokeRec char78[] = { + new StrokeRec( 2, char78_stroke0 ), + new StrokeRec( 2, char78_stroke1 ), + new StrokeRec( 2, char78_stroke2 ), +}; + +/* char: 79 'O' */ + +static final CoordRec char79_stroke0[] = { + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 33.3333, (float) 95.2381 ), + new CoordRec((float) 23.8095, (float) 85.7143 ), + new CoordRec((float) 19.0476, (float) 76.1905 ), + new CoordRec((float) 14.2857, (float) 61.9048 ), + new CoordRec((float) 14.2857, (float) 38.0952 ), + new CoordRec((float) 19.0476, (float) 23.8095 ), + new CoordRec((float) 23.8095, (float) 14.2857 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), + new CoordRec((float) 85.7143, (float) 23.8095 ), + new CoordRec((float) 90.4762, (float) 38.0952 ), + new CoordRec((float) 90.4762, (float) 61.9048 ), + new CoordRec((float) 85.7143, (float) 76.1905 ), + new CoordRec((float) 80.9524, (float) 85.7143 ), + new CoordRec((float) 71.4286, (float) 95.2381 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, (float) 100 ), +}; + +static final StrokeRec char79[] = { + new StrokeRec( 21, char79_stroke0 ), +}; + +/* char: 80 'P' */ + +static final CoordRec char80_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char80_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 76.1905, (float) 95.2381 ), + new CoordRec((float) 80.9524, (float) 90.4762 ), + new CoordRec((float) 85.7143, (float) 80.9524 ), + new CoordRec((float) 85.7143, (float) 66.6667 ), + new CoordRec((float) 80.9524, (float) 57.1429 ), + new CoordRec((float) 76.1905, (float) 52.381 ), + new CoordRec((float) 61.9047, (float) 47.619 ), + new CoordRec((float) 19.0476, (float) 47.619 ), +}; + +static final StrokeRec char80[] = { + new StrokeRec( 2, char80_stroke0 ), + new StrokeRec( 10, char80_stroke1 ), +}; + +/* char: 81 'Q' */ + +static final CoordRec char81_stroke0[] = { + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 33.3333, (float) 95.2381 ), + new CoordRec((float) 23.8095, (float) 85.7143 ), + new CoordRec((float) 19.0476, (float) 76.1905 ), + new CoordRec((float) 14.2857, (float) 61.9048 ), + new CoordRec((float) 14.2857, (float) 38.0952 ), + new CoordRec((float) 19.0476, (float) 23.8095 ), + new CoordRec((float) 23.8095, (float) 14.2857 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), + new CoordRec((float) 85.7143, (float) 23.8095 ), + new CoordRec((float) 90.4762, (float) 38.0952 ), + new CoordRec((float) 90.4762, (float) 61.9048 ), + new CoordRec((float) 85.7143, (float) 76.1905 ), + new CoordRec((float) 80.9524, (float) 85.7143 ), + new CoordRec((float) 71.4286, (float) 95.2381 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, (float) 100 ), +}; + +static final CoordRec char81_stroke1[] = { + new CoordRec((float) 57.1428, (float) 19.0476 ), + new CoordRec((float) 85.7143, (float) -9.5238 ), +}; + +static final StrokeRec char81[] = { + new StrokeRec( 21, char81_stroke0 ), + new StrokeRec( 2, char81_stroke1 ), +}; + +/* char: 82 'R' */ + +static final CoordRec char82_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char82_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 76.1905, (float) 95.2381 ), + new CoordRec((float) 80.9524, (float) 90.4762 ), + new CoordRec((float) 85.7143, (float) 80.9524 ), + new CoordRec((float) 85.7143, (float) 71.4286 ), + new CoordRec((float) 80.9524, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 57.1429 ), + new CoordRec((float) 61.9047, (float) 52.381 ), + new CoordRec((float) 19.0476, (float) 52.381 ), +}; + +static final CoordRec char82_stroke2[] = { + new CoordRec((float) 52.3809, (float) 52.381 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final StrokeRec char82[] = { + new StrokeRec( 2, char82_stroke0 ), + new StrokeRec( 10, char82_stroke1 ), + new StrokeRec( 2, char82_stroke2 ), +}; + +/* char: 83 'S' */ + +static final CoordRec char83_stroke0[] = { + new CoordRec((float) 85.7143, (float) 85.7143 ), + new CoordRec((float) 76.1905, (float) 95.2381 ), + new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 28.5714, (float) 95.2381 ), + new CoordRec((float) 19.0476, (float) 85.7143 ), + new CoordRec((float) 19.0476, (float) 76.1905 ), + new CoordRec((float) 23.8095, (float) 66.6667 ), + new CoordRec((float) 28.5714, (float) 61.9048 ), + new CoordRec((float) 38.0952, (float) 57.1429 ), + new CoordRec((float) 66.6666, (float) 47.619 ), + new CoordRec((float) 76.1905, (float) 42.8571 ), + new CoordRec((float) 80.9524, (float) 38.0952 ), + new CoordRec((float) 85.7143, (float) 28.5714 ), + new CoordRec((float) 85.7143, (float) 14.2857 ), + new CoordRec((float) 76.1905, (float) 4.7619 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 28.5714, (float) 4.7619 ), + new CoordRec((float) 19.0476, (float) 14.2857 ), +}; + +static final StrokeRec char83[] = { + new StrokeRec( 20, char83_stroke0 ), +}; + +/* char: 84 'T' */ + +static final CoordRec char84_stroke0[] = { + new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char84_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 85.7143, (float) 100 ), +}; + +static final StrokeRec char84[] = { + new StrokeRec( 2, char84_stroke0 ), + new StrokeRec( 2, char84_stroke1 ), +}; + +/* char: 85 'U' */ + +static final CoordRec char85_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, (float) 28.5714 ), + new CoordRec((float) 23.8095, (float) 14.2857 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), + new CoordRec((float) 85.7143, (float) 28.5714 ), + new CoordRec((float) 85.7143, (float) 100 ), +}; + +static final StrokeRec char85[] = { + new StrokeRec( 10, char85_stroke0 ), +}; + +/* char: 86 'V' */ + +static final CoordRec char86_stroke0[] = { + new CoordRec((float) 14.2857, (float) 100 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char86_stroke1[] = { + new CoordRec((float) 90.4762, (float) 100 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final StrokeRec char86[] = { + new StrokeRec( 2, char86_stroke0 ), + new StrokeRec( 2, char86_stroke1 ), +}; + +/* char: 87 'W' */ + +static final CoordRec char87_stroke0[] = { + new CoordRec((float) 4.7619, (float) 100 ), + new CoordRec((float) 28.5714, (float) 0 ), +}; + +static final CoordRec char87_stroke1[] = { + new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 28.5714, (float) 0 ), +}; + +static final CoordRec char87_stroke2[] = { + new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 76.1905, (float) 0 ), +}; + +static final CoordRec char87_stroke3[] = { + new CoordRec((float) 100, (float) 100 ), + new CoordRec((float) 76.1905, (float) 0 ), +}; + +static final StrokeRec char87[] = { + new StrokeRec( 2, char87_stroke0 ), + new StrokeRec( 2, char87_stroke1 ), + new StrokeRec( 2, char87_stroke2 ), + new StrokeRec( 2, char87_stroke3 ), +}; + +/* char: 88 'X' */ + +static final CoordRec char88_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final CoordRec char88_stroke1[] = { + new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final StrokeRec char88[] = { + new StrokeRec( 2, char88_stroke0 ), + new StrokeRec( 2, char88_stroke1 ), +}; + +/* char: 89 'Y' */ + +static final CoordRec char89_stroke0[] = { + new CoordRec((float) 14.2857, (float) 100 ), + new CoordRec((float) 52.3809, (float) 52.381 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char89_stroke1[] = { + new CoordRec((float) 90.4762, (float) 100 ), + new CoordRec((float) 52.3809, (float) 52.381 ), +}; + +static final StrokeRec char89[] = { + new StrokeRec( 3, char89_stroke0 ), + new StrokeRec( 2, char89_stroke1 ), +}; + +/* char: 90 'Z' */ + +static final CoordRec char90_stroke0[] = { + new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, (float) 0 ), +}; + +static final CoordRec char90_stroke1[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 85.7143, (float) 100 ), +}; + +static final CoordRec char90_stroke2[] = { + new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 85.7143, (float) 0 ), +}; + +static final StrokeRec char90[] = { + new StrokeRec( 2, char90_stroke0 ), + new StrokeRec( 2, char90_stroke1 ), + new StrokeRec( 2, char90_stroke2 ), +}; + +/* char: 91 '[' */ + +static final CoordRec char91_stroke0[] = { + new CoordRec((float) 35.7143, (float) 119.048 ), + new CoordRec((float) 35.7143, (float) -33.3333 ), +}; + +static final CoordRec char91_stroke1[] = { + new CoordRec((float) 40.4762, (float) 119.048 ), + new CoordRec((float) 40.4762, (float) -33.3333 ), +}; + +static final CoordRec char91_stroke2[] = { + new CoordRec((float) 35.7143, (float) 119.048 ), + new CoordRec((float) 69.0476, (float) 119.048 ), +}; + +static final CoordRec char91_stroke3[] = { + new CoordRec((float) 35.7143, (float) -33.3333 ), + new CoordRec((float) 69.0476, (float) -33.3333 ), +}; + +static final StrokeRec char91[] = { + new StrokeRec( 2, char91_stroke0 ), + new StrokeRec( 2, char91_stroke1 ), + new StrokeRec( 2, char91_stroke2 ), + new StrokeRec( 2, char91_stroke3 ), +}; + +/* char: 92 '\' */ + +static final CoordRec char92_stroke0[] = { + new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 85.7143, (float) -14.2857 ), +}; + +static final StrokeRec char92[] = { + new StrokeRec( 2, char92_stroke0 ), +}; + +/* char: 93 ']' */ + +static final CoordRec char93_stroke0[] = { + new CoordRec((float) 64.2857, (float) 119.048 ), + new CoordRec((float) 64.2857, (float) -33.3333 ), +}; + +static final CoordRec char93_stroke1[] = { + new CoordRec((float) 69.0476, (float) 119.048 ), + new CoordRec((float) 69.0476, (float) -33.3333 ), +}; + +static final CoordRec char93_stroke2[] = { + new CoordRec((float) 35.7143, (float) 119.048 ), + new CoordRec((float) 69.0476, (float) 119.048 ), +}; + +static final CoordRec char93_stroke3[] = { + new CoordRec((float) 35.7143, (float) -33.3333 ), + new CoordRec((float) 69.0476, (float) -33.3333 ), +}; + +static final StrokeRec char93[] = { + new StrokeRec( 2, char93_stroke0 ), + new StrokeRec( 2, char93_stroke1 ), + new StrokeRec( 2, char93_stroke2 ), + new StrokeRec( 2, char93_stroke3 ), +}; + +/* char: 94 '^' */ + +static final CoordRec char94_stroke0[] = { + new CoordRec((float) 52.3809, (float) 109.524 ), + new CoordRec((float) 14.2857, (float) 42.8571 ), +}; + +static final CoordRec char94_stroke1[] = { + new CoordRec((float) 52.3809, (float) 109.524 ), + new CoordRec((float) 90.4762, (float) 42.8571 ), +}; + +static final StrokeRec char94[] = { + new StrokeRec( 2, char94_stroke0 ), + new StrokeRec( 2, char94_stroke1 ), +}; + +/* char: 95 '_' */ + +static final CoordRec char95_stroke0[] = { + new CoordRec((float) 0, (float) -33.3333 ), + new CoordRec((float) 104.762, (float) -33.3333 ), + new CoordRec((float) 104.762, (float) -28.5714 ), + new CoordRec((float) 0, (float) -28.5714 ), + new CoordRec((float) 0, (float) -33.3333 ), +}; + +static final StrokeRec char95[] = { + new StrokeRec( 5, char95_stroke0 ), +}; + +/* char: 96 '`' */ + +static final CoordRec char96_stroke0[] = { + new CoordRec((float) 42.8572, (float) 100 ), + new CoordRec((float) 66.6667, (float) 71.4286 ), +}; + +static final CoordRec char96_stroke1[] = { + new CoordRec((float) 42.8572, (float) 100 ), + new CoordRec((float) 38.0953, (float) 95.2381 ), + new CoordRec((float) 66.6667, (float) 71.4286 ), +}; + +static final StrokeRec char96[] = { + new StrokeRec( 2, char96_stroke0 ), + new StrokeRec( 3, char96_stroke1 ), +}; + +/* char: 97 'a' */ + +static final CoordRec char97_stroke0[] = { + new CoordRec((float) 80.9524, (float) 66.6667 ), + new CoordRec((float) 80.9524, (float) 0 ), +}; + +static final CoordRec char97_stroke1[] = { + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4285, (float) 61.9048 ), + new CoordRec((float) 61.9047, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 28.5714, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 23.8095, (float) 28.5714 ), + new CoordRec((float) 28.5714, (float) 14.2857 ), + new CoordRec((float) 38.0952, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4285, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), +}; + +static final StrokeRec char97[] = { + new StrokeRec( 2, char97_stroke0 ), + new StrokeRec( 14, char97_stroke1 ), +}; + +/* char: 98 'b' */ + +static final CoordRec char98_stroke0[] = { + new CoordRec((float) 23.8095, (float) 100 ), + new CoordRec((float) 23.8095, (float) 0 ), +}; + +static final CoordRec char98_stroke1[] = { + new CoordRec((float) 23.8095, (float) 52.381 ), + new CoordRec((float) 33.3333, (float) 61.9048 ), + new CoordRec((float) 42.8571, (float) 66.6667 ), + new CoordRec((float) 57.1428, (float) 66.6667 ), + new CoordRec((float) 66.6666, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 52.381 ), + new CoordRec((float) 80.9524, (float) 38.0952 ), + new CoordRec((float) 80.9524, (float) 28.5714 ), + new CoordRec((float) 76.1905, (float) 14.2857 ), + new CoordRec((float) 66.6666, (float) 4.7619 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 23.8095, (float) 14.2857 ), +}; + +static final StrokeRec char98[] = { + new StrokeRec( 2, char98_stroke0 ), + new StrokeRec( 14, char98_stroke1 ), +}; + +/* char: 99 'c' */ + +static final CoordRec char99_stroke0[] = { + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4285, (float) 61.9048 ), + new CoordRec((float) 61.9047, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 28.5714, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 23.8095, (float) 28.5714 ), + new CoordRec((float) 28.5714, (float) 14.2857 ), + new CoordRec((float) 38.0952, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4285, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), +}; + +static final StrokeRec char99[] = { + new StrokeRec( 14, char99_stroke0 ), +}; + +/* char: 100 'd' */ + +static final CoordRec char100_stroke0[] = { + new CoordRec((float) 80.9524, (float) 100 ), + new CoordRec((float) 80.9524, (float) 0 ), +}; + +static final CoordRec char100_stroke1[] = { + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4285, (float) 61.9048 ), + new CoordRec((float) 61.9047, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 28.5714, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 23.8095, (float) 28.5714 ), + new CoordRec((float) 28.5714, (float) 14.2857 ), + new CoordRec((float) 38.0952, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4285, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), +}; + +static final StrokeRec char100[] = { + new StrokeRec( 2, char100_stroke0 ), + new StrokeRec( 14, char100_stroke1 ), +}; + +/* char: 101 'e' */ + +static final CoordRec char101_stroke0[] = { + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 80.9524, (float) 38.0952 ), + new CoordRec((float) 80.9524, (float) 47.619 ), + new CoordRec((float) 76.1905, (float) 57.1429 ), + new CoordRec((float) 71.4285, (float) 61.9048 ), + new CoordRec((float) 61.9047, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 28.5714, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 23.8095, (float) 28.5714 ), + new CoordRec((float) 28.5714, (float) 14.2857 ), + new CoordRec((float) 38.0952, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4285, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), +}; + +static final StrokeRec char101[] = { + new StrokeRec( 17, char101_stroke0 ), +}; + +/* char: 102 'f' */ + +static final CoordRec char102_stroke0[] = { + new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 61.9048, (float) 100 ), + new CoordRec((float) 52.381, (float) 95.2381 ), + new CoordRec((float) 47.6191, (float) 80.9524 ), + new CoordRec((float) 47.6191, (float) 0 ), +}; + +static final CoordRec char102_stroke1[] = { + new CoordRec((float) 33.3334, (float) 66.6667 ), + new CoordRec((float) 66.6667, (float) 66.6667 ), +}; + +static final StrokeRec char102[] = { + new StrokeRec( 5, char102_stroke0 ), + new StrokeRec( 2, char102_stroke1 ), +}; + +/* char: 103 'g' */ + +static final CoordRec char103_stroke0[] = { + new CoordRec((float) 80.9524, (float) 66.6667 ), + new CoordRec((float) 80.9524, (float) -9.5238 ), + new CoordRec((float) 76.1905, (float) -23.8095 ), + new CoordRec((float) 71.4285, (float) -28.5714 ), + new CoordRec((float) 61.9047, (float) -33.3333 ), + new CoordRec((float) 47.619, (float) -33.3333 ), + new CoordRec((float) 38.0952, (float) -28.5714 ), +}; + +static final CoordRec char103_stroke1[] = { + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4285, (float) 61.9048 ), + new CoordRec((float) 61.9047, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 28.5714, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 23.8095, (float) 28.5714 ), + new CoordRec((float) 28.5714, (float) 14.2857 ), + new CoordRec((float) 38.0952, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4285, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), +}; + +static final StrokeRec char103[] = { + new StrokeRec( 7, char103_stroke0 ), + new StrokeRec( 14, char103_stroke1 ), +}; + +/* char: 104 'h' */ + +static final CoordRec char104_stroke0[] = { + new CoordRec((float) 26.1905, (float) 100 ), + new CoordRec((float) 26.1905, (float) 0 ), +}; + +static final CoordRec char104_stroke1[] = { + new CoordRec((float) 26.1905, (float) 47.619 ), + new CoordRec((float) 40.4762, (float) 61.9048 ), + new CoordRec((float) 50, (float) 66.6667 ), + new CoordRec((float) 64.2857, (float) 66.6667 ), + new CoordRec((float) 73.8095, (float) 61.9048 ), + new CoordRec((float) 78.5715, (float) 47.619 ), + new CoordRec((float) 78.5715, (float) 0 ), +}; + +static final StrokeRec char104[] = { + new StrokeRec( 2, char104_stroke0 ), + new StrokeRec( 7, char104_stroke1 ), +}; + +/* char: 105 'i' */ + +static final CoordRec char105_stroke0[] = { + new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 52.381, (float) 95.2381 ), + new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 52.381, (float) 104.762 ), + new CoordRec((float) 47.6191, (float) 100 ), +}; + +static final CoordRec char105_stroke1[] = { + new CoordRec((float) 52.381, (float) 66.6667 ), + new CoordRec((float) 52.381, (float) 0 ), +}; + +static final StrokeRec char105[] = { + new StrokeRec( 5, char105_stroke0 ), + new StrokeRec( 2, char105_stroke1 ), +}; + +/* char: 106 'j' */ + +static final CoordRec char106_stroke0[] = { + new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 61.9048, (float) 95.2381 ), + new CoordRec((float) 66.6667, (float) 100 ), + new CoordRec((float) 61.9048, (float) 104.762 ), + new CoordRec((float) 57.1429, (float) 100 ), +}; + +static final CoordRec char106_stroke1[] = { + new CoordRec((float) 61.9048, (float) 66.6667 ), + new CoordRec((float) 61.9048, (float) -14.2857 ), + new CoordRec((float) 57.1429, (float) -28.5714 ), + new CoordRec((float) 47.6191, (float) -33.3333 ), + new CoordRec((float) 38.0953, (float) -33.3333 ), +}; + +static final StrokeRec char106[] = { + new StrokeRec( 5, char106_stroke0 ), + new StrokeRec( 5, char106_stroke1 ), +}; + +/* char: 107 'k' */ + +static final CoordRec char107_stroke0[] = { + new CoordRec((float) 26.1905, (float) 100 ), + new CoordRec((float) 26.1905, (float) 0 ), +}; + +static final CoordRec char107_stroke1[] = { + new CoordRec((float) 73.8095, (float) 66.6667 ), + new CoordRec((float) 26.1905, (float) 19.0476 ), +}; + +static final CoordRec char107_stroke2[] = { + new CoordRec((float) 45.2381, (float) 38.0952 ), + new CoordRec((float) 78.5715, (float) 0 ), +}; + +static final StrokeRec char107[] = { + new StrokeRec( 2, char107_stroke0 ), + new StrokeRec( 2, char107_stroke1 ), + new StrokeRec( 2, char107_stroke2 ), +}; + +/* char: 108 'l' */ + +static final CoordRec char108_stroke0[] = { + new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, (float) 0 ), +}; + +static final StrokeRec char108[] = { + new StrokeRec( 2, char108_stroke0 ), +}; + +/* char: 109 'm' */ + +static final CoordRec char109_stroke0[] = { + new CoordRec((float) 0, (float) 66.6667 ), + new CoordRec((float) 0, (float) 0 ), +}; + +static final CoordRec char109_stroke1[] = { + new CoordRec((float) 0, (float) 47.619 ), + new CoordRec((float) 14.2857, (float) 61.9048 ), + new CoordRec((float) 23.8095, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 61.9048 ), + new CoordRec((float) 52.381, (float) 47.619 ), + new CoordRec((float) 52.381, (float) 0 ), +}; + +static final CoordRec char109_stroke2[] = { + new CoordRec((float) 52.381, (float) 47.619 ), + new CoordRec((float) 66.6667, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 66.6667 ), + new CoordRec((float) 90.4762, (float) 66.6667 ), + new CoordRec((float) 100, (float) 61.9048 ), + new CoordRec((float) 104.762, (float) 47.619 ), + new CoordRec((float) 104.762, (float) 0 ), +}; + +static final StrokeRec char109[] = { + new StrokeRec( 2, char109_stroke0 ), + new StrokeRec( 7, char109_stroke1 ), + new StrokeRec( 7, char109_stroke2 ), +}; + +/* char: 110 'n' */ + +static final CoordRec char110_stroke0[] = { + new CoordRec((float) 26.1905, (float) 66.6667 ), + new CoordRec((float) 26.1905, (float) 0 ), +}; + +static final CoordRec char110_stroke1[] = { + new CoordRec((float) 26.1905, (float) 47.619 ), + new CoordRec((float) 40.4762, (float) 61.9048 ), + new CoordRec((float) 50, (float) 66.6667 ), + new CoordRec((float) 64.2857, (float) 66.6667 ), + new CoordRec((float) 73.8095, (float) 61.9048 ), + new CoordRec((float) 78.5715, (float) 47.619 ), + new CoordRec((float) 78.5715, (float) 0 ), +}; + +static final StrokeRec char110[] = { + new StrokeRec( 2, char110_stroke0 ), + new StrokeRec( 7, char110_stroke1 ), +}; + +/* char: 111 'o' */ + +static final CoordRec char111_stroke0[] = { + new CoordRec((float) 45.2381, (float) 66.6667 ), + new CoordRec((float) 35.7143, (float) 61.9048 ), + new CoordRec((float) 26.1905, (float) 52.381 ), + new CoordRec((float) 21.4286, (float) 38.0952 ), + new CoordRec((float) 21.4286, (float) 28.5714 ), + new CoordRec((float) 26.1905, (float) 14.2857 ), + new CoordRec((float) 35.7143, (float) 4.7619 ), + new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 59.5238, (float) 0 ), + new CoordRec((float) 69.0476, (float) 4.7619 ), + new CoordRec((float) 78.5714, (float) 14.2857 ), + new CoordRec((float) 83.3334, (float) 28.5714 ), + new CoordRec((float) 83.3334, (float) 38.0952 ), + new CoordRec((float) 78.5714, (float) 52.381 ), + new CoordRec((float) 69.0476, (float) 61.9048 ), + new CoordRec((float) 59.5238, (float) 66.6667 ), + new CoordRec((float) 45.2381, (float) 66.6667 ), +}; + +static final StrokeRec char111[] = { + new StrokeRec( 17, char111_stroke0 ), +}; + +/* char: 112 'p' */ + +static final CoordRec char112_stroke0[] = { + new CoordRec((float) 23.8095, (float) 66.6667 ), + new CoordRec((float) 23.8095, (float) -33.3333 ), +}; + +static final CoordRec char112_stroke1[] = { + new CoordRec((float) 23.8095, (float) 52.381 ), + new CoordRec((float) 33.3333, (float) 61.9048 ), + new CoordRec((float) 42.8571, (float) 66.6667 ), + new CoordRec((float) 57.1428, (float) 66.6667 ), + new CoordRec((float) 66.6666, (float) 61.9048 ), + new CoordRec((float) 76.1905, (float) 52.381 ), + new CoordRec((float) 80.9524, (float) 38.0952 ), + new CoordRec((float) 80.9524, (float) 28.5714 ), + new CoordRec((float) 76.1905, (float) 14.2857 ), + new CoordRec((float) 66.6666, (float) 4.7619 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 23.8095, (float) 14.2857 ), +}; + +static final StrokeRec char112[] = { + new StrokeRec( 2, char112_stroke0 ), + new StrokeRec( 14, char112_stroke1 ), +}; + +/* char: 113 'q' */ + +static final CoordRec char113_stroke0[] = { + new CoordRec((float) 80.9524, (float) 66.6667 ), + new CoordRec((float) 80.9524, (float) -33.3333 ), +}; + +static final CoordRec char113_stroke1[] = { + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4285, (float) 61.9048 ), + new CoordRec((float) 61.9047, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 38.0952, (float) 61.9048 ), + new CoordRec((float) 28.5714, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 38.0952 ), + new CoordRec((float) 23.8095, (float) 28.5714 ), + new CoordRec((float) 28.5714, (float) 14.2857 ), + new CoordRec((float) 38.0952, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 71.4285, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), +}; + +static final StrokeRec char113[] = { + new StrokeRec( 2, char113_stroke0 ), + new StrokeRec( 14, char113_stroke1 ), +}; + +/* char: 114 'r' */ + +static final CoordRec char114_stroke0[] = { + new CoordRec((float) 33.3334, (float) 66.6667 ), + new CoordRec((float) 33.3334, (float) 0 ), +}; + +static final CoordRec char114_stroke1[] = { + new CoordRec((float) 33.3334, (float) 38.0952 ), + new CoordRec((float) 38.0953, (float) 52.381 ), + new CoordRec((float) 47.6191, (float) 61.9048 ), + new CoordRec((float) 57.1429, (float) 66.6667 ), + new CoordRec((float) 71.4286, (float) 66.6667 ), +}; + +static final StrokeRec char114[] = { + new StrokeRec( 2, char114_stroke0 ), + new StrokeRec( 5, char114_stroke1 ), +}; + +/* char: 115 's' */ + +static final CoordRec char115_stroke0[] = { + new CoordRec((float) 78.5715, (float) 52.381 ), + new CoordRec((float) 73.8095, (float) 61.9048 ), + new CoordRec((float) 59.5238, (float) 66.6667 ), + new CoordRec((float) 45.2381, (float) 66.6667 ), + new CoordRec((float) 30.9524, (float) 61.9048 ), + new CoordRec((float) 26.1905, (float) 52.381 ), + new CoordRec((float) 30.9524, (float) 42.8571 ), + new CoordRec((float) 40.4762, (float) 38.0952 ), + new CoordRec((float) 64.2857, (float) 33.3333 ), + new CoordRec((float) 73.8095, (float) 28.5714 ), + new CoordRec((float) 78.5715, (float) 19.0476 ), + new CoordRec((float) 78.5715, (float) 14.2857 ), + new CoordRec((float) 73.8095, (float) 4.7619 ), + new CoordRec((float) 59.5238, (float) 0 ), + new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 30.9524, (float) 4.7619 ), + new CoordRec((float) 26.1905, (float) 14.2857 ), +}; + +static final StrokeRec char115[] = { + new StrokeRec( 17, char115_stroke0 ), +}; + +/* char: 116 't' */ + +static final CoordRec char116_stroke0[] = { + new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, (float) 19.0476 ), + new CoordRec((float) 52.381, (float) 4.7619 ), + new CoordRec((float) 61.9048, (float) 0 ), + new CoordRec((float) 71.4286, (float) 0 ), +}; + +static final CoordRec char116_stroke1[] = { + new CoordRec((float) 33.3334, (float) 66.6667 ), + new CoordRec((float) 66.6667, (float) 66.6667 ), +}; + +static final StrokeRec char116[] = { + new StrokeRec( 5, char116_stroke0 ), + new StrokeRec( 2, char116_stroke1 ), +}; + +/* char: 117 'u' */ + +static final CoordRec char117_stroke0[] = { + new CoordRec((float) 26.1905, (float) 66.6667 ), + new CoordRec((float) 26.1905, (float) 19.0476 ), + new CoordRec((float) 30.9524, (float) 4.7619 ), + new CoordRec((float) 40.4762, (float) 0 ), + new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 64.2857, (float) 4.7619 ), + new CoordRec((float) 78.5715, (float) 19.0476 ), +}; + +static final CoordRec char117_stroke1[] = { + new CoordRec((float) 78.5715, (float) 66.6667 ), + new CoordRec((float) 78.5715, (float) 0 ), +}; + +static final StrokeRec char117[] = { + new StrokeRec( 7, char117_stroke0 ), + new StrokeRec( 2, char117_stroke1 ), +}; + +/* char: 118 'v' */ + +static final CoordRec char118_stroke0[] = { + new CoordRec((float) 23.8095, (float) 66.6667 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final CoordRec char118_stroke1[] = { + new CoordRec((float) 80.9524, (float) 66.6667 ), + new CoordRec((float) 52.3809, (float) 0 ), +}; + +static final StrokeRec char118[] = { + new StrokeRec( 2, char118_stroke0 ), + new StrokeRec( 2, char118_stroke1 ), +}; + +/* char: 119 'w' */ + +static final CoordRec char119_stroke0[] = { + new CoordRec((float) 14.2857, (float) 66.6667 ), + new CoordRec((float) 33.3333, (float) 0 ), +}; + +static final CoordRec char119_stroke1[] = { + new CoordRec((float) 52.3809, (float) 66.6667 ), + new CoordRec((float) 33.3333, (float) 0 ), +}; + +static final CoordRec char119_stroke2[] = { + new CoordRec((float) 52.3809, (float) 66.6667 ), + new CoordRec((float) 71.4286, (float) 0 ), +}; + +static final CoordRec char119_stroke3[] = { + new CoordRec((float) 90.4762, (float) 66.6667 ), + new CoordRec((float) 71.4286, (float) 0 ), +}; + +static final StrokeRec char119[] = { + new StrokeRec( 2, char119_stroke0 ), + new StrokeRec( 2, char119_stroke1 ), + new StrokeRec( 2, char119_stroke2 ), + new StrokeRec( 2, char119_stroke3 ), +}; + +/* char: 120 'x' */ + +static final CoordRec char120_stroke0[] = { + new CoordRec((float) 26.1905, (float) 66.6667 ), + new CoordRec((float) 78.5715, (float) 0 ), +}; + +static final CoordRec char120_stroke1[] = { + new CoordRec((float) 78.5715, (float) 66.6667 ), + new CoordRec((float) 26.1905, (float) 0 ), +}; + +static final StrokeRec char120[] = { + new StrokeRec( 2, char120_stroke0 ), + new StrokeRec( 2, char120_stroke1 ), +}; + +/* char: 121 'y' */ + +static final CoordRec char121_stroke0[] = { + new CoordRec((float) 26.1905, (float) 66.6667 ), + new CoordRec((float) 54.7619, (float) 0 ), +}; + +static final CoordRec char121_stroke1[] = { + new CoordRec((float) 83.3334, (float) 66.6667 ), + new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 45.2381, (float) -19.0476 ), + new CoordRec((float) 35.7143, (float) -28.5714 ), + new CoordRec((float) 26.1905, (float) -33.3333 ), + new CoordRec((float) 21.4286, (float) -33.3333 ), +}; + +static final StrokeRec char121[] = { + new StrokeRec( 2, char121_stroke0 ), + new StrokeRec( 6, char121_stroke1 ), +}; + +/* char: 122 'z' */ + +static final CoordRec char122_stroke0[] = { + new CoordRec((float) 78.5715, (float) 66.6667 ), + new CoordRec((float) 26.1905, (float) 0 ), +}; + +static final CoordRec char122_stroke1[] = { + new CoordRec((float) 26.1905, (float) 66.6667 ), + new CoordRec((float) 78.5715, (float) 66.6667 ), +}; + +static final CoordRec char122_stroke2[] = { + new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 78.5715, (float) 0 ), +}; + +static final StrokeRec char122[] = { + new StrokeRec( 2, char122_stroke0 ), + new StrokeRec( 2, char122_stroke1 ), + new StrokeRec( 2, char122_stroke2 ), +}; + +/* char: 123 '{' */ + +static final CoordRec char123_stroke0[] = { + new CoordRec((float) 64.2857, (float) 119.048 ), + new CoordRec((float) 54.7619, (float) 114.286 ), + new CoordRec((float) 50, (float) 109.524 ), + new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 45.2381, (float) 90.4762 ), + new CoordRec((float) 50, (float) 80.9524 ), + new CoordRec((float) 54.7619, (float) 76.1905 ), + new CoordRec((float) 59.5238, (float) 66.6667 ), + new CoordRec((float) 59.5238, (float) 57.1429 ), + new CoordRec((float) 50, (float) 47.619 ), +}; + +static final CoordRec char123_stroke1[] = { + new CoordRec((float) 54.7619, (float) 114.286 ), + new CoordRec((float) 50, (float) 104.762 ), + new CoordRec((float) 50, (float) 95.2381 ), + new CoordRec((float) 54.7619, (float) 85.7143 ), + new CoordRec((float) 59.5238, (float) 80.9524 ), + new CoordRec((float) 64.2857, (float) 71.4286 ), + new CoordRec((float) 64.2857, (float) 61.9048 ), + new CoordRec((float) 59.5238, (float) 52.381 ), + new CoordRec((float) 40.4762, (float) 42.8571 ), + new CoordRec((float) 59.5238, (float) 33.3333 ), + new CoordRec((float) 64.2857, (float) 23.8095 ), + new CoordRec((float) 64.2857, (float) 14.2857 ), + new CoordRec((float) 59.5238, (float) 4.7619 ), + new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 50, (float) -9.5238 ), + new CoordRec((float) 50, (float) -19.0476 ), + new CoordRec((float) 54.7619, (float) -28.5714 ), +}; + +static final CoordRec char123_stroke2[] = { + new CoordRec((float) 50, (float) 38.0952 ), + new CoordRec((float) 59.5238, (float) 28.5714 ), + new CoordRec((float) 59.5238, (float) 19.0476 ), + new CoordRec((float) 54.7619, (float) 9.5238 ), + new CoordRec((float) 50, (float) 4.7619 ), + new CoordRec((float) 45.2381, (float) -4.7619 ), + new CoordRec((float) 45.2381, (float) -14.2857 ), + new CoordRec((float) 50, (float) -23.8095 ), + new CoordRec((float) 54.7619, (float) -28.5714 ), + new CoordRec((float) 64.2857, (float) -33.3333 ), +}; + +static final StrokeRec char123[] = { + new StrokeRec( 10, char123_stroke0 ), + new StrokeRec( 17, char123_stroke1 ), + new StrokeRec( 10, char123_stroke2 ), +}; + +/* char: 124 '|' */ + +static final CoordRec char124_stroke0[] = { + new CoordRec((float) 52.381, (float) 119.048 ), + new CoordRec((float) 52.381, (float) -33.3333 ), +}; + +static final StrokeRec char124[] = { + new StrokeRec( 2, char124_stroke0 ), +}; + +/* char: 125 '}' */ + +static final CoordRec char125_stroke0[] = { + new CoordRec((float) 40.4762, (float) 119.048 ), + new CoordRec((float) 50, (float) 114.286 ), + new CoordRec((float) 54.7619, (float) 109.524 ), + new CoordRec((float) 59.5238, (float) 100 ), + new CoordRec((float) 59.5238, (float) 90.4762 ), + new CoordRec((float) 54.7619, (float) 80.9524 ), + new CoordRec((float) 50, (float) 76.1905 ), + new CoordRec((float) 45.2381, (float) 66.6667 ), + new CoordRec((float) 45.2381, (float) 57.1429 ), + new CoordRec((float) 54.7619, (float) 47.619 ), +}; + +static final CoordRec char125_stroke1[] = { + new CoordRec((float) 50, (float) 114.286 ), + new CoordRec((float) 54.7619, (float) 104.762 ), + new CoordRec((float) 54.7619, (float) 95.2381 ), + new CoordRec((float) 50, (float) 85.7143 ), + new CoordRec((float) 45.2381, (float) 80.9524 ), + new CoordRec((float) 40.4762, (float) 71.4286 ), + new CoordRec((float) 40.4762, (float) 61.9048 ), + new CoordRec((float) 45.2381, (float) 52.381 ), + new CoordRec((float) 64.2857, (float) 42.8571 ), + new CoordRec((float) 45.2381, (float) 33.3333 ), + new CoordRec((float) 40.4762, (float) 23.8095 ), + new CoordRec((float) 40.4762, (float) 14.2857 ), + new CoordRec((float) 45.2381, (float) 4.7619 ), + new CoordRec((float) 50, (float) 0 ), + new CoordRec((float) 54.7619, (float) -9.5238 ), + new CoordRec((float) 54.7619, (float) -19.0476 ), + new CoordRec((float) 50, (float) -28.5714 ), +}; + +static final CoordRec char125_stroke2[] = { + new CoordRec((float) 54.7619, (float) 38.0952 ), + new CoordRec((float) 45.2381, (float) 28.5714 ), + new CoordRec((float) 45.2381, (float) 19.0476 ), + new CoordRec((float) 50, (float) 9.5238 ), + new CoordRec((float) 54.7619, (float) 4.7619 ), + new CoordRec((float) 59.5238, (float) -4.7619 ), + new CoordRec((float) 59.5238, (float) -14.2857 ), + new CoordRec((float) 54.7619, (float) -23.8095 ), + new CoordRec((float) 50, (float) -28.5714 ), + new CoordRec((float) 40.4762, (float) -33.3333 ), +}; + +static final StrokeRec char125[] = { + new StrokeRec( 10, char125_stroke0 ), + new StrokeRec( 17, char125_stroke1 ), + new StrokeRec( 10, char125_stroke2 ), +}; + +/* char: 126 '~' */ + +static final CoordRec char126_stroke0[] = { + new CoordRec((float) 9.5238, (float) 28.5714 ), + new CoordRec((float) 9.5238, (float) 38.0952 ), + new CoordRec((float) 14.2857, (float) 52.381 ), + new CoordRec((float) 23.8095, (float) 57.1429 ), + new CoordRec((float) 33.3333, (float) 57.1429 ), + new CoordRec((float) 42.8571, (float) 52.381 ), + new CoordRec((float) 61.9048, (float) 38.0952 ), + new CoordRec((float) 71.4286, (float) 33.3333 ), + new CoordRec((float) 80.9524, (float) 33.3333 ), + new CoordRec((float) 90.4762, (float) 38.0952 ), + new CoordRec((float) 95.2381, (float) 47.619 ), +}; + +static final CoordRec char126_stroke1[] = { + new CoordRec((float) 9.5238, (float) 38.0952 ), + new CoordRec((float) 14.2857, (float) 47.619 ), + new CoordRec((float) 23.8095, (float) 52.381 ), + new CoordRec((float) 33.3333, (float) 52.381 ), + new CoordRec((float) 42.8571, (float) 47.619 ), + new CoordRec((float) 61.9048, (float) 33.3333 ), + new CoordRec((float) 71.4286, (float) 28.5714 ), + new CoordRec((float) 80.9524, (float) 28.5714 ), + new CoordRec((float) 90.4762, (float) 33.3333 ), + new CoordRec((float) 95.2381, (float) 47.619 ), + new CoordRec((float) 95.2381, (float) 57.1429 ), +}; + +static final StrokeRec char126[] = { + new StrokeRec( 11, char126_stroke0 ), + new StrokeRec( 11, char126_stroke1 ), +}; + +/* char: 127 */ + +static final CoordRec char127_stroke0[] = { + new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 33.3333, (float) -33.3333 ), +}; + +static final CoordRec char127_stroke1[] = { + new CoordRec((float) 47.619, (float) 66.6667 ), + new CoordRec((float) 33.3333, (float) 61.9048 ), + new CoordRec((float) 23.8095, (float) 52.381 ), + new CoordRec((float) 19.0476, (float) 38.0952 ), + new CoordRec((float) 19.0476, (float) 23.8095 ), + new CoordRec((float) 23.8095, (float) 14.2857 ), + new CoordRec((float) 33.3333, (float) 4.7619 ), + new CoordRec((float) 47.619, (float) 0 ), + new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 71.4286, (float) 4.7619 ), + new CoordRec((float) 80.9524, (float) 14.2857 ), + new CoordRec((float) 85.7143, (float) 28.5714 ), + new CoordRec((float) 85.7143, (float) 42.8571 ), + new CoordRec((float) 80.9524, (float) 52.381 ), + new CoordRec((float) 71.4286, (float) 61.9048 ), + new CoordRec((float) 57.1428, (float) 66.6667 ), + new CoordRec((float) 47.619, (float) 66.6667 ), +}; + +static final StrokeRec char127[] = { + new StrokeRec( 2, char127_stroke0 ), + new StrokeRec( 17, char127_stroke1 ), +}; + +static final StrokeCharRec chars[] = { + new StrokeCharRec(0, /* char0 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char1 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char2 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char3 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char4 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char5 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char6 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char7 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char8 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char9 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char10 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char11 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char12 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char13 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char14 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char15 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char16 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char17 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char18 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char19 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char20 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char21 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char22 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char23 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char24 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char25 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char26 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char27 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char28 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char29 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char30 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char31 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char32 */ null, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char33, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char34, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char35, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char36, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char37, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char38, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char39, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char40, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char41, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char42, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char43, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char44, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char45, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char46, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char47, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char48, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char49, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char50, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char51, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char52, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char53, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char54, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char55, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char56, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char57, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char58, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char59, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char60, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char61, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char62, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char63, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char64, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char65, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char66, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char67, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char68, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char69, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char70, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char71, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char72, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char73, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char74, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char75, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char76, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char77, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char78, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char79, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char80, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char81, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char82, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char83, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char84, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char85, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char86, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char87, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char88, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char89, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char90, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char91, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char92, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char93, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char94, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char95, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char96, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char97, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char98, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char99, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char100, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char101, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char102, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char103, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char104, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char105, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char106, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char107, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char108, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char109, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char110, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char111, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char112, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char113, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char114, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char115, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char116, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char117, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char118, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(4, char119, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char120, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char121, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char122, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char123, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(1, char124, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(3, char125, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char126, (float) 52.381, (float) 104.762 ), + new StrokeCharRec(2, char127, (float) 52.381, (float) 104.762 ), +}; + +static final StrokeFontRec glutStrokeMonoRoman = new StrokeFontRec( "Roman", 128, chars, (float) 119.048, (float) -33.3333 ); +} diff --git a/src/classes/com/sun/opengl/utils/GLUTStrokeRoman.java b/src/classes/com/sun/opengl/utils/GLUTStrokeRoman.java new file mode 100644 index 000000000..de040508a --- /dev/null +++ b/src/classes/com/sun/opengl/utils/GLUTStrokeRoman.java @@ -0,0 +1,2491 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +class GLUTStrokeRoman { + +/* GENERATED FILE -- DO NOT MODIFY */ + +/* char: 33 '!' */ + +static final CoordRec char33_stroke0[] = { + new CoordRec((float) 13.3819, (float) 100), + new CoordRec((float) 13.3819, (float) 33.3333), +}; + +static final CoordRec char33_stroke1[] = { + new CoordRec((float) 13.3819, (float) 9.5238), + new CoordRec((float) 8.62, (float) 4.7619), + new CoordRec((float) 13.3819, (float) 0), + new CoordRec((float) 18.1438, (float) 4.7619), + new CoordRec((float) 13.3819, (float) 9.5238), +}; + +static final StrokeRec char33[] = { + new StrokeRec(2, char33_stroke0), + new StrokeRec(5, char33_stroke1), +}; + +/* char: 34 '"' */ + +static final CoordRec char34_stroke0[] = { + new CoordRec((float) 4.02, (float) 100), + new CoordRec((float) 4.02, (float) 66.6667), +}; + +static final CoordRec char34_stroke1[] = { + new CoordRec((float) 42.1152, (float) 100), + new CoordRec((float) 42.1152, (float) 66.6667), +}; + +static final StrokeRec char34[] = { + new StrokeRec(2, char34_stroke0), + new StrokeRec(2, char34_stroke1), +}; + +/* char: 35 '#' */ + +static final CoordRec char35_stroke0[] = { + new CoordRec((float) 41.2952, (float) 119.048), + new CoordRec((float) 7.9619, (float) -33.3333), +}; + +static final CoordRec char35_stroke1[] = { + new CoordRec((float) 69.8667, (float) 119.048), + new CoordRec((float) 36.5333, (float) -33.3333), +}; + +static final CoordRec char35_stroke2[] = { + new CoordRec((float) 7.9619, (float) 57.1429), + new CoordRec((float) 74.6286, (float) 57.1429), +}; + +static final CoordRec char35_stroke3[] = { + new CoordRec((float) 3.2, (float) 28.5714), + new CoordRec((float) 69.8667, (float) 28.5714), +}; + +static final StrokeRec char35[] = { + new StrokeRec(2, char35_stroke0), + new StrokeRec(2, char35_stroke1), + new StrokeRec(2, char35_stroke2), + new StrokeRec(2, char35_stroke3), +}; + +/* char: 36 '$' */ + +static final CoordRec char36_stroke0[] = { + new CoordRec((float) 28.6295, (float) 119.048), + new CoordRec((float) 28.6295, (float) -19.0476), +}; + +static final CoordRec char36_stroke1[] = { + new CoordRec((float) 47.6771, (float) 119.048), + new CoordRec((float) 47.6771, (float) -19.0476), +}; + +static final CoordRec char36_stroke2[] = { + new CoordRec((float) 71.4867, (float) 85.7143), + new CoordRec((float) 61.9629, (float) 95.2381), + new CoordRec((float) 47.6771, (float) 100), + new CoordRec((float) 28.6295, (float) 100), + new CoordRec((float) 14.3438, (float) 95.2381), + new CoordRec((float) 4.82, (float) 85.7143), + new CoordRec((float) 4.82, (float) 76.1905), + new CoordRec((float) 9.5819, (float) 66.6667), + new CoordRec((float) 14.3438, (float) 61.9048), + new CoordRec((float) 23.8676, (float) 57.1429), + new CoordRec((float) 52.439, (float) 47.619), + new CoordRec((float) 61.9629, (float) 42.8571), + new CoordRec((float) 66.7248, (float) 38.0952), + new CoordRec((float) 71.4867, (float) 28.5714), + new CoordRec((float) 71.4867, (float) 14.2857), + new CoordRec((float) 61.9629, (float) 4.7619), + new CoordRec((float) 47.6771, (float) 0), + new CoordRec((float) 28.6295, (float) 0), + new CoordRec((float) 14.3438, (float) 4.7619), + new CoordRec((float) 4.82, (float) 14.2857), +}; + +static final StrokeRec char36[] = { + new StrokeRec(2, char36_stroke0), + new StrokeRec(2, char36_stroke1), + new StrokeRec(20, char36_stroke2), +}; + +/* char: 37 '%' */ + +static final CoordRec char37_stroke0[] = { + new CoordRec((float) 92.0743, (float) 100), + new CoordRec((float) 6.36, (float) 0), +}; + +static final CoordRec char37_stroke1[] = { + new CoordRec((float) 30.1695, (float) 100), + new CoordRec((float) 39.6933, (float) 90.4762), + new CoordRec((float) 39.6933, (float) 80.9524), + new CoordRec((float) 34.9314, (float) 71.4286), + new CoordRec((float) 25.4076, (float) 66.6667), + new CoordRec((float) 15.8838, (float) 66.6667), + new CoordRec((float) 6.36, (float) 76.1905), + new CoordRec((float) 6.36, (float) 85.7143), + new CoordRec((float) 11.1219, (float) 95.2381), + new CoordRec((float) 20.6457, (float) 100), + new CoordRec((float) 30.1695, (float) 100), + new CoordRec((float) 39.6933, (float) 95.2381), + new CoordRec((float) 53.979, (float) 90.4762), + new CoordRec((float) 68.2648, (float) 90.4762), + new CoordRec((float) 82.5505, (float) 95.2381), + new CoordRec((float) 92.0743, (float) 100), +}; + +static final CoordRec char37_stroke2[] = { + new CoordRec((float) 73.0267, (float) 33.3333), + new CoordRec((float) 63.5029, (float) 28.5714), + new CoordRec((float) 58.741, (float) 19.0476), + new CoordRec((float) 58.741, (float) 9.5238), + new CoordRec((float) 68.2648, (float) 0), + new CoordRec((float) 77.7886, (float) 0), + new CoordRec((float) 87.3124, (float) 4.7619), + new CoordRec((float) 92.0743, (float) 14.2857), + new CoordRec((float) 92.0743, (float) 23.8095), + new CoordRec((float) 82.5505, (float) 33.3333), + new CoordRec((float) 73.0267, (float) 33.3333), +}; + +static final StrokeRec char37[] = { + new StrokeRec(2, char37_stroke0), + new StrokeRec(16, char37_stroke1), + new StrokeRec(11, char37_stroke2), +}; + +/* char: 38 '&' */ + +static final CoordRec char38_stroke0[] = { + new CoordRec((float) 101.218, (float) 57.1429), + new CoordRec((float) 101.218, (float) 61.9048), + new CoordRec((float) 96.4562, (float) 66.6667), + new CoordRec((float) 91.6943, (float) 66.6667), + new CoordRec((float) 86.9324, (float) 61.9048), + new CoordRec((float) 82.1705, (float) 52.381), + new CoordRec((float) 72.6467, (float) 28.5714), + new CoordRec((float) 63.1229, (float) 14.2857), + new CoordRec((float) 53.599, (float) 4.7619), + new CoordRec((float) 44.0752, (float) 0), + new CoordRec((float) 25.0276, (float) 0), + new CoordRec((float) 15.5038, (float) 4.7619), + new CoordRec((float) 10.7419, (float) 9.5238), + new CoordRec((float) 5.98, (float) 19.0476), + new CoordRec((float) 5.98, (float) 28.5714), + new CoordRec((float) 10.7419, (float) 38.0952), + new CoordRec((float) 15.5038, (float) 42.8571), + new CoordRec((float) 48.8371, (float) 61.9048), + new CoordRec((float) 53.599, (float) 66.6667), + new CoordRec((float) 58.361, (float) 76.1905), + new CoordRec((float) 58.361, (float) 85.7143), + new CoordRec((float) 53.599, (float) 95.2381), + new CoordRec((float) 44.0752, (float) 100), + new CoordRec((float) 34.5514, (float) 95.2381), + new CoordRec((float) 29.7895, (float) 85.7143), + new CoordRec((float) 29.7895, (float) 76.1905), + new CoordRec((float) 34.5514, (float) 61.9048), + new CoordRec((float) 44.0752, (float) 47.619), + new CoordRec((float) 67.8848, (float) 14.2857), + new CoordRec((float) 77.4086, (float) 4.7619), + new CoordRec((float) 86.9324, (float) 0), + new CoordRec((float) 96.4562, (float) 0), + new CoordRec((float) 101.218, (float) 4.7619), + new CoordRec((float) 101.218, (float) 9.5238), +}; + +static final StrokeRec char38[] = { + new StrokeRec(34, char38_stroke0), +}; + +/* char: 39 ''' */ + +static final CoordRec char39_stroke0[] = { + new CoordRec((float) 4.44, (float) 100), + new CoordRec((float) 4.44, (float) 66.6667), +}; + +static final StrokeRec char39[] = { + new StrokeRec(2, char39_stroke0), +}; + +/* char: 40 '(' */ + +static final CoordRec char40_stroke0[] = { + new CoordRec((float) 40.9133, (float) 119.048), + new CoordRec((float) 31.3895, (float) 109.524), + new CoordRec((float) 21.8657, (float) 95.2381), + new CoordRec((float) 12.3419, (float) 76.1905), + new CoordRec((float) 7.58, (float) 52.381), + new CoordRec((float) 7.58, (float) 33.3333), + new CoordRec((float) 12.3419, (float) 9.5238), + new CoordRec((float) 21.8657, (float) -9.5238), + new CoordRec((float) 31.3895, (float) -23.8095), + new CoordRec((float) 40.9133, (float) -33.3333), +}; + +static final StrokeRec char40[] = { + new StrokeRec(10, char40_stroke0), +}; + +/* char: 41 ')' */ + +static final CoordRec char41_stroke0[] = { + new CoordRec((float) 5.28, (float) 119.048), + new CoordRec((float) 14.8038, (float) 109.524), + new CoordRec((float) 24.3276, (float) 95.2381), + new CoordRec((float) 33.8514, (float) 76.1905), + new CoordRec((float) 38.6133, (float) 52.381), + new CoordRec((float) 38.6133, (float) 33.3333), + new CoordRec((float) 33.8514, (float) 9.5238), + new CoordRec((float) 24.3276, (float) -9.5238), + new CoordRec((float) 14.8038, (float) -23.8095), + new CoordRec((float) 5.28, (float) -33.3333), +}; + +static final StrokeRec char41[] = { + new StrokeRec(10, char41_stroke0), +}; + +/* char: 42 '*' */ + +static final CoordRec char42_stroke0[] = { + new CoordRec((float) 30.7695, (float) 71.4286), + new CoordRec((float) 30.7695, (float) 14.2857), +}; + +static final CoordRec char42_stroke1[] = { + new CoordRec((float) 6.96, (float) 57.1429), + new CoordRec((float) 54.579, (float) 28.5714), +}; + +static final CoordRec char42_stroke2[] = { + new CoordRec((float) 54.579, (float) 57.1429), + new CoordRec((float) 6.96, (float) 28.5714), +}; + +static final StrokeRec char42[] = { + new StrokeRec(2, char42_stroke0), + new StrokeRec(2, char42_stroke1), + new StrokeRec(2, char42_stroke2), +}; + +/* char: 43 '+' */ + +static final CoordRec char43_stroke0[] = { + new CoordRec((float) 48.8371, (float) 85.7143), + new CoordRec((float) 48.8371, (float) 0), +}; + +static final CoordRec char43_stroke1[] = { + new CoordRec((float) 5.98, (float) 42.8571), + new CoordRec((float) 91.6943, (float) 42.8571), +}; + +static final StrokeRec char43[] = { + new StrokeRec(2, char43_stroke0), + new StrokeRec(2, char43_stroke1), +}; + +/* char: 44 ',' */ + +static final CoordRec char44_stroke0[] = { + new CoordRec((float) 18.2838, (float) 4.7619), + new CoordRec((float) 13.5219, (float) 0), + new CoordRec((float) 8.76, (float) 4.7619), + new CoordRec((float) 13.5219, (float) 9.5238), + new CoordRec((float) 18.2838, (float) 4.7619), + new CoordRec((float) 18.2838, (float) -4.7619), + new CoordRec((float) 13.5219, (float) -14.2857), + new CoordRec((float) 8.76, (float) -19.0476), +}; + +static final StrokeRec char44[] = { + new StrokeRec(8, char44_stroke0), +}; + +/* char: 45 '-' */ + +static final CoordRec char45_stroke0[] = { + new CoordRec((float) 7.38, (float) 42.8571), + new CoordRec((float) 93.0943, (float) 42.8571), +}; + +static final StrokeRec char45[] = { + new StrokeRec(2, char45_stroke0), +}; + +/* char: 46 '.' */ + +static final CoordRec char46_stroke0[] = { + new CoordRec((float) 13.1019, (float) 9.5238), + new CoordRec((float) 8.34, (float) 4.7619), + new CoordRec((float) 13.1019, (float) 0), + new CoordRec((float) 17.8638, (float) 4.7619), + new CoordRec((float) 13.1019, (float) 9.5238), +}; + +static final StrokeRec char46[] = { + new StrokeRec(5, char46_stroke0), +}; + +/* char: 47 '/' */ + +static final CoordRec char47_stroke0[] = { + new CoordRec((float) 7.24, (float) -14.2857), + new CoordRec((float) 73.9067, (float) 100), +}; + +static final StrokeRec char47[] = { + new StrokeRec(2, char47_stroke0), +}; + +/* char: 48 '0' */ + +static final CoordRec char48_stroke0[] = { + new CoordRec((float) 33.5514, (float) 100), + new CoordRec((float) 19.2657, (float) 95.2381), + new CoordRec((float) 9.7419, (float) 80.9524), + new CoordRec((float) 4.98, (float) 57.1429), + new CoordRec((float) 4.98, (float) 42.8571), + new CoordRec((float) 9.7419, (float) 19.0476), + new CoordRec((float) 19.2657, (float) 4.7619), + new CoordRec((float) 33.5514, (float) 0), + new CoordRec((float) 43.0752, (float) 0), + new CoordRec((float) 57.361, (float) 4.7619), + new CoordRec((float) 66.8848, (float) 19.0476), + new CoordRec((float) 71.6467, (float) 42.8571), + new CoordRec((float) 71.6467, (float) 57.1429), + new CoordRec((float) 66.8848, (float) 80.9524), + new CoordRec((float) 57.361, (float) 95.2381), + new CoordRec((float) 43.0752, (float) 100), + new CoordRec((float) 33.5514, (float) 100), +}; + +static final StrokeRec char48[] = { + new StrokeRec(17, char48_stroke0), +}; + +/* char: 49 '1' */ + +static final CoordRec char49_stroke0[] = { + new CoordRec((float) 11.82, (float) 80.9524), + new CoordRec((float) 21.3438, (float) 85.7143), + new CoordRec((float) 35.6295, (float) 100), + new CoordRec((float) 35.6295, (float) 0), +}; + +static final StrokeRec char49[] = { + new StrokeRec(4, char49_stroke0), +}; + +/* char: 50 '2' */ + +static final CoordRec char50_stroke0[] = { + new CoordRec((float) 10.1819, (float) 76.1905), + new CoordRec((float) 10.1819, (float) 80.9524), + new CoordRec((float) 14.9438, (float) 90.4762), + new CoordRec((float) 19.7057, (float) 95.2381), + new CoordRec((float) 29.2295, (float) 100), + new CoordRec((float) 48.2771, (float) 100), + new CoordRec((float) 57.801, (float) 95.2381), + new CoordRec((float) 62.5629, (float) 90.4762), + new CoordRec((float) 67.3248, (float) 80.9524), + new CoordRec((float) 67.3248, (float) 71.4286), + new CoordRec((float) 62.5629, (float) 61.9048), + new CoordRec((float) 53.039, (float) 47.619), + new CoordRec((float) 5.42, (float) 0), + new CoordRec((float) 72.0867, (float) 0), +}; + +static final StrokeRec char50[] = { + new StrokeRec(14, char50_stroke0), +}; + +/* char: 51 '3' */ + +static final CoordRec char51_stroke0[] = { + new CoordRec((float) 14.5238, (float) 100), + new CoordRec((float) 66.9048, (float) 100), + new CoordRec((float) 38.3333, (float) 61.9048), + new CoordRec((float) 52.619, (float) 61.9048), + new CoordRec((float) 62.1429, (float) 57.1429), + new CoordRec((float) 66.9048, (float) 52.381), + new CoordRec((float) 71.6667, (float) 38.0952), + new CoordRec((float) 71.6667, (float) 28.5714), + new CoordRec((float) 66.9048, (float) 14.2857), + new CoordRec((float) 57.381, (float) 4.7619), + new CoordRec((float) 43.0952, (float) 0), + new CoordRec((float) 28.8095, (float) 0), + new CoordRec((float) 14.5238, (float) 4.7619), + new CoordRec((float) 9.7619, (float) 9.5238), + new CoordRec((float) 5, (float) 19.0476), +}; + +static final StrokeRec char51[] = { + new StrokeRec(15, char51_stroke0), +}; + +/* char: 52 '4' */ + +static final CoordRec char52_stroke0[] = { + new CoordRec((float) 51.499, (float) 100), + new CoordRec((float) 3.88, (float) 33.3333), + new CoordRec((float) 75.3086, (float) 33.3333), +}; + +static final CoordRec char52_stroke1[] = { + new CoordRec((float) 51.499, (float) 100), + new CoordRec((float) 51.499, (float) 0), +}; + +static final StrokeRec char52[] = { + new StrokeRec(3, char52_stroke0), + new StrokeRec(2, char52_stroke1), +}; + +/* char: 53 '5' */ + +static final CoordRec char53_stroke0[] = { + new CoordRec((float) 62.0029, (float) 100), + new CoordRec((float) 14.3838, (float) 100), + new CoordRec((float) 9.6219, (float) 57.1429), + new CoordRec((float) 14.3838, (float) 61.9048), + new CoordRec((float) 28.6695, (float) 66.6667), + new CoordRec((float) 42.9552, (float) 66.6667), + new CoordRec((float) 57.241, (float) 61.9048), + new CoordRec((float) 66.7648, (float) 52.381), + new CoordRec((float) 71.5267, (float) 38.0952), + new CoordRec((float) 71.5267, (float) 28.5714), + new CoordRec((float) 66.7648, (float) 14.2857), + new CoordRec((float) 57.241, (float) 4.7619), + new CoordRec((float) 42.9552, (float) 0), + new CoordRec((float) 28.6695, (float) 0), + new CoordRec((float) 14.3838, (float) 4.7619), + new CoordRec((float) 9.6219, (float) 9.5238), + new CoordRec((float) 4.86, (float) 19.0476), +}; + +static final StrokeRec char53[] = { + new StrokeRec(17, char53_stroke0), +}; + +/* char: 54 '6' */ + +static final CoordRec char54_stroke0[] = { + new CoordRec((float) 62.7229, (float) 85.7143), + new CoordRec((float) 57.961, (float) 95.2381), + new CoordRec((float) 43.6752, (float) 100), + new CoordRec((float) 34.1514, (float) 100), + new CoordRec((float) 19.8657, (float) 95.2381), + new CoordRec((float) 10.3419, (float) 80.9524), + new CoordRec((float) 5.58, (float) 57.1429), + new CoordRec((float) 5.58, (float) 33.3333), + new CoordRec((float) 10.3419, (float) 14.2857), + new CoordRec((float) 19.8657, (float) 4.7619), + new CoordRec((float) 34.1514, (float) 0), + new CoordRec((float) 38.9133, (float) 0), + new CoordRec((float) 53.199, (float) 4.7619), + new CoordRec((float) 62.7229, (float) 14.2857), + new CoordRec((float) 67.4848, (float) 28.5714), + new CoordRec((float) 67.4848, (float) 33.3333), + new CoordRec((float) 62.7229, (float) 47.619), + new CoordRec((float) 53.199, (float) 57.1429), + new CoordRec((float) 38.9133, (float) 61.9048), + new CoordRec((float) 34.1514, (float) 61.9048), + new CoordRec((float) 19.8657, (float) 57.1429), + new CoordRec((float) 10.3419, (float) 47.619), + new CoordRec((float) 5.58, (float) 33.3333), +}; + +static final StrokeRec char54[] = { + new StrokeRec(23, char54_stroke0), +}; + +/* char: 55 '7' */ + +static final CoordRec char55_stroke0[] = { + new CoordRec((float) 72.2267, (float) 100), + new CoordRec((float) 24.6076, (float) 0), +}; + +static final CoordRec char55_stroke1[] = { + new CoordRec((float) 5.56, (float) 100), + new CoordRec((float) 72.2267, (float) 100), +}; + +static final StrokeRec char55[] = { + new StrokeRec(2, char55_stroke0), + new StrokeRec(2, char55_stroke1), +}; + +/* char: 56 '8' */ + +static final CoordRec char56_stroke0[] = { + new CoordRec((float) 29.4095, (float) 100), + new CoordRec((float) 15.1238, (float) 95.2381), + new CoordRec((float) 10.3619, (float) 85.7143), + new CoordRec((float) 10.3619, (float) 76.1905), + new CoordRec((float) 15.1238, (float) 66.6667), + new CoordRec((float) 24.6476, (float) 61.9048), + new CoordRec((float) 43.6952, (float) 57.1429), + new CoordRec((float) 57.981, (float) 52.381), + new CoordRec((float) 67.5048, (float) 42.8571), + new CoordRec((float) 72.2667, (float) 33.3333), + new CoordRec((float) 72.2667, (float) 19.0476), + new CoordRec((float) 67.5048, (float) 9.5238), + new CoordRec((float) 62.7429, (float) 4.7619), + new CoordRec((float) 48.4571, (float) 0), + new CoordRec((float) 29.4095, (float) 0), + new CoordRec((float) 15.1238, (float) 4.7619), + new CoordRec((float) 10.3619, (float) 9.5238), + new CoordRec((float) 5.6, (float) 19.0476), + new CoordRec((float) 5.6, (float) 33.3333), + new CoordRec((float) 10.3619, (float) 42.8571), + new CoordRec((float) 19.8857, (float) 52.381), + new CoordRec((float) 34.1714, (float) 57.1429), + new CoordRec((float) 53.219, (float) 61.9048), + new CoordRec((float) 62.7429, (float) 66.6667), + new CoordRec((float) 67.5048, (float) 76.1905), + new CoordRec((float) 67.5048, (float) 85.7143), + new CoordRec((float) 62.7429, (float) 95.2381), + new CoordRec((float) 48.4571, (float) 100), + new CoordRec((float) 29.4095, (float) 100), +}; + +static final StrokeRec char56[] = { + new StrokeRec(29, char56_stroke0), +}; + +/* char: 57 '9' */ + +static final CoordRec char57_stroke0[] = { + new CoordRec((float) 68.5048, (float) 66.6667), + new CoordRec((float) 63.7429, (float) 52.381), + new CoordRec((float) 54.219, (float) 42.8571), + new CoordRec((float) 39.9333, (float) 38.0952), + new CoordRec((float) 35.1714, (float) 38.0952), + new CoordRec((float) 20.8857, (float) 42.8571), + new CoordRec((float) 11.3619, (float) 52.381), + new CoordRec((float) 6.6, (float) 66.6667), + new CoordRec((float) 6.6, (float) 71.4286), + new CoordRec((float) 11.3619, (float) 85.7143), + new CoordRec((float) 20.8857, (float) 95.2381), + new CoordRec((float) 35.1714, (float) 100), + new CoordRec((float) 39.9333, (float) 100), + new CoordRec((float) 54.219, (float) 95.2381), + new CoordRec((float) 63.7429, (float) 85.7143), + new CoordRec((float) 68.5048, (float) 66.6667), + new CoordRec((float) 68.5048, (float) 42.8571), + new CoordRec((float) 63.7429, (float) 19.0476), + new CoordRec((float) 54.219, (float) 4.7619), + new CoordRec((float) 39.9333, (float) 0), + new CoordRec((float) 30.4095, (float) 0), + new CoordRec((float) 16.1238, (float) 4.7619), + new CoordRec((float) 11.3619, (float) 14.2857), +}; + +static final StrokeRec char57[] = { + new StrokeRec(23, char57_stroke0), +}; + +/* char: 58 ':' */ + +static final CoordRec char58_stroke0[] = { + new CoordRec((float) 14.0819, (float) 66.6667), + new CoordRec((float) 9.32, (float) 61.9048), + new CoordRec((float) 14.0819, (float) 57.1429), + new CoordRec((float) 18.8438, (float) 61.9048), + new CoordRec((float) 14.0819, (float) 66.6667), +}; + +static final CoordRec char58_stroke1[] = { + new CoordRec((float) 14.0819, (float) 9.5238), + new CoordRec((float) 9.32, (float) 4.7619), + new CoordRec((float) 14.0819, (float) 0), + new CoordRec((float) 18.8438, (float) 4.7619), + new CoordRec((float) 14.0819, (float) 9.5238), +}; + +static final StrokeRec char58[] = { + new StrokeRec(5, char58_stroke0), + new StrokeRec(5, char58_stroke1), +}; + +/* char: 59 ';' */ + +static final CoordRec char59_stroke0[] = { + new CoordRec((float) 12.9619, (float) 66.6667), + new CoordRec((float) 8.2, (float) 61.9048), + new CoordRec((float) 12.9619, (float) 57.1429), + new CoordRec((float) 17.7238, (float) 61.9048), + new CoordRec((float) 12.9619, (float) 66.6667), +}; + +static final CoordRec char59_stroke1[] = { + new CoordRec((float) 17.7238, (float) 4.7619), + new CoordRec((float) 12.9619, (float) 0), + new CoordRec((float) 8.2, (float) 4.7619), + new CoordRec((float) 12.9619, (float) 9.5238), + new CoordRec((float) 17.7238, (float) 4.7619), + new CoordRec((float) 17.7238, (float) -4.7619), + new CoordRec((float) 12.9619, (float) -14.2857), + new CoordRec((float) 8.2, (float) -19.0476), +}; + +static final StrokeRec char59[] = { + new StrokeRec(5, char59_stroke0), + new StrokeRec(8, char59_stroke1), +}; + +/* char: 60 '<' */ + +static final CoordRec char60_stroke0[] = { + new CoordRec((float) 79.2505, (float) 85.7143), + new CoordRec((float) 3.06, (float) 42.8571), + new CoordRec((float) 79.2505, (float) 0), +}; + +static final StrokeRec char60[] = { + new StrokeRec(3, char60_stroke0), +}; + +/* char: 61 '=' */ + +static final CoordRec char61_stroke0[] = { + new CoordRec((float) 5.7, (float) 57.1429), + new CoordRec((float) 91.4143, (float) 57.1429), +}; + +static final CoordRec char61_stroke1[] = { + new CoordRec((float) 5.7, (float) 28.5714), + new CoordRec((float) 91.4143, (float) 28.5714), +}; + +static final StrokeRec char61[] = { + new StrokeRec(2, char61_stroke0), + new StrokeRec(2, char61_stroke1), +}; + +/* char: 62 '>' */ + +static final CoordRec char62_stroke0[] = { + new CoordRec((float) 2.78, (float) 85.7143), + new CoordRec((float) 78.9705, (float) 42.8571), + new CoordRec((float) 2.78, (float) 0), +}; + +static final StrokeRec char62[] = { + new StrokeRec(3, char62_stroke0), +}; + +/* char: 63 '?' */ + +static final CoordRec char63_stroke0[] = { + new CoordRec((float) 8.42, (float) 76.1905), + new CoordRec((float) 8.42, (float) 80.9524), + new CoordRec((float) 13.1819, (float) 90.4762), + new CoordRec((float) 17.9438, (float) 95.2381), + new CoordRec((float) 27.4676, (float) 100), + new CoordRec((float) 46.5152, (float) 100), + new CoordRec((float) 56.039, (float) 95.2381), + new CoordRec((float) 60.801, (float) 90.4762), + new CoordRec((float) 65.5629, (float) 80.9524), + new CoordRec((float) 65.5629, (float) 71.4286), + new CoordRec((float) 60.801, (float) 61.9048), + new CoordRec((float) 56.039, (float) 57.1429), + new CoordRec((float) 36.9914, (float) 47.619), + new CoordRec((float) 36.9914, (float) 33.3333), +}; + +static final CoordRec char63_stroke1[] = { + new CoordRec((float) 36.9914, (float) 9.5238), + new CoordRec((float) 32.2295, (float) 4.7619), + new CoordRec((float) 36.9914, (float) 0), + new CoordRec((float) 41.7533, (float) 4.7619), + new CoordRec((float) 36.9914, (float) 9.5238), +}; + +static final StrokeRec char63[] = { + new StrokeRec(14, char63_stroke0), + new StrokeRec(5, char63_stroke1), +}; + +/* char: 64 '@' */ + +static final CoordRec char64_stroke0[] = { + new CoordRec((float) 49.2171, (float) 52.381), + new CoordRec((float) 39.6933, (float) 57.1429), + new CoordRec((float) 30.1695, (float) 57.1429), + new CoordRec((float) 25.4076, (float) 47.619), + new CoordRec((float) 25.4076, (float) 42.8571), + new CoordRec((float) 30.1695, (float) 33.3333), + new CoordRec((float) 39.6933, (float) 33.3333), + new CoordRec((float) 49.2171, (float) 38.0952), +}; + +static final CoordRec char64_stroke1[] = { + new CoordRec((float) 49.2171, (float) 57.1429), + new CoordRec((float) 49.2171, (float) 38.0952), + new CoordRec((float) 53.979, (float) 33.3333), + new CoordRec((float) 63.5029, (float) 33.3333), + new CoordRec((float) 68.2648, (float) 42.8571), + new CoordRec((float) 68.2648, (float) 47.619), + new CoordRec((float) 63.5029, (float) 61.9048), + new CoordRec((float) 53.979, (float) 71.4286), + new CoordRec((float) 39.6933, (float) 76.1905), + new CoordRec((float) 34.9314, (float) 76.1905), + new CoordRec((float) 20.6457, (float) 71.4286), + new CoordRec((float) 11.1219, (float) 61.9048), + new CoordRec((float) 6.36, (float) 47.619), + new CoordRec((float) 6.36, (float) 42.8571), + new CoordRec((float) 11.1219, (float) 28.5714), + new CoordRec((float) 20.6457, (float) 19.0476), + new CoordRec((float) 34.9314, (float) 14.2857), + new CoordRec((float) 39.6933, (float) 14.2857), + new CoordRec((float) 53.979, (float) 19.0476), +}; + +static final StrokeRec char64[] = { + new StrokeRec(8, char64_stroke0), + new StrokeRec(19, char64_stroke1), +}; + +/* char: 65 'A' */ + +static final CoordRec char65_stroke0[] = { + new CoordRec((float) 40.5952, (float) 100), + new CoordRec((float) 2.5, (float) 0), +}; + +static final CoordRec char65_stroke1[] = { + new CoordRec((float) 40.5952, (float) 100), + new CoordRec((float) 78.6905, (float) 0), +}; + +static final CoordRec char65_stroke2[] = { + new CoordRec((float) 16.7857, (float) 33.3333), + new CoordRec((float) 64.4048, (float) 33.3333), +}; + +static final StrokeRec char65[] = { + new StrokeRec(2, char65_stroke0), + new StrokeRec(2, char65_stroke1), + new StrokeRec(2, char65_stroke2), +}; + +/* char: 66 'B' */ + +static final CoordRec char66_stroke0[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 11.42, (float) 0), +}; + +static final CoordRec char66_stroke1[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 54.2771, (float) 100), + new CoordRec((float) 68.5629, (float) 95.2381), + new CoordRec((float) 73.3248, (float) 90.4762), + new CoordRec((float) 78.0867, (float) 80.9524), + new CoordRec((float) 78.0867, (float) 71.4286), + new CoordRec((float) 73.3248, (float) 61.9048), + new CoordRec((float) 68.5629, (float) 57.1429), + new CoordRec((float) 54.2771, (float) 52.381), +}; + +static final CoordRec char66_stroke2[] = { + new CoordRec((float) 11.42, (float) 52.381), + new CoordRec((float) 54.2771, (float) 52.381), + new CoordRec((float) 68.5629, (float) 47.619), + new CoordRec((float) 73.3248, (float) 42.8571), + new CoordRec((float) 78.0867, (float) 33.3333), + new CoordRec((float) 78.0867, (float) 19.0476), + new CoordRec((float) 73.3248, (float) 9.5238), + new CoordRec((float) 68.5629, (float) 4.7619), + new CoordRec((float) 54.2771, (float) 0), + new CoordRec((float) 11.42, (float) 0), +}; + +static final StrokeRec char66[] = { + new StrokeRec(2, char66_stroke0), + new StrokeRec(9, char66_stroke1), + new StrokeRec(10, char66_stroke2), +}; + +/* char: 67 'C' */ + +static final CoordRec char67_stroke0[] = { + new CoordRec((float) 78.0886, (float) 76.1905), + new CoordRec((float) 73.3267, (float) 85.7143), + new CoordRec((float) 63.8029, (float) 95.2381), + new CoordRec((float) 54.279, (float) 100), + new CoordRec((float) 35.2314, (float) 100), + new CoordRec((float) 25.7076, (float) 95.2381), + new CoordRec((float) 16.1838, (float) 85.7143), + new CoordRec((float) 11.4219, (float) 76.1905), + new CoordRec((float) 6.66, (float) 61.9048), + new CoordRec((float) 6.66, (float) 38.0952), + new CoordRec((float) 11.4219, (float) 23.8095), + new CoordRec((float) 16.1838, (float) 14.2857), + new CoordRec((float) 25.7076, (float) 4.7619), + new CoordRec((float) 35.2314, (float) 0), + new CoordRec((float) 54.279, (float) 0), + new CoordRec((float) 63.8029, (float) 4.7619), + new CoordRec((float) 73.3267, (float) 14.2857), + new CoordRec((float) 78.0886, (float) 23.8095), +}; + +static final StrokeRec char67[] = { + new StrokeRec(18, char67_stroke0), +}; + +/* char: 68 'D' */ + +static final CoordRec char68_stroke0[] = { + new CoordRec((float) 11.96, (float) 100), + new CoordRec((float) 11.96, (float) 0), +}; + +static final CoordRec char68_stroke1[] = { + new CoordRec((float) 11.96, (float) 100), + new CoordRec((float) 45.2933, (float) 100), + new CoordRec((float) 59.579, (float) 95.2381), + new CoordRec((float) 69.1029, (float) 85.7143), + new CoordRec((float) 73.8648, (float) 76.1905), + new CoordRec((float) 78.6267, (float) 61.9048), + new CoordRec((float) 78.6267, (float) 38.0952), + new CoordRec((float) 73.8648, (float) 23.8095), + new CoordRec((float) 69.1029, (float) 14.2857), + new CoordRec((float) 59.579, (float) 4.7619), + new CoordRec((float) 45.2933, (float) 0), + new CoordRec((float) 11.96, (float) 0), +}; + +static final StrokeRec char68[] = { + new StrokeRec(2, char68_stroke0), + new StrokeRec(12, char68_stroke1), +}; + +/* char: 69 'E' */ + +static final CoordRec char69_stroke0[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 11.42, (float) 0), +}; + +static final CoordRec char69_stroke1[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 73.3248, (float) 100), +}; + +static final CoordRec char69_stroke2[] = { + new CoordRec((float) 11.42, (float) 52.381), + new CoordRec((float) 49.5152, (float) 52.381), +}; + +static final CoordRec char69_stroke3[] = { + new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 73.3248, (float) 0), +}; + +static final StrokeRec char69[] = { + new StrokeRec(2, char69_stroke0), + new StrokeRec(2, char69_stroke1), + new StrokeRec(2, char69_stroke2), + new StrokeRec(2, char69_stroke3), +}; + +/* char: 70 'F' */ + +static final CoordRec char70_stroke0[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 11.42, (float) 0), +}; + +static final CoordRec char70_stroke1[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 73.3248, (float) 100), +}; + +static final CoordRec char70_stroke2[] = { + new CoordRec((float) 11.42, (float) 52.381), + new CoordRec((float) 49.5152, (float) 52.381), +}; + +static final StrokeRec char70[] = { + new StrokeRec(2, char70_stroke0), + new StrokeRec(2, char70_stroke1), + new StrokeRec(2, char70_stroke2), +}; + +/* char: 71 'G' */ + +static final CoordRec char71_stroke0[] = { + new CoordRec((float) 78.4886, (float) 76.1905), + new CoordRec((float) 73.7267, (float) 85.7143), + new CoordRec((float) 64.2029, (float) 95.2381), + new CoordRec((float) 54.679, (float) 100), + new CoordRec((float) 35.6314, (float) 100), + new CoordRec((float) 26.1076, (float) 95.2381), + new CoordRec((float) 16.5838, (float) 85.7143), + new CoordRec((float) 11.8219, (float) 76.1905), + new CoordRec((float) 7.06, (float) 61.9048), + new CoordRec((float) 7.06, (float) 38.0952), + new CoordRec((float) 11.8219, (float) 23.8095), + new CoordRec((float) 16.5838, (float) 14.2857), + new CoordRec((float) 26.1076, (float) 4.7619), + new CoordRec((float) 35.6314, (float) 0), + new CoordRec((float) 54.679, (float) 0), + new CoordRec((float) 64.2029, (float) 4.7619), + new CoordRec((float) 73.7267, (float) 14.2857), + new CoordRec((float) 78.4886, (float) 23.8095), + new CoordRec((float) 78.4886, (float) 38.0952), +}; + +static final CoordRec char71_stroke1[] = { + new CoordRec((float) 54.679, (float) 38.0952), + new CoordRec((float) 78.4886, (float) 38.0952), +}; + +static final StrokeRec char71[] = { + new StrokeRec(19, char71_stroke0), + new StrokeRec(2, char71_stroke1), +}; + +/* char: 72 'H' */ + +static final CoordRec char72_stroke0[] = { + new CoordRec((float) 11.42, (float) 100), + new CoordRec((float) 11.42, (float) 0), +}; + +static final CoordRec char72_stroke1[] = { + new CoordRec((float) 78.0867, (float) 100), + new CoordRec((float) 78.0867, (float) 0), +}; + +static final CoordRec char72_stroke2[] = { + new CoordRec((float) 11.42, (float) 52.381), + new CoordRec((float) 78.0867, (float) 52.381), +}; + +static final StrokeRec char72[] = { + new StrokeRec(2, char72_stroke0), + new StrokeRec(2, char72_stroke1), + new StrokeRec(2, char72_stroke2), +}; + +/* char: 73 'I' */ + +static final CoordRec char73_stroke0[] = { + new CoordRec((float) 10.86, (float) 100), + new CoordRec((float) 10.86, (float) 0), +}; + +static final StrokeRec char73[] = { + new StrokeRec(2, char73_stroke0), +}; + +/* char: 74 'J' */ + +static final CoordRec char74_stroke0[] = { + new CoordRec((float) 50.119, (float) 100), + new CoordRec((float) 50.119, (float) 23.8095), + new CoordRec((float) 45.3571, (float) 9.5238), + new CoordRec((float) 40.5952, (float) 4.7619), + new CoordRec((float) 31.0714, (float) 0), + new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 12.0238, (float) 4.7619), + new CoordRec((float) 7.2619, (float) 9.5238), + new CoordRec((float) 2.5, (float) 23.8095), + new CoordRec((float) 2.5, (float) 33.3333), +}; + +static final StrokeRec char74[] = { + new StrokeRec(10, char74_stroke0), +}; + +/* char: 75 'K' */ + +static final CoordRec char75_stroke0[] = { + new CoordRec((float) 11.28, (float) 100), + new CoordRec((float) 11.28, (float) 0), +}; + +static final CoordRec char75_stroke1[] = { + new CoordRec((float) 77.9467, (float) 100), + new CoordRec((float) 11.28, (float) 33.3333), +}; + +static final CoordRec char75_stroke2[] = { + new CoordRec((float) 35.0895, (float) 57.1429), + new CoordRec((float) 77.9467, (float) 0), +}; + +static final StrokeRec char75[] = { + new StrokeRec(2, char75_stroke0), + new StrokeRec(2, char75_stroke1), + new StrokeRec(2, char75_stroke2), +}; + +/* char: 76 'L' */ + +static final CoordRec char76_stroke0[] = { + new CoordRec((float) 11.68, (float) 100), + new CoordRec((float) 11.68, (float) 0), +}; + +static final CoordRec char76_stroke1[] = { + new CoordRec((float) 11.68, (float) 0), + new CoordRec((float) 68.8229, (float) 0), +}; + +static final StrokeRec char76[] = { + new StrokeRec(2, char76_stroke0), + new StrokeRec(2, char76_stroke1), +}; + +/* char: 77 'M' */ + +static final CoordRec char77_stroke0[] = { + new CoordRec((float) 10.86, (float) 100), + new CoordRec((float) 10.86, (float) 0), +}; + +static final CoordRec char77_stroke1[] = { + new CoordRec((float) 10.86, (float) 100), + new CoordRec((float) 48.9552, (float) 0), +}; + +static final CoordRec char77_stroke2[] = { + new CoordRec((float) 87.0505, (float) 100), + new CoordRec((float) 48.9552, (float) 0), +}; + +static final CoordRec char77_stroke3[] = { + new CoordRec((float) 87.0505, (float) 100), + new CoordRec((float) 87.0505, (float) 0), +}; + +static final StrokeRec char77[] = { + new StrokeRec(2, char77_stroke0), + new StrokeRec(2, char77_stroke1), + new StrokeRec(2, char77_stroke2), + new StrokeRec(2, char77_stroke3), +}; + +/* char: 78 'N' */ + +static final CoordRec char78_stroke0[] = { + new CoordRec((float) 11.14, (float) 100), + new CoordRec((float) 11.14, (float) 0), +}; + +static final CoordRec char78_stroke1[] = { + new CoordRec((float) 11.14, (float) 100), + new CoordRec((float) 77.8067, (float) 0), +}; + +static final CoordRec char78_stroke2[] = { + new CoordRec((float) 77.8067, (float) 100), + new CoordRec((float) 77.8067, (float) 0), +}; + +static final StrokeRec char78[] = { + new StrokeRec(2, char78_stroke0), + new StrokeRec(2, char78_stroke1), + new StrokeRec(2, char78_stroke2), +}; + +/* char: 79 'O' */ + +static final CoordRec char79_stroke0[] = { + new CoordRec((float) 34.8114, (float) 100), + new CoordRec((float) 25.2876, (float) 95.2381), + new CoordRec((float) 15.7638, (float) 85.7143), + new CoordRec((float) 11.0019, (float) 76.1905), + new CoordRec((float) 6.24, (float) 61.9048), + new CoordRec((float) 6.24, (float) 38.0952), + new CoordRec((float) 11.0019, (float) 23.8095), + new CoordRec((float) 15.7638, (float) 14.2857), + new CoordRec((float) 25.2876, (float) 4.7619), + new CoordRec((float) 34.8114, (float) 0), + new CoordRec((float) 53.859, (float) 0), + new CoordRec((float) 63.3829, (float) 4.7619), + new CoordRec((float) 72.9067, (float) 14.2857), + new CoordRec((float) 77.6686, (float) 23.8095), + new CoordRec((float) 82.4305, (float) 38.0952), + new CoordRec((float) 82.4305, (float) 61.9048), + new CoordRec((float) 77.6686, (float) 76.1905), + new CoordRec((float) 72.9067, (float) 85.7143), + new CoordRec((float) 63.3829, (float) 95.2381), + new CoordRec((float) 53.859, (float) 100), + new CoordRec((float) 34.8114, (float) 100), +}; + +static final StrokeRec char79[] = { + new StrokeRec(21, char79_stroke0), +}; + +/* char: 80 'P' */ + +static final CoordRec char80_stroke0[] = { + new CoordRec((float) 12.1, (float) 100), + new CoordRec((float) 12.1, (float) 0), +}; + +static final CoordRec char80_stroke1[] = { + new CoordRec((float) 12.1, (float) 100), + new CoordRec((float) 54.9571, (float) 100), + new CoordRec((float) 69.2429, (float) 95.2381), + new CoordRec((float) 74.0048, (float) 90.4762), + new CoordRec((float) 78.7667, (float) 80.9524), + new CoordRec((float) 78.7667, (float) 66.6667), + new CoordRec((float) 74.0048, (float) 57.1429), + new CoordRec((float) 69.2429, (float) 52.381), + new CoordRec((float) 54.9571, (float) 47.619), + new CoordRec((float) 12.1, (float) 47.619), +}; + +static final StrokeRec char80[] = { + new StrokeRec(2, char80_stroke0), + new StrokeRec(10, char80_stroke1), +}; + +/* char: 81 'Q' */ + +static final CoordRec char81_stroke0[] = { + new CoordRec((float) 33.8714, (float) 100), + new CoordRec((float) 24.3476, (float) 95.2381), + new CoordRec((float) 14.8238, (float) 85.7143), + new CoordRec((float) 10.0619, (float) 76.1905), + new CoordRec((float) 5.3, (float) 61.9048), + new CoordRec((float) 5.3, (float) 38.0952), + new CoordRec((float) 10.0619, (float) 23.8095), + new CoordRec((float) 14.8238, (float) 14.2857), + new CoordRec((float) 24.3476, (float) 4.7619), + new CoordRec((float) 33.8714, (float) 0), + new CoordRec((float) 52.919, (float) 0), + new CoordRec((float) 62.4429, (float) 4.7619), + new CoordRec((float) 71.9667, (float) 14.2857), + new CoordRec((float) 76.7286, (float) 23.8095), + new CoordRec((float) 81.4905, (float) 38.0952), + new CoordRec((float) 81.4905, (float) 61.9048), + new CoordRec((float) 76.7286, (float) 76.1905), + new CoordRec((float) 71.9667, (float) 85.7143), + new CoordRec((float) 62.4429, (float) 95.2381), + new CoordRec((float) 52.919, (float) 100), + new CoordRec((float) 33.8714, (float) 100), +}; + +static final CoordRec char81_stroke1[] = { + new CoordRec((float) 48.1571, (float) 19.0476), + new CoordRec((float) 76.7286, (float) -9.5238), +}; + +static final StrokeRec char81[] = { + new StrokeRec(21, char81_stroke0), + new StrokeRec(2, char81_stroke1), +}; + +/* char: 82 'R' */ + +static final CoordRec char82_stroke0[] = { + new CoordRec((float) 11.68, (float) 100), + new CoordRec((float) 11.68, (float) 0), +}; + +static final CoordRec char82_stroke1[] = { + new CoordRec((float) 11.68, (float) 100), + new CoordRec((float) 54.5371, (float) 100), + new CoordRec((float) 68.8229, (float) 95.2381), + new CoordRec((float) 73.5848, (float) 90.4762), + new CoordRec((float) 78.3467, (float) 80.9524), + new CoordRec((float) 78.3467, (float) 71.4286), + new CoordRec((float) 73.5848, (float) 61.9048), + new CoordRec((float) 68.8229, (float) 57.1429), + new CoordRec((float) 54.5371, (float) 52.381), + new CoordRec((float) 11.68, (float) 52.381), +}; + +static final CoordRec char82_stroke2[] = { + new CoordRec((float) 45.0133, (float) 52.381), + new CoordRec((float) 78.3467, (float) 0), +}; + +static final StrokeRec char82[] = { + new StrokeRec(2, char82_stroke0), + new StrokeRec(10, char82_stroke1), + new StrokeRec(2, char82_stroke2), +}; + +/* char: 83 'S' */ + +static final CoordRec char83_stroke0[] = { + new CoordRec((float) 74.6667, (float) 85.7143), + new CoordRec((float) 65.1429, (float) 95.2381), + new CoordRec((float) 50.8571, (float) 100), + new CoordRec((float) 31.8095, (float) 100), + new CoordRec((float) 17.5238, (float) 95.2381), + new CoordRec((float) 8, (float) 85.7143), + new CoordRec((float) 8, (float) 76.1905), + new CoordRec((float) 12.7619, (float) 66.6667), + new CoordRec((float) 17.5238, (float) 61.9048), + new CoordRec((float) 27.0476, (float) 57.1429), + new CoordRec((float) 55.619, (float) 47.619), + new CoordRec((float) 65.1429, (float) 42.8571), + new CoordRec((float) 69.9048, (float) 38.0952), + new CoordRec((float) 74.6667, (float) 28.5714), + new CoordRec((float) 74.6667, (float) 14.2857), + new CoordRec((float) 65.1429, (float) 4.7619), + new CoordRec((float) 50.8571, (float) 0), + new CoordRec((float) 31.8095, (float) 0), + new CoordRec((float) 17.5238, (float) 4.7619), + new CoordRec((float) 8, (float) 14.2857), +}; + +static final StrokeRec char83[] = { + new StrokeRec(20, char83_stroke0), +}; + +/* char: 84 'T' */ + +static final CoordRec char84_stroke0[] = { + new CoordRec((float) 35.6933, (float) 100), + new CoordRec((float) 35.6933, (float) 0), +}; + +static final CoordRec char84_stroke1[] = { + new CoordRec((float) 2.36, (float) 100), + new CoordRec((float) 69.0267, (float) 100), +}; + +static final StrokeRec char84[] = { + new StrokeRec(2, char84_stroke0), + new StrokeRec(2, char84_stroke1), +}; + +/* char: 85 'U' */ + +static final CoordRec char85_stroke0[] = { + new CoordRec((float) 11.54, (float) 100), + new CoordRec((float) 11.54, (float) 28.5714), + new CoordRec((float) 16.3019, (float) 14.2857), + new CoordRec((float) 25.8257, (float) 4.7619), + new CoordRec((float) 40.1114, (float) 0), + new CoordRec((float) 49.6352, (float) 0), + new CoordRec((float) 63.921, (float) 4.7619), + new CoordRec((float) 73.4448, (float) 14.2857), + new CoordRec((float) 78.2067, (float) 28.5714), + new CoordRec((float) 78.2067, (float) 100), +}; + +static final StrokeRec char85[] = { + new StrokeRec(10, char85_stroke0), +}; + +/* char: 86 'V' */ + +static final CoordRec char86_stroke0[] = { + new CoordRec((float) 2.36, (float) 100), + new CoordRec((float) 40.4552, (float) 0), +}; + +static final CoordRec char86_stroke1[] = { + new CoordRec((float) 78.5505, (float) 100), + new CoordRec((float) 40.4552, (float) 0), +}; + +static final StrokeRec char86[] = { + new StrokeRec(2, char86_stroke0), + new StrokeRec(2, char86_stroke1), +}; + +/* char: 87 'W' */ + +static final CoordRec char87_stroke0[] = { + new CoordRec((float) 2.22, (float) 100), + new CoordRec((float) 26.0295, (float) 0), +}; + +static final CoordRec char87_stroke1[] = { + new CoordRec((float) 49.839, (float) 100), + new CoordRec((float) 26.0295, (float) 0), +}; + +static final CoordRec char87_stroke2[] = { + new CoordRec((float) 49.839, (float) 100), + new CoordRec((float) 73.6486, (float) 0), +}; + +static final CoordRec char87_stroke3[] = { + new CoordRec((float) 97.4581, (float) 100), + new CoordRec((float) 73.6486, (float) 0), +}; + +static final StrokeRec char87[] = { + new StrokeRec(2, char87_stroke0), + new StrokeRec(2, char87_stroke1), + new StrokeRec(2, char87_stroke2), + new StrokeRec(2, char87_stroke3), +}; + +/* char: 88 'X' */ + +static final CoordRec char88_stroke0[] = { + new CoordRec((float) 2.5, (float) 100), + new CoordRec((float) 69.1667, (float) 0), +}; + +static final CoordRec char88_stroke1[] = { + new CoordRec((float) 69.1667, (float) 100), + new CoordRec((float) 2.5, (float) 0), +}; + +static final StrokeRec char88[] = { + new StrokeRec(2, char88_stroke0), + new StrokeRec(2, char88_stroke1), +}; + +/* char: 89 'Y' */ + +static final CoordRec char89_stroke0[] = { + new CoordRec((float) 1.52, (float) 100), + new CoordRec((float) 39.6152, (float) 52.381), + new CoordRec((float) 39.6152, (float) 0), +}; + +static final CoordRec char89_stroke1[] = { + new CoordRec((float) 77.7105, (float) 100), + new CoordRec((float) 39.6152, (float) 52.381), +}; + +static final StrokeRec char89[] = { + new StrokeRec(3, char89_stroke0), + new StrokeRec(2, char89_stroke1), +}; + +/* char: 90 'Z' */ + +static final CoordRec char90_stroke0[] = { + new CoordRec((float) 69.1667, (float) 100), + new CoordRec((float) 2.5, (float) 0), +}; + +static final CoordRec char90_stroke1[] = { + new CoordRec((float) 2.5, (float) 100), + new CoordRec((float) 69.1667, (float) 100), +}; + +static final CoordRec char90_stroke2[] = { + new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 69.1667, (float) 0), +}; + +static final StrokeRec char90[] = { + new StrokeRec(2, char90_stroke0), + new StrokeRec(2, char90_stroke1), + new StrokeRec(2, char90_stroke2), +}; + +/* char: 91 '[' */ + +static final CoordRec char91_stroke0[] = { + new CoordRec((float) 7.78, (float) 119.048), + new CoordRec((float) 7.78, (float) -33.3333), +}; + +static final CoordRec char91_stroke1[] = { + new CoordRec((float) 12.5419, (float) 119.048), + new CoordRec((float) 12.5419, (float) -33.3333), +}; + +static final CoordRec char91_stroke2[] = { + new CoordRec((float) 7.78, (float) 119.048), + new CoordRec((float) 41.1133, (float) 119.048), +}; + +static final CoordRec char91_stroke3[] = { + new CoordRec((float) 7.78, (float) -33.3333), + new CoordRec((float) 41.1133, (float) -33.3333), +}; + +static final StrokeRec char91[] = { + new StrokeRec(2, char91_stroke0), + new StrokeRec(2, char91_stroke1), + new StrokeRec(2, char91_stroke2), + new StrokeRec(2, char91_stroke3), +}; + +/* char: 92 '\' */ + +static final CoordRec char92_stroke0[] = { + new CoordRec((float) 5.84, (float) 100), + new CoordRec((float) 72.5067, (float) -14.2857), +}; + +static final StrokeRec char92[] = { + new StrokeRec(2, char92_stroke0), +}; + +/* char: 93 ']' */ + +static final CoordRec char93_stroke0[] = { + new CoordRec((float) 33.0114, (float) 119.048), + new CoordRec((float) 33.0114, (float) -33.3333), +}; + +static final CoordRec char93_stroke1[] = { + new CoordRec((float) 37.7733, (float) 119.048), + new CoordRec((float) 37.7733, (float) -33.3333), +}; + +static final CoordRec char93_stroke2[] = { + new CoordRec((float) 4.44, (float) 119.048), + new CoordRec((float) 37.7733, (float) 119.048), +}; + +static final CoordRec char93_stroke3[] = { + new CoordRec((float) 4.44, (float) -33.3333), + new CoordRec((float) 37.7733, (float) -33.3333), +}; + +static final StrokeRec char93[] = { + new StrokeRec(2, char93_stroke0), + new StrokeRec(2, char93_stroke1), + new StrokeRec(2, char93_stroke2), + new StrokeRec(2, char93_stroke3), +}; + +/* char: 94 '^' */ + +static final CoordRec char94_stroke0[] = { + new CoordRec((float) 44.0752, (float) 109.524), + new CoordRec((float) 5.98, (float) 42.8571), +}; + +static final CoordRec char94_stroke1[] = { + new CoordRec((float) 44.0752, (float) 109.524), + new CoordRec((float) 82.1705, (float) 42.8571), +}; + +static final StrokeRec char94[] = { + new StrokeRec(2, char94_stroke0), + new StrokeRec(2, char94_stroke1), +}; + +/* char: 95 '_' */ + +static final CoordRec char95_stroke0[] = { + new CoordRec((float)-1.1, (float) -33.3333), + new CoordRec((float) 103.662, (float) -33.3333), + new CoordRec((float) 103.662, (float) -28.5714), + new CoordRec((float)-1.1, (float) -28.5714), + new CoordRec((float)-1.1, (float) -33.3333), +}; + +static final StrokeRec char95[] = { + new StrokeRec(5, char95_stroke0), +}; + +/* char: 96 '`' */ + +static final CoordRec char96_stroke0[] = { + new CoordRec((float) 33.0219, (float) 100), + new CoordRec((float) 56.8314, (float) 71.4286), +}; + +static final CoordRec char96_stroke1[] = { + new CoordRec((float) 33.0219, (float) 100), + new CoordRec((float) 28.26, (float) 95.2381), + new CoordRec((float) 56.8314, (float) 71.4286), +}; + +static final StrokeRec char96[] = { + new StrokeRec(2, char96_stroke0), + new StrokeRec(3, char96_stroke1), +}; + +/* char: 97 'a' */ + +static final CoordRec char97_stroke0[] = { + new CoordRec((float) 63.8229, (float) 66.6667), + new CoordRec((float) 63.8229, (float) 0), +}; + +static final CoordRec char97_stroke1[] = { + new CoordRec((float) 63.8229, (float) 52.381), + new CoordRec((float) 54.299, (float) 61.9048), + new CoordRec((float) 44.7752, (float) 66.6667), + new CoordRec((float) 30.4895, (float) 66.6667), + new CoordRec((float) 20.9657, (float) 61.9048), + new CoordRec((float) 11.4419, (float) 52.381), + new CoordRec((float) 6.68, (float) 38.0952), + new CoordRec((float) 6.68, (float) 28.5714), + new CoordRec((float) 11.4419, (float) 14.2857), + new CoordRec((float) 20.9657, (float) 4.7619), + new CoordRec((float) 30.4895, (float) 0), + new CoordRec((float) 44.7752, (float) 0), + new CoordRec((float) 54.299, (float) 4.7619), + new CoordRec((float) 63.8229, (float) 14.2857), +}; + +static final StrokeRec char97[] = { + new StrokeRec(2, char97_stroke0), + new StrokeRec(14, char97_stroke1), +}; + +/* char: 98 'b' */ + +static final CoordRec char98_stroke0[] = { + new CoordRec((float) 8.76, (float) 100), + new CoordRec((float) 8.76, (float) 0), +}; + +static final CoordRec char98_stroke1[] = { + new CoordRec((float) 8.76, (float) 52.381), + new CoordRec((float) 18.2838, (float) 61.9048), + new CoordRec((float) 27.8076, (float) 66.6667), + new CoordRec((float) 42.0933, (float) 66.6667), + new CoordRec((float) 51.6171, (float) 61.9048), + new CoordRec((float) 61.141, (float) 52.381), + new CoordRec((float) 65.9029, (float) 38.0952), + new CoordRec((float) 65.9029, (float) 28.5714), + new CoordRec((float) 61.141, (float) 14.2857), + new CoordRec((float) 51.6171, (float) 4.7619), + new CoordRec((float) 42.0933, (float) 0), + new CoordRec((float) 27.8076, (float) 0), + new CoordRec((float) 18.2838, (float) 4.7619), + new CoordRec((float) 8.76, (float) 14.2857), +}; + +static final StrokeRec char98[] = { + new StrokeRec(2, char98_stroke0), + new StrokeRec(14, char98_stroke1), +}; + +/* char: 99 'c' */ + +static final CoordRec char99_stroke0[] = { + new CoordRec((float) 62.6629, (float) 52.381), + new CoordRec((float) 53.139, (float) 61.9048), + new CoordRec((float) 43.6152, (float) 66.6667), + new CoordRec((float) 29.3295, (float) 66.6667), + new CoordRec((float) 19.8057, (float) 61.9048), + new CoordRec((float) 10.2819, (float) 52.381), + new CoordRec((float) 5.52, (float) 38.0952), + new CoordRec((float) 5.52, (float) 28.5714), + new CoordRec((float) 10.2819, (float) 14.2857), + new CoordRec((float) 19.8057, (float) 4.7619), + new CoordRec((float) 29.3295, (float) 0), + new CoordRec((float) 43.6152, (float) 0), + new CoordRec((float) 53.139, (float) 4.7619), + new CoordRec((float) 62.6629, (float) 14.2857), +}; + +static final StrokeRec char99[] = { + new StrokeRec(14, char99_stroke0), +}; + +/* char: 100 'd' */ + +static final CoordRec char100_stroke0[] = { + new CoordRec((float) 61.7829, (float) 100), + new CoordRec((float) 61.7829, (float) 0), +}; + +static final CoordRec char100_stroke1[] = { + new CoordRec((float) 61.7829, (float) 52.381), + new CoordRec((float) 52.259, (float) 61.9048), + new CoordRec((float) 42.7352, (float) 66.6667), + new CoordRec((float) 28.4495, (float) 66.6667), + new CoordRec((float) 18.9257, (float) 61.9048), + new CoordRec((float) 9.4019, (float) 52.381), + new CoordRec((float) 4.64, (float) 38.0952), + new CoordRec((float) 4.64, (float) 28.5714), + new CoordRec((float) 9.4019, (float) 14.2857), + new CoordRec((float) 18.9257, (float) 4.7619), + new CoordRec((float) 28.4495, (float) 0), + new CoordRec((float) 42.7352, (float) 0), + new CoordRec((float) 52.259, (float) 4.7619), + new CoordRec((float) 61.7829, (float) 14.2857), +}; + +static final StrokeRec char100[] = { + new StrokeRec(2, char100_stroke0), + new StrokeRec(14, char100_stroke1), +}; + +/* char: 101 'e' */ + +static final CoordRec char101_stroke0[] = { + new CoordRec((float) 5.72, (float) 38.0952), + new CoordRec((float) 62.8629, (float) 38.0952), + new CoordRec((float) 62.8629, (float) 47.619), + new CoordRec((float) 58.101, (float) 57.1429), + new CoordRec((float) 53.339, (float) 61.9048), + new CoordRec((float) 43.8152, (float) 66.6667), + new CoordRec((float) 29.5295, (float) 66.6667), + new CoordRec((float) 20.0057, (float) 61.9048), + new CoordRec((float) 10.4819, (float) 52.381), + new CoordRec((float) 5.72, (float) 38.0952), + new CoordRec((float) 5.72, (float) 28.5714), + new CoordRec((float) 10.4819, (float) 14.2857), + new CoordRec((float) 20.0057, (float) 4.7619), + new CoordRec((float) 29.5295, (float) 0), + new CoordRec((float) 43.8152, (float) 0), + new CoordRec((float) 53.339, (float) 4.7619), + new CoordRec((float) 62.8629, (float) 14.2857), +}; + +static final StrokeRec char101[] = { + new StrokeRec(17, char101_stroke0), +}; + +/* char: 102 'f' */ + +static final CoordRec char102_stroke0[] = { + new CoordRec((float) 38.7752, (float) 100), + new CoordRec((float) 29.2514, (float) 100), + new CoordRec((float) 19.7276, (float) 95.2381), + new CoordRec((float) 14.9657, (float) 80.9524), + new CoordRec((float) 14.9657, (float) 0), +}; + +static final CoordRec char102_stroke1[] = { + new CoordRec((float) 0.68, (float) 66.6667), + new CoordRec((float) 34.0133, (float) 66.6667), +}; + +static final StrokeRec char102[] = { + new StrokeRec(5, char102_stroke0), + new StrokeRec(2, char102_stroke1), +}; + +/* char: 103 'g' */ + +static final CoordRec char103_stroke0[] = { + new CoordRec((float) 62.5029, (float) 66.6667), + new CoordRec((float) 62.5029, (float) -9.5238), + new CoordRec((float) 57.741, (float) -23.8095), + new CoordRec((float) 52.979, (float) -28.5714), + new CoordRec((float) 43.4552, (float) -33.3333), + new CoordRec((float) 29.1695, (float) -33.3333), + new CoordRec((float) 19.6457, (float) -28.5714), +}; + +static final CoordRec char103_stroke1[] = { + new CoordRec((float) 62.5029, (float) 52.381), + new CoordRec((float) 52.979, (float) 61.9048), + new CoordRec((float) 43.4552, (float) 66.6667), + new CoordRec((float) 29.1695, (float) 66.6667), + new CoordRec((float) 19.6457, (float) 61.9048), + new CoordRec((float) 10.1219, (float) 52.381), + new CoordRec((float) 5.36, (float) 38.0952), + new CoordRec((float) 5.36, (float) 28.5714), + new CoordRec((float) 10.1219, (float) 14.2857), + new CoordRec((float) 19.6457, (float) 4.7619), + new CoordRec((float) 29.1695, (float) 0), + new CoordRec((float) 43.4552, (float) 0), + new CoordRec((float) 52.979, (float) 4.7619), + new CoordRec((float) 62.5029, (float) 14.2857), +}; + +static final StrokeRec char103[] = { + new StrokeRec(7, char103_stroke0), + new StrokeRec(14, char103_stroke1), +}; + +/* char: 104 'h' */ + +static final CoordRec char104_stroke0[] = { + new CoordRec((float) 9.6, (float) 100), + new CoordRec((float) 9.6, (float) 0), +}; + +static final CoordRec char104_stroke1[] = { + new CoordRec((float) 9.6, (float) 47.619), + new CoordRec((float) 23.8857, (float) 61.9048), + new CoordRec((float) 33.4095, (float) 66.6667), + new CoordRec((float) 47.6952, (float) 66.6667), + new CoordRec((float) 57.219, (float) 61.9048), + new CoordRec((float) 61.981, (float) 47.619), + new CoordRec((float) 61.981, (float) 0), +}; + +static final StrokeRec char104[] = { + new StrokeRec(2, char104_stroke0), + new StrokeRec(7, char104_stroke1), +}; + +/* char: 105 'i' */ + +static final CoordRec char105_stroke0[] = { + new CoordRec((float) 10.02, (float) 100), + new CoordRec((float) 14.7819, (float) 95.2381), + new CoordRec((float) 19.5438, (float) 100), + new CoordRec((float) 14.7819, (float) 104.762), + new CoordRec((float) 10.02, (float) 100), +}; + +static final CoordRec char105_stroke1[] = { + new CoordRec((float) 14.7819, (float) 66.6667), + new CoordRec((float) 14.7819, (float) 0), +}; + +static final StrokeRec char105[] = { + new StrokeRec(5, char105_stroke0), + new StrokeRec(2, char105_stroke1), +}; + +/* char: 106 'j' */ + +static final CoordRec char106_stroke0[] = { + new CoordRec((float) 17.3876, (float) 100), + new CoordRec((float) 22.1495, (float) 95.2381), + new CoordRec((float) 26.9114, (float) 100), + new CoordRec((float) 22.1495, (float) 104.762), + new CoordRec((float) 17.3876, (float) 100), +}; + +static final CoordRec char106_stroke1[] = { + new CoordRec((float) 22.1495, (float) 66.6667), + new CoordRec((float) 22.1495, (float) -14.2857), + new CoordRec((float) 17.3876, (float) -28.5714), + new CoordRec((float) 7.8638, (float) -33.3333), + new CoordRec((float)-1.66, (float) -33.3333), +}; + +static final StrokeRec char106[] = { + new StrokeRec(5, char106_stroke0), + new StrokeRec(5, char106_stroke1), +}; + +/* char: 107 'k' */ + +static final CoordRec char107_stroke0[] = { + new CoordRec((float) 9.6, (float) 100), + new CoordRec((float) 9.6, (float) 0), +}; + +static final CoordRec char107_stroke1[] = { + new CoordRec((float) 57.219, (float) 66.6667), + new CoordRec((float) 9.6, (float) 19.0476), +}; + +static final CoordRec char107_stroke2[] = { + new CoordRec((float) 28.6476, (float) 38.0952), + new CoordRec((float) 61.981, (float) 0), +}; + +static final StrokeRec char107[] = { + new StrokeRec(2, char107_stroke0), + new StrokeRec(2, char107_stroke1), + new StrokeRec(2, char107_stroke2), +}; + +/* char: 108 'l' */ + +static final CoordRec char108_stroke0[] = { + new CoordRec((float) 10.02, (float) 100), + new CoordRec((float) 10.02, (float) 0), +}; + +static final StrokeRec char108[] = { + new StrokeRec(2, char108_stroke0), +}; + +/* char: 109 'm' */ + +static final CoordRec char109_stroke0[] = { + new CoordRec((float) 9.6, (float) 66.6667), + new CoordRec((float) 9.6, (float) 0), +}; + +static final CoordRec char109_stroke1[] = { + new CoordRec((float) 9.6, (float) 47.619), + new CoordRec((float) 23.8857, (float) 61.9048), + new CoordRec((float) 33.4095, (float) 66.6667), + new CoordRec((float) 47.6952, (float) 66.6667), + new CoordRec((float) 57.219, (float) 61.9048), + new CoordRec((float) 61.981, (float) 47.619), + new CoordRec((float) 61.981, (float) 0), +}; + +static final CoordRec char109_stroke2[] = { + new CoordRec((float) 61.981, (float) 47.619), + new CoordRec((float) 76.2667, (float) 61.9048), + new CoordRec((float) 85.7905, (float) 66.6667), + new CoordRec((float) 100.076, (float) 66.6667), + new CoordRec((float) 109.6, (float) 61.9048), + new CoordRec((float) 114.362, (float) 47.619), + new CoordRec((float) 114.362, (float) 0), +}; + +static final StrokeRec char109[] = { + new StrokeRec(2, char109_stroke0), + new StrokeRec(7, char109_stroke1), + new StrokeRec(7, char109_stroke2), +}; + +/* char: 110 'n' */ + +static final CoordRec char110_stroke0[] = { + new CoordRec((float) 9.18, (float) 66.6667), + new CoordRec((float) 9.18, (float) 0), +}; + +static final CoordRec char110_stroke1[] = { + new CoordRec((float) 9.18, (float) 47.619), + new CoordRec((float) 23.4657, (float) 61.9048), + new CoordRec((float) 32.9895, (float) 66.6667), + new CoordRec((float) 47.2752, (float) 66.6667), + new CoordRec((float) 56.799, (float) 61.9048), + new CoordRec((float) 61.561, (float) 47.619), + new CoordRec((float) 61.561, (float) 0), +}; + +static final StrokeRec char110[] = { + new StrokeRec(2, char110_stroke0), + new StrokeRec(7, char110_stroke1), +}; + +/* char: 111 'o' */ + +static final CoordRec char111_stroke0[] = { + new CoordRec((float) 28.7895, (float) 66.6667), + new CoordRec((float) 19.2657, (float) 61.9048), + new CoordRec((float) 9.7419, (float) 52.381), + new CoordRec((float) 4.98, (float) 38.0952), + new CoordRec((float) 4.98, (float) 28.5714), + new CoordRec((float) 9.7419, (float) 14.2857), + new CoordRec((float) 19.2657, (float) 4.7619), + new CoordRec((float) 28.7895, (float) 0), + new CoordRec((float) 43.0752, (float) 0), + new CoordRec((float) 52.599, (float) 4.7619), + new CoordRec((float) 62.1229, (float) 14.2857), + new CoordRec((float) 66.8848, (float) 28.5714), + new CoordRec((float) 66.8848, (float) 38.0952), + new CoordRec((float) 62.1229, (float) 52.381), + new CoordRec((float) 52.599, (float) 61.9048), + new CoordRec((float) 43.0752, (float) 66.6667), + new CoordRec((float) 28.7895, (float) 66.6667), +}; + +static final StrokeRec char111[] = { + new StrokeRec(17, char111_stroke0), +}; + +/* char: 112 'p' */ + +static final CoordRec char112_stroke0[] = { + new CoordRec((float) 9.46, (float) 66.6667), + new CoordRec((float) 9.46, (float) -33.3333), +}; + +static final CoordRec char112_stroke1[] = { + new CoordRec((float) 9.46, (float) 52.381), + new CoordRec((float) 18.9838, (float) 61.9048), + new CoordRec((float) 28.5076, (float) 66.6667), + new CoordRec((float) 42.7933, (float) 66.6667), + new CoordRec((float) 52.3171, (float) 61.9048), + new CoordRec((float) 61.841, (float) 52.381), + new CoordRec((float) 66.6029, (float) 38.0952), + new CoordRec((float) 66.6029, (float) 28.5714), + new CoordRec((float) 61.841, (float) 14.2857), + new CoordRec((float) 52.3171, (float) 4.7619), + new CoordRec((float) 42.7933, (float) 0), + new CoordRec((float) 28.5076, (float) 0), + new CoordRec((float) 18.9838, (float) 4.7619), + new CoordRec((float) 9.46, (float) 14.2857), +}; + +static final StrokeRec char112[] = { + new StrokeRec(2, char112_stroke0), + new StrokeRec(14, char112_stroke1), +}; + +/* char: 113 'q' */ + +static final CoordRec char113_stroke0[] = { + new CoordRec((float) 61.9829, (float) 66.6667), + new CoordRec((float) 61.9829, (float) -33.3333), +}; + +static final CoordRec char113_stroke1[] = { + new CoordRec((float) 61.9829, (float) 52.381), + new CoordRec((float) 52.459, (float) 61.9048), + new CoordRec((float) 42.9352, (float) 66.6667), + new CoordRec((float) 28.6495, (float) 66.6667), + new CoordRec((float) 19.1257, (float) 61.9048), + new CoordRec((float) 9.6019, (float) 52.381), + new CoordRec((float) 4.84, (float) 38.0952), + new CoordRec((float) 4.84, (float) 28.5714), + new CoordRec((float) 9.6019, (float) 14.2857), + new CoordRec((float) 19.1257, (float) 4.7619), + new CoordRec((float) 28.6495, (float) 0), + new CoordRec((float) 42.9352, (float) 0), + new CoordRec((float) 52.459, (float) 4.7619), + new CoordRec((float) 61.9829, (float) 14.2857), +}; + +static final StrokeRec char113[] = { + new StrokeRec(2, char113_stroke0), + new StrokeRec(14, char113_stroke1), +}; + +/* char: 114 'r' */ + +static final CoordRec char114_stroke0[] = { + new CoordRec((float) 9.46, (float) 66.6667), + new CoordRec((float) 9.46, (float) 0), +}; + +static final CoordRec char114_stroke1[] = { + new CoordRec((float) 9.46, (float) 38.0952), + new CoordRec((float) 14.2219, (float) 52.381), + new CoordRec((float) 23.7457, (float) 61.9048), + new CoordRec((float) 33.2695, (float) 66.6667), + new CoordRec((float) 47.5552, (float) 66.6667), +}; + +static final StrokeRec char114[] = { + new StrokeRec(2, char114_stroke0), + new StrokeRec(5, char114_stroke1), +}; + +/* char: 115 's' */ + +static final CoordRec char115_stroke0[] = { + new CoordRec((float) 57.081, (float) 52.381), + new CoordRec((float) 52.319, (float) 61.9048), + new CoordRec((float) 38.0333, (float) 66.6667), + new CoordRec((float) 23.7476, (float) 66.6667), + new CoordRec((float) 9.4619, (float) 61.9048), + new CoordRec((float) 4.7, (float) 52.381), + new CoordRec((float) 9.4619, (float) 42.8571), + new CoordRec((float) 18.9857, (float) 38.0952), + new CoordRec((float) 42.7952, (float) 33.3333), + new CoordRec((float) 52.319, (float) 28.5714), + new CoordRec((float) 57.081, (float) 19.0476), + new CoordRec((float) 57.081, (float) 14.2857), + new CoordRec((float) 52.319, (float) 4.7619), + new CoordRec((float) 38.0333, (float) 0), + new CoordRec((float) 23.7476, (float) 0), + new CoordRec((float) 9.4619, (float) 4.7619), + new CoordRec((float) 4.7, (float) 14.2857), +}; + +static final StrokeRec char115[] = { + new StrokeRec(17, char115_stroke0), +}; + +/* char: 116 't' */ + +static final CoordRec char116_stroke0[] = { + new CoordRec((float) 14.8257, (float) 100), + new CoordRec((float) 14.8257, (float) 19.0476), + new CoordRec((float) 19.5876, (float) 4.7619), + new CoordRec((float) 29.1114, (float) 0), + new CoordRec((float) 38.6352, (float) 0), +}; + +static final CoordRec char116_stroke1[] = { + new CoordRec((float) 0.54, (float) 66.6667), + new CoordRec((float) 33.8733, (float) 66.6667), +}; + +static final StrokeRec char116[] = { + new StrokeRec(5, char116_stroke0), + new StrokeRec(2, char116_stroke1), +}; + +/* char: 117 'u' */ + +static final CoordRec char117_stroke0[] = { + new CoordRec((float) 9.46, (float) 66.6667), + new CoordRec((float) 9.46, (float) 19.0476), + new CoordRec((float) 14.2219, (float) 4.7619), + new CoordRec((float) 23.7457, (float) 0), + new CoordRec((float) 38.0314, (float) 0), + new CoordRec((float) 47.5552, (float) 4.7619), + new CoordRec((float) 61.841, (float) 19.0476), +}; + +static final CoordRec char117_stroke1[] = { + new CoordRec((float) 61.841, (float) 66.6667), + new CoordRec((float) 61.841, (float) 0), +}; + +static final StrokeRec char117[] = { + new StrokeRec(7, char117_stroke0), + new StrokeRec(2, char117_stroke1), +}; + +/* char: 118 'v' */ + +static final CoordRec char118_stroke0[] = { + new CoordRec((float) 1.8, (float) 66.6667), + new CoordRec((float) 30.3714, (float) 0), +}; + +static final CoordRec char118_stroke1[] = { + new CoordRec((float) 58.9429, (float) 66.6667), + new CoordRec((float) 30.3714, (float) 0), +}; + +static final StrokeRec char118[] = { + new StrokeRec(2, char118_stroke0), + new StrokeRec(2, char118_stroke1), +}; + +/* char: 119 'w' */ + +static final CoordRec char119_stroke0[] = { + new CoordRec((float) 2.5, (float) 66.6667), + new CoordRec((float) 21.5476, (float) 0), +}; + +static final CoordRec char119_stroke1[] = { + new CoordRec((float) 40.5952, (float) 66.6667), + new CoordRec((float) 21.5476, (float) 0), +}; + +static final CoordRec char119_stroke2[] = { + new CoordRec((float) 40.5952, (float) 66.6667), + new CoordRec((float) 59.6429, (float) 0), +}; + +static final CoordRec char119_stroke3[] = { + new CoordRec((float) 78.6905, (float) 66.6667), + new CoordRec((float) 59.6429, (float) 0), +}; + +static final StrokeRec char119[] = { + new StrokeRec(2, char119_stroke0), + new StrokeRec(2, char119_stroke1), + new StrokeRec(2, char119_stroke2), + new StrokeRec(2, char119_stroke3), +}; + +/* char: 120 'x' */ + +static final CoordRec char120_stroke0[] = { + new CoordRec((float) 1.66, (float) 66.6667), + new CoordRec((float) 54.041, (float) 0), +}; + +static final CoordRec char120_stroke1[] = { + new CoordRec((float) 54.041, (float) 66.6667), + new CoordRec((float) 1.66, (float) 0), +}; + +static final StrokeRec char120[] = { + new StrokeRec(2, char120_stroke0), + new StrokeRec(2, char120_stroke1), +}; + +/* char: 121 'y' */ + +static final CoordRec char121_stroke0[] = { + new CoordRec((float) 6.5619, (float) 66.6667), + new CoordRec((float) 35.1333, (float) 0), +}; + +static final CoordRec char121_stroke1[] = { + new CoordRec((float) 63.7048, (float) 66.6667), + new CoordRec((float) 35.1333, (float) 0), + new CoordRec((float) 25.6095, (float) -19.0476), + new CoordRec((float) 16.0857, (float) -28.5714), + new CoordRec((float) 6.5619, (float) -33.3333), + new CoordRec((float) 1.8, (float) -33.3333), +}; + +static final StrokeRec char121[] = { + new StrokeRec(2, char121_stroke0), + new StrokeRec(6, char121_stroke1), +}; + +/* char: 122 'z' */ + +static final CoordRec char122_stroke0[] = { + new CoordRec((float) 56.821, (float) 66.6667), + new CoordRec((float) 4.44, (float) 0), +}; + +static final CoordRec char122_stroke1[] = { + new CoordRec((float) 4.44, (float) 66.6667), + new CoordRec((float) 56.821, (float) 66.6667), +}; + +static final CoordRec char122_stroke2[] = { + new CoordRec((float) 4.44, (float) 0), + new CoordRec((float) 56.821, (float) 0), +}; + +static final StrokeRec char122[] = { + new StrokeRec(2, char122_stroke0), + new StrokeRec(2, char122_stroke1), + new StrokeRec(2, char122_stroke2), +}; + +/* char: 123 '{' */ + +static final CoordRec char123_stroke0[] = { + new CoordRec((float) 31.1895, (float) 119.048), + new CoordRec((float) 21.6657, (float) 114.286), + new CoordRec((float) 16.9038, (float) 109.524), + new CoordRec((float) 12.1419, (float) 100), + new CoordRec((float) 12.1419, (float) 90.4762), + new CoordRec((float) 16.9038, (float) 80.9524), + new CoordRec((float) 21.6657, (float) 76.1905), + new CoordRec((float) 26.4276, (float) 66.6667), + new CoordRec((float) 26.4276, (float) 57.1429), + new CoordRec((float) 16.9038, (float) 47.619), +}; + +static final CoordRec char123_stroke1[] = { + new CoordRec((float) 21.6657, (float) 114.286), + new CoordRec((float) 16.9038, (float) 104.762), + new CoordRec((float) 16.9038, (float) 95.2381), + new CoordRec((float) 21.6657, (float) 85.7143), + new CoordRec((float) 26.4276, (float) 80.9524), + new CoordRec((float) 31.1895, (float) 71.4286), + new CoordRec((float) 31.1895, (float) 61.9048), + new CoordRec((float) 26.4276, (float) 52.381), + new CoordRec((float) 7.38, (float) 42.8571), + new CoordRec((float) 26.4276, (float) 33.3333), + new CoordRec((float) 31.1895, (float) 23.8095), + new CoordRec((float) 31.1895, (float) 14.2857), + new CoordRec((float) 26.4276, (float) 4.7619), + new CoordRec((float) 21.6657, (float) 0), + new CoordRec((float) 16.9038, (float) -9.5238), + new CoordRec((float) 16.9038, (float) -19.0476), + new CoordRec((float) 21.6657, (float) -28.5714), +}; + +static final CoordRec char123_stroke2[] = { + new CoordRec((float) 16.9038, (float) 38.0952), + new CoordRec((float) 26.4276, (float) 28.5714), + new CoordRec((float) 26.4276, (float) 19.0476), + new CoordRec((float) 21.6657, (float) 9.5238), + new CoordRec((float) 16.9038, (float) 4.7619), + new CoordRec((float) 12.1419, (float) -4.7619), + new CoordRec((float) 12.1419, (float) -14.2857), + new CoordRec((float) 16.9038, (float) -23.8095), + new CoordRec((float) 21.6657, (float) -28.5714), + new CoordRec((float) 31.1895, (float) -33.3333), +}; + +static final StrokeRec char123[] = { + new StrokeRec(10, char123_stroke0), + new StrokeRec(17, char123_stroke1), + new StrokeRec(10, char123_stroke2), +}; + +/* char: 124 '|' */ + +static final CoordRec char124_stroke0[] = { + new CoordRec((float) 11.54, (float) 119.048), + new CoordRec((float) 11.54, (float) -33.3333), +}; + +static final StrokeRec char124[] = { + new StrokeRec(2, char124_stroke0), +}; + +/* char: 125 '}' */ + +static final CoordRec char125_stroke0[] = { + new CoordRec((float) 9.18, (float) 119.048), + new CoordRec((float) 18.7038, (float) 114.286), + new CoordRec((float) 23.4657, (float) 109.524), + new CoordRec((float) 28.2276, (float) 100), + new CoordRec((float) 28.2276, (float) 90.4762), + new CoordRec((float) 23.4657, (float) 80.9524), + new CoordRec((float) 18.7038, (float) 76.1905), + new CoordRec((float) 13.9419, (float) 66.6667), + new CoordRec((float) 13.9419, (float) 57.1429), + new CoordRec((float) 23.4657, (float) 47.619), +}; + +static final CoordRec char125_stroke1[] = { + new CoordRec((float) 18.7038, (float) 114.286), + new CoordRec((float) 23.4657, (float) 104.762), + new CoordRec((float) 23.4657, (float) 95.2381), + new CoordRec((float) 18.7038, (float) 85.7143), + new CoordRec((float) 13.9419, (float) 80.9524), + new CoordRec((float) 9.18, (float) 71.4286), + new CoordRec((float) 9.18, (float) 61.9048), + new CoordRec((float) 13.9419, (float) 52.381), + new CoordRec((float) 32.9895, (float) 42.8571), + new CoordRec((float) 13.9419, (float) 33.3333), + new CoordRec((float) 9.18, (float) 23.8095), + new CoordRec((float) 9.18, (float) 14.2857), + new CoordRec((float) 13.9419, (float) 4.7619), + new CoordRec((float) 18.7038, (float) 0), + new CoordRec((float) 23.4657, (float) -9.5238), + new CoordRec((float) 23.4657, (float) -19.0476), + new CoordRec((float) 18.7038, (float) -28.5714), +}; + +static final CoordRec char125_stroke2[] = { + new CoordRec((float) 23.4657, (float) 38.0952), + new CoordRec((float) 13.9419, (float) 28.5714), + new CoordRec((float) 13.9419, (float) 19.0476), + new CoordRec((float) 18.7038, (float) 9.5238), + new CoordRec((float) 23.4657, (float) 4.7619), + new CoordRec((float) 28.2276, (float) -4.7619), + new CoordRec((float) 28.2276, (float) -14.2857), + new CoordRec((float) 23.4657, (float) -23.8095), + new CoordRec((float) 18.7038, (float) -28.5714), + new CoordRec((float) 9.18, (float) -33.3333), +}; + +static final StrokeRec char125[] = { + new StrokeRec(10, char125_stroke0), + new StrokeRec(17, char125_stroke1), + new StrokeRec(10, char125_stroke2), +}; + +/* char: 126 '~' */ + +static final CoordRec char126_stroke0[] = { + new CoordRec((float) 2.92, (float) 28.5714), + new CoordRec((float) 2.92, (float) 38.0952), + new CoordRec((float) 7.6819, (float) 52.381), + new CoordRec((float) 17.2057, (float) 57.1429), + new CoordRec((float) 26.7295, (float) 57.1429), + new CoordRec((float) 36.2533, (float) 52.381), + new CoordRec((float) 55.301, (float) 38.0952), + new CoordRec((float) 64.8248, (float) 33.3333), + new CoordRec((float) 74.3486, (float) 33.3333), + new CoordRec((float) 83.8724, (float) 38.0952), + new CoordRec((float) 88.6343, (float) 47.619), +}; + +static final CoordRec char126_stroke1[] = { + new CoordRec((float) 2.92, (float) 38.0952), + new CoordRec((float) 7.6819, (float) 47.619), + new CoordRec((float) 17.2057, (float) 52.381), + new CoordRec((float) 26.7295, (float) 52.381), + new CoordRec((float) 36.2533, (float) 47.619), + new CoordRec((float) 55.301, (float) 33.3333), + new CoordRec((float) 64.8248, (float) 28.5714), + new CoordRec((float) 74.3486, (float) 28.5714), + new CoordRec((float) 83.8724, (float) 33.3333), + new CoordRec((float) 88.6343, (float) 47.619), + new CoordRec((float) 88.6343, (float) 57.1429), +}; + +static final StrokeRec char126[] = { + new StrokeRec(11, char126_stroke0), + new StrokeRec(11, char126_stroke1), +}; + +/* char: 127 */ + +static final CoordRec char127_stroke0[] = { + new CoordRec((float) 52.381, (float) 100), + new CoordRec((float) 14.2857, (float) -33.3333), +}; + +static final CoordRec char127_stroke1[] = { + new CoordRec((float) 28.5714, (float) 66.6667), + new CoordRec((float) 14.2857, (float) 61.9048), + new CoordRec((float) 4.7619, (float) 52.381), + new CoordRec((float) 0, (float) 38.0952), + new CoordRec((float) 0, (float) 23.8095), + new CoordRec((float) 4.7619, (float) 14.2857), + new CoordRec((float) 14.2857, (float) 4.7619), + new CoordRec((float) 28.5714, (float) 0), + new CoordRec((float) 38.0952, (float) 0), + new CoordRec((float) 52.381, (float) 4.7619), + new CoordRec((float) 61.9048, (float) 14.2857), + new CoordRec((float) 66.6667, (float) 28.5714), + new CoordRec((float) 66.6667, (float) 42.8571), + new CoordRec((float) 61.9048, (float) 52.381), + new CoordRec((float) 52.381, (float) 61.9048), + new CoordRec((float) 38.0952, (float) 66.6667), + new CoordRec((float) 28.5714, (float) 66.6667), +}; + +static final StrokeRec char127[] = { + new StrokeRec(2, char127_stroke0), + new StrokeRec(17, char127_stroke1), +}; + +static final StrokeCharRec chars[] = { + new StrokeCharRec( 0, /* char0 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char1 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char2 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char3 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char4 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char5 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char6 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char7 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char8 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char9 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char10 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char11 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char12 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char13 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char14 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char15 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char16 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char17 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char18 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char19 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char20 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char21 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char22 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char23 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char24 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char25 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char26 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char27 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char28 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char29 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char30 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char31 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char32 */ null, (float) 52.381, (float) 104.762 ), + new StrokeCharRec( 2, char33, (float) 13.3819, (float) 26.6238 ), + new StrokeCharRec( 2, char34, (float) 23.0676, (float) 51.4352 ), + new StrokeCharRec( 4, char35, (float) 36.5333, (float) 79.4886 ), + new StrokeCharRec( 3, char36, (float) 38.1533, (float) 76.2067 ), + new StrokeCharRec( 3, char37, (float) 49.2171, (float) 96.5743 ), + new StrokeCharRec( 1, char38, (float) 53.599, (float) 101.758 ), + new StrokeCharRec( 1, char39, (float) 4.44, (float) 13.62 ), + new StrokeCharRec( 1, char40, (float) 21.8657, (float) 47.1733 ), + new StrokeCharRec( 1, char41, (float) 24.3276, (float) 47.5333 ), + new StrokeCharRec( 3, char42, (float) 30.7695, (float) 59.439 ), + new StrokeCharRec( 2, char43, (float) 48.8371, (float) 97.2543 ), + new StrokeCharRec( 1, char44, (float) 13.5219, (float) 26.0638 ), + new StrokeCharRec( 1, char45, (float) 50.2371, (float) 100.754 ), + new StrokeCharRec( 1, char46, (float) 13.1019, (float) 26.4838 ), + new StrokeCharRec( 1, char47, (float) 40.5733, (float) 82.1067 ), + new StrokeCharRec( 1, char48, (float) 38.3133, (float) 77.0667 ), + new StrokeCharRec( 1, char49, (float) 30.8676, (float) 66.5295 ), + new StrokeCharRec( 1, char50, (float) 38.7533, (float) 77.6467 ), + new StrokeCharRec( 1, char51, (float) 38.3333, (float) 77.0467 ), + new StrokeCharRec( 2, char52, (float) 37.2133, (float) 80.1686 ), + new StrokeCharRec( 1, char53, (float) 38.1933, (float) 77.6867 ), + new StrokeCharRec( 1, char54, (float) 34.1514, (float) 73.8048 ), + new StrokeCharRec( 2, char55, (float) 38.8933, (float) 77.2267 ), + new StrokeCharRec( 1, char56, (float) 38.9333, (float) 77.6667 ), + new StrokeCharRec( 1, char57, (float) 39.9333, (float) 74.0648 ), + new StrokeCharRec( 2, char58, (float) 14.0819, (float) 26.2238 ), + new StrokeCharRec( 2, char59, (float) 12.9619, (float) 26.3038 ), + new StrokeCharRec( 1, char60, (float) 41.1552, (float) 81.6105 ), + new StrokeCharRec( 2, char61, (float) 48.5571, (float) 97.2543 ), + new StrokeCharRec( 1, char62, (float) 40.8752, (float) 81.6105 ), + new StrokeCharRec( 2, char63, (float) 36.9914, (float) 73.9029 ), + new StrokeCharRec( 2, char64, (float) 34.9314, (float) 74.3648 ), + new StrokeCharRec( 3, char65, (float) 40.5952, (float) 80.4905 ), + new StrokeCharRec( 3, char66, (float) 44.7533, (float) 83.6267 ), + new StrokeCharRec( 1, char67, (float) 39.9933, (float) 84.4886 ), + new StrokeCharRec( 2, char68, (float) 45.2933, (float) 85.2867 ), + new StrokeCharRec( 4, char69, (float) 39.9914, (float) 78.1848 ), + new StrokeCharRec( 3, char70, (float) 39.9914, (float) 78.7448 ), + new StrokeCharRec( 2, char71, (float) 40.3933, (float) 89.7686 ), + new StrokeCharRec( 3, char72, (float) 44.7533, (float) 89.0867 ), + new StrokeCharRec( 1, char73, (float) 10.86, (float) 21.3 ), + new StrokeCharRec( 1, char74, (float) 31.0714, (float) 59.999 ), + new StrokeCharRec( 3, char75, (float) 44.6133, (float) 79.3267 ), + new StrokeCharRec( 2, char76, (float) 40.2514, (float) 71.3229 ), + new StrokeCharRec( 4, char77, (float) 48.9552, (float) 97.2105 ), + new StrokeCharRec( 3, char78, (float) 44.4733, (float) 88.8067 ), + new StrokeCharRec( 1, char79, (float) 44.3352, (float) 88.8305 ), + new StrokeCharRec( 2, char80, (float) 45.4333, (float) 85.6667 ), + new StrokeCharRec( 2, char81, (float) 43.3952, (float) 88.0905 ), + new StrokeCharRec( 3, char82, (float) 45.0133, (float) 82.3667 ), + new StrokeCharRec( 1, char83, (float) 41.3333, (float) 80.8267 ), + new StrokeCharRec( 2, char84, (float) 35.6933, (float) 71.9467 ), + new StrokeCharRec( 1, char85, (float) 44.8733, (float) 89.4867 ), + new StrokeCharRec( 2, char86, (float) 40.4552, (float) 81.6105 ), + new StrokeCharRec( 4, char87, (float) 49.839, (float) 100.518 ), + new StrokeCharRec( 2, char88, (float) 35.8333, (float) 72.3667 ), + new StrokeCharRec( 2, char89, (float) 39.6152, (float) 79.6505 ), + new StrokeCharRec( 3, char90, (float) 35.8333, (float) 73.7467 ), + new StrokeCharRec( 4, char91, (float) 22.0657, (float) 46.1133 ), + new StrokeCharRec( 1, char92, (float) 39.1733, (float) 78.2067 ), + new StrokeCharRec( 4, char93, (float) 23.4876, (float) 46.3933 ), + new StrokeCharRec( 2, char94, (float) 44.0752, (float) 90.2305 ), + new StrokeCharRec( 1, char95, (float) 51.281, (float) 104.062 ), + new StrokeCharRec( 2, char96, (float) 42.5457, (float) 83.5714 ), + new StrokeCharRec( 2, char97, (float) 35.2514, (float) 66.6029 ), + new StrokeCharRec( 2, char98, (float) 37.3314, (float) 70.4629 ), + new StrokeCharRec( 1, char99, (float) 34.0914, (float) 68.9229 ), + new StrokeCharRec( 2, char100, (float) 33.2114, (float) 70.2629 ), + new StrokeCharRec( 1, char101, (float) 34.2914, (float) 68.5229 ), + new StrokeCharRec( 2, char102, (float) 14.9657, (float) 38.6552 ), + new StrokeCharRec( 2, char103, (float) 33.9314, (float) 70.9829 ), + new StrokeCharRec( 2, char104, (float) 33.4095, (float) 71.021 ), + new StrokeCharRec( 2, char105, (float) 14.7819, (float) 28.8638 ), + new StrokeCharRec( 2, char106, (float) 17.3876, (float) 36.2314 ), + new StrokeCharRec( 3, char107, (float) 33.4095, (float) 62.521 ), + new StrokeCharRec( 1, char108, (float) 10.02, (float) 19.34 ), + new StrokeCharRec( 3, char109, (float) 61.981, (float) 123.962 ), + new StrokeCharRec( 2, char110, (float) 32.9895, (float) 70.881 ), + new StrokeCharRec( 1, char111, (float) 33.5514, (float) 71.7448 ), + new StrokeCharRec( 2, char112, (float) 38.0314, (float) 70.8029 ), + new StrokeCharRec( 2, char113, (float) 33.4114, (float) 70.7429 ), + new StrokeCharRec( 2, char114, (float) 23.7457, (float) 49.4952 ), + new StrokeCharRec( 1, char115, (float) 28.5095, (float) 62.321 ), + new StrokeCharRec( 2, char116, (float) 14.8257, (float) 39.3152 ), + new StrokeCharRec( 2, char117, (float) 33.2695, (float) 71.161 ), + new StrokeCharRec( 2, char118, (float) 30.3714, (float) 60.6029 ), + new StrokeCharRec( 4, char119, (float) 40.5952, (float) 80.4905 ), + new StrokeCharRec( 2, char120, (float) 25.4695, (float) 56.401 ), + new StrokeCharRec( 2, char121, (float) 35.1333, (float) 66.0648 ), + new StrokeCharRec( 3, char122, (float) 28.2495, (float) 61.821 ), + new StrokeCharRec( 3, char123, (float) 21.6657, (float) 41.6295 ), + new StrokeCharRec( 1, char124, (float) 11.54, (float) 23.78 ), + new StrokeCharRec( 3, char125, (float) 18.7038, (float) 41.4695 ), + new StrokeCharRec( 2, char126, (float) 45.7771, (float) 91.2743 ), + new StrokeCharRec( 2, char127, (float) 33.3333, (float) 66.6667 ), +}; + +static final StrokeFontRec glutStrokeRoman = new StrokeFontRec( "Roman", 128, chars, (float) 119.048, (float) -33.3333 ); +} diff --git a/src/classes/com/sun/opengl/utils/StrokeCharRec.java b/src/classes/com/sun/opengl/utils/StrokeCharRec.java new file mode 100644 index 000000000..8601e4079 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/StrokeCharRec.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +class StrokeCharRec { + int num_strokes; + StrokeRec[] stroke; + float center; + float right; + + StrokeCharRec(int num_strokes, + StrokeRec[] stroke, + float center, + float right) { + this.num_strokes = num_strokes; + this.stroke = stroke; + this.center = center; + this.right = right; + } +} diff --git a/src/classes/com/sun/opengl/utils/StrokeFontRec.java b/src/classes/com/sun/opengl/utils/StrokeFontRec.java new file mode 100644 index 000000000..2ea2d21ac --- /dev/null +++ b/src/classes/com/sun/opengl/utils/StrokeFontRec.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +class StrokeFontRec { + String name; + int num_chars; + StrokeCharRec[] ch; + float top; + float bottom; + + StrokeFontRec(String name, + int num_chars, + StrokeCharRec[] ch, + float top, + float bottom) { + this.name = name; + this.num_chars = num_chars; + this.ch = ch; + this.top = top; + this.bottom = bottom; + } +} diff --git a/src/classes/com/sun/opengl/utils/StrokeRec.java b/src/classes/com/sun/opengl/utils/StrokeRec.java new file mode 100644 index 000000000..bc875856e --- /dev/null +++ b/src/classes/com/sun/opengl/utils/StrokeRec.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.opengl.utils; + +/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +class StrokeRec { + int num_coords; + CoordRec[] coord; + + StrokeRec(int num_coords, + CoordRec[] coord) { + this.num_coords = num_coords; + this.coord = coord; + } +} diff --git a/src/classes/com/sun/opengl/utils/Version.java b/src/classes/com/sun/opengl/utils/Version.java new file mode 100644 index 000000000..843dc9a03 --- /dev/null +++ b/src/classes/com/sun/opengl/utils/Version.java @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package com.sun.opengl.utils; + +/** + * The version and build number of this implementation. + * Version numbers for a release are of the form: w.x.y[-a]-z, where: + *

    + *
  • + * w - the major version number of the release. This number should + * start at 1. Typically, a bump in the major version number + * signifies that the release breaks backwards compatibility + * with some older release. + *
  • + *
  • + * x - minor version number. This number starts at 0. A bump in + * the minor version number signifies a release that has significant + * new functionality. + *
  • + *
  • + * y - minor-minor version number number. This number starts at 0. A + * bump in the minor-minor version number signifies that new bug + * fixes have been added to the build. + *
  • + *
  • + * a - an optional build designator followed by a digit. Valid build + * designators are: + *
      + *
    • alpha
    • + *
    • beta
    • + *
    + *
  • + *
  • + * z - build number. This is used to specify the build number of the + * release. This is usually only important to people that use + * the daily build of a project. The format is the lower-case + * letter 'b' followed by a two digit number. + *
  • + *
+ * + * For example, the following are all valid version strings: + *
    + *
  • 1.1.2-b02
  • + *
  • 1.3.5-alpha1-b19
  • + *
  • 4.7.1-beta3-b20
  • + *
+ * + */ +public final class Version { + + /** + * Private constructor - no need for user to create + * an instance of this class. + */ + private Version() { + } + + /** + * Version string of this build. + */ + private static final String version = "jsr231-1.0-beta1-b01"; + + /** + * Returns the version string and build number of + * this implementation. See the class description + * for the version string format. + * + * @return The version string of this implementation. + */ + public static String getVersion() { + return version; + } +} diff --git a/src/classes/javax/media/opengl/ComponentEvents.java b/src/classes/javax/media/opengl/ComponentEvents.java new file mode 100644 index 000000000..bfbbb957b --- /dev/null +++ b/src/classes/javax/media/opengl/ComponentEvents.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import java.awt.event.*; +import java.beans.PropertyChangeListener; + +/** Factors out the listener manipulation for the events supported by + all of the {@link GLDrawable} implementations. Provided to reduce + clutter in the documentation for GLDrawable. */ + +public interface ComponentEvents { + public void addComponentListener(ComponentListener l); + public void removeComponentListener(ComponentListener l); + public void addFocusListener(FocusListener l); + public void removeFocusListener(FocusListener l); + public void addHierarchyBoundsListener(HierarchyBoundsListener l); + public void removeHierarchyBoundsListener(HierarchyBoundsListener l); + public void addHierarchyListener(HierarchyListener l); + public void removeHierarchyListener(HierarchyListener l); + public void addInputMethodListener(InputMethodListener l); + public void removeInputMethodListener(InputMethodListener l); + public void addKeyListener(KeyListener l); + public void removeKeyListener(KeyListener l); + public void addMouseListener(MouseListener l); + public void removeMouseListener(MouseListener l); + public void addMouseMotionListener(MouseMotionListener l); + public void removeMouseMotionListener(MouseMotionListener l); + public void addMouseWheelListener(MouseWheelListener l); + public void removeMouseWheelListener(MouseWheelListener l); + public void addPropertyChangeListener(PropertyChangeListener listener); + public void removePropertyChangeListener(PropertyChangeListener listener); + public void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener); + public void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener); +} diff --git a/src/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java new file mode 100644 index 000000000..391787a01 --- /dev/null +++ b/src/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import com.sun.opengl.impl.Debug; + +/**

The default implementation of the {@link + GLCapabilitiesChooser} interface, which provides consistent visual + selection behavior across platforms. The precise algorithm is + deliberately left loosely specified. Some properties are:

+ +
    + +
  • As long as there is at least one available non-null + GLCapabilities which matches the "stereo" option, will return a + valid index. + +
  • Attempts to match as closely as possible the given + GLCapabilities, but will select one with fewer capabilities (i.e., + lower color depth) if necessary. + +
  • Prefers hardware-accelerated visuals to + non-hardware-accelerated. + +
  • If there is no exact match, prefers a more-capable visual to + a less-capable one. + +
  • If there is more than one exact match, chooses an arbitrary + one. + +
  • May select the opposite of a double- or single-buffered + visual (based on the user's request) in dire situations. + +
  • Color depth (including alpha) mismatches are weighted higher + than depth buffer mismatches, which are in turn weighted higher + than accumulation buffer (including alpha) and stencil buffer + depth mismatches. + +
  • If a valid windowSystemRecommendedChoice parameter is + supplied, chooses that instead of using the cross-platform code. + +
+*/ + +public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { + private static final boolean DEBUG = Debug.debug("DefaultGLCapabilitiesChooser"); + + public int chooseCapabilities(GLCapabilities desired, + GLCapabilities[] available, + int windowSystemRecommendedChoice) { + if (DEBUG) { + for (int i = 0; i < available.length; i++) { + System.err.println("Available " + i + ": " + available[i]); + } + } + + if (windowSystemRecommendedChoice >= 0 && + windowSystemRecommendedChoice < available.length && + available[windowSystemRecommendedChoice] != null) { + if (DEBUG) { + System.err.println("Choosing window system's recommended choice of " + windowSystemRecommendedChoice); + System.err.println(available[windowSystemRecommendedChoice]); + } + return windowSystemRecommendedChoice; + } + + // Create score array + int[] scores = new int[available.length]; + int NO_SCORE = -9999999; + int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; + int STENCIL_MISMATCH_PENALTY = 500; + // Pseudo attempt to keep equal rank penalties scale-equivalent + // (e.g., stencil mismatch is 3 * accum because there are 3 accum + // components) + int COLOR_MISMATCH_PENALTY_SCALE = 36; + int DEPTH_MISMATCH_PENALTY_SCALE = 6; + int ACCUM_MISMATCH_PENALTY_SCALE = 1; + int STENCIL_MISMATCH_PENALTY_SCALE = 3; + for (int i = 0; i < scores.length; i++) { + scores[i] = NO_SCORE; + } + // Compute score for each + for (int i = 0; i < scores.length; i++) { + GLCapabilities cur = available[i]; + if (cur == null) { + continue; + } + if (desired.getStereo() != cur.getStereo()) { + continue; + } + int score = 0; + // Compute difference in color depth + // (Note that this decides the direction of all other penalties) + score += (COLOR_MISMATCH_PENALTY_SCALE * + ((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) - + (desired.getRedBits() + desired.getGreenBits() + desired.getBlueBits() + desired.getAlphaBits()))); + // Compute difference in depth buffer depth + score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * + Math.abs(cur.getDepthBits() - desired.getDepthBits())); + // Compute difference in accumulation buffer depth + score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) * + Math.abs((cur.getAccumRedBits() + cur.getAccumGreenBits() + cur.getAccumBlueBits() + cur.getAccumAlphaBits()) - + (desired.getAccumRedBits() + desired.getAccumGreenBits() + desired.getAccumBlueBits() + desired.getAccumAlphaBits()))); + // Compute difference in stencil bits + score += STENCIL_MISMATCH_PENALTY_SCALE * sign(score) * (cur.getStencilBits() - desired.getStencilBits()); + if (cur.getDoubleBuffered() != desired.getDoubleBuffered()) { + score += sign(score) * DOUBLE_BUFFER_MISMATCH_PENALTY; + } + if ((desired.getStencilBits() > 0) && (cur.getStencilBits() == 0)) { + score += sign(score) * STENCIL_MISMATCH_PENALTY; + } + scores[i] = score; + } + // Now prefer hardware-accelerated visuals by pushing scores of + // non-hardware-accelerated visuals out + boolean gotHW = false; + int maxAbsoluteHWScore = 0; + for (int i = 0; i < scores.length; i++) { + int score = scores[i]; + if (score == NO_SCORE) { + continue; + } + GLCapabilities cur = available[i]; + if (cur.getHardwareAccelerated()) { + int absScore = Math.abs(score); + if (!gotHW || + (absScore > maxAbsoluteHWScore)) { + gotHW = true; + maxAbsoluteHWScore = absScore; + } + } + } + if (gotHW) { + for (int i = 0; i < scores.length; i++) { + int score = scores[i]; + if (score == NO_SCORE) { + continue; + } + GLCapabilities cur = available[i]; + if (!cur.getHardwareAccelerated()) { + if (score <= 0) { + score -= maxAbsoluteHWScore; + } else if (score > 0) { + score += maxAbsoluteHWScore; + } + scores[i] = score; + } + } + } + + if (DEBUG) { + System.err.print("Scores: ["); + for (int i = 0; i < available.length; i++) { + if (i > 0) { + System.err.print(","); + } + System.err.print(" " + scores[i]); + } + System.err.println(" ]"); + } + + // Ready to select. Choose score closest to 0. + int scoreClosestToZero = NO_SCORE; + int chosenIndex = -1; + for (int i = 0; i < scores.length; i++) { + int score = scores[i]; + if (score == NO_SCORE) { + continue; + } + // Don't substitute a positive score for a smaller negative score + if ((scoreClosestToZero == NO_SCORE) || + (Math.abs(score) < Math.abs(scoreClosestToZero) && + ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { + scoreClosestToZero = score; + chosenIndex = i; + } + } + if (chosenIndex < 0) { + throw new GLException("Unable to select one of the provided GLCapabilities"); + } + if (DEBUG) { + System.err.println("Chosen index: " + chosenIndex); + System.err.println("Chosen capabilities:"); + System.err.println(available[chosenIndex]); + } + + return chosenIndex; + } + + private static int sign(int score) { + if (score < 0) { + return -1; + } + return 1; + } +} diff --git a/src/classes/javax/media/opengl/GLAutoDrawable.java b/src/classes/javax/media/opengl/GLAutoDrawable.java new file mode 100644 index 000000000..18adfde54 --- /dev/null +++ b/src/classes/javax/media/opengl/GLAutoDrawable.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import javax.media.opengl.glu.*; + +/** A higher-level abstraction than {@link GLDrawable} which supplies + an event based mechanism ({@link GLEventListener}) for performing + OpenGL rendering. A GLAutoDrawable automatically creates a primary + rendering context which is associated with the GLAutoDrawable for + the lifetime of the object. This context has the {@link + GLContext#setSynchronized synchronized} property enabled so that + calls to {@link GLContext#makeCurrent makeCurrent} will block if + the context is current on another thread. This allows the internal + GLContext for the GLAutoDrawable to be used both by the event + based rendering mechanism as well by end users directly. */ + +public interface GLAutoDrawable extends GLDrawable, ComponentEvents { + /** + * Returns the context associated with this drawable. The returned + * context will be synchronized. + */ + public GLContext getContext(); + + /** Adds a {@link GLEventListener} to this drawable. If multiple + listeners are added to a given drawable, they are notified of + events in an arbitrary order. */ + public void addGLEventListener(GLEventListener listener); + + /** Removes a {@link GLEventListener} from this drawable. Note that + if this is done from within a particular drawable's {@link + GLEventListener} handler (reshape, display, etc.) that it is not + guaranteed that all other listeners will be evaluated properly + during this update cycle. */ + public void removeGLEventListener(GLEventListener listener); + + /** Causes OpenGL rendering to be performed for this GLAutoDrawable + by calling {@link GLEventListener#display display} for all + registered {@link GLEventListener}s. Called automatically by the + window system toolkit upon receiving a repaint() request. this + routine may be called manually for better control over the + rendering process. It is legal to call another GLAutoDrawable's + display method from within the {@link GLEventListener#display + display} callback. */ + public void display(); + + /** Schedules a repaint of the component at some point in the + future. */ + public void repaint(); + + /** Enables or disables automatic buffer swapping for this drawable. + By default this property is set to true; when true, after all + GLEventListeners have been called for a display() event, the + front and back buffers are swapped, displaying the results of + the render. When disabled, the user is responsible for calling + {@link #swapBuffers} manually. */ + public void setAutoSwapBufferMode(boolean onOrOff); + + /** Indicates whether automatic buffer swapping is enabled for this + drawable. See {@link #setAutoSwapBufferMode}. */ + public boolean getAutoSwapBufferMode(); + + /** Returns the {@link GL} pipeline object this GLAutoDrawable uses. + If this method is called outside of the {@link + GLEventListener}'s callback methods (init, display, etc.) it may + return null. Users should not rely on the identity of the + returned GL object; for example, users should not maintain a + hash table with the GL object as the key. Additionally, the GL + object should not be cached in client code, but should be + re-fetched from the GLAutoDrawable at the beginning of each call + to init, display, etc. */ + public GL getGL(); + + /** Sets the {@link GL} pipeline object this GLAutoDrawable uses. + This should only be called from within the GLEventListener's + callback methods, and usually only from within the init() + method, in order to install a composable pipeline. See the JOGL + demos for examples. */ + public void setGL(GL gl); +} diff --git a/src/classes/javax/media/opengl/GLCanvas.java b/src/classes/javax/media/opengl/GLCanvas.java new file mode 100644 index 000000000..f2ca1bf80 --- /dev/null +++ b/src/classes/javax/media/opengl/GLCanvas.java @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import java.awt.Canvas; +import java.awt.EventQueue; +import java.awt.Graphics; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import com.sun.opengl.impl.*; + +// FIXME: Subclasses need to call resetGLFunctionAvailability() on their +// context whenever the displayChanged() function is called on our +// GLEventListeners + +/** A heavyweight AWT component which provides OpenGL rendering + support. This is the primary implementation of {@link GLDrawable}; + {@link GLJPanel} is provided for compatibility with Swing user + interfaces when adding a heavyweight doesn't work either because + of Z-ordering or LayoutManager problems. This class can not be + instantiated directly; use {@link GLDrawableFactory} to construct + them. */ + +public class GLCanvas extends Canvas implements GLAutoDrawable { + + private static final boolean DEBUG = Debug.debug("GLCanvas"); + + private GLDrawableHelper drawableHelper = new GLDrawableHelper(); + private GLDrawable drawable; + private GLContextImpl context; + private boolean autoSwapBufferMode = true; + private boolean sendReshape = false; + + /** Creates a new GLCanvas component. The passed GLCapabilities must + be non-null and specifies the OpenGL capabilities for the + component. The GLCapabilitiesChooser must be non-null and + specifies the algorithm for selecting one of the available + GLCapabilities for the component; the GLDrawableFactory uses a + DefaultGLCapabilitesChooser if the user does not provide + one. The passed GLContext may be null and specifies an OpenGL + context with which to share textures, display lists and other + OpenGL state. The passed GraphicsDevice must be non-null and + indicates the screen on which to create the GLCanvas; the + GLDrawableFactory uses the default screen device of the local + GraphicsEnvironment if the user does not provide one. */ + protected GLCanvas(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GLContext shareWith, + GraphicsDevice device) { + // The platform-specific GLDrawableFactory will only provide a + // non-null GraphicsConfiguration on platforms where this is + // necessary (currently only X11, as Windows allows the pixel + // format of the window to be set later and Mac OS X seems to + // handle this very differently than all other platforms). On + // other platforms this method returns null; it is the case (at + // least in the Sun AWT implementation) that this will result in + // equivalent behavior to calling the no-arg super() constructor + // for Canvas. + super(GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, chooser, device)); + drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser); + context = (GLContextImpl) drawable.createContext(shareWith); + context.setSynchronized(true); + } + + public GLContext createContext(GLContext shareWith) { + return drawable.createContext(shareWith); + } + + public void setRealized(boolean realized) { + } + + public void display() { + maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction, + displayAction); + } + + /** Overridden from Canvas; calls {@link #display}. Should not be + invoked by applications directly. */ + public void paint(Graphics g) { + display(); + } + + /** Overridden from Canvas; used to indicate when it's safe to + create an OpenGL context for the component. */ + public void addNotify() { + super.addNotify(); + drawable.setRealized(true); + if (DEBUG) { + System.err.println("GLCanvas.addNotify()"); + } + } + + /** Overridden from Canvas; used to indicate that it's no longer + safe to have an OpenGL context for the component. */ + public void removeNotify() { + context.destroy(); + drawable.setRealized(false); + super.removeNotify(); + if (DEBUG) { + System.err.println("GLCanvas.removeNotify()"); + } + } + + /** Overridden from Canvas; causes {@link GLDrawableHelper#reshape} + to be called on all registered {@link GLEventListener}s. Called + automatically by the AWT; should not be invoked by applications + directly. */ + public void reshape(int x, int y, int width, int height) { + super.reshape(x, y, width, height); + sendReshape = true; + } + + /** Overridden from Canvas to prevent Java2D's clearing of the + canvas from interfering with the OpenGL rendering. */ + public void update(Graphics g) { + paint(g); + } + + public void addGLEventListener(GLEventListener listener) { + drawableHelper.addGLEventListener(listener); + } + + public void removeGLEventListener(GLEventListener listener) { + drawableHelper.removeGLEventListener(listener); + } + + public GLContext getContext() { + return context; + } + + public GL getGL() { + return getContext().getGL(); + } + + public void setGL(GL gl) { + getContext().setGL(gl); + } + + public void setAutoSwapBufferMode(boolean onOrOff) { + drawableHelper.setAutoSwapBufferMode(onOrOff); + } + + public boolean getAutoSwapBufferMode() { + return drawableHelper.getAutoSwapBufferMode(); + } + + public void swapBuffers() { + maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction); + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private void maybeDoSingleThreadedWorkaround(Runnable eventDispatchThreadAction, + Runnable invokeGLAction) { + if (Threading.isSingleThreaded() && + !Threading.isOpenGLThread()) { + Threading.invokeOnOpenGLThread(eventDispatchThreadAction); + } else { + drawableHelper.invokeGL(drawable, context, invokeGLAction, initAction); + } + } + + class InitAction implements Runnable { + public void run() { + drawableHelper.init(GLCanvas.this); + } + } + private InitAction initAction = new InitAction(); + + class DisplayAction implements Runnable { + public void run() { + if (sendReshape) { + // Note: we ignore the given x and y within the parent component + // since we are drawing directly into this heavyweight component. + int width = getWidth(); + int height = getHeight(); + getGL().glViewport(0, 0, width, height); + drawableHelper.reshape(GLCanvas.this, 0, 0, width, height); + sendReshape = false; + } + + drawableHelper.display(GLCanvas.this); + } + } + private DisplayAction displayAction = new DisplayAction(); + + class SwapBuffersAction implements Runnable { + public void run() { + drawable.swapBuffers(); + } + } + private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); + + // Workaround for ATI driver bugs related to multithreading issues + // like simultaneous rendering via Animators to canvases that are + // being resized on the AWT event dispatch thread + class DisplayOnEventDispatchThreadAction implements Runnable { + public void run() { + drawableHelper.invokeGL(drawable, context, displayAction, initAction); + } + } + private DisplayOnEventDispatchThreadAction displayOnEventDispatchThreadAction = + new DisplayOnEventDispatchThreadAction(); + class SwapBuffersOnEventDispatchThreadAction implements Runnable { + public void run() { + drawableHelper.invokeGL(drawable, context, swapBuffersAction, initAction); + } + } + private SwapBuffersOnEventDispatchThreadAction swapBuffersOnEventDispatchThreadAction = + new SwapBuffersOnEventDispatchThreadAction(); +} diff --git a/src/classes/javax/media/opengl/GLCapabilities.java b/src/classes/javax/media/opengl/GLCapabilities.java new file mode 100644 index 000000000..77ada1b1a --- /dev/null +++ b/src/classes/javax/media/opengl/GLCapabilities.java @@ -0,0 +1,342 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +/** Specifies a set of OpenGL capabilities that a rendering context + must support, such as color depth and whether stereo is enabled. + It currently contains the minimal number of routines which allow + configuration on all supported window systems. */ + +public class GLCapabilities implements Cloneable { + private boolean doubleBuffered = true; + private boolean stereo = false; + private boolean hardwareAccelerated = true; + private int depthBits = 24; + private int stencilBits = 0; + private int redBits = 8; + private int greenBits = 8; + private int blueBits = 8; + private int alphaBits = 0; + private int accumRedBits = 0; + private int accumGreenBits = 0; + private int accumBlueBits = 0; + private int accumAlphaBits = 0; + // Shift bits from PIXELFORMATDESCRIPTOR not present because they + // are unlikely to be supported on Windows anyway + + // Support for full-scene antialiasing (FSAA) + private boolean sampleBuffers = false; + private int numSamples = 2; + + // Bits for pbuffer creation + private boolean offscreenFloatingPointBuffers; + private boolean offscreenRenderToTexture; + private boolean offscreenRenderToTextureRectangle; + + /** Creates a GLCapabilities object. All attributes are in a default + state. + */ + public GLCapabilities() {} + + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + throw new GLException(e); + } + } + + /** Indicates whether double-buffering is enabled. */ + public boolean getDoubleBuffered() { + return doubleBuffered; + } + + /** Enables or disables double buffering. */ + public void setDoubleBuffered(boolean onOrOff) { + doubleBuffered = onOrOff; + } + + /** Indicates whether stereo is enabled. */ + public boolean getStereo() { + return stereo; + } + + /** Enables or disables stereo viewing. */ + public void setStereo(boolean onOrOff) { + stereo = onOrOff; + } + + /** Indicates whether hardware acceleration is enabled. */ + public boolean getHardwareAccelerated() { + return hardwareAccelerated; + } + + /** Enables or disables hardware acceleration. */ + public void setHardwareAccelerated(boolean onOrOff) { + hardwareAccelerated = onOrOff; + } + + /** Returns the number of bits requested for the depth buffer. */ + public int getDepthBits() { + return depthBits; + } + + /** Sets the number of bits requested for the depth buffer. */ + public void setDepthBits(int depthBits) { + this.depthBits = depthBits; + } + + /** Returns the number of bits requested for the stencil buffer. */ + public int getStencilBits() { + return stencilBits; + } + + /** Sets the number of bits requested for the stencil buffer. */ + public void setStencilBits(int stencilBits) { + this.stencilBits = stencilBits; + } + + /** Returns the number of bits requested for the color buffer's red + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public int getRedBits() { + return redBits; + } + + /** Sets the number of bits requested for the color buffer's red + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setRedBits(int redBits) { + this.redBits = redBits; + } + + /** Returns the number of bits requested for the color buffer's + green component. On some systems only the color depth, which is + the sum of the red, green, and blue bits, is considered. */ + public int getGreenBits() { + return greenBits; + } + + /** Sets the number of bits requested for the color buffer's green + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setGreenBits(int greenBits) { + this.greenBits = greenBits; + } + + /** Returns the number of bits requested for the color buffer's blue + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public int getBlueBits() { + return blueBits; + } + + /** Sets the number of bits requested for the color buffer's blue + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setBlueBits(int blueBits) { + this.blueBits = blueBits; + } + + /** Returns the number of bits requested for the color buffer's + alpha component. On some systems only the color depth, which is + the sum of the red, green, and blue bits, is considered. */ + public int getAlphaBits() { + return alphaBits; + } + + /** Sets the number of bits requested for the color buffer's alpha + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setAlphaBits(int alphaBits) { + this.alphaBits = alphaBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's red component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumRedBits() { + return accumRedBits; + } + + /** Sets the number of bits requested for the accumulation buffer's + red component. On some systems only the accumulation buffer + depth, which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumRedBits(int accumRedBits) { + this.accumRedBits = accumRedBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's green component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumGreenBits() { + return accumGreenBits; + } + + /** Sets the number of bits requested for the accumulation buffer's + green component. On some systems only the accumulation buffer + depth, which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumGreenBits(int accumGreenBits) { + this.accumGreenBits = accumGreenBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's blue component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumBlueBits() { + return accumBlueBits; + } + + /** Sets the number of bits requested for the accumulation buffer's + blue component. On some systems only the accumulation buffer + depth, which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumBlueBits(int accumBlueBits) { + this.accumBlueBits = accumBlueBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's alpha component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumAlphaBits() { + return accumAlphaBits; + } + + /** Sets number of bits requested for accumulation buffer's alpha + component. On some systems only the accumulation buffer depth, + which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumAlphaBits(int accumAlphaBits) { + this.accumAlphaBits = accumAlphaBits; + } + + /** Indicates whether sample buffers for full-scene antialiasing + (FSAA) should be allocated for this drawable. Defaults to + false. */ + public void setSampleBuffers(boolean onOrOff) { + sampleBuffers = onOrOff; + } + + /** Returns whether sample buffers for full-scene antialiasing + (FSAA) should be allocated for this drawable. Defaults to + false. */ + public boolean getSampleBuffers() { + return sampleBuffers; + } + + /** If sample buffers are enabled, indicates the number of buffers + to be allocated. Defaults to 2. */ + public void setNumSamples(int numSamples) { + this.numSamples = numSamples; + } + + /** Returns the number of sample buffers to be allocated if sample + buffers are enabled. Defaults to 2. */ + public int getNumSamples() { + return numSamples; + } + + /** For offscreen surfaces only (pbuffers), indicates whether + floating-point buffers should be used if available. Defaults to + false. */ + public void setOffscreenFloatingPointBuffers(boolean onOrOff) { + offscreenFloatingPointBuffers = onOrOff; + } + + /** For offscreen surfaces only (pbuffers), returns whether + floating-point buffers should be used if available. Defaults to + false. */ + public boolean getOffscreenFloatingPointBuffers() { + return offscreenFloatingPointBuffers; + } + + /** For offscreen surfaces only (pbuffers), indicates whether the + render-to-texture extension should be used if available. + Defaults to false. */ + public void setOffscreenRenderToTexture(boolean onOrOff) { + offscreenRenderToTexture = onOrOff; + } + + /** For offscreen surfaces only (pbuffers), returns whether the + render-to-texture extension should be used if available. + Defaults to false. */ + public boolean getOffscreenRenderToTexture() { + return offscreenRenderToTexture; + } + + /** For offscreen surfaces only (pbuffers), indicates whether the + render-to-texture-rectangle extension should be used if + available. Defaults to false. */ + public void setOffscreenRenderToTextureRectangle(boolean onOrOff) { + offscreenRenderToTextureRectangle = onOrOff; + } + + /** For offscreen surfaces only (pbuffers), returns whether the + render-to-texture extension should be used. Defaults to false. */ + public boolean getOffscreenRenderToTextureRectangle() { + return offscreenRenderToTextureRectangle; + } + + /** Returns a textual representation of this GLCapabilities + object. */ + public String toString() { + return ("GLCapabilities [" + + "DoubleBuffered: " + doubleBuffered + + ", Stereo: " + stereo + + ", HardwareAccelerated: " + hardwareAccelerated + + ", DepthBits: " + depthBits + + ", StencilBits: " + stencilBits + + ", Red: " + redBits + + ", Green: " + greenBits + + ", Blue: " + blueBits + + ", Alpha: " + alphaBits + + ", Red Accum: " + accumRedBits + + ", Green Accum: " + accumGreenBits + + ", Blue Accum: " + accumBlueBits + + ", Alpha Accum: " + accumAlphaBits + + " ]"); + } +} diff --git a/src/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/classes/javax/media/opengl/GLCapabilitiesChooser.java new file mode 100644 index 000000000..9d970ff42 --- /dev/null +++ b/src/classes/javax/media/opengl/GLCapabilitiesChooser.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +/** Provides a mechanism by which applications can customize the + window type selection for a given {@link GLCapabilities}. + Developers can implement this interface and pass an instance into + the appropriate method of {@link GLDrawableFactory}; the chooser + will be called during the OpenGL context creation process. */ + +public interface GLCapabilitiesChooser { + /** Chooses the index (0..available.length - 1) of the {@link + GLCapabilities} most closely matching the desired one from the + list of all supported. Some of the entries in the + available array may be null; the chooser must + ignore these. The windowSystemRecommendedChoice + parameter may be provided to the chooser by the underlying + window system; if this index is valid, it is recommended, but + not necessarily required, that the chooser select that entry. + +

Note: this method is called automatically by the + {@link GLDrawableFactory} when an instance of this class is + passed in to one of its factory methods. It should generally not + be invoked by users directly, unless it is desired to delegate + the choice to some other GLCapabilitiesChooser object. + */ + public int chooseCapabilities(GLCapabilities desired, + GLCapabilities[] available, + int windowSystemRecommendedChoice); +} diff --git a/src/classes/javax/media/opengl/GLContext.java b/src/classes/javax/media/opengl/GLContext.java new file mode 100644 index 000000000..82997bc8f --- /dev/null +++ b/src/classes/javax/media/opengl/GLContext.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +/** Abstraction for an OpenGL rendering context. In order to perform + OpenGL rendering, a context must be "made current" on the current + thread. OpenGL rendering semantics specify that only one context + may be current on the current thread at any given time, and also + that a given context may be current on only one thread at any + given time. Because components can be added to and removed from + the component hierarchy at any time, it is possible that the + underlying OpenGL context may need to be destroyed and recreated + multiple times over the lifetime of a given component. This + process is handled by the implementation, and the GLContext + abstraction provides a stable object which clients can use to + refer to a given context. */ + +public abstract class GLContext { + /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */ + public static final int CONTEXT_NOT_CURRENT = 0; + /** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */ + public static final int CONTEXT_CURRENT = 1; + /** Indicates that a newly-created context was made current during the last call to {@link #makeCurrent makeCurrent}. */ + public static final int CONTEXT_CURRENT_NEW = 2; + + private static ThreadLocal currentContext = new ThreadLocal(); + + /** + * Returns the GLDrawable to which this context may be used to + * draw. + */ + public abstract GLDrawable getGLDrawable(); + + /** + * Makes this GLContext current on the calling thread. + * + * There are two return values that indicate success and one that + * indicates failure. A return value of CONTEXT_CURRENT_NEW + * indicates that that context has been made current, and that + * this is the first time this context has been made current, or + * that the state of the underlying context or drawable may have + * changed since the last time this context was made current. In + * this case, the application may wish to initialize the state. A + * return value of CONTEXT_CURRENT indicates that the context has + * been made currrent, with its previous state restored. + * + * If the context could not be made current (for example, because + * the underlying drawable has not ben realized on the display) , + * a value of CONTEXT_NOT_CURRENT is returned. + * + * If the context is in use by another thread at the time of the + * call, then if isSynchronized() is true the call will + * block. If isSynchronized() is false, an exception will be + * thrown and the context will remain current on the other thread. + * + * @return CONTEXT_CURRENT if the context was successfully made current + * @return CONTEXT_CURRENT_NEW if the context was successfully made + * current, but need to be initialized. + * + * @return CONTEXT_NOT_CURRENT if the context could not be made current. + * + * @throws GLException if synchronization is disabled and the + * context is current on another thread, or because the context + * could not be created or made current due to non-recoverable, + * window system-specific errors. + */ + public abstract int makeCurrent() throws GLException; + + /** + * Releases control of this GLContext from the current thread. + * + * @throws GLException if the context had not previously been made + * current on the current thread + */ + public abstract void release() throws GLException; + + /** + * Returns the context which is current on the current thread. If no + * context is current, returns null. + * + * @return the context current on this thread, or null if no context + * is current. + */ + public static GLContext getCurrent() { + return (GLContext) currentContext.get(); + } + + /** + * Sets the current context object on the current thread. This + * method is called by GLContext implementations during {@link + * #makeCurrent} and does not need to be called by end users. + * + */ + public static void setCurrent(GLContext cur) { + currentContext.set(cur); + } + + /** + * Destroys this OpenGL context and frees its associated resources. + */ + public abstract void destroy(); + + /** + * Returns true if 'makeCurrent' will exhibit synchronized behavior. + */ + public abstract boolean isSynchronized(); + + /** + * Determines whether 'makeCurrent' will exhibit synchronized behavior. + */ + public abstract void setSynchronized(boolean isSynchronized); + + /** + * Returns the GL pipeline object for this GLContext. + */ + public abstract GL getGL(); + + /** + * Sets the GL pipeline object for this GLContext. + */ + public abstract void setGL(GL gl); +} diff --git a/src/classes/javax/media/opengl/GLDrawable.java b/src/classes/javax/media/opengl/GLDrawable.java new file mode 100644 index 000000000..5b54bd369 --- /dev/null +++ b/src/classes/javax/media/opengl/GLDrawable.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +// FIXME: We need some way to tell when the device upon which the canvas is +// being displayed has changed (e.g., the user drags the canvas's parent +// window from one screen on multi-screen environment to another, when the +// user changes the display bit depth or screen resolution, etc). When this +// occurs, we need the canvas to reset the gl function pointer tables for the +// canvas, because the new device may have different capabilities (e.g., +// doesn't support as many opengl extensions) from the original device. This +// hook would also be useful in other GLDrawables (for example, offscreen +// buffers such as pbuffers, whose contents may or may not be invalidated when +// the display mode changes, depending on the vendor's GL implementation). +// +// Right now I'm not sure how hook into when this change occurs. There isn't +// any AWT event corresponding to a device change (as far as I can +// tell). We could constantly check the GraphicsConfiguration of the canvas's top-level +// parent to see if it has changed, but this would be very slow (we'd have to +// do it every time the context is made current). There has got to be a better +// solution, but I'm not sure what it is. + +// FIXME: Subclasses need to call resetGLFunctionAvailability() on their +// context whenever the displayChanged() function is called on our +// GLEventListeners + +/** An abstraction for an OpenGL rendering target. A GLDrawable's + primary functionality is to create OpenGL contexts which can be + used to perform rendering. A GLDrawable does not automatically + create an OpenGL context, but all implementations of {@link + GLAutoDrawable} do so upon creation. */ + +public interface GLDrawable { + /** + * Creates a new context for drawing to this drawable that will + * share display lists with the given GLContext. + * + * The GLContext share need not be associated with this + * GLDrawable. + */ + public GLContext createContext(GLContext shareWith); + + /** + + * Indicates to on-screen GLDrawable implementations whether the + * underlying window has been created and can be drawn into. This + * method must be called from GLDrawables obtained from the + * GLDrawableFactory via the {@link GLDrawableFactory#getGLDrawable + * GLDrawableFactory.getGLDrawable()} method. It must typically be + * called with an argument of true in the + * addNotify method of components performing OpenGL + * rendering and with an argument of false in the + * removeNotify method. Calling this method has no + * other effects. For example, if removeNotify is + * called on a Canvas implementation for which a GLDrawable has been + * created, it is also necessary to destroy all OpenGL contexts + * associated with that GLDrawable. This is not done automatically + * by the implementation. It is not necessary to call + * setRealized on a GLCanvas, a GLJPanel, or a + * GLPbuffer, as these perform the appropriate calls on their + * underlying GLDrawables internally.. + */ + public void setRealized(boolean realized); + + /** Requests a new width and height for this GLDrawable. Not all + drawables are able to respond to this request and may silently + ignore it. */ + public void setSize(int width, int height); + + /** Returns the current width of this GLDrawable. */ + public int getWidth(); + + /** Returns the current height of this GLDrawable. */ + public int getHeight(); + + /** Swaps the front and back buffers of this drawable. For {@link + GLAutoDrawable} implementations, when automatic buffer swapping + is enabled (as is the default), it is not necessary to call this + method and doing so may have undefined results. */ + public void swapBuffers() throws GLException; +} diff --git a/src/classes/javax/media/opengl/GLDrawableFactory.java b/src/classes/javax/media/opengl/GLDrawableFactory.java new file mode 100644 index 000000000..c45bb16e0 --- /dev/null +++ b/src/classes/javax/media/opengl/GLDrawableFactory.java @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import com.sun.opengl.impl.*; + +/**

Provides a virtual machine- and operating system-independent + mechanism for creating {@link GLDrawable}s.

+ +

The {@link javax.media.opengl.GLCapabilities} objects passed in to the + various factory methods are used as a hint for the properties of + the returned drawable. The default capabilities selection + algorithm (equivalent to passing in a null {@link + GLCapabilitiesChooser}) is described in {@link + DefaultGLCapabilitiesChooser}. Sophisticated applications needing + to change the selection algorithm may pass in their own {@link + GLCapabilitiesChooser} which can select from the available pixel + formats.

+ +

Because of the multithreaded nature of the Java platform's + window system toolkit, it is typically not possible to immediately + reject a given {@link GLCapabilities} as being unsupportable by + either returning null from the creation routines or + raising a {@link GLException}. The semantics of the rejection + process are (unfortunately) left unspecified for now. The current + implementation will cause a {@link GLException} to be raised + during the first repaint of the {@link GLCanvas} or {@link + GLJPanel} if the capabilities can not be met. Pbuffers are always + created immediately and their creation will fail with a {@link + GLException} if errors occur.

+*/ + +public abstract class GLDrawableFactory { + private static GLDrawableFactory factory; + + protected GLDrawableFactory() {} + + /** Returns the sole GLDrawableFactory instance. */ + public static GLDrawableFactory getFactory() { + if (factory == null) { + try { + String osName = System.getProperty("os.name"); + String osNameLowerCase = osName.toLowerCase(); + Class factoryClass = null; + + // Because there are some complications with generating all + // platforms' Java glue code on all platforms (among them that we + // would have to include jawt.h and jawt_md.h in the jogl + // sources, which we currently don't have to do) we break the only + // static dependencies with platform-specific code here using reflection. + + if (osNameLowerCase.startsWith("wind")) { + factoryClass = Class.forName("com.sun.opengl.impl.windows.WindowsGLDrawableFactory"); + } else if (osNameLowerCase.startsWith("mac os x")) { + factoryClass = Class.forName("com.sun.opengl.impl.macosx.MacOSXGLDrawableFactory"); + } else { + // Assume Linux, Solaris, etc. Should probably test for these explicitly. + factoryClass = Class.forName("com.sun.opengl.impl.x11.X11GLDrawableFactory"); + } + + if (factoryClass == null) { + throw new GLException("OS " + osName + " not yet supported"); + } + + factory = (GLDrawableFactory) factoryClass.newInstance(); + } catch (ClassNotFoundException e) { + throw new GLException(e); + } catch (InstantiationException e) { + throw new GLException(e); + } catch (IllegalAccessException e) { + throw new GLException(e); + } + } + + return factory; + } + + /** + * Selects an AWT GraphicsConfiguration on the specified + * GraphicsDevice compatible with the supplied GLCapabilities. This + * method is intended to be used by applications which do not use + * the supplied GLCanvas class but instead wrap their own Canvas + * with a GLDrawable. Some platforms (specifically X11) require the + * GraphicsConfiguration to be specified when the platform-specific + * window system object, such as a Canvas, is created. This method + * returns null on platforms on which the OpenGL pixel format + * selection process is performed later. + * + * @see java.awt.Canvas#Canvas(java.awt.GraphicsConfiguration) + */ + public abstract GraphicsConfiguration + chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GraphicsDevice device); + + /** + * Returns a GLDrawable that wraps a platform-specific window system + * object, such as an AWT or LCDUI Canvas. On platforms which + * support it, selects a pixel format compatible with the supplied + * GLCapabilities, or if the passed GLCapabilities object is null, + * uses a default set of capabilities. On these platforms, uses + * either the supplied GLCapabilitiesChooser object, or if the + * passed GLCapabilitiesChooser object is null, uses a + * DefaultGLCapabilitiesChooser instance. + * + * @throws IllegalArgumentException if the passed target is either + * null or its data type is not supported by this GLDrawableFactory. + * @throws GLException if any window system-specific errors caused + * the creation of the GLDrawable to fail. + */ + public abstract GLDrawable getGLDrawable(Object target, + GLCapabilities capabilities, + GLCapabilitiesChooser chooser) + throws IllegalArgumentException, GLException; + + //---------------------------------------------------------------------- + // Methods to create high-level objects + + /** Creates a {@link GLCanvas} on the default graphics device with + the specified capabilities using the default capabilities + selection algorithm. */ + public GLCanvas createGLCanvas(GLCapabilities capabilities) { + return createGLCanvas(capabilities, null, null, null); + } + + /** Creates a {@link GLCanvas} on the specified graphics device with + the specified capabilities using the supplied capabilities + selection algorithm. A null chooser is equivalent to using the + {@link DefaultGLCapabilitiesChooser}. The canvas will share + textures and display lists with the specified {@link GLContext}; + the context must either be null or have been fabricated by + classes in this package. A null context indicates no sharing. A + null GraphicsDevice is equivalent to using that returned from + GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(). */ + public GLCanvas createGLCanvas(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GLContext shareWith, + GraphicsDevice device) { + return new GLCanvas(capabilities, + chooser, + shareWith, + device); + } + + /** Creates a {@link GLJPanel} with the specified capabilities using + the default capabilities selection algorithm. */ + public GLJPanel createGLJPanel(GLCapabilities capabilities) { + return createGLJPanel(capabilities, null, null); + } + + /** Creates a {@link GLJPanel} with the specified capabilities using + the supplied capabilities selection algorithm. A null chooser is + equivalent to using the {@link DefaultGLCapabilitiesChooser}. + The panel will share textures and display lists with the + specified {@link GLContext}; the context must either be null or + have been fabricated by classes in this package. A null context + indicates no sharing. */ + public GLJPanel createGLJPanel(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GLContext shareWith) { + return new GLJPanel(capabilities, chooser, shareWith); + } + + /** + * Returns true if it is possible to create a GLPbuffer. Some older + * graphics cards do not have this capability. + */ + public abstract boolean canCreateGLPbuffer(); + + /** + * Creates a GLPbuffer with the given capabilites and dimensions. + */ + public abstract GLPbuffer createGLPbuffer(GLCapabilities capabilities, + int initialWidth, + int initialHeight, + GLContext shareWith); + + //---------------------------------------------------------------------- + // Methods for interacting with third-party OpenGL libraries + + /** + *

Creates a GLContext object representing an existing OpenGL + * context in an external (third-party) OpenGL-based library. This + * GLContext object may be used to draw into this preexisting + * context using its {@link GL} and {@link + * javax.media.opengl.glu.GLU} objects. New contexts created through + * {@link GLDrawable}s may share textures and display lists with + * this external context.

+ * + *

The underlying OpenGL context must be current on the current + * thread at the time this method is called. The user is responsible + * for the maintenance of the underlying OpenGL context; calls to + * makeCurrent and release on the returned + * GLContext object have no effect. If the underlying OpenGL context + * is destroyed, the destroy method should be called on + * the GLContext. A new GLContext object + * should be created for each newly-created underlying OpenGL + * context. + */ + public abstract GLContext createExternalGLContext(); + + /** + * Returns true if it is possible to create an external GLDrawable + * object via {@link #createExternalGLDrawable}. + */ + public abstract boolean canCreateExternalGLDrawable(); + + /** + *

Creates a {@link GLDrawable} object representing an existing + * OpenGL drawable in an external (third-party) OpenGL-based + * library. This GLDrawable object may be used to create new, + * fully-functional {@link GLContext}s on the OpenGL drawable. This + * is useful when interoperating with a third-party OpenGL-based + * library and it is essential to not perturb the state of the + * library's existing context, even to the point of not sharing + * textures or display lists with that context.

+ * + *

An underlying OpenGL context must be current on the desired + * drawable and the current thread at the time this method is + * called. The user is responsible for the maintenance of the + * underlying drawable. If one or more contexts are created on the + * drawable using {@link GLDrawable#createContext}, and the drawable + * is deleted by the third-party library, the user is responsible + * for calling {@link GLContext#destroy} on these contexts.

+ * + *

Calls to setSize, getWidth and + * getHeight are illegal on the returned GLDrawable. If + * these operations are required by the user, they must be performed + * by the third-party library.

+ * + *

It is legal to create both an external GLContext and + * GLDrawable representing the same third-party OpenGL entities. + * This can be used, for example, to query current state information + * using the external GLContext and then create and set up new + * GLContexts using the external GLDrawable.

+ * + *

This functionality may not be available on all platforms and + * {@link #canCreateExternalGLDrawable} should be called first to + * see if it is present. For example, on X11 platforms, this API + * requires the presence of GLX 1.3 or later. + */ + public abstract GLDrawable createExternalGLDrawable(); +} diff --git a/src/classes/javax/media/opengl/GLEventListener.java b/src/classes/javax/media/opengl/GLEventListener.java new file mode 100644 index 000000000..3aadbf833 --- /dev/null +++ b/src/classes/javax/media/opengl/GLEventListener.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import java.util.EventListener; + +/** Declares events which client code can use to manage OpenGL + rendering into a {@link GLAutoDrawable}. At the time any of these + methods is called, the drawable has made its associated OpenGL + context current, so it is valid to make OpenGL calls. */ + +public interface GLEventListener extends EventListener { + /** Called by the drawable immediately after the OpenGL context is + initialized. Can be used to perform one-time OpenGL + initialization such as setup of lights and display lists. Note + that this method may be called more than once if the underlying + OpenGL context for the GLAutoDrawable is destroyed and + recreated, for example if a GLCanvas is removed from the widget + hierarchy and later added again. + */ + public void init(GLAutoDrawable drawable); + + /** Called by the drawable to initiate OpenGL rendering by the + client. After all GLEventListeners have been notified of a + display event, the drawable will swap its buffers if {@link + GLAutoDrawable#setAutoSwapBufferMode setAutoSwapBufferMode} is + enabled. */ + public void display(GLAutoDrawable drawable); + + /** Called by the drawable during the first repaint after the + component has been resized. The client can update the viewport + and view volume of the window appropriately, for example by a + call to {@link javax.media.opengl.GL#glViewport}; note that for + convenience the component has already called glViewport(x, + y, width, height) when this method is called, so the + client may not have to do anything in this method. + */ + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height); + + /** Called by the drawable when the display mode or the display device + associated with the GLAutoDrawable has changed. The two boolean parameters + indicate the types of change(s) that have occurred. ( !!! CURRENTLY + UNIMPLEMENTED !!! ) +

+ + An example of a display mode change is when the bit depth changes (e.g., + from 32-bit to 16-bit color) on monitor upon which the GLAutoDrawable is + currently being displayed.

+ + An example of a display device change is when the user drags the + window containing the GLAutoDrawable from one monitor to another in a + multiple-monitor setup.

+ + The reason that this function handles both types of changes (instead of + handling mode and device changes in separate methods) is so that + applications have the opportunity to respond to display changes the most + efficient manner. For example, the application may need make fewer + adjustments to compensate for a device change if it knows that the mode + on the new device is identical the previous mode. + */ + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged); +} diff --git a/src/classes/javax/media/opengl/GLException.java b/src/classes/javax/media/opengl/GLException.java new file mode 100644 index 000000000..644042e15 --- /dev/null +++ b/src/classes/javax/media/opengl/GLException.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +/** A generic exception for OpenGL errors used throughout the binding + as a substitute for {@link RuntimeException}. */ + +public class GLException extends RuntimeException { + /** Constructs a GLException object. */ + public GLException() { + super(); + } + + /** Constructs a GLException object with the specified detail + message. */ + public GLException(String message) { + super(message); + } + + /** Constructs a GLException object with the specified detail + message and root cause. */ + public GLException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs a GLException object with the specified root + cause. */ + public GLException(Throwable cause) { + super(cause); + } +} diff --git a/src/classes/javax/media/opengl/GLJPanel.java b/src/classes/javax/media/opengl/GLJPanel.java new file mode 100644 index 000000000..3d6f4e831 --- /dev/null +++ b/src/classes/javax/media/opengl/GLJPanel.java @@ -0,0 +1,877 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.opengl; + +import java.awt.*; +import java.awt.geom.*; +import java.awt.image.*; +import javax.swing.*; +import java.nio.*; +import java.security.*; +import javax.swing.JComponent; +import javax.swing.JPanel; +import com.sun.opengl.impl.*; + +// FIXME: Subclasses need to call resetGLFunctionAvailability() on their +// context whenever the displayChanged() function is called on their +// GLEventListeners + +/** A lightweight Swing component which provides OpenGL rendering + support. Provided for compatibility with Swing user interfaces + when adding a heavyweight doesn't work either because of + Z-ordering or LayoutManager problems. This component attempts to + use hardware-accelerated rendering via pbuffers and falls back on + to software rendering if problems occur. This class can not be + instantiated directly; use {@link GLDrawableFactory} to construct + them.

+ + Note that because this component attempts to use pbuffers for + rendering, and because pbuffers can not be resized, somewhat + surprising behavior may occur during resize operations; the {@link + GLEventListener#init} method may be called multiple times as the + pbuffer is resized to be able to cover the size of the GLJPanel. + This behavior is correct, as the textures and display lists for + the GLJPanel will have been lost during the resize operation. The + application should attempt to make its GLEventListener.init() + methods as side-effect-free as possible.

+ + The GLJPanel can be made transparent by creating it with a + GLCapabilities object with alpha bits specified and calling {@link + #setOpaque}(false). Pixels with resulting OpenGL alpha values less + than 1.0 will be overlaid on any underlying Java2D rendering. +*/ + +public class GLJPanel extends JPanel implements GLAutoDrawable { + private static final boolean DEBUG = Debug.debug("GLJPanel"); + private static final boolean VERBOSE = Debug.verbose(); + + private GLDrawableHelper drawableHelper = new GLDrawableHelper(); + private volatile boolean isInitialized; + private volatile boolean shouldInitialize = false; + + // Data used for either pbuffers or pixmap-based offscreen surfaces + private GLCapabilities offscreenCaps; + private GLCapabilitiesChooser chooser; + private GLContext shareWith; + // This image is exactly the correct size to render into the panel + private BufferedImage offscreenImage; + // One of these is used to store the read back pixels before storing + // in the BufferedImage + private ByteBuffer readBackBytes; + private IntBuffer readBackInts; + private int readBackWidthInPixels; + private int readBackHeightInPixels; + // Width of the actual GLJPanel + private int panelWidth = 0; + private int panelHeight = 0; + private Updater updater; + private int awtFormat; + private int glFormat; + private int glType; + // Lazy reshape notification + private boolean handleReshape = false; + private boolean sendReshape = true; + + // Implementation using pbuffers + private static boolean hardwareAccelerationDisabled = + Debug.isPropertyDefined("jogl.gljpanel.nohw"); + private static boolean softwareRenderingDisabled = + Debug.isPropertyDefined("jogl.gljpanel.nosw"); + private GLPbuffer pbuffer; + private int pbufferWidth = 256; + private int pbufferHeight = 256; + + // Implementation using software rendering + private GLDrawableImpl offscreenDrawable; + private GLContextImpl offscreenContext; + + // For handling reshape events lazily + private int reshapeX; + private int reshapeY; + private int reshapeWidth; + private int reshapeHeight; + + // For saving/restoring of OpenGL state during ReadPixels + private int[] swapbytes = new int[1]; + private int[] rowlength = new int[1]; + private int[] skiprows = new int[1]; + private int[] skippixels = new int[1]; + private int[] alignment = new int[1]; + + // Implementation using Java2D OpenGL pipeline's back buffer + private static boolean swingBufferPerWindow = + Debug.isPropertyDefined("swing.bufferPerWindow") ? + Debug.getBooleanProperty("swing.bufferPerWindow") : + true; + private boolean oglPipelineEnabled = + Java2D.isOGLPipelineActive() && + !Debug.isPropertyDefined("jogl.gljpanel.noogl"); + // Opaque Object identifier representing the Java2D surface we are + // drawing to; used to determine when to destroy and recreate JOGL + // context + private Object j2dSurface; + // Graphics object being used during Java2D update action + // (absolutely essential to cache this) + private Graphics cached2DGraphics; + // No-op context representing the Java2D OpenGL context + private GLContext j2dContext; + // Context associated with no-op drawable representing the JOGL + // OpenGL context + private GLDrawable joglDrawable; + // The real OpenGL context JOGL uses to render + private GLContext joglContext; + // State captured from Java2D OpenGL context necessary in order to + // properly render into Java2D back buffer + private int[] drawBuffer = new int[1]; + private int[] readBuffer = new int[1]; + // These are always set to (0, 0) except when the Java2D / OpenGL + // pipeline is active + private int viewportX; + private int viewportY; + + /** Creates a new GLJPanel component. The passed GLCapabilities must + be non-null and specifies the OpenGL capabilities for the + component. The GLCapabilitiesChooser must be non-null and + specifies the algorithm for selecting one of the available + GLCapabilities for the component; the GLDrawableFactory uses a + DefaultGLCapabilitiesChooser if the user does not provide + one. The passed GLContext may be null and specifies an OpenGL + context with which to share textures, display lists and other + OpenGL state. */ + protected GLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLContext shareWith) { + super(); + + // Works around problems on many vendors' cards; we don't need a + // back buffer for the offscreen surface anyway + if (capabilities != null) { + offscreenCaps = (GLCapabilities) capabilities.clone(); + } else { + offscreenCaps = new GLCapabilities(); + } + offscreenCaps.setDoubleBuffered(false); + this.chooser = ((chooser != null) ? chooser : new DefaultGLCapabilitiesChooser()); + this.shareWith = shareWith; + } + + public void display() { + if (EventQueue.isDispatchThread()) { + // Want display() to be synchronous, so call paintImmediately() + paintImmediately(0, 0, getWidth(), getHeight()); + } else { + // Multithreaded redrawing of Swing components is not allowed, + // so do everything on the event dispatch thread + try { + EventQueue.invokeAndWait(paintImmediatelyAction); + } catch (Exception e) { + throw new GLException(e); + } + } + } + + private void captureJ2DState(GL gl) { + gl.glGetIntegerv(GL.GL_DRAW_BUFFER, drawBuffer, 0); + gl.glGetIntegerv(GL.GL_READ_BUFFER, readBuffer, 0); + } + + private boolean preGL(Graphics g) { + GL gl = joglContext.getGL(); + // Set up needed state in JOGL context from Java2D context + gl.glEnable(GL.GL_SCISSOR_TEST); + Rectangle r = Java2D.getOGLScissorBox(g); + if (r == null) { + return false; + } + gl.glScissor(r.x, r.y, r.width, r.height); + Rectangle oglViewport = Java2D.getOGLViewport(g, panelWidth, panelHeight); + // If the viewport X or Y changes, in addition to the panel's + // width or height, we need to send a reshape operation to the + // client + if ((viewportX != oglViewport.x) || + (viewportY != oglViewport.y)) { + sendReshape = true; + if (DEBUG) { + System.err.println("Sending reshape because viewport changed"); + System.err.println(" viewportX (" + viewportX + ") ?= oglViewport.x (" + oglViewport.x + ")"); + System.err.println(" viewportY (" + viewportY + ") ?= oglViewport.y (" + oglViewport.y + ")"); + } + } + viewportX = oglViewport.x; + viewportY = oglViewport.y; + + gl.glDrawBuffer(drawBuffer[0]); + gl.glReadBuffer(readBuffer[0]); + return true; + } + + /** Overridden from JComponent; calls event listeners' {@link + GLEventListener#display display} methods. Should not be invoked + by applications directly. */ + public void paintComponent(final Graphics g) { + if (shouldInitialize) { + initialize(); + } + + if (!isInitialized) { + return; + } + + // NOTE: must do this when the context is not current as it may + // involve destroying the pbuffer (current context) and + // re-creating it -- tricky to do properly while the context is + // current + if (handleReshape) { + handleReshape(); + } + + updater.setGraphics(g); + + if (oglPipelineEnabled) { + Java2D.invokeWithOGLContextCurrent(g, new Runnable() { + public void run() { + // Create no-op context representing Java2D context + if (j2dContext == null) { + j2dContext = GLDrawableFactory.getFactory().createExternalGLContext(); + + // Check to see whether we can support the requested + // capabilities or need to fall back to a pbuffer + // FIXME: add more checks? + + GL gl = j2dContext.getGL(); + if ((getGLInteger(gl, GL.GL_RED_BITS) < offscreenCaps.getRedBits()) || + (getGLInteger(gl, GL.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) || + (getGLInteger(gl, GL.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) || + // (getGLInteger(gl, GL.GL_ALPHA_BITS) < offscreenCaps.getAlphaBits()) || + (getGLInteger(gl, GL.GL_ACCUM_RED_BITS) < offscreenCaps.getAccumRedBits()) || + (getGLInteger(gl, GL.GL_ACCUM_GREEN_BITS) < offscreenCaps.getAccumGreenBits()) || + (getGLInteger(gl, GL.GL_ACCUM_BLUE_BITS) < offscreenCaps.getAccumBlueBits()) || + (getGLInteger(gl, GL.GL_ACCUM_ALPHA_BITS) < offscreenCaps.getAccumAlphaBits()) || + // (getGLInteger(gl, GL.GL_DEPTH_BITS) < offscreenCaps.getDepthBits()) || + (getGLInteger(gl, GL.GL_STENCIL_BITS) < offscreenCaps.getStencilBits())) { + if (DEBUG) { + System.err.println("GLJPanel: Falling back to pbuffer-based support because Java2D context insufficient"); + System.err.println(" Available Required"); + System.err.println("GL_RED_BITS " + getGLInteger(gl, GL.GL_RED_BITS) + " " + offscreenCaps.getRedBits()); + System.err.println("GL_GREEN_BITS " + getGLInteger(gl, GL.GL_GREEN_BITS) + " " + offscreenCaps.getGreenBits()); + System.err.println("GL_BLUE_BITS " + getGLInteger(gl, GL.GL_BLUE_BITS) + " " + offscreenCaps.getBlueBits()); + System.err.println("GL_ALPHA_BITS " + getGLInteger(gl, GL.GL_ALPHA_BITS) + " " + offscreenCaps.getAlphaBits()); + System.err.println("GL_ACCUM_RED_BITS " + getGLInteger(gl, GL.GL_ACCUM_RED_BITS) + " " + offscreenCaps.getAccumRedBits()); + System.err.println("GL_ACCUM_GREEN_BITS " + getGLInteger(gl, GL.GL_ACCUM_GREEN_BITS) + " " + offscreenCaps.getAccumGreenBits()); + System.err.println("GL_ACCUM_BLUE_BITS " + getGLInteger(gl, GL.GL_ACCUM_BLUE_BITS) + " " + offscreenCaps.getAccumBlueBits()); + System.err.println("GL_ACCUM_ALPHA_BITS " + getGLInteger(gl, GL.GL_ACCUM_ALPHA_BITS) + " " + offscreenCaps.getAccumAlphaBits()); + System.err.println("GL_DEPTH_BITS " + getGLInteger(gl, GL.GL_DEPTH_BITS) + " " + offscreenCaps.getDepthBits()); + System.err.println("GL_STENCIL_BITS " + getGLInteger(gl, GL.GL_STENCIL_BITS) + " " + offscreenCaps.getStencilBits()); + } + isInitialized = false; + shouldInitialize = true; + oglPipelineEnabled = false; + handleReshape = true; + j2dContext.destroy(); + j2dContext = null; + return; + } + } + + j2dContext.makeCurrent(); + try { + captureJ2DState(j2dContext.getGL()); + Object curSurface = Java2D.getOGLSurfaceIdentifier(g); + if (curSurface != null) { + if (j2dSurface != curSurface) { + if (joglContext != null) { + joglContext.destroy(); + joglContext = null; + joglDrawable = null; + sendReshape = true; + if (DEBUG) { + System.err.println("Sending reshape because surface changed"); + System.err.println("New surface = " + curSurface); + } + } + j2dSurface = curSurface; + } + if (joglContext == null) { + joglDrawable = GLDrawableFactory.getFactory().createExternalGLDrawable(); + joglContext = joglDrawable.createContext(shareWith); + } + drawableHelper.invokeGL(joglDrawable, joglContext, displayAction, initAction); + } + } finally { + j2dContext.release(); + } + } + }); + } else { + if (!hardwareAccelerationDisabled) { + pbuffer.display(); + } else { + drawableHelper.invokeGL(offscreenDrawable, offscreenContext, displayAction, initAction); + } + } + } + + /** Overridden from JPanel; used to indicate that an OpenGL context + may be created for the component. */ + public void addNotify() { + super.addNotify(); + shouldInitialize = true; + if (DEBUG) { + System.err.println("GLJPanel.addNotify()"); + } + } + + /** Overridden from JPanel; used to indicate that it's no longer + safe to have an OpenGL context for the component. */ + public void removeNotify() { + if (DEBUG) { + System.err.println("GLJPanel.removeNotify()"); + } + if (oglPipelineEnabled) { + Java2D.invokeWithOGLContextCurrent(null, new Runnable() { + public void run() { + if (joglContext != null) { + joglContext.destroy(); + joglContext = null; + } + joglDrawable = null; + if (j2dContext != null) { + j2dContext.destroy(); + j2dContext = null; + } + } + }); + } else { + if (!hardwareAccelerationDisabled) { + if (pbuffer != null) { + pbuffer.destroy(); + pbuffer = null; + } + } else { + if (offscreenContext != null) { + offscreenContext.destroy(); + offscreenContext = null; + } + if (offscreenDrawable != null) { + offscreenDrawable.destroy(); + offscreenDrawable = null; + } + } + } + isInitialized = false; + super.removeNotify(); + } + + /** Overridden from Canvas; causes {@link GLEventListener#reshape + reshape} to be called on all registered {@link + GLEventListener}s. Called automatically by the AWT; should not + be invoked by applications directly. */ + public void reshape(int x, int y, int width, int height) { + super.reshape(x, y, width, height); + + reshapeX = x; + reshapeY = y; + reshapeWidth = width; + reshapeHeight = height; + handleReshape = true; + } + + public void setOpaque(boolean opaque) { + if (opaque != isOpaque()) { + if (offscreenImage != null) { + offscreenImage.flush(); + offscreenImage = null; + } + } + super.setOpaque(opaque); + } + + public void addGLEventListener(GLEventListener listener) { + drawableHelper.addGLEventListener(listener); + } + + public void removeGLEventListener(GLEventListener listener) { + drawableHelper.removeGLEventListener(listener); + } + + public GLContext createContext(GLContext shareWith) { + if (!hardwareAccelerationDisabled) { + return pbuffer.createContext(shareWith); + } else { + return offscreenDrawable.createContext(shareWith); + } + } + + public void setRealized(boolean realized) { + } + + public GLContext getContext() { + if (oglPipelineEnabled) { + return joglContext; + } else { + if (!hardwareAccelerationDisabled) { + return pbuffer.getContext(); + } else { + return offscreenContext; + } + } + } + + public GL getGL() { + GLContext context = getContext(); + return (context == null) ? null : context.getGL(); + } + + public void setGL(GL gl) { + GLContext context = getContext(); + if (context != null) { + context.setGL(gl); + } + } + + public void setAutoSwapBufferMode(boolean onOrOff) { + if (!hardwareAccelerationDisabled) { + pbuffer.setAutoSwapBufferMode(onOrOff); + } else { + drawableHelper.setAutoSwapBufferMode(onOrOff); + } + } + + public boolean getAutoSwapBufferMode() { + if (!hardwareAccelerationDisabled) { + return pbuffer.getAutoSwapBufferMode(); + } else { + return drawableHelper.getAutoSwapBufferMode(); + } + } + + public void swapBuffers() { + if (!hardwareAccelerationDisabled) { + pbuffer.swapBuffers(); + } else { + drawableHelper.invokeGL(offscreenDrawable, offscreenContext, swapBuffersAction, initAction); + } + } + + /** For a translucent GLJPanel (one for which {@link #setOpaque + setOpaque}(false) has been called), indicates whether the + application should preserve the OpenGL color buffer + (GL_COLOR_BUFFER_BIT) for correct rendering of the GLJPanel and + underlying widgets which may show through portions of the + GLJPanel with alpha values less than 1. Most Swing + implementations currently expect the GLJPanel to be completely + cleared (e.g., by glClear(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT)), but for certain optimized Java2D + and Swing implementations which use OpenGL internally, it may be + possible to perform OpenGL rendering using the GLJPanel into the + same OpenGL drawable as the Java2D implementation. */ + public boolean shouldPreserveColorBufferIfTranslucent() { + return oglPipelineEnabled; + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + + private void initialize() { + if (panelWidth == 0 || + panelHeight == 0) { + // See whether we have a non-zero size yet and can go ahead with + // initialization + if (reshapeWidth == 0 || + reshapeHeight == 0) { + return; + } + + // Pull down reshapeWidth and reshapeHeight into panelWidth and + // panelHeight eagerly in order to complete initialization, and + // force a reshape later + panelWidth = reshapeWidth; + panelHeight = reshapeHeight; + } + + if (!oglPipelineEnabled) { + // Initialize either the hardware-accelerated rendering path or + // the lightweight rendering path + if (!hardwareAccelerationDisabled) { + if (GLDrawableFactory.getFactory().canCreateGLPbuffer()) { + if (pbuffer != null) { + throw new InternalError("Creating pbuffer twice without destroying it (memory leak / correctness bug)"); + } + try { + pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(offscreenCaps, + pbufferWidth, + pbufferHeight, + shareWith); + updater = new Updater(); + pbuffer.addGLEventListener(updater); + shouldInitialize = false; + isInitialized = true; + return; + } catch (GLException e) { + if (DEBUG) { + e.printStackTrace(); + System.err.println("GLJPanel: Falling back on software rendering because of problems creating pbuffer"); + } + hardwareAccelerationDisabled = true; + } + } else { + if (DEBUG) { + System.err.println("GLJPanel: Falling back on software rendering because no pbuffer support"); + } + + // If the factory reports that it can't create a pbuffer, + // don't try again the next time, and fall through to the + // software rendering path + hardwareAccelerationDisabled = true; + } + } + + if (softwareRenderingDisabled) { + throw new GLException("Fallback to software rendering disabled by user"); + } + + // Fall-through path: create an offscreen context instead + offscreenDrawable = GLDrawableFactoryImpl.getFactoryImpl().createOffscreenDrawable(offscreenCaps, chooser); + offscreenDrawable.setSize(Math.max(1, panelWidth), Math.max(1, panelHeight)); + offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith); + offscreenContext.setSynchronized(true); + } + updater = new Updater(); + shouldInitialize = false; + isInitialized = true; + } + + private void handleReshape() { + readBackWidthInPixels = 0; + readBackHeightInPixels = 0; + + panelWidth = reshapeWidth; + panelHeight = reshapeHeight; + + if (DEBUG) { + System.err.println("GLJPanel.handleReshape: (w,h) = (" + + panelWidth + "," + panelHeight + ")"); + } + + sendReshape = true; + + if (!oglPipelineEnabled) { + if (!hardwareAccelerationDisabled) { + // Use factor larger than 2 during shrinks for some hysteresis + float shrinkFactor = 2.5f; + if ((panelWidth > pbufferWidth ) || (panelHeight > pbufferHeight) || + (panelWidth < (pbufferWidth / shrinkFactor)) || (panelHeight < (pbufferWidth / shrinkFactor))) { + if (DEBUG) { + System.err.println("Resizing pbuffer from (" + pbufferWidth + ", " + pbufferHeight + ") " + + " to fit (" + panelWidth + ", " + panelHeight + ")"); + } + // Must destroy and recreate pbuffer to fit + if (pbuffer != null) { + pbuffer.destroy(); + } + pbuffer = null; + isInitialized = false; + pbufferWidth = getNextPowerOf2(panelWidth); + pbufferHeight = getNextPowerOf2(panelHeight); + if (DEBUG) { + System.err.println("New pbuffer size is (" + pbufferWidth + ", " + pbufferHeight + ")"); + } + initialize(); + } + + // It looks like NVidia's drivers (at least the ones on my + // notebook) are buggy and don't allow a rectangle of less than + // the pbuffer's width to be read...this doesn't really matter + // because it's the Graphics.drawImage() calls that are the + // bottleneck. Should probably make the size of the offscreen + // image be the exact size of the pbuffer to save some work on + // resize operations... + readBackWidthInPixels = pbufferWidth; + readBackHeightInPixels = panelHeight; + } else { + offscreenContext.destroy(); + offscreenDrawable.setSize(Math.max(1, panelWidth), Math.max(1, panelHeight)); + readBackWidthInPixels = Math.max(1, panelWidth); + readBackHeightInPixels = Math.max(1, panelHeight); + } + + if (offscreenImage != null) { + offscreenImage.flush(); + offscreenImage = null; + } + } + + handleReshape = false; + } + + // FIXME: it isn't clear whether this works any more given that + // we're accessing the GLDrawable inside of the GLPbuffer directly + // up in reshape() -- need to rethink and clean this up + class Updater implements GLEventListener { + private Graphics g; + + public void setGraphics(Graphics g) { + this.g = g; + } + + public void init(GLAutoDrawable drawable) { + if (oglPipelineEnabled) { + if (!preGL(g)) { + return; + } + } + drawableHelper.init(GLJPanel.this); + } + + public void display(GLAutoDrawable drawable) { + if (oglPipelineEnabled) { + if (!preGL(g)) { + return; + } + } + + if (sendReshape) { + if (DEBUG) { + System.err.println("glViewport(" + viewportX + ", " + viewportY + ", " + panelWidth + ", " + panelHeight + ")"); + } + getGL().glViewport(viewportX, viewportY, panelWidth, panelHeight); + drawableHelper.reshape(GLJPanel.this, viewportX, viewportY, panelWidth, panelHeight); + sendReshape = false; + } + + drawableHelper.display(GLJPanel.this); + + if (!oglPipelineEnabled) { + // Must now copy pixels from offscreen context into surface + if (offscreenImage == null) { + if (panelWidth > 0 && panelHeight > 0) { + // It looks like NVidia's drivers (at least the ones on my + // notebook) are buggy and don't allow a sub-rectangle to be + // read from a pbuffer...this doesn't really matter because + // it's the Graphics.drawImage() calls that are the + // bottleneck + + int awtFormat = 0; + int hwGLFormat = 0; + if (!hardwareAccelerationDisabled) { + // This seems to be a good choice on all platforms + hwGLFormat = GL.GL_UNSIGNED_INT_8_8_8_8_REV; + } + + // Should be more flexible in these BufferedImage formats; + // perhaps see what the preferred image types are on the + // given platform + if (isOpaque()) { + awtFormat = BufferedImage.TYPE_INT_RGB; + } else { + awtFormat = BufferedImage.TYPE_INT_ARGB; + } + + offscreenImage = new BufferedImage(panelWidth, + panelHeight, + awtFormat); + switch (awtFormat) { + case BufferedImage.TYPE_3BYTE_BGR: + glFormat = GL.GL_BGR; + glType = GL.GL_UNSIGNED_BYTE; + readBackBytes = ByteBuffer.allocate(readBackWidthInPixels * readBackHeightInPixels * 3); + break; + + case BufferedImage.TYPE_INT_RGB: + case BufferedImage.TYPE_INT_ARGB: + glFormat = GL.GL_BGRA; + glType = (hardwareAccelerationDisabled + ? offscreenContext.getOffscreenContextPixelDataType() + : hwGLFormat); + readBackInts = IntBuffer.allocate(readBackWidthInPixels * readBackHeightInPixels); + break; + + default: + // FIXME: Support more off-screen image types (current + // offscreen context implementations don't use others, and + // some of the OpenGL formats aren't supported in the 1.1 + // headers, which we're currently using) + throw new GLException("Unsupported offscreen image type " + awtFormat); + } + } + } + + if (offscreenImage != null) { + GL gl = getGL(); + // Save current modes + gl.glGetIntegerv(GL.GL_PACK_SWAP_BYTES, swapbytes, 0); + gl.glGetIntegerv(GL.GL_PACK_ROW_LENGTH, rowlength, 0); + gl.glGetIntegerv(GL.GL_PACK_SKIP_ROWS, skiprows, 0); + gl.glGetIntegerv(GL.GL_PACK_SKIP_PIXELS, skippixels, 0); + gl.glGetIntegerv(GL.GL_PACK_ALIGNMENT, alignment, 0); + + gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, GL.GL_FALSE); + gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, readBackWidthInPixels); + gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0); + gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0); + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); + + // Actually read the pixels. + gl.glReadBuffer(GL.GL_FRONT); + if (readBackBytes != null) { + gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackBytes); + } else if (readBackInts != null) { + gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackInts); + } + + // Restore saved modes. + gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, swapbytes[0]); + gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, rowlength[0]); + gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, skiprows[0]); + gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, skippixels[0]); + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, alignment[0]); + + if (readBackBytes != null || readBackInts != null) { + // Copy temporary data into raster of BufferedImage for faster + // blitting Note that we could avoid this copy in the cases + // where !offscreenContext.offscreenImageNeedsVerticalFlip(), + // but that's the software rendering path which is very slow + // anyway + Object src = null; + Object dest = null; + int srcIncr = 0; + int destIncr = 0; + + if (readBackBytes != null) { + src = readBackBytes.array(); + dest = ((DataBufferByte) offscreenImage.getRaster().getDataBuffer()).getData(); + srcIncr = readBackWidthInPixels * 3; + destIncr = offscreenImage.getWidth() * 3; + } else { + src = readBackInts.array(); + dest = ((DataBufferInt) offscreenImage.getRaster().getDataBuffer()).getData(); + srcIncr = readBackWidthInPixels; + destIncr = offscreenImage.getWidth(); + } + + if (!hardwareAccelerationDisabled || + offscreenContext.offscreenImageNeedsVerticalFlip()) { + int srcPos = 0; + int destPos = (offscreenImage.getHeight() - 1) * destIncr; + for (; destPos >= 0; srcPos += srcIncr, destPos -= destIncr) { + System.arraycopy(src, srcPos, dest, destPos, destIncr); + } + } else { + int srcPos = 0; + int destEnd = destIncr * offscreenImage.getHeight(); + for (int destPos = 0; destPos < destEnd; srcPos += srcIncr, destPos += destIncr) { + System.arraycopy(src, srcPos, dest, destPos, destIncr); + } + } + + // Draw resulting image in one shot + g.drawImage(offscreenImage, 0, 0, offscreenImage.getWidth(), offscreenImage.getHeight(), GLJPanel.this); + } + } + } else { + // Cause OpenGL pipeline to flush its results because + // otherwise it's possible we will buffer up multiple frames' + // rendering results, resulting in apparent mouse lag + GL gl = getGL(); + gl.glFinish(); + } + } + + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + // This is handled above and dispatched directly to the appropriate context + } + + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + } + } + + class InitAction implements Runnable { + public void run() { + updater.init(GLJPanel.this); + } + } + private InitAction initAction = new InitAction(); + + class DisplayAction implements Runnable { + public void run() { + updater.display(GLJPanel.this); + } + } + private DisplayAction displayAction = new DisplayAction(); + + // This one is used exclusively in the non-hardware-accelerated case + class SwapBuffersAction implements Runnable { + public void run() { + offscreenDrawable.swapBuffers(); + } + } + private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); + + class PaintImmediatelyAction implements Runnable { + public void run() { + paintImmediately(0, 0, getWidth(), getHeight()); + } + } + private PaintImmediatelyAction paintImmediatelyAction = new PaintImmediatelyAction(); + + private int getNextPowerOf2(int number) { + // Workaround for problems where 0 width or height are transiently + // seen during layout + if (number == 0) { + return 2; + } + + if (((number-1) & number) == 0) { + //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0 + return number; + } + int power = 0; + while (number > 0) { + number = number>>1; + power++; + } + return (1< + + OpenGL is specified as a thread-safe API, but in practice there + are multithreading-related issues on most, if not all, of the + platforms which support it. For example, some OpenGL + implementations do not behave well when one context is made + current first on one thread, released, and then made current on a + second thread, although this is legal according to the OpenGL + specification. On other platforms there are other problems. + +

+ + Due to these limitations, and due to the inherent multithreading + in the Java platform (in particular, in the Abstract Window + Toolkit), it is necessary to limit the multithreading occurring in + the typical application using the JOGL API. This has been done by + forcing all OpenGL-related work for GLAutoDrawables on to a single + thread. In other words, if an application uses only the + GLAutoDrawable and GLEventListener callback mechanism, it is + guaranteed to have the most correct single-threaded behavior on + all platforms. + +

+ + Applications using the GLContext makeCurrent/release API directly + will inherently break this single-threaded model, as these methods + require that the OpenGL context be made current on the current + thread immediately. For applications wishing to integrate better + with the single-threaded model, this class provides public access + to the mechanism used by the JOGL implementation. Users can + execute Runnables on the internal thread used for performing + OpenGL work, and query whether the current thread is already this + thread. Using these mechanisms the user can move work from the + current thread on to the internal OpenGL thread if desired. + +

+ + This class also provides mechanisms for querying whether this + internal serialization of OpenGL work is in effect, and a + programmatic way of disabling it. Currently it is enabled by + default, although it could be disabled in the future if OpenGL + drivers become more robust on all platforms. + +

+ + In addition to specifying programmatically whether the single + thread for OpenGL work is enabled, users may switch it on and off + using the system property jogl.1thread. Valid values + for this system property are: + +

+    -Djogl.1thread=false     Disable single-threading of OpenGL work
+    -Djogl.1thread=true      Enable single-threading of OpenGL work (default)
+    -Djogl.1thread=auto      Select default single-threading behavior (currently on)
+    
+*/ + +public class Threading { + private static boolean singleThreaded = true; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String workaround = System.getProperty("jogl.1thread"); + if (workaround != null && (!workaround.equals("auto"))) { + singleThreaded = Boolean.valueOf(workaround).booleanValue(); + } + printWorkaroundNotice(); + return null; + } + }); + } + + /** No reason to ever instantiate this class */ + private Threading() {} + + /** Provides a mechanism for end users to disable the default + single-threading of the JOGL implementation. Users are strongly + discouraged from calling this method unless they are aware of + all of the consequences and are prepared to enforce some amount + of threading restrictions in their applications. Disabling this + single-threading, for example, will have unintended consequences + on GLAutoDrawable implementations such as GLCanvas, GLJPanel and + GLPbuffer. Currently there is no supported way to re-enable it + once disabled, partly to discourage careless use of this + method. */ + public static void disableSingleThreading() { + singleThreaded = false; + if (Debug.verbose()) { + System.err.println("Application forced disabling of single-threading of JOGL implementation"); + } + } + + /** Indicates whether OpenGL work is being automatically forced to a + single thread by the JOGL implementation. */ + public static boolean isSingleThreaded() { + return singleThreaded; + } + + /** Indicates whether the current thread is the single thread on + which the JOGL implementation performs all of its OpenGL-related + work. This method should only be called if the single-thread + model is in effect. */ + public static boolean isOpenGLThread() throws GLException { + if (!isSingleThreaded()) { + throw new GLException("Should only call this in single-threaded mode"); + } + + if (Java2D.isOGLPipelineActive()) { + // FIXME: ideally only the QFT would be considered to be the + // "OpenGL thread", but we can not currently run all of JOGL's + // OpenGL work on that thread. For now, run the GLJPanel's + // Java2D/JOGL bridge on the QFT but everything else on the + // EDT, except when we're already on the QFT. + return (Java2D.isQueueFlusherThread() || + EventQueue.isDispatchThread()); + } else { + return EventQueue.isDispatchThread(); + } + } + + /** Executes the passed Runnable on the single thread used for all + OpenGL work in the JOGL implementation. It is not specified + exactly which thread is used for this purpose. This method + should only be called if the single-thread model is in use and + if the current thread is not the OpenGL thread (i.e., if + isOpenGLThread() returns false). It is up to the + end user to check to see whether the current thread is the + OpenGL thread and either execute the Runnable directly or + perform the work inside it. */ + public static void invokeOnOpenGLThread(Runnable r) throws GLException { + if (!isSingleThreaded()) { + throw new GLException ("Should only call this in single-threaded mode"); + } + + if (isOpenGLThread()) { + throw new GLException ("Should only call this from other threads than the OpenGL thread"); + } + + // FIXME: ideally should run all OpenGL work on the Java2D QFT + // thread when it's enabled, but there are issues with this when + // the GLJPanel is not using the Java2D bridge; would like to run + // its OpenGL work on the QFT, but do the image drawing from the + // EDT. Other issues still remain with the GLCanvas as well. + + // if (Java2D.isOGLPipelineActive()) { + // Java2D.invokeWithOGLContextCurrent(null, r); + // } else { + try { + EventQueue.invokeAndWait(r); + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (InterruptedException e) { + throw new GLException(e); + } + // } + } + + private static void printWorkaroundNotice() { + if (singleThreaded && Debug.verbose()) { + System.err.println("Using single thread for performing OpenGL work in JOGL implementation"); + } + } +} diff --git a/src/classes/javax/media/opengl/glu/GLUquadric.java b/src/classes/javax/media/opengl/glu/GLUquadric.java new file mode 100755 index 000000000..bcb21fb90 --- /dev/null +++ b/src/classes/javax/media/opengl/glu/GLUquadric.java @@ -0,0 +1,8 @@ +package javax.media.opengl.glu; + +/** + * Wrapper for a GLU quadric object. + */ + +public interface GLUquadric { +} diff --git a/src/classes/javax/media/opengl/glu/GLUtessellator.java b/src/classes/javax/media/opengl/glu/GLUtessellator.java new file mode 100755 index 000000000..df42a8a82 --- /dev/null +++ b/src/classes/javax/media/opengl/glu/GLUtessellator.java @@ -0,0 +1,56 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package javax.media.opengl.glu; + +/** + * The GLUtessellator object is used to hold the data, such as the + * vertices, edges and callback objects, to describe and tessellate complex + * polygons. A GLUtessellator object is used with the + * {@link GLU GLU} tessellator methods and + * {@link GLUtessellatorCallback GLU callbacks}. + * + * @author Eric Veach, July 1994 + * @author Java Port: Pepijn Van Eechhoudt, July 2003 + * @author Java Port: Nathan Parker Burg, August 2003 + */ +public interface GLUtessellator {} diff --git a/src/classes/javax/media/opengl/glu/GLUtessellatorCallback.java b/src/classes/javax/media/opengl/glu/GLUtessellatorCallback.java new file mode 100755 index 000000000..9d4946b00 --- /dev/null +++ b/src/classes/javax/media/opengl/glu/GLUtessellatorCallback.java @@ -0,0 +1,346 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package javax.media.opengl.glu; + +/** + * GLUtessellatorCallback interface provides methods that the user will + * override to define the callbacks for a tessellation object. + * + * @author Eric Veach, July 1994 + * @author Java Port: Pepijn Van Eeckhoudt, July 2003 + * @author Java Port: Nathan Parker Burg, August 2003 + */ +public interface GLUtessellatorCallback { + /** + * The begin callback method is invoked like + * {@link javax.media.opengl.GL#glBegin glBegin} to indicate the start of a + * (triangle) primitive. The method takes a single argument of type int. If + * the GLU_TESS_BOUNDARY_ONLY property is set to GL_FALSE, then + * the argument is set to either GL_TRIANGLE_FAN, + * GL_TRIANGLE_STRIP, or GL_TRIANGLES. If the + * GLU_TESS_BOUNDARY_ONLY property is set to GL_TRUE, then the + * argument will be set to GL_LINE_LOOP. + * + * @param type + * Specifics the type of begin/end pair being defined. The following + * values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, + * GL_TRIANGLES or GL_LINE_LOOP. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #end end + * @see #begin begin + */ + public void begin(int type); + + /** + * The same as the {@link #begin begin} callback method except that + * it takes an additional reference argument. This reference is + * identical to the opaque reference provided when {@link + * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. + * + * @param type + * Specifics the type of begin/end pair being defined. The following + * values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, + * GL_TRIANGLES or GL_LINE_LOOP. + * @param polygonData + * Specifics a reference to user-defined data. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #endData endData + * @see #begin begin + */ + public void beginData(int type, Object polygonData); + + + /** + * The edgeFlag callback method is similar to + * {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes + * a single boolean boundaryEdge that indicates which edges lie on the + * polygon boundary. If the boundaryEdge is GL_TRUE, then each vertex + * that follows begins an edge that lies on the polygon boundary, that is, + * an edge that separates an interior region from an exterior one. If the + * boundaryEdge is GL_FALSE, then each vertex that follows begins an + * edge that lies in the polygon interior. The edge flag callback (if + * defined) is invoked before the first vertex callback.

+ * + * Since triangle fans and triangle strips do not support edge flags, the + * begin callback is not called with GL_TRIANGLE_FAN or + * GL_TRIANGLE_STRIP if a non-null edge flag callback is provided. + * (If the callback is initialized to null, there is no impact on + * performance). Instead, the fans and strips are converted to independent + * triangles. + * + * @param boundaryEdge + * Specifics which edges lie on the polygon boundary. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #edgeFlagData edgeFlagData + */ + public void edgeFlag(boolean boundaryEdge); + + + /** + * The same as the {@link #edgeFlag edgeFlage} callback method + * except that it takes an additional reference argument. This + * reference is identical to the opaque reference provided when + * {@link GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. + * + * @param boundaryEdge + * Specifics which edges lie on the polygon boundary. + * @param polygonData + * Specifics a reference to user-defined data. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #edgeFlag edgeFlag + */ + public void edgeFlagData(boolean boundaryEdge, Object polygonData); + + + /** + * The vertex callback method is invoked between the {@link + * #begin begin} and {@link #end end} callback methods. It is + * similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f}, + * and it defines the vertices of the triangles created by the + * tessellation process. The method takes a reference as its only + * argument. This reference is identical to the opaque reference + * provided by the user when the vertex was described (see {@link + * GLU#gluTessVertex gluTessVertex}). + * + * @param vertexData + * Specifics a reference to the vertices of the triangles created + * byt the tessellatin process. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #vertexData vertexData + */ + public void vertex(Object vertexData); + + + /** + * The same as the {@link #vertex vertex} callback method except + * that it takes an additional reference argument. This reference is + * identical to the opaque reference provided when {@link + * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. + * + * @param vertexData + * Specifics a reference to the vertices of the triangles created + * byt the tessellatin process. + * @param polygonData + * Specifics a reference to user-defined data. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #vertex vertex + */ + public void vertexData(Object vertexData, Object polygonData); + + + /** + * The end callback serves the same purpose as + * {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a + * primitive and it takes no arguments. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #begin begin + * @see #endData endData + */ + public void end(); + + + /** + * The same as the {@link #end end} callback method except that it + * takes an additional reference argument. This reference is + * identical to the opaque reference provided when {@link + * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. + * + * @param polygonData + * Specifics a reference to user-defined data. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #beginData beginData + * @see #end end + */ + public void endData(Object polygonData); + + + /** + * The combine callback method is called to create a new vertex when + * the tessellation detects an intersection, or wishes to merge features. The + * method takes four arguments: an array of three elements each of type + * double, an array of four references, an array of four elements each of + * type float, and a reference to a reference.

+ * + * The vertex is defined as a linear combination of up to four existing + * vertices, stored in data. The coefficients of the linear combination + * are given by weight; these weights always add up to 1. All vertex + * pointers are valid even when some of the weights are 0. coords gives + * the location of the new vertex.

+ * + * The user must allocate another vertex, interpolate parameters using + * data and weight, and return the new vertex pointer in + * outData. This handle is supplied during rendering callbacks. The + * user is responsible for freeing the memory some time after + * {@link GLU#gluTessEndPolygon gluTessEndPolygon} is + * called.

+ * + * For example, if the polygon lies in an arbitrary plane in 3-space, and a + * color is associated with each vertex, the GLU_TESS_COMBINE + * callback might look like this: + * + *

+   *         void myCombine(double[] coords, Object[] data,
+   *                        float[] weight, Object[] outData)
+   *         {
+   *            MyVertex newVertex = new MyVertex();
+   *
+   *            newVertex.x = coords[0];
+   *            newVertex.y = coords[1];
+   *            newVertex.z = coords[2];
+   *            newVertex.r = weight[0]*data[0].r +
+   *                          weight[1]*data[1].r +
+   *                          weight[2]*data[2].r +
+   *                          weight[3]*data[3].r;
+   *            newVertex.g = weight[0]*data[0].g +
+   *                          weight[1]*data[1].g +
+   *                          weight[2]*data[2].g +
+   *                          weight[3]*data[3].g;
+   *            newVertex.b = weight[0]*data[0].b +
+   *                          weight[1]*data[1].b +
+   *                          weight[2]*data[2].b +
+   *                          weight[3]*data[3].b;
+   *            newVertex.a = weight[0]*data[0].a +
+   *                          weight[1]*data[1].a +
+   *                          weight[2]*data[2].a +
+   *                          weight[3]*data[3].a;
+   *            outData = newVertex;
+   *         }
+ * + * @param coords + * Specifics the location of the new vertex. + * @param data + * Specifics the vertices used to create the new vertex. + * @param weight + * Specifics the weights used to create the new vertex. + * @param outData + * Reference user the put the coodinates of the new vertex. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #combineData combineData + */ + public void combine(double[] coords, Object[] data, + float[] weight, Object[] outData); + + + /** + * The same as the {@link #combine combine} callback method except + * that it takes an additional reference argument. This reference is + * identical to the opaque reference provided when {@link + * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. + * + * @param coords + * Specifics the location of the new vertex. + * @param data + * Specifics the vertices used to create the new vertex. + * @param weight + * Specifics the weights used to create the new vertex. + * @param outData + * Reference user the put the coodinates of the new vertex. + * @param polygonData + * Specifics a reference to user-defined data. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #combine combine + */ + public void combineData(double[] coords, Object[] data, + float[] weight, Object[] outData, + Object polygonData); + + + /** + * The error callback method is called when an error is encountered. + * The one argument is of type int; it indicates the specific error that + * occurred and will be set to one of GLU_TESS_MISSING_BEGIN_POLYGON, + * GLU_TESS_MISSING_END_POLYGON, GLU_TESS_MISSING_BEGIN_CONTOUR, + * GLU_TESS_MISSING_END_CONTOUR, GLU_TESS_COORD_TOO_LARGE, + * GLU_TESS_NEED_COMBINE_CALLBACK or GLU_OUT_OF_MEMORY. + * Character strings describing these errors can be retrieved with the + * {@link GLU#gluErrorString gluErrorString} call.

+ * + * The GLU library will recover from the first four errors by inserting the + * missing call(s). GLU_TESS_COORD_TOO_LARGE indicates that some + * vertex coordinate exceeded the predefined constant + * GLU_TESS_MAX_COORD in absolute value, and that the value has been + * clamped. (Coordinate values must be small enough so that two can be + * multiplied together without overflow.) + * GLU_TESS_NEED_COMBINE_CALLBACK indicates that the tessellation + * detected an intersection between two edges in the input data, and the + * GLU_TESS_COMBINE or GLU_TESS_COMBINE_DATA callback was not + * provided. No output is generated. GLU_OUT_OF_MEMORY indicates that + * there is not enough memory so no output is generated. + * + * @param errnum + * Specifics the error number code. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #errorData errorData + */ + public void error(int errnum); + + + /** + * The same as the {@link #error error} callback method except that + * it takes an additional reference argument. This reference is + * identical to the opaque reference provided when {@link + * GLU#gluTessBeginPolygon gluTessBeginPolygon} was called. + * + * @param errnum + * Specifics the error number code. + * @param polygonData + * Specifics a reference to user-defined data. + * + * @see GLU#gluTessCallback gluTessCallback + * @see #error error + */ + public void errorData(int errnum, Object polygonData); + + //void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh); +} diff --git a/src/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java new file mode 100755 index 000000000..eaccf0b15 --- /dev/null +++ b/src/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java @@ -0,0 +1,74 @@ +/* +* Portions Copyright (C) 2003 Sun Microsystems, Inc. +* All rights reserved. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +** Author: Eric Veach, July 1994 +** Java Port: Pepijn Van Eeckhoudt, July 2003 +** Java Port: Nathan Parker Burg, August 2003 +*/ +package javax.media.opengl.glu; + +/** + * The GLUtessellatorCallbackAdapter provides a default implementation of + * {@link GLUtessellatorCallback GLUtessellatorCallback} + * with empty callback methods. This class can be extended to provide user + * defined callback methods. + * + * @author Eric Veach, July 1994 + * @author Java Port: Pepijn Van Eechhoudt, July 2003 + * @author Java Port: Nathan Parker Burg, August 2003 + */ + +public class GLUtessellatorCallbackAdapter implements GLUtessellatorCallback { + public void begin(int type) {} + public void edgeFlag(boolean boundaryEdge) {} + public void vertex(Object vertexData) {} + public void end() {} +// public void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh) {} + public void error(int errnum) {} + public void combine(double[] coords, Object[] data, + float[] weight, Object[] outData) {} + public void beginData(int type, Object polygonData) {} + public void edgeFlagData(boolean boundaryEdge, + Object polygonData) {} + public void vertexData(Object vertexData, Object polygonData) {} + public void endData(Object polygonData) {} + public void errorData(int errnum, Object polygonData) {} + public void combineData(double[] coords, Object[] data, + float[] weight, Object[] outData, + Object polygonData) {} +} diff --git a/src/native/jogl/BufferUtils.c b/src/native/jogl/BufferUtils.c deleted file mode 100644 index 7698b00ba..000000000 --- a/src/native/jogl/BufferUtils.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -#include - -#ifdef _MSC_VER - /* This typedef seems to be needed at least for VC6 and Visual Studio 2003 */ - #if _MSC_VER <= 1400 - typedef int intptr_t; - #endif -#else - #include -#endif - -JNIEXPORT jobject JNICALL -Java_net_java_games_jogl_util_BufferUtils_bufferOffset0(JNIEnv* env, jclass unused, jint offset) { - return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) offset, 0); -} diff --git a/src/native/jogl/InternalBufferUtils.c b/src/native/jogl/InternalBufferUtils.c index 73c52011f..083f51b42 100644 --- a/src/native/jogl/InternalBufferUtils.c +++ b/src/native/jogl/InternalBufferUtils.c @@ -49,6 +49,6 @@ #endif JNIEXPORT jobject JNICALL -Java_net_java_games_jogl_impl_InternalBufferUtils_newDirectByteBuffer(JNIEnv* env, jclass unused, jlong address, jint capacity) { +Java_com_sun_opengl_impl_InternalBufferUtils_newDirectByteBuffer(JNIEnv* env, jclass unused, jlong address, jint capacity) { return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) address, capacity); } diff --git a/src/native/jogl/JAWT_DrawingSurfaceInfo.c b/src/native/jogl/JAWT_DrawingSurfaceInfo.c index 59c575f0c..2b64ec858 100644 --- a/src/native/jogl/JAWT_DrawingSurfaceInfo.c +++ b/src/native/jogl/JAWT_DrawingSurfaceInfo.c @@ -41,13 +41,13 @@ #ifdef WIN32 #define PLATFORM_DSI_SIZE sizeof(JAWT_Win32DrawingSurfaceInfo) - static const char* platformDSIClassName = "net/java/games/jogl/impl/windows/JAWT_Win32DrawingSurfaceInfo"; + static const char* platformDSIClassName = "com/sun/opengl/impl/windows/JAWT_Win32DrawingSurfaceInfo"; #elif defined(linux) || defined(__sun) || defined(__FreeBSD__) #define PLATFORM_DSI_SIZE sizeof(JAWT_X11DrawingSurfaceInfo) - static const char* platformDSIClassName = "net/java/games/jogl/impl/x11/JAWT_X11DrawingSurfaceInfo"; + static const char* platformDSIClassName = "com/sun/opengl/impl/x11/JAWT_X11DrawingSurfaceInfo"; #elif defined(macosx) #define PLATFORM_DSI_SIZE sizeof(JAWT_MacOSXDrawingSurfaceInfo) - static const char* platformDSIClassName = "net/java/games/jogl/impl/macosx/JAWT_MacOSXDrawingSurfaceInfo"; + static const char* platformDSIClassName = "com/sun/opengl/impl/macosx/JAWT_MacOSXDrawingSurfaceInfo"; #else ERROR: port JAWT_DrawingSurfaceInfo.c to your platform #endif @@ -56,7 +56,7 @@ static jclass platformDSIClass = NULL; static jmethodID constructor = NULL; JNIEXPORT jobject JNICALL -Java_net_java_games_jogl_impl_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) { +Java_com_sun_opengl_impl_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) { JAWT_DrawingSurfaceInfo* dsi; jobject dirbuf; jclass clazz; diff --git a/src/native/jogl/MacOSXWindowSystemInterface.m b/src/native/jogl/MacOSXWindowSystemInterface.m index 516bda0db..125f6abb4 100644 --- a/src/native/jogl/MacOSXWindowSystemInterface.m +++ b/src/native/jogl/MacOSXWindowSystemInterface.m @@ -43,7 +43,19 @@ void* createContext(void* shareContext, void* view, NSView *nsView = (NSView*)view; if (nsView != NULL) { + Bool viewReady = true; + if ([nsView lockFocusIfCanDraw] == NO) { + viewReady = false; + } else { + NSRect frame = [nsView frame]; + if ((frame.size.width == 0) || (frame.size.height == 0)) { + [nsView unlockFocus]; + viewReady = false; + } + } + + if (!viewReady) { if (viewNotReady != NULL) { *viewNotReady = 1; } @@ -163,13 +175,17 @@ void* createPBuffer(int renderTarget, int internalFormat, int width, int height) } Bool destroyPBuffer(void* context, void* buffer) { - NSOpenGLContext *nsContext = (NSOpenGLContext*)context; + /* FIXME: not clear whether we need to perform the clearDrawable below */ + /* FIXME: remove the context argument -- don't need it any more */ + /* NSOpenGLContext *nsContext = (NSOpenGLContext*)context; */ NSOpenGLPixelBuffer *pBuffer = (NSOpenGLPixelBuffer*)buffer; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + /* if (nsContext != NULL) { [nsContext clearDrawable]; } + */ [pBuffer release]; [pool release]; diff --git a/src/net/java/games/cg/CgException.java b/src/net/java/games/cg/CgException.java deleted file mode 100644 index 341ba3dbf..000000000 --- a/src/net/java/games/cg/CgException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.cg; - -/** - * A generic exception for errors that occur throughout the NVidia Cg - * binding, as a substitute for {@link RuntimeException}. - */ -public class CgException extends RuntimeException { - /** Constructs a CgException object. */ - public CgException() { - super(); - } - - /** Constructs a CgException object with the specified detail message. */ - public CgException(String message) { - super(message); - } - - /** Constructs a CgException object with the specified detail message and - root cause. */ - public CgException(String message, Throwable cause) { - super(message, cause); - } - - /** Constructs a CgException object with the specified root cause. */ - public CgException(Throwable cause) { - super(cause); - } -} diff --git a/src/net/java/games/gluegen/ArrayTypes.java b/src/net/java/games/gluegen/ArrayTypes.java deleted file mode 100644 index 1a75f7306..000000000 --- a/src/net/java/games/gluegen/ArrayTypes.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.nio.*; - -/** - * Convenience class containing the Class objects corresponding to arrays of - * various types (e.g., {@link #booleanArrayClass} is the Class of Java type - * "boolean[]"). - */ -public class ArrayTypes { - /** Class for Java type boolean[] */ - public static final Class booleanArrayClass; - /** Class for Java type byte[] */ - public static final Class byteArrayClass; - /** Class for Java type char[] */ - public static final Class charArrayClass; - /** Class for Java type short[] */ - public static final Class shortArrayClass; - /** Class for Java type int[] */ - public static final Class intArrayClass; - /** Class for Java type long[] */ - public static final Class longArrayClass; - /** Class for Java type float[] */ - public static final Class floatArrayClass; - /** Class for Java type double[] */ - public static final Class doubleArrayClass; - /** Class for Java type String[] */ - public static final Class stringArrayClass; - - // Classes for two-dimensional arrays. - // - // GlueGen converts C types like int** into Java arrays of direct - // buffers of the appropriate type (like IntBuffer[]). If the tool - // supported conversions like byte[][] -> char**, it would - // effectively be necessary to copy all of the data from the Java - // heap to the C heap during each call. The reason for this is that - // if we wanted to use GetPrimitiveArrayCritical to lock down the - // storage for each individual array element, we would need to fetch - // each element of the two-dimensional Java array into temporary - // storage before making the first GetPrimitiveArrayCritical call, - // since one can not call GetObjectArrayElement inside a Get / - // ReleasePrimitiveArrayCritical pair. This means that we would need - // two top-level pieces of temporary storage for the two-dimensional - // array as well as two loops to set up the contents, which would be - // too complicated. - // - // The one concession we make is converting String[] -> char**. The - // JVM takes care of the C heap allocation for GetStringUTFChars and - // ReleaseStringUTFChars, and this conversion is important for - // certain OpenGL operations. - - /** Class for Java type Buffer[] */ - public static final Class bufferArrayClass; - /** Class for Java type ByteBuffer[] */ - public static final Class byteBufferArrayClass; - /** Class for Java type ShortBuffer[] */ - public static final Class shortBufferArrayClass; - /** Class for Java type IntBuffer[] */ - public static final Class intBufferArrayClass; - /** Class for Java type LongBuffer[] */ - public static final Class longBufferArrayClass; - /** Class for Java type FloatBuffer[] */ - public static final Class floatBufferArrayClass; - /** Class for Java type DoubleBuffer[] */ - public static final Class doubleBufferArrayClass; - - static { - booleanArrayClass = new boolean[0].getClass(); - byteArrayClass = new byte [0].getClass(); - charArrayClass = new char [0].getClass(); - shortArrayClass = new short [0].getClass(); - intArrayClass = new int [0].getClass(); - longArrayClass = new long [0].getClass(); - floatArrayClass = new float [0].getClass(); - doubleArrayClass = new double [0].getClass(); - stringArrayClass = new String [0].getClass(); - - bufferArrayClass = new Buffer [0].getClass(); - byteBufferArrayClass = new ByteBuffer [0].getClass(); - shortBufferArrayClass = new ShortBuffer [0].getClass(); - intBufferArrayClass = new IntBuffer [0].getClass(); - longBufferArrayClass = new LongBuffer [0].getClass(); - floatBufferArrayClass = new FloatBuffer [0].getClass(); - doubleBufferArrayClass = new DoubleBuffer[0].getClass(); - } -} diff --git a/src/net/java/games/gluegen/CMethodBindingEmitter.java b/src/net/java/games/gluegen/CMethodBindingEmitter.java deleted file mode 100644 index f8afd06e4..000000000 --- a/src/net/java/games/gluegen/CMethodBindingEmitter.java +++ /dev/null @@ -1,1343 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; -import java.io.*; -import java.text.MessageFormat; - -import net.java.games.gluegen.cgram.types.*; - -/** Emits the C-side component of the Java<->C JNI binding. */ -public class CMethodBindingEmitter extends FunctionEmitter -{ - protected static final CommentEmitter defaultCommentEmitter = - new DefaultCommentEmitter(); - - protected static final String arrayResLength = "_array_res_length"; - protected static final String arrayRes = "_array_res"; - protected static final String arrayIdx = "_array_idx"; - - private MethodBinding binding; - - /** Name of the package in which the corresponding Java method resides.*/ - private String packageName; - - /** Name of the class in which the corresponding Java method resides.*/ - private String className; - - /** - * Whether or not the Java<->C JNI binding for this emitter's MethodBinding - * is overloaded. - */ - private boolean isOverloadedBinding; - - /** - * Whether or not the Java-side of the Java<->C JNI binding for this - * emitter's MethodBinding is static. - */ - private boolean isJavaMethodStatic; - - /** - * Optional List of Strings containing temporary C variables to declare. - */ - private List/**/ temporaryCVariableDeclarations; - - /** - * Optional List of Strings containing assignments to temporary C variables - * to make after the call is completed. - */ - private List/**/ temporaryCVariableAssignments; - - /** - * Capacity of the return value in the event that it is encapsulated in a - * java.nio.Buffer. Is ignored if binding.getJavaReturnType().isNIOBuffer() - * == false; - */ - private MessageFormat returnValueCapacityExpression = null; - - /** - * Length of the returned array. Is ignored if - * binding.getJavaReturnType().isArray() is false. - */ - private MessageFormat returnValueLengthExpression = null; - - // Note: the VC++ 6.0 compiler emits hundreds of warnings when the - // (necessary) null-checking code is enabled. This appears to just - // be a compiler bug, but would be good to track down exactly why it - // is happening. When the null checking is enabled for just the - // GetPrimitiveArrayCritical calls, there are five warnings - // generated for several thousand new if tests added to the code. - // Which ones are the ones at fault? The line numbers for the - // warnings are incorrect. - private static final boolean EMIT_NULL_CHECKS = true; - - /** - * Constructs an emitter for the specified binding, and sets a default - * comment emitter that will emit the signature of the C function that is - * being bound. - */ - public CMethodBindingEmitter(MethodBinding binding, - boolean isOverloadedBinding, - String javaPackageName, - String javaClassName, - boolean isJavaMethodStatic, - PrintWriter output) - { - super(output); - - assert(binding != null); - assert(javaClassName != null); - assert(javaPackageName != null); - - this.binding = binding; - this.packageName = javaPackageName; - this.className = javaClassName; - this.isOverloadedBinding = isOverloadedBinding; - this.isJavaMethodStatic = isJavaMethodStatic; - setCommentEmitter(defaultCommentEmitter); - } - - public final MethodBinding getBinding() { return binding; } - - public String getName() { - return binding.getName(); - } - - /** - * Get the expression for the capacity of the returned java.nio.Buffer. - */ - public final MessageFormat getReturnValueCapacityExpression() - { - return returnValueCapacityExpression; - } - - /** - * If this function returns a void* encapsulated in a - * java.nio.Buffer, sets the expression for the capacity of the - * returned Buffer. - * - * @param expression a MessageFormat which, when applied to an array - * of type String[] that contains each of the arguments names of the - * Java-side binding, returns an expression that will (when compiled - * by a C compiler) evaluate to an integer-valued expression. The - * value of this expression is the capacity of the java.nio.Buffer - * returned from this method. - * - * @throws IllegalArgumentException if the - * binding.getJavaReturnType().isNIOBuffer() == false - * - */ - public final void setReturnValueCapacityExpression(MessageFormat expression) - { - returnValueCapacityExpression = expression; - - if (!binding.getJavaReturnType().isNIOBuffer()) - { - throw new IllegalArgumentException( - "Cannot specify return value capacity for a method that does not " + - "return java.nio.Buffer: \"" + binding + "\""); - } - } - - /** - * Get the expression for the length of the returned array - */ - public final MessageFormat getReturnValueLengthExpression() - { - return returnValueLengthExpression; - } - - /** - * If this function returns an array, sets the expression for the - * length of the returned array. - * - * @param expression a MessageFormat which, when applied to an array - * of type String[] that contains each of the arguments names of the - * Java-side binding, returns an expression that will (when compiled - * by a C compiler) evaluate to an integer-valued expression. The - * value of this expression is the length of the array returned from - * this method. - * - * @throws IllegalArgumentException if the - * binding.getJavaReturnType().isNIOBuffer() == false - * - */ - public final void setReturnValueLengthExpression(MessageFormat expression) - { - returnValueLengthExpression = expression; - - if (!binding.getJavaReturnType().isArray()) - { - throw new IllegalArgumentException( - "Cannot specify return value length for a method that does not " + - "return an array: \"" + binding + "\""); - } - } - - /** - * Returns the List of Strings containing declarations for temporary - * C variables to be assigned to after the underlying function call. - */ - public final List/**/ getTemporaryCVariableDeclarations() { - return temporaryCVariableDeclarations; - } - - /** - * Sets up a List of Strings containing declarations for temporary C - * variables to be assigned to after the underlying function call. A - * null argument indicates that no manual declarations are to be made. - */ - public final void setTemporaryCVariableDeclarations(List/**/ arg) { - temporaryCVariableDeclarations = arg; - } - - /** - * Returns the List of Strings containing assignments for temporary - * C variables which are made after the underlying function call. A - * null argument indicates that no manual assignments are to be - * made. - */ - public final List/**/ getTemporaryCVariableAssignments() { - return temporaryCVariableAssignments; - } - - /** - * Sets up a List of Strings containing assignments for temporary C - * variables which are made after the underlying function call. A - * null argument indicates that no manual assignments are to be made. - */ - public final void setTemporaryCVariableAssignments(List/**/ arg) { - temporaryCVariableAssignments = arg; - } - - /** - * Get the name of the class in which the corresponding Java method - * resides. - */ - public String getJavaPackageName() { return packageName; } - - /** - * Get the name of the package in which the corresponding Java method - * resides. - */ - public String getJavaClassName() { return className; } - - /** - * Is the Java<->C JNI binding for this emitter's MethodBinding one of - * several overloaded methods with the same name? - */ - public final boolean getIsOverloadedBinding() { return isOverloadedBinding; } - - /** - * Is the Java side of the Java<->C JNI binding for this emitter's - * MethodBinding a static method?. - */ - public final boolean getIsJavaMethodStatic() { return isJavaMethodStatic; } - - protected void emitReturnType(PrintWriter writer) - { - writer.print("JNIEXPORT "); - writer.print(binding.getJavaReturnType().jniTypeName()); - writer.print(" JNICALL"); - } - - protected void emitName(PrintWriter writer) - { - writer.println(); // start name on new line - writer.print("Java_"); - writer.print(jniMangle(getJavaPackageName())); - writer.print("_"); - writer.print(jniMangle(getJavaClassName())); - writer.print("_"); - if (isOverloadedBinding) - { - writer.print(jniMangle(binding)); - //System.err.println("OVERLOADED MANGLING FOR " + binding.getName() + - // " = " + jniMangle(binding)); - } - else - { - writer.print(jniMangle(binding.getName())); - //System.err.println(" NORMAL MANGLING FOR " + binding.getName() + - // " = " + jniMangle(binding.getName())); - } - } - - protected int emitArguments(PrintWriter writer) - { - writer.print("JNIEnv *env, "); - int numEmitted = 1; // initially just the JNIEnv - if (isJavaMethodStatic && !binding.hasContainingType()) - { - writer.print("jclass"); - } - else - { - writer.print("jobject"); - } - writer.print(" _unused"); - ++numEmitted; - - if (binding.hasContainingType()) - { - // "this" argument always comes down in argument 0 as direct buffer - writer.print(", jobject " + JavaMethodBindingEmitter.javaThisArgumentName()); - } - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType javaArgType = binding.getJavaArgumentType(i); - // Handle case where only param is void - if (javaArgType.isVoid()) { - // Make sure this is the only param to the method; if it isn't, - // there's something wrong with our parsing of the headers. - assert(binding.getNumArguments() == 1); - continue; - } - if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) { - continue; - } - writer.print(", "); - writer.print(javaArgType.jniTypeName()); - writer.print(" "); - writer.print(binding.getArgumentName(i)); - ++numEmitted; - } - - return numEmitted; - } - - - protected void emitBody(PrintWriter writer) - { - writer.println(" {"); - emitBodyVariableDeclarations(writer); - emitBodyUserVariableDeclarations(writer); - emitBodyVariablePreCallSetup(writer, false); - emitBodyVariablePreCallSetup(writer, true); - emitBodyCallCFunction(writer); - emitBodyUserVariableAssignments(writer); - emitBodyVariablePostCallCleanup(writer, true); - emitBodyVariablePostCallCleanup(writer, false); - emitBodyReturnResult(writer); - writer.println("}"); - writer.println(); - } - - protected void emitBodyVariableDeclarations(PrintWriter writer) - { - // Emit declarations for all pointer and String conversion variables - if (binding.hasContainingType()) { - emitPointerDeclaration(writer, - binding.getContainingType(), - binding.getContainingCType(), - CMethodBindingEmitter.cThisArgumentName(), - null); - } - - boolean emittedDataCopyTemps = false; - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); - if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { - continue; - } - - if (type.isArray() || type.isNIOBuffer()) { - String convName = pointerConversionArgumentName(i); - // handle array/buffer argument types - boolean needsDataCopy = - emitPointerDeclaration(writer, - binding.getJavaArgumentType(i), - binding.getCArgumentType(i), - convName, - binding.getArgumentName(i)); - if (needsDataCopy && !emittedDataCopyTemps) { - // emit loop counter and array length variables used during data - // copy - writer.println(" jobject _tmpObj;"); - writer.println(" int _copyIndex;"); - writer.println(" jsize _tmpArrayLen;"); - emittedDataCopyTemps = true; - } - } else if (type.isString()) { - writer.print(" const char* _UTF8"); - writer.print(binding.getArgumentName(i)); - writer.println(" = NULL;"); - } - - } - - // Emit declaration for return value if necessary - Type cReturnType = binding.getCReturnType(); - - JavaType javaReturnType = binding.getJavaReturnType(); - String capitalizedComponentType = null; - if (!cReturnType.isVoid()) { - writer.print(" "); - // Note we must respect const/volatile for return argument - writer.print(binding.getCSymbol().getReturnType().getName(true)); - writer.println(" _res;"); - if (javaReturnType.isArray()) { - if (javaReturnType.isNIOByteBufferArray()) { - writer.print(" int "); - writer.print(arrayResLength); - writer.println(";"); - writer.print(" int "); - writer.print(arrayIdx); - writer.println(";"); - writer.print(" jobjectArray "); - writer.print(arrayRes); - writer.println(";"); - } else { - writer.print(" int "); - writer.print(arrayResLength); - writer.println(";"); - - Class componentType = javaReturnType.getJavaClass().getComponentType(); - if (componentType.isArray()) { - throw new RuntimeException("Multi-dimensional arrays not supported yet"); - } - - String javaTypeName = componentType.getName(); - capitalizedComponentType = - "" + Character.toUpperCase(javaTypeName.charAt(0)) + javaTypeName.substring(1); - String javaArrayTypeName = "j" + javaTypeName + "Array"; - writer.print(" "); - writer.print(javaArrayTypeName); - writer.print(" "); - writer.print(arrayRes); - writer.println(";"); - } - } - } - } - - /** Emits the user-defined C variable declarations from the - TemporaryCVariableDeclarations directive in the .cfg file. */ - protected void emitBodyUserVariableDeclarations(PrintWriter writer) { - if (temporaryCVariableDeclarations != null) { - for (Iterator iter = temporaryCVariableDeclarations.iterator(); iter.hasNext(); ) { - String val = (String) iter.next(); - writer.print(" "); - writer.println(val); - } - } - } - - /** - * Code to init the variables that were declared in - * emitBodyVariableDeclarations(), PRIOR TO calling the actual C - * function. - */ - protected void emitBodyVariablePreCallSetup(PrintWriter writer, - boolean emittingPrimitiveArrayCritical) - { - if (!emittingPrimitiveArrayCritical) { - // Convert all Buffers to pointers first so we don't have to - // call ReleasePrimitiveArrayCritical for any arrays if any - // incoming buffers aren't direct - if (binding.hasContainingType()) { - emitPointerConversion(writer, binding, - binding.getContainingType(), - binding.getContainingCType(), - JavaMethodBindingEmitter.javaThisArgumentName(), - CMethodBindingEmitter.cThisArgumentName()); - } - - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); - if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { - continue; - } - if (type.isNIOBuffer()) { - emitPointerConversion(writer, binding, type, - binding.getCArgumentType(i), - binding.getArgumentName(i), - pointerConversionArgumentName(i)); - } - } - } - - // Convert all arrays to pointers, and get UTF-8 versions of jstring args - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType javaArgType = binding.getJavaArgumentType(i); - - if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) { - continue; - } - - if (javaArgType.isArray()) { - boolean needsDataCopy = javaArgTypeNeedsDataCopy(javaArgType); - Class subArrayElementJavaType = javaArgType.getJavaClass().getComponentType(); - - // We only defer the emission of GetPrimitiveArrayCritical - // calls that won't be matched up until after the function - // we're calling - if ((!needsDataCopy && !emittingPrimitiveArrayCritical) || - (needsDataCopy && emittingPrimitiveArrayCritical)) { - continue; - } - - if (EMIT_NULL_CHECKS) { - writer.print(" if ("); - writer.print(binding.getArgumentName(i)); - writer.println(" != NULL) {"); - } - - Type cArgType = binding.getCArgumentType(i); - String cArgTypeName = cArgType.getName(); - - String convName = pointerConversionArgumentName(i); - - if (!needsDataCopy) { - writer.print(" "); - writer.print(convName); - writer.print(" = ("); - if (javaArgType.isArray() && - javaArgType.getJavaClass().getComponentType() == java.lang.String.class) { - // java-side type is String[] - cArgTypeName = "jstring *"; - } - writer.print(cArgTypeName); - writer.print(") (*env)->GetPrimitiveArrayCritical(env, "); - writer.print(binding.getArgumentName(i)); - writer.println(", NULL);"); - } else { - // Handle the case where the array elements are of a type that needs a - // data copy operation to convert from the java memory model to the C - // memory model (e.g., int[][], String[], etc) - // - // FIXME: should factor out this whole block of code into a separate - // method for clarity and maintenance purposes - if (cArgType.toString().indexOf("const") == -1) { - // FIXME: if the arg type is non-const, the sematics might be that - // the function modifies the argument -- we don't yet support - // this. - // - // Note: the check for "const" in the CVAttributes string isn't - // truly checking the constness of the target types at both - // pointer depths. However, it's a quick approximation, and quite - // often C code doesn't get the constness right anyhow. - throw new RuntimeException( - "Cannot copy data for ptr-to-ptr arg type \"" + cArgType + - "\": support for non-const ptr-to-ptr types not implemented."); - } - - writer.println(); - writer.println(" /* Copy contents of " + binding.getArgumentName(i) + - " into " + convName + "_copy */"); - - // get length of array being copied - String arrayLenName = "_tmpArrayLen"; - writer.print(" "); - writer.print(arrayLenName); - writer.print(" = (*env)->GetArrayLength(env, "); - writer.print(binding.getArgumentName(i)); - writer.println(");"); - - // allocate an array to hold each element - if (cArgType.pointerDepth() != 2) { - throw new RuntimeException( - "Could not copy data for type \"" + cArgType + - "\"; copying only supported for types of the form " + - "ptr-to-ptr-to-type."); - } - PointerType cArgPtrType = cArgType.asPointer(); - if (cArgPtrType == null) { - throw new RuntimeException( - "Could not copy data for type \"" + cArgType + - "\"; currently only pointer types supported."); - } - PointerType cArgElementType = cArgPtrType.getTargetType().asPointer(); - emitMalloc( - writer, - convName+"_copy", - cArgElementType.getName(), - arrayLenName, - "Could not allocate buffer for copying data in argument \\\""+binding.getArgumentName(i)+"\\\""); - - // process each element in the array - writer.println(" for (_copyIndex = 0; _copyIndex < "+arrayLenName+"; ++_copyIndex) {"); - - // get each array element - writer.println(" /* get each element of the array argument \"" + binding.getArgumentName(i) + "\" */"); - String subArrayElementJNITypeString = jniType(subArrayElementJavaType); - writer.print(" _tmpObj = ("); - writer.print(subArrayElementJNITypeString); - writer.print(") (*env)->GetObjectArrayElement(env, "); - writer.print(binding.getArgumentName(i)); - writer.println(", _copyIndex);"); - - if (subArrayElementJNITypeString == "jstring") - { - writer.print(" "); - emitGetStringUTFChars(writer, - "(jstring) _tmpObj", - convName+"_copy[_copyIndex]"); - } - else if (isNIOBufferClass(subArrayElementJavaType)) - { - emitGetDirectBufferAddress(writer, - "_tmpObj", - cArgElementType.getName(), - convName + "_copy[_copyIndex]"); - } - else - { - // Question: do we always need to copy the sub-arrays, or just - // GetPrimitiveArrayCritical on each jobjectarray element and - // assign it to the appropriate elements at pointer depth 1? - // Probably depends on const-ness of the argument. - // Malloc enough space to hold a copy of each sub-array - writer.print(" "); - emitMalloc( - writer, - convName+"_copy[_copyIndex]", - cArgElementType.getTargetType().getName(), // assumes cArgPtrType is ptr-to-ptr-to-primitive !! - "(*env)->GetArrayLength(env, _tmpObj)", - "Could not allocate buffer during copying of data in argument \\\""+binding.getArgumentName(i)+"\\\""); - // FIXME: copy the data (use matched Get/ReleasePrimitiveArrayCritical() calls) - if (true) throw new RuntimeException( - "Cannot yet handle type \"" + cArgType.getName() + - "\"; need to add support for copying ptr-to-ptr-to-primitiveType subarrays"); - - - } - writer.println(" }"); - - writer.println(); - } // end of data copy - - if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } - - } else if (javaArgType.isString()) { - if (emittingPrimitiveArrayCritical) { - continue; - } - - if (EMIT_NULL_CHECKS) { - writer.print(" if ("); - writer.print(binding.getArgumentName(i)); - writer.println(" != NULL) {"); - } - - emitGetStringUTFChars(writer, - binding.getArgumentName(i), - "_UTF8" + binding.getArgumentName(i)); - - if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } - } else if (javaArgType.isArrayOfCompoundTypeWrappers()) { - - // FIXME - throw new RuntimeException("Outgoing arrays of StructAccessors not yet implemented"); - } - } - } - - - /** - * Code to clean up any variables that were declared in - * emitBodyVariableDeclarations(), AFTER calling the actual C function. - */ - protected void emitBodyVariablePostCallCleanup(PrintWriter writer, - boolean emittingPrimitiveArrayCritical) - { - // Release primitive arrays and temporary UTF8 strings if necessary - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType javaArgType = binding.getJavaArgumentType(i); - if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) { - continue; - } - if (javaArgType.isArray()) { - boolean needsDataCopy = javaArgTypeNeedsDataCopy(javaArgType); - Class subArrayElementJavaType = javaArgType.getJavaClass().getComponentType(); - - if ((!needsDataCopy && !emittingPrimitiveArrayCritical) || - (needsDataCopy && emittingPrimitiveArrayCritical)) { - continue; - } - - if (EMIT_NULL_CHECKS) { - writer.print(" if ("); - writer.print(binding.getArgumentName(i)); - writer.println(" != NULL) {"); - } - - String convName = pointerConversionArgumentName(i); - - if (!needsDataCopy) { - // Release array - writer.print(" (*env)->ReleasePrimitiveArrayCritical(env, "); - writer.print(binding.getArgumentName(i)); - writer.print(", "); - writer.print(convName); - writer.println(", JNI_ABORT);"); - } else { - // clean up the case where the array elements are of a type that needed - // a data copy operation to convert from the java memory model to the - // C memory model (e.g., int[][], String[], etc) - // - // FIXME: should factor out this whole block of code into a separate - // method for clarity and maintenance purposes - Type cArgType = binding.getCArgumentType(i); - String cArgTypeName = cArgType.getName(); - - if (cArgType.toString().indexOf("const") == -1) { - // FIXME: handle any cleanup from treatment of non-const args, - // assuming they were treated differently in - // emitBodyVariablePreCallSetup() (see the similar section in that - // method for details). - throw new RuntimeException( - "Cannot clean up copied data for ptr-to-ptr arg type \"" + cArgType + - "\": support for cleaning up non-const ptr-to-ptr types not implemented."); - } - - writer.println(" /* Clean up " + convName + "_copy */"); - - // Only need to perform cleanup for individual array - // elements if they are not direct buffers - if (!isNIOBufferClass(subArrayElementJavaType)) { - // Re-fetch length of array that was copied - String arrayLenName = "_tmpArrayLen"; - writer.print(" "); - writer.print(arrayLenName); - writer.print(" = (*env)->GetArrayLength(env, "); - writer.print(binding.getArgumentName(i)); - writer.println(");"); - - // free each element - PointerType cArgPtrType = cArgType.asPointer(); - if (cArgPtrType == null) { - throw new RuntimeException( - "Could not copy data for type \"" + cArgType + - "\"; currently only pointer types supported."); - } - PointerType cArgElementType = cArgPtrType.getTargetType().asPointer(); - - // process each element in the array - writer.println(" for (_copyIndex = 0; _copyIndex < " + arrayLenName +"; ++_copyIndex) {"); - - // get each array element - writer.println(" /* free each element of " +convName +"_copy */"); - String subArrayElementJNITypeString = jniType(subArrayElementJavaType); - writer.print(" _tmpObj = ("); - writer.print(subArrayElementJNITypeString); - writer.print(") (*env)->GetObjectArrayElement(env, "); - writer.print(binding.getArgumentName(i)); - writer.println(", _copyIndex);"); - - if (subArrayElementJNITypeString == "jstring") { - writer.print(" (*env)->ReleaseStringUTFChars(env, "); - writer.print("(jstring) _tmpObj"); - writer.print(", "); - writer.print(convName+"_copy[_copyIndex]"); - writer.println(");"); - } else { - if (true) throw new RuntimeException( - "Cannot yet handle type \"" + cArgType.getName() + - "\"; need to add support for cleaning up copied ptr-to-ptr-to-primitiveType subarrays"); - } - writer.println(" }"); - } - - // free the main array - writer.print(" free((void*) "); - writer.print(convName+"_copy"); - writer.println(");"); - } // end of cleaning up copied data - - if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } - } else if (javaArgType.isString()) { - if (emittingPrimitiveArrayCritical) { - continue; - } - - if (EMIT_NULL_CHECKS) { - writer.print(" if ("); - writer.print(binding.getArgumentName(i)); - writer.println(" != NULL) {"); - } - - writer.print(" (*env)->ReleaseStringUTFChars(env, "); - writer.print(binding.getArgumentName(i)); - writer.print(", _UTF8"); - writer.print(binding.getArgumentName(i)); - writer.println(");"); - - if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } - } else if (javaArgType.isArrayOfCompoundTypeWrappers()) { - - // FIXME - throw new RuntimeException("Outgoing arrays of StructAccessors not yet implemented"); - - } - } - } - - protected void emitBodyCallCFunction(PrintWriter writer) - { - // Make the call to the actual C function - writer.print(" "); - - // WARNING: this code assumes that the return type has already been - // typedef-resolved. - Type cReturnType = binding.getCReturnType(); - - if (!cReturnType.isVoid()) { - writer.print("_res = "); - } - if (binding.hasContainingType()) { - // Call through function pointer - writer.print(CMethodBindingEmitter.cThisArgumentName() + "->"); - } - writer.print(binding.getCSymbol().getName()); - writer.print("("); - for (int i = 0; i < binding.getNumArguments(); i++) { - if (i != 0) { - writer.print(", "); - } - JavaType javaArgType = binding.getJavaArgumentType(i); - // Handle case where only param is void. - if (javaArgType.isVoid()) { - // Make sure this is the only param to the method; if it isn't, - // there's something wrong with our parsing of the headers. - assert(binding.getNumArguments() == 1); - continue; - } - - if (javaArgType.isJNIEnv()) { - writer.print("env"); - } else if (binding.isArgumentThisPointer(i)) { - writer.print(CMethodBindingEmitter.cThisArgumentName()); - } else { - writer.print("("); - Type cArgType = binding.getCSymbol().getArgumentType(i); - writer.print(cArgType.getName()); - writer.print(") "); - if (binding.getCArgumentType(i).isPointer() && binding.getJavaArgumentType(i).isPrimitive()) { - writer.print("(intptr_t) "); - } - if (javaArgType.isArray() || javaArgType.isNIOBuffer()) { - writer.print(pointerConversionArgumentName(i)); - if (javaArgTypeNeedsDataCopy(javaArgType)) { - writer.print("_copy"); - } - } else { - if (javaArgType.isString()) { writer.print("_UTF8"); } - writer.print(binding.getArgumentName(i)); - } - } - } - writer.println(");"); - } - - /** Emits the user-defined C variable assignments from the - TemporaryCVariableAssignments directive in the .cfg file. */ - protected void emitBodyUserVariableAssignments(PrintWriter writer) { - if (temporaryCVariableAssignments != null) { - for (Iterator iter = temporaryCVariableAssignments.iterator(); iter.hasNext(); ) { - String val = (String) iter.next(); - writer.print(" "); - writer.println(val); - } - } - } - - // FIXME: refactor this so that subclasses (in particular, - // net.java.games.gluegen.opengl.CGLPAWrapperEmitter) don't have to copy the whole - // method - protected void emitBodyReturnResult(PrintWriter writer) - { - // WARNING: this code assumes that the return type has already been - // typedef-resolved. - Type cReturnType = binding.getCReturnType(); - - // Return result if necessary - if (!cReturnType.isVoid()) { - JavaType javaReturnType = binding.getJavaReturnType(); - if (javaReturnType.isPrimitive()) { - writer.print(" return "); - if (cReturnType.isPointer()) { - // Pointer being converted to int or long: cast this result - // (through intptr_t to avoid compiler warnings with gcc) - writer.print("(" + javaReturnType.jniTypeName() + ") (intptr_t) "); - } - writer.println("_res;"); - } else if (javaReturnType.isNIOBuffer()) { - writer.println(" if (_res == NULL) return NULL;"); - writer.print(" return (*env)->NewDirectByteBuffer(env, _res, "); - // See whether capacity has been specified - if (returnValueCapacityExpression != null) { - String[] argumentNames = new String[binding.getNumArguments()]; - for (int i = 0; i < binding.getNumArguments(); i++) - { - argumentNames[i] = binding.getArgumentName(i); - } - writer.print( - returnValueCapacityExpression.format(argumentNames)); - } else { - int sz = 0; - if (cReturnType.isPointer() && - cReturnType.asPointer().getTargetType().isCompound()) { - sz = cReturnType.asPointer().getTargetType().getSize(); - if (sz == -1) { - throw new InternalError( - "Error emitting code for compound return type "+ - "for function \"" + binding + "\": " + - "Structs to be emitted should have been laid out by this point " + - "(type " + cReturnType.asPointer().getTargetType().getName() + " / " + - cReturnType.asPointer().getTargetType() + " was not)" - ); - } - } else { - sz = cReturnType.getSize(); - } - writer.print(sz); - System.err.println( - "WARNING: No capacity specified for java.nio.Buffer return " + - "value for function \"" + binding + "\";" + - " assuming size of equivalent C return type (" + sz + " bytes): " + binding); - } - writer.println(");"); - } else if (javaReturnType.isString()) { - writer.print(" if (_res == NULL) return NULL;"); - writer.println(" return (*env)->NewStringUTF(env, _res);"); - } else if (javaReturnType.isArray()) { - if (javaReturnType.isNIOByteBufferArray()) { - writer.println(" if (_res == NULL) return NULL;"); - if (returnValueLengthExpression == null) { - throw new RuntimeException("Error while generating C code: no length specified for array returned from function " + - binding); - } - String[] argumentNames = new String[binding.getNumArguments()]; - for (int i = 0; i < binding.getNumArguments(); i++) { - argumentNames[i] = binding.getArgumentName(i); - } - writer.println(" " + arrayResLength + " = " + returnValueLengthExpression.format(argumentNames) + ";"); - writer.println(" " + arrayRes + " = (*env)->NewObjectArray(env, " + arrayResLength + ", (*env)->FindClass(env, \"java/nio/ByteBuffer\"), NULL);"); - writer.println(" for (" + arrayIdx + " = 0; " + arrayIdx + " < " + arrayResLength + "; " + arrayIdx + "++) {"); - Type retType = binding.getCSymbol().getReturnType(); - Type baseType; - if (retType.isPointer()) { - baseType = retType.asPointer().getTargetType().asPointer().getTargetType(); - } else { - baseType = retType.asArray().getElementType().asPointer().getTargetType(); - } - int sz = baseType.getSize(); - if (sz < 0) - sz = 0; - writer.println(" (*env)->SetObjectArrayElement(env, " + arrayRes + ", " + arrayIdx + - ", (*env)->NewDirectByteBuffer(env, _res[" + arrayIdx + "], " + sz + "));"); - writer.println(" }"); - writer.println(" return " + arrayRes + ";"); - } else { - // FIXME: must have user provide length of array in .cfg file - // by providing a constant value, input parameter, or - // expression which computes the array size (already present - // as ReturnValueCapacity, not yet implemented / tested here) - - throw new RuntimeException( - "Could not emit native code for function \"" + binding + - "\": array return values for non-char types not implemented yet"); - - // FIXME: This is approximately what will be required here - // - //writer.print(" "); - //writer.print(arrayRes); - //writer.print(" = (*env)->New"); - //writer.print(capitalizedComponentType); - //writer.print("Array(env, "); - //writer.print(arrayResLength); - //writer.println(");"); - //writer.print(" (*env)->Set"); - //writer.print(capitalizedComponentType); - //writer.print("ArrayRegion(env, "); - //writer.print(arrayRes); - //writer.print(", 0, "); - //writer.print(arrayResLength); - //writer.println(", _res);"); - //writer.print(" return "); - //writer.print(arrayRes); - //writer.println(";"); - } - } - } - } - - protected static String cThisArgumentName() { - return "this0"; - } - - // Mangle a class, package or function name - protected String jniMangle(String name) { - return name.replaceAll("_", "_1").replace('.', '_'); - } - - protected String jniMangle(MethodBinding binding) { - StringBuffer buf = new StringBuffer(); - buf.append(jniMangle(binding.getName())); - buf.append("__"); - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); - Class c = type.getJavaClass(); - if (c != null) { - jniMangle(c, buf); - } else { - // FIXME: add support for char* -> String conversion - throw new RuntimeException("Unknown kind of JavaType: name="+type.getName()); - } - } - return buf.toString(); - } - - protected void jniMangle(Class c, StringBuffer res) { - if (c.isArray()) { - res.append("_3"); - jniMangle(c.getComponentType(), res); - } else if (c.isPrimitive()) { - if (c == Boolean.TYPE) res.append("Z"); - else if (c == Byte.TYPE) res.append("B"); - else if (c == Character.TYPE) res.append("C"); - else if (c == Short.TYPE) res.append("S"); - else if (c == Integer.TYPE) res.append("I"); - else if (c == Long.TYPE) res.append("J"); - else if (c == Float.TYPE) res.append("F"); - else if (c == Double.TYPE) res.append("D"); - else throw new InternalError("Illegal primitive type"); - } else { - res.append("L"); - res.append(c.getName().replace('.', '_')); - res.append("_2"); - } - } - - private String jniType(Class javaType) - { - if (javaType.isPrimitive()) { - return "j" + javaType.getName(); - } else if (javaType == java.lang.String.class) { - return "jstring"; - } else if (isNIOBufferClass(javaType)) { - return "jobject"; - } else { - throw new RuntimeException( - "Could not determine JNI type for Java class \"" + - javaType.getName() + "\"; was not String, primitive or direct buffer"); - } - } - - private void emitOutOfMemoryCheck(PrintWriter writer, String varName, - String errorMessage) - { - writer.print(" if ("); - writer.print(varName); - writer.println(" == NULL) {"); - writer.println(" (*env)->ThrowNew(env, (*env)->FindClass(env, \"java/lang/OutOfMemoryError\"),"); - writer.print(" \"" + errorMessage); - writer.print(" in native dispatcher for \\\""); - writer.print(binding.getName()); - writer.println("\\\"\");"); - writer.print(" return"); - if (!binding.getJavaReturnType().isVoid()) { - writer.print(" 0"); - } - writer.println(";"); - writer.println(" }"); - } - - private void emitMalloc(PrintWriter writer, - String targetVarName, - String elementTypeString, - String numElementsExpression, - String mallocFailureErrorString) - { - writer.print(" "); - writer.print(targetVarName); - writer.print(" = ("); - writer.print(elementTypeString); - writer.print(" *) malloc("); - writer.print(numElementsExpression); - writer.print(" * sizeof("); - writer.print(elementTypeString); - writer.println("));"); - // Catch memory allocation failure - if (EMIT_NULL_CHECKS) { - emitOutOfMemoryCheck( - writer, targetVarName, - mallocFailureErrorString); - } - } - - private void emitGetStringUTFChars(PrintWriter writer, - String sourceVarName, - String receivingVarName) - { - writer.print(" if ("); - writer.print(sourceVarName); - writer.println(" != NULL) {"); - writer.print(" "); - writer.print(receivingVarName); - writer.print(" = (*env)->GetStringUTFChars(env, "); - writer.print(sourceVarName); - writer.println(", (jboolean*)NULL);"); - // Catch memory allocation failure in the event that the VM didn't pin - // the String and failed to allocate a copy - if (EMIT_NULL_CHECKS) { - emitOutOfMemoryCheck( - writer, receivingVarName, - "Failed to get UTF-8 chars for argument \\\""+sourceVarName+"\\\""); - } - writer.println(" } else {"); - writer.print(" "); - writer.print(receivingVarName); - writer.println(" = NULL;"); - writer.println(" }"); - } - - private void emitGetDirectBufferAddress(PrintWriter writer, - String sourceVarName, - String receivingVarTypeString, - String receivingVarName) { - if (EMIT_NULL_CHECKS) { - writer.print(" if ("); - writer.print(sourceVarName); - writer.println(" != NULL) {"); - } - writer.print(" "); - writer.print(receivingVarName); - writer.print(" = ("); - writer.print(receivingVarTypeString); - writer.print(") (*env)->GetDirectBufferAddress(env, "); - writer.print(sourceVarName); - writer.println(");"); - if (EMIT_NULL_CHECKS) { - writer.println(" } else {"); - writer.print(" "); - writer.print(receivingVarName); - writer.println(" = NULL;"); - writer.println(" }"); - } - } - - - // Note: if the data in the Type needs to be converted from the Java memory - // model to the C memory model prior to calling any C-side functions, then - // an extra variable named XXX_copy (where XXX is the value of the - // cVariableName argument) will be emitted and TRUE will be returned. - private boolean emitPointerDeclaration(PrintWriter writer, - JavaType javaType, - Type cType, - String cVariableName, - String javaArgumentName) { - String ptrTypeString = null; - boolean needsDataCopy = false; - - // Emit declaration for the pointer variable. - // - // Note that we don't need to obey const/volatile for outgoing arguments - // - if (javaType.isNIOBuffer()) - { - ptrTypeString = cType.getName(); - } - else if (javaType.isArray()) { - needsDataCopy = javaArgTypeNeedsDataCopy(javaType); - // It's an array; get the type of the elements in the array - Class elementType = javaType.getJavaClass().getComponentType(); - if (elementType.isPrimitive()) - { - ptrTypeString = cType.getName(); - } - else if (elementType == java.lang.String.class) - { - ptrTypeString = "jstring"; - } - else if (elementType.isArray()) - { - Class subElementType = elementType.getComponentType(); - if (subElementType.isPrimitive()) - { - // type is pointer to pointer to primitive - ptrTypeString = cType.getName(); - } - else - { - // type is pointer to pointer of some type we don't support (maybe - // it's an array of pointers to structs?) - throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\""); - } - - } - else if (isNIOBufferClass(elementType)) - { - // type is an array of direct buffers of some sort - ptrTypeString = cType.getName(); - } - else - { - // Type is pointer to something we can't/don't handle - throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\""); - } - } - else if (javaType.isArrayOfCompoundTypeWrappers()) - { - // FIXME - throw new RuntimeException("Outgoing arrays of StructAccessors not yet implemented"); - } - else - { - ptrTypeString = cType.getName(); - } - - if (!needsDataCopy) - { - // declare the pointer variable - writer.print(" "); - writer.print(ptrTypeString); - writer.print(" "); - writer.print(cVariableName); - writer.println(" = NULL;"); - } - else - { - // Declare a variable to hold a copy of the argument data in which the - // incoming data has been properly laid out in memory to match the C - // memory model - //writer.print(" const "); - Class elementType = javaType.getJavaClass().getComponentType(); - if (javaType.isArray() && - javaType.getJavaClass().getComponentType() == java.lang.String.class) { - writer.print(" const char **"); - } else { - writer.print(ptrTypeString); - } - writer.print(" "); - writer.print(cVariableName); - writer.print("_copy = NULL; /* copy of data in "); - writer.print(javaArgumentName); - writer.println(", laid out according to C memory model */"); - } - - return needsDataCopy; - } - - private void emitPointerConversion(PrintWriter writer, - MethodBinding binding, - JavaType type, - Type cType, - String incomingArgumentName, - String cVariableName) { - emitGetDirectBufferAddress(writer, - incomingArgumentName, - cType.getName(), - cVariableName); - - /* - if (EMIT_NULL_CHECKS) { - writer.print(" if ("); - writer.print(incomingArgumentName); - writer.println(" != NULL) {"); - } - - writer.print(" "); - writer.print(cVariableName); - writer.print(" = ("); - writer.print(cType.getName()); - writer.print(") (*env)->GetDirectBufferAddress(env, "); - writer.print(incomingArgumentName); - writer.println(");"); - - if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } - */ - } - - protected String pointerConversionArgumentName(int i) { - return "_ptr" + i; - } - - /** - * Class that emits a generic comment for CMethodBindingEmitters; the comment - * includes the C signature of the native method that is being bound by the - * emitter java method. - */ - protected static class DefaultCommentEmitter implements CommentEmitter { - public void emit(FunctionEmitter emitter, PrintWriter writer) { - emitBeginning((CMethodBindingEmitter)emitter, writer); - emitEnding((CMethodBindingEmitter)emitter, writer); - } - protected void emitBeginning(CMethodBindingEmitter emitter, PrintWriter writer) { - writer.println(" Java->C glue code:"); - writer.print(" * Java package: "); - writer.print(emitter.getJavaPackageName()); - writer.print("."); - writer.println(emitter.getJavaClassName()); - writer.print(" * Java method: "); - MethodBinding binding = emitter.getBinding(); - writer.println(binding); - writer.println(" * C function: " + binding.getCSymbol()); - } - protected void emitEnding(CMethodBindingEmitter emitter, PrintWriter writer) { - } - } - - protected boolean javaArgTypeNeedsDataCopy(JavaType javaArgType) { - if (javaArgType.isArray()) { - Class subArrayElementJavaType = javaArgType.getJavaClass().getComponentType(); - return (subArrayElementJavaType.isArray() || - subArrayElementJavaType == java.lang.String.class || - isNIOBufferClass(subArrayElementJavaType)); - } - return false; - } - - protected static boolean isNIOBufferClass(Class c) { - return java.nio.Buffer.class.isAssignableFrom(c); - } -} - diff --git a/src/net/java/games/gluegen/CMethodBindingImplEmitter.java b/src/net/java/games/gluegen/CMethodBindingImplEmitter.java deleted file mode 100644 index 91789f027..000000000 --- a/src/net/java/games/gluegen/CMethodBindingImplEmitter.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; -import java.io.*; -import java.text.MessageFormat; - -public class CMethodBindingImplEmitter extends CMethodBindingEmitter -{ - protected static final CommentEmitter defaultCImplCommentEmitter = - new CImplCommentEmitter(); - - public CMethodBindingImplEmitter(MethodBinding binding, - boolean isOverloadedBinding, - String javaPackageName, - String javaClassName, - boolean isJavaMethodStatic, - PrintWriter output) - { - super(binding, isOverloadedBinding, - javaPackageName, javaClassName, - isJavaMethodStatic, output); - setCommentEmitter(defaultCImplCommentEmitter); - } - - protected void emitName(PrintWriter writer) - { - super.emitName(writer); - if (!getIsOverloadedBinding()) { - writer.print("0"); - } - } - - /** - * Gets the mangled name for the binding, but assumes that this is an Impl - * routine - */ - protected String jniMangle(MethodBinding binding) { - StringBuffer buf = new StringBuffer(); - buf.append(jniMangle(binding.getName())); - buf.append("0"); - buf.append("__"); - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); - Class c = type.getJavaClass(); - if (c != null) { - jniMangle(c, buf); - } else { - // FIXME: add support for char* -> String conversion - throw new RuntimeException("Unknown kind of JavaType: name="+type.getName()); - } - } - return buf.toString(); - } - - protected static class CImplCommentEmitter extends CMethodBindingEmitter.DefaultCommentEmitter { - protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { - writer.print(" -- FIXME: PUT A COMMENT HERE -- "); - } - } -} diff --git a/src/net/java/games/gluegen/CodeGenUtils.java b/src/net/java/games/gluegen/CodeGenUtils.java deleted file mode 100644 index b89994cdf..000000000 --- a/src/net/java/games/gluegen/CodeGenUtils.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.io.*; -import java.util.*; - -public class CodeGenUtils -{ - /** - * Given a java package name (e.g., "java.lang"), return the package as a - * directory path (i.e., "java/lang"). - */ - public static String packageAsPath(String packageName) { - String path = packageName.replace('.', File.separatorChar); - //System.out.println("Converted package [" + packageName + "] to path [" + path +"]"); - return path; - } - - /** - * @param generator the object that is emitting the autogenerated code. If - * null, the generator will not be mentioned in the warning message. - */ - public static void emitAutogeneratedWarning(PrintWriter w, Object generator) { - w.print("/* !---- DO NOT EDIT: This file autogenerated "); - if (generator != null) - { - w.print("by "); - w.print(packageAsPath(generator.getClass().getName())); - w.print(".java "); - } - w.print("on "); - w.print((new Date()).toString()); - w.println(" ----! */"); - w.println(); - } - - /** - * Emit the opening headers for one java class/interface file. - */ - public static void emitJavaHeaders( - PrintWriter w, - String packageName, - String className, - boolean isClassNotInterface, - String[] imports, - String[] accessModifiers, - String[] interfaces, - String classExtended, - EmissionCallback classDocComment) throws IOException - { - w.println("package " + packageName + ";"); - w.println(); - - for (int i = 0; imports != null && i < imports.length; ++i) { - w.print("import "); - w.print(imports[i]); - w.println(';'); - } - w.println("import net.java.games.gluegen.runtime.*;"); - - w.println(); - - if (classDocComment != null) - { - classDocComment.emit(w); - } - - for (int i = 0; accessModifiers != null && i < accessModifiers.length; ++i) { - w.print(accessModifiers[i]); - w.print(' '); - } - - if (isClassNotInterface) { - w.print("class "); - w.print(className); - w.print(' '); - if (classExtended != null) { - w.print("extends "); - w.print(classExtended); - } - } - else { - if (classExtended != null) { - throw new IllegalArgumentException( - "Autogenerated interface class " + className + - " cannot extend class " + classExtended); - } - w.print("interface "); - w.print(className); - w.print(' '); - } - - for (int i = 0; interfaces != null && i < interfaces.length; ++i) { - if (i == 0) { w.print(isClassNotInterface ? "implements " : "extends "); } - w.print(interfaces[i]); - if (i < interfaces.length-1) { w.print(", "); } - } - - w.println(); - w.println('{'); - } - - //----------------------------------------- - - /** A class that emits source code of some time when activated. */ - public interface EmissionCallback - { - /** Emit appropriate source code through the given writer. */ - public void emit(PrintWriter output); - } -} diff --git a/src/net/java/games/gluegen/CommentEmitter.java b/src/net/java/games/gluegen/CommentEmitter.java deleted file mode 100644 index 10256acba..000000000 --- a/src/net/java/games/gluegen/CommentEmitter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.io.*; - -public interface CommentEmitter -{ - /** - * Emit the body of a comment for the specified function; do NOT emit the - * open (e.g., comment "/*") or close (e.g., "*\/") characters. - */ - public void emit(FunctionEmitter funcEmitter, PrintWriter output); -} - diff --git a/src/net/java/games/gluegen/DebugEmitter.java b/src/net/java/games/gluegen/DebugEmitter.java deleted file mode 100644 index c8e8b3869..000000000 --- a/src/net/java/games/gluegen/DebugEmitter.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; - -import net.java.games.gluegen.cgram.types.*; - -/** Debug emitter which prints the parsing results to standard output. */ - -public class DebugEmitter implements GlueEmitter { - public void readConfigurationFile(String filename) {} - - public void setMachineDescription(MachineDescription md) {} - - public void beginEmission(GlueEmitterControls controls) { - System.out.println("----- BEGIN EMISSION OF GLUE CODE -----"); - } - public void endEmission() { - System.out.println("----- END EMISSION OF GLUE CODE -----"); - } - public void beginDefines() {} - public void emitDefine(String name, String value, String optionalComment) { - System.out.println("#define " + name + " " + value + - (optionalComment != null ? ("// " + optionalComment) : "")); - } - public void endDefines() {} - - public void beginFunctions(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) { - Set keys = typedefDictionary.keySet(); - for (Iterator iter = keys.iterator(); iter.hasNext(); ) { - String key = (String) iter.next(); - Type value = typedefDictionary.get(key); - System.out.println("typedef " + value + " " + key + ";"); - } - } - public Iterator emitFunctions(List/**/ originalCFunctions) - throws Exception { - for (Iterator iter = originalCFunctions.iterator(); iter.hasNext(); ) { - FunctionSymbol sym = (FunctionSymbol) iter.next(); - emitSingleFunction(sym); - } - return originalCFunctions.iterator(); - } - public void emitSingleFunction(FunctionSymbol sym) { - System.out.println(sym); - System.out.println(" -> " + sym.toString()); - } - public void endFunctions() {} - - public void beginStructLayout() throws Exception {} - public void layoutStruct(CompoundType t) throws Exception {} - public void endStructLayout() throws Exception {} - - public void beginStructs(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) { - } - public void emitStruct(CompoundType t, String alternateName) { - String name = t.getName(); - if (name == null && alternateName != null) { - name = alternateName; - } - - System.out.println("Referenced type \"" + name + "\""); - } - public void endStructs() {} -} diff --git a/src/net/java/games/gluegen/FunctionEmitter.java b/src/net/java/games/gluegen/FunctionEmitter.java deleted file mode 100644 index 77a79b6fc..000000000 --- a/src/net/java/games/gluegen/FunctionEmitter.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; -import java.io.*; - -public abstract class FunctionEmitter -{ - public static final EmissionModifier STATIC = new EmissionModifier("static"); - - private HashSet modifiers = new HashSet(4); - private CommentEmitter commentEmitter = null; - private PrintWriter defaultOutput; - - /** - * Constructs the FunctionEmitter with a CommentEmitter that emits nothing. - */ - public FunctionEmitter(PrintWriter defaultOutput) - { - assert(defaultOutput != null); - this.defaultOutput = defaultOutput; - } - - /** - * Makes this FunctionEmitter a copy of the passed one. - */ - public FunctionEmitter(FunctionEmitter arg) { - modifiers = (HashSet) arg.modifiers.clone(); - commentEmitter = arg.commentEmitter; - defaultOutput = arg.defaultOutput; - } - - public PrintWriter getDefaultOutput() { return defaultOutput; } - - public void addModifiers(Iterator/**/ mi) - { - while (mi.hasNext()) - { - modifiers.add((EmissionModifier) mi.next()); - } - } - public void addModifier(EmissionModifier m) { modifiers.add(m); } - - public boolean removeModifier(EmissionModifier m) { return modifiers.remove(m); } - - public void clearModifiers() { modifiers.clear(); } - - public boolean hasModifier(EmissionModifier m) { return modifiers.contains(m); } - - public Iterator getModifiers() { return modifiers.iterator(); } - - public abstract String getName(); - - /** - * Emit the function to the specified output (instead of the default - * output). - */ - public void emit(PrintWriter output) - { - emitDocComment(output); - //output.println(" // Emitter: " + getClass().getName()); - emitSignature(output); - emitBody(output); - } - - /** - * Emit the function to the default output (the output that was passed to - * the constructor) - */ - public final void emit() - { - emit(getDefaultOutput()); - } - - /** Returns, as a String, whatever {@link #emit} would output. */ - public String toString() - { - StringWriter sw = new StringWriter(500); - PrintWriter w = new PrintWriter(sw); - emit(w); - return sw.toString(); - } - - /** - * Set the object that will emit the comment for this function. If the - * parameter is null, no comment will be emitted. - */ - public void setCommentEmitter(CommentEmitter cEmitter) - { - commentEmitter = cEmitter; - } - - /** - * Get the comment emitter for this FunctionEmitter. The return value may be - * null, in which case no comment emitter has been set. - */ - public CommentEmitter getCommentEmitter() { return commentEmitter; } - - protected void emitDocComment(PrintWriter writer) - { - if (commentEmitter != null) - { - writer.print(getBaseIndentString()); //indent - - writer.print(getCommentStartString()); - - commentEmitter.emit(this, writer); - - writer.print(getBaseIndentString()); //indent - - writer.println(getCommentEndString()); - } - } - - protected void emitSignature(PrintWriter writer) - { - writer.print(getBaseIndentString()); // indent method - - int numEmitted = emitModifiers(writer); - if (numEmitted > 0) - { - writer.print(" "); - } - - emitReturnType(writer); - writer.print(" "); - - emitName(writer); - writer.print("("); - - emitArguments(writer); - writer.print(")"); - } - - protected int emitModifiers(PrintWriter writer) - { - PrintWriter w = getDefaultOutput(); - int numEmitted = 0; - for (Iterator it = getModifiers(); it.hasNext(); ) - { - writer.print(it.next()); - ++numEmitted; - if (it.hasNext()) - { - writer.print(" "); - } - } - return numEmitted; - } - - protected String getBaseIndentString() { return ""; } - - protected String getCommentStartString() { return "/* "; } - protected String getCommentEndString() { return " */"; } - - protected abstract void emitReturnType(PrintWriter writer); - protected abstract void emitName(PrintWriter writer); - /** Returns the number of arguments emitted. */ - protected abstract int emitArguments(PrintWriter writer); - protected abstract void emitBody(PrintWriter writer); - - public static class EmissionModifier - { - public final String toString() { return emittedForm; } - - private String emittedForm; - protected EmissionModifier(String emittedForm) { this.emittedForm = emittedForm; } - } -} - diff --git a/src/net/java/games/gluegen/GlueEmitter.java b/src/net/java/games/gluegen/GlueEmitter.java deleted file mode 100644 index 00147dfd2..000000000 --- a/src/net/java/games/gluegen/GlueEmitter.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; -import net.java.games.gluegen.cgram.types.*; - -/** Specifies the interface by which GlueGen requests glue code to be - generated. Can be replaced to generate glue code for other - languages and foreign function interfaces. */ - -public interface GlueEmitter { - - public void readConfigurationFile(String filename) throws Exception; - - /** Set the description of the underlying hardware. */ - public void setMachineDescription(MachineDescription md); - - /** - * Begin the emission of glue code. This might include opening files, - * emitting class headers, etc. - */ - public void beginEmission(GlueEmitterControls controls) throws Exception; - - /** - * Finish the emission of glue code. This might include closing files, - * closing open class definitions, etc. - */ - public void endEmission() throws Exception; - - public void beginDefines() throws Exception; - /** - * @param optionalComment If optionalComment is non-null, the emitter can - * emit that string as a comment providing extra information about the - * define. - */ - public void emitDefine(String name, String value, String optionalComment) throws Exception; - public void endDefines() throws Exception; - - public void beginFunctions(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) throws Exception; - - /** Emit glue code for the list of FunctionSymbols. */ - public Iterator emitFunctions(java.util.List/**/ cFunctions) throws Exception; - public void endFunctions() throws Exception; - - /** Begins the process of computing field offsets and type sizes for - the structs to be emitted. */ - public void beginStructLayout() throws Exception; - /** Lays out one struct which will be emitted later. */ - public void layoutStruct(CompoundType t) throws Exception; - /** Finishes the struct layout process. */ - public void endStructLayout() throws Exception; - - public void beginStructs(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) throws Exception; - /** Emit glue code for the given CompoundType. alternateName is - provided when the CompoundType (e.g. "struct foo_t") has not - been typedefed to anything but the type of "pointer to struct - foo_t" has (e.g. "typedef struct foo_t {} *Foo"); in this case - alternateName would be set to Foo. */ - public void emitStruct(CompoundType t, String alternateName) throws Exception; - public void endStructs() throws Exception; -} diff --git a/src/net/java/games/gluegen/GlueEmitterControls.java b/src/net/java/games/gluegen/GlueEmitterControls.java deleted file mode 100644 index 15df83654..000000000 --- a/src/net/java/games/gluegen/GlueEmitterControls.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -/** Specifies the interface by which a GlueEmitter can request - additional information from the glue generator. */ - -public interface GlueEmitterControls { - /** Requests emission of an accessor for a struct that will not be - referenced by any functions or other structs. */ - public void forceStructEmission(String typedefName); -} diff --git a/src/net/java/games/gluegen/GlueGen.java b/src/net/java/games/gluegen/GlueGen.java deleted file mode 100644 index 442f6405b..000000000 --- a/src/net/java/games/gluegen/GlueGen.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.io.*; -import java.util.*; - -import antlr.*; -import antlr.collections.*; -import net.java.games.gluegen.cgram.*; -import net.java.games.gluegen.cgram.types.*; -import net.java.games.gluegen.pcpp.*; - -/** Glue code generator for C functions and data structures. */ - -public class GlueGen implements GlueEmitterControls { - private java.util.List forcedStructNames = new ArrayList(); - - public void forceStructEmission(String typedefName) { - forcedStructNames.add(typedefName); - } - - public void run(String[] args) { - try { - Reader reader = null; - String filename = null; - String emitterClass = null; - java.util.List cfgFiles = new ArrayList(); - - if (args.length == 0) { - usage(); - } - - java.util.List includePaths = new ArrayList(); - for (int i = 0; i < args.length; i++) { - if (i < args.length - 1) { - String arg = args[i]; - if (arg.startsWith("-I")) { - String[] paths = arg.substring(2).split(System.getProperty("path.separator")); - for (int j = 0; j < paths.length; j++) { - includePaths.add(paths[j]); - } - } else if (arg.startsWith("-E")) { - emitterClass = arg.substring(2); - } else if (arg.startsWith("-C")) { - cfgFiles.add(arg.substring(2)); - } else { - usage(); - } - } else { - String arg = args[i]; - if (arg.equals("-")) { - reader = new InputStreamReader(System.in); - filename = "standard input"; - } else { - if (arg.startsWith("-")) { - usage(); - } - filename = arg; - reader = new BufferedReader(new FileReader(filename)); - } - } - } - - final PCPP preprocessor = new PCPP(includePaths); - PipedInputStream ppIn = new PipedInputStream(); - final PipedOutputStream ppOut = new PipedOutputStream(ppIn); - preprocessor.setOut(ppOut); - final Reader rdr = reader; - final String fn = filename; - new Thread(new Runnable() { - public void run() { - try { - preprocessor.run(rdr, fn); - ppOut.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - }).start(); - - DataInputStream dis = new DataInputStream(ppIn); - GnuCLexer lexer = new GnuCLexer(dis); - lexer.setTokenObjectClass(CToken.class.getName()); - lexer.initialize(); - // Parse the input expression. - GnuCParser parser = new GnuCParser(lexer); - - // set AST node type to TNode or get nasty cast class errors - parser.setASTNodeType(TNode.class.getName()); - TNode.setTokenVocabulary(GNUCTokenTypes.class.getName()); - - // invoke parser - try { - parser.translationUnit(); - } - catch (RecognitionException e) { - System.err.println("Fatal IO error:\n"+e); - System.exit(1); - } - catch (TokenStreamException e) { - System.err.println("Fatal IO error:\n"+e); - System.exit(1); - } - - HeaderParser headerParser = new HeaderParser(); - MachineDescription machDesc; - String os = System.getProperty("os.name").toLowerCase(); - String cpu = System.getProperty("os.arch").toLowerCase(); - if ((os.startsWith("linux") && cpu.equals("amd64")) || - (os.startsWith("linux") && cpu.equals("ia64"))) { - machDesc = new MachineDescription64Bit(); - } else { - machDesc = new MachineDescription32Bit(); - } - headerParser.setMachineDescription(machDesc); - TypeDictionary td = new TypeDictionary(); - headerParser.setTypedefDictionary(td); - TypeDictionary sd = new TypeDictionary(); - headerParser.setStructDictionary(sd); - // set AST node type to TNode or get nasty cast class errors - headerParser.setASTNodeType(TNode.class.getName()); - // walk that tree - headerParser.translationUnit( parser.getAST() ); - - // For debugging: Dump type dictionary and struct dictionary to System.err - //td.dumpDictionary(System.err, "All Types"); - //sd.dumpDictionary(System.err, "All Structs"); - - // At this point we have all of the pieces we need in order to - // generate glue code: the #defines to constants, the set of - // typedefs, and the set of functions. - - GlueEmitter emit = null; - if (emitterClass == null) { - emit = new JavaEmitter(); - } else { - try { - emit = (GlueEmitter) Class.forName(emitterClass).newInstance(); - } catch (Exception e) { - System.err.println("Exception occurred while instantiating emitter class. Exiting."); - e.printStackTrace(); - System.exit(1); - } - } - - for (Iterator iter = cfgFiles.iterator(); iter.hasNext(); ) { - emit.readConfigurationFile((String) iter.next()); - } - - // provide MachineDescription to emitter if it needs it - emit.setMachineDescription(machDesc); - - // begin emission of glue code - emit.beginEmission(this); - - emit.beginDefines(); - Set emittedDefines = new HashSet(100); - // emit java equivalent of enum { ... } statements - for (Iterator iter = headerParser.getEnums().iterator(); iter.hasNext(); ) { - EnumType enumeration = (EnumType)iter.next(); - // iterate over all values in the enumeration - for (int i = 0; i < enumeration.getNumEnumerates(); ++i) { - String enumElementName = enumeration.getEnumName(i); - if (emittedDefines.contains(enumElementName) == false) { - emittedDefines.add(enumElementName); - String comment = null; - if (! enumeration.getName().equals("")) { - comment = "Defined as part of enum type \"" + - enumeration.getName() + "\""; - } - emit.emitDefine( - enumElementName, - String.valueOf(enumeration.getEnumValue(i)), - comment); - } - } - } - // emit java equivalent of #define statements - for (Iterator iter = lexer.getDefines().iterator(); iter.hasNext(); ) { - Define def = (Define) iter.next(); - if (emittedDefines.contains(def.getName()) == false) { - emittedDefines.add(def.getName()); - emit.emitDefine(def.getName(), def.getValue(), null); - } - } - emit.endDefines(); - - java.util.List functions = headerParser.getParsedFunctions(); - - // Iterate through the functions finding structs that are referenced in - // the function signatures; these will be remembered for later emission - ReferencedStructs referencedStructs = new ReferencedStructs(); - for (Iterator iter = functions.iterator(); iter.hasNext(); ) { - FunctionSymbol sym = (FunctionSymbol) iter.next(); - // FIXME: this doesn't take into account the possibility that some of - // the functions we send to emitMethodBindings() might not actually be - // emitted (e.g., if an Ignore directive in the JavaEmitter causes it - // to be skipped). - sym.getType().visit(referencedStructs); - } - - // Normally only referenced types will be emitted. The user can force a - // type to be emitted via a .cfg file directive. Those directives are - // processed here. - for (Iterator iter = forcedStructNames.iterator(); iter.hasNext(); ) { - String name = (String) iter.next(); - Type type = td.get(name); - if (type == null) { - System.err.println("WARNING: during forced struct emission: struct \"" + name + "\" not found"); - } else if (!type.isCompound()) { - System.err.println("WARNING: during forced struct emission: type \"" + name + "\" was not a struct"); - } else { - type.visit(referencedStructs); - } - } - - // Lay out structs - emit.beginStructLayout(); - for (Iterator iter = referencedStructs.results(); iter.hasNext(); ) { - Type t = (Type) iter.next(); - if (t.isCompound()) { - emit.layoutStruct(t.asCompound()); - } else if (t.isPointer()) { - PointerType p = t.asPointer(); - CompoundType c = p.getTargetType().asCompound(); - emit.layoutStruct(c); - } - } - emit.endStructLayout(); - - // Emit structs - emit.beginStructs(td, sd, headerParser.getCanonMap()); - for (Iterator iter = referencedStructs.results(); iter.hasNext(); ) { - Type t = (Type) iter.next(); - if (t.isCompound()) { - emit.emitStruct(t.asCompound(), null); - } else if (t.isPointer()) { - PointerType p = t.asPointer(); - CompoundType c = p.getTargetType().asCompound(); - assert p.hasTypedefedName() && c.getName() == null : "ReferencedStructs incorrectly recorded pointer type " + p; - emit.emitStruct(c, p.getName()); - } - } - emit.endStructs(); - - // emit java and C code to interface with the native functions - emit.beginFunctions(td, sd, headerParser.getCanonMap()); - emit.emitFunctions(functions); - emit.endFunctions(); - - // end emission of glue code - emit.endEmission(); - - } catch ( Exception e ) { - e.printStackTrace(); - System.err.println("Exception occurred while generating glue code. Exiting."); - System.exit(1); - } - } - - public static void main(String[] args) { - new GlueGen().run(args); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private static void usage() { - System.out.println("Usage: java GlueGen [-I...] [-Eemitter_class_name] [-Ccfg_file_name...] "); - System.out.println(); - System.out.println("Runs C header parser on input file or standard input, first"); - System.out.println("passing input through minimal pseudo-C-preprocessor. Use -I"); - System.out.println("command-line arguments to specify the search path for #includes."); - System.out.println("Emitter class name can be specified with -E option: i.e.,"); - System.out.println("-Enet.java.games.gluegen.JavaEmitter (the default). Use"); - System.out.println("-Enet.java.games.gluegen.DebugEmitter to print recognized entities"); - System.out.println("(#define directives to constant numbers, typedefs, and function"); - System.out.println("declarations) to standard output. Emitter-specific configuration"); - System.out.println("file or files can be specified with -C option; e.g,"); - System.out.println("-Cjava-emitter.cfg."); - System.exit(1); - } -} diff --git a/src/net/java/games/gluegen/JavaConfiguration.java b/src/net/java/games/gluegen/JavaConfiguration.java deleted file mode 100644 index 8722725df..000000000 --- a/src/net/java/games/gluegen/JavaConfiguration.java +++ /dev/null @@ -1,1184 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.io.*; -import java.util.*; -import java.util.regex.*; - -import net.java.games.gluegen.cgram.types.*; - -/** Parses and provides access to the contents of .cfg files for the - JavaEmitter. */ - -public class JavaConfiguration { - private int nestedReads; - private String packageName; - private String implPackageName; - private String className; - private String implClassName; - /** - * Root directory for the hierarchy of generated java classes. Default is - * working directory. - */ - private String javaOutputDir = "."; - /** - * Directory into which generated native JNI code will be written. Default - * is current working directory. - */ - private String nativeOutputDir = "."; - /** - * If true, then each native *.c and *.h file will be generated in the - * directory nativeOutputDir/packageAsPath(packageName). Default is false. - */ - private boolean nativeOutputUsesJavaHierarchy; - /** - * Style of code emission. Can emit everything into one class - * (AllStatic), separate interface and implementing classes - * (InterfaceAndImpl), only the interface (InterfaceOnly), or only - * the implementation (ImplOnly). - */ - private int emissionStyle = JavaEmitter.ALL_STATIC; - /** - * List of imports to emit at the head of the output files. - */ - private List/**/ imports = new ArrayList(); - /** - * The kind of exception raised by the generated code if run-time - * checks fail. Defaults to RuntimeException. - */ - private String runtimeExceptionType = "RuntimeException"; - private Map/**/ typeInfoMap = new HashMap(); - private Set/**/ returnsString = new HashSet(); - private Map/**/ returnedArrayLengths = new HashMap(); - /** - * Key is function that has some byte[] arguments that should be - * converted to String args; value is List of Integer argument indices - */ - private Map/*>*/ argumentsAreString = new HashMap(); - private Set/**/ ignores = new HashSet(); - private Set/**/ ignoreNots = new HashSet(); - private Set/**/ unimplemented = new HashSet(); - private Set/**/ nioOnly = new HashSet(); - /** See {@link #nioMode} */ - public static final int NIO_MODE_VOID_ONLY = 1; - /** See {@link #nioMode} */ - public static final int NIO_MODE_ALL_POINTERS = 2; - private int nioMode = NIO_MODE_VOID_ONLY; - private Set/**/ noNio = new HashSet(); - private Set/**/ forcedNio = new HashSet(); - private boolean flattenNIOVariants = true; - private Set/**/ manuallyImplement = new HashSet(); - private Map/*>*/ customJavaCode = new HashMap(); - private Map/*>*/ classJavadoc = new HashMap(); - private Map/**/ structPackages = new HashMap(); - private List/**/ customCCode = new ArrayList(); - private List/**/ forcedStructs = new ArrayList(); - private Map/*>*/ mirroredArgs = new HashMap(); - private Map/**/ returnValueCapacities = new HashMap(); - private Map/**/ returnValueLengths = new HashMap(); - private Map/*>*/ temporaryCVariableDeclarations = new HashMap(); - private Map/*>*/ temporaryCVariableAssignments = new HashMap(); - private Map/*>*/ extendedInterfaces = new HashMap(); - private Map/*>*/ implementedInterfaces = new HashMap(); - private Map/**/ javaTypeRenames = new HashMap(); - - /** Reads the configuration file. - @param filename path to file that should be read - */ - public final void read(String filename) throws IOException { - read(filename, null); - } - - /** Reads the specified file, treating each line as if it started with the - specified string. - @param filename path to file that should be read - @param linePrefix if not null, treat each line read as if it were - prefixed with the specified string. - */ - protected final void read(String filename, String linePrefix) throws IOException { - File file = new File(filename); - BufferedReader reader = null; - try { - reader = new BufferedReader(new FileReader(file)); - } - catch (FileNotFoundException fnfe) { - throw new RuntimeException("Could not read file \"" + file + "\"", fnfe); - } - int lineNo = 0; - String line = null; - boolean hasPrefix = linePrefix != null && linePrefix.length() > 0; - try { - ++nestedReads; - while ((line = reader.readLine()) != null) { - ++lineNo; - if (hasPrefix) - { - line = linePrefix + " " + line; - } - - if (line.trim().startsWith("#")) - { - // comment line - continue; - } - - StringTokenizer tok = new StringTokenizer(line); - if (tok.hasMoreTokens()) - { - // always reset delimiters in case of CustomJavaCode, etc. - String cmd = tok.nextToken(" \t\n\r\f"); - - dispatch(cmd, tok, file, filename, lineNo); - } - } - reader.close(); - } finally { - --nestedReads; - } - - if (nestedReads == 0) { - if (allStatic() && implClassName != null) { - throw new IllegalStateException( - "Error in configuration file \"" + filename + "\": Cannot use " + - "directive \"ImplJavaClass\" in conjunction with " + - "\"Style AllStatic\""); - } - - if (className == null) { - throw new RuntimeException("Output class name was not specified in configuration file"); - } - if (packageName == null) { - throw new RuntimeException("Output package name was not specified in configuration file"); - } - - if (allStatic()) { - implClassName = className; - // If we're using the "Style AllStatic" directive, then the - // implPackageName is the same as the regular package name - implPackageName = packageName; - } else { - if (implClassName == null) { - // implClassName defaults to "Impl" if ImplJavaClass - // directive is not used - implClassName = className + "Impl"; - } - if (implPackageName == null) { - // implPackageName defaults to ".impl" if ImplPackage - // directive is not used - implPackageName = packageName + ".impl"; - } - } - } - } - - /** Returns the package name parsed from the configuration file. */ - public String packageName() { return packageName; } - /** Returns the implementation package name parsed from the configuration file. */ - public String implPackageName() { return implPackageName; } - /** Returns the class name parsed from the configuration file. */ - public String className() { return className; } - /** Returns the implementation class name parsed from the configuration file. */ - public String implClassName() { return implClassName; } - /** Returns the Java code output directory parsed from the configuration file. */ - public String javaOutputDir() { return javaOutputDir; } - /** Returns the native code output directory parsed from the configuration file. */ - public String nativeOutputDir() { return nativeOutputDir; } - /** Returns whether the native code directory structure mirrors the Java hierarchy. */ - public boolean nativeOutputUsesJavaHierarchy() { return nativeOutputUsesJavaHierarchy; } - /** Returns the code emission style (constants in JavaEmitter) parsed from the configuration file. */ - public int emissionStyle() { return emissionStyle; } - /** Returns the kind of exception to raise if run-time checks fail in the generated code. */ - public String runtimeExceptionType() { return runtimeExceptionType; } - /** Returns the list of imports that should be emitted at the top of each .java file. */ - public List/**/ imports() { return imports; } - - /** If this type should be considered opaque, returns the TypeInfo - describing the replacement type. Returns null if this type - should not be considered opaque. */ - public TypeInfo typeInfo(Type type, TypeDictionary typedefDictionary) { - // Because typedefs of pointer types can show up at any point, - // walk the pointer chain looking for a typedef name that is in - // the TypeInfo map. - int pointerDepth = type.pointerDepth(); - for (int i = 0; i <= pointerDepth; i++) { - String name = type.getName(); - if (name != null) { - TypeInfo info = (TypeInfo) typeInfoMap.get(name); - while (info != null) { - if (info.name().equals(name) && info.pointerDepth() == i) { - return info; - } - info = info.next(); - } - } - - if (type.isCompound()) { - // Try struct name as well - name = type.asCompound().getStructName(); - if (name != null) { - TypeInfo info = (TypeInfo) typeInfoMap.get(name); - while (info != null) { - if (info.name().equals(name) && info.pointerDepth() == i) { - return info; - } - info = info.next(); - } - } - } - - // Try all typedef names that map to this type - Set entrySet = typedefDictionary.entrySet(); - for (Iterator iter = entrySet.iterator(); iter.hasNext(); ) { - Map.Entry entry = (Map.Entry) iter.next(); - // "eq" equality is OK to use here since all types have been canonicalized - if (entry.getValue() == type) { - name = (String) entry.getKey(); - TypeInfo info = (TypeInfo) typeInfoMap.get(name); - while (info != null) { - if (info.name().equals(name) && info.pointerDepth() == i) { - return info; - } - info = info.next(); - } - } - } - - if (type.isPointer()) { - type = type.asPointer().getTargetType(); - } - } - - return null; - } - - /** Indicates whether the given function (which returns a - char* in C) should be translated as returning a - java.lang.String. */ - public boolean returnsString(String functionName) { - return returnsString.contains(functionName); - } - - /** Provides a Java MessageFormat expression indicating the number - of elements in the returned array from the specified function - name. Indicates that the given return value, which must be a - pointer to a CompoundType, is actually an array of the - CompoundType rather than a pointer to a single object. */ - public String returnedArrayLength(String functionName) { - return (String) returnedArrayLengths.get(functionName); - } - - /** Returns a list of Integers which are the indices of const char* - arguments that should be converted to Strings. Returns null if there are no - such hints for the given function name. */ - - public List/**/ stringArguments(String functionName) { - return (List) argumentsAreString.get(functionName); - } - - /** Returns true if the given function should only create a java.nio - variant, and no array variants, for void* and other - C primitive pointers. */ - public boolean nioOnly(String functionName) { - return nioOnly.contains(functionName); - } - - /** Returns true if the user requested that the given function - should only create array variants, and no java.nio variant, for - void* and other C primitive pointers, overriding - the NIO mode default. */ - public boolean noNio(String functionName) { - return noNio.contains(functionName); - } - - /** Returns true if the user requested that the given function - should create a java.nio variant for the given function's - void* and other C primitive pointers, overriding - the NIO mode default. */ - public boolean forcedNio(String functionName) { - return forcedNio.contains(functionName); - } - - /** Returns the default NIO generation mode for C primitive pointer - arguments. NIO_MODE_VOID_ONLY is the default and specifies - that only void* arguments will have java.nio variants generated - for them. NIO_MODE_ALL_POINTERS specifies that all C - primitive arguments will have java.nio variants generated. */ - public int nioMode() { - return nioMode; - } - - /** Returns true if, for the plethora of java.nio variants generated - for primitive C pointer types, the emitter should flatten the - output down to two variants: one taking only Java primitive - arrays as arguments, and one taking only java.nio.Buffers as - arguments. */ - public boolean flattenNIOVariants() { - return flattenNIOVariants; - } - - /** Returns true if the glue code for the given function will be - manually implemented by the end user. */ - public boolean manuallyImplement(String functionName) { - return manuallyImplement.contains(functionName); - } - - /** Returns a list of Strings containing user-implemented code for - the given Java type name (not fully-qualified, only the class - name); returns either null or an empty list if there is no - custom code for the class. */ - public List customJavaCodeForClass(String className) { - List res = (List) customJavaCode.get(className); - if (res == null) { - res = new ArrayList(); - customJavaCode.put(className, res); - } - return res; - } - - /** Returns a list of Strings containing Javadoc documentation for - the given Java type name (not fully-qualified, only the class - name); returns either null or an empty list if there is no - Javadoc documentation for the class. */ - public List javadocForClass(String className) { - List res = (List) classJavadoc.get(className); - if (res == null) { - res = new ArrayList(); - classJavadoc.put(className, res); - } - return res; - } - - /** Returns the package into which to place the glue code for - accessing the specified struct. Defaults to emitting into the - regular package (i.e., the result of {@link #packageName}). */ - public String packageForStruct(String structName) { - String res = (String) structPackages.get(structName); - if (res == null) { - res = packageName; - } - return res; - } - - /** Returns, as a List of Strings, the custom C code to be emitted - along with the glue code for the main class. */ - public List/**/ customCCode() { - return customCCode; - } - - /** Returns, as a List of Strings, the structs for which glue code - emission should be forced. */ - public List/**/ forcedStructs() { - return forcedStructs; - } - - /** Returns a List of Integers indicating the indices of arguments - in this function that should be expanded to the same type when - binding functions with multiple void* arguments. Returns null if - no such indices were specified. */ - public List/**/ mirroredArgs(String functionName) { - return (List) mirroredArgs.get(functionName); - } - - /** Returns a MessageFormat string of the C expression calculating - the capacity of the java.nio.ByteBuffer being returned from a - native method, or null if no expression has been specified. */ - public String returnValueCapacity(String functionName) { - return (String) returnValueCapacities.get(functionName); - } - - /** Returns a MessageFormat string of the C expression calculating - the length of the array being returned from a native method, or - null if no expression has been specified. */ - public String returnValueLength(String functionName) { - return (String) returnValueLengths.get(functionName); - } - - /** Returns a List of Strings of expressions declaring temporary C - variables in the glue code for the specified function. */ - public List/**/ temporaryCVariableDeclarations(String functionName) { - return (List) temporaryCVariableDeclarations.get(functionName); - } - - /** Returns a List of Strings of expressions containing assignments - to temporary C variables in the glue code for the specified - function. */ - public List/**/ temporaryCVariableAssignments(String functionName) { - return (List) temporaryCVariableAssignments.get(functionName); - } - - /** Returns a List of Strings indicating the interfaces the passed - interface should declare it extends. May return null or a list - of zero length if there are none. */ - public List/**/ extendedInterfaces(String interfaceName) { - List res = (List) extendedInterfaces.get(interfaceName); - if (res == null) { - res = new ArrayList(); - extendedInterfaces.put(interfaceName, res); - } - return res; - } - - /** Returns a List of Strings indicating the interfaces the passed - class should declare it implements. May return null or a list - of zero length if there are none. */ - public List/**/ implementedInterfaces(String className) { - List res = (List) implementedInterfaces.get(className); - if (res == null) { - res = new ArrayList(); - implementedInterfaces.put(className, res); - } - return res; - } - - /** Returns true if this #define, function, struct, or field within - a struct should be ignored during glue code generation. */ - public boolean shouldIgnore(String symbol) { - - //System.err.println("CHECKING IGNORE: " + symbol); - - // Simple case; the entire symbol is in the ignore table. - if (ignores.contains(symbol)) { - return true; - } - - // Ok, the slow case. We need to check the entire table, in case the table - // contains an regular expression that matches the symbol. - for (Iterator iter = ignores.iterator(); iter.hasNext(); ) { - Pattern regexp = (Pattern)iter.next(); - Matcher matcher = regexp.matcher(symbol); - if (matcher.matches()) { - return true; - } - } - - // Check negated ignore table if not empty - if (ignoreNots.size() > 0) { - // Ok, the slow case. We need to check the entire table, in case the table - // contains an regular expression that matches the symbol. - for (Iterator iter = ignoreNots.iterator(); iter.hasNext(); ) { - Pattern regexp = (Pattern)iter.next(); - Matcher matcher = regexp.matcher(symbol); - if (!matcher.matches()) { - return true; - } - } - } - - return false; - } - - /** Returns true if this function should be given a body which - throws a run-time exception with an "unimplemented" message - during glue code generation. */ - public boolean isUnimplemented(String symbol) { - - // Simple case; the entire symbol is in the ignore table. - if (unimplemented.contains(symbol)) { - return true; - } - - // Ok, the slow case. We need to check the entire table, in case the table - // contains an regular expression that matches the symbol. - for (Iterator iter = unimplemented.iterator(); iter.hasNext(); ) { - Pattern regexp = (Pattern)iter.next(); - Matcher matcher = regexp.matcher(symbol); - if (matcher.matches()) { - return true; - } - } - - return false; - } - - /** Returns a replacement name for this type, which should be the - name of a Java wrapper class for a C struct, or the name - unchanged if no RenameJavaType directive was specified for this - type. */ - public String renameJavaType(String javaTypeName) { - String rename = (String) javaTypeRenames.get(javaTypeName); - if (rename != null) { - return rename; - } - return javaTypeName; - } - - /** Returns true if the emission style is AllStatic. */ - public boolean allStatic() { - return (emissionStyle == JavaEmitter.ALL_STATIC); - } - - /** Returns true if an interface should be emitted during glue code generation. */ - public boolean emitInterface() { - return (emissionStyle() == JavaEmitter.INTERFACE_AND_IMPL || - emissionStyle() == JavaEmitter.INTERFACE_ONLY); - } - - /** Returns true if an implementing class should be emitted during glue code generation. */ - public boolean emitImpl() { - return (emissionStyle() == JavaEmitter.ALL_STATIC || - emissionStyle() == JavaEmitter.INTERFACE_AND_IMPL || - emissionStyle() == JavaEmitter.IMPL_ONLY); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { - //System.err.println("read cmd = [" + cmd + "]"); - if (cmd.equalsIgnoreCase("Package")) { - packageName = readString("package", tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("ImplPackage")) { - implPackageName = readString("ImplPackage", tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("JavaClass")) { - className = readString("JavaClass", tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("ImplJavaClass")) { - implClassName = readString("ImplJavaClass", tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("JavaOutputDir")) { - javaOutputDir = readString("JavaOutputDir", tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("NativeOutputDir")) { - nativeOutputDir = readString("NativeOutputDir", tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("HierarchicalNativeOutput")) { - String tmp = readString("HierarchicalNativeOutput", tok, filename, lineNo); - nativeOutputUsesJavaHierarchy = Boolean.valueOf(tmp).booleanValue(); - } else if (cmd.equalsIgnoreCase("Style")) { - String style = readString("Style", tok, filename, lineNo); - if (style.equalsIgnoreCase("AllStatic")) { - emissionStyle = JavaEmitter.ALL_STATIC; - } else if (style.equalsIgnoreCase("InterfaceAndImpl")) { - emissionStyle = JavaEmitter.INTERFACE_AND_IMPL; - } else if (style.equalsIgnoreCase("InterfaceOnly")) { - emissionStyle = JavaEmitter.INTERFACE_ONLY; - } else if (style.equalsIgnoreCase("ImplOnly")) { - emissionStyle = JavaEmitter.IMPL_ONLY; - } else { - System.err.println("WARNING: Error parsing \"style\" command at line " + lineNo + - " in file \"" + filename + "\""); - } - } else if (cmd.equalsIgnoreCase("Import")) { - imports.add(readString("Import", tok, filename, lineNo)); - } else if (cmd.equalsIgnoreCase("Opaque")) { - readOpaque(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("ReturnsString")) { - readReturnsString(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("ReturnedArrayLength")) { - readReturnedArrayLength(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because ReturnedArrayLength changes them. - } else if (cmd.equalsIgnoreCase("ArgumentIsString")) { - readArgumentIsString(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("Ignore")) { - readIgnore(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("IgnoreNot")) { - readIgnoreNot(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("Unimplemented")) { - readUnimplemented(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("IgnoreField")) { - readIgnoreField(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("ManuallyImplement")) { - readManuallyImplement(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("CustomJavaCode")) { - readCustomJavaCode(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because readCustomJavaCode changes them. - } else if (cmd.equalsIgnoreCase("CustomCCode")) { - readCustomCCode(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because readCustomCCode changes them. - } else if (cmd.equalsIgnoreCase("ClassJavadoc")) { - readClassJavadoc(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because readClassJavadoc changes them. - } else if (cmd.equalsIgnoreCase("NioOnly")) { - nioOnly.add(readString("NioOnly", tok, filename, lineNo)); - } else if (cmd.equalsIgnoreCase("NoNio")) { - noNio.add(readString("NoNio", tok, filename, lineNo)); - } else if (cmd.equalsIgnoreCase("ForcedNio")) { - forcedNio.add(readString("ForcedNio", tok, filename, lineNo)); - } else if (cmd.equalsIgnoreCase("NioMode")) { - readNioMode(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("FlattenNIOVariants")) { - flattenNIOVariants = readBoolean("FlattenNIOVariants", tok, filename, lineNo).booleanValue(); - } else if (cmd.equalsIgnoreCase("EmitStruct")) { - forcedStructs.add(readString("EmitStruct", tok, filename, lineNo)); - } else if (cmd.equalsIgnoreCase("MirrorExpandedBindingArgs")) { - readMirrorExpandedBindingArgs(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("StructPackage")) { - readStructPackage(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("TemporaryCVariableDeclaration")) { - readTemporaryCVariableDeclaration(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because TemporaryCVariableDeclaration changes them. - } else if (cmd.equalsIgnoreCase("TemporaryCVariableAssignment")) { - readTemporaryCVariableAssignment(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because TemporaryCVariableAssignment changes them. - } else if (cmd.equalsIgnoreCase("ReturnValueCapacity")) { - readReturnValueCapacity(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because ReturnValueCapacity changes them. - } else if (cmd.equalsIgnoreCase("ReturnValueLength")) { - readReturnValueLength(tok, filename, lineNo); - // Warning: make sure delimiters are reset at the top of this loop - // because ReturnValueLength changes them. - } else if (cmd.equalsIgnoreCase("Include")) { - doInclude(tok, file, filename, lineNo); - } else if (cmd.equalsIgnoreCase("IncludeAs")) { - doIncludeAs(tok, file, filename, lineNo); - } else if (cmd.equalsIgnoreCase("Extends")) { - readExtend(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("Implements")) { - readImplements(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("RenameJavaType")) { - readRenameJavaType(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("RuntimeExceptionType")) { - runtimeExceptionType = readString("RuntimeExceptionType", tok, filename, lineNo); - } else { - throw new RuntimeException("Unknown command \"" + cmd + - "\" in command file " + filename + - " at line number " + lineNo); - } - } - - protected String readString(String cmd, StringTokenizer tok, String filename, int lineNo) { - try { - return tok.nextToken(); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"" + cmd + "\" command at line " + lineNo + - " in file \"" + filename + "\": missing expected parameter", e); - } - } - - protected Boolean readBoolean(String cmd, StringTokenizer tok, String filename, int lineNo) { - try { - return Boolean.valueOf(tok.nextToken()); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"" + cmd + "\" command at line " + lineNo + - " in file \"" + filename + "\": missing expected boolean value", e); - } - } - - protected Class stringToPrimitiveType(String type) throws ClassNotFoundException { - if (type.equals("boolean")) return Boolean.TYPE; - if (type.equals("byte")) return Integer.TYPE; - if (type.equals("char")) return Character.TYPE; - if (type.equals("short")) return Short.TYPE; - if (type.equals("int")) return Integer.TYPE; - if (type.equals("long")) return Long.TYPE; - if (type.equals("float")) return Float.TYPE; - if (type.equals("double")) return Double.TYPE; - throw new RuntimeException("Only primitive types are supported here"); - } - - protected void readOpaque(StringTokenizer tok, String filename, int lineNo) { - try { - JavaType javaType = JavaType.createForClass(stringToPrimitiveType(tok.nextToken())); - String cType = null; - while (tok.hasMoreTokens()) { - if (cType == null) { - cType = tok.nextToken(); - } else { - cType = cType + " " + tok.nextToken(); - } - } - if (cType == null) { - throw new RuntimeException("No C type for \"Opaque\" command at line " + lineNo + - " in file \"" + filename + "\""); - } - TypeInfo info = parseTypeInfo(cType, javaType); - addTypeInfo(info); - } catch (Exception e) { - throw new RuntimeException("Error parsing \"Opaque\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readReturnsString(StringTokenizer tok, String filename, int lineNo) { - try { - String name = tok.nextToken(); - returnsString.add(name); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"ReturnsString\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readReturnedArrayLength(StringTokenizer tok, String filename, int lineNo) { - try { - String functionName = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - restOfLine = restOfLine.trim(); - returnedArrayLengths.put(functionName, restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"ReturnedArrayLength\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readIgnore(StringTokenizer tok, String filename, int lineNo) { - try { - String regex = tok.nextToken(); - ignores.add(Pattern.compile(regex)); - //System.err.println("IGNORING " + regex + " / " + ignores.get(regex)); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"Ignore\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readIgnoreNot(StringTokenizer tok, String filename, int lineNo) { - try { - String regex = tok.nextToken(); - ignoreNots.add(Pattern.compile(regex)); - //System.err.println("IGNORING NEGATION OF " + regex + " / " + ignores.get(regex)); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"IgnoreNot\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readUnimplemented(StringTokenizer tok, String filename, int lineNo) { - try { - String regex = tok.nextToken(); - unimplemented.add(Pattern.compile(regex)); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"Unimplemented\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readIgnoreField(StringTokenizer tok, String filename, int lineNo) { - try { - String containingStruct = tok.nextToken(); - String name = tok.nextToken(); - ignores.add(Pattern.compile(containingStruct + " " + name)); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"IgnoreField\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readManuallyImplement(StringTokenizer tok, String filename, int lineNo) { - try { - String name = tok.nextToken(); - manuallyImplement.add(name); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"ManuallyImplement\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readCustomJavaCode(StringTokenizer tok, String filename, int lineNo) { - try { - String className = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - addCustomJavaCode(className, restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"CustomJavaCode\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void addCustomJavaCode(String className, String code) { - List codeList = customJavaCodeForClass(className); - codeList.add(code); - } - - protected void readCustomCCode(StringTokenizer tok, String filename, int lineNo) { - try { - String restOfLine = tok.nextToken("\n\r\f"); - customCCode.add(restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"CustomCCode\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readClassJavadoc(StringTokenizer tok, String filename, int lineNo) { - try { - String className = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - addClassJavadoc(className, restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"ClassJavadoc\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void addClassJavadoc(String className, String code) { - List codeList = javadocForClass(className); - codeList.add(code); - } - - /** - * Sets the default NIO generation mode for C primitive - * pointers. Options are VOID_ONLY or ALL_POINTERS. When the mode is - * set to VOID_ONLY, java.nio variants of methods are only generated - * for C primitive pointers of type void*. All other - * pointers are translated by default into Java primitive arrays. - * When the mode is set to ALL_POINTERS, C primitive pointers of - * other types (i.e., int*) will have java.nio variants - * generated for them (i.e., IntBuffer as opposed to - * merely int[]). This default mode can be overridden - * with the NioOnly and NoNio directives. The default for this mode - * is currently VOID_ONLY. - */ - protected void readNioMode(StringTokenizer tok, String filename, int lineNo) { - try { - String mode = tok.nextToken(); - if (mode.equalsIgnoreCase("VOID_ONLY")) { - nioMode = NIO_MODE_VOID_ONLY; - } else if (mode.equalsIgnoreCase("ALL_POINTERS")) { - nioMode = NIO_MODE_ALL_POINTERS; - } else { - throw new RuntimeException("Error parsing \"NioMode\" command at line " + lineNo + - " in file \"" + filename + "\"; expected VOID_ONLY or ALL_POINTERS"); - } - } catch (NoSuchElementException e) { - throw new RuntimeException( - "Error parsing \"NioMode\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - /** - * When void* arguments in the C function prototypes are encountered, the - * emitter will try to expand the binding and create Java entry points for - * all possible array types. If there are 2 or more void* arguments in the C - * prototype, this directive lets you specify which of those arguments - * should always be expanded to the same type.

- * - * For example, given the C prototype: - *

-   * void FuncName(void *foo, void *bar);
-   * 
- * - * The emitter will normally emit multiple Java entry points: - *
-   * public abstract void FuncName(boolean[] foo, java.nio.Buffer bar);
-   * public abstract void FuncName(boolean[] foo, boolean[] bar);
-   * public abstract void FuncName(boolean[] foo, byte[] bar);
-   * public abstract void FuncName(boolean[] foo, char[] bar);
-   * public abstract void FuncName(boolean[] foo, short[] bar);
-   * public abstract void FuncName(boolean[] foo, int[] bar);
-   * public abstract void FuncName(boolean[] foo, long[] bar);
-   * public abstract void FuncName(boolean[] foo, float[] bar);
-   * public abstract void FuncName(boolean[] foo, double[] bar);
-   * 
-   * public abstract void FuncName(byte[] foo, java.nio.Buffer bar);
-   * public abstract void FuncName(byte[] foo, boolean[] bar);
-   * public abstract void FuncName(byte[] foo, byte[] bar);
-   * <...etc for all variants on the second parameter...>
-   * 
-   * public abstract void FuncName(char[] foo, java.nio.Buffer bar);
-   * public abstract void FuncName(char[] foo, boolean[] bar);
-   * public abstract void FuncName(char[] foo, byte[] bar);
-   * <...etc for all variants on the second parameter...>
-   * <...and so on for all remaining variants on the first parameter...>
-   * 
- * - * This directive lets you specify that arguments at a particular index - * should always be expanded to the same type. For example, the directive: - *
-   * MirrorExpandedBindingArgs FuncName 0 1
-   * 
- * will force the first and second arguments in function FuncName to be - * expanded identically. This would result in the emission of the following - * entry points only: - *
-   * public abstract void FuncName(java.nio.Buffer[] foo, java.nio.Buffer bar);
-   * public abstract void FuncName(boolean[] foo, boolean[] bar);
-   * public abstract void FuncName(byte[] foo, byte[] bar);
-   * public abstract void FuncName(char[] foo, char[] bar);
-   * public abstract void FuncName(short[] foo, short[] bar);
-   * public abstract void FuncName(int[] foo, int[] bar);
-   * public abstract void FuncName(long[] foo, long[] bar);
-   * public abstract void FuncName(float[] foo, float[] bar);
-   * public abstract void FuncName(double[] foo, double[] bar);
-   * 
- */ - protected void readMirrorExpandedBindingArgs(StringTokenizer tok, String filename, int lineNo) { - try { - String methodName = tok.nextToken(); - ArrayList argIndices = new ArrayList(2); - while (tok.hasMoreTokens()) - { - Integer idx = Integer.valueOf(tok.nextToken()); - argIndices.add(idx); - } - - if(argIndices.size() > 1) - { - mirroredArgs.put(methodName, argIndices); - } - else - { - throw new RuntimeException("ERROR: Error parsing \"MirrorExpandedBindingArgs\" command at line " + lineNo + - " in file \"" + filename + "\": directive requires at least 2 argument indices"); - } - } catch (NoSuchElementException e) { - throw new RuntimeException( - "Error parsing \"MirrorExpandedBindingArgs\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - /** - * When const char* arguments in the C function prototypes are encountered, - * the emitter will normally convert them to byte[] - * arguments. This directive lets you specify which of those arguments - * should be converted to String arguments instead of - * byte[] .

- * - * For example, given the C prototype: - *

-   * void FuncName(const char* ugh, int bar, const char *foo, const char* goop);
-   * 
- * - * The emitter will normally emit: - *
-   * public abstract void FuncName(byte[] ugh, int bar, byte[] foo, byte[] goop);
-   * 
- * - * However, if you supplied the following directive: - * - *
-   * ArgumentIsString FuncName 0 2
-   * 
- * - * The emitter will instead emit: - *
-   * public abstract void FuncName(String ugh, int bar, String foo, byte[] goop);
-   * 
- * - */ - protected void readArgumentIsString(StringTokenizer tok, String filename, int lineNo) { - try { - String methodName = tok.nextToken(); - ArrayList argIndices = new ArrayList(2); - while (tok.hasMoreTokens()) { - Integer idx = Integer.valueOf(tok.nextToken()); - argIndices.add(idx); - } - - if(argIndices.size() > 0) { - argumentsAreString.put(methodName, argIndices); - } - else { - throw new RuntimeException("ERROR: Error parsing \"ArgumentIsString\" command at line " + lineNo + - " in file \"" + filename + "\": directive requires specification of at least 1 index"); - } - } catch (NoSuchElementException e) { - throw new RuntimeException( - "Error parsing \"ArgumentIsString\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readStructPackage(StringTokenizer tok, String filename, int lineNo) { - try { - String struct = tok.nextToken(); - String pkg = tok.nextToken(); - structPackages.put(struct, pkg); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"StructPackage\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readReturnValueCapacity(StringTokenizer tok, String filename, int lineNo) { - try { - String functionName = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - restOfLine = restOfLine.trim(); - returnValueCapacities.put(functionName, restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"ReturnValueCapacity\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readReturnValueLength(StringTokenizer tok, String filename, int lineNo) { - try { - String functionName = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - restOfLine = restOfLine.trim(); - returnValueLengths.put(functionName, restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"ReturnValueLength\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readTemporaryCVariableDeclaration(StringTokenizer tok, String filename, int lineNo) { - try { - String functionName = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - restOfLine = restOfLine.trim(); - List list = (List) temporaryCVariableDeclarations.get(functionName); - if (list == null) { - list = new ArrayList/**/(); - temporaryCVariableDeclarations.put(functionName, list); - } - list.add(restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"TemporaryCVariableDeclaration\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readTemporaryCVariableAssignment(StringTokenizer tok, String filename, int lineNo) { - try { - String functionName = tok.nextToken(); - String restOfLine = tok.nextToken("\n\r\f"); - restOfLine = restOfLine.trim(); - List list = (List) temporaryCVariableAssignments.get(functionName); - if (list == null) { - list = new ArrayList/**/(); - temporaryCVariableAssignments.put(functionName, list); - } - list.add(restOfLine); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"TemporaryCVariableAssignment\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void doInclude(StringTokenizer tok, File file, String filename, int lineNo) throws IOException { - try { - String includedFilename = tok.nextToken(); - File includedFile = new File(includedFilename); - if (!includedFile.isAbsolute()) { - includedFile = new File(file.getParentFile(), includedFilename); - } - read(includedFile.getAbsolutePath()); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"Include\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void doIncludeAs(StringTokenizer tok, File file, String filename, int lineNo) throws IOException { - try { - StringBuffer linePrefix = new StringBuffer(128); - while (tok.countTokens() > 1) - { - linePrefix.append(tok.nextToken()); - linePrefix.append(" "); - } - // last token is filename - String includedFilename = tok.nextToken(); - File includedFile = new File(includedFilename); - if (!includedFile.isAbsolute()) { - includedFile = new File(file.getParentFile(), includedFilename); - } - read(includedFile.getAbsolutePath(), linePrefix.toString()); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"IncludeAs\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - protected void readExtend(StringTokenizer tok, String filename, int lineNo) { - try { - String interfaceName = tok.nextToken(); - List intfs = extendedInterfaces(interfaceName); - intfs.add(tok.nextToken()); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"Extends\" command at line " + lineNo + - " in file \"" + filename + "\": missing expected parameter", e); - } - } - - protected void readImplements(StringTokenizer tok, String filename, int lineNo) { - try { - String className = tok.nextToken(); - List intfs = implementedInterfaces(className); - intfs.add(tok.nextToken()); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"Implements\" command at line " + lineNo + - " in file \"" + filename + "\": missing expected parameter", e); - } - } - - protected void readRenameJavaType(StringTokenizer tok, String filename, int lineNo) { - try { - String fromName = tok.nextToken(); - String toName = tok.nextToken(); - javaTypeRenames.put(fromName, toName); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"RenameJavaType\" command at line " + lineNo + - " in file \"" + filename + "\": missing expected parameter", e); - } - } - - protected static TypeInfo parseTypeInfo(String cType, JavaType javaType) { - String typeName = null; - int pointerDepth = 0; - int idx = 0; - while (idx < cType.length() && - (cType.charAt(idx) != ' ') && - (cType.charAt(idx) != '*')) { - ++idx; - } - typeName = cType.substring(0, idx); - // Count pointer depth - while (idx < cType.length()) { - if (cType.charAt(idx) == '*') { - ++pointerDepth; - } - ++idx; - } - return new TypeInfo(typeName, pointerDepth, javaType); - } - - protected void addTypeInfo(TypeInfo info) { - TypeInfo tmp = (TypeInfo) typeInfoMap.get(info.name()); - if (tmp == null) { - typeInfoMap.put(info.name(), info); - return; - } - while (tmp.next() != null) { - tmp = tmp.next(); - } - tmp.setNext(info); - } -} diff --git a/src/net/java/games/gluegen/JavaEmitter.java b/src/net/java/games/gluegen/JavaEmitter.java deleted file mode 100644 index ba412fb55..000000000 --- a/src/net/java/games/gluegen/JavaEmitter.java +++ /dev/null @@ -1,1414 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.io.*; -import java.util.*; -import java.text.MessageFormat; - -import net.java.games.gluegen.cgram.types.*; - -// PROBLEMS: -// - what if something returns 'const int *'? Could we -// return an IntBuffer that has read-only behavior? Or do we copy the array -// (but we don't know its size!). What do we do if it returns a non-const -// int*? Should the user be allowed to write back to the returned pointer? -// -// - Non-const array types must be properly released with JNI_COMMIT -// in order to see side effects if the array was copied. - - -public class JavaEmitter implements GlueEmitter { - private StructLayout layout; - private TypeDictionary typedefDictionary; - private TypeDictionary structDictionary; - private Map canonMap; - private JavaConfiguration cfg; - - /** - * Style of code emission. Can emit everything into one class - * (AllStatic), separate interface and implementing classes - * (InterfaceAndImpl), only the interface (InterfaceOnly), or only - * the implementation (ImplOnly). - */ - static final int ALL_STATIC = 1; - static final int INTERFACE_AND_IMPL = 2; - static final int INTERFACE_ONLY = 3; - static final int IMPL_ONLY = 4; - - private PrintWriter javaWriter; // Emits either interface or, in AllStatic mode, everything - private PrintWriter javaImplWriter; // Only used in non-AllStatic modes for impl class - private PrintWriter cWriter; - private MachineDescription machDesc; - - public void readConfigurationFile(String filename) throws Exception { - cfg = createConfig(); - cfg.read(filename); - } - - public void setMachineDescription(MachineDescription md) { - machDesc = md; - } - - public void beginEmission(GlueEmitterControls controls) throws IOException - { - try - { - openWriters(); - } - catch (Exception e) - { - throw new RuntimeException( - "Unable to open files for writing", e); - } - - emitAllFileHeaders(); - - // Request emission of any structs requested - for (Iterator iter = cfg.forcedStructs().iterator(); iter.hasNext(); ) { - controls.forceStructEmission((String) iter.next()); - } - } - - public void endEmission() - { - emitAllFileFooters(); - - try - { - closeWriters(); - } - catch (Exception e) - { - throw new RuntimeException( - "Unable to close open files", e); - } - } - - public void beginDefines() throws Exception - { - if (cfg.allStatic() || cfg.emitInterface()) { - javaWriter().println(); - } - } - - public void emitDefine(String name, String value, String optionalComment) throws Exception - { - if (cfg.allStatic() || cfg.emitInterface()) { - // TODO: Some defines (e.g., GL_DOUBLE_EXT in gl.h) are defined in terms - // of other defines -- should we emit them as references to the original - // define (not even sure if the lexer supports this)? Right now they're - // emitted as the numeric value of the original definition. If we decide - // emit them as references we'll also have to emit them in the correct - // order. It's probably not an issue right now because the emitter - // currently only emits only numeric defines -- if it handled #define'd - // objects it would make a bigger difference. - - if (!cfg.shouldIgnore(name)) { - String type = null; - - // FIXME: need to handle when type specifier is in last char (e.g., - // "1.0d or 2759L", because parseXXX() methods don't allow the type - // specifier character in the string. - // - //char lastChar = value.charAt(value.length()-1); - - try { - // see if it's a long or int - int radix; - String parseValue; - // FIXME: are you allowed to specify hex/octal constants with - // negation, e.g. "-0xFF" or "-056"? If so, need to modify the - // following "if(..)" checks and parseValue computation - if (value.startsWith("0x") || value.startsWith("0X")) { - radix = 16; - parseValue = value.substring(2); - } - else if (value.startsWith("0") && value.length() > 1) { - // TODO: is "0" the prefix in C to indicate octal??? - radix = 8; - parseValue = value.substring(1); - } - else { - radix = 10; - parseValue = value; - } - //System.err.println("parsing " + value + " as long w/ radix " + radix); - long longVal = Long.parseLong(parseValue, radix); - type = "long"; - // if constant is small enough, store it as an int instead of a long - if (longVal > Integer.MIN_VALUE && longVal < Integer.MAX_VALUE) { - type = "int"; - } - - } catch (NumberFormatException e) { - try { - // see if it's a double or float - double dVal = Double.parseDouble(value); - type = "double"; - // if constant is small enough, store it as a float instead of a double - if (dVal > Float.MIN_VALUE && dVal < Float.MAX_VALUE) { - type = "float"; - } - - } catch (NumberFormatException e2) { - throw new RuntimeException( - "Cannot emit define \""+name+"\": value \""+value+ - "\" cannot be assigned to a int, long, float, or double", e2); - } - } - - if (type == null) { - throw new RuntimeException( - "Cannot emit define (2) \""+name+"\": value \""+value+ - "\" cannot be assigned to a int, long, float, or double"); - } - if (optionalComment != null && optionalComment.length() != 0) { - javaWriter().println(" /** " + optionalComment + " */"); - } - javaWriter().println(" public static final " + type + " " + name + " = " + value + ";"); - } - } - } - - public void endDefines() throws Exception - { - } - - public void beginFunctions(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) throws Exception { - this.typedefDictionary = typedefDictionary; - this.structDictionary = structDictionary; - this.canonMap = canonMap; - if (cfg.allStatic() || cfg.emitInterface()) { - javaWriter().println(); - } - } - - public Iterator emitFunctions(List/**/ originalCFunctions) - throws Exception { - // Sometimes headers will have the same function prototype twice, once - // with the argument names and once without. We'll remember the signatures - // we've already processed we don't generate duplicate bindings. - // - // Note: this code assumes that on the equals() method in FunctionSymbol - // only considers function name and argument types (i.e., it does not - // consider argument *names*) when comparing FunctionSymbols for equality - Set funcsToBindSet = new HashSet(100); - for (Iterator cIter = originalCFunctions.iterator(); cIter.hasNext(); ) { - FunctionSymbol cFunc = (FunctionSymbol) cIter.next(); - if (!funcsToBindSet.contains(cFunc)) { - funcsToBindSet.add(cFunc); - } - } - - ArrayList funcsToBind = new ArrayList(funcsToBindSet.size()); - funcsToBind.addAll(funcsToBindSet); - // sort functions to make them easier to find in native code - Collections.sort( - funcsToBind, - new Comparator() { - public int compare(Object o1, Object o2) { - return ((FunctionSymbol)o1).getName().compareTo( - ((FunctionSymbol)o2).getName()); - } - public boolean equals(Object obj) { - return obj.getClass() == this.getClass(); - } - }); - - // Bind all the C funcs to Java methods - ArrayList/**/ methodBindingEmitters = new ArrayList(2*funcsToBind.size()); - for (Iterator iter = funcsToBind.iterator(); iter.hasNext(); ) { - FunctionSymbol cFunc = (FunctionSymbol) iter.next(); - // Check to see whether this function should be ignored - if (cfg.shouldIgnore(cFunc.getName())) { - continue; // don't generate bindings for this symbol - } - - List allBindings = generateMethodBindingEmitters(cFunc); - methodBindingEmitters.addAll(allBindings); - } - - // Emit all the methods - for (int i = 0; i < methodBindingEmitters.size(); ++i) { - FunctionEmitter emitter = (FunctionEmitter)methodBindingEmitters.get(i); - try { - emitter.emit(); - } catch (Exception e) { - throw new RuntimeException( - "Error while emitting binding for \"" + emitter.getName() + "\"", e); - } - emitter.getDefaultOutput().println(); // put newline after method body - } - - // Return the list of FunctionSymbols that we generated gluecode for - return funcsToBind.iterator(); - } - - /** - * Create the object that will read and store configuration information for - * this JavaEmitter. - */ - protected JavaConfiguration createConfig() { - return new JavaConfiguration(); - } - - /** - * Get the configuration information for this JavaEmitter. - */ - protected JavaConfiguration getConfig() { - return cfg; - } - - /** - * Generate all appropriate Java bindings for the specified C function - * symbols. - */ - protected List generateMethodBindingEmitters(FunctionSymbol sym) throws Exception { - - ArrayList/**/ allEmitters = new ArrayList(1); - - try { - // Get Java binding for the function - MethodBinding mb = bindFunction(sym, null, null); - - // Expand all void* arguments - List bindings = expandMethodBinding(mb); - boolean overloaded = (bindings.size() > 1); - if (overloaded) { - // resize ahead of time for speed - allEmitters.ensureCapacity(bindings.size()); - } - - // List of the indices of the arguments in this function that should be - // expanded to the same type when binding functions with multiple void* - // arguments - List mirrorIdxs = cfg.mirroredArgs(sym.getName()); - - for (Iterator iter = bindings.iterator(); iter.hasNext(); ) { - MethodBinding binding = (MethodBinding) iter.next(); - - // Honor the MirrorExpandedBindingArgs directive in .cfg files - if (mirrorIdxs != null) { - assert(mirrorIdxs.size() >= 2); // sanity check. - boolean typesMatch = true; - int argIndex = ((Integer)mirrorIdxs.get(0)).intValue(); - JavaType leftArgType = binding.getJavaArgumentType(argIndex); - for (int i = 1; i < mirrorIdxs.size(); ++i) { - argIndex = ((Integer)mirrorIdxs.get(i)).intValue(); - JavaType rightArgType = binding.getJavaArgumentType(argIndex); - if (!(leftArgType.equals(rightArgType))) { - typesMatch = false; - break; - } - leftArgType = rightArgType; - } - // Don't emit the binding if the specified args aren't the same type - if (!typesMatch) { continue; } // skip this binding - } - - // Try to create an NIOBuffer variant for this expanded binding. If - // it's the same as the original binding, then we'll be able to emit - // the binding like any normal binding because no special binding - // generation (wrapper methods, etc) will be necessary. - MethodBinding specialBinding = binding.createNIOBufferVariant(); - - if (cfg.allStatic() && binding.hasContainingType()) { - // This should not currently happen since structs are emitted using a different mechanism - throw new IllegalArgumentException("Cannot create binding in AllStatic mode because method has containing type: \"" + - binding + "\""); - } - - boolean isUnimplemented = cfg.isUnimplemented(binding.getName()); - - if (cfg.emitImpl()) { - // Generate the emitter for the method which may do conversion - // from type wrappers to NIO Buffers or which may call the - // underlying function directly - JavaMethodBindingImplEmitter entryPoint = - new JavaMethodBindingImplEmitter(binding, - (cfg.allStatic() ? javaWriter() : javaImplWriter()), - cfg.runtimeExceptionType(), - isUnimplemented); - entryPoint.addModifier(JavaMethodBindingEmitter.PUBLIC); - if (cfg.allStatic()) { - entryPoint.addModifier(JavaMethodBindingEmitter.STATIC); - } - if (!isUnimplemented && !bindingNeedsBody(binding)) { - entryPoint.addModifier(JavaMethodBindingEmitter.NATIVE); - } - entryPoint.setReturnedArrayLengthExpression(cfg.returnedArrayLength(binding.getName())); - allEmitters.add(entryPoint); - } - - if (cfg.emitInterface()) { - // Generate an emitter that will emit just the interface to the function - JavaMethodBindingEmitter entryPointInterface = - new JavaMethodBindingEmitter(binding, javaWriter(), cfg.runtimeExceptionType()); - entryPointInterface.addModifier(JavaMethodBindingEmitter.PUBLIC); - entryPointInterface.setReturnedArrayLengthExpression(cfg.returnedArrayLength(binding.getName())); - allEmitters.add(entryPointInterface); - } - - if (cfg.emitImpl()) { - // If the user has stated that the function will be - // manually implemented, then don't auto-generate a function body. - if (!cfg.manuallyImplement(sym.getName()) && !isUnimplemented) { - if (bindingNeedsBody(binding)) { - // Generate the method which calls the underlying C function - // after unboxing has occurred - PrintWriter output = cfg.allStatic() ? javaWriter() : javaImplWriter(); - JavaMethodBindingEmitter wrappedEntryPoint = - new JavaMethodBindingEmitter(specialBinding, output, cfg.runtimeExceptionType(), true); - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.PRIVATE); - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.STATIC); // Doesn't really matter - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.NATIVE); - allEmitters.add(wrappedEntryPoint); - } - - CMethodBindingEmitter cEmitter = - makeCEmitter(specialBinding, - overloaded, - (binding != specialBinding), - cfg.implPackageName(), cfg.implClassName(), - cWriter()); - allEmitters.add(cEmitter); - } - } - } // end iteration over expanded bindings - } catch (Exception e) { - throw new RuntimeException( - "Error while generating bindings for \"" + sym + "\"", e); - } - - return allEmitters; - } - - - public void endFunctions() throws Exception - { - if (cfg.allStatic() || cfg.emitInterface()) { - emitCustomJavaCode(javaWriter(), cfg.className()); - } - if (!cfg.allStatic() && cfg.emitImpl()) { - emitCustomJavaCode(javaImplWriter(), cfg.implClassName()); - } - } - - public void beginStructLayout() throws Exception {} - public void layoutStruct(CompoundType t) throws Exception { - getLayout().layout(t); - } - public void endStructLayout() throws Exception {} - - public void beginStructs(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) throws Exception { - this.typedefDictionary = typedefDictionary; - this.structDictionary = structDictionary; - this.canonMap = canonMap; - } - - public void emitStruct(CompoundType structType, String alternateName) throws Exception { - String name = structType.getName(); - if (name == null && alternateName != null) { - name = alternateName; - } - - if (name == null) { - System.err.println("WARNING: skipping emission of unnamed struct \"" + structType + "\""); - return; - } - - if (cfg.shouldIgnore(name)) { - return; - } - - Type containingCType = canonicalize(new PointerType(machDesc.pointerSizeInBytes(), structType, 0)); - JavaType containingType = typeToJavaType(containingCType, false); - if (!containingType.isCompoundTypeWrapper()) { - return; - } - String containingTypeName = containingType.getName(); - - boolean needsNativeCode = false; - for (int i = 0; i < structType.getNumFields(); i++) { - if (structType.getField(i).getType().isFunctionPointer()) { - needsNativeCode = true; - break; - } - } - - String structClassPkg = cfg.packageForStruct(name); - PrintWriter writer = null; - PrintWriter cWriter = null; - try - { - writer = openFile( - cfg.javaOutputDir() + File.separator + - CodeGenUtils.packageAsPath(structClassPkg) + - File.separator + containingTypeName + ".java"); - CodeGenUtils.emitAutogeneratedWarning(writer, this); - if (needsNativeCode) { - String nRoot = cfg.nativeOutputDir(); - if (cfg.nativeOutputUsesJavaHierarchy()) { - nRoot += - File.separator + - CodeGenUtils.packageAsPath(cfg.packageName()); - } - cWriter = openFile(nRoot + File.separator + containingTypeName + "_JNI.c"); - CodeGenUtils.emitAutogeneratedWarning(cWriter, this); - emitCHeader(cWriter, containingTypeName); - } - } - catch(Exception e) - { - throw new RuntimeException( - "Unable to open files for emission of struct class", e); - } - - writer.println(); - writer.println("package " + structClassPkg + ";"); - writer.println(); - writer.println("import java.nio.*;"); - writer.println(); - writer.println("import net.java.games.gluegen.runtime.*;"); - writer.println(); - List/**/ imports = cfg.imports(); - for (Iterator iter = imports.iterator(); iter.hasNext(); ) { - writer.print("import "); - writer.print(iter.next()); - writer.println(";"); - } - List/**/ javadoc = cfg.javadocForClass(containingTypeName); - for (Iterator iter = javadoc.iterator(); iter.hasNext(); ) { - writer.println((String) iter.next()); - } - writer.println(); - writer.print("public class " + containingTypeName + " "); - boolean firstIteration = true; - List/**/ userSpecifiedInterfaces = cfg.implementedInterfaces(containingTypeName); - for (Iterator iter = userSpecifiedInterfaces.iterator(); iter.hasNext(); ) { - if (firstIteration) { - writer.print("implements "); - } - firstIteration = false; - writer.print(iter.next()); - writer.print(" "); - } - writer.println("{"); - writer.println(" private StructAccessor accessor;"); - writer.println(); - writer.println(" public static int size() {"); - writer.println(" return " + structType.getSize() + ";"); - writer.println(" }"); - writer.println(); - writer.println(" public " + containingTypeName + "() {"); - writer.println(" this(BufferFactory.newDirectByteBuffer(size()));"); - writer.println(" }"); - writer.println(); - writer.println(" public " + containingTypeName + "(ByteBuffer buf) {"); - writer.println(" accessor = new StructAccessor(buf);"); - writer.println(" }"); - writer.println(); - writer.println(" public ByteBuffer getBuffer() {"); - writer.println(" return accessor.getBuffer();"); - writer.println(" }"); - for (int i = 0; i < structType.getNumFields(); i++) { - Field field = structType.getField(i); - Type fieldType = field.getType(); - if (!cfg.shouldIgnore(name + " " + field.getName())) { - if (fieldType.isFunctionPointer()) { - try { - // Emit method call and associated native code - FunctionType funcType = fieldType.asPointer().getTargetType().asFunction(); - FunctionSymbol funcSym = new FunctionSymbol(field.getName(), funcType); - MethodBinding binding = bindFunction(funcSym, containingType, containingCType); - binding.findThisPointer(); // FIXME: need to provide option to disable this on per-function basis - MethodBinding specialBinding = binding.createNIOBufferVariant(); - writer.println(); - - JavaMethodBindingEmitter entryPoint = new JavaMethodBindingImplEmitter(binding, writer, cfg.runtimeExceptionType()); - entryPoint.addModifier(JavaMethodBindingEmitter.PUBLIC); - if (!bindingNeedsBody(binding) && !binding.hasContainingType()) { - entryPoint.addModifier(JavaMethodBindingEmitter.NATIVE); - } - entryPoint.emit(); - - JavaMethodBindingEmitter wrappedEntryPoint = new JavaMethodBindingEmitter(specialBinding, writer, cfg.runtimeExceptionType(), true); - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.PRIVATE); - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.NATIVE); - wrappedEntryPoint.emit(); - - CMethodBindingEmitter cEmitter = - makeCEmitter(specialBinding, - false, // overloaded - true, // doing impl routine? - structClassPkg, - containingTypeName, - cWriter); - cEmitter.emit(); - } catch (Exception e) { - System.err.println("While processing field " + field + " of type " + name + ":"); - throw(e); - } - } else if (fieldType.isCompound()) { - // FIXME: will need to support this at least in order to - // handle the union in jawt_Win32DrawingSurfaceInfo (fabricate - // a name?) - if (fieldType.getName() == null) { - throw new RuntimeException("Anonymous structs as fields not supported yet (field \"" + - field + "\" in type \"" + name + "\")"); - } - - writer.println(); - writer.println(" public " + fieldType.getName() + " " + field.getName() + "() {"); - writer.println(" return new " + fieldType.getName() + "(accessor.slice(" + - field.getOffset() + ", " + fieldType.getSize() + "));"); - writer.println(" }"); - - // FIXME: add setter by autogenerating "copyTo" for all compound type wrappers - } else if (fieldType.isArray()) { - System.err.println("WARNING: Array fields (field \"" + field + "\" of type \"" + name + - "\") not implemented yet"); - } else { - JavaType javaType = null; - try { - javaType = typeToJavaType(fieldType, false); - } catch (Exception e) { - System.err.println("Error occurred while creating accessor for field \"" + - field.getName() + "\" in type \"" + name + "\""); - e.printStackTrace(); - throw(e); - } - if (javaType.isPrimitive()) { - // Primitive type - String externalJavaTypeName = javaType.getName(); - String internalJavaTypeName = externalJavaTypeName; - if (isOpaque(fieldType)) { - internalJavaTypeName = compatiblePrimitiveJavaTypeName(fieldType, javaType); - } - String capitalized = - "" + Character.toUpperCase(internalJavaTypeName.charAt(0)) + internalJavaTypeName.substring(1); - int slot = slot(fieldType, (int) field.getOffset()); - // Setter - writer.println(); - writer.println(" public " + containingTypeName + " " + field.getName() + "(" + externalJavaTypeName + " val) {"); - writer.print (" accessor.set" + capitalized + "At(" + slot + ", "); - if (!externalJavaTypeName.equals(internalJavaTypeName)) { - writer.print("(" + internalJavaTypeName + ") "); - } - writer.println("val);"); - writer.println(" return this;"); - writer.println(" }"); - // Getter - writer.println(); - writer.println(" public " + externalJavaTypeName + " " + field.getName() + "() {"); - writer.print (" return "); - if (!externalJavaTypeName.equals(internalJavaTypeName)) { - writer.print("(" + externalJavaTypeName + ") "); - } - writer.println("accessor.get" + capitalized + "At(" + slot + ");"); - writer.println(" }"); - } else { - // FIXME - System.err.println("WARNING: Complicated fields (field \"" + field + "\" of type \"" + name + - "\") not implemented yet"); - // throw new RuntimeException("Complicated fields (field \"" + field + "\" of type \"" + t + - // "\") not implemented yet"); - } - } - } - } - emitCustomJavaCode(writer, containingTypeName); - writer.println("}"); - writer.flush(); - writer.close(); - if (needsNativeCode) { - cWriter.flush(); - cWriter.close(); - } - } - public void endStructs() throws Exception {} - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected boolean bindingNeedsBody(MethodBinding binding) { - // We need to perform NIO checks and conversions and array length - // checks - return binding.signatureUsesNIO() || binding.signatureUsesCArrays(); - } - - private CMethodBindingEmitter makeCEmitter(MethodBinding binding, - boolean overloaded, - boolean doingImplRoutine, - String bindingJavaPackageName, - String bindingJavaClassName, - PrintWriter output) { - MessageFormat returnValueCapacityFormat = null; - MessageFormat returnValueLengthFormat = null; - JavaType javaReturnType = binding.getJavaReturnType(); - if (javaReturnType.isNIOBuffer()) { - // See whether capacity has been specified - String capacity = cfg.returnValueCapacity(binding.getName()); - if (capacity != null) { - returnValueCapacityFormat = new MessageFormat(capacity); - } - } else if (javaReturnType.isArray()) { - // See whether length has been specified - String len = cfg.returnValueLength(binding.getName()); - if (len != null) { - returnValueLengthFormat = new MessageFormat(len); - } - } - CMethodBindingEmitter cEmitter; - if (doingImplRoutine) { - cEmitter = new CMethodBindingImplEmitter(binding, overloaded, - bindingJavaPackageName, - bindingJavaClassName, - cfg.allStatic(), output); - } else { - cEmitter = new CMethodBindingEmitter(binding, overloaded, - bindingJavaPackageName, - bindingJavaClassName, - cfg.allStatic(), output); - } - if (returnValueCapacityFormat != null) { - cEmitter.setReturnValueCapacityExpression(returnValueCapacityFormat); - } - if (returnValueLengthFormat != null) { - cEmitter.setReturnValueLengthExpression(returnValueLengthFormat); - } - cEmitter.setTemporaryCVariableDeclarations(cfg.temporaryCVariableDeclarations(binding.getName())); - cEmitter.setTemporaryCVariableAssignments(cfg.temporaryCVariableAssignments(binding.getName())); - return cEmitter; - } - - private JavaType typeToJavaType(Type cType, boolean outgoingArgument) { - // Recognize JNIEnv* case up front - PointerType opt = cType.asPointer(); - if ((opt != null) && - (opt.getTargetType().getName() != null) && - (opt.getTargetType().getName().equals("JNIEnv"))) { - return JavaType.createForJNIEnv(); - } - - // Opaque specifications override automatic conversions - TypeInfo info = cfg.typeInfo(cType, typedefDictionary); - if (info != null) { - return info.javaType(); - } - Type t = cType; - if (t.isInt() || t.isEnum()) { - switch (t.getSize()) { - case 1: return javaType(Byte.TYPE); - case 2: return javaType(Short.TYPE); - case 4: return javaType(Integer.TYPE); - case 8: return javaType(Long.TYPE); - default: throw new RuntimeException("Unknown integer type of size " + - t.getSize() + " and name " + t.getName()); - } - } else if (t.isFloat()) { - return javaType(Float.TYPE); - } else if (t.isDouble()) { - return javaType(Double.TYPE); - } else if (t.isVoid()) { - return javaType(Void.TYPE); - } else { - if (t.pointerDepth() > 0 || t.arrayDimension() > 0) { - Type targetType; // target type - if (t.isPointer()) { - // t is *, we need to get - targetType = t.asPointer().getTargetType(); - } else { - // t is [], we need to get - targetType = t.asArray().getElementType(); - } - - // Handle Types of form pointer-to-type or array-of-type, like - // char* or int[]; these are expanded out into Java primitive - // arrays, NIO buffers, or both in expandMethodBinding - if (t.pointerDepth() == 1 || t.arrayDimension() == 1) { - if (targetType.isVoid()) { - return JavaType.createForVoidPointer(); - } else if (targetType.isInt()) { - switch (targetType.getSize()) { - case 1: return JavaType.createForCCharPointer(); - case 2: return JavaType.createForCShortPointer(); - case 4: return JavaType.createForCInt32Pointer(); - case 8: return JavaType.createForCInt64Pointer(); - default: throw new RuntimeException("Unknown integer array type of size " + - t.getSize() + " and name " + t.getName()); - } - } else if (targetType.isFloat()) { - return JavaType.createForCFloatPointer(); - } else if (targetType.isDouble()) { - return JavaType.createForCDoublePointer(); - } else if (targetType.isCompound()) { - if (t.isArray()) { - throw new RuntimeException("Arrays of compound types not handled yet"); - } - // Special cases for known JNI types (in particular for converting jawt.h) - if (t.getName() != null && - t.getName().equals("jobject")) { - return javaType(java.lang.Object.class); - } - - String name = targetType.getName(); - if (name == null) { - // Try containing pointer type for any typedefs - name = t.getName(); - if (name == null) { - throw new RuntimeException("Couldn't find a proper type name for pointer type " + t); - } - } - - return JavaType.createForCStruct(cfg.renameJavaType(name)); - } else { - throw new RuntimeException("Don't know how to convert pointer/array type \"" + - t + "\""); - } - } - // Handle Types of form pointer-to-pointer-to-type or - // array-of-arrays-of-type, like char** or int[][] - else if (t.pointerDepth() == 2 || t.arrayDimension() == 2) { - // Get the target type of the target type (targetType was computer earlier - // as to be a pointer to the target type, so now we need to get its - // target type) - Type bottomType; - if (targetType.isPointer()) { - // t is**, targetType is *, we need to get - bottomType = targetType.asPointer().getTargetType(); - } else { - // t is[][], targetType is [], we need to get - bottomType = targetType.asArray().getElementType(); - } - - if (bottomType.isPrimitive()) { - if (bottomType.isInt()) { - switch (bottomType.getSize()) { - case 1: return javaType(ArrayTypes.byteBufferArrayClass); - case 2: return javaType(ArrayTypes.shortBufferArrayClass); - case 4: return javaType(ArrayTypes.intBufferArrayClass); - case 8: return javaType(ArrayTypes.longBufferArrayClass); - default: throw new RuntimeException("Unknown two-dimensional integer array type of element size " + - bottomType.getSize() + " and name " + bottomType.getName()); - } - } else if (bottomType.isFloat()) { - return javaType(ArrayTypes.floatBufferArrayClass); - } else if (bottomType.isDouble()) { - return javaType(ArrayTypes.doubleBufferArrayClass); - } else { - throw new RuntimeException("Unexpected primitive type " + bottomType.getName() + - " in two-dimensional array"); - } - } else if (bottomType.isVoid()) { - return javaType(ArrayTypes.bufferArrayClass); - } else if (targetType.isPointer() && (targetType.pointerDepth() == 1) && - targetType.asPointer().getTargetType().isCompound()) { - // Array of pointers; convert as array of StructAccessors - return JavaType.createForCArray(targetType); - } else { - throw new RuntimeException( - "Could not convert C type \"" + t + "\" " + - "to appropriate Java type; need to add more support for " + - "depth=2 pointer/array types [debug info: targetType=\"" + - targetType + "\"]"); - } - } else { - // can't handle this type of pointer/array argument - throw new RuntimeException( - "Could not convert C pointer/array \"" + t + "\" to " + - "appropriate Java type; types with pointer/array depth " + - "greater than 2 are not yet supported [debug info: " + - "pointerDepth=" + t.pointerDepth() + " arrayDimension=" + - t.arrayDimension() + " targetType=\"" + targetType + "\"]"); - } - - } else { - throw new RuntimeException( - "Could not convert C type \"" + t + "\" (class " + - t.getClass().getName() + ") to appropriate Java type"); - } - } - } - - private static boolean isIntegerType(Class c) { - return ((c == Byte.TYPE) || - (c == Short.TYPE) || - (c == Character.TYPE) || - (c == Integer.TYPE) || - (c == Long.TYPE)); - } - - private int slot(Type t, int byteOffset) { - if (t.isInt()) { - switch (t.getSize()) { - case 1: - case 2: - case 4: - case 8: return byteOffset / t.getSize(); - default: throw new RuntimeException("Illegal type"); - } - } else if (t.isFloat()) { - return byteOffset / 4; - } else if (t.isDouble()) { - return byteOffset / 8; - } else if (t.isPointer()) { - return byteOffset / machDesc.pointerSizeInBytes(); - } else { - throw new RuntimeException("Illegal type " + t); - } - } - - private StructLayout getLayout() { - if (layout == null) { - layout = StructLayout.createForCurrentPlatform(); - } - return layout; - } - - protected PrintWriter openFile(String filename) throws IOException { - //System.out.println("Trying to open: " + filename); - File file = new File(filename); - String parentDir = file.getParent(); - if (parentDir != null) - { - File pDirFile = new File(parentDir); - pDirFile.mkdirs(); - } - return new PrintWriter(new BufferedWriter(new FileWriter(file))); - } - - private boolean isOpaque(Type type) { - return (cfg.typeInfo(type, typedefDictionary) != null); - } - - private String compatiblePrimitiveJavaTypeName(Type fieldType, - JavaType javaType) { - Class c = javaType.getJavaClass(); - if (!isIntegerType(c)) { - // FIXME - throw new RuntimeException("Can't yet handle opaque definitions of structs' fields to non-integer types (byte, short, int, long, etc.)"); - } - switch (fieldType.getSize()) { - case 1: return "byte"; - case 2: return "short"; - case 4: return "int"; - case 8: return "long"; - default: throw new RuntimeException("Can't handle opaque definitions if the starting type isn't compatible with integral types"); - } - } - - private void openWriters() throws IOException { - String jRoot = - cfg.javaOutputDir() + File.separator + - CodeGenUtils.packageAsPath(cfg.packageName()); - String jImplRoot = null; - if (!cfg.allStatic()) { - jImplRoot = - cfg.javaOutputDir() + File.separator + - CodeGenUtils.packageAsPath(cfg.implPackageName()); - } - String nRoot = cfg.nativeOutputDir(); - if (cfg.nativeOutputUsesJavaHierarchy()) - { - nRoot += - File.separator + CodeGenUtils.packageAsPath(cfg.packageName()); - } - - if (cfg.allStatic() || cfg.emitInterface()) { - javaWriter = openFile(jRoot + File.separator + cfg.className() + ".java"); - } - if (!cfg.allStatic() && cfg.emitImpl()) { - javaImplWriter = openFile(jImplRoot + File.separator + cfg.implClassName() + ".java"); - } - if (cfg.emitImpl()) { - cWriter = openFile(nRoot + File.separator + cfg.implClassName() + "_JNI.c"); - } - - if (javaWriter != null) { - CodeGenUtils.emitAutogeneratedWarning(javaWriter, this); - } - if (javaImplWriter != null) { - CodeGenUtils.emitAutogeneratedWarning(javaImplWriter, this); - } - if (cWriter != null) { - CodeGenUtils.emitAutogeneratedWarning(cWriter, this); - } - } - - protected PrintWriter javaWriter() { - if (!cfg.allStatic() && !cfg.emitInterface()) { - throw new InternalError("Should not call this"); - } - return javaWriter; - } - - protected PrintWriter javaImplWriter() { - if (cfg.allStatic() || !cfg.emitImpl()) { - throw new InternalError("Should not call this"); - } - return javaImplWriter; - } - - protected PrintWriter cWriter() { - if (!cfg.emitImpl()) { - throw new InternalError("Should not call this"); - } - return cWriter; - } - - private void closeWriter(PrintWriter writer) throws IOException { - writer.flush(); - writer.close(); - } - - private void closeWriters() throws IOException { - if (javaWriter != null) { - closeWriter(javaWriter); - } - if (javaImplWriter != null) { - closeWriter(javaImplWriter); - } - if (cWriter != null) { - closeWriter(cWriter); - } - javaWriter = null; - javaImplWriter = null; - cWriter = null; - } - - /** - * Returns the value that was specified by the configuration directive - * "JavaOutputDir", or the default if none was specified. - */ - protected String getJavaOutputDir() { - return cfg.javaOutputDir(); - } - - /** - * Returns the value that was specified by the configuration directive - * "Package", or the default if none was specified. - */ - protected String getJavaPackageName() { - return cfg.packageName(); - } - - /** - * Returns the value that was specified by the configuration directive - * "ImplPackage", or the default if none was specified. - */ - protected String getImplPackageName() { - return cfg.implPackageName(); - } - - /** - * Emit all the strings specified in the "CustomJavaCode" parameters of - * the configuration file. - */ - protected void emitCustomJavaCode(PrintWriter writer, String className) throws Exception - { - List code = cfg.customJavaCodeForClass(className); - if (code.size() == 0) - return; - - writer.println(); - writer.println(" // --- Begin CustomJavaCode .cfg declarations"); - for (Iterator iter = code.iterator(); iter.hasNext(); ) { - writer.println((String) iter.next()); - } - writer.println(" // ---- End CustomJavaCode .cfg declarations"); - } - - /** - * Write out any header information for the output files (class declaration - * and opening brace, import statements, etc). - */ - protected void emitAllFileHeaders() throws IOException { - try { - if (cfg.allStatic() || cfg.emitInterface()) { - String[] interfaces; - List userSpecifiedInterfaces = null; - if (cfg.emitInterface()) { - userSpecifiedInterfaces = cfg.extendedInterfaces(cfg.className()); - } else { - userSpecifiedInterfaces = cfg.implementedInterfaces(cfg.className()); - } - interfaces = new String[userSpecifiedInterfaces.size()]; - userSpecifiedInterfaces.toArray(interfaces); - - final List/**/ intfDocs = cfg.javadocForClass(cfg.className()); - CodeGenUtils.EmissionCallback docEmitter = - new CodeGenUtils.EmissionCallback() { - public void emit(PrintWriter w) { - for (Iterator iter = intfDocs.iterator(); iter.hasNext(); ) { - w.println((String) iter.next()); - } - } - }; - - CodeGenUtils.emitJavaHeaders( - javaWriter, - cfg.packageName(), - cfg.className(), - cfg.allStatic() ? true : false, - (String[]) cfg.imports().toArray(new String[] {}), - new String[] { "public" }, - interfaces, - null, - docEmitter); - } - - if (!cfg.allStatic() && cfg.emitImpl()) { - final List/**/ implDocs = cfg.javadocForClass(cfg.className()); - CodeGenUtils.EmissionCallback docEmitter = - new CodeGenUtils.EmissionCallback() { - public void emit(PrintWriter w) { - for (Iterator iter = implDocs.iterator(); iter.hasNext(); ) { - w.println((String) iter.next()); - } - } - }; - - String[] interfaces; - List userSpecifiedInterfaces = null; - userSpecifiedInterfaces = cfg.implementedInterfaces(cfg.implClassName()); - interfaces = new String[1 + userSpecifiedInterfaces.size()]; - userSpecifiedInterfaces.toArray(interfaces); - interfaces[userSpecifiedInterfaces.size()] = cfg.className(); - - CodeGenUtils.emitJavaHeaders( - javaImplWriter, - cfg.implPackageName(), - cfg.implClassName(), - true, - (String[]) cfg.imports().toArray(new String[] {}), - new String[] { "public" }, - interfaces, - null, - docEmitter); - } - - if (cfg.emitImpl()) { - PrintWriter cWriter = cWriter(); - emitCHeader(cWriter, cfg.implClassName()); - } - } catch (Exception e) { - throw new RuntimeException( - "Error emitting all file headers: cfg.allStatic()=" + cfg.allStatic() + - " cfg.emitImpl()=" + cfg.emitImpl() + " cfg.emitInterface()=" + cfg.emitInterface(), - e); - } - - } - - protected void emitCHeader(PrintWriter cWriter, String className) { - cWriter.println("#include "); - cWriter.println(); - - if (getConfig().emitImpl()) { - cWriter.println("#include "); - cWriter.println(); - } - - for (Iterator iter = cfg.customCCode().iterator(); iter.hasNext(); ) { - cWriter.println((String) iter.next()); - } - cWriter.println(); - } - - /** - * Write out any footer information for the output files (closing brace of - * class definition, etc). - */ - protected void emitAllFileFooters(){ - if (cfg.allStatic() || cfg.emitInterface()) { - javaWriter().println(); - javaWriter().println("} // end of class " + cfg.className()); - } - if (!cfg.allStatic() && cfg.emitImpl()) - { - javaImplWriter().println(); - javaImplWriter().println("} // end of class " + cfg.implClassName()); - } - } - - private JavaType javaType(Class c) { - return JavaType.createForClass(c); - } - - private MethodBinding bindFunction(FunctionSymbol sym, - JavaType containingType, - Type containingCType) { - - MethodBinding binding = new MethodBinding(sym, containingType, containingCType); - - if (cfg.returnsString(binding.getName())) { - PointerType prt = sym.getReturnType().asPointer(); - if (prt == null || - prt.getTargetType().asInt() == null || - prt.getTargetType().getSize() != 1) { - throw new RuntimeException( - "Cannot apply ReturnsString configuration directive to \"" + sym + - "\". ReturnsString requires native method to have return type \"char *\""); - } - binding.setJavaReturnType(javaType(java.lang.String.class)); - } else { - binding.setJavaReturnType(typeToJavaType(sym.getReturnType(), false)); - } - - // List of the indices of the arguments in this function that should be - // converted from byte[] to String - List stringArgIndices = cfg.stringArguments(binding.getName()); - - for (int i = 0; i < sym.getNumArguments(); i++) { - Type cArgType = sym.getArgumentType(i); - JavaType mappedType = typeToJavaType(cArgType, true); - //System.out.println("C arg type -> \"" + cArgType + "\"" ); - //System.out.println(" Java -> \"" + mappedType + "\"" ); - - // Take into account any ArgumentIsString configuration directives that apply - if (stringArgIndices != null && stringArgIndices.contains(new Integer(i))) { - //System.out.println("Forcing conversion of " + binding.getName() + " arg #" + i + " from byte[] to String "); - if (mappedType.isCVoidPointerType() || - mappedType.isCCharPointerType() || - (mappedType.isArray() && mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass)) { - // convert mapped type from void* and byte[] to String, or ByteBuffer[] to String[] - if (mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass) { - mappedType = javaType(ArrayTypes.stringArrayClass); - } else { - mappedType = javaType(String.class); - } - } - else { - throw new RuntimeException( - "Cannot apply ArgumentIsString configuration directive to " + - "argument " + i + " of \"" + sym + "\": argument type is not " + - "a \"void*\", \"char *\", or \"char**\" equivalent"); - } - } - binding.addJavaArgumentType(mappedType); - //System.out.println("During binding of [" + sym + "], added mapping from C type: " + cArgType + " to Java type: " + mappedType); - } - - //System.err.println("---> " + binding); - //System.err.println(" ---> " + binding.getCSymbol()); - return binding; - } - - // Expands a MethodBinding containing C primitive pointer types into - // multiple variants taking Java primitive arrays and NIO buffers, subject - // to the per-function "NIO only" rule in the configuration file - private List/**/ expandMethodBinding(MethodBinding binding) { - List result = new ArrayList(); - result.add(binding); - int i = 0; - while (i < result.size()) { - MethodBinding mb = (MethodBinding) result.get(i); - boolean shouldRemoveCurrent = false; - for (int j = 0; j < mb.getNumArguments(); j++) { - JavaType t = mb.getJavaArgumentType(j); - if (t.isCPrimitivePointerType()) { - // Remove original from list - shouldRemoveCurrent = true; - MethodBinding variant = null; - - // Non-NIO variants for void* and other C primitive pointer types - if (!cfg.nioOnly(mb.getCSymbol().getName())) { - if (t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.booleanArrayClass)); - if (! result.contains(variant)) result.add(variant); - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.charArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - if (t.isCCharPointerType() || t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.byteArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - if (t.isCShortPointerType() || t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.shortArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - if (t.isCInt32PointerType() || t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.intArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - if (t.isCInt64PointerType() || t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.longArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - if (t.isCFloatPointerType() || t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.floatArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - if (t.isCDoublePointerType() || t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, javaType(ArrayTypes.doubleArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - } - - // NIO variants for void* and other C primitive pointer types - if (!cfg.noNio(mb.getCSymbol().getName())) { - if (t.isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIOBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - } - - if ((cfg.nioMode() == JavaConfiguration.NIO_MODE_ALL_POINTERS && !cfg.noNio(mb.getCSymbol().getName())) || - (cfg.nioMode() == JavaConfiguration.NIO_MODE_VOID_ONLY && cfg.forcedNio(mb.getCSymbol().getName()))) { - if (t.isCCharPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIOByteBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - - if (t.isCShortPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIOShortBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - - if (t.isCInt32PointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIOIntBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - - if (t.isCInt64PointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIOLongBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - - if (t.isCFloatPointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIOFloatBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - - if (t.isCDoublePointerType()) { - variant = mb.createCPrimitivePointerVariant(j, JavaType.forNIODoubleBufferClass()); - if (! result.contains(variant)) result.add(variant); - } - } - } - } - if (mb.getJavaReturnType().isCPrimitivePointerType()) { - MethodBinding variant = null; - if (mb.getJavaReturnType().isCVoidPointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, JavaType.forNIOByteBufferClass()); - if (! result.contains(variant)) result.add(variant); - } else if (mb.getJavaReturnType().isCCharPointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, javaType(ArrayTypes.byteArrayClass)); - if (! result.contains(variant)) result.add(variant); - } else if (mb.getJavaReturnType().isCShortPointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, javaType(ArrayTypes.shortArrayClass)); - if (! result.contains(variant)) result.add(variant); - } else if (mb.getJavaReturnType().isCInt32PointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, javaType(ArrayTypes.intArrayClass)); - if (! result.contains(variant)) result.add(variant); - } else if (mb.getJavaReturnType().isCInt64PointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, javaType(ArrayTypes.longArrayClass)); - if (! result.contains(variant)) result.add(variant); - } else if (mb.getJavaReturnType().isCFloatPointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, javaType(ArrayTypes.floatArrayClass)); - if (! result.contains(variant)) result.add(variant); - } else if (mb.getJavaReturnType().isCDoublePointerType()) { - variant = mb.createCPrimitivePointerVariant(-1, javaType(ArrayTypes.doubleArrayClass)); - if (! result.contains(variant)) result.add(variant); - } - shouldRemoveCurrent = true; - } - if (shouldRemoveCurrent) { - result.remove(i); - --i; - } - ++i; - } - - // Honor the flattenNIOVariants directive in the configuration file - if (cfg.flattenNIOVariants()) { - i = 0; - while (i < result.size()) { - boolean shouldRemoveCurrent = false; - MethodBinding mb = (MethodBinding) result.get(i); - for (int j = 0; j < binding.getNumArguments() && !shouldRemoveCurrent; j++) { - JavaType t1 = binding.getJavaArgumentType(j); - if (t1.isCPrimitivePointerType() && !t1.isCVoidPointerType()) { - for (int k = j + 1; k < binding.getNumArguments() && !shouldRemoveCurrent; k++) { - JavaType t2 = binding.getJavaArgumentType(k); - if (t2.isCPrimitivePointerType() && !t2.isCVoidPointerType()) { - // The "NIO-ness" of the converted arguments in the - // new binding must match - JavaType nt1 = mb.getJavaArgumentType(j); - JavaType nt2 = mb.getJavaArgumentType(k); - if (nt1.isNIOBuffer() != nt2.isNIOBuffer()) { - shouldRemoveCurrent = true; - } - } - } - } - } - if (shouldRemoveCurrent) { - result.remove(i); - --i; - } - - ++i; - } - } - - return result; - } - - private String resultName() { - return "_res"; - } - - private Type canonicalize(Type t) { - Type res = (Type) canonMap.get(t); - if (res != null) { - return res; - } - canonMap.put(t, t); - return t; - } -} diff --git a/src/net/java/games/gluegen/JavaMethodBindingEmitter.java b/src/net/java/games/gluegen/JavaMethodBindingEmitter.java deleted file mode 100644 index 72d349356..000000000 --- a/src/net/java/games/gluegen/JavaMethodBindingEmitter.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; -import java.io.*; - -import net.java.games.gluegen.cgram.types.*; -import net.java.games.gluegen.cgram.*; - -/** - * An emitter that emits only the interface for a Java<->C JNI binding. - */ -public class JavaMethodBindingEmitter extends FunctionEmitter -{ - public static final EmissionModifier PUBLIC = new EmissionModifier("public"); - public static final EmissionModifier PROTECTED = new EmissionModifier("protected"); - public static final EmissionModifier PRIVATE = new EmissionModifier("private"); - public static final EmissionModifier ABSTRACT = new EmissionModifier("abstract"); - public static final EmissionModifier FINAL = new EmissionModifier("final"); - public static final EmissionModifier NATIVE = new EmissionModifier("native"); - public static final EmissionModifier SYNCHRONIZED = new EmissionModifier("synchronized"); - - protected static final CommentEmitter defaultJavaCommentEmitter = new DefaultCommentEmitter(); - protected static final CommentEmitter defaultInterfaceCommentEmitter = - new InterfaceCommentEmitter(); - - // Exception type raised in the generated code if runtime checks fail - private String runtimeExceptionType; - - private MethodBinding binding; - private boolean forImplementingMethodCall; - - // A non-null value indicates that rather than returning a compound - // type accessor we are returning an array of such accessors; this - // expression is a MessageFormat string taking the names of the - // incoming Java arguments as parameters and computing as an int the - // number of elements of the returned array. - private String returnedArrayLengthExpression; - - public JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType) - { - this(binding, output, runtimeExceptionType, false); - } - - public JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType, boolean forImplementingMethodCall) - { - super(output); - this.binding = binding; - this.forImplementingMethodCall = forImplementingMethodCall; - this.runtimeExceptionType = runtimeExceptionType; - setCommentEmitter(defaultInterfaceCommentEmitter); - } - - public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg) { - super(arg); - runtimeExceptionType = arg.runtimeExceptionType; - binding = arg.binding; - forImplementingMethodCall = arg.forImplementingMethodCall; - returnedArrayLengthExpression = arg.returnedArrayLengthExpression; - } - - public final MethodBinding getBinding() { return binding; } - - public boolean isForImplementingMethodCall() { return forImplementingMethodCall; } - - public String getName() { - return binding.getName(); - } - - - /** The type of exception (must subclass - java.lang.RuntimeException) raised if runtime - checks fail in the generated code. */ - public String getRuntimeExceptionType() { - return runtimeExceptionType; - } - - /** If the underlying function returns an array (currently only - arrays of compound types are supported) as opposed to a pointer - to an object, this method should be called to provide a - MessageFormat string containing an expression that computes the - number of elements of the returned array. The parameters to the - MessageFormat expression are the names of the incoming Java - arguments. */ - public void setReturnedArrayLengthExpression(String expr) { - returnedArrayLengthExpression = expr; - } - - protected void emitReturnType(PrintWriter writer) - { - writer.print(getReturnTypeString(false)); - } - - protected String getReturnTypeString(boolean skipArray) { - if (skipArray || (getReturnedArrayLengthExpression() == null && !binding.getJavaReturnType().isArrayOfCompoundTypeWrappers())) { - return binding.getJavaReturnType().getName(); - } - return binding.getJavaReturnType().getName() + "[]"; - } - - protected void emitName(PrintWriter writer) - { - if (forImplementingMethodCall) { - writer.print(getImplMethodName()); - } else { - writer.print(getName()); - } - } - - protected int emitArguments(PrintWriter writer) - { - boolean needComma = false; - int numEmitted = 0; - - if (forImplementingMethodCall && binding.hasContainingType()) { - // Always emit outgoing "this" argument - writer.print("java.nio.Buffer "); - writer.print(javaThisArgumentName()); - ++numEmitted; - needComma = true; - } - - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); - if (type.isVoid()) { - // Make sure this is the only param to the method; if it isn't, - // there's something wrong with our parsing of the headers. - if (binding.getNumArguments() != 1) { - throw new InternalError( - "\"void\" argument type found in " + - "multi-argument function \"" + binding + "\""); - } - continue; - } - - if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { - // Don't need to expose these at the Java level - continue; - } - - if (needComma) { - writer.print(", "); - } - - writer.print(type.getName()); - writer.print(" "); - writer.print(binding.getArgumentName(i)); - ++numEmitted; - needComma = true; - } - return numEmitted; - } - - protected String getImplMethodName() - { - return binding.getName() + "0"; - } - - protected void emitBody(PrintWriter writer) - { - writer.println(';'); - } - - protected static String javaThisArgumentName() { - return "jthis0"; - } - - protected String getCommentStartString() { return "/** "; } - - protected String getBaseIndentString() { return " "; } - - protected String getReturnedArrayLengthExpression() { - return returnedArrayLengthExpression; - } - - /** - * Class that emits a generic comment for JavaMethodBindingEmitters; the comment - * includes the C signature of the native method that is being bound by the - * emitter java method. - */ - protected static class DefaultCommentEmitter implements CommentEmitter { - public void emit(FunctionEmitter emitter, PrintWriter writer) { - emitBeginning(emitter, writer); - emitBindingCSignature(((JavaMethodBindingEmitter)emitter).getBinding(), writer); - emitEnding(emitter, writer); - } - protected void emitBeginning(FunctionEmitter emitter, PrintWriter writer) { - writer.print("Entry point to C language function:
"); - } - protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { - writer.print(" "); - writer.print(binding.getCSymbol()); - writer.print(" "); - } - protected void emitEnding(FunctionEmitter emitter, PrintWriter writer) { - // If argument type is a named enum, then emit a comment detailing the - // acceptable values of that enum. - MethodBinding binding = ((JavaMethodBindingEmitter)emitter).getBinding(); - for (int i = 0; i < binding.getNumArguments(); i++) { - Type type = binding.getCArgumentType(i); - // don't emit param comments for anonymous enums, since we can't - // distinguish between the values found within multiple anonymous - // enums in the same C translation unit. - if (type.isEnum() && type.getName() != HeaderParser.ANONYMOUS_ENUM_NAME) { - EnumType enumType = (EnumType)type; - writer.println(); - writer.print(emitter.getBaseIndentString()); - writer.print(" "); - writer.print("@param "); - writer.print(binding.getArgumentName(i)); - writer.print(" valid values are: "); - for (int j = 0; j < enumType.getNumEnumerates(); ++j) { - if (j>0) writer.print(", "); - writer.print(enumType.getEnumName(j)); - } - writer.println(""); - } - } - } - } - - protected static class InterfaceCommentEmitter - extends JavaMethodBindingEmitter.DefaultCommentEmitter - { - protected void emitBeginning(FunctionEmitter emitter, - PrintWriter writer) { - writer.print("Interface to C language function:
"); - } - } -} - diff --git a/src/net/java/games/gluegen/JavaMethodBindingImplEmitter.java b/src/net/java/games/gluegen/JavaMethodBindingImplEmitter.java deleted file mode 100644 index a3d35f912..000000000 --- a/src/net/java/games/gluegen/JavaMethodBindingImplEmitter.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.io.*; -import java.util.*; -import java.text.MessageFormat; - -import net.java.games.gluegen.cgram.types.*; - -/** Emits the Java-side component of the Java<->C JNI binding. */ -public class JavaMethodBindingImplEmitter extends JavaMethodBindingEmitter -{ - private boolean isUnimplemented; - - public JavaMethodBindingImplEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType) - { - this(binding, output, runtimeExceptionType, false); - } - - public JavaMethodBindingImplEmitter(MethodBinding binding, - PrintWriter output, - String runtimeExceptionType, - boolean isUnimplemented) - { - super(binding, output, runtimeExceptionType); - setCommentEmitter(defaultJavaCommentEmitter); - this.isUnimplemented = isUnimplemented; - } - - public JavaMethodBindingImplEmitter(JavaMethodBindingEmitter arg) { - super(arg); - if (arg instanceof JavaMethodBindingImplEmitter) { - this.isUnimplemented = ((JavaMethodBindingImplEmitter) arg).isUnimplemented; - } - } - - protected void emitBody(PrintWriter writer) - { - MethodBinding binding = getBinding(); - if (needsBody()) { - writer.println(); - writer.println(" {"); - if (isUnimplemented) { - writer.println(" throw new " + getRuntimeExceptionType() + "(\"Unimplemented\");"); - } else { - emitPreCallSetup(binding, writer); - emitReturnVariableSetup(binding, writer); - emitCall(binding, writer); - } - writer.println(" }"); - } else { - writer.println(";"); - } - } - - protected boolean isUnimplemented() { - return isUnimplemented; - } - - protected boolean needsBody() { - return (isUnimplemented || - getBinding().signatureUsesNIO() || - getBinding().signatureUsesCArrays() || - getBinding().hasContainingType()); - } - - protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) { - emitArrayLengthAndNIOBufferChecks(binding, writer); - } - - protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer) { - // Check lengths of any incoming arrays if necessary - for (int i = 0; i < binding.getNumArguments(); i++) { - Type type = binding.getCArgumentType(i); - if (type.isArray()) { - ArrayType arrayType = type.asArray(); - writer.println(" if (" + binding.getArgumentName(i) + ".length < " + arrayType.getLength() + ")"); - writer.println(" throw new " + getRuntimeExceptionType() + "(\"Length of array \\\"" + binding.getArgumentName(i) + - "\\\" was less than the required " + arrayType.getLength() + "\");"); - } else { - JavaType javaType = binding.getJavaArgumentType(i); - if (javaType.isNIOBuffer()) { - writer.println(" if (!BufferFactory.isDirect(" + binding.getArgumentName(i) + "))"); - writer.println(" throw new " + getRuntimeExceptionType() + "(\"Argument \\\"" + - binding.getArgumentName(i) + "\\\" was not a direct buffer\");"); - } else if (javaType.isNIOBufferArray()) { - String argName = binding.getArgumentName(i); - // Check direct buffer properties of all buffers within - writer.println(" if (" + argName + " != null) {"); - writer.println(" for (int _ctr = 0; _ctr < " + argName + ".length; _ctr++) {"); - writer.println(" if (!BufferFactory.isDirect(" + argName + "[_ctr])) {"); - writer.println(" throw new " + getRuntimeExceptionType() + "(\"Element \" + _ctr + \" of argument \\\"" + - binding.getArgumentName(i) + "\\\" was not a direct buffer\");"); - writer.println(" }"); - writer.println(" }"); - writer.println(" }"); - } - } - } - } - - protected void emitReturnVariableSetup(MethodBinding binding, PrintWriter writer) { - writer.print(" "); - JavaType returnType = binding.getJavaReturnType(); - if (!returnType.isVoid()) { - if (returnType.isCompoundTypeWrapper() || - returnType.isNIOByteBuffer()) { - writer.println("ByteBuffer _res;"); - writer.print(" _res = "); - } else if (returnType.isArrayOfCompoundTypeWrappers()) { - writer.println("ByteBuffer[] _res;"); - writer.print(" _res = "); - } else { - writer.print("return "); - } - } - } - - protected void emitCall(MethodBinding binding, PrintWriter writer) { - writer.print(getImplMethodName()); - writer.print("("); - emitCallArguments(binding, writer); - writer.print(")"); - emitCallResultReturn(binding, writer); - } - - protected int emitCallArguments(MethodBinding binding, PrintWriter writer) { - boolean needComma = false; - int numArgsEmitted = 0; - if (binding.hasContainingType()) { - // Emit this pointer - assert(binding.getContainingType().isCompoundTypeWrapper()); - writer.print("getBuffer()"); - needComma = true; - ++numArgsEmitted; - } - for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); - if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { - // Don't need to expose these at the Java level - continue; - } - - if (type.isVoid()) { - // Make sure this is the only param to the method; if it isn't, - // there's something wrong with our parsing of the headers. - assert(binding.getNumArguments() == 1); - continue; - } - - if (needComma) { - writer.print(", "); - } - - if (type.isCompoundTypeWrapper()) { - writer.print("(("); - } - writer.print(binding.getArgumentName(i)); - if (type.isCompoundTypeWrapper()) { - writer.print(" == null) ? null : "); - writer.print(binding.getArgumentName(i)); - writer.print(".getBuffer())"); - } - needComma = true; - ++numArgsEmitted; - } - return numArgsEmitted; - } - - protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer) { - JavaType returnType = binding.getJavaReturnType(); - if (returnType.isCompoundTypeWrapper()) { - writer.println(";"); - String fmt = getReturnedArrayLengthExpression(); - writer.println(" if (_res == null) return null;"); - if (fmt == null) { - writer.print(" return new " + returnType.getName() + "(_res.order(ByteOrder.nativeOrder()))"); - } else { - writer.println(" _res.order(ByteOrder.nativeOrder());"); - String[] argumentNames = new String[binding.getNumArguments()]; - for (int i = 0; i < binding.getNumArguments(); i++) { - argumentNames[i] = binding.getArgumentName(i); - } - String expr = new MessageFormat(fmt).format(argumentNames); - PointerType cReturnTypePointer = binding.getCReturnType().asPointer(); - CompoundType cReturnType = null; - if (cReturnTypePointer != null) { - cReturnType = cReturnTypePointer.getTargetType().asCompound(); - } - if (cReturnType == null) { - throw new RuntimeException("ReturnedArrayLength directive currently only supported for pointers to compound types " + - "(error occurred while generating Java glue code for " + binding.getName() + ")"); - } - writer.println(" " + getReturnTypeString(false) + " _retarray = new " + getReturnTypeString(true) + "[" + expr + "];"); - writer.println(" for (int _count = 0; _count < " + expr + "; _count++) {"); - // Create temporary ByteBuffer slice - // FIXME: probably need Type.getAlignedSize() for arrays of - // compound types (rounding up to machine-dependent alignment) - writer.println(" _res.position(_count * " + cReturnType.getSize() + ");"); - writer.println(" _res.limit ((1 + _count) * " + cReturnType.getSize() + ");"); - writer.println(" ByteBuffer _tmp = _res.slice();"); - writer.println(" _tmp.order(ByteOrder.nativeOrder());"); - writer.println(" _res.position(0);"); - writer.println(" _res.limit(_res.capacity());"); - writer.println(" _retarray[_count] = new " + getReturnTypeString(true) + "(_tmp);"); - writer.println(" }"); - writer.print (" return _retarray"); - } - } else if (returnType.isNIOBuffer()) { - writer.println(";"); - writer.println(" if (_res == null) return null;"); - writer.print(" return _res.order(ByteOrder.nativeOrder())"); - } else if (returnType.isArrayOfCompoundTypeWrappers()) { - writer.println(";"); - writer.println(" if (_res == null) return null;"); - writer.println(" " + getReturnTypeString(false) + " _retarray = new " + getReturnTypeString(true) + "[_res.length];"); - writer.println(" for (int _count = 0; _count < _res.length; _count++) {"); - writer.println(" _retarray[_count] = new " + getReturnTypeString(true) + "(_res[_count]);"); - writer.println(" }"); - writer.print (" return _retarray"); - } - writer.println(";"); - } -} - diff --git a/src/net/java/games/gluegen/JavaType.java b/src/net/java/games/gluegen/JavaType.java deleted file mode 100644 index 76b2f107c..000000000 --- a/src/net/java/games/gluegen/JavaType.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.nio.*; - -import net.java.games.gluegen.cgram.types.*; - -/** - * Describes a java-side representation of a type that is used to represent - * the same data on both the Java-side and C-side during a JNI operation. Also - * contains some utility methods for creating common types. - */ -public class JavaType { - private static final int PTR_C_VOID = 1; - private static final int PTR_C_CHAR = 2; - private static final int PTR_C_SHORT = 3; - private static final int PTR_C_INT32 = 4; - private static final int PTR_C_INT64 = 5; - private static final int PTR_C_FLOAT = 6; - private static final int PTR_C_DOUBLE = 7; - - private Class clazz; // Primitive types and other types representable as Class objects - private String name; // Types we're generating glue code for (i.e., C structs) - private Type elementType; // Element type if this JavaType represents a C array - private int primitivePointerType; // Represents C arrays that - // will / can be represented - // with NIO buffers (resolved - // down to another JavaType - // later in processing) - private static JavaType nioBufferType; - private static JavaType nioByteBufferType; - private static JavaType nioShortBufferType; - private static JavaType nioIntBufferType; - private static JavaType nioLongBufferType; - private static JavaType nioFloatBufferType; - private static JavaType nioDoubleBufferType; - private static JavaType nioByteBufferArrayType; - - public boolean equals(Object arg) { - if ((arg == null) || (!(arg instanceof JavaType))) { - return false; - } - JavaType t = (JavaType) arg; - return (this == t || - (t.clazz == clazz && - ((name == t.name) || - ((name != null) && (t.name != null) && (name.equals(t.name)))) && - ((elementType == t.elementType) || - (elementType != null) && (t.elementType != null) && (elementType.equals(t.elementType))) && - (primitivePointerType == t.primitivePointerType))); - } - - public int hashCode() { - if (clazz == null) { - if (name == null) { - return 0; - } - return name.hashCode(); - } - return clazz.hashCode(); - } - - /** Creates a JavaType corresponding to the given Java type. This - can be used to represent arrays of primitive values or Strings; - the emitters understand how to perform proper conversion from - the corresponding C type. */ - public static JavaType createForClass(Class clazz) { - return new JavaType(clazz); - } - - /** Creates a JavaType corresponding to the specified C CompoundType - name; for example, if "Foo" is supplied, then this JavaType - represents a "Foo *" by way of a StructAccessor. */ - public static JavaType createForCStruct(String name) { - return new JavaType(name); - } - - /** Creates a JavaType corresponding to an array of the given - element type. This is used to represent arrays of "Foo **" which - should be mapped to Foo[] in Java. */ - public static JavaType createForCArray(Type elementType) { - return new JavaType(elementType); - } - - public static JavaType createForVoidPointer() { - return new JavaType(PTR_C_VOID); - } - - public static JavaType createForCCharPointer() { - return new JavaType(PTR_C_CHAR); - } - - public static JavaType createForCShortPointer() { - return new JavaType(PTR_C_SHORT); - } - - public static JavaType createForCInt32Pointer() { - return new JavaType(PTR_C_INT32); - } - - public static JavaType createForCInt64Pointer() { - return new JavaType(PTR_C_INT64); - } - - public static JavaType createForCFloatPointer() { - return new JavaType(PTR_C_FLOAT); - } - - public static JavaType createForCDoublePointer() { - return new JavaType(PTR_C_DOUBLE); - } - - public static JavaType createForJNIEnv() { - return createForCStruct("JNIEnv"); - } - - public static JavaType forNIOBufferClass() { - if (nioBufferType == null) { - nioBufferType = createForClass(java.nio.Buffer.class); - } - return nioBufferType; - } - - public static JavaType forNIOByteBufferClass() { - if (nioByteBufferType == null) { - nioByteBufferType = createForClass(java.nio.ByteBuffer.class); - } - return nioByteBufferType; - } - - public static JavaType forNIOShortBufferClass() { - if (nioShortBufferType == null) { - nioShortBufferType = createForClass(java.nio.ShortBuffer.class); - } - return nioShortBufferType; - } - - public static JavaType forNIOIntBufferClass() { - if (nioIntBufferType == null) { - nioIntBufferType = createForClass(java.nio.IntBuffer.class); - } - return nioIntBufferType; - } - - public static JavaType forNIOLongBufferClass() { - if (nioLongBufferType == null) { - nioLongBufferType = createForClass(java.nio.LongBuffer.class); - } - return nioLongBufferType; - } - - public static JavaType forNIOFloatBufferClass() { - if (nioFloatBufferType == null) { - nioFloatBufferType = createForClass(java.nio.FloatBuffer.class); - } - return nioFloatBufferType; - } - - public static JavaType forNIODoubleBufferClass() { - if (nioDoubleBufferType == null) { - nioDoubleBufferType = createForClass(java.nio.DoubleBuffer.class); - } - return nioDoubleBufferType; - } - - public static JavaType forNIOByteBufferArrayClass() { - if (nioByteBufferArrayType == null) { - ByteBuffer[] tmp = new ByteBuffer[0]; - nioByteBufferArrayType = createForClass(tmp.getClass()); - } - return nioByteBufferArrayType; - } - - /** - * Returns the Java Class corresponding to this type. Returns null if this - * object corresponds to a C primitive array type. - */ - public Class getJavaClass() { - return clazz; - } - - /** - * Returns the name corresponding to this type. Returns null when this - * object does not represent a C-language "struct" type. - */ - public String getName() { - if (clazz != null) { - if (clazz.isArray()) { - return arrayName(clazz); - } - return clazz.getName(); - } - if (elementType != null) { - return elementType.getName(); - } - return name; - } - - /** Returns the String corresponding to the JNI type for this type, - or NULL if it can't be represented (i.e., it's a boxing class - that we need to call getBuffer() on.) */ - public String jniTypeName() { - if (clazz == null) { - return null; - } - - if (isVoid()) { - return "void"; - } - - if (clazz.isPrimitive()) { - return "j" + clazz.getName(); - } - - if (clazz.isArray()) { - Class elementType = clazz.getComponentType(); - if (elementType.isPrimitive()) - { - // Type is array-of-primitive - return "j" + elementType.getName() + "Array"; - } - else if (elementType == java.lang.String.class) - { - // Type is array-of-string - return "jobjectArray /*elements are String*/"; - //return "jobjectArray"; - } - else if (java.nio.Buffer.class.isAssignableFrom(elementType)) - { - return "jobjectArray /*elements are " + elementType.getName() + "*/"; - } - else if (elementType.isArray()) - { - // Type is array-of-arrays-of-something - - if (elementType.getComponentType().isPrimitive()) - { - // Type is an array-of-arrays-of-primitive - return "jobjectArray /* elements are " + elementType.getComponentType() + "[]*/"; - //return "jobjectArray"; - } - else - { - throw new RuntimeException("Multi-dimensional arrays of types that are not primitives or Strings are not supported."); - } - } - else - { - // Some unusual type that we don't handle - throw new RuntimeException("Unexpected and unsupported type: \"" + this + "\""); - } - } // end array type case - - if (isString()) { - return "jstring"; - } - - return "jobject"; - } - - public boolean isNIOBuffer() { - return (clazz != null && java.nio.Buffer.class.isAssignableFrom(clazz)); - } - - public boolean isNIOByteBuffer() { - return (clazz == java.nio.ByteBuffer.class); - } - - public boolean isNIOByteBufferArray() { - return (this == nioByteBufferArrayType); - } - - public boolean isNIOBufferArray() { - return (isArray() && - (java.nio.Buffer.class.isAssignableFrom(clazz.getComponentType()))); - } - - public boolean isString() { - return (clazz == java.lang.String.class); - } - - public boolean isArray() { - return ((clazz != null) && clazz.isArray()); - } - - public boolean isPrimitive() { - return ((clazz != null) && !isArray() && clazz.isPrimitive() && (clazz != Void.TYPE)); - } - - public boolean isPrimitiveArray() { - return (isArray() && (clazz.getComponentType().isPrimitive())); - } - - public boolean isVoid() { - return (clazz == Void.TYPE); - } - - public boolean isCompoundTypeWrapper() { - return (clazz == null && name != null && !isJNIEnv()); - } - - public boolean isArrayOfCompoundTypeWrappers() { - return (elementType != null); - } - - public boolean isCPrimitivePointerType() { - return (primitivePointerType != 0); - } - - public boolean isCVoidPointerType() { - return (primitivePointerType == PTR_C_VOID); - } - - public boolean isCCharPointerType() { - return (primitivePointerType == PTR_C_CHAR); - } - - public boolean isCShortPointerType() { - return (primitivePointerType == PTR_C_SHORT); - } - - public boolean isCInt32PointerType() { - return (primitivePointerType == PTR_C_INT32); - } - - public boolean isCInt64PointerType() { - return (primitivePointerType == PTR_C_INT64); - } - - public boolean isCFloatPointerType() { - return (primitivePointerType == PTR_C_FLOAT); - } - - public boolean isCDoublePointerType() { - return (primitivePointerType == PTR_C_DOUBLE); - } - - public boolean isJNIEnv() { - return clazz == null && name == "JNIEnv"; - } - - public Object clone() { - JavaType clone = new JavaType(primitivePointerType); - - clone.clazz = this.clazz; - clone.name = this.name; - clone.elementType = this.elementType; - - return clone; - } - - public String toString() { - return getName(); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - /** - * Constructs a representation for a type corresponding to the given Class - * argument. - */ - private JavaType(Class clazz) { - this.clazz = clazz; - } - - /** Constructs a type representing a named C struct. */ - private JavaType(String name) { - this.name = name; - } - - /** Constructs a type representing an array of C pointers. */ - private JavaType(Type elementType) { - this.elementType = elementType; - } - - /** Constructs a type representing a pointer to a C primitive - (integer, floating-point, or void pointer) type. */ - private JavaType(int primitivePointerType) { - this.primitivePointerType = primitivePointerType; - } - - private String arrayName(Class clazz) { - StringBuffer buf = new StringBuffer(); - int arrayCount = 0; - while (clazz.isArray()) { - ++arrayCount; - clazz = clazz.getComponentType(); - } - buf.append(clazz.getName()); - while (--arrayCount >= 0) { - buf.append("[]"); - } - return buf.toString(); - } - -} diff --git a/src/net/java/games/gluegen/MethodBinding.java b/src/net/java/games/gluegen/MethodBinding.java deleted file mode 100644 index d8b91acaf..000000000 --- a/src/net/java/games/gluegen/MethodBinding.java +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; - -import net.java.games.gluegen.cgram.types.*; - -/** Represents the binding of a C function to a Java method. Also used - to represent calls through function pointers contained in - structs. */ - -public class MethodBinding { - - private FunctionSymbol sym; - private JavaType javaReturnType; - private List javaArgumentTypes; - private boolean computedSignatureProperties; - private boolean signatureUsesNIO; - private boolean signatureUsesCArrays; - private boolean signatureUsesPrimitiveArrays; - private JavaType containingType; - private Type containingCType; - private int thisPointerIndex = -1; - - /** - * Constructs a new MethodBinding that is an exact clone of the - * argument, including the java return type and java argument - * types. It's safe to modify this binding after construction. - */ - public MethodBinding(MethodBinding bindingToCopy) { - this.sym = bindingToCopy.sym; - - this.containingType = bindingToCopy.containingType; - this.containingCType = bindingToCopy.containingCType; - this.javaReturnType = bindingToCopy.javaReturnType; - this.javaArgumentTypes = (List)((ArrayList)bindingToCopy.javaArgumentTypes).clone(); - this.computedSignatureProperties = bindingToCopy.computedSignatureProperties; - this.signatureUsesNIO = bindingToCopy.signatureUsesNIO; - this.signatureUsesCArrays = bindingToCopy.signatureUsesCArrays; - this.signatureUsesPrimitiveArrays = bindingToCopy.signatureUsesPrimitiveArrays; - this.thisPointerIndex = bindingToCopy.thisPointerIndex; - } - - /** Constructor for calling a C function. */ - public MethodBinding(FunctionSymbol sym) { - this.sym = sym; - } - - /** Constructor for calling a function pointer contained in a - struct. */ - public MethodBinding(FunctionSymbol sym, JavaType containingType, Type containingCType) { - this.sym = sym; - this.containingType = containingType; - this.containingCType = containingCType; - } - - public void setJavaReturnType(JavaType type) { - javaReturnType = type; - computedSignatureProperties = false; - } - - public void addJavaArgumentType(JavaType type) { - if (javaArgumentTypes == null) { - javaArgumentTypes = new ArrayList(); - } - javaArgumentTypes.add(type); - computedSignatureProperties = false; - } - - public JavaType getJavaReturnType() { - return javaReturnType; - } - - public int getNumArguments() { - return sym.getNumArguments(); - } - - public JavaType getJavaArgumentType(int i) { - return (JavaType) javaArgumentTypes.get(i); - } - - public Type getCReturnType() { - return sym.getReturnType(); - } - - public Type getCArgumentType(int i) { - return sym.getArgumentType(i); - } - - public FunctionSymbol getCSymbol() { - return sym; - } - - /** Returns either the argument name specified by the underlying - FunctionSymbol or a fabricated argument name based on the - position. Note that it is currently not guaranteed that there - are no namespace clashes with these fabricated argument - names. */ - public String getArgumentName(int i) { - String ret = sym.getArgumentName(i); - if (ret != null) { - return ret; - } - return "arg" + i; - } - - public String getName() { - return sym.getName(); - } - - /** Replaces the C primitive pointer argument at slot argumentNumber - (0..getNumArguments() - 1) with the specified type. If - argumentNumber is less than 0 then replaces the return type. */ - public MethodBinding createCPrimitivePointerVariant(int argumentNumber, - JavaType newArgType) { - MethodBinding binding = new MethodBinding(sym); - if (argumentNumber < 0) { - binding.setJavaReturnType(newArgType); - } else { - binding.setJavaReturnType(javaReturnType); - } - for (int i = 0; i < getNumArguments(); i++) { - JavaType type = getJavaArgumentType(i); - if (i == argumentNumber) { - type = newArgType; - } - binding.addJavaArgumentType(type); - } - return binding; - } - - /** - * Returns true if the return type or any of the outgoing arguments - * in the method's signature require conversion or checking due to - * the use of New I/O. - */ - public boolean signatureUsesNIO() { - computeSignatureProperties(); - return signatureUsesNIO; - } - - /** - * Returns true if any of the outgoing arguments in the method's - * signature represent fixed-length C arrays which require length - * checking during the call. - */ - public boolean signatureUsesCArrays() { - computeSignatureProperties(); - return signatureUsesCArrays; - } - - /** - * Returns true if any of the outgoing arguments in the method's - * signature represent primitive arrays which require a - * GetPrimitiveArrayCritical or similar operation during the call. - */ - public boolean signatureUsesPrimitiveArrays() { - computeSignatureProperties(); - return signatureUsesPrimitiveArrays; - } - - /** - * Computes summary information about the method's C and Java - * signatures. - */ - protected void computeSignatureProperties() { - if (computedSignatureProperties) - return; - - signatureUsesNIO = false; - signatureUsesCArrays = false; - signatureUsesPrimitiveArrays = false; - - if (javaReturnType.isCompoundTypeWrapper() || - javaReturnType.isNIOByteBuffer() || - javaReturnType.isArrayOfCompoundTypeWrappers()) { - // Needs wrapping and/or setting of byte order (neither of - // which can be done easily from native code) - signatureUsesNIO = true; - } - - for (int i = 0; i < getNumArguments(); i++) { - JavaType javaArgType = getJavaArgumentType(i); - Type cArgType = getCArgumentType(i); - if (javaArgType.isCompoundTypeWrapper() || - javaArgType.isNIOBuffer() || - javaArgType.isNIOBufferArray()) { - // Needs unwrapping of accessors or checking of direct - // buffer property - signatureUsesNIO = true; - } - - if (cArgType.isArray()) { - // Needs checking of array lengths - signatureUsesCArrays = true; - } - - if (javaArgType.isPrimitiveArray()) { - // Needs getPrimitiveArrayCritical or similar construct - // depending on native code calling convention - signatureUsesPrimitiveArrays = true; - } - } - - computedSignatureProperties = true; - } - - - public MethodBinding createNIOBufferVariant() { - if (!signatureUsesNIO()) { - return this; - } - MethodBinding binding = new MethodBinding(sym, containingType, containingCType); - binding.thisPointerIndex = thisPointerIndex; - if (javaReturnType.isCompoundTypeWrapper()) { - binding.setJavaReturnType(JavaType.forNIOByteBufferClass()); - } else if (javaReturnType.isArrayOfCompoundTypeWrappers()) { - binding.setJavaReturnType(JavaType.forNIOByteBufferArrayClass()); - } else { - binding.setJavaReturnType(javaReturnType); - } - for (int i = 0; i < getNumArguments(); i++) { - JavaType type = getJavaArgumentType(i); - if (type.isCompoundTypeWrapper()) { - type = JavaType.forNIOBufferClass(); - } - binding.addJavaArgumentType(type); - } - return binding; - } - - /** Indicates whether this MethodBinding is for a function pointer - contained in a struct. */ - public boolean hasContainingType() { - return (getContainingType() != null); - } - - /** Retrieves the containing type of this MethodBinding if it is for - a function pointer contained in a struct. */ - public JavaType getContainingType() { - return containingType; - } - - /** Retrieves the containing C type of this MethodBinding if it is for - a function pointer contained in a struct. */ - public Type getContainingCType() { - return containingCType; - } - - /** Find the leftmost argument matching the type of the containing - type (for function pointer MethodBindings) and record that as a - "this" pointer, meaning that it does not need to be explicitly - passed at the Java level. */ - public void findThisPointer() { - clearThisPointer(); - for (int i = 0; i < getNumArguments(); i++) { - JavaType arg = getJavaArgumentType(i); - if (arg.equals(containingType)) { - thisPointerIndex = i; - break; - } - - if (!arg.isJNIEnv()) { - break; // this pointer must be leftmost argument excluding JNIEnvs - } - } - } - - /** Clears any record of a this pointer for this MethodBinding. */ - public void clearThisPointer() { - thisPointerIndex = -1; - } - - /** Indicates whether the ith argument to this MethodBinding - is actually a "this" pointer. */ - public boolean isArgumentThisPointer(int i) { - return (thisPointerIndex == i); - } - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (obj == null || ! (obj instanceof MethodBinding)) { - return false; - } - - MethodBinding other = (MethodBinding)obj; - if (!(sym.equals(other.sym))) { return false; } - if (!(javaReturnType.equals(other.getJavaReturnType()))) { return false; } - if (containingType != null && - other.getContainingCType() != null && - (!(containingCType.equals(other.getContainingCType())))) { - return false; - } - if (javaArgumentTypes.size() != other.javaArgumentTypes.size()) { - return false; - } - - for (int i = 0; i < javaArgumentTypes.size(); ++i) { - Object typeThis = javaArgumentTypes.get(i); - Object typeOther = other.getJavaArgumentType(i); - if (!(typeThis.equals(typeOther))) { - return false; - } - } - - return true; - } - - // FIXME!! Implement hashCode() to match equals(Object) - - /** Returns the signature of this binding. */ - public String toString() { - StringBuffer buf = new StringBuffer(200); - buf.append(getJavaReturnType().getName()); - buf.append(" "); - buf.append(getName()); - buf.append("("); - boolean needComma = false; - for (int i = 0; i < getNumArguments(); i++) { - JavaType type = getJavaArgumentType(i); - if (type.isVoid()) { - // Make sure this is the only param to the method; if it isn't, - // there's something wrong with our parsing of the headers. - assert(getNumArguments() == 1); - continue; - } - if (type.isJNIEnv() || isArgumentThisPointer(i)) { - // Don't need to expose these at the Java level - continue; - } - - if (needComma) { - buf.append(", "); - } - - buf.append(type.getName()); - buf.append(" "); - buf.append(getArgumentName(i)); - needComma = true; - } - buf.append(")"); - return buf.toString(); - } - - public final Object clone() { - return new MethodBinding(this); - } - -} - diff --git a/src/net/java/games/gluegen/ReferencedStructs.java b/src/net/java/games/gluegen/ReferencedStructs.java deleted file mode 100644 index 824346be8..000000000 --- a/src/net/java/games/gluegen/ReferencedStructs.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import java.util.*; -import net.java.games.gluegen.cgram.types.*; - -public class ReferencedStructs implements TypeVisitor { - private Set results = new HashSet(); - - public void clear() { - results.clear(); - } - - public Iterator results() { - return results.iterator(); - } - - public void visitType(Type t) { - if (t.isPointer()) { - PointerType p = t.asPointer(); - if (p.hasTypedefedName()) { - CompoundType c = p.getTargetType().asCompound(); - if (c != null && c.getName() == null) { - // This otherwise-unnamed CompoundType is referred to by a - // PointerType that has a typedef name. Assume that it is - // referred to in the glue code and emit it. - results.add(p); - } - } - } else if (t.isCompound()) { - results.add(t); - } - } -} diff --git a/src/net/java/games/gluegen/StructLayout.java b/src/net/java/games/gluegen/StructLayout.java deleted file mode 100644 index 77542b714..000000000 --- a/src/net/java/games/gluegen/StructLayout.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -import net.java.games.gluegen.cgram.types.*; - -public class StructLayout { - private int baseOffset; - private int structAlignment; - - protected StructLayout(int baseOffset, - int structAlignment) { - this.baseOffset = baseOffset; - this.structAlignment = structAlignment; - } - - public void layout(CompoundType t) { - int n = t.getNumFields(); - int curOffset = baseOffset; - int maxSize = 0; - for (int i = 0; i < n; i++) { - Field f = t.getField(i); - Type ft = f.getType(); - if (ft.isInt() || ft.isFloat() || ft.isDouble() || ft.isPointer()) { - int sz = ft.getSize(); - if ((curOffset % sz) != 0) { - curOffset += sz - (curOffset % sz); - } - f.setOffset(curOffset); - if (t.isUnion()) { - maxSize = Math.max(maxSize, sz); - } else { - curOffset += sz; - } - } else if (ft.isCompound()) { - new StructLayout(0, structAlignment).layout(ft.asCompound()); - if ((curOffset % structAlignment) != 0) { - curOffset += structAlignment - (curOffset % structAlignment); - } - f.setOffset(curOffset); - if (t.isUnion()) { - maxSize = Math.max(maxSize, ft.getSize()); - } else { - curOffset += ft.getSize(); - } - } else if (ft.isArray()) { - ArrayType arrayType = ft.asArray(); - CompoundType compoundElementType = arrayType.getBaseElementType().asCompound(); - if (compoundElementType != null) { - new StructLayout(0, structAlignment).layout(compoundElementType); - arrayType.recomputeSize(); - } - // Note: not sure how this rounding is done - if ((curOffset % structAlignment) != 0) { - curOffset += structAlignment - (curOffset % structAlignment); - } - f.setOffset(curOffset); - curOffset += ft.getSize(); - } else { - // FIXME - String name = t.getName(); - if (name == null) { - name = t.toString(); - } - throw new RuntimeException("Complicated field types (" + ft + - " " + f.getName() + - " in type " + name + - ") not implemented yet"); - } - } - // FIXME: I think the below is wrong; better check with some examples - // if ((curOffset % structAlignment) != 0) { - // curOffset += structAlignment - (curOffset % structAlignment); - // } - if (t.isUnion()) { - t.setSize(maxSize); - } else { - t.setSize(curOffset); - } - } - - - - public static StructLayout createForCurrentPlatform() { - String os = System.getProperty("os.name").toLowerCase(); - String cpu = System.getProperty("os.arch").toLowerCase(); - if ((os.startsWith("windows") && cpu.equals("x86")) || - (os.startsWith("linux") && cpu.equals("i386")) || - (os.startsWith("linux") && cpu.equals("amd64")) || - (os.startsWith("linux") && cpu.equals("ia64")) || - (os.startsWith("sunos") && cpu.equals("sparc")) || - (os.startsWith("sunos") && cpu.equals("x86")) || - (os.startsWith("mac os") && cpu.equals("ppc")) || - (os.startsWith("freebsd") && cpu.equals("i386")) - ) { - // FIXME: make struct alignment configurable? May need to change - // packing rules on a per-type basis? - return new StructLayout(0, 8); - } else { - // FIXME: add more ports - throw new RuntimeException("Please port StructLayout to your OS (" + os + ") and CPU (" + cpu + ")"); - } - } -} diff --git a/src/net/java/games/gluegen/TypeInfo.java b/src/net/java/games/gluegen/TypeInfo.java deleted file mode 100644 index 60146fa48..000000000 --- a/src/net/java/games/gluegen/TypeInfo.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen; - -/** Utility class for handling Opaque directives for JavaEmitter. */ - -public class TypeInfo { - private String name; - private int pointerDepth; - private JavaType javaType; - private TypeInfo next; - - public TypeInfo(String name, int pointerDepth, JavaType javaType) { - this.name = name; - this.pointerDepth = pointerDepth; - this.javaType = javaType; - } - - public String name() { return name; } - public int pointerDepth() { return pointerDepth; } - public JavaType javaType() { return javaType; } - public void setNext(TypeInfo info) { this.next = info; } - public TypeInfo next() { return next; } -} diff --git a/src/net/java/games/gluegen/ant/GlueGenTask.java b/src/net/java/games/gluegen/ant/GlueGenTask.java deleted file mode 100644 index c9849c29d..000000000 --- a/src/net/java/games/gluegen/ant/GlueGenTask.java +++ /dev/null @@ -1,494 +0,0 @@ -package net.java.games.gluegen.ant; - -/* - * GlueGenTask.java - * Copyright (C) 2003 Rob Grzywinski (rgrzywinski@realityinteractive.com) - * - * Copying, distribution and use of this software in source and binary - * forms, with or without modification, is permitted provided that the - * following conditions are met: - * - * Distributions of source code must reproduce the copyright notice, - * this list of conditions and the following disclaimer in the source - * code header files; and Distributions of binary code must reproduce - * the copyright notice, this list of conditions and the following - * disclaimer in the documentation, Read me file, license file and/or - * other materials provided with the software distribution. - * - * The names of Sun Microsystems, Inc. ("Sun") and/or the copyright - * holder may not be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT A WARRANTY OF ANY - * KIND. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND - * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, NON-INTERFERENCE, ACCURACY OF - * INFORMATIONAL CONTENT OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. THE - * COPYRIGHT HOLDER, SUN AND SUN'S LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL THE - * COPYRIGHT HOLDER, SUN OR SUN'S LICENSORS BE LIABLE FOR ANY LOST - * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, - * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND - * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT - * DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION, - * OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE COPYRIGHT - * HOLDER, SUN AND SUN'S LICENSORS DISCLAIM ANY EXPRESS OR IMPLIED - * WARRANTY OF FITNESS FOR SUCH USES. - */ - -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Execute; -import org.apache.tools.ant.taskdefs.LogStreamHandler; -import org.apache.tools.ant.types.CommandlineJava; -import org.apache.tools.ant.types.DirSet; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.PatternSet; -import org.apache.tools.ant.types.Reference; -import org.apache.tools.ant.util.JavaEnvUtils; - -/** - *

An ANT {@link org.apache.tools.ant.Task} - * for using {@link net.java.games.gluegen.GlueGen}.

- * - *

Usage:

- *
-    <gluegen src="[source C file]" 
-                includes="[optional directory pattern of include files to include]"
-                excludes="[optional directory pattern of include files to exclude]"
-                includeRefid="[optional FileSet or DirSet for include files]"
-                literalInclude="[optional hack to get around FileSet / DirSet issues with different drives]"
-                emitter="[emitter class name]"
-                config="[configuration file]" />
- * 
- * - * @author Rob Grzywinski rgrzywinski@yahoo.com - */ -// FIXME: blow out javadoc -// NOTE: this has not been exhaustively tested -public class GlueGenTask extends Task -{ - /** - *

The {@link net.java.games.gluegen.GlueGen} classname.

- */ - private static final String GLUE_GEN = "net.java.games.gluegen.GlueGen"; - - // ========================================================================= - /** - *

The {@link org.apache.tools.ant.types.CommandlineJava} that is used - * to execute {@link net.java.games.gluegen.GlueGen}.

- */ - private CommandlineJava gluegenCommandline; - - // ========================================================================= - /** - *

The name of the emitter class.

- */ - private String emitter; - - /** - *

The configuration file name.

- */ - private String configuration; - - /** - *

The name of the source C file that is to be parsed.

- */ - private String sourceFile; - - /** - *

The {@link org.apache.tools.ant.types.FileSet} of includes.

- */ - private FileSet includeSet = new FileSet(); - - /** - *

Because a {@link org.apache.tools.ant.types.FileSet} will include - * everything in its base directory if it is left untouched, the includeSet - * must only be added to the set of includes if it has been explicitly - * set.

- */ - private boolean usedIncludeSet = false; // by default it is not used - - /** - *

The set of include sets. This allows includes to be added in multiple - * fashions.

- */ - // FIXME: rename to listXXXX - private List setOfIncludeSets = new LinkedList(); - - /** - *

A single literal directory to include. This is to get around the - * fact that neither {@link org.apache.tools.ant.types.FileSet} nor - * {@link org.apache.tools.ant.types.DirSet} can handle multiple drives in - * a sane manner. If null then it has not been specified.

- */ - private String literalInclude; - - // ========================================================================= - /** - *

Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.

- */ - public GlueGenTask() - { - // create the CommandlineJava that will be used to call GlueGen - gluegenCommandline = new CommandlineJava(); - - // set the VM and classname in the commandline - gluegenCommandline.setVm(JavaEnvUtils.getJreExecutable("java")); - gluegenCommandline.setClassname(GLUE_GEN); - // gluegenCommandline.createVmArgument().setValue("-verbose:class"); - } - - // ========================================================================= - // ANT getters and setters - /** - *

Set the emitter class name. This is called by ANT.

- * - * @param emitter the name of the emitter class - */ - public void setEmitter(String emitter) - { - log( ("Setting emitter class name to: " + emitter), Project.MSG_VERBOSE); - this.emitter = emitter; - } - - /** - *

Set the configuration file name. This is called by ANT.

- * - * @param configuration the name of the configuration file - */ - public void setConfig(String configuration) - { - log( ("Setting configuration file name to: " + configuration), - Project.MSG_VERBOSE); - this.configuration = configuration; - } - - /** - *

Set the source C file that is to be parsed. This is called by ANT.

- * - * @param sourceFile the name of the source file - */ - public void setSrc(String sourceFile) - { - log( ("Setting source file name to: " + sourceFile), Project.MSG_VERBOSE); - this.sourceFile = sourceFile; - } - - /** - *

Set a single literal include directory. See the literalInclude - * javadoc for more information.

- * - * @param directory the directory to include - */ - public void setLiteralInclude(String directory) - { - this.literalInclude = directory; - } - - /** - *

Add an include file to the list. This is called by ANT for a nested - * element.

- * - * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} - */ - public PatternSet.NameEntry createInclude() - { - usedIncludeSet = true; - return includeSet.createInclude(); - } - - /** - *

Add an include file to the list. This is called by ANT for a nested - * element.

- * - * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} - */ - public PatternSet.NameEntry createIncludesFile() - { - usedIncludeSet = true; - return includeSet.createIncludesFile(); - } - - /** - *

Set the set of include patterns. Patterns may be separated by a comma - * or a space. This is called by ANT.

- * - * @param includes the string containing the include patterns - */ - public void setIncludes(String includes) - { - usedIncludeSet = true; - includeSet.setIncludes(includes); - } - - /** - *

Add an include file to the list that is to be exluded. This is called - * by ANT for a nested element.

- * - * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} - */ - public PatternSet.NameEntry createExclude() - { - usedIncludeSet = true; - return includeSet.createExclude(); - } - - /** - *

Add an exclude file to the list. This is called by ANT for a nested - * element.

- * - * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} - */ - public PatternSet.NameEntry createExcludesFile() - { - usedIncludeSet = true; - return includeSet.createExcludesFile(); - } - - /** - *

Set the set of exclude patterns. Patterns may be separated by a comma - * or a space. This is called by ANT.

- * - * @param includes the string containing the exclude patterns - */ - public void setExcludes(String excludes) - { - usedIncludeSet = true; - includeSet.setExcludes(excludes); - } - - /** - *

Set a {@link org.apache.tools.ant.types.Reference} to simplify adding - * of complex sets of files to include. This is called by ANT.

? - * - * @param reference a Reference to a {@link org.apache.tools.ant.types.FileSet} - * or {@link org.apache.tools.ant.types.DirSet} - * @throws BuildException if the specified Reference is not - * either a FileSet or DirSet - */ - public void setIncludeRefid(Reference reference) - { - // ensure that the referenced object is either a FileSet or DirSet - final Object referencedObject = reference.getReferencedObject(getProject()); - if( !( (referencedObject instanceof FileSet) || - (referencedObject instanceof DirSet)) ) - { - throw new BuildException("Only FileSets or DirSets are allowed as an include refid."); - } - - // add the referenced object to the set of include sets - setOfIncludeSets.add(referencedObject); - } - - /** - *

Add a nested {@link org.apache.tools.ant.types.DirSet} to specify - * the files to include. This is called by ANT.

- * - * @param dirset the DirSet to be added - */ - public void addDirset(DirSet dirset) - { - setOfIncludeSets.add(dirset); - } - - /** - *

Add an optional classpath that defines the location of {@link net.java.games.gluegen.GlueGen} - * and GlueGen's dependencies.

- * - * @returns {@link org.apache.tools.ant.types.Path} - */ - public Path createClasspath() - { - return gluegenCommandline.createClasspath(project).createPath(); - } - - // ========================================================================= - /** - *

Run the task. This involves validating the set attributes, creating - * the command line to be executed and finally executing the command.

- * - * @see org.apache.tools.ant.Task#execute() - */ - public void execute() - throws BuildException - { - // validate that all of the required attributes have been set - validateAttributes(); - - // TODO: add logic to determine if the generated file needs to be - // regenerated - - // add the attributes to the CommandlineJava - addAttributes(); - - log(gluegenCommandline.describeCommand(), Project.MSG_VERBOSE); - - // execute the command and throw on error - final int error = execute(gluegenCommandline.getCommandline()); - if(error == 1) - throw new BuildException( ("GlueGen returned: " + error), location); - } - - /** - *

Ensure that the user specified all required arguments.

- * - * @throws BuildException if there are required arguments that are not - * present or not valid - */ - private void validateAttributes() - throws BuildException - { - // validate that the emitter class is set - if(!isValid(emitter)) - throw new BuildException("Invalid emitter class name: " + emitter); - - // validate that the configuration file is set - if(!isValid(configuration)) - throw new BuildException("Invalid configuration file name: " + configuration); - - // validate that the source file is set - if(!isValid(sourceFile)) - throw new BuildException("Invalid source file name: " + sourceFile); - - // CHECK: do there need to be includes to be valid? - } - - /** - *

Is the specified string valid? A valid string is non-null - * and has a non-zero length.

- * - * @param string the string to be tested for validity - * @return true if the string is valid. false - * otherwise. - */ - private boolean isValid(String string) - { - // check for null - if(string == null) - return false; - - // ensure that the string has a non-zero length - // NOTE: must trim() to remove leading and trailing whitespace - if(string.trim().length() < 1) - return false; - - // the string is valid - return true; - } - - /** - *

Add all of the attributes to the command line. They have already - * been validated.

- */ - private void addAttributes() - throws BuildException - { - // NOTE: GlueGen uses concatenated flag / value rather than two - // separate arguments - - // add the emitter class name - gluegenCommandline.createArgument().setValue("-E" + emitter); - - // add the configuration file name - gluegenCommandline.createArgument().setValue("-C" + configuration); - - // add the includedSet to the setOfIncludeSets to simplify processing - // all types of include sets ONLY if it has been set. - // NOTE: see the usedIncludeSet member javadoc for more info - // NOTE: references and nested DirSets have already been added to the - // set of include sets - if(usedIncludeSet) - { - includeSet.setDir(getProject().getBaseDir()); // NOTE: the base dir must be set - setOfIncludeSets.add(includeSet); - } - - // iterate over all include sets and add their directories to the - // list of included directories. - final List includedDirectories = new LinkedList(); - for(Iterator includes=setOfIncludeSets.iterator(); includes.hasNext(); ) - { - // get the included set and based on its type add the directories - // to includedDirectories - Object include = (Object)includes.next(); - final String[] directoryDirs; - if(include instanceof FileSet) - { - final FileSet fileSet = (FileSet)include; - DirectoryScanner directoryScanner = fileSet.getDirectoryScanner(getProject()); - directoryDirs = directoryScanner.getIncludedDirectories(); - } else if(include instanceof DirSet) - { - final DirSet dirSet = (DirSet)include; - DirectoryScanner directoryScanner = dirSet.getDirectoryScanner(getProject()); - directoryDirs = directoryScanner.getIncludedDirectories(); - } else - { - // NOTE: this cannot occur as it is checked on setXXX() but - // just to be pedantic this is here - throw new BuildException("Invalid included construct."); - } - - // add the directoryDirs to the includedDirectories - // TODO: exclude any directory that is already in the list - for(int i=0; iExecute {@link net.java.games.gluegen.GlueGen} in a forked JVM.

- * - * @throws BuildException - */ - private int execute(String[] command) - throws BuildException - { - // create the object that will perform the command execution - Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, - Project.MSG_WARN), - null); - - // set the project and command line - execute.setAntRun(project); - execute.setCommandline(command); - - // execute the command - try - { - return execute.execute(); - } catch(IOException ioe) - { - throw new BuildException(ioe, location); - } - } -} diff --git a/src/net/java/games/gluegen/ant/StaticGLGenTask.java b/src/net/java/games/gluegen/ant/StaticGLGenTask.java deleted file mode 100644 index 35ed2d504..000000000 --- a/src/net/java/games/gluegen/ant/StaticGLGenTask.java +++ /dev/null @@ -1,303 +0,0 @@ -package net.java.games.gluegen.ant; - -/* - * StaticGLGenTask.java - * Copyright (C) 2003 Rob Grzywinski (rgrzywinski@realityinteractive.com) - * - * Copying, distribution and use of this software in source and binary - * forms, with or without modification, is permitted provided that the - * following conditions are met: - * - * Distributions of source code must reproduce the copyright notice, - * this list of conditions and the following disclaimer in the source - * code header files; and Distributions of binary code must reproduce - * the copyright notice, this list of conditions and the following - * disclaimer in the documentation, Read me file, license file and/or - * other materials provided with the software distribution. - * - * The names of Sun Microsystems, Inc. ("Sun") and/or the copyright - * holder may not be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT A WARRANTY OF ANY - * KIND. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND - * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, NON-INTERFERENCE, ACCURACY OF - * INFORMATIONAL CONTENT OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. THE - * COPYRIGHT HOLDER, SUN AND SUN'S LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL THE - * COPYRIGHT HOLDER, SUN OR SUN'S LICENSORS BE LIABLE FOR ANY LOST - * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, - * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND - * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT - * DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION, - * OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE COPYRIGHT - * HOLDER, SUN AND SUN'S LICENSORS DISCLAIM ANY EXPRESS OR IMPLIED - * WARRANTY OF FITNESS FOR SUCH USES. - */ - -import java.io.IOException; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Execute; -import org.apache.tools.ant.taskdefs.LogStreamHandler; -import org.apache.tools.ant.types.CommandlineJava; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.PatternSet; -import org.apache.tools.ant.util.JavaEnvUtils; - -/** - *

An ANT {@link org.apache.tools.ant.Task} - * for using {@link net.java.games.gluegen.opengl.BuildStaticGLInfo}.

- * - *

Usage:

- *
-    <staticglgen package="[generated files package]" 
-                    headers="[file pattern of GL headers]"
-                    outputdir="[directory to output the generated files]" />
- * 
- * - * @author Rob Grzywinski rgrzywinski@yahoo.com - */ -// FIXME: blow out javadoc -public class StaticGLGenTask extends Task -{ - /** - *

The {@link net.java.games.gluegen.opengl.BuildStaticGLInfo} classname.

- */ - private static final String GL_GEN = "net.java.games.gluegen.opengl.BuildStaticGLInfo"; - - // ========================================================================= - /** - *

The {@link org.apache.tools.ant.types.CommandlineJava} that is used - * to execute {@link net.java.games.gluegen.opengl.BuildStaticGLInfo}.

- */ - private CommandlineJava glgenCommandline; - - // ========================================================================= - /** - *

The package name for the generated files.

- */ - private String packageName; - - /** - *

The output directory.

- */ - private String outputDirectory; - - /** - *

The {@link org.apache.tools.ant.types.FileSet} of GL headers.

- */ - private FileSet headerSet = new FileSet(); - - // ========================================================================= - /** - *

Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.

- */ - public StaticGLGenTask() - { - // create the CommandlineJava that will be used to call BuildStaticGLInfo - glgenCommandline = new CommandlineJava(); - - // set the VM and classname in the commandline - glgenCommandline.setVm(JavaEnvUtils.getJreExecutable("java")); - glgenCommandline.setClassname(GL_GEN); - } - - // ========================================================================= - // ANT getters and setters - /** - *

Set the package name for the generated files. This is called by ANT.

- * - * @param packageName the name of the package for the generated files - */ - public void setPackage(String packageName) - { - log( ("Setting package name to: " + packageName), Project.MSG_VERBOSE); - this.packageName = packageName; - } - - /** - *

Set the output directory. This is called by ANT.

- * - * @param directory the output directory - */ - public void setOutputDir(String directory) - { - log( ("Setting output directory to: " + directory), - Project.MSG_VERBOSE); - this.outputDirectory = directory; - } - - /** - *

Add a header file to the list. This is called by ANT for a nested - * element.

- * - * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} - */ - public PatternSet.NameEntry createHeader() - { - return headerSet.createInclude(); - } - - /** - *

Add a header file to the list. This is called by ANT for a nested - * element.

- * - * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} - */ - public PatternSet.NameEntry createHeadersFile() - { - return headerSet.createIncludesFile(); - } - - /** - *

Set the set of header patterns. Patterns may be separated by a comma - * or a space. This is called by ANT.

- * - * @param headers the string containing the header patterns - */ - public void setHeaders(String headers) - { - headerSet.setIncludes(headers); - } - - /** - *

Add an optional classpath that defines the location of {@link net.java.games.gluegen.opengl.BuildStaticGLInfo} - * and BuildStaticGLInfo's dependencies.

- * - * @returns {@link org.apache.tools.ant.types.Path} - */ - public Path createClasspath() - { - return glgenCommandline.createClasspath(project).createPath(); - } - - // ========================================================================= - /** - *

Run the task. This involves validating the set attributes, creating - * the command line to be executed and finally executing the command.

- * - * @see org.apache.tools.ant.Task#execute() - */ - public void execute() - throws BuildException - { - // validate that all of the required attributes have been set - validateAttributes(); - - // TODO: add logic to determine if the generated file needs to be - // regenerated - - // add the attributes to the CommandlineJava - addAttributes(); - - log(glgenCommandline.describeCommand(), Project.MSG_VERBOSE); - - // execute the command and throw on error - final int error = execute(glgenCommandline.getCommandline()); - if(error == 1) - throw new BuildException( ("BuildStaticGLInfo returned: " + error), location); - } - - /** - *

Ensure that the user specified all required arguments.

- * - * @throws BuildException if there are required arguments that are not - * present or not valid - */ - private void validateAttributes() - throws BuildException - { - // validate that the package name is set - if(!isValid(packageName)) - throw new BuildException("Invalid package name: " + packageName); - - // validate that the output directory is set - // TODO: switch to file and ensure that it exists - if(!isValid(outputDirectory)) - throw new BuildException("Invalid output directory name: " + outputDirectory); - - // TODO: validate that there are headers set - } - - /** - *

Is the specified string valid? A valid string is non-null - * and has a non-zero length.

- * - * @param string the string to be tested for validity - * @return true if the string is valid. false - * otherwise. - */ - private boolean isValid(String string) - { - // check for null - if(string == null) - return false; - - // ensure that the string has a non-zero length - // NOTE: must trim() to remove leading and trailing whitespace - if(string.trim().length() < 1) - return false; - - // the string is valid - return true; - } - - /** - *

Add all of the attributes to the command line. They have already - * been validated.

- */ - private void addAttributes() - { - // add the package name - glgenCommandline.createArgument().setValue(packageName); - - // add the output directory name - glgenCommandline.createArgument().setValue(outputDirectory); - - // add the header -files- from the FileSet - headerSet.setDir(getProject().getBaseDir()); - DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject()); - String[] directoryFiles = directoryScanner.getIncludedFiles(); - for(int i=0; iExecute {@link net.java.games.gluegen.opengl.BuildStaticGLInfo} in a - * forked JVM.

- * - * @throws BuildException - */ - private int execute(String[] command) - throws BuildException - { - // create the object that will perform the command execution - Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, - Project.MSG_WARN), - null); - - // set the project and command line - execute.setAntRun(project); - execute.setCommandline(command); - - // execute the command - try - { - return execute.execute(); - } catch(IOException ioe) - { - throw new BuildException(ioe, location); - } - } -} diff --git a/src/net/java/games/gluegen/cgram/CSymbolTable.java b/src/net/java/games/gluegen/cgram/CSymbolTable.java deleted file mode 100644 index e22274b90..000000000 --- a/src/net/java/games/gluegen/cgram/CSymbolTable.java +++ /dev/null @@ -1,132 +0,0 @@ -package net.java.games.gluegen.cgram; - -import java.util.Vector; -import java.util.Hashtable; -import java.util.Enumeration; - - - -public class CSymbolTable { - - /** holds list of scopes */ - private Vector scopeStack; - - /** table where all defined names are mapped to TNode tree nodes */ - private Hashtable symTable; - - public CSymbolTable() { - scopeStack = new Vector(10); - symTable = new Hashtable(533); - } - - - /** push a new scope onto the scope stack. - */ - public void pushScope(String s) { - //System.out.println("push scope:" + s); - scopeStack.addElement(s); - } - - /** pop the last scope off the scope stack. - */ - public void popScope() { - //System.out.println("pop scope"); - int size = scopeStack.size(); - if(size > 0) - scopeStack.removeElementAt(size - 1); - } - - /** return the current scope as a string - */ - public String currentScopeAsString() { - StringBuffer buf = new StringBuffer(100); - boolean first = true; - Enumeration e = scopeStack.elements(); - while(e.hasMoreElements()) { - if(first) - first = false; - else - buf.append("::"); - buf.append(e.nextElement().toString()); - } - return buf.toString(); - } - - /** given a name for a type, append it with the - current scope. - */ - public String addCurrentScopeToName(String name) { - String currScope = currentScopeAsString(); - return addScopeToName(currScope, name); - } - - /** given a name for a type, append it with the - given scope. MBZ - */ - public String addScopeToName(String scope, String name) { - if(scope == null || scope.length() > 0) - return scope + "::" + name; - else - return name; - } - - /** remove one level of scope from name MBZ*/ - public String removeOneLevelScope(String scopeName) { - int index = scopeName.lastIndexOf("::"); - if (index > 0) { - return scopeName.substring(0,index); - } - if (scopeName.length() > 0) { - return ""; - } - return null; - } - - /** add a node to the table with it's key as - the current scope and the name */ - public TNode add(String name, TNode node) { - return (TNode)symTable.put(addCurrentScopeToName(name),node); - } - - - /** lookup a fully scoped name in the symbol table */ - public TNode lookupScopedName(String scopedName) { - return (TNode)symTable.get(scopedName); - } - - /** lookup an unscoped name in the table by prepending - the current scope. - MBZ -- if not found, pop scopes and look again - */ - public TNode lookupNameInCurrentScope(String name) { - String scope = currentScopeAsString(); - String scopedName; - TNode tnode = null; - - //System.out.println( "\n"+ this.toString() ); - - while (tnode == null && scope != null) { - scopedName = addScopeToName(scope, name); - //System.out.println("lookup trying " + scopedName); - tnode = (TNode)symTable.get(scopedName); - scope = removeOneLevelScope(scope); - } - return tnode; - } - - /** convert this table to a string */ - public String toString() { - StringBuffer buff = new StringBuffer(300); - buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() + - "\nDefinedSymbols:\n"); - Enumeration ke = symTable.keys(); - Enumeration ve = symTable.elements(); - while(ke.hasMoreElements()) { - buff.append(ke.nextElement().toString() + " (" + - TNode.getNameForType(((TNode)ve.nextElement()).getType()) + ")\n"); - } - buff.append("}\n"); - return buff.toString(); - } - -}; diff --git a/src/net/java/games/gluegen/cgram/CToken.java b/src/net/java/games/gluegen/cgram/CToken.java deleted file mode 100644 index facd95a08..000000000 --- a/src/net/java/games/gluegen/cgram/CToken.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.java.games.gluegen.cgram; - -import antlr.CommonToken; - -public class CToken extends antlr.CommonToken { - String source = ""; - int tokenNumber; - - public String getSource() - { - return source; - } - - public void setSource(String src) - { - source = src; - } - - public int getTokenNumber() - { - return tokenNumber; - } - - public void setTokenNumber(int i) - { - tokenNumber = i; - } - - public String toString() { - return "CToken:" +"(" + hashCode() + ")" + "[" + getType() + "] "+ getText() + " line:" + getLine() + " source:" + source ; - } -} diff --git a/src/net/java/games/gluegen/cgram/Define.java b/src/net/java/games/gluegen/cgram/Define.java deleted file mode 100644 index 9fbd8636d..000000000 --- a/src/net/java/games/gluegen/cgram/Define.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram; - -/** Represents a #define of a literal to a value (a number represented - in string form.) */ - -public class Define { - private String name; - private String value; - - public Define(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { return name; } - public String getValue() { return value; } -} diff --git a/src/net/java/games/gluegen/cgram/GnuCEmitter.g b/src/net/java/games/gluegen/cgram/GnuCEmitter.g deleted file mode 100644 index 87294fc53..000000000 --- a/src/net/java/games/gluegen/cgram/GnuCEmitter.g +++ /dev/null @@ -1,1145 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1998 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: GnuCEmitter -FILE: GnuCEmitter.g - -AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 - -DESCRIPTION: - - This tree grammar is for a Gnu C AST. - It turns the tree back into source code. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { - package net.java.games.gluegen.cgram; - - import java.io.*; - import java.util.*; - - import antlr.CommonAST; - import antlr.DumpASTVisitor; -} - - -class GnuCEmitter extends GnuCTreeParser; - -options - { - importVocab = GNUC; - buildAST = false; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - - -int tabs = 0; -PrintStream currentOutput = System.out; -int lineNum = 1; -String currentSource = ""; -LineObject trueSourceFile; -final int lineDirectiveThreshold = Integer.MAX_VALUE; -PreprocessorInfoChannel preprocessorInfoChannel = null; -Stack sourceFiles = new Stack(); - -public GnuCEmitter( PreprocessorInfoChannel preprocChannel ) -{ - preprocessorInfoChannel = preprocChannel; -} - -void initializePrinting() -{ - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber( new Integer(1) ); - printPreprocs(preprocs); -/* if ( currentSource.equals("") ) { - trueSourceFile = new LineObject(currentSource); - currentOutput.println("# 1 \"" + currentSource + "\"\n"); - sourceFiles.push(trueSourceFile); - } -*/ -} - -void finalizePrinting() { - // flush any leftover preprocessing instructions to the stream - - printPreprocs( - preprocessorInfoChannel.extractLinesPrecedingTokenNumber( - new Integer( preprocessorInfoChannel.getMaxTokenNumber() + 1 ) )); - //print a newline so file ends at a new line - currentOutput.println(); -} - -void printPreprocs( Vector preprocs ) -{ - // if there was a preprocessingDirective previous to this token then - // print a newline and the directive, line numbers handled later - if ( preprocs.size() > 0 ) { - if ( trueSourceFile != null ) { - currentOutput.println(); //make sure we're starting a new line unless this is the first line directive - } - lineNum++; - Enumeration e = preprocs.elements(); - while (e.hasMoreElements()) - { - Object o = e.nextElement(); - if ( o.getClass().getName().equals("LineObject") ) { - LineObject l = (LineObject) o; - - // we always return to the trueSourceFile, we never enter it from another file - // force it to be returning if in fact we aren't currently in trueSourceFile - if (( trueSourceFile != null ) //trueSource exists - && ( !currentSource.equals(trueSourceFile.getSource()) ) //currently not in trueSource - && ( trueSourceFile.getSource().equals(l.getSource()) ) ) { //returning to trueSource - l.setEnteringFile( false ); - l.setReturningToFile( true ); - } - - - // print the line directive - currentOutput.println(l); - lineNum = l.getLine(); - currentSource = l.getSource(); - - - // the very first line directive always represents the true sourcefile - if ( trueSourceFile == null ) { - trueSourceFile = new LineObject(currentSource); - sourceFiles.push(trueSourceFile); - } - - // keep our own stack of files entered - if ( l.getEnteringFile() ) { - sourceFiles.push(l); - } - - // if returning to a file, pop the exited files off the stack - if ( l.getReturningToFile() ) { - LineObject top = (LineObject) sourceFiles.peek(); - while (( top != trueSourceFile ) && (! l.getSource().equals(top.getSource()) )) { - sourceFiles.pop(); - top = (LineObject) sourceFiles.peek(); - } - } - } - else { // it was a #pragma or such - currentOutput.println(o); - lineNum++; - } - } - } - -} - -void print( TNode t ) { - int tLineNum = t.getLocalLineNum(); - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( lineNum == tLineNum ){ - // do nothing special, we're at the right place - } - else { - int diff = tLineNum - lineNum; - if ( lineNum < tLineNum ) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - printTabs(); - } - else { // just reset lineNum - lineNum = tLineNum; - } - } - currentOutput.print( t.getText() + " " ); -} - - -/* This was my attempt at being smart about line numbers - It didn't work quite right but I don't know why, I didn't - have enough test cases. Worked ok compiling rcs and ghostscript -*/ -void printAddingLineDirectives( TNode t ) { - int tLineNum = t.getLocalLineNum(); - String tSource = (String) t.getAttribute("source"); - - if ( tSource == null ) tSource = currentSource; - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) || !currentSource.equals(tSource) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( ( lineNum == tLineNum ) && ( currentSource.equals(tSource) ) ){ - // do nothing special, we're at the right place - } - else if ( currentSource.equals(tSource) ) { - int diff = tLineNum - lineNum; - if (diff > 0 && diff < lineDirectiveThreshold) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - } - else { // print line directive to get us to right line number - // preserve flags 3 and 4 if present in current file - if ( ! sourceFiles.empty() ) { - LineObject l = (LineObject) sourceFiles.peek(); - StringBuffer tFlags = new StringBuffer(""); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags.toString()); - lineNum = tLineNum; - } - } - - printTabs(); - } - else { // different source - Enumeration sources = sourceFiles.elements(); - // see if we're returning to a file we entered earlier - boolean returningToEarlierFile = false; - while (sources.hasMoreElements()) { - LineObject l = (LineObject) sources.nextElement(); - if (l.getSource().equals(tSource)) { - returningToEarlierFile = true; - break; - } - } - if (returningToEarlierFile) { - // pop off the files we're exiting, but never pop the trueSourceFile - LineObject l = (LineObject) sourceFiles.peek(); - while ( ( l != trueSourceFile ) &&(! l.getSource().equals(tSource) ) ) { - sourceFiles.pop(); - l = (LineObject) sourceFiles.peek(); - } - - // put in the return flag, plus others as needed - StringBuffer tFlags = new StringBuffer(" 2"); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - else { // entering a file that wasn't in the original source - // pretend we're entering it from top of stack - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + " 1"); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - } - currentOutput.print( t.getText() + " " ); -} - -/** It is not ok to print newlines from the String passed in as -it will screw up the line number handling **/ -void print( String s ) { - currentOutput.print( s + " " ); -} - -void printTabs() { - for ( int i = 0; i< tabs; i++ ) { - currentOutput.print( "\t" ); - } -} - -void commaSep( TNode t ) { - print( t ); - if ( t.getNextSibling() != null ) { - print( "," ); - } -} - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x typeName - | expr - ) - rp:RPAREN { print( rp ); } - ) - | p:"__complex" { print( p ); } - ; - - -typedefName - : #(NTypedefName i:ID { print( i ); } ) - ; - - -structSpecifier - : #( a:"struct" { print( a ); } - structOrUnionBody - ) - ; - -unionSpecifier - : #( a:"union" { print( a ); } - structOrUnionBody - ) - ; - -structOrUnionBody - : ( (ID LCURLY) => i1:ID lc1:LCURLY { print( i1 ); print ( "{" ); tabs++; } - ( structDeclarationList )? - rc1:RCURLY { tabs--; print( rc1 ); } - | lc2:LCURLY { print( lc2 ); tabs++; } - ( structDeclarationList )? - rc2:RCURLY { tabs--; print( rc2 ); } - | i2:ID { print( i2 ); } - ) - ; - -structDeclarationList - : ( structDeclaration { print( ";" ); } - )+ - ; - - -structDeclaration - : specifierQualifierList structDeclaratorList - ; - - -specifierQualifierList - : ( - typeSpecifier - | typeQualifier - )+ - ; - - -structDeclaratorList - : structDeclarator - ( { print(","); } structDeclarator )* - ; - - -structDeclarator - : - #( NStructDeclarator - ( declarator )? - ( c:COLON { print( c ); } expr )? - ( attributeDecl )* - ) - ; - - -enumSpecifier - : #( a:"enum" { print( a ); } - ( i:ID { print( i ); } )? - ( lc:LCURLY { print( lc ); tabs++; } - enumList - rc:RCURLY { tabs--; print( rc ); } - )? - ) - ; - - -enumList - : - enumerator ( {print(",");} enumerator)* - ; - - -enumerator - : i:ID { print( i ); } - ( b:ASSIGN { print( b ); } - expr - )? - ; - - -attributeDecl: - #( a:"__attribute" { print( a ); } - (b:. { print( b ); } )* - ) - | #( n:NAsmAttribute { print( n ); } - lp:LPAREN { print( lp ); } - expr { print( ")" ); } - rp:RPAREN { print( rp ); } - ) - ; - -initDeclList - : initDecl - ( { print( "," ); } initDecl )* - ; - - -initDecl - { String declName = ""; } - : #(NInitDecl - declarator - ( attributeDecl )* - ( a:ASSIGN { print( a ); } - initializer - | b:COLON { print( b ); } - expr - )? - ) - ; - - -pointerGroup - : #( NPointerGroup - ( a:STAR { print( a ); } - ( typeQualifier )* - )+ - ) - ; - - - -idList - : i:ID { print( i ); } - ( c:COMMA { print( c ); } - id:ID { print( id ); } - )* - ; - - - -initializer - : #( NInitializer (initializerElementLabel)? expr ) - | lcurlyInitializer - ; - -initializerElementLabel - : #( NInitializerElementLabel - ( - ( l:LBRACKET { print( l ); } - expr - r:RBRACKET { print( r ); } - (a1:ASSIGN { print( a1 ); } )? - ) - | i1:ID c:COLON { print( i1 ); print( c ); } - | d:DOT i2:ID a2:ASSIGN { print( d ); print( i2 ); print( a2 ); } - ) - ) - ; - -lcurlyInitializer - : #(n:NLcurlyInitializer { print( n ); tabs++; } - initializerList - rc:RCURLY { tabs--; print( rc ); } - ) - ; - -initializerList - : ( i:initializer { commaSep( i ); } - )* - ; - - -declarator - : #( NDeclarator - ( pointerGroup )? - - ( id:ID { print( id ); } - | lp:LPAREN { print( lp ); } declarator rp:RPAREN { print( rp ); } - ) - - ( #( n:NParameterTypeList { print( n ); } - ( - parameterTypeList - | (idList)? - ) - r:RPAREN { print( r ); } - ) - | lb:LBRACKET { print( lb );} ( expr )? rb:RBRACKET { print( rb ); } - )* - ) - ; - - - -parameterTypeList - : ( parameterDeclaration - ( c:COMMA { print( c ); } - | s:SEMI { print( s ); } - )? - )+ - ( v:VARARGS { print( v ); } )? - ; - - - -parameterDeclaration - : #( NParameterDeclaration - declSpecifiers - (declarator | nonemptyAbstractDeclarator)? - ) - ; - - -functionDef - : #( NFunctionDef - ( functionDeclSpecifiers)? - declarator - (declaration - | v:VARARGS { print( v ); } - )* - compoundStatement - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - -functionDeclSpecifiers - : - ( functionStorageClassSpecifier - | typeQualifier - | typeSpecifier - )+ - ; - -declarationList - : - ( //ANTLR doesn't know that declarationList properly eats all the declarations - //so it warns about the ambiguity - options { - warnWhenFollowAmbig = false; - } : - localLabelDecl - | declaration - )+ - ; - -localLabelDecl - : #(a:"__label__" { print( a ); } - ( i:ID { commaSep( i ); } - )+ - { print( ";" ); } - ) - ; - - - -compoundStatement - : #( cs:NCompoundStatement { print( cs ); tabs++; } - ( declarationList - | functionDef - )* - ( statementList )? - rc:RCURLY { tabs--; print( rc ); } - ) - - ; - -statementList - : ( statement )+ - ; - -statement - : statementBody - ; - -statementBody - : s:SEMI { print( s ); } - - | compoundStatement // Group of statements - - | #(NStatementExpr - expr { print( ";" ); } - ) // Expressions - -// Iteration statements: - - | #( w:"while" { print( w ); print( "(" ); } - expr { print( ")" ); } - statement ) - - | #( d:"do" { print( d ); } - statement - { print( " while ( " ); } - expr - { print( " );" ); } - ) - - | #( f:"for" { print( f ); print( "(" ); } - expr { print( ";" ); } - expr { print( ";" ); } - expr { print( ")" ); } - statement - ) - - -// Jump statements: - - | #( g:"goto" { print( g );} - expr { print( ";" ); } - ) - | c:"continue" { print( c ); print( ";" );} - | b:"break" { print( b ); print( ";" );} - | #( r:"return" { print( r ); } - ( expr )? - { print( ";" ); } - ) - - -// Labeled statements: - | #( NLabel - ni:ID { print( ni ); print( ":" ); } - ( statement )? - ) - - | #( - ca:"case" { print( ca ); } - expr { print( ":" ); } - (statement)? - ) - - | #( - de:"default" { print( de ); print( ":" ); } - (statement)? - ) - - - -// Selection statements: - - | #( i:"if" { print( i ); print( "(" ); } - expr { print( ")" ); } - statement - ( e:"else" { print( e ); } - statement - )? - ) - | #( sw:"switch" { print( sw ); print( "(" ); } - expr { print( ")" ); } - statement - ) - - - - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - - - - -expr - : - binaryExpr - | conditionalExpr - | castExpr - | unaryExpr - | postfixExpr - | primaryExpr - | emptyExpr - | compoundStatementExpr - | initializer - | rangeExpr - | gnuAsmExpr - ; - -emptyExpr - : NEmptyExpression - ; - -compoundStatementExpr - : #(l:LPAREN { print( l ); } - compoundStatement - r:RPAREN { print( r ); } - ) - ; - -rangeExpr - : #(NRangeExpr expr v:VARARGS{ print( v ); } expr) - ; - -gnuAsmExpr - : #(n:NGnuAsmExpr { print( n ); } - (v:"volatile" { print( v ); } )? - lp:LPAREN { print( lp ); } - stringConst - ( options { warnWhenFollowAmbig = false; }: - c1:COLON { print( c1 );} - (strOptExprPair - ( c2:COMMA { print( c2 ); } strOptExprPair)* - )? - ( options { warnWhenFollowAmbig = false; }: - c3:COLON { print( c3 ); } - (strOptExprPair - ( c4:COMMA { print( c4 ); } strOptExprPair)* - )? - )? - )? - ( c5:COLON { print( c5 ); } - stringConst - ( c6:COMMA { print( c6 ); } - stringConst - )* - )? - rp:RPAREN { print( rp ); } - ) - ; - -strOptExprPair - : stringConst - ( - l:LPAREN { print( l ); } - expr - r:RPAREN { print( r ); } - )? - ; - -binaryOperator - : ASSIGN - | DIV_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN - | STAR_ASSIGN - | MOD_ASSIGN - | RSHIFT_ASSIGN - | LSHIFT_ASSIGN - | BAND_ASSIGN - | BOR_ASSIGN - | BXOR_ASSIGN - | LOR - | LAND - | BOR - | BXOR - | BAND - | EQUAL - | NOT_EQUAL - | LT - | LTE - | GT - | GTE - | LSHIFT - | RSHIFT - | PLUS - | MINUS - | STAR - | DIV - | MOD - | NCommaExpr - ; - -binaryExpr - : b:binaryOperator - // no rules allowed as roots, so here I manually get - // the first and second children of the binary operator - // and then print them out in the right order - { TNode e1, e2; - e1 = (TNode) b.getFirstChild(); - e2 = (TNode) e1.getNextSibling(); - expr( e1 ); - print( b ); - expr( e2 ); - } - - ; - - -conditionalExpr - : #( q:QUESTION - expr { print( q ); } - ( expr )? - c:COLON { print( c ); } - expr - ) - ; - - -castExpr - : #( - c:NCast { print( c ); } - typeName - rp:RPAREN { print( rp ); } - expr - ) - ; - - -typeName - : specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator - : #( NNonemptyAbstractDeclarator - ( pointerGroup - ( (lp1:LPAREN { print( lp1 ); } - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - rp1:RPAREN { print( rp1 ); } - ) - | ( - lb1:LBRACKET { print( lb1 ); } - (expr)? - rb1:RBRACKET { print( rb1 ); } - ) - )* - - | ( (lp2:LPAREN { print( lp2 ); } - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - rp2:RPAREN { print( rp2 ); } - ) - | ( - lb2:LBRACKET { print( lb2 ); } - (expr)? - rb2:RBRACKET { print( rb2 ); } - ) - )+ - ) - ) - ; - - - -unaryExpr - : #( i:INC { print( i ); } expr ) - | #( d:DEC { print( d ); } expr ) - | #( NUnaryExpr u:unaryOperator { print( u ); } expr) - | #( s:"sizeof" { print( s ); } - ( ( LPAREN typeName )=> - lps:LPAREN { print( lps ); } - typeName - rps:RPAREN { print( rps ); } - | expr - ) - ) - | #( a:"__alignof" { print( a ); } - ( ( LPAREN typeName )=> - lpa:LPAREN { print( lpa ); } - typeName - rpa:RPAREN { print( rpa ); } - | expr - ) - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - | LAND - | "__real" - | "__imag" - ; - - -postfixExpr - : #( NPostfixExpr - primaryExpr - ( a:PTR b:ID { print( a ); print( b ); } - | c:DOT d:ID { print( c ); print( d ); } - | #( n:NFunctionCallArgs { print( n ); } - (argExprList)? - rp:RPAREN { print( rp ); } - ) - | lb:LBRACKET { print( lb ); } - expr - rb:RBRACKET { print( rb ); } - | f:INC { print( f ); } - | g:DEC { print( g ); } - )+ - ) - ; - - - -primaryExpr - : i:ID { print( i ); } - | n:Number { print( n ); } - | charConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - - | #( eg:NExpressionGroup { print( eg ); } - expr { print( ")" ); } - ) - ; - - - -argExprList - : expr ( {print( "," );} expr )* - ; - - - -protected -charConst - : c:CharLiteral { print( c ); } - ; - - -protected -stringConst - : #( NStringSeq - ( - s:StringLiteral { print( s ); } - )+ - ) - ; - - -protected -intConst - : IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - - -protected -floatConst - : FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - - - - - - - - - - diff --git a/src/net/java/games/gluegen/cgram/GnuCParser.g b/src/net/java/games/gluegen/cgram/GnuCParser.g deleted file mode 100644 index feed4518e..000000000 --- a/src/net/java/games/gluegen/cgram/GnuCParser.g +++ /dev/null @@ -1,864 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1998 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: GnuCParser -FILE: GnuCParser.g - -AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 - -DESCRIPTION: - This is a grammar for the GNU C compiler. It is a - grammar subclass of StdCParser, overriding only those - rules which are different from Standard C. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { - package net.java.games.gluegen.cgram; - - import java.io.*; - - import antlr.CommonAST; - import antlr.DumpASTVisitor; -} - - -class GnuCParser extends StdCParser; - -options - { - k = 2; - exportVocab = GNUC; - buildAST = true; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x declaration - | ( functionPrefix )=> functionDef - | typelessDeclaration - | asm_expr - | SEMI - ; - -/* these two are here because GCC allows "cat = 13;" as a valid program! */ -functionPrefix - { String declName; } - : ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - | //epsilon - ) - declName = d:declarator[true] - ( declaration )* (VARARGS)? ( SEMI )* - LCURLY - ; - -typelessDeclaration - { AST typeMissing = #[NTypeMissing]; } - : initDeclList[typeMissing] SEMI { ## = #( #[NTypeMissing], ##); } - ; - -initializer - : ( ( ( (initializerElementLabel)=> initializerElementLabel )? - ( assignExpr | lcurlyInitializer ) { ## = #( #[NInitializer], ## ); } - ) - | lcurlyInitializer - ) - ; - -// GCC allows more specific initializers -initializerElementLabel - : ( ( LBRACKET ((constExpr VARARGS)=> rangeExpr | constExpr) RBRACKET (ASSIGN)? ) - | ID COLON - | DOT ID ASSIGN - ) - { ## = #( #[NInitializerElementLabel], ##) ; } - ; - -// GCC allows empty initializer lists -lcurlyInitializer - : - LCURLY^ (initializerList ( COMMA! )? )? RCURLY - { ##.setType( NLcurlyInitializer ); } - ; - -initializerList - : initializer ( options{warnWhenFollowAmbig=false;}:COMMA! initializer )* - ; - - -declarator[boolean isFunctionDefinition] returns [String declName] - { declName = ""; } - : - ( pointerGroup )? - - ( id:ID { declName = id.getText(); } - | LPAREN declName = declarator[false] RPAREN - ) - - ( declaratorParamaterList[isFunctionDefinition, declName] - | LBRACKET ( expr )? RBRACKET - )* - { ## = #( #[NDeclarator], ## ); } - ; - -declaratorParamaterList[boolean isFunctionDefinition, String declName] - : - LPAREN^ - { - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - } - ( - (declSpecifiers)=> parameterTypeList - | (idList)? - ) - { - popScope(); - } - ( COMMA! )? - RPAREN - { ##.setType(NParameterTypeList); } - ; - -parameterTypeList - : parameterDeclaration - ( options { - warnWhenFollowAmbig = false; - } : - ( COMMA | SEMI ) - parameterDeclaration - )* - ( ( COMMA | SEMI ) - VARARGS - )? - ; - - -declarationList - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - - localLabelDeclaration - | ( declarationPredictor )=> declaration - )+ - ; -localLabelDeclaration - : ( //GNU note: any __label__ declarations must come before regular declarations. - "__label__"^ ID (options{warnWhenFollowAmbig=false;}: COMMA! ID)* ( COMMA! )? ( SEMI! )+ - ) - ; - - -declaration - { AST ds1 = null; } - : ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } - ( - initDeclList[ds1] - )? - ( SEMI )+ - { ## = #( #[NDeclaration], ##); } - - ; - -functionStorageClassSpecifier - : "extern" - | "static" - | "inline" - ; - -typeSpecifier [int specCount] returns [int retSpecCount] - { retSpecCount = specCount + 1; } - : - ( "void" - | "char" - | "short" - | "int" - | "__int64" - | "long" - | "float" - | "double" - | "signed" - | "unsigned" - | structOrUnionSpecifier ( options{warnWhenFollowAmbig=false;}: attributeDecl )* - | enumSpecifier - | { specCount==0 }? typedefName - | "typeof"^ LPAREN - ( ( typeName )=> typeName - | expr - ) - RPAREN - | "__complex" - ) - ; - - -structOrUnionSpecifier - { String scopeName; } - : sou:structOrUnion! - ( ( ID LCURLY )=> i:ID l:LCURLY - { - scopeName = #sou.getText() + " " + #i.getText(); - #l.setText(scopeName); - pushScope(scopeName); - } - ( structDeclarationList )? - { popScope();} - RCURLY - | l1:LCURLY - { - scopeName = getAScopeName(); - #l1.setText(scopeName); - pushScope(scopeName); - } - ( structDeclarationList )? - { popScope(); } - RCURLY - | ID - ) - { - ## = #( #sou, ## ); - } - ; - - -structDeclaration - : specifierQualifierList structDeclaratorList ( COMMA! )? ( SEMI! )+ - ; - -structDeclaratorList - : structDeclarator ( options{warnWhenFollowAmbig=false;}: COMMA! structDeclarator )* - ; - -structDeclarator - : ( declarator[false] )? - ( COLON constExpr )? - ( attributeDecl )* - { ## = #( #[NStructDeclarator], ##); } - ; - - - -enumSpecifier - : "enum"^ - ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY - | LCURLY enumList["anonymous"] RCURLY - | ID - ) - ; -enumList[String enumName] - : enumerator[enumName] ( options{warnWhenFollowAmbig=false;}: COMMA! enumerator[enumName] )* ( COMMA! )? - ; - - -initDeclList[AST declarationSpecifiers] - : initDecl[declarationSpecifiers] - ( options{warnWhenFollowAmbig=false;}: COMMA! initDecl[declarationSpecifiers] )* - ( COMMA! )? - ; - -initDecl[AST declarationSpecifiers] - { String declName = ""; } - : declName = d:declarator[false] - { AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(#d); - symbolTable.add(declName, #(null, ds1, d1) ); - } - ( attributeDecl )* - ( ASSIGN initializer - | COLON expr - )? - { ## = #( #[NInitDecl], ## ); } - ; - -attributeDecl - : "__attribute"^ LPAREN LPAREN attributeList RPAREN RPAREN - | "asm"^ LPAREN stringConst RPAREN { ##.setType( NAsmAttribute ); } - ; - -attributeList - : attribute ( options{warnWhenFollowAmbig=false;}: COMMA attribute)* ( COMMA )? - ; - -attribute - : ( ~(LPAREN | RPAREN | COMMA) - | LPAREN attributeList RPAREN - )* - ; -compoundStatement[String scopeName] - : LCURLY^ - - { - pushScope(scopeName); - } - ( //this ambiguity is ok, declarationList and nestedFunctionDef end properly - options { - warnWhenFollowAmbig = false; - } : - ( "typedef" | "__label__" | declaration )=> declarationList - | (nestedFunctionDef)=> nestedFunctionDef - )* - ( statementList )? - { popScope(); } - RCURLY - { ##.setType( NCompoundStatement ); ##.setAttribute( "scopeName", scopeName ); } - ; - -nestedFunctionDef - { String declName; } - : ( "auto" )? //only for nested functions - ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - )? - declName = d:declarator[false] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - pushScope(declName); - } - ( declaration )* - { popScope(); } - compoundStatement[declName] - { ## = #( #[NFunctionDef], ## );} - ; - -statement - : SEMI // Empty statements - - | compoundStatement[getAScopeName()] // Group of statements - - | expr SEMI! { ## = #( #[NStatementExpr], ## );} // Expressions - -// Iteration statements: - - | "while"^ LPAREN! expr RPAREN! statement - | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! - |! "for" - LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN - s:statement - { - if ( #e1 == null) { #e1 = (TNode) #[ NEmptyExpression ]; } - if ( #e2 == null) { #e2 = (TNode) #[ NEmptyExpression ]; } - if ( #e3 == null) { #e3 = (TNode) #[ NEmptyExpression ]; } - ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); - } - - -// Jump statements: - - | "goto"^ expr SEMI! - | "continue" SEMI! - | "break" SEMI! - | "return"^ ( expr )? SEMI! - - - | ID COLON! (options {warnWhenFollowAmbig=false;}: statement)? { ## = #( #[NLabel], ## ); } -// GNU allows range expressions in case statements - | "case"^ ((constExpr VARARGS)=> rangeExpr | constExpr) COLON! ( options{warnWhenFollowAmbig=false;}:statement )? - | "default"^ COLON! ( options{warnWhenFollowAmbig=false;}: statement )? - -// Selection statements: - - | "if"^ - LPAREN! expr RPAREN! statement - ( //standard if-else ambiguity - options { - warnWhenFollowAmbig = false; - } : - "else" statement )? - | "switch"^ LPAREN! expr RPAREN! statement - ; - - - -conditionalExpr - : logicalOrExpr - ( QUESTION^ (expr)? COLON conditionalExpr )? - ; - -rangeExpr //used in initializers only - : constExpr VARARGS constExpr - { ## = #(#[NRangeExpr], ##); } - ; - -castExpr - : ( LPAREN typeName RPAREN )=> - LPAREN^ typeName RPAREN ( castExpr | lcurlyInitializer ) - { ##.setType(NCast); } - - | unaryExpr - ; -nonemptyAbstractDeclarator - : ( - pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - ( COMMA! )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - ( COMMA! )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - { ## = #( #[NNonemptyAbstractDeclarator], ## ); } - - ; - - - -unaryExpr - : postfixExpr - | INC^ castExpr - | DEC^ castExpr - | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } - - | "sizeof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - | "__alignof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - | gnuAsmExpr - ; - -unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT //also stands for complex conjugation - | LNOT - | LAND //for label dereference (&&label) - | "__real" - | "__imag" - ; - -gnuAsmExpr - : "asm"^ ("volatile")? - LPAREN stringConst - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - )? - )? - ( COLON stringConst ( COMMA stringConst)* )? - RPAREN - { ##.setType(NGnuAsmExpr); } - ; - -//GCC requires the PARENs -strOptExprPair - : stringConst ( LPAREN expr RPAREN )? - ; - - -primaryExpr - : ID - | Number - | charConst - | stringConst -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - | (LPAREN LCURLY) => LPAREN^ compoundStatement[getAScopeName()] RPAREN - | LPAREN^ expr RPAREN { ##.setType(NExpressionGroup); } - ; - - -{ - import java.io.*; - import java.util.*; - import antlr.*; -} - -class GnuCLexer extends StdCLexer; -options - { - k = 3; - importVocab = GNUC; - testLiterals = false; - } -tokens { - LITERAL___extension__ = "__extension__"; -} - -{ - public void initialize(String src) - { - setOriginalSource(src); - initialize(); - } - - public void initialize() - { - literals.put(new ANTLRHashString("__alignof__", this), new Integer(LITERAL___alignof)); - literals.put(new ANTLRHashString("__asm", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__asm__", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__attribute__", this), new Integer(LITERAL___attribute)); - literals.put(new ANTLRHashString("__complex__", this), new Integer(LITERAL___complex)); - literals.put(new ANTLRHashString("__const", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__const__", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__imag__", this), new Integer(LITERAL___imag)); - literals.put(new ANTLRHashString("__inline", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__inline__", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__real__", this), new Integer(LITERAL___real)); - literals.put(new ANTLRHashString("__signed", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__signed__", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__typeof", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__typeof__", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__volatile", this), new Integer(LITERAL_volatile)); - literals.put(new ANTLRHashString("__volatile__", this), new Integer(LITERAL_volatile)); - } - - - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - List defines = new ArrayList(); - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - public void addDefine(String name, String value) - { - defines.add(new Define(name, value)); - } - - /** Returns a list of Define objects corresponding to the - preprocessor definitions seen during parsing. */ - public List getDefines() { - return defines; - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -} -Whitespace - : ( ( ' ' | '\t' | '\014') - | "\r\n" { newline(); } - | ( '\n' | '\r' ) { newline(); } - ) { _ttype = Token.SKIP; } - ; - - -protected -Escape - : '\\' - ( options{warnWhenFollowAmbig=false;}: - ~('0'..'7' | 'x') - | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit )* - | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )* - | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ - ) - ; - -protected IntSuffix - : 'L' - | 'l' - | 'U' - | 'u' - | 'I' - | 'i' - | 'J' - | 'j' - ; -protected NumberSuffix - : - IntSuffix - | 'F' - | 'f' - ; - -Number - : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ - ( '.' ( Digit )* ( Exponent )? - | Exponent - ) - ( NumberSuffix - )* - - | ( "..." )=> "..." { _ttype = VARARGS; } - - | '.' { _ttype = DOT; } - ( ( Digit )+ ( Exponent )? - { _ttype = Number; } - ( NumberSuffix - )* - )? - - | '0' ( '0'..'7' )* - ( NumberSuffix - )* - - | '1'..'9' ( Digit )* - ( NumberSuffix - )* - - | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ - ( IntSuffix - )* - ; - -IDMEAT - : - i:ID { - - if ( i.getType() == LITERAL___extension__ ) { - $setType(Token.SKIP); - } - else { - $setType(i.getType()); - } - - } - ; - -protected ID - options - { - testLiterals = true; - } - : ( 'a'..'z' | 'A'..'Z' | '_' | '$') - ( 'a'..'z' | 'A'..'Z' | '_' | '$' | '0'..'9' )* - ; - -WideCharLiteral - : - 'L' CharLiteral - { $setType(CharLiteral); } - ; - - - -WideStringLiteral - : - 'L' StringLiteral - { $setType(StringLiteral); } - ; - -StringLiteral - : - '"' - ( ('\\' ~('\n'))=> Escape - | ( '\r' { newline(); } - | '\n' { - newline(); - } - | '\\' '\n' { - newline(); - } - ) - | ~( '"' | '\r' | '\n' | '\\' ) - )* - '"' - ; - - - - diff --git a/src/net/java/games/gluegen/cgram/GnuCTreeParser.g b/src/net/java/games/gluegen/cgram/GnuCTreeParser.g deleted file mode 100644 index 8400e3e59..000000000 --- a/src/net/java/games/gluegen/cgram/GnuCTreeParser.g +++ /dev/null @@ -1,852 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1998 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: GnuCTreeParser -FILE: GnuCTreeParser.g - -AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 - -DESCRIPTION: - - This tree grammar is for a Gnu C AST. No actions in it, - subclass to do something useful. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { - package net.java.games.gluegen.cgram; - - import java.io.*; - - import antlr.CommonAST; - import antlr.DumpASTVisitor; -} - - -class GnuCTreeParser extends TreeParser; - -options - { - importVocab = GNUC; - buildAST = false; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x typeName - | expr - ) - RPAREN - ) - | "__complex" - ; - - -typedefName - : #(NTypedefName ID) - ; - - -structSpecifier - : #( "struct" structOrUnionBody ) - ; - -unionSpecifier - : #( "union" structOrUnionBody ) - ; - -structOrUnionBody - : ( (ID LCURLY) => ID LCURLY - ( structDeclarationList )? - RCURLY - | LCURLY - ( structDeclarationList )? - RCURLY - | ID - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - -structDeclarationList - : ( structDeclaration )+ - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -structDeclaration - : specifierQualifierList structDeclaratorList - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -specifierQualifierList - : ( - typeSpecifier - | typeQualifier - )+ - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -structDeclaratorList - : ( structDeclarator )+ - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -structDeclarator - : - #( NStructDeclarator - ( declarator )? - ( COLON expr )? - ( attributeDecl )* - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - - -enumSpecifier - : #( "enum" - ( ID )? - ( LCURLY enumList RCURLY )? - ) - ; - - -enumList - : ( enumerator )+ - ; - - -enumerator - : ID ( ASSIGN expr )? - ; - - - -attributeDecl: - #( "__attribute" (.)* ) - | #( NAsmAttribute LPAREN expr RPAREN ) - ; - -initDeclList - : ( initDecl )+ - ; - - -initDecl - { String declName = ""; } - : #( NInitDecl - declarator - ( attributeDecl )* - ( ASSIGN initializer - | COLON expr - )? - ) - ; - - -pointerGroup - : #( NPointerGroup ( STAR ( typeQualifier )* )+ ) - ; - - - -idList - : ID ( COMMA ID )* - ; - - - -initializer - : #( NInitializer (initializerElementLabel)? expr ) - | lcurlyInitializer - ; - -initializerElementLabel - : #( NInitializerElementLabel - ( - ( LBRACKET expr RBRACKET (ASSIGN)? ) - | ID COLON - | DOT ID ASSIGN - ) - ) - ; - -lcurlyInitializer - : #( NLcurlyInitializer - initializerList - RCURLY - ) - ; - -initializerList - : ( initializer )* - ; - - -declarator - : #( NDeclarator - ( pointerGroup )? - - ( id:ID - | LPAREN declarator RPAREN - ) - - ( #( NParameterTypeList - ( - parameterTypeList - | (idList)? - ) - RPAREN - ) - | LBRACKET ( expr )? RBRACKET - )* - ) - ; - - - -parameterTypeList - : ( parameterDeclaration ( COMMA | SEMI )? )+ ( VARARGS )? - ; - - - -parameterDeclaration - : #( NParameterDeclaration - declSpecifiers - (declarator | nonemptyAbstractDeclarator)? - ) - ; - - -functionDef - : #( NFunctionDef - ( functionDeclSpecifiers)? - declarator - (declaration | VARARGS)* - compoundStatement - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - -functionDeclSpecifiers - : - ( functionStorageClassSpecifier - | typeQualifier - | typeSpecifier - )+ - ; - -declarationList - : - ( //ANTLR doesn't know that declarationList properly eats all the declarations - //so it warns about the ambiguity - options { - warnWhenFollowAmbig = false; - } : - localLabelDecl - | declaration - )+ - ; - -localLabelDecl - : #("__label__" (ID)+ ) - ; - - - -compoundStatement - : #( NCompoundStatement - ( declarationList - | functionDef - )* - ( statementList )? - RCURLY - ) - ; - -statementList - : ( statement )+ - ; - -statement - : statementBody - ; - -statementBody - : SEMI // Empty statements - - | compoundStatement // Group of statements - - | #(NStatementExpr expr) // Expressions - -// Iteration statements: - - | #( "while" expr statement ) - | #( "do" statement expr ) - | #( "for" - expr expr expr - statement - ) - - -// Jump statements: - - | #( "goto" expr ) - | "continue" - | "break" - | #( "return" ( expr )? ) - - -// Labeled statements: - | #( NLabel ID (statement)? ) - | #( "case" expr (statement)? ) - | #( "default" (statement)? ) - - - -// Selection statements: - - | #( "if" - expr statement - ( "else" statement )? - ) - | #( "switch" expr statement ) - - - - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - - - - -expr - : assignExpr - | conditionalExpr - | logicalOrExpr - | logicalAndExpr - | inclusiveOrExpr - | exclusiveOrExpr - | bitAndExpr - | equalityExpr - | relationalExpr - | shiftExpr - | additiveExpr - | multExpr - | castExpr - | unaryExpr - | postfixExpr - | primaryExpr - | commaExpr - | emptyExpr - | compoundStatementExpr - | initializer - | rangeExpr - | gnuAsmExpr - ; - -commaExpr - : #(NCommaExpr expr expr) - ; - -emptyExpr - : NEmptyExpression - ; - -compoundStatementExpr - : #(LPAREN compoundStatement RPAREN) - ; - -rangeExpr - : #(NRangeExpr expr VARARGS expr) - ; - -gnuAsmExpr - : #(NGnuAsmExpr - ("volatile")? - LPAREN stringConst - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - )? - )? - ( COLON stringConst ( COMMA stringConst)* )? - RPAREN - ) - ; - -strOptExprPair - : stringConst ( LPAREN expr RPAREN )? - ; - -assignExpr - : #( ASSIGN expr expr) - | #( DIV_ASSIGN expr expr) - | #( PLUS_ASSIGN expr expr) - | #( MINUS_ASSIGN expr expr) - | #( STAR_ASSIGN expr expr) - | #( MOD_ASSIGN expr expr) - | #( RSHIFT_ASSIGN expr expr) - | #( LSHIFT_ASSIGN expr expr) - | #( BAND_ASSIGN expr expr) - | #( BOR_ASSIGN expr expr) - | #( BXOR_ASSIGN expr expr) - ; - - -conditionalExpr - : #( QUESTION expr (expr)? COLON expr ) - ; - - -logicalOrExpr - : #( LOR expr expr) - ; - - -logicalAndExpr - : #( LAND expr expr ) - ; - - -inclusiveOrExpr - : #( BOR expr expr ) - ; - - -exclusiveOrExpr - : #( BXOR expr expr ) - ; - - -bitAndExpr - : #( BAND expr expr ) - ; - - - -equalityExpr - : #( EQUAL expr expr) - | #( NOT_EQUAL expr expr) - ; - - -relationalExpr - : #( LT expr expr) - | #( LTE expr expr) - | #( GT expr expr) - | #( GTE expr expr) - ; - - - -shiftExpr - : #( LSHIFT expr expr) - | #( RSHIFT expr expr) - ; - - -additiveExpr - : #( PLUS expr expr) - | #( MINUS expr expr) - ; - - -multExpr - : #( STAR expr expr) - | #( DIV expr expr) - | #( MOD expr expr) - ; - - - -castExpr - : #( NCast typeName RPAREN expr) - ; - - -typeName - : specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator - : #( NNonemptyAbstractDeclarator - ( pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - ) - ; - - - -unaryExpr - : #( INC expr ) - | #( DEC expr ) - | #( NUnaryExpr unaryOperator expr) - | #( "sizeof" - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | expr - ) - ) - | #( "__alignof" - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | expr - ) - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - | LAND - | "__real" - | "__imag" - ; - - -postfixExpr - : #( NPostfixExpr - primaryExpr - ( PTR ID - | DOT ID - | #( NFunctionCallArgs (argExprList)? RPAREN ) - | LBRACKET expr RBRACKET - | INC - | DEC - )+ - ) - ; - - - -primaryExpr - : ID - | Number - | charConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - - | #( NExpressionGroup expr ) - ; - - - -argExprList - : ( expr )+ - ; - - - -protected -charConst - : CharLiteral - ; - - -protected -stringConst - : #(NStringSeq (StringLiteral)+) - ; - - -protected -intConst - : IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - - -protected -floatConst - : FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - - - - - - - - - diff --git a/src/net/java/games/gluegen/cgram/HeaderParser.g b/src/net/java/games/gluegen/cgram/HeaderParser.g deleted file mode 100644 index 1263c30b8..000000000 --- a/src/net/java/games/gluegen/cgram/HeaderParser.g +++ /dev/null @@ -1,715 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -header { - package net.java.games.gluegen.cgram; - - import java.io.*; - import java.util.*; - - import antlr.CommonAST; - import net.java.games.gluegen.cgram.types.*; -} - -class HeaderParser extends GnuCTreeParser; -options { - k = 1; -} - -{ - /** Name assigned to a anonymous EnumType (e.g., "enum { ... }"). */ - public static final String ANONYMOUS_ENUM_NAME = ""; - - /** Set the machine description for this HeaderParser. Must be - done before parsing. */ - public void setMachineDescription(MachineDescription machDesc) { - this.machDesc = machDesc; - } - - /** Returns the MachineDescription this HeaderParser uses. */ - public MachineDescription machineDescription() { - return machDesc; - } - - /** Set the dictionary mapping typedef names to types for this - HeaderParser. Must be done before parsing. */ - public void setTypedefDictionary(TypeDictionary dict) { - this.typedefDictionary = dict; - } - - /** Returns the typedef dictionary this HeaderParser uses. */ - public TypeDictionary getTypedefDictionary() { - return typedefDictionary; - } - - /** Set the dictionary mapping struct names (i.e., the "foo" in - "struct foo { ... };") to types for this HeaderParser. Must be done - before parsing. */ - public void setStructDictionary(TypeDictionary dict) { - this.structDictionary = dict; - } - - /** Returns the struct name dictionary this HeaderParser uses. */ - public TypeDictionary getStructDictionary() { - return structDictionary; - } - - /** Get the canonicalization map, which is a regular HashMap - mapping Type to Type and which is used for looking up the unique - instances of e.g. pointer-to-structure types that have been typedefed - and therefore have names. */ - public Map getCanonMap() { - return canonMap; - } - - /** Pre-define the list of EnumTypes for this HeaderParser. Must be - done before parsing. */ - public void setEnums(List/**/ enumTypes) { - // FIXME: Need to take the input set of EnumTypes, extract all - // the enumerates from each EnumType, and fill in the enumHash - // so that each enumerate maps to the enumType to which it - // belongs. - throw new RuntimeException("setEnums is Unimplemented!"); - } - - /** Returns the EnumTypes this HeaderParser processed. */ - public List/**/ getEnums() { - return new ArrayList(enumHash.values()); - } - - /** Clears the list of functions this HeaderParser has parsed. - Useful when reusing the same HeaderParser for more than one - header file. */ - public void clearParsedFunctions() { - functions.clear(); - } - - /** Returns the list of FunctionSymbols this HeaderParser has parsed. */ - public List getParsedFunctions() { - return functions; - } - - private CompoundType lookupInStructDictionary(String typeName, - CompoundTypeKind kind, - int cvAttrs) { - CompoundType t = (CompoundType) structDictionary.get(typeName); - if (t == null) { - t = new CompoundType(null, -1, kind, cvAttrs); - t.setStructName(typeName); - structDictionary.put(typeName, t); - } - return t; - } - - private Type lookupInTypedefDictionary(String typeName) { - Type t = typedefDictionary.get(typeName); - if (t == null) { - throw new RuntimeException("Undefined reference to typedef name " + typeName); - } - return t; - } - - static class ParameterDeclaration { - private String id; - private Type type; - - ParameterDeclaration(String id, Type type) { - this.id = id; - this.type = type; - } - String id() { return id; } - Type type() { return type; } - } - - // A box for a Type. Allows type to be passed down to be modified by recursive rules. - static class TypeBox { - private Type origType; - private Type type; - private boolean isTypedef; - - TypeBox(Type type) { - this(type, false); - } - - TypeBox(Type type, boolean isTypedef) { - this.origType = type; - this.isTypedef = isTypedef; - } - - Type type() { - if (type == null) { - return origType; - } - return type; - } - void setType(Type type) { - this.type = type; - } - void reset() { - type = null; - } - - boolean isTypedef() { return isTypedef; } - - // for easier debugging - public String toString() { - String tStr = "Type=NULL_REF"; - if (type == origType) { - tStr = "Type=ORIG_TYPE"; - } else if (type != null) { - tStr = "Type: name=\"" + type.getCVAttributesString() + " " + - type.getName() + "\"; signature=\"" + type + "\"; class " + - type.getClass().getName(); - } - String oStr = "OrigType=NULL_REF"; - if (origType != null) { - oStr = "OrigType: name=\"" + origType.getCVAttributesString() + " " + - origType.getName() + "\"; signature=\"" + origType + "\"; class " + - origType.getClass().getName(); - } - return "<["+tStr + "] [" + oStr + "] " + " isTypedef=" + isTypedef+">"; - } - } - - private MachineDescription machDesc; - private boolean doDeclaration; // Used to only process function typedefs - private String declId; - private List parameters; - private TypeDictionary typedefDictionary; - private TypeDictionary structDictionary; - private List/**/ functions = new ArrayList(); - // hash from name of an enumerated value to the EnumType to which it belongs - private HashMap/**/ enumHash = new HashMap(); - - // Storage class specifiers - private static final int AUTO = 1 << 0; - private static final int REGISTER = 1 << 1; - private static final int TYPEDEF = 1 << 2; - // Function storage class specifiers - private static final int EXTERN = 1 << 3; - private static final int STATIC = 1 << 4; - private static final int INLINE = 1 << 5; - // Type qualifiers - private static final int CONST = 1 << 6; - private static final int VOLATILE = 1 << 7; - private static final int SIGNED = 1 << 8; - private static final int UNSIGNED = 1 << 9; - - private void initDeclaration() { - doDeclaration = false; - declId = null; - } - - private void doDeclaration() { - doDeclaration = true; - } - - private void processDeclaration(Type returnType) { - if (doDeclaration) { - FunctionSymbol sym = new FunctionSymbol(declId, new FunctionType(null, -1, returnType, 0)); - if (parameters != null) { // handle funcs w/ empty parameter lists (e.g., "foo()") - for (Iterator iter = parameters.iterator(); iter.hasNext(); ) { - ParameterDeclaration pd = (ParameterDeclaration) iter.next(); - sym.addArgument(pd.type(), pd.id()); - } - } - functions.add(sym); - } - } - - private int attrs2CVAttrs(int attrs) { - int cvAttrs = 0; - if ((attrs & CONST) != 0) { - cvAttrs |= CVAttributes.CONST; - } - if ((attrs & VOLATILE) != 0) { - cvAttrs |= CVAttributes.VOLATILE; - } - return cvAttrs; - } - - /** Helper routine which handles creating a pointer or array type - for [] expressions */ - private void handleArrayExpr(TypeBox tb, AST t) { - if (t != null) { - try { - // FIXME: this doesn't take into account struct alignment, which may be necessary - // See also FIXMEs in ArrayType.java - int len = parseIntConstExpr(t); - tb.setType(canonicalize(new ArrayType(tb.type(), len * tb.type().getSize(), len, 0))); - return; - } catch (RecognitionException e) { - // Fall through - } - } - tb.setType(canonicalize(new PointerType(machDesc.pointerSizeInBytes(), - tb.type(), - 0))); - } - - private int parseIntConstExpr(AST t) throws RecognitionException { - return intConstExpr(t); - } - - /** Utility function: creates a new EnumType with the given name, or - returns an existing one if it has already been created. */ - private EnumType getEnumType(String enumTypeName) { - EnumType enumType = null; - Iterator it = enumHash.values().iterator(); - while (it.hasNext()) { - EnumType potentialMatch = (EnumType)it.next(); - if (potentialMatch.getName().equals(enumTypeName)) { - enumType = potentialMatch; - break; - } - } - - if (enumType == null) { - enumType = new EnumType(enumTypeName, machDesc.longSizeInBytes()); - } - - return enumType; - } - - // Map used to canonicalize types. For example, we may typedef - // struct foo { ... } *pfoo; subsequent references to struct foo* should - // point to the same PointerType object that had its name set to "pfoo". - private Map canonMap = new HashMap(); - private Type canonicalize(Type t) { - Type res = (Type) canonMap.get(t); - if (res != null) { - return res; - } - canonMap.put(t, t); - return t; - } -} - -declarator[TypeBox tb] returns [String s] { - initDeclaration(); - s = null; - List params = null; - String funcPointerName = null; - TypeBox dummyTypeBox = null; -} - : #( NDeclarator - ( pointerGroup[tb] )? - - ( id:ID { s = id.getText(); } - | LPAREN funcPointerName = declarator[dummyTypeBox] RPAREN - ) - - ( #( NParameterTypeList - ( - params = parameterTypeList - | (idList)? - ) - RPAREN - ) { - if (id != null) { - declId = id.getText(); - parameters = params; // FIXME: Ken, why are we setting this class member here? - doDeclaration(); - } else if ( funcPointerName != null ) { - /* TypeBox becomes function pointer in this case */ - FunctionType ft = new FunctionType(null, -1, tb.type(), 0); - if (params == null) { - // If the function pointer has no declared parameters, it's a - // void function. I'm not sure if the parameter name is - // ever referenced anywhere when the type is VoidType, so - // just in case I'll set it to a comment string so it will - // still compile if written out to code anywhere. - ft.addArgument(new VoidType(0), "/*unnamed-void*/"); - } else { - for (Iterator iter = params.iterator(); iter.hasNext(); ) { - ParameterDeclaration pd = (ParameterDeclaration) iter.next(); - ft.addArgument(pd.type(), pd.id()); - } - } - tb.setType(canonicalize(new PointerType(machDesc.pointerSizeInBytes(), - ft, - 0))); - s = funcPointerName; - } - } - | LBRACKET ( e:expr )? RBRACKET { handleArrayExpr(tb, e); } - )* - ) - ; - -typelessDeclaration { - TypeBox tb = null; -} - : #(NTypeMissing initDeclList[tb] SEMI) - ; - -declaration { - TypeBox tb = null; -} - : #( NDeclaration - tb = declSpecifiers - ( - initDeclList[tb] - )? - ( SEMI )+ - ) { processDeclaration(tb.type()); } - ; - -parameterTypeList returns [List l] { l = new ArrayList(); ParameterDeclaration decl = null; } - : ( decl = parameterDeclaration { if (decl != null) l.add(decl); } ( COMMA | SEMI )? )+ ( VARARGS )? - ; - -parameterDeclaration returns [ParameterDeclaration pd] { - Type t = null; - String decl = null; - pd = null; - TypeBox tb = null; -} - : #( NParameterDeclaration - tb = declSpecifiers - (decl = declarator[tb] | nonemptyAbstractDeclarator[tb])? - ) { pd = new ParameterDeclaration(decl, tb.type()); } - ; - -functionDef { - TypeBox tb = null; -} - : #( NFunctionDef - ( functionDeclSpecifiers)? - declarator[tb] - (declaration | VARARGS)* - compoundStatement - ) - ; - -declSpecifiers returns [TypeBox tb] { - tb = null; - Type t = null; - int x = 0; - int y = 0; -} - : ( y = storageClassSpecifier { x |= y; } - | y = typeQualifier { x |= y; } - | t = typeSpecifier[x] - )+ -{ - if (t == null && - (x & (SIGNED | UNSIGNED)) != 0) { - t = new IntType("int", machDesc.intSizeInBytes(), ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); - } - tb = new TypeBox(t, ((x & TYPEDEF) != 0)); -} - ; - -storageClassSpecifier returns [int x] { x = 0; } - : "auto" { x |= AUTO; } - | "register" { x |= REGISTER; } - | "typedef" { x |= TYPEDEF; } - | x = functionStorageClassSpecifier - ; - - -functionStorageClassSpecifier returns [int x] { x = 0; } - : "extern" { x |= EXTERN; } - | "static" { x |= STATIC; } - | "inline" { x |= INLINE; } - ; - - -typeQualifier returns [int x] { x = 0; } - : "const" { x |= CONST; } - | "volatile" { x |= VOLATILE; } - | "signed" { x |= SIGNED; } - | "unsigned" { x |= UNSIGNED; } - ; - -typeSpecifier[int attributes] returns [Type t] { - t = null; - int cvAttrs = attrs2CVAttrs(attributes); - boolean unsigned = ((attributes & UNSIGNED) != 0); -} - : "void" { t = new VoidType(cvAttrs); } - | "char" { t = new IntType("char" , machDesc.charSizeInBytes(), unsigned, cvAttrs); } - | "short" { t = new IntType("short", machDesc.shortSizeInBytes(), unsigned, cvAttrs); } - | "int" { t = new IntType("int" , machDesc.intSizeInBytes(), unsigned, cvAttrs); } - | "long" { t = new IntType("long" , machDesc.longSizeInBytes(), unsigned, cvAttrs); } - | "__int64" { t = new IntType("__int64", machDesc.int64SizeInBytes(), unsigned, cvAttrs); } - | "float" { t = new FloatType("float", machDesc.floatSizeInBytes(), cvAttrs); } - | "double" { t = new DoubleType("double", machDesc.doubleSizeInBytes(), cvAttrs); } - | t = structSpecifier[cvAttrs] ( attributeDecl )* - | t = unionSpecifier [cvAttrs] ( attributeDecl )* - | t = enumSpecifier [cvAttrs] - | t = typedefName [cvAttrs] - | #("typeof" LPAREN - ( (typeName )=> typeName - | expr - ) - RPAREN - ) - | "__complex" - ; - -typedefName[int cvAttrs] returns [Type t] { t = null; } - : #(NTypedefName id : ID) - { - t = canonicalize(lookupInTypedefDictionary(id.getText()).getCVVariant(cvAttrs)); - } - ; - -structSpecifier[int cvAttrs] returns [Type t] { t = null; } - : #( "struct" t = structOrUnionBody[CompoundTypeKind.STRUCT, cvAttrs] ) - ; - -unionSpecifier[int cvAttrs] returns [Type t] { t = null; } - : #( "union" t = structOrUnionBody[CompoundTypeKind.UNION, cvAttrs] ) - ; - -structOrUnionBody[CompoundTypeKind kind, int cvAttrs] returns [CompoundType t] { - t = null; -} - : ( (ID LCURLY) => id:ID LCURLY { - t = (CompoundType) canonicalize(lookupInStructDictionary(id.getText(), kind, cvAttrs)); - } ( structDeclarationList[t] )? - RCURLY { t.setBodyParsed(); } - | LCURLY { t = new CompoundType(null, -1, kind, cvAttrs); } - ( structDeclarationList[t] )? - RCURLY { t.setBodyParsed(); } - | id2:ID { t = (CompoundType) canonicalize(lookupInStructDictionary(id2.getText(), kind, cvAttrs)); } - ) - ; - -structDeclarationList[CompoundType t] - : ( structDeclaration[t] )+ - ; - -structDeclaration[CompoundType containingType] { - Type t = null; - boolean addedAny = false; -} - : t = specifierQualifierList addedAny = structDeclaratorList[containingType, t] { - if (!addedAny) { - if (t != null) { - CompoundType ct = t.asCompound(); - if (ct.isUnion()) { - // Anonymous union - containingType.addField(new Field(null, t, -1)); - } - } - } - } - ; - -specifierQualifierList returns [Type t] { - t = null; int x = 0; int y = 0; -} - : ( - t = typeSpecifier[x] - | y = typeQualifier { x |= y; } - )+ { - if (t == null && - (x & (SIGNED | UNSIGNED)) != 0) { - t = new IntType("int", machDesc.intSizeInBytes(), ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); - } -} - ; - -structDeclaratorList[CompoundType containingType, Type t] returns [boolean addedAny] { - addedAny = false; - boolean y = false; -} - : ( y = structDeclarator[containingType, t] { addedAny = y; })+ - ; - -structDeclarator[CompoundType containingType, Type t] returns [boolean addedAny] { - addedAny = false; - String s = null; - TypeBox tb = new TypeBox(t); -} - : - #( NStructDeclarator - ( s = declarator[tb] { containingType.addField(new Field(s, tb.type(), -1)); addedAny = true; } )? - ( COLON expr { /* FIXME: bit types not handled yet */ } ) ? - ( attributeDecl )* - ) - ; - -// FIXME: this will not correctly set the name of the enumeration when -// encountering a declaration like this: -// -// typedef enum { } enumName; -// -// In this case calling getName() on the EnumType return value will -// incorrectly return HeaderParser.ANONYMOUS_ENUM_NAME instead of -// "enumName" -// -// I haven't implemented it yet because I'm not sure how to get the -// "enumName" *before* executing the enumList rule. -enumSpecifier [int cvAttrs] returns [Type t] { - t = null; -} - : #( "enum" - ( ( ID LCURLY )=> i:ID LCURLY enumList[(EnumType)(t = getEnumType(i.getText()))] RCURLY - | LCURLY enumList[(EnumType)(t = getEnumType(ANONYMOUS_ENUM_NAME))] RCURLY - | ID { t = getEnumType(i.getText()); } - ) - ) - ; - -enumList[EnumType enumeration] { - long defaultEnumerantValue = 0; -} - : ( defaultEnumerantValue = enumerator[enumeration, defaultEnumerantValue] )+ - ; - -enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValue] { - newDefaultValue = defaultValue; -} - : eName:ID ( ASSIGN eVal:expr )? { - // FIXME! Integer.parseInt() will throw if its argument is in octal or hex format. - long value = (eVal == null) ? defaultValue : Long.parseLong(eVal.getText()); - newDefaultValue = value+1; - String eTxt = eName.getText(); - if (enumHash.containsKey(eTxt)) { - EnumType oldEnumType = ((EnumType)enumHash.get(eTxt)); - long oldValue = oldEnumType.getEnumValue(eTxt); - System.err.println("WARNING: redefinition of enumerated value '" + eTxt + "';" + - " existing definition is in enumeration '" + oldEnumType.getName() + - "' with value " + oldValue + " and new definition is in enumeration '" + - enumeration.getName() + "' with value " + value); - // remove old definition - oldEnumType.removeEnumerate(eTxt); - } - // insert new definition - enumeration.addEnum(eTxt, value); - enumHash.put(eTxt, enumeration); - //System.err.println("ENUM [" + enumeration.getName() + "]: " + eTxt + " = " + enumeration.getEnumValue(eTxt) + - // " (new default = " + newDefaultValue + ")"); - } - ; - -initDeclList[TypeBox tb] - : ( initDecl[tb] )+ - ; - -initDecl[TypeBox tb] { - String declName = null; -} - : #( NInitDecl - declName = declarator[tb] { - //System.err.println("GOT declName: " + declName + " TB=" + tb); - } - ( attributeDecl )* - ( ASSIGN initializer - | COLON expr - )? - ) -{ - if ((declName != null) && (tb != null) && tb.isTypedef()) { - Type t = tb.type(); - //System.err.println("Adding typedef mapping: [" + declName + "] -> [" + t + "]"); - if (!t.hasTypedefName()) { - t.setName(declName); - } - t = canonicalize(t); - typedefDictionary.put(declName, t); - // Clear out PointerGroup effects in case another typedef variant follows - tb.reset(); - } -} - ; - -pointerGroup[TypeBox tb] { int x = 0; int y = 0; } - : #( NPointerGroup ( STAR { x = 0; y = 0; } ( y = typeQualifier { x |= y; } )* - { - //System.err.println("IN PTR GROUP: TB=" + tb); - if (tb != null) { - tb.setType(canonicalize(new PointerType(machDesc.pointerSizeInBytes(), - tb.type(), - attrs2CVAttrs(x)))); - } - } - )+ ) - ; - - -functionDeclSpecifiers - : - ( functionStorageClassSpecifier - | typeQualifier - | typeSpecifier[0] - )+ - ; - -typeName { - TypeBox tb = null; -} - : specifierQualifierList (nonemptyAbstractDeclarator[tb])? - ; - - -/* FIXME: the handling of types in this rule has not been well thought - out and is known to be incomplete. Currently it is only used to handle - pointerGroups for unnamed parameters. */ -nonemptyAbstractDeclarator[TypeBox tb] - : #( NNonemptyAbstractDeclarator - ( pointerGroup[tb] - ( (LPAREN - ( nonemptyAbstractDeclarator[tb] - | parameterTypeList - )? - RPAREN) - | (LBRACKET (e1:expr)? RBRACKET) { handleArrayExpr(tb, e1); } - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator[tb] - | parameterTypeList - )? - RPAREN) - | (LBRACKET (e2:expr)? RBRACKET) { handleArrayExpr(tb, e2); } - )+ - ) - ) - ; - -/* Helper routine for parsing expressions which evaluate to integer - constants. Can be made more complicated as necessary. */ -intConstExpr returns [int i] { i = -1; } - : n:Number { return Integer.parseInt(n.getText()); } - ; diff --git a/src/net/java/games/gluegen/cgram/LineObject.java b/src/net/java/games/gluegen/cgram/LineObject.java deleted file mode 100644 index 578e14194..000000000 --- a/src/net/java/games/gluegen/cgram/LineObject.java +++ /dev/null @@ -1,126 +0,0 @@ -package net.java.games.gluegen.cgram; - -class LineObject { - LineObject parent = null; - String source = ""; - int line = 1; - boolean enteringFile = false; - boolean returningToFile = false; - boolean systemHeader = false; - boolean treatAsC = false; - - public LineObject() - { - super(); - } - - public LineObject( LineObject lobj ) - { - parent = lobj.getParent(); - source = lobj.getSource(); - line = lobj.getLine(); - enteringFile = lobj.getEnteringFile(); - returningToFile = lobj.getReturningToFile(); - systemHeader = lobj.getSystemHeader(); - treatAsC = lobj.getTreatAsC(); - } - - public LineObject( String src) - { - source = src; - } - - public void setSource(String src) - { - source = src; - } - - public String getSource() - { - return source; - } - - public void setParent(LineObject par) - { - parent = par; - } - - public LineObject getParent() - { - return parent; - } - - public void setLine(int l) - { - line = l; - } - - public int getLine() - { - return line; - } - - public void newline() - { - line++; - } - - public void setEnteringFile(boolean v) - { - enteringFile = v; - } - - public boolean getEnteringFile() - { - return enteringFile; - } - - public void setReturningToFile(boolean v) - { - returningToFile = v; - } - - public boolean getReturningToFile() - { - return returningToFile; - } - - public void setSystemHeader(boolean v) - { - systemHeader = v; - } - - public boolean getSystemHeader() - { - return systemHeader; - } - - public void setTreatAsC(boolean v) - { - treatAsC = v; - } - - public boolean getTreatAsC() - { - return treatAsC; - } - - public String toString() { - StringBuffer ret; - ret = new StringBuffer("# " + line + " \"" + source + "\""); - if (enteringFile) { - ret.append(" 1"); - } - if (returningToFile) { - ret.append(" 2"); - } - if (systemHeader) { - ret.append(" 3"); - } - if (treatAsC) { - ret.append(" 4"); - } - return ret.toString(); - } -} - diff --git a/src/net/java/games/gluegen/cgram/PreprocessorInfoChannel.java b/src/net/java/games/gluegen/cgram/PreprocessorInfoChannel.java deleted file mode 100644 index f2de592c7..000000000 --- a/src/net/java/games/gluegen/cgram/PreprocessorInfoChannel.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.java.games.gluegen.cgram; - -import java.util.*; - -public class PreprocessorInfoChannel -{ - Hashtable lineLists = new Hashtable(); // indexed by Token number - int firstValidTokenNumber = 0; - int maxTokenNumber = 0; - - public void addLineForTokenNumber( Object line, Integer toknum ) - { - if ( lineLists.containsKey( toknum ) ) { - Vector lines = (Vector) lineLists.get( toknum ); - lines.addElement(line); - } - else { - Vector lines = new Vector(); - lines.addElement(line); - lineLists.put(toknum, lines); - if ( maxTokenNumber < toknum.intValue() ) { - maxTokenNumber = toknum.intValue(); - } - } - } - - public int getMaxTokenNumber() - { - return maxTokenNumber; - } - - public Vector extractLinesPrecedingTokenNumber( Integer toknum ) - { - Vector lines = new Vector(); - if (toknum == null) return lines; - for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){ - Integer inti = new Integer(i); - if ( lineLists.containsKey( inti ) ) { - Vector tokenLineVector = (Vector) lineLists.get( inti ); - if ( tokenLineVector != null) { - Enumeration tokenLines = tokenLineVector.elements(); - while ( tokenLines.hasMoreElements() ) { - lines.addElement( tokenLines.nextElement() ); - } - lineLists.remove(inti); - } - } - } - firstValidTokenNumber = toknum.intValue(); - return lines; - } - - public String toString() - { - StringBuffer sb = new StringBuffer("PreprocessorInfoChannel:\n"); - for (int i = 0; i <= maxTokenNumber + 1; i++){ - Integer inti = new Integer(i); - if ( lineLists.containsKey( inti ) ) { - Vector tokenLineVector = (Vector) lineLists.get( inti ); - if ( tokenLineVector != null) { - Enumeration tokenLines = tokenLineVector.elements(); - while ( tokenLines.hasMoreElements() ) { - sb.append(inti + ":" + tokenLines.nextElement() + '\n'); - } - } - } - } - return sb.toString(); - } -} - - - diff --git a/src/net/java/games/gluegen/cgram/StdCParser.g b/src/net/java/games/gluegen/cgram/StdCParser.g deleted file mode 100644 index 65f7468bf..000000000 --- a/src/net/java/games/gluegen/cgram/StdCParser.g +++ /dev/null @@ -1,1375 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1997 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: Parser -FILE: stdc.g - -AUTHOR: John D. Mitchell (john@non.net), Jul 12, 1997 - -REVISION HISTORY: - - Name Date Description - ---- ---- ----------- - JDM 97.07.12 Initial version. - JTC 97.11.18 Declaration vs declarator & misc. hacking. - JDM 97.11.20 Fixed: declaration vs funcDef, - parenthesized expressions, - declarator iteration, - varargs recognition, - empty source file recognition, - and some typos. - - -DESCRIPTION: - - This grammar supports the Standard C language. - - Note clearly that this grammar does *NOT* deal with - preprocessor functionality (including things like trigraphs) - Nor does this grammar deal with multi-byte characters nor strings - containing multi-byte characters [these constructs are "exercises - for the reader" as it were :-)]. - - Please refer to the ISO/ANSI C Language Standard if you believe - this grammar to be in error. Please cite chapter and verse in any - correspondence to the author to back up your claim. - -TODO: - - - typedefName is commented out, needs a symbol table to resolve - ambiguity. - - - trees - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { - package net.java.games.gluegen.cgram; - - import java.io.*; - - import antlr.CommonAST; - import antlr.DumpASTVisitor; -} - - -class StdCParser extends Parser; - -options - { - k = 2; - exportVocab = STDC; - buildAST = true; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x declaration - | functionDef - | asm_expr - ; - - -asm_expr - : "asm"^ - ("volatile")? LCURLY! expr RCURLY! SEMI! - ; - - -declaration - { AST ds1 = null; } - : ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } - ( - initDeclList[ds1] - )? - SEMI! - { ## = #( #[NDeclaration], ##); } - - ; - - -declSpecifiers - { int specCount=0; } - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - s:storageClassSpecifier - | typeQualifier - | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - )+ - ; - -storageClassSpecifier - : "auto" - | "register" - | "typedef" - | functionStorageClassSpecifier - ; - - -functionStorageClassSpecifier - : "extern" - | "static" - ; - - -typeQualifier - : "const" - | "volatile" - ; - -typeSpecifier [int specCount] returns [int retSpecCount] - { retSpecCount = specCount + 1; } - : - ( "void" - | "char" - | "short" - | "int" - | "long" - | "float" - | "double" - | "signed" - | "unsigned" - | structOrUnionSpecifier - | enumSpecifier - | { specCount == 0 }? typedefName - ) - ; - - -typedefName - : { isTypedefName ( LT(1).getText() ) }? - i:ID { ## = #(#[NTypedefName], #i); } - ; - -structOrUnionSpecifier - { String scopeName; } - : sou:structOrUnion! - ( ( ID LCURLY )=> i:ID l:LCURLY - { - scopeName = #sou.getText() + " " + #i.getText(); - #l.setText(scopeName); - pushScope(scopeName); - } - structDeclarationList - { popScope();} - RCURLY! - | l1:LCURLY - { - scopeName = getAScopeName(); - #l1.setText(scopeName); - pushScope(scopeName); - } - structDeclarationList - { popScope(); } - RCURLY! - | ID - ) - { - ## = #( #sou, ## ); - } - ; - - -structOrUnion - : "struct" - | "union" - ; - - -structDeclarationList - : ( structDeclaration )+ - ; - - -structDeclaration - : specifierQualifierList structDeclaratorList ( SEMI! )+ - ; - - -specifierQualifierList - { int specCount = 0; } - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - | typeQualifier - )+ - ; - - -structDeclaratorList - : structDeclarator ( COMMA! structDeclarator )* - ; - - -structDeclarator - : - ( COLON constExpr - | declarator[false] ( COLON constExpr )? - ) - { ## = #( #[NStructDeclarator], ##); } - ; - - -enumSpecifier - : "enum"^ - ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY! - | LCURLY enumList["anonymous"] RCURLY! - | ID - ) - ; - - -enumList[String enumName] - : enumerator[enumName] ( COMMA! enumerator[enumName] )* - ; - -enumerator[String enumName] - : i:ID { symbolTable.add( i.getText(), - #( null, - #[LITERAL_enum, "enum"], - #[ ID, enumName] - ) - ); - } - (ASSIGN constExpr)? - ; - - -initDeclList[AST declarationSpecifiers] - : initDecl[declarationSpecifiers] - ( COMMA! initDecl[declarationSpecifiers] )* - ; - - -initDecl[AST declarationSpecifiers] - { String declName = ""; } - : declName = d:declarator[false] - { AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(#d); - symbolTable.add(declName, #(null, ds1, d1) ); - } - ( ASSIGN initializer - | COLON expr - )? - { ## = #( #[NInitDecl], ## ); } - - ; - -pointerGroup - : ( STAR ( typeQualifier )* )+ { ## = #( #[NPointerGroup], ##); } - ; - - - -idList - : ID ( COMMA! ID )* - ; - - -initializer - : ( assignExpr - | LCURLY initializerList ( COMMA! )? RCURLY! - ) - { ## = #( #[NInitializer], ## ); } - ; - - -initializerList - : initializer ( COMMA! initializer )* - ; - - -declarator[boolean isFunctionDefinition] returns [String declName] - { declName = ""; } - : - ( pointerGroup )? - - ( id:ID { declName = id.getText(); } - | LPAREN declName = declarator[false] RPAREN - ) - - ( ! LPAREN - { - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - } - ( - (declSpecifiers)=> p:parameterTypeList - { - ## = #( null, ##, #( #[NParameterTypeList], #p ) ); - } - - | (i:idList)? - { - ## = #( null, ##, #( #[NParameterTypeList], #i ) ); - } - ) - { - popScope(); - } - RPAREN - | LBRACKET ( constExpr )? RBRACKET - )* - { ## = #( #[NDeclarator], ## ); } - ; - -parameterTypeList - : parameterDeclaration - ( options { - warnWhenFollowAmbig = false; - } : - COMMA! - parameterDeclaration - )* - ( COMMA! - VARARGS - )? - ; - - -parameterDeclaration - { String declName; } - : ds:declSpecifiers - ( ( declarator[false] )=> declName = d:declarator[false] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - } - | nonemptyAbstractDeclarator - )? - { - ## = #( #[NParameterDeclaration], ## ); - } - ; - -/* JTC: - * This handles both new and old style functions. - * see declarator rule to see differences in parameters - * and here (declaration SEMI)* is the param type decls for the - * old style. may want to do some checking to check for illegal - * combinations (but I assume all parsed code will be legal?) - */ - -functionDef - { String declName; } - : ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - | //epsilon - ) - declName = d:declarator[true] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - pushScope(declName); - } - ( declaration )* (VARARGS)? ( SEMI! )* - { popScope(); } - compoundStatement[declName] - { ## = #( #[NFunctionDef], ## );} - ; - -functionDeclSpecifiers - { int specCount = 0; } - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - functionStorageClassSpecifier - | typeQualifier - | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - )+ - ; - -declarationList - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - ( declarationPredictor )=> declaration - )+ - ; - -declarationPredictor - : (options { //only want to look at declaration if I don't see typedef - warnWhenFollowAmbig = false; - }: - "typedef" - | declaration - ) - ; - - -compoundStatement[String scopeName] - : LCURLY! - { - pushScope(scopeName); - } - ( ( declarationPredictor)=> declarationList )? - ( statementList )? - { popScope(); } - RCURLY! - { ## = #( #[NCompoundStatement, scopeName], ##); } - ; - - -statementList - : ( statement )+ - ; -statement - : SEMI // Empty statements - - | compoundStatement[getAScopeName()] // Group of statements - - | expr SEMI! { ## = #( #[NStatementExpr], ## ); } // Expressions - -// Iteration statements: - - | "while"^ LPAREN! expr RPAREN! statement - | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! - |! "for" - LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN - s:statement - { - if ( #e1 == null) { #e1 = (TNode) #[ NEmptyExpression ]; } - if ( #e2 == null) { #e2 = (TNode) #[ NEmptyExpression ]; } - if ( #e3 == null) { #e3 = (TNode) #[ NEmptyExpression ]; } - ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); - } - - -// Jump statements: - - | "goto"^ ID SEMI! - | "continue" SEMI! - | "break" SEMI! - | "return"^ ( expr )? SEMI! - - -// Labeled statements: - | ID COLON! (options {warnWhenFollowAmbig=false;}:statement)? { ## = #( #[NLabel], ## ); } - | "case"^ constExpr COLON! statement - | "default"^ COLON! statement - - - -// Selection statements: - - | "if"^ - LPAREN! expr RPAREN! statement - ( //standard if-else ambiguity - options { - warnWhenFollowAmbig = false; - } : - "else" statement )? - | "switch"^ LPAREN! expr RPAREN! statement - ; - - - - - - -expr - : assignExpr (options { - /* MBZ: - COMMA is ambiguous between comma expressions and - argument lists. argExprList should get priority, - and it does by being deeper in the expr rule tree - and using (COMMA assignExpr)* - */ - warnWhenFollowAmbig = false; - } : - c:COMMA^ { #c.setType(NCommaExpr); } assignExpr - )* - ; - - -assignExpr - : conditionalExpr ( a:assignOperator! assignExpr { ## = #( #a, ## );} )? - ; - -assignOperator - : ASSIGN - | DIV_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN - | STAR_ASSIGN - | MOD_ASSIGN - | RSHIFT_ASSIGN - | LSHIFT_ASSIGN - | BAND_ASSIGN - | BOR_ASSIGN - | BXOR_ASSIGN - ; - - -conditionalExpr - : logicalOrExpr - ( QUESTION^ expr COLON! conditionalExpr )? - ; - - -constExpr - : conditionalExpr - ; - -logicalOrExpr - : logicalAndExpr ( LOR^ logicalAndExpr )* - ; - - -logicalAndExpr - : inclusiveOrExpr ( LAND^ inclusiveOrExpr )* - ; - -inclusiveOrExpr - : exclusiveOrExpr ( BOR^ exclusiveOrExpr )* - ; - - -exclusiveOrExpr - : bitAndExpr ( BXOR^ bitAndExpr )* - ; - - -bitAndExpr - : equalityExpr ( BAND^ equalityExpr )* - ; - - - -equalityExpr - : relationalExpr - ( ( EQUAL^ | NOT_EQUAL^ ) relationalExpr )* - ; - - -relationalExpr - : shiftExpr - ( ( LT^ | LTE^ | GT^ | GTE^ ) shiftExpr )* - ; - - - -shiftExpr - : additiveExpr - ( ( LSHIFT^ | RSHIFT^ ) additiveExpr )* - ; - - -additiveExpr - : multExpr - ( ( PLUS^ | MINUS^ ) multExpr )* - ; - - -multExpr - : castExpr - ( ( STAR^ | DIV^ | MOD^ ) castExpr )* - ; - - -castExpr - : ( LPAREN typeName RPAREN )=> - LPAREN! typeName RPAREN! ( castExpr ) - { ## = #( #[NCast, "("], ## ); } - - | unaryExpr - ; - - -typeName - : specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator - : ( - pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - { ## = #( #[NNonemptyAbstractDeclarator], ## ); } - - ; - -/* JTC: - -LR rules: - -abstractDeclarator - : nonemptyAbstractDeclarator - | // null - ; - -nonemptyAbstractDeclarator - : LPAREN nonemptyAbstractDeclarator RPAREN - | abstractDeclarator LPAREN RPAREN - | abstractDeclarator (LBRACKET (expr)? RBRACKET) - | STAR abstractDeclarator - ; -*/ - -unaryExpr - : postfixExpr - | INC^ unaryExpr - | DEC^ unaryExpr - | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } - - | "sizeof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - ; - - -unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - ; - -postfixExpr - : primaryExpr - ( - postfixSuffix {## = #( #[NPostfixExpr], ## );} - )? - ; -postfixSuffix - : - ( PTR ID - | DOT ID - | functionCall - | LBRACKET expr RBRACKET - | INC - | DEC - )+ - ; - -functionCall - : - LPAREN^ (a:argExprList)? RPAREN - { - ##.setType( NFunctionCallArgs ); - } - ; - - -primaryExpr - : ID - | charConst - | intConst - | floatConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - | LPAREN! expr RPAREN! { ## = #( #[NExpressionGroup, "("], ## ); } - ; - -argExprList - : assignExpr ( COMMA! assignExpr )* - ; - - - -protected -charConst - : CharLiteral - ; - - -protected -stringConst - : (StringLiteral)+ { ## = #(#[NStringSeq], ##); } - ; - - -protected -intConst - : IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - - -protected -floatConst - : FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - - - - - - -dummy - : NTypedefName - | NInitDecl - | NDeclarator - | NStructDeclarator - | NDeclaration - | NCast - | NPointerGroup - | NExpressionGroup - | NFunctionCallArgs - | NNonemptyAbstractDeclarator - | NInitializer - | NStatementExpr - | NEmptyExpression - | NParameterTypeList - | NFunctionDef - | NCompoundStatement - | NParameterDeclaration - | NCommaExpr - | NUnaryExpr - | NLabel - | NPostfixExpr - | NRangeExpr - | NStringSeq - | NInitializerElementLabel - | NLcurlyInitializer - | NAsmAttribute - | NGnuAsmExpr - | NTypeMissing - ; - - - - - - -{ - import java.io.*; - import antlr.*; -} - -class StdCLexer extends Lexer; - -options - { - k = 3; - exportVocab = STDC; - testLiterals = false; - } - -{ - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - public void addDefine(String name, String value) - { - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -} - -protected -Vocabulary - : '\3'..'\377' - ; - - -/* Operators: */ - -ASSIGN : '=' ; -COLON : ':' ; -COMMA : ',' ; -QUESTION : '?' ; -SEMI : ';' ; -PTR : "->" ; - - -// DOT & VARARGS are commented out since they are generated as part of -// the Number rule below due to some bizarre lexical ambiguity shme. - -// DOT : '.' ; -protected -DOT:; - -// VARARGS : "..." ; -protected -VARARGS:; - - -LPAREN : '(' ; -RPAREN : ')' ; -LBRACKET : '[' ; -RBRACKET : ']' ; -LCURLY : '{' ; -RCURLY : '}' ; - -EQUAL : "==" ; -NOT_EQUAL : "!=" ; -LTE : "<=" ; -LT : "<" ; -GTE : ">=" ; -GT : ">" ; - -DIV : '/' ; -DIV_ASSIGN : "/=" ; -PLUS : '+' ; -PLUS_ASSIGN : "+=" ; -INC : "++" ; -MINUS : '-' ; -MINUS_ASSIGN : "-=" ; -DEC : "--" ; -STAR : '*' ; -STAR_ASSIGN : "*=" ; -MOD : '%' ; -MOD_ASSIGN : "%=" ; -RSHIFT : ">>" ; -RSHIFT_ASSIGN : ">>=" ; -LSHIFT : "<<" ; -LSHIFT_ASSIGN : "<<=" ; - -LAND : "&&" ; -LNOT : '!' ; -LOR : "||" ; - -BAND : '&' ; -BAND_ASSIGN : "&=" ; -BNOT : '~' ; -BOR : '|' ; -BOR_ASSIGN : "|=" ; -BXOR : '^' ; -BXOR_ASSIGN : "^=" ; - - -Whitespace - : ( ( '\003'..'\010' | '\t' | '\013' | '\f' | '\016'.. '\037' | '\177'..'\377' | ' ' ) - | "\r\n" { newline(); } - | ( '\n' | '\r' ) { newline(); } - ) { _ttype = Token.SKIP; } - ; - - -Comment - : "/*" - ( { LA(2) != '/' }? '*' - | "\r\n" { deferredNewline(); } - | ( '\r' | '\n' ) { deferredNewline(); } - | ~( '*'| '\r' | '\n' ) - )* - "*/" { _ttype = Token.SKIP; - } - ; - - -CPPComment - : - "//" ( ~('\n') )* - { - _ttype = Token.SKIP; - } - ; - -protected NonWhitespace - : (~('\r' | '\n'))* - ; - - -PREPROC_DIRECTIVE -options { - paraphrase = "a line directive"; -} - - : - '#' - ( ( "line" || (( ' ' | '\t' | '\014')+ '0'..'9')) => LineDirective - | ( (Space)* "define" (Space)* i:ID (Space)* (n:Number)? - nw:NonWhitespace - ("\r\n" | "\r" | "\n") ) { if (n != null) { - addDefine(i.getText(), n.getText()); - } else { - setPreprocessingDirective("#define " + i.getText() + " " + - nw.getText()); - } - } - | (~'\n')* { setPreprocessingDirective(getText()); } - ) - { - _ttype = Token.SKIP; - } - ; - -protected Space: - ( ' ' | '\t' | '\014') - ; - -protected LineDirective -{ - boolean oldCountingTokens = countingTokens; - countingTokens = false; -} -: - { - lineObject = new LineObject(); - deferredLineCount = 0; - } - ("line")? //this would be for if the directive started "#line", but not there for GNU directives - (Space)+ - n:Number { lineObject.setLine(Integer.parseInt(n.getText())); } - (Space)+ - ( fn:StringLiteral { try { - lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1)); - } - catch (StringIndexOutOfBoundsException e) { /*not possible*/ } - } - | fi:ID { lineObject.setSource(fi.getText()); } - )? - (Space)* - ("1" { lineObject.setEnteringFile(true); } )? - (Space)* - ("2" { lineObject.setReturningToFile(true); } )? - (Space)* - ("3" { lineObject.setSystemHeader(true); } )? - (Space)* - ("4" { lineObject.setTreatAsC(true); } )? - (~('\r' | '\n'))* - ("\r\n" | "\r" | "\n") - { - preprocessorInfoChannel.addLineForTokenNumber(new LineObject(lineObject), new Integer(tokenNumber)); - countingTokens = oldCountingTokens; - } - ; - - - -/* Literals: */ - -/* - * Note that we do NOT handle tri-graphs nor multi-byte sequences. - */ - - -/* - * Note that we can't have empty character constants (even though we - * can have empty strings :-). - */ -CharLiteral - : '\'' ( Escape | ~( '\'' ) ) '\'' - ; - - -/* - * Can't have raw imbedded newlines in string constants. Strict reading of - * the standard gives odd dichotomy between newlines & carriage returns. - * Go figure. - */ -StringLiteral - : '"' - ( Escape - | ( - '\r' { deferredNewline(); } - | '\n' { - deferredNewline(); - _ttype = BadStringLiteral; - } - | '\\' '\n' { - deferredNewline(); - } - ) - | ~( '"' | '\r' | '\n' | '\\' ) - )* - '"' - ; - - -protected BadStringLiteral - : // Imaginary token. - ; - - -/* - * Handle the various escape sequences. - * - * Note carefully that these numeric escape *sequences* are *not* of the - * same form as the C language numeric *constants*. - * - * There is no such thing as a binary numeric escape sequence. - * - * Octal escape sequences are either 1, 2, or 3 octal digits exactly. - * - * There is no such thing as a decimal escape sequence. - * - * Hexadecimal escape sequences are begun with a leading \x and continue - * until a non-hexadecimal character is found. - * - * No real handling of tri-graph sequences, yet. - */ - -protected -Escape - : '\\' - ( options{warnWhenFollowAmbig=false;}: - 'a' - | 'b' - | 'f' - | 'n' - | 'r' - | 't' - | 'v' - | '"' - | '\'' - | '\\' - | '?' - | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit ( options{warnWhenFollowAmbig=false;}: Digit )? )? - | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )? - | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ - ) - ; - - -/* Numeric Constants: */ - -protected -Digit - : '0'..'9' - ; - -protected -LongSuffix - : 'l' - | 'L' - ; - -protected -UnsignedSuffix - : 'u' - | 'U' - ; - -protected -FloatSuffix - : 'f' - | 'F' - ; - -protected -Exponent - : ( 'e' | 'E' ) ( '+' | '-' )? ( Digit )+ - ; - - -protected -DoubleDoubleConst:; - -protected -FloatDoubleConst:; - -protected -LongDoubleConst:; - -protected -IntOctalConst:; - -protected -LongOctalConst:; - -protected -UnsignedOctalConst:; - -protected -IntIntConst:; - -protected -LongIntConst:; - -protected -UnsignedIntConst:; - -protected -IntHexConst:; - -protected -LongHexConst:; - -protected -UnsignedHexConst:; - - - - -Number - : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ - ( '.' ( Digit )* ( Exponent )? - | Exponent - ) { _ttype = DoubleDoubleConst; } - ( FloatSuffix { _ttype = FloatDoubleConst; } - | LongSuffix { _ttype = LongDoubleConst; } - )? - - | ( "..." )=> "..." { _ttype = VARARGS; } - - | '.' { _ttype = DOT; } - ( ( Digit )+ ( Exponent )? - { _ttype = DoubleDoubleConst; } - ( FloatSuffix { _ttype = FloatDoubleConst; } - | LongSuffix { _ttype = LongDoubleConst; } - )? - )? - - | '0' ( '0'..'7' )* { _ttype = IntOctalConst; } - ( LongSuffix { _ttype = LongOctalConst; } - | UnsignedSuffix { _ttype = UnsignedOctalConst; } - )? - - | '1'..'9' ( Digit )* { _ttype = IntIntConst; } - ( LongSuffix { _ttype = LongIntConst; } - | UnsignedSuffix { _ttype = UnsignedIntConst; } - )? - - | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ - { _ttype = IntHexConst; } - ( LongSuffix { _ttype = LongHexConst; } - | UnsignedSuffix { _ttype = UnsignedHexConst; } - )? - ; - - -ID - options - { - testLiterals = true; - } - : ( 'a'..'z' | 'A'..'Z' | '_' ) - ( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' )* - ; - - diff --git a/src/net/java/games/gluegen/cgram/TNode.java b/src/net/java/games/gluegen/cgram/TNode.java deleted file mode 100644 index 2a93b939c..000000000 --- a/src/net/java/games/gluegen/cgram/TNode.java +++ /dev/null @@ -1,433 +0,0 @@ -package net.java.games.gluegen.cgram; - -import antlr.collections.AST; -import antlr.CommonAST; -import antlr.Token; -import java.lang.reflect.*; -import java.util.Hashtable; -import java.util.Enumeration; - -/** - Class TNode is an implementation of the AST interface - and adds many useful features: - - It is double-linked for reverse searching. - (this is currently incomplete, in that method doubleLink() must - be called after any changes to the tree to maintain the - reverse links). - - It can store a definition node (defNode), so that nodes such - as scoped names can refer to the node that defines the name. - - It stores line numbers for nodes. - - Searches for parents and children of a tree can be done - based on their type. - - The tree can be printed to System.out using a lisp-style syntax. - - - - */ -public class TNode extends CommonAST { - protected int ttype; - protected String text; - protected int lineNum = 0; - protected TNode defNode; - protected TNode up; - protected TNode left; - protected boolean marker = false; - protected Hashtable attributes = null; - static String tokenVocabulary; - - - - - /** Set the token vocabulary to a tokentypes class - generated by antlr. - */ - public static void setTokenVocabulary(String s) { - tokenVocabulary = s; - } - - -public void initialize(Token token) { - CToken tok = (CToken) token; - setText(tok.getText()); - setType(tok.getType()); - setLineNum(tok.getLine()); - setAttribute("source", tok.getSource()); - setAttribute("tokenNumber", new Integer(tok.getTokenNumber())); -} -public void initialize(AST tr) { - TNode t = (TNode) tr; - setText(t.getText()); - setType(t.getType()); - setLineNum(t.getLineNum()); - setDefNode(t.getDefNode()); - this.attributes = t.getAttributesTable(); -} - - - /** Get the token type for this node */ - public int getType() { return ttype; } - - /** Set the token type for this node */ - public void setType(int ttype_) { - ttype = ttype_; - } - - /** Get the marker value for this node. - This member is a general-use marker. - */ - public boolean getMarker() { return marker; } - - /** Set the marker value for this node. - This property is a general-use boolean marker. - */ - public void setMarker(boolean marker_) { - marker = marker_; - } - - /** get the hashtable that holds attribute values. - */ - public Hashtable getAttributesTable() { - if(attributes == null) - attributes = new Hashtable(7); - return attributes; - } - - /** set an attribute in the attribute table. - */ - public void setAttribute(String attrName, Object value) { - if(attributes == null) - attributes = new Hashtable(7); - attributes.put(attrName,value); - } - - /** lookup the attribute name in the attribute table. - If the value does not exist, it returns null. - */ - public Object getAttribute(String attrName) { - if(attributes == null) - return null; - else - return attributes.get(attrName); - } - - /** Get the line number for this node. - If the line number is 0, search for a non-zero line num among children */ - public int getLineNum() { - if(lineNum != 0) - return lineNum; - else - if(down == null) - return lineNum; - else - return ((TNode)down).getLocalLineNum(); - } - - public int getLocalLineNum() { - if(lineNum != 0) - return lineNum; - else - if(down == null) - if(right == null) - return lineNum; - else - return ((TNode)right).getLocalLineNum(); - else - return ((TNode)down).getLocalLineNum(); - } - - /** Set the line number for this node */ - public void setLineNum(int lineNum_) { - lineNum = lineNum_; - } - - /** Get the token text for this node */ - public String getText() { return text; } - - /** Set the token text for this node */ - public void setText(String text_) { - text = text_; - } - - /** return the last child of this node, or null if there is none */ - public TNode getLastChild() { - TNode down = (TNode)getFirstChild(); - if(down != null) - return down.getLastSibling(); - else - return null; - } - - /** return the last sibling of this node, which is - this if the next sibling is null */ - public TNode getLastSibling() { - TNode next = (TNode)getNextSibling(); - if(next != null) - return next.getLastSibling(); - else - return this; - } - - /** return the first sibling of this node, which is - this if the prev sibling is null */ - public TNode getFirstSibling() { - TNode prev = (TNode)left; - if(prev != null) - return prev.getFirstSibling(); - else - return this; - } - - - /** return the parent node of this node */ - public TNode getParent() { - return (TNode)getFirstSibling().up; - } - - - /** add the new node as a new sibling, inserting it ahead of any - existing next sibling. This method maintains double-linking. - if node is null, nothing happens. If the node has siblings, - then they are added in as well. - */ - public void addSibling(AST node) { - if(node == null) return; - TNode next = (TNode)right; - right = (TNode)node; - ((TNode)node).left = this; - TNode nodeLastSib = ((TNode)node).getLastSibling(); - nodeLastSib.right = next; - if(next != null) - next.left = nodeLastSib; - } - - - /** return the number of children of this node */ - public int numberOfChildren() { - int count = 0; - AST child = getFirstChild(); - while(child != null) { - count++; - child = child.getNextSibling(); - } - return count; - } - - - /** remove this node from the tree, resetting sibling and parent - pointers as necessary. This method maintains double-linking */ - public void removeSelf() { - TNode parent = (TNode)up; - TNode prev = (TNode)left; - TNode next = (TNode)right; - - if(parent != null) { - parent.down = next; - if(next != null) { - next.up = parent; - next.left = prev; // which should be null - } - } - else { - if(prev != null) - prev.right = next; - if(next != null) - next.left = prev; - } - } - - - /** return the def node for this node */ - public TNode getDefNode() { - return defNode; - } - - /** set the def node for this node */ - public void setDefNode(TNode n) { - defNode = n; - } - - - /** return a deep copy of this node, and all sub nodes. - New tree is doubleLinked, with no parent or siblings. - Marker value is not copied! - */ - public TNode deepCopy() { - TNode copy = new TNode(); - copy.ttype = ttype; - copy.text = text; - copy.lineNum = lineNum; - copy.defNode = defNode; - if(attributes != null) - copy.attributes = (Hashtable)attributes.clone(); - if(down != null) - copy.down = ((TNode)down).deepCopyWithRightSiblings(); - copy.doubleLink(); - return copy; - } - - - /** return a deep copy of this node, all sub nodes, - and right siblings. - New tree is doubleLinked, with no parent or left siblings. - defNode is not copied */ - public TNode deepCopyWithRightSiblings() { - TNode copy = new TNode(); - copy.ttype = ttype; - copy.text = text; - copy.lineNum = lineNum; - copy.defNode = defNode; - if(attributes != null) - copy.attributes = (Hashtable)attributes.clone(); - if(down != null) - copy.down = ((TNode)down).deepCopyWithRightSiblings(); - if(right != null) - copy.right = ((TNode)right).deepCopyWithRightSiblings(); - copy.doubleLink(); - return copy; - } - - - /** return a short string representation of the node */ - public String toString() { - StringBuffer str = new StringBuffer( getNameForType(getType()) + - "[" + getText() + ", " + "]"); - - if(this.getLineNum() != 0) - str.append(" line:" + (this.getLineNum() ) ); - - Enumeration keys = (this.getAttributesTable().keys()); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - str.append(" " + key + ":" + (this.getAttribute(key))); - } - - return str.toString(); - } - - - /** print given tree to System.out */ - public static void printTree(AST t) { - if (t == null) return; - printASTNode(t,0); - System.out.print("\n"); - } - - - /** protected method that does the work of printing */ - protected static void printASTNode(AST t, int indent) { - AST child1, next; - child1 = t.getFirstChild(); - - System.out.print("\n"); - for(int i = 0; i < indent; i++) - System.out.print(" "); - - if(child1 != null) - System.out.print("("); - - String s = t.getText(); - if(s != null && s.length() > 0) { - System.out.print(getNameForType(t.getType())); - System.out.print(": \"" + s + "\""); - } - else - System.out.print(getNameForType(t.getType())); - if(((TNode)t).getLineNum() != 0) - System.out.print(" line:" + ((TNode)t).getLineNum() ); - - Enumeration keys = ((TNode)t).getAttributesTable().keys(); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - System.out.print(" " + key + ":" + ((TNode)t).getAttribute(key)); - } - TNode def = ((TNode)t).getDefNode(); - if(def != null) - System.out.print("[" + getNameForType(def.getType()) + "]"); - - - if(child1 != null) { - printASTNode(child1,indent + 1); - - System.out.print("\n"); - for(int i = 0; i < indent; i++) - System.out.print(" "); - System.out.print(")"); - } - - next = t.getNextSibling(); - if(next != null) { - printASTNode(next,indent); - } - } - - /** converts an int tree token type to a name. - Does this by reflecting on nsdidl.IDLTreeTokenTypes, - and is dependent on how ANTLR 2.00 outputs that class. */ - public static String getNameForType(int t) { - try{ - Class c = Class.forName(tokenVocabulary); - Field[] fields = c.getDeclaredFields(); - if(t-2 < fields.length) - return fields[t-2].getName(); - } catch (Exception e) { System.out.println(e); } - return "unfoundtype: " + t; - } - - - /** set up reverse links between this node and its first - child and its first sibling, and link those as well */ - public void doubleLink() { - TNode right = (TNode)getNextSibling(); - if(right != null) { - right.left = this; - right.doubleLink(); - } - TNode down = (TNode)getFirstChild(); - if(down != null) { - down.up = this; - down.doubleLink(); - } - } - - /** find first parent of the given type, - return null on failure */ - public TNode parentOfType(int type) { - if(up == null) { - if(left == null) - return null; - else - return left.parentOfType(type); - } - if(up.getType() == type) - return up; - return up.parentOfType(type); - } - - /** find the first child of the node - of the given type, return null on failure */ - public TNode firstChildOfType(int type) { - TNode down = (TNode)getFirstChild(); - if(down == null) - return null; - if(down.getType() == type) - return down; - return down.firstSiblingOfType(type); - } - - /** find the first sibling of the node - of the given type, return null on failure */ - public TNode firstSiblingOfType(int type) { - TNode right = (TNode)getNextSibling(); - if(right == null) - return null; - if(right.getType() == type) - return right; - return right.firstSiblingOfType(type); - } - -} diff --git a/src/net/java/games/gluegen/cgram/TNodeFactory.java b/src/net/java/games/gluegen/cgram/TNodeFactory.java deleted file mode 100644 index 8cda2cfa9..000000000 --- a/src/net/java/games/gluegen/cgram/TNodeFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.java.games.gluegen.cgram; - -import antlr.Token; -import antlr.ASTFactory; -import antlr.collections.AST; - -/** This class extends ASTFactory to build instances - of class TNode */ -public class TNodeFactory extends ASTFactory { - - /** Create a new ampty AST node */ - public AST create() { - return new TNode(); - } - - /** Create a new AST node from type and text */ - public AST create(int ttype, String text) { - AST ast = new TNode(); - ast.setType(ttype); - ast.setText(text); - return ast; - } - - /** Create a new AST node from an existing AST node */ - public AST create(AST ast) { - AST newast = new TNode(); - newast.setType(ast.getType()); - newast.setText(ast.getText()); - return newast; - } - - -} diff --git a/src/net/java/games/gluegen/cgram/types/ArrayType.java b/src/net/java/games/gluegen/cgram/types/ArrayType.java deleted file mode 100644 index 1a73284e7..000000000 --- a/src/net/java/games/gluegen/cgram/types/ArrayType.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Represents an array type. This differs from a pointer type in C - syntax by the use of "[]" rather than "*". The length may or may - not be known; if the length is unknown then a negative number - should be passed in to the constructor. */ - -public class ArrayType extends Type { - private Type elementType; - private int length; - private String computedName; - - public ArrayType(Type elementType, int sizeInBytes, int length, int cvAttributes) { - super(elementType.getName() + " *", sizeInBytes, cvAttributes); - this.elementType = elementType; - this.length = length; - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof ArrayType))) { - return false; - } - ArrayType t = (ArrayType) arg; - return (super.equals(arg) && elementType.equals(t.elementType) && (length == t.length)); - } - - public String getName(boolean includeCVAttrs) { - // Lazy computation of name due to lazy setting of compound type - // names during parsing - // Note: don't think cvAttributes can be set for array types (unlike pointer types) - if (computedName == null) { - computedName = elementType.getName() + " *"; - computedName = computedName.intern(); - } - return computedName; - } - - public ArrayType asArray() { return this; } - - public Type getElementType() { return elementType; } - public int getLength() { return length; } - public boolean hasLength() { return length >= 0; } - - /** Return the bottommost element type if this is a multidimensional - array. */ - public Type getBaseElementType() { - ArrayType t = this; - while (t.getElementType().isArray()) { - t = t.getElementType().asArray(); - } - return t.getElementType(); - } - - /** Recompute the size of this array if necessary. This needs to be - done when the base element type is a compound type. */ - public void recomputeSize() { - ArrayType arrayElementType = getElementType().asArray(); - if (arrayElementType != null) { - arrayElementType.recomputeSize(); - } - // FIXME: this doesn't take into account struct alignment, which may be necessary - // See also FIXME below and in HeaderParser.g - super.setSize(getLength() * elementType.getSize()); - } - - public String toString() { - return toString(null); - } - - public String toString(String variableName) { - StringBuffer buf = new StringBuffer(); - buf.append(elementType.getName()); - if (variableName != null) { - buf.append(" "); - buf.append(variableName); - } - buf.append("["); - buf.append(length); - buf.append("]"); - return buf.toString(); - } - - public void visit(TypeVisitor arg) { - super.visit(arg); - elementType.visit(arg); - } - - Type newCVVariant(int cvAttributes) { - return new ArrayType(elementType, getSize(), length, cvAttributes); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/BitType.java b/src/net/java/games/gluegen/cgram/types/BitType.java deleted file mode 100644 index 915f847f8..000000000 --- a/src/net/java/games/gluegen/cgram/types/BitType.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Represents a bitfield in a struct. */ - -public class BitType extends IntType { - private IntType underlyingType; - private int sizeInBits; - private int offset; - - public BitType(IntType underlyingType, int sizeInBits, int lsbOffset, int cvAttributes) { - super(underlyingType.getName(), underlyingType.getSize(), underlyingType.isUnsigned(), cvAttributes); - this.underlyingType = underlyingType; - this.sizeInBits = sizeInBits; - this.offset = lsbOffset; - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof BitType))) { - return false; - } - BitType t = (BitType) arg; - return (super.equals(arg) && underlyingType.equals(t.underlyingType) && - (sizeInBits == t.sizeInBits) && (offset == t.offset)); - } - - public BitType asBit() { return this; } - - /** Size in bits of this type. */ - public int getSizeInBits() { - return sizeInBits; - } - - /** Offset from the least-significant bit (LSB) of the LSB of this - type */ - public int getOffset() { - return offset; - } - - public void visit(TypeVisitor arg) { - super.visit(arg); - underlyingType.visit(arg); - } - - Type newCVVariant(int cvAttributes) { - return new BitType(underlyingType, sizeInBits, offset, cvAttributes); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/CVAttributes.java b/src/net/java/games/gluegen/cgram/types/CVAttributes.java deleted file mode 100644 index 481a7be00..000000000 --- a/src/net/java/games/gluegen/cgram/types/CVAttributes.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Enumeration for const/volatile attributes. These are passed in to - the constructor of the type. */ - -public interface CVAttributes { - public static final int CONST = 0x01; - public static final int VOLATILE = 0x02; -} diff --git a/src/net/java/games/gluegen/cgram/types/CompoundType.java b/src/net/java/games/gluegen/cgram/types/CompoundType.java deleted file mode 100644 index 4c8c2d9ac..000000000 --- a/src/net/java/games/gluegen/cgram/types/CompoundType.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -import java.util.*; - -/** Models all compound types, i.e., those containing fields: structs - and unions. The boolean type accessors indicate how the type is - really defined. */ - -public class CompoundType extends Type { - private CompoundTypeKind kind; - // The name "foo" in the construct "struct foo { ... }"; - private String structName; - private ArrayList fields; - private boolean visiting; - private boolean bodyParsed; - private boolean computedHashcode; - private int hashcode; - - public CompoundType(String name, int size, CompoundTypeKind kind, int cvAttributes) { - this(name, size, kind, cvAttributes, null); - } - - private CompoundType(String name, int size, CompoundTypeKind kind, int cvAttributes, String structName) { - super(name, size, cvAttributes); - assert kind != null; - this.kind = kind; - this.structName = structName; - } - - public int hashCode() { - if (computedHashcode) { - return hashcode; - } - - if (structName != null) { - hashcode = structName.hashCode(); - } else if (getName() != null) { - hashcode = getName().hashCode(); - } else { - hashcode = 0; - } - - computedHashcode = true; - return hashcode; - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof CompoundType))) { - return false; - } - CompoundType t = (CompoundType) arg; - return (super.equals(arg) && - (structName == t.structName || (structName != null && structName.equals(t.structName))) && - kind == t.kind && - listsEqual(fields, t.fields)); - } - - /** Returns the struct name of this CompoundType, i.e. the "foo" in - the construct "struct foo { ... };". */ - public String getStructName() { - return structName; - } - - /** Sets the struct name of this CompoundType, i.e. the "foo" in the - construct "struct foo { ... };". */ - public void setStructName(String structName) { - this.structName = structName; - } - - public void setSize(int size) { - super.setSize(size); - } - - public CompoundType asCompound() { return this; } - - /** Returns the number of fields in this type. */ - public int getNumFields() { - return ((fields == null) ? 0 : fields.size()); - } - - /** Returns the ith field of this type. */ - public Field getField(int i) { - return (Field) fields.get(i); - } - - /** Adds a field to this type. */ - public void addField(Field f) { - if (bodyParsed) { - throw new RuntimeException("Body of this CompoundType has already been parsed; should not be adding more fields"); - } - if (fields == null) { - fields = new ArrayList(); - } - fields.add(f); - } - - /** Indicates to this CompoundType that its body has been parsed and - that no more {@link #addField} operations will be made. */ - public void setBodyParsed() { - bodyParsed = true; - } - - /** Indicates whether this type was declared as a struct. */ - public boolean isStruct() { return (kind == CompoundTypeKind.STRUCT); } - /** Indicates whether this type was declared as a union. */ - public boolean isUnion() { return (kind == CompoundTypeKind.UNION); } - - public String toString() { - String cvAttributesString = getCVAttributesString(); - if (getName() != null) { - return cvAttributesString + getName(); - } else if (getStructName() != null) { - return cvAttributesString + "struct " + getStructName(); - } else { - return cvAttributesString + getStructString(); - } - } - - public void visit(TypeVisitor arg) { - if (visiting) { - return; - } - try { - visiting = true; - super.visit(arg); - int n = getNumFields(); - for (int i = 0; i < n; i++) { - Field f = getField(i); - f.getType().visit(arg); - } - } finally { - visiting = false; - } - } - - public String getStructString() { - if (visiting) { - if (getName() != null) { - return getName(); - } - return "struct {/*Recursive type reference*/}"; - } - - try { - visiting = true; - String kind = (isStruct() ? "struct {" : "union {"); - StringBuffer res = new StringBuffer(); - res.append(kind); - int n = getNumFields(); - for (int i = 0; i < n; i++) { - res.append(" "); - res.append(getField(i)); - } - res.append(" }"); - return res.toString(); - } finally { - visiting = false; - } - } - - Type newCVVariant(int cvAttributes) { - CompoundType t = new CompoundType(getName(), getSize(), kind, cvAttributes, structName); - t.fields = fields; - return t; - } -} diff --git a/src/net/java/games/gluegen/cgram/types/CompoundTypeKind.java b/src/net/java/games/gluegen/cgram/types/CompoundTypeKind.java deleted file mode 100644 index eedabfd2f..000000000 --- a/src/net/java/games/gluegen/cgram/types/CompoundTypeKind.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Type-safe enum for discriminating between structs and unions, - which are both represented as compound types. */ - -public class CompoundTypeKind { - public static final CompoundTypeKind STRUCT = new CompoundTypeKind(); - public static final CompoundTypeKind UNION = new CompoundTypeKind(); - - private CompoundTypeKind() {} -} diff --git a/src/net/java/games/gluegen/cgram/types/DoubleType.java b/src/net/java/games/gluegen/cgram/types/DoubleType.java deleted file mode 100644 index 3d0ca6fe1..000000000 --- a/src/net/java/games/gluegen/cgram/types/DoubleType.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Represents a double-word floating-point type (C type "double".) */ - -public class DoubleType extends PrimitiveType { - public DoubleType(String name, int size, int cvAttributes) { - super(name, size, cvAttributes); - } - - public boolean equals(Object arg) { - if (arg == this) { - return true; - } - if (arg == null || (!(arg instanceof DoubleType))) { - return false; - } - return super.equals(arg); - } - - public DoubleType asDouble() { return this; } - - Type newCVVariant(int cvAttributes) { - return new DoubleType(getName(), getSize(), cvAttributes); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/EnumType.java b/src/net/java/games/gluegen/cgram/types/EnumType.java deleted file mode 100644 index 4ddd1e514..000000000 --- a/src/net/java/games/gluegen/cgram/types/EnumType.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -import java.util.*; - -/** Describes enumerated types. Enumerations are like ints except that - they have a set of named values. */ - -public class EnumType extends IntType { - private IntType underlyingType; - - private static class Enum { - String name; - long value; - Enum(String name, long value) { - this.name = name; - this.value = value; - } - - String getName() { return name; } - long getValue() { return value; } - } - private List/**/ enums; - - private static final int longSizeBytes = 8; - - public EnumType(String name) { - super(name, longSizeBytes, false, CVAttributes.CONST ); - this.underlyingType = new IntType(name, longSizeBytes, false, CVAttributes.CONST); - } - - public EnumType(String name, int enumSizeBytes) { - super(name, enumSizeBytes, false, CVAttributes.CONST ); - this.underlyingType = new IntType(name, enumSizeBytes, false, CVAttributes.CONST); - } - - protected EnumType(String name, IntType underlyingType, int cvAttributes) { - super(name, underlyingType.getSize(), underlyingType.isUnsigned(), cvAttributes); - this.underlyingType = underlyingType; - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof EnumType))) { - return false; - } - EnumType t = (EnumType) arg; - return (super.equals(arg) && - underlyingType.equals(t.underlyingType) && - listsEqual(enums, t.enums)); - } - - public EnumType asEnum() { return this; } - - public void addEnum(String name, long val) { - if (enums == null) { - enums = new ArrayList(); - } - enums.add(new Enum(name, val)); - } - - /** Number of enumerates defined in this enum. */ - public int getNumEnumerates() { return enums.size(); } - /** Fetch ith (0..getNumEnumerates() - 1) name */ - public String getEnumName(int i) { return ((Enum) enums.get(i)).getName(); } - /** Fetch ith (0..getNumEnumerates() - 1) value */ - public long getEnumValue(int i) { return ((Enum) enums.get(i)).getValue(); } - /** Fetch the value of the enumerate with the given name. */ - public long getEnumValue(String name) { - for (int i = 0; i < enums.size(); ++i) { - Enum n = ((Enum)enums.get(i)); - if (n.getName().equals(name)) { return n.getValue(); } - } - throw new NoSuchElementException( - "No enumerate named \"" + name + "\" in EnumType \"" + - getName() + "\""); - } - /** Does this enum type contain an enumerate with the given name? */ - public boolean containsEnumerate(String name) { - for (int i = 0; i < enums.size(); ++i) { - if (((Enum)enums.get(i)).getName().equals(name)) { return true; } - } - return false; - } - /** Remove the enumerate with the given name. Returns true if it was found - * and removed; false if it was not found. - */ - public boolean removeEnumerate(String name) { - for (int i = 0; i < enums.size(); ++i) { - Enum e = (Enum)enums.get(i); - if (e.getName().equals(name)) { - enums.remove(e); - return true; - } - } - return false; - } - - public void visit(TypeVisitor arg) { - super.visit(arg); - underlyingType.visit(arg); - } - - Type newCVVariant(int cvAttributes) { - EnumType t = new EnumType(getName(), underlyingType, cvAttributes); - t.enums = enums; - return t; - } -} diff --git a/src/net/java/games/gluegen/cgram/types/Field.java b/src/net/java/games/gluegen/cgram/types/Field.java deleted file mode 100644 index a2ea44363..000000000 --- a/src/net/java/games/gluegen/cgram/types/Field.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Represents a field in a struct or union. */ - -public class Field { - private String name; - private Type type; - private long offset; - - public Field(String name, Type type, long offset) { - this.name = name; - this.type = type; - this.offset = offset; - } - - public int hashCode() { - return name.hashCode(); - } - - public boolean equals(Object arg) { - if (arg == null || (!(arg instanceof Field))) { - return false; - } - - Field f = (Field) arg; - return (((name != null && name.equals(f.name)) || - (name == null && f.name == null)) && - type.equals(f.type) && - offset == f.offset); - } - - /** Name of this field in the containing data structure. */ - public String getName() { return name; } - - /** Type of this field. */ - public Type getType() { return type; } - - /** Offset, in bytes, of this field in the containing data structure. */ - public long getOffset() { return offset; } - - /** Sets the offset of this field in the containing data structure. */ - public void setOffset(long offset) { this.offset = offset; } - - public String toString() { - if (!getType().isFunctionPointer()) { - if (getName() == null && - getType().asCompound() != null && - getType().asCompound().isUnion()) { - return "" + getType() + ";"; - } - return "" + getType() + " " + getName() + ";"; - } else { - FunctionType ft = getType().asPointer().getTargetType().asFunction(); - return ft.toString(getName(), true) + ";"; - } - } -} diff --git a/src/net/java/games/gluegen/cgram/types/FloatType.java b/src/net/java/games/gluegen/cgram/types/FloatType.java deleted file mode 100644 index 8b81e0c3f..000000000 --- a/src/net/java/games/gluegen/cgram/types/FloatType.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -/** Represents a single-word floating-point type (C type "float".) */ - -public class FloatType extends PrimitiveType { - public FloatType(String name, int size, int cvAttributes) { - super(name, size, cvAttributes); - } - - public boolean equals(Object arg) { - if (arg == this) { - return true; - } - if (arg == null || (!(arg instanceof FloatType))) { - return false; - } - return super.equals(arg); - } - - public FloatType asFloat() { return this; } - - Type newCVVariant(int cvAttributes) { - return new FloatType(getName(), getSize(), cvAttributes); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/FunctionSymbol.java b/src/net/java/games/gluegen/cgram/types/FunctionSymbol.java deleted file mode 100644 index ab72dfb83..000000000 --- a/src/net/java/games/gluegen/cgram/types/FunctionSymbol.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -import java.util.*; - -/** Describes a function symbol, which includes the name and - type. Since we are currently only concerned with processing - functions this is the only symbol type, though plausibly more - types should be added and a true symbol table constructed during - parsing. */ - -public class FunctionSymbol { - private String name; - private FunctionType type; - - public FunctionSymbol(String name, FunctionType type) { - this.name = name; - this.type = type; - } - - public String getName() { return name; } - - /** Returns the type of this function. Do not add arguments to it - directly; use addArgument instead. */ - public FunctionType getType() { return type; } - - /** Returns the return type of this function. */ - public Type getReturnType() { return type.getReturnType(); } - - public int getNumArguments() { return type.getNumArguments(); } - - /** Returns the name of the ith argument. May return null if - no argument names were available during parsing. */ - public String getArgumentName(int i) { - return type.getArgumentName(i); - } - - /** Returns the type of the ith argument. */ - public Type getArgumentType(int i) { - return type.getArgumentType(i); - } - - /** Add an argument's name and type. Use null for unknown argument - names. */ - public void addArgument(Type argumentType, String argumentName) { - type.addArgument(argumentType, argumentName); - } - - public String toString() { - return getType().toString(getName()); - } - - public int hashCode() { - if (name == null) { - return 0; - } - return name.hashCode(); - } - - public boolean equals(Object arg) { - if (arg == this) { - return true; - } - - if (arg == null || (!(arg instanceof FunctionSymbol))) { - return false; - } - - FunctionSymbol other = (FunctionSymbol) arg; - return ( - (getName() == other.getName() || getName().equals(other.getName())) - && type.equals(other.type)); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/FunctionType.java b/src/net/java/games/gluegen/cgram/types/FunctionType.java deleted file mode 100644 index 5d309a83f..000000000 --- a/src/net/java/games/gluegen/cgram/types/FunctionType.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -import java.util.*; - -/** Describes a function type, used to model both function - declarations and (via PointerType) function pointers. */ - -public class FunctionType extends Type { - private Type returnType; - private ArrayList argumentTypes; - private ArrayList argumentNames; - - public FunctionType(String name, int size, Type returnType, int cvAttributes) { - super(name, size, cvAttributes); - this.returnType = returnType; - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof FunctionType))) { - return false; - } - FunctionType t = (FunctionType) arg; - return (super.equals(arg) && - returnType.equals(t.returnType) && - listsEqual(argumentTypes, t.argumentTypes)); - } - - public FunctionType asFunction() { return this; } - - /** Returns the return type of this function. */ - public Type getReturnType() { return returnType; } - - public int getNumArguments() { return ((argumentTypes == null) ? 0 : argumentTypes.size()); } - - /** Returns the name of the ith argument. May return null if - no argument names were available during parsing. */ - public String getArgumentName(int i) { - return (String) argumentNames.get(i); - } - - /** Returns the type of the ith argument. */ - public Type getArgumentType(int i) { - return (Type) argumentTypes.get(i); - } - - /** Add an argument's name and type. Use null for unknown argument - names. */ - public void addArgument(Type argumentType, String argumentName) { - if (argumentTypes == null) { - argumentTypes = new ArrayList(); - argumentNames = new ArrayList(); - } - argumentTypes.add(argumentType); - argumentNames.add(argumentName); - } - - public void setArgumentName(int i, String name) - { - argumentNames.set(i,name); - } - - public String toString() { - return toString(null); - } - - public String toString(String functionName) { - return toString(functionName, false); - } - - String toString(String functionName, boolean isPointer) { - StringBuffer res = new StringBuffer(); - res.append(getReturnType()); - res.append(" "); - if (isPointer) { - res.append("(*"); - } - if (functionName != null) { - res.append(functionName); - } - if (isPointer) { - res.append(")"); - } - res.append("("); - int n = getNumArguments(); - for (int i = 0; i < n; i++) { - Type t = getArgumentType(i); - if (t.isFunctionPointer()) { - FunctionType ft = t.asPointer().getTargetType().asFunction(); - res.append(ft.toString(getArgumentName(i), true)); - } else if (t.isArray()) { - res.append(t.asArray().toString(getArgumentName(i))); - } else { - res.append(t); - String argumentName = getArgumentName(i); - if (argumentName != null) { - res.append(" "); - res.append(argumentName); - } - } - if (i < n - 1) { - res.append(", "); - } - } - res.append(")"); - if (!isPointer) { - res.append(";"); - } - return res.toString(); - } - - public void visit(TypeVisitor arg) { - super.visit(arg); - returnType.visit(arg); - int n = getNumArguments(); - for (int i = 0; i < n; i++) { - getArgumentType(i).visit(arg); - } - } - - Type newCVVariant(int cvAttributes) { - // Functions don't have const/volatile attributes - return this; - } -} diff --git a/src/net/java/games/gluegen/cgram/types/IntType.java b/src/net/java/games/gluegen/cgram/types/IntType.java deleted file mode 100644 index 50223af11..000000000 --- a/src/net/java/games/gluegen/cgram/types/IntType.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public class IntType extends PrimitiveType { - private boolean unsigned; - private boolean typedefedUnsigned; - - public IntType(String name, int size, boolean unsigned, int cvAttributes) { - this(name, size, unsigned, cvAttributes, false); - } - - private IntType(String name, int size, boolean unsigned, int cvAttributes, boolean typedefedUnsigned) { - super(name, size, cvAttributes); - this.unsigned = unsigned; - this.typedefedUnsigned = typedefedUnsigned; - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof IntType))) { - return false; - } - IntType t = (IntType) arg; - return (super.equals(arg) && (unsigned == t.unsigned)); - } - - public void setName(String name) { - super.setName(name); - typedefedUnsigned = unsigned; - } - - public IntType asInt() { return this; } - - /** Indicates whether this type is unsigned */ - public boolean isUnsigned() { return unsigned; } - - public String toString() { - return getCVAttributesString() + ((isUnsigned() & (!typedefedUnsigned)) ? "unsigned " : "") + getName(); - } - - Type newCVVariant(int cvAttributes) { - return new IntType(getName(), getSize(), isUnsigned(), cvAttributes, typedefedUnsigned); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/MachineDescription.java b/src/net/java/games/gluegen/cgram/types/MachineDescription.java deleted file mode 100644 index 7acb919bc..000000000 --- a/src/net/java/games/gluegen/cgram/types/MachineDescription.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public class MachineDescription { - private int charSizeInBytes; - private int shortSizeInBytes; - private int intSizeInBytes; - private int longSizeInBytes; - private int int64SizeInBytes; - private int floatSizeInBytes; - private int doubleSizeInBytes; - private int pointerSizeInBytes; - - public MachineDescription(int charSizeInBytes, - int shortSizeInBytes, - int intSizeInBytes, - int longSizeInBytes, - int int64SizeInBytes, - int floatSizeInBytes, - int doubleSizeInBytes, - int pointerSizeInBytes) { - this.charSizeInBytes = charSizeInBytes; - this.shortSizeInBytes = shortSizeInBytes; - this.intSizeInBytes = intSizeInBytes; - this.longSizeInBytes = longSizeInBytes; - this.int64SizeInBytes = int64SizeInBytes; - this.floatSizeInBytes = floatSizeInBytes; - this.doubleSizeInBytes = doubleSizeInBytes; - this.pointerSizeInBytes = pointerSizeInBytes; - } - - public int charSizeInBytes() { return charSizeInBytes; } - public int shortSizeInBytes() { return shortSizeInBytes; } - public int intSizeInBytes() { return intSizeInBytes; } - public int longSizeInBytes() { return longSizeInBytes; } - public int int64SizeInBytes() { return int64SizeInBytes; } - public int floatSizeInBytes() { return floatSizeInBytes; } - public int doubleSizeInBytes() { return doubleSizeInBytes; } - public int pointerSizeInBytes() { return pointerSizeInBytes; } -} diff --git a/src/net/java/games/gluegen/cgram/types/MachineDescription32Bit.java b/src/net/java/games/gluegen/cgram/types/MachineDescription32Bit.java deleted file mode 100644 index fca7edce7..000000000 --- a/src/net/java/games/gluegen/cgram/types/MachineDescription32Bit.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public class MachineDescription32Bit extends MachineDescription { - public MachineDescription32Bit() { - super(1, 2, 4, 4, 8, 4, 8, 4); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java b/src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java deleted file mode 100644 index 4ef78639b..000000000 --- a/src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public class MachineDescription64Bit extends MachineDescription { - public MachineDescription64Bit() { - super(1, 2, 4, 8, 8, 4, 8, 8); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/PointerType.java b/src/net/java/games/gluegen/cgram/types/PointerType.java deleted file mode 100644 index ffe369761..000000000 --- a/src/net/java/games/gluegen/cgram/types/PointerType.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public class PointerType extends Type { - private Type targetType; - private String computedName; - private boolean hasTypedefedName; - - public PointerType(int size, Type targetType, int cvAttributes) { - // can pass null for the final name parameter because the PointerType's getName() - // completely replaces superclass behavior - this(size, targetType, cvAttributes, false, null); - } - - private PointerType(int size, Type targetType, int cvAttributes, boolean hasTypedefedName, String typedefedName) { - super(targetType.getName() + " *", size, cvAttributes); - this.hasTypedefedName = false; - this.targetType = targetType; - if (hasTypedefedName) { - setName(typedefedName); - } - } - - public int hashCode() { - return targetType.hashCode(); - } - - public boolean equals(Object arg) { - if (arg == this) return true; - if (arg == null || (!(arg instanceof PointerType))) { - return false; - } - PointerType t = (PointerType) arg; - // Note we ignore the name of this type (which might be a typedef - // name) for comparison purposes because this is what allows - // e.g. a newly-fabricated type "PIXELFORMATDESCRIPTOR *" to be - // canonicalized to e.g. "LPPIXELFORMATDESCRIPTOR" - return ((getSize() == t.getSize()) && - (getCVAttributes() == t.getCVAttributes()) && - targetType.equals(t.targetType)); - } - - public void setName(String name) { - super.setName(name); - hasTypedefedName = true; - } - - public String getName(boolean includeCVAttrs) { - if (hasTypedefedName) { - return super.getName(includeCVAttrs); - } else { - // Lazy computation of name due to lazy setting of compound type - // names during parsing - if (computedName == null) { - computedName = targetType.getName(includeCVAttrs) + " *"; - computedName = computedName.intern(); - } - if (!includeCVAttrs) { - return computedName; - } - return targetType.getName(includeCVAttrs) + " * " + getCVAttributesString(); - } - } - - public boolean hasTypedefedName() { - return hasTypedefedName; - } - - public PointerType asPointer() { return this; } - - public Type getTargetType() { return targetType; } - - public boolean isFunctionPointer() { return targetType.isFunction(); } - - public String toString() { - if (hasTypedefedName) { - return super.getName(true); - } else { - if (!targetType.isFunction()) { - return targetType.toString() + " * " + getCVAttributesString(); - } - return toString(null); // this is a pointer to an unnamed function - } - } - - /** For use only when printing function pointers */ - public String toString(String functionName) { - if (!targetType.isFunction()) { - throw new RuntimeException(" This method is only for use when printing function pointers"); - } - return ((FunctionType) targetType).toString(functionName, true); - } - - public void visit(TypeVisitor arg) { - super.visit(arg); - targetType.visit(arg); - } - - Type newCVVariant(int cvAttributes) { - return new PointerType(getSize(), targetType, cvAttributes, hasTypedefedName, (hasTypedefedName ? getName() : null)); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/PrimitiveType.java b/src/net/java/games/gluegen/cgram/types/PrimitiveType.java deleted file mode 100644 index 405f1016d..000000000 --- a/src/net/java/games/gluegen/cgram/types/PrimitiveType.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public abstract class PrimitiveType extends Type { - protected PrimitiveType(String name, int size, int cvAttributes) { - super(name, size, cvAttributes); - } - - public boolean isPrimitive() { - return true; - } -} diff --git a/src/net/java/games/gluegen/cgram/types/Type.java b/src/net/java/games/gluegen/cgram/types/Type.java deleted file mode 100644 index 6c0ea9f79..000000000 --- a/src/net/java/games/gluegen/cgram/types/Type.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -import java.util.List; - -/** Models a C type. Primitive types include int, float, and - double. All types have an associated name. Structs and unions are - modeled as "compound" types -- composed of fields of primitive or - other types. */ - -public abstract class Type { - private String name; - private int size; - private int cvAttributes; - private int typedefedCVAttributes; - private boolean hasTypedefName; - - protected Type(String name, int size, int cvAttributes) { - setName(name); - this.size = size; - this.cvAttributes = cvAttributes; - hasTypedefName = false; - } - - /** Returns the name of this type. The returned string is suitable - for use as a type specifier. Does not include any const/volatile - attributes. */ - public String getName() { return getName(false); } - - /** Returns the name of this type, optionally including - const/volatile attributes. The returned string is suitable for - use as a type specifier. */ - public String getName(boolean includeCVAttrs) { - if (!includeCVAttrs) { - return name; - } - return getCVAttributesString() + name; - } - - /** Set the name of this type; used for handling typedefs. */ - public void setName(String name) { - if (name == null) { - this.name = name; - } else { - this.name = name.intern(); - } - // Capture the const/volatile attributes at the time of typedef so - // we don't redundantly repeat them in the CV attributes string - typedefedCVAttributes = cvAttributes; - hasTypedefName = true; - } - - /** Size of this type in bytes. */ - public int getSize() { return size; } - /** Set the size of this type; only available for CompoundTypes. */ - void setSize(int size) { this.size = size; } - - /** Casts this to a BitType or returns null if not a BitType. */ - public BitType asBit() { return null; } - /** Casts this to an IntType or returns null if not an IntType. */ - public IntType asInt() { return null; } - /** Casts this to an EnumType or returns null if not an EnumType. */ - public EnumType asEnum() { return null; } - /** Casts this to a FloatType or returns null if not a FloatType. */ - public FloatType asFloat() { return null; } - /** Casts this to a DoubleType or returns null if not a DoubleType. */ - public DoubleType asDouble() { return null; } - /** Casts this to a PointerType or returns null if not a PointerType. */ - public PointerType asPointer() { return null; } - /** Casts this to an ArrayType or returns null if not an ArrayType. */ - public ArrayType asArray() { return null; } - /** Casts this to a CompoundType or returns null if not a CompoundType. */ - public CompoundType asCompound() { return null; } - /** Casts this to a FunctionType or returns null if not a FunctionType. */ - public FunctionType asFunction() { return null; } - /** Casts this to a VoidType or returns null if not a VoidType. */ - public VoidType asVoid() { return null; } - - /** Indicates whether this is a BitType. */ - public boolean isBit() { return (asBit() != null); } - /** Indicates whether this is an IntType. */ - public boolean isInt() { return (asInt() != null); } - /** Indicates whether this is an EnumType. */ - public boolean isEnum() { return (asEnum() != null); } - /** Indicates whether this is a FloatType. */ - public boolean isFloat() { return (asFloat() != null); } - /** Indicates whether this is a DoubleType. */ - public boolean isDouble() { return (asDouble() != null); } - /** Indicates whether this is a PointerType. */ - public boolean isPointer() { return (asPointer() != null); } - /** Indicates whether this is an ArrayType. */ - public boolean isArray() { return (asArray() != null); } - /** Indicates whether this is a CompoundType. */ - public boolean isCompound() { return (asCompound() != null); } - /** Indicates whether this is a FunctionType. */ - public boolean isFunction() { return (asFunction() != null); } - /** Indicates whether this is a VoidType. */ - public boolean isVoid() { return (asVoid() != null); } - - /** Indicates whether this type is const. */ - public boolean isConst() { return (((cvAttributes & ~typedefedCVAttributes) & CVAttributes.CONST) != 0); } - /** Indicates whether this type is volatile. */ - public boolean isVolatile() { return (((cvAttributes & ~typedefedCVAttributes) & CVAttributes.VOLATILE) != 0); } - - /** Indicates whether this type is a primitive type. */ - public boolean isPrimitive(){ return false; } - - /** Convenience routine indicating whether this Type is a pointer to - a function. */ - public boolean isFunctionPointer() { - return (isPointer() && asPointer().getTargetType().isFunction()); - } - - /** Hashcode for Types. */ - public int hashCode() { - if (name == null) { - return 0; - } - - if (cvAttributes != 0) - { - String nameWithAttribs = name + cvAttributes; - return nameWithAttribs.hashCode(); - } - return name.hashCode(); - } - - /** - * Equality test for Types. - */ - public boolean equals(Object arg) { - if (arg == this) { - return true; - } - if (arg == null || (!(arg instanceof Type))) { - return false; - } - Type t = (Type) arg; - return ((name == t.name || (name != null && name.equals(name))) && - (size == t.size) && - (cvAttributes == t.cvAttributes)); - } - - /** Returns a string representation of this type. This string is not - necessarily suitable for use as a type specifier; for example, - it will contain an expanded description of structs/unions. */ - public String toString() { - return getName(true); - } - - /** Visit this type and all of the component types of this one; for - example, the return type and argument types of a FunctionType. */ - public void visit(TypeVisitor visitor) { - visitor.visitType(this); - } - - public final int getCVAttributes() { - return cvAttributes; - } - - /** Returns a string indicating the const/volatile attributes of - this type. */ - public final String getCVAttributesString() { - if (isConst() && isVolatile()) return "const volatile "; - if (isConst()) return "const "; - if (isVolatile()) return "volatile "; - return ""; - } - - /** Return a variant of this type matching the given const/volatile - attributes. May return this object if the attributes match. */ - public final Type getCVVariant(int cvAttributes) { - if (this.cvAttributes == cvAttributes) { - return this; - } - return newCVVariant(cvAttributes); - } - - /** Create a new variant of this type matching the given - const/volatile attributes. */ - abstract Type newCVVariant(int cvAttributes); - - /** Indicates whether setName() has been called on this type, - indicating that it already has a typedef name. */ - public boolean hasTypedefName() { - return hasTypedefName; - } - - /** Helper method for determining how many pointer indirections this - type represents (i.e., "void **" returns 2). Returns 0 if this - type is not a pointer type. */ - public int pointerDepth() { - PointerType pt = asPointer(); - if (pt == null) { - return 0; - } - return 1 + pt.getTargetType().pointerDepth(); - } - - /** Helper method for determining how many array dimentions this - type represents (i.e., "char[][]" returns 2). Returns 0 if this - type is not an array type. */ - public int arrayDimension() { - ArrayType arrayType = asArray(); - if (arrayType == null) { - return 0; - } - return 1 + arrayType.getElementType().arrayDimension(); - } - - /** Helper routine for list equality comparison */ - static boolean listsEqual(List a, List b) { - return ((a == null && b == null) || - (a != null && b != null && a.equals(b))); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/TypeDictionary.java b/src/net/java/games/gluegen/cgram/types/TypeDictionary.java deleted file mode 100644 index 3909919aa..000000000 --- a/src/net/java/games/gluegen/cgram/types/TypeDictionary.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -import java.util.*; - -/** Utility class for recording names of typedefs and structs. */ - -public class TypeDictionary { - /** Mapping from type name to type.*/ - private HashMap/**/ map = new HashMap/**/(); - - /** Reverse mapping; created lazily from the regular map */ - private HashMap/*, String>*/ reverseMap = new HashMap/*, String>*/(); - - /** Has a type been added/removed since the last time the reverse map was - * calculated? */ - private boolean reverseMapOutOfDate = false; - - /** - * Create a mapping from a type to its name. - * @param name the name to which the type is defined - * @param type the type that can be referred to by the specified name. - */ - public Type put(String name, Type type) { - reverseMapOutOfDate = true; - return (Type) map.put(name, type); - } - - /** Get the type corresponding to the given name. Returns null if no type - * was found corresponding to the given name. */ - public Type get(String name) { - return (Type) map.get(name); - } - - /** - * Get the names that correspond to the given type. There will be more than - * one name in the returned list if the type has been defined to multiple - * names. Returns null if no names were found for given type. - */ - public Set/**/ get(Type type) { - if (reverseMapOutOfDate) { - rebuildReverseMap(); - reverseMapOutOfDate = false; - } - // Don't let callers muck with the set. - return Collections.unmodifiableSet((Set)reverseMap.get(type)); - } - - /** Remove the mapping from the specified name to its associated type.*/ - public Type remove(String name) { - reverseMapOutOfDate = true; - return (Type) map.remove(name); - } - - /** Get all the names that map to Types. - * @return a Set of Strings that are the typedef names that map to Types in the dictionary. - */ - public Set keySet() { - return map.keySet(); - } - - public Set entrySet() { - return map.entrySet(); - } - - public boolean containsKey(String key) { - return map.containsKey(key); - } - - public boolean containsValue(Type value) { - return map.containsValue(value); - } - - public boolean isEmpty() { - return map.isEmpty(); - } - - /** Returns a collection of all the Types in the dictionary that are mapped via typedefs names. */ - public Collection values() { - return map.values(); - } - - /** Build the mapping of from each Type to all the names by which is may be - * referenced. Warning: this is a slow operation! - */ - private void rebuildReverseMap() { - reverseMap.clear(); - for (Iterator/**/ it = map.keySet().iterator(); it.hasNext(); ) { - String name = (String)it.next(); - Type type = (Type)map.get(name); - if (type == null) { - throw new IllegalStateException("Internal error; TypedefDictionary contains null Type for name \"" + name + "\""); - } - HashSet allNamesForType = (HashSet)reverseMap.get(type); - if (allNamesForType == null) { - allNamesForType = new HashSet/**/(); - reverseMap.put(type, allNamesForType); - } - allNamesForType.add(name); - } - } - - /** - * Dumps the dictionary contents to the specified output stream, annotated - * with the specified description. Useful for debugging. - */ - public void dumpDictionary(java.io.PrintStream out, String description) { - out.println("------------------------------------------------------------------------------"); - out.println("TypeDictionary: " + (description == null ? "" : description)); - out.println("------------------------------------------------------------------------------"); - out.println("Forward mapping: "); - for (Iterator names = keySet().iterator(); names.hasNext(); ) { - String typeName = (String)names.next(); - out.println(" [" + typeName + "]\t--> [" + get(typeName) + "]"); - } - out.println("Reverse mapping: "); - - // because the reverse mapping is built lazily upon query, we must force it to - // be built if it has not yet been built. - if (reverseMapOutOfDate) { - rebuildReverseMap(); - reverseMapOutOfDate = false; - } - for (Iterator types = reverseMap.keySet().iterator(); types.hasNext(); ) { - Type type = (Type)types.next(); - Set names = get(type); - out.println(" [" + type + "]\t--> " + names + ""); - } - out.println("------------------------------------------------------------------------------"); - } -} diff --git a/src/net/java/games/gluegen/cgram/types/TypeVisitor.java b/src/net/java/games/gluegen/cgram/types/TypeVisitor.java deleted file mode 100644 index 4679327d1..000000000 --- a/src/net/java/games/gluegen/cgram/types/TypeVisitor.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public interface TypeVisitor { - public void visitType(Type t); -} diff --git a/src/net/java/games/gluegen/cgram/types/VoidType.java b/src/net/java/games/gluegen/cgram/types/VoidType.java deleted file mode 100644 index 00130b708..000000000 --- a/src/net/java/games/gluegen/cgram/types/VoidType.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.cgram.types; - -public class VoidType extends Type { - public VoidType(int cvAttributes) { - this("void", cvAttributes); - } - - private VoidType(String name, int cvAttributes) { - super(name, 0, cvAttributes); - } - - public VoidType asVoid() { return this; } - - Type newCVVariant(int cvAttributes) { - return new VoidType(getName(), cvAttributes); - } -} diff --git a/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java b/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java deleted file mode 100644 index eaed4a100..000000000 --- a/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java +++ /dev/null @@ -1,567 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.opengl; - -import net.java.games.gluegen.*; - -import java.lang.reflect.*; -import java.io.*; -import java.util.*; -import java.util.regex.*; - -public class BuildComposablePipeline -{ - private String outputDirectory; - private Class classToComposeAround; - - public static void main(String[] args) - { - String nameOfClassToComposeAround = args[0]; - Class classToComposeAround; - try { - classToComposeAround = Class.forName(nameOfClassToComposeAround); - } catch (Exception e) { - throw new RuntimeException( - "Could not find class \"" + nameOfClassToComposeAround + "\"", e); - } - - String outputDir = args[1]; - - BuildComposablePipeline composer = - new BuildComposablePipeline(classToComposeAround, outputDir); - - try - { - composer.emit(); - } - catch (IOException e) - { - throw new RuntimeException( - "Error generating composable pipeline source files", e); - } - } - - protected BuildComposablePipeline(Class classToComposeAround, String outputDirectory) - { - this.outputDirectory = outputDirectory; - this.classToComposeAround = classToComposeAround; - - if (! classToComposeAround.isInterface()) - { - throw new IllegalArgumentException( - classToComposeAround.getName() + " is not an interface class"); - } - } - - /** - * Emit the java source code for the classes that comprise the composable - * pipeline. - */ - public void emit() throws IOException - { - String pDir = outputDirectory; - String pInterface = classToComposeAround.getName(); - List/**/ publicMethods = Arrays.asList(classToComposeAround.getMethods()); - - (new DebugPipeline(pDir, pInterface)).emit(publicMethods); - (new TracePipeline(pDir, pInterface)).emit(publicMethods); - } - - //------------------------------------------------------- - - /** - * Emits a Java source file that represents one element of the composable - * pipeline. - */ - protected static abstract class PipelineEmitter - { - private File file; - private String basePackage; - private String baseName; // does not include package! - private String outputDir; - - /** - * @param outputDir the directory into which the pipeline classes will be - * generated. - * @param baseInterfaceClassName the full class name (including package, - * e.g. "java.lang.String") of the interface that the pipeline wraps - * @exception IllegalArgumentException if classToComposeAround is not an - * interface. - */ - public PipelineEmitter(String outputDir, String baseInterfaceClassName) - { - int lastDot = baseInterfaceClassName.lastIndexOf('.'); - if (lastDot == -1) - { - // no package, class is at root level - this.baseName = baseInterfaceClassName; - this.basePackage = null; - } - else - { - this.baseName = baseInterfaceClassName.substring(lastDot+1); - this.basePackage = baseInterfaceClassName.substring(0, lastDot); - } - - this.outputDir = outputDir; - } - - public void emit(List/**/ methodsToWrap) throws IOException - { - String pipelineClassName = getPipelineName(); - this.file = new File(outputDir + File.separatorChar + pipelineClassName + ".java"); - String parentDir = file.getParent(); - if (parentDir != null) - { - File pDirFile = new File(parentDir); - pDirFile.mkdirs(); - } - - PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); - - CodeGenUtils.emitJavaHeaders(output, - basePackage, - pipelineClassName, - true, - new String[] { "java.io.*" }, - new String[] { "public" }, - new String[] { baseName }, - null, - new CodeGenUtils.EmissionCallback() { - public void emit(PrintWriter w) { emitClassDocComment(w); } - } - ); - - preMethodEmissionHook(output); - - constructorHook(output); - - for (int i = 0; i < methodsToWrap.size(); ++i) - { - Method m = (Method)methodsToWrap.get(i); - emitMethodDocComment(output, m); - emitSignature(output, m); - emitBody(output, m); - } - - postMethodEmissionHook(output); - - output.println(); - output.print(" private " + baseName + " " + getDownstreamObjectName() + ";"); - - // end the class - output.println(); - output.print("} // end class "); - output.println(pipelineClassName); - - output.flush(); - output.close(); - } - - /** Get the name of the object through which API calls should be routed. */ - protected String getDownstreamObjectName() - { - return "downstream" + baseName; - } - - protected void emitMethodDocComment(PrintWriter output, Method m) - { - } - - protected void emitSignature(PrintWriter output, Method m) - { - output.print(" public "); - output.print(' '); - output.print(JavaType.createForClass(m.getReturnType()).getName()); - output.print(' '); - output.print(m.getName()); - output.print('('); - output.print(getArgListAsString(m, true, true)); - output.println(")"); - } - - protected void emitBody(PrintWriter output, Method m) - { - output.println(" {"); - output.print(" "); - Class retType = m.getReturnType(); - - preDownstreamCallHook(output, m); - - if (retType != Void.TYPE) - { - output.print(JavaType.createForClass(retType).getName()); - output.print(" _res = "); - } - output.print(getDownstreamObjectName()); - output.print('.'); - output.print(m.getName()); - output.print('('); - output.print(getArgListAsString(m, false, true)); - output.println(");"); - - postDownstreamCallHook(output, m); - - if (retType != Void.TYPE) - { - output.println(" return _res;"); - } - output.println(" }"); - - } - - private String getArgListAsString(Method m, boolean includeArgTypes, boolean includeArgNames) - { - StringBuffer buf = new StringBuffer(256); - if (!includeArgNames && !includeArgTypes) - { - throw new IllegalArgumentException( - "Cannot generate arglist without both arg types and arg names"); - } - - Class[] argTypes = m.getParameterTypes(); - for (int i = 0; i < argTypes.length; ++i) - { - if (includeArgTypes) - { - buf.append(JavaType.createForClass(argTypes[i]).getName()); - buf.append(' '); - } - - if (includeArgNames) - { - buf.append("arg"); - buf.append(i); - } - if (i < argTypes.length-1) { buf.append(','); } - } - - return buf.toString(); - } - - /** The name of the class around which this pipeline is being - * composed. E.g., if this pipeline was constructed with - * "java.util.Set" as the baseInterfaceClassName, then this method will - * return "Set". - */ - protected String getBaseInterfaceName() - { - return baseName; - } - - /** Get the name for this pipeline class. */ - protected abstract String getPipelineName(); - - /** - * Called after the class headers have been generated, but before any - * method wrappers have been generated. - */ - protected abstract void preMethodEmissionHook(PrintWriter output); - - /** - * Emits the constructor for the pipeline; called after the preMethodEmissionHook. - */ - protected void constructorHook(PrintWriter output) { - output.print( " public " + getPipelineName() + "(" + baseName + " "); - output.println(getDownstreamObjectName() + ")"); - output.println(" {"); - output.println(" if (" + getDownstreamObjectName() + " == null) {"); - output.println(" throw new IllegalArgumentException(\"null " + getDownstreamObjectName() + "\");"); - output.println(" }"); - output.print( " this." + getDownstreamObjectName()); - output.println(" = " + getDownstreamObjectName() + ";"); - output.println(" }"); - output.println(); - } - - /** - * Called after the method wrappers have been generated, but before the - * closing parenthesis of the class is emitted. - */ - protected abstract void postMethodEmissionHook(PrintWriter output); - - /** - * Called before the pipeline routes the call to the downstream object. - */ - protected abstract void preDownstreamCallHook(PrintWriter output, Method m); - - /** - * Called after the pipeline has routed the call to the downstream object, - * but before the calling function exits or returns a value. - */ - protected abstract void postDownstreamCallHook(PrintWriter output, Method m); - - /** Emit a Javadoc comment for this pipeline class. */ - protected abstract void emitClassDocComment(PrintWriter output); - - } // end class PipelineEmitter - - //------------------------------------------------------- - - protected class DebugPipeline extends PipelineEmitter - { - String className; - String baseInterfaceClassName; - public DebugPipeline(String outputDir, String baseInterfaceClassName) - { - super(outputDir, baseInterfaceClassName); - className = "Debug" + getBaseInterfaceName(); - } - - protected String getPipelineName() - { - return className; - } - - protected void preMethodEmissionHook(PrintWriter output) - { - } - - protected void postMethodEmissionHook(PrintWriter output) - { - output.println(" private void checkGLGetError(String caller)"); - output.println(" {"); - output.println(" if (insideBeginEndPair) {"); - output.println(" return;"); - output.println(" }"); - output.println(); - output.println(" // Debug code to make sure the pipeline is working; leave commented out unless testing this class"); - output.println(" //System.err.println(\"Checking for GL errors " + - "after call to \" + caller + \"()\");"); - output.println(); - output.println(" int err = " + - getDownstreamObjectName() + - ".glGetError();"); - output.println(" if (err == GL_NO_ERROR) { return; }"); - output.println(); - output.println(" StringBuffer buf = new StringBuffer("); - output.println(" \"glGetError() returned the following error codes " + - "after a call to \" + caller + \"(): \");"); - output.println(); - output.println(" // Loop repeatedly to allow for distributed GL implementations,"); - output.println(" // as detailed in the glGetError() specification"); - output.println(" int recursionDepth = 10;"); - output.println(" do {"); - output.println(" switch (err) {"); - output.println(" case GL_INVALID_ENUM: buf.append(\"GL_INVALID_ENUM \"); break;"); - output.println(" case GL_INVALID_VALUE: buf.append(\"GL_INVALID_VALUE \"); break;"); - output.println(" case GL_INVALID_OPERATION: buf.append(\"GL_INVALID_OPERATION \"); break;"); - output.println(" case GL_STACK_OVERFLOW: buf.append(\"GL_STACK_OVERFLOW \"); break;"); - output.println(" case GL_STACK_UNDERFLOW: buf.append(\"GL_STACK_UNDERFLOW \"); break;"); - output.println(" case GL_OUT_OF_MEMORY: buf.append(\"GL_OUT_OF_MEMORY \"); break;"); - output.println(" case GL_NO_ERROR: throw new InternalError(\"Should not be treating GL_NO_ERROR as error\");"); - output.println(" default: throw new InternalError(\"Unknown glGetError() return value: \" + err);"); - output.println(" }"); - output.println(" } while ((--recursionDepth >= 0) && (err = " + - getDownstreamObjectName() + - ".glGetError()) != GL_NO_ERROR);"); - output.println(" throw new GLException(buf.toString());"); - output.println(" }"); - - output.println(" /** True if the pipeline is inside a glBegin/glEnd pair.*/"); - output.println(" private boolean insideBeginEndPair = false;"); - output.println(); - - } - protected void emitClassDocComment(PrintWriter output) - { - output.println("/**

Composable pipline which wraps an underlying {@link GL} implementation,"); - output.println(" providing error checking after each OpenGL method call. If an error occurs,"); - output.println(" causes a {@link GLException} to be thrown at exactly the point of failure."); - output.println(" Sample code which installs this pipeline:

"); - output.println(); - output.println("
");
-      output.println("     drawable.setGL(new DebugGL(drawable.getGL()));");
-      output.println("
"); - output.println("*/"); - } - - protected void preDownstreamCallHook(PrintWriter output, Method m) - { - } - - protected void postDownstreamCallHook(PrintWriter output, Method m) - { - if (m.getName().equals("glBegin")) - { - output.println(" insideBeginEndPair = true;"); - output.println(" // NOTE: can't check glGetError(); it's not allowed inside glBegin/glEnd pair"); - } - else - { - if (m.getName().equals("glEnd")) - { - output.println(" insideBeginEndPair = false;"); - } - - // calls to glGetError() are only allowed outside of glBegin/glEnd pairs - output.println(" checkGLGetError(\"" + m.getName() + "\");"); - } - } - - } // end class DebugPipeline - - //------------------------------------------------------- - - protected class TracePipeline extends PipelineEmitter - { - String className; - String baseInterfaceClassName; - public TracePipeline(String outputDir, String baseInterfaceClassName) - { - super(outputDir, baseInterfaceClassName); - className = "Trace" + getBaseInterfaceName(); - } - - protected String getPipelineName() - { - return className; - } - - protected void preMethodEmissionHook(PrintWriter output) - { - } - - protected void constructorHook(PrintWriter output) { - output.print( " public " + getPipelineName() + "(" + getBaseInterfaceName() + " "); - output.println(getDownstreamObjectName() + ", PrintStream " + getOutputStreamName() + ")"); - output.println(" {"); - output.println(" if (" + getDownstreamObjectName() + " == null) {"); - output.println(" throw new IllegalArgumentException(\"null " + getDownstreamObjectName() + "\");"); - output.println(" }"); - output.print( " this." + getDownstreamObjectName()); - output.println(" = " + getDownstreamObjectName() + ";"); - output.print( " this." + getOutputStreamName()); - output.println(" = " + getOutputStreamName() + ";"); - output.println(" }"); - output.println(); - } - - protected void postMethodEmissionHook(PrintWriter output) - { - output.println("private PrintStream " + getOutputStreamName() + ";"); - output.println("private int indent = 0;"); - output.println("protected String dumpArray(Object obj)"); - output.println("{"); - output.println(" if (obj == null) return \"[null]\";"); - output.println(" StringBuffer sb = new StringBuffer(\"[\");"); - output.println(" int len = java.lang.reflect.Array.getLength(obj);"); - output.println(" int count = Math.min(len,16);"); - output.println(" for ( int i =0; i < count; i++ ) {"); - output.println(" sb.append(java.lang.reflect.Array.get(obj,i));"); - output.println(" if (i < count-1)"); - output.println(" sb.append(',');"); - output.println(" }"); - output.println(" if ( len > 16 )"); - output.println(" sb.append(\"...\").append(len);"); - output.println(" sb.append(']');"); - output.println(" return sb.toString();"); - output.println("}"); - output.println("protected void print(String str)"); - output.println("{"); - output.println(" "+getOutputStreamName()+".print(str);"); - output.println("}"); - output.println("protected void println(String str)"); - output.println("{"); - output.println(" "+getOutputStreamName()+".println(str);"); - output.println("}"); - output.println("protected void printIndent()"); - output.println("{"); - output.println(" for( int i =0; i < indent; i++) {"+getOutputStreamName()+".print(' ');}"); - output.println("}"); - } - protected void emitClassDocComment(PrintWriter output) - { - output.println("/**

Composable pipline which wraps an underlying {@link GL} implementation,"); - output.println(" providing tracing information to a user-specified {@link java.io.PrintStream}"); - output.println(" before after each OpenGL method call. Sample code which installs this pipeline:

"); - output.println(); - output.println("
");
-      output.println("     drawable.setGL(new TraceGL(drawable.getGL(), System.err));");
-      output.println("
"); - output.println("*/"); - } - - protected void preDownstreamCallHook(PrintWriter output, Method m) - { - Class[] params = m.getParameterTypes(); - if ( m.getName().equals("glEnd") || m.getName().equals("glEndList")) - { - output.println("indent-=2;"); - output.println(" printIndent();"); - } - else - { - output.println("printIndent();"); - } - - output.print(" print(\"" + m.getName() + "(\""); - for ( int i =0; i < params.length; i++ ) - { - if ( params[i].isArray() ) - output.print("+dumpArray(arg"+i+")"); - else - output.print("+arg"+i); - if ( i < params.length-1) - output.print("+\",\""); - } - output.println("+\")\");"); - output.print(" "); - } - - protected void postDownstreamCallHook(PrintWriter output, Method m) - { - Class ret = m.getReturnType(); - if ( ret != Void.TYPE ) - { - output.println(" println(\" = \"+_res);"); - } - else - { - output.println(" println(\"\");"); - } - } - - private String getOutputStreamName() { - return "stream"; - } - - } // end class TracePipeline -} diff --git a/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java b/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java deleted file mode 100644 index e4a091946..000000000 --- a/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.opengl; - -import java.io.*; -import java.util.*; -import java.util.regex.*; - - /** - * Builds the StaticGLInfo class from the OpenGL header files (i.e., gl.h - * and glext.h) whose paths were passed as arguments to {@link - * #main(String[])}. - * - * It relies upon the assumption that a function's membership is scoped by - * preprocessor blocks in the header files that match the following pattern: - *
- * - *
-   * 
-   * #ifndef GL_XXXX
-   * GLAPI   glFuncName()
-   * #endif GL_XXXX
-   *
-   * 
- * - * For example, if it parses the following data: - * - *
-   * 
-   * #ifndef GL_VERSION_1_3
-   * GLAPI void APIENTRY glActiveTexture (GLenum);
-   * GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
-   * GLAPI void   glFuncName()
-   * #endif GL_VERSION_1_3
-   *
-   * #ifndef GL_ARB_texture_compression
-   * GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-   * GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-   * #endif
-   * 
-   * 
- * - * It will associate - * glActiveTexture and - * glMultiTexCoord1dv - * with the symbol - * GL_VERSION_1_3 , - * and associate - * glCompressedTexImage2DARB and - * glCompressedTexImage3DARB - * with the symbol - * GL_ARB_texture_compression . - * */ -public class BuildStaticGLInfo -{ - protected static Pattern funcPattern = - Pattern.compile("^(GLAPI|extern)?(\\s*)(\\w+)(\\*)?(\\s+)(APIENTRY|WINAPI)?(\\s*)([w]?gl\\w+)\\s?(\\(.*)"); - protected static Pattern associationPattern = - Pattern.compile("\\#ifndef ([W]?GL[X]?_[A-Za-z0-9_]+)"); - - /** - * The first argument is the package to which the StaticGLInfo class - * belongs, the second is the path to the directory in which that package's - * classes reside, and the remaining arguments are paths to the C header - * files that should be parsed - */ - public static void main(String[] args) - { - String packageName = args[0]; - String packageDir = args[1]; - - String[] cHeaderFilePaths = new String[args.length-2]; - System.arraycopy(args, 2, cHeaderFilePaths, 0, cHeaderFilePaths.length); - - BuildStaticGLInfo builder = new BuildStaticGLInfo(); - try - { - File file = new File(packageDir + File.separatorChar + "StaticGLInfo.java"); - String parentDir = file.getParent(); - if (parentDir != null) - { - File pDirFile = new File(parentDir); - pDirFile.mkdirs(); - } - - PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(file))); - builder.build(writer, packageName, cHeaderFilePaths); - - writer.flush(); - writer.close(); - } - catch (Exception e) - { - StringBuffer buf = new StringBuffer("{ "); - for (int i = 0; i < cHeaderFilePaths.length; ++i) - { - buf.append(cHeaderFilePaths[i]); - buf.append(" "); - } - buf.append('}'); - throw new RuntimeException( - "Error building StaticGLInfo.java from " + buf.toString(), e); - } - } - - protected void build(PrintWriter output, String packageName, String[] cHeaderFilePaths) throws IOException - { - HashMap groupToFuncHash = new HashMap(50); - for (int i = 0; i < cHeaderFilePaths.length; ++i) - { - process(groupToFuncHash, new FileReader(cHeaderFilePaths[i])); - } - - emitJavaCode(output, packageName, groupToFuncHash); - } - - protected void process(HashMap groupToFuncHash, FileReader headerFile) throws IOException - { - BufferedReader reader = new BufferedReader(headerFile); - String line, activeAssociation = null; - Matcher m; - while ((line = reader.readLine()) != null) - { - // see if we're inside a #ifndef GL_XXX block and matching a function - if (activeAssociation != null && (m = funcPattern.matcher(line)).matches()) - { - // We found a new function associated with the last #ifndef block we - // were associated with - - String funcName = m.group(8); - HashSet funcsForGroup = (HashSet)groupToFuncHash.get(activeAssociation); - if (funcsForGroup == null) - { - funcsForGroup = new HashSet(8); - groupToFuncHash.put(activeAssociation, funcsForGroup); - } - funcsForGroup.add(funcName); - - //System.err.println("FOUND ASSOCIATION FOR " + activeAssociation + ": " + funcName); - } - else if ((m = associationPattern.matcher(line)).matches()) - { - // found a new #ifndef GL_XXX block - activeAssociation = m.group(1); - - //System.err.println("FOUND NEW ASSOCIATION BLOCK: " + activeAssociation); - } - } - } - - protected void emitJavaCode(PrintWriter output, String packageName, HashMap groupToFuncHash) - { - output.println("package " + packageName + ";"); - output.println(); - output.println("import java.util.*;"); - output.println(); - output.println("public final class StaticGLInfo"); - output.println("{"); - - output.println(" // maps function names to the extension string or OpenGL"); - output.println(" // specification version string to which they correspond."); - output.println(" private static HashMap funcToAssocMap;"); - output.println(); - - output.println(" /**"); - output.println(" * Returns the OpenGL extension string or GL_VERSION string with which the"); - output.println(" * given function is associated.

"); - output.println(" *"); - output.println(" * If the"); - output.println(" * function is part of the OpenGL core, the returned value will be"); - output.println(" * GL_VERSION_XXX where XXX represents the OpenGL version of which the"); - output.println(" * function is a member (XXX will be of the form \"A\" or \"A_B\" or \"A_B_C\";"); - output.println(" * e.g., GL_VERSION_1_2_1 for OpenGL version 1.2.1)."); - output.println(" *"); - output.println(" * If the function is an extension function, the returned value will the"); - output.println(" * OpenGL extension string for the extension to which the function"); - output.println(" * corresponds. For example, if glLoadTransposeMatrixfARB is the argument,"); - output.println(" * GL_ARB_transpose_matrix will be the value returned."); - output.println(" * Please see http://oss.sgi.com/projects/ogl-sample/registry/index.html for"); - output.println(" * a list of extension names and the functions they expose."); - output.println(" *"); - output.println(" * If the function specified is not part of any known OpenGL core version or"); - output.println(" * extension, then NULL will be returned."); - output.println(" */"); - output.println(" public static String getFunctionAssociation(String glFunctionName)"); - output.println(" {"); - output.println(" return (String)funcToAssocMap.get(glFunctionName);"); - output.println(" }"); - output.println(); - - output.println(" static"); - output.println(" {"); - output.println(" funcToAssocMap = new HashMap(1536); // approximate max capacity"); - output.println(" String group;"); - ArrayList sets = new ArrayList(groupToFuncHash.keySet()); - Collections.sort(sets); - for (int i = 0; i < sets.size(); ++i) - { - String groupName = (String) sets.get(i); - //System.err.println(groupName); // debug - output.println(); - output.println(" //----------------------------------------------------------------"); - output.println(" // " + groupName); - output.println(" //----------------------------------------------------------------"); - output.println(" group = \"" + groupName + "\";"); - HashSet funcs = (HashSet)groupToFuncHash.get(groupName); - Iterator funcIter = funcs.iterator(); - while (funcIter.hasNext()) - { - String funcName = (String)funcIter.next(); - //System.err.println(" " + funcName); // debug - output.println(" funcToAssocMap.put(\"" + funcName + "\", group);"); - } - } - output.println(" }"); - - output.println("} // end class StaticGLInfo"); - } - -} diff --git a/src/net/java/games/gluegen/opengl/CGLPAWrapperEmitter.java b/src/net/java/games/gluegen/opengl/CGLPAWrapperEmitter.java deleted file mode 100644 index 9ec2a81f9..000000000 --- a/src/net/java/games/gluegen/opengl/CGLPAWrapperEmitter.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.opengl; - -import java.io.*; -import java.util.*; -import net.java.games.gluegen.*; -import net.java.games.gluegen.cgram.types.*; - -public class CGLPAWrapperEmitter extends CMethodBindingEmitter -{ - private static final CommentEmitter defaultCommentEmitter = - new CGLPAWrapperCommentEmitter(); - - private CMethodBindingEmitter emitterBeingWrapped; - private String glFuncPtrTypedefValue; - private static String procAddressJavaTypeName = - JavaType.createForClass(Long.TYPE).jniTypeName(); - - public CGLPAWrapperEmitter(CMethodBindingEmitter methodToWrap) - { - super( - new MethodBinding(methodToWrap.getBinding()) { - public String getName() { - return GLEmitter.WRAP_PREFIX + super.getName(); - } - }, - methodToWrap.getIsOverloadedBinding(), - methodToWrap.getJavaPackageName(), - methodToWrap.getJavaClassName(), - methodToWrap.getIsJavaMethodStatic(), - methodToWrap.getDefaultOutput() - ); - - if (methodToWrap.getReturnValueCapacityExpression() != null) { - setReturnValueCapacityExpression(methodToWrap.getReturnValueCapacityExpression()); - } - if (methodToWrap.getReturnValueLengthExpression() != null) { - setReturnValueLengthExpression(methodToWrap.getReturnValueLengthExpression()); - } - setTemporaryCVariableDeclarations(methodToWrap.getTemporaryCVariableDeclarations()); - setTemporaryCVariableAssignments (methodToWrap.getTemporaryCVariableAssignments ()); - - setCommentEmitter(defaultCommentEmitter); - } - - protected int emitArguments(PrintWriter writer) - { - int numEmitted = super.emitArguments(writer); - if (numEmitted > 0) - { - writer.print(", "); - } - //writer.print("long glProcAddress"); - writer.print(procAddressJavaTypeName); - writer.print(" glProcAddress"); - ++numEmitted; - - return numEmitted; - } - - protected void emitBodyVariableDeclarations(PrintWriter writer) - { - // create variable for the function pointer with the right type, and set - // it to the value of the passed-in glProcAddress - FunctionSymbol cSym = getBinding().getCSymbol(); - String funcPointerTypedefName = - GLEmitter.getGLFunctionPointerTypedefName(cSym); - - writer.print(" "); - writer.print(funcPointerTypedefName); - writer.print(" ptr_"); - writer.print(cSym.getName()); - writer.println(";"); - - super.emitBodyVariableDeclarations(writer); - } - - protected void emitBodyVariablePreCallSetup(PrintWriter writer, - boolean emittingPrimitiveArrayCritical) - { - super.emitBodyVariablePreCallSetup(writer, emittingPrimitiveArrayCritical); - - if (!emittingPrimitiveArrayCritical) { - // set the function pointer to the value of the passed-in glProcAddress - FunctionSymbol cSym = getBinding().getCSymbol(); - String funcPointerTypedefName = - GLEmitter.getGLFunctionPointerTypedefName(cSym); - - String ptrVarName = "ptr_" + cSym.getName(); - - writer.print(" "); - writer.print(ptrVarName); - writer.print(" = ("); - writer.print(funcPointerTypedefName); - writer.println(") (intptr_t) glProcAddress;"); - - writer.println(" assert(" + ptrVarName + " != NULL);"); - } - } - - // FIXME: refactor this and the superclass version so we don't have to copy - // the whole function - protected void emitBodyCallCFunction(PrintWriter writer) - { - // Make the call to the actual C function - writer.print(" "); - - // WARNING: this code assumes that the return type has already been - // typedef-resolved. - Type cReturnType = getBinding().getCReturnType(); - - if (!cReturnType.isVoid()) { - writer.print("_res = "); - } - - // !!!!!!!!! BEGIN CHANGES FROM SUPERCLASS METHOD - - MethodBinding binding = getBinding(); - if (binding.hasContainingType()) { - // Cannot call GL func through function pointer - throw new IllegalStateException( - "Cannot call GL func through function pointer: " + binding); - } - - // call throught the run-time function pointer - writer.print("(* ptr_"); - writer.print(binding.getCSymbol().getName()); - writer.print(") "); - - // !!!!!!!!! END CHANGES FROM SUPERCLASS METHOD - - - writer.print("("); - for (int i = 0; i < binding.getNumArguments(); i++) { - if (i != 0) { - writer.print(", "); - } - JavaType javaType = binding.getJavaArgumentType(i); - // Handle case where only param is void. - if (javaType.isVoid()) { - // Make sure this is the only param to the method; if it isn't, - // there's something wrong with our parsing of the headers. - assert(binding.getNumArguments() == 1); - continue; - } - - if (javaType.isJNIEnv()) { - writer.print("env"); - } else if (binding.isArgumentThisPointer(i)) { - writer.print(CMethodBindingEmitter.cThisArgumentName()); - } else { - writer.print("("); - writer.print(binding.getCSymbol().getArgumentType(i).getName()); - writer.print(") "); - if (binding.getCArgumentType(i).isPointer() && binding.getJavaArgumentType(i).isPrimitive()) { - writer.print("(intptr_t) "); - } - if (javaType.isArray() || javaType.isNIOBuffer()) { - writer.print(pointerConversionArgumentName(i)); - if (javaArgTypeNeedsDataCopy(javaType)) { - writer.print("_copy"); - } - } else { - if (javaType.isString()) { writer.print("_UTF8"); } - writer.print(binding.getArgumentName(i)); - } - } - } - writer.println(");"); - } - - protected String jniMangle(MethodBinding binding) { - StringBuffer buf = new StringBuffer(); - buf.append(super.jniMangle(binding)); - jniMangle(Long.TYPE, buf); - return buf.toString(); - } - - /** This class emits the comment for the wrapper method */ - private static class CGLPAWrapperCommentEmitter extends CMethodBindingEmitter.DefaultCommentEmitter { - protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { - writer.print(" -- FIXME: IMPLEMENT COMMENT FOR CGLPAWrapperCommentEmitter -- "); - } - } -} // end class CGLPAWrapperEmitter diff --git a/src/net/java/games/gluegen/opengl/ConvertFromGL4Java.java b/src/net/java/games/gluegen/opengl/ConvertFromGL4Java.java deleted file mode 100644 index 428aba110..000000000 --- a/src/net/java/games/gluegen/opengl/ConvertFromGL4Java.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.opengl; - -import java.io.*; - -public class ConvertFromGL4Java { - public static void main(String[] args) throws IOException { - for (int i = 0; i < args.length; i++) { - convert(new File(args[i])); - } - } - - private static void convert(File src) throws IOException { - File orig = new File(src.getAbsolutePath() + ".orig"); - if (!src.renameTo(orig)) { - throw new IOException("Error renaming original file to " + orig); - } - File dest = src; - BufferedReader reader = new BufferedReader(new FileReader(orig)); - BufferedWriter writer = new BufferedWriter(new FileWriter(dest)); - boolean handledImports = false; - String line = null; - while ((line = reader.readLine()) != null) { - String trimmed = line.trim(); - boolean isImport = false; - if (trimmed.startsWith("import gl4java")) { - line = "import net.java.games.jogl.*;"; - isImport = true; - } - if (!isImport || - (isImport && !handledImports)) { - line = line.replaceAll("GLFunc14", "GL"); - line = line.replaceAll("GLUFunc14", "GLU"); - line = line.replaceAll("GLFunc", "GL"); - line = line.replaceAll("GLUFunc", "GLU"); - line = line.replaceAll("implements GLEnum,", "implements "); - line = line.replaceAll(", GLEnum\\s", " "); - line = line.replaceAll("GLEnum,", ""); - line = line.replaceAll("GLEnum.", ""); - line = line.replaceAll("GLEnum", ""); - line = line.replaceAll("GL_", "GL.GL_"); - writer.write(line); - writer.newLine(); - if (isImport) { - handledImports = true; - } - } - } - writer.flush(); - reader.close(); - writer.close(); - } -} diff --git a/src/net/java/games/gluegen/opengl/GLEmitter.java b/src/net/java/games/gluegen/opengl/GLEmitter.java deleted file mode 100644 index f36d7b1ac..000000000 --- a/src/net/java/games/gluegen/opengl/GLEmitter.java +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.opengl; - -import java.io.*; -import java.text.MessageFormat; -import java.util.*; -import net.java.games.gluegen.*; -import net.java.games.gluegen.cgram.types.*; -import net.java.games.gluegen.runtime.*; - -/** - * A subclass of JavaEmitter that modifies the normal emission of C and Java - * code in order to allow a high-performance, cross-platform binding of Java - * to OpenGL. - */ -public class GLEmitter extends JavaEmitter -{ - public static final String PROCADDRESS_VAR_PREFIX = ProcAddressHelper.PROCADDRESS_VAR_PREFIX; - protected static final String WRAP_PREFIX = "dispatch_"; - private TypeDictionary typedefDictionary; - private PrintWriter tableWriter; - private String tableClassPackage; - private String tableClassName; - private int numProcAddressEntries; - - public void beginFunctions(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) throws Exception - { - this.typedefDictionary = typedefDictionary; - - if (getGLConfig().emitProcAddressTable()) - { - beginGLProcAddressTable(); - } - super.beginFunctions(typedefDictionary, structDictionary, canonMap); - } - - public void endFunctions() throws Exception - { - if (getGLConfig().emitProcAddressTable()) - { - endGLProcAddressTable(); - } - super.endFunctions(); - } - - public void beginStructs(TypeDictionary typedefDictionary, - TypeDictionary structDictionary, - Map canonMap) throws Exception { - super.beginStructs(typedefDictionary, structDictionary, canonMap); - } - - protected JavaConfiguration createConfig() { - return new GLConfiguration(); - } - - protected List generateMethodBindingEmitters(FunctionSymbol sym) throws Exception - { - return generateMethodBindingEmittersImpl(sym); - } - - protected List generateMethodBindingEmitters(FunctionSymbol sym, boolean skipProcessing) throws Exception { - if (skipProcessing) { - return super.generateMethodBindingEmitters(sym); - } else { - return generateMethodBindingEmittersImpl(sym); - } - } - - private List generateMethodBindingEmittersImpl(FunctionSymbol sym) throws Exception - { - List defaultEmitters = super.generateMethodBindingEmitters(sym); - - // if the superclass didn't generate any bindings for the symbol, let's - // honor that (for example, the superclass might have caught an Ignore - // direction that matched the symbol's name). - if (defaultEmitters.isEmpty()) - { - return defaultEmitters; - } - - // Don't do anything special if this symbol doesn't require passing of - // Opengl procedure addresses in order to function correctly. - if (!needsProcAddressWrapper(sym) || getConfig().isUnimplemented(sym.getName())) - { - return defaultEmitters; - } - - // 9 is default # expanded bindings for void* - ArrayList modifiedEmitters = new ArrayList(9); - - if (getGLConfig().emitProcAddressTable()) - { - // emit an entry in the GL proc address table for this method. - emitGLProcAddressTableEntryForSymbol(sym); - } - - for (Iterator iter = defaultEmitters.iterator(); iter.hasNext(); ) - { - FunctionEmitter emitter = (FunctionEmitter) iter.next(); - if (emitter instanceof JavaMethodBindingEmitter) - { - JavaMethodBindingEmitter newEmitter = - generateModifiedEmitter((JavaMethodBindingEmitter)emitter); - if (newEmitter != null) { - modifiedEmitters.add(newEmitter); - } - } - else if (emitter instanceof CMethodBindingEmitter) - { - modifiedEmitters.add( - generateModifiedEmitter((CMethodBindingEmitter)emitter)); - } - else - { - throw new RuntimeException("Unexpected emitter type: " + - emitter.getClass().getName()); - } - } - - return modifiedEmitters; - } - - /** - * Returns the name of the typedef for a pointer to the GL function - * represented by the argument. For example, if the argument is the function - * "glFuncName", the value returned will be "PFNGLFUNCNAMEPROC". This - * returns a valid string regardless of whether or not the typedef is - * actually defined. - */ - static String getGLFunctionPointerTypedefName(FunctionSymbol sym) - { - String symName = sym.getName(); - StringBuffer buf = new StringBuffer(symName.length() + 8); - buf.append("PFN"); - buf.append(symName.toUpperCase()); - buf.append("PROC"); - return buf.toString(); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected JavaMethodBindingEmitter generateModifiedEmitter(JavaMethodBindingEmitter baseJavaEmitter) - { - if (!(baseJavaEmitter instanceof JavaMethodBindingImplEmitter)) { - // We only want to wrap the native entry point in the implementation - // class, not the public interface in the interface class. - // - // If the superclass has generated a "0" emitter for this routine because - // it needs argument conversion or similar, filter that out since we will - // be providing such an emitter ourselves. Otherwise return the emitter - // unmodified. - if (baseJavaEmitter.isForImplementingMethodCall()) - return null; - return baseJavaEmitter; - } - if (getGLConfig().manuallyImplement(baseJavaEmitter.getName())) { - // User will provide Java-side implementation of this routine - return null; - } - return new JavaGLPAWrapperEmitter(baseJavaEmitter, getGLConfig().getProcAddressTableExpr()); - } - - protected CMethodBindingEmitter generateModifiedEmitter(CMethodBindingEmitter baseCEmitter) - { - // The C-side JNI binding for this particular function will have an - // extra final argument, which is the address (the OpenGL procedure - // address) of the function it needs to call - CGLPAWrapperEmitter res = new CGLPAWrapperEmitter(baseCEmitter); - MessageFormat exp = baseCEmitter.getReturnValueCapacityExpression(); - if (exp != null) { - res.setReturnValueCapacityExpression(exp); - } - return res; - } - - protected boolean needsProcAddressWrapper(FunctionSymbol sym) - { - String symName = sym.getName(); - - GLConfiguration config = getGLConfig(); - - // We should only wrap the GL symbol if its function pointer typedef has - // been defined (most likely in glext.h). - String funcPointerTypedefName = getGLFunctionPointerTypedefName(sym); - boolean shouldWrap = typedefDictionary.containsKey(funcPointerTypedefName); - //System.err.println(funcPointerTypedefName + " defined: " + shouldWrap); - - if (config.skipProcAddressGen(symName)) { - shouldWrap = false; - } - - if (!shouldWrap) - { - //System.err.println("WARNING (GL): *not* run-time linking: " + sym + - // "(" + funcPointerTypedefName + " undefined)"); - } - else - { - FunctionType typedef = typedefDictionary.get(funcPointerTypedefName).asPointer().getTargetType().asFunction(); - FunctionType fun = sym.getType(); - int numarg = typedef.getNumArguments(); - for ( int i =0; i < numarg; i++ ) - { - if ( fun.getArgumentName(i) == null ) - fun.setArgumentName(i,typedef.getArgumentName(i)); - } - } - - return shouldWrap; - } - - private void beginGLProcAddressTable() throws Exception - { - tableClassPackage = getGLConfig().tableClassPackage(); - tableClassName = getGLConfig().tableClassName(); - - // Table defaults to going into the impl directory unless otherwise overridden - String implPackageName = tableClassPackage; - if (implPackageName == null) { - implPackageName = getImplPackageName(); - } - String jImplRoot = - getJavaOutputDir() + File.separator + - CodeGenUtils.packageAsPath(implPackageName); - - tableWriter = openFile(jImplRoot + File.separator + tableClassName + ".java"); - - CodeGenUtils.emitAutogeneratedWarning(tableWriter, this); - - tableWriter.println("package " + implPackageName + ";"); - tableWriter.println(); - for (Iterator iter = getConfig().imports().iterator(); iter.hasNext(); ) { - tableWriter.println("import " + ((String) iter.next()) + ";"); - } - tableWriter.println(); - tableWriter.println("/**"); - tableWriter.println(" * This table is a cache of the native pointers to OpenGL extension"); - tableWriter.println(" * functions, to be used for run-time linking of these extensions. "); - tableWriter.println(" * These pointers are obtained by the OpenGL context via a "); - tableWriter.println(" * platform-specific function (e.g., wglGetProcAddress() on Win32,"); - tableWriter.println(" * glXGetProcAddress() on X11, etc). If the member variable "); - tableWriter.println(" * " + PROCADDRESS_VAR_PREFIX + "glFuncName is non-zero then function"); - tableWriter.println(" * \"glFuncName\" can be called through the associated GLContext; "); - tableWriter.println(" * if it is 0, then the extension is not available and cannot be called."); - tableWriter.println(" */"); - tableWriter.println("public class " + tableClassName); - tableWriter.println("{"); - numProcAddressEntries = 0; - - for (Iterator iter = getGLConfig().getForceProcAddressGen().iterator(); iter.hasNext(); ) { - emitGLProcAddressTableEntryForString((String) iter.next()); - } - } - - private void endGLProcAddressTable() throws Exception - { - PrintWriter w = tableWriter; - - w.println(); - w.println(" /**"); - w.println(" * This is a convenience method to get (by name) the native function "); - w.println(" * pointer for a given extension function. It lets you avoid "); - w.println(" * having to manually compute the " + PROCADDRESS_VAR_PREFIX + ""); - w.println(" * member variable name and look it up via reflection; it also"); - w.println(" * will throw an exception if you try to get the address of an"); - w.println(" * unknown GL extension, or one that is statically linked "); - w.println(" * and therefore does not have a valid GL procedure address. "); - w.println(" */"); - w.println(" public long getAddressFor(String glFunctionName) {"); - w.println(" String addressFieldName = net.java.games.gluegen.opengl.GLEmitter.PROCADDRESS_VAR_PREFIX + glFunctionName;"); - w.println(" try { "); - w.println(" java.lang.reflect.Field addressField = this.getClass().getField(addressFieldName);"); - w.println(" return addressField.getLong(this);"); - w.println(" } catch (Exception e) {"); - w.println(" // The user is calling a bogus function or one which is not runtime"); - w.println(" // linked (extensions and core post-OpenGL 1.1 functions are runtime linked)"); - w.println(" if (!FunctionAvailabilityCache.isPartOfGLCore(\"1.1\", glFunctionName)) "); - w.println(" {"); - w.println(" throw new RuntimeException(" ); - w.println(" \"WARNING: Address query failed for \\\"\" + glFunctionName +"); - w.println(" \"\\\"; either it's not runtime linked or it is not a known \" +"); - w.println(" \"OpenGL function\", e);"); - w.println(" }"); - w.println(" } "); - w.println(" assert(false); // should never get this far"); - w.println(" return 0;"); - w.println(" }"); - - w.println("} // end of class " + tableClassName); - w.flush(); - w.close(); - } - - protected void emitGLProcAddressTableEntryForSymbol(FunctionSymbol cFunc) - { - emitGLProcAddressTableEntryForString(cFunc.getName()); - } - - protected void emitGLProcAddressTableEntryForString(String str) - { - tableWriter.print(" public long "); - tableWriter.print(PROCADDRESS_VAR_PREFIX); - tableWriter.print(str); - tableWriter.println(";"); - ++numProcAddressEntries; - } - - protected GLConfiguration getGLConfig() { - return (GLConfiguration) getConfig(); - } - - protected static class GLConfiguration extends JavaConfiguration - { - private boolean emitProcAddressTable = false; - private String tableClassPackage; - private String tableClassName = "ProcAddressTable"; - private Set/**/ skipProcAddressGen = new HashSet(); - private List/**/ forceProcAddressGen = new ArrayList(); - private String contextVariableName = "context"; - private String defaultGetProcAddressTableExpr = ".getGLProcAddressTable()"; - private String getProcAddressTableExpr; - - protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { - if (cmd.equalsIgnoreCase("EmitProcAddressTable")) - { - emitProcAddressTable = - readBoolean("EmitProcAddressTable", tok, filename, lineNo).booleanValue(); - } - else if (cmd.equalsIgnoreCase("ProcAddressTablePackage")) - { - tableClassPackage = readString("ProcAddressTablePackage", tok, filename, lineNo); - } - else if (cmd.equalsIgnoreCase("ProcAddressTableClassName")) - { - tableClassName = readString("ProcAddressTableClassName", tok, filename, lineNo); - } - else if (cmd.equalsIgnoreCase("SkipProcAddressGen")) - { - String sym = readString("SkipProcAddressGen", tok, filename, lineNo); - skipProcAddressGen.add(sym); - } - else if (cmd.equalsIgnoreCase("ForceProcAddressGen")) - { - String sym = readString("ForceProcAddressGen", tok, filename, lineNo); - forceProcAddressGen.add(sym); - } - else if (cmd.equalsIgnoreCase("ContextVariableName")) - { - contextVariableName = readString("ContextVariableName", tok, filename, lineNo); - } - else if (cmd.equalsIgnoreCase("GetProcAddressTableExpr")) - { - getProcAddressTableExpr = readGetProcAddressTableExpr(tok, filename, lineNo); - } - else - { - super.dispatch(cmd,tok,file,filename,lineNo); - } - } - - protected String readGetProcAddressTableExpr(StringTokenizer tok, String filename, int lineNo) { - try { - String restOfLine = tok.nextToken("\n\r\f"); - return restOfLine.trim(); - } catch (NoSuchElementException e) { - throw new RuntimeException("Error parsing \"GetProcAddressTableExpr\" command at line " + lineNo + - " in file \"" + filename + "\"", e); - } - } - - public boolean emitProcAddressTable() { return emitProcAddressTable; } - public String tableClassPackage() { return tableClassPackage; } - public String tableClassName() { return tableClassName; } - public boolean skipProcAddressGen (String name) { return skipProcAddressGen.contains(name); } - public List getForceProcAddressGen() { return forceProcAddressGen; } - public String contextVariableName() { return contextVariableName; } - public String getProcAddressTableExpr() { - if (getProcAddressTableExpr == null) { - getProcAddressTableExpr = contextVariableName + defaultGetProcAddressTableExpr; - } - return getProcAddressTableExpr; - } - } // end class GLConfiguration -} - diff --git a/src/net/java/games/gluegen/opengl/JavaGLPAWrapperEmitter.java b/src/net/java/games/gluegen/opengl/JavaGLPAWrapperEmitter.java deleted file mode 100644 index aa853711a..000000000 --- a/src/net/java/games/gluegen/opengl/JavaGLPAWrapperEmitter.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.opengl; - -import java.io.*; -import java.util.*; -import net.java.games.gluegen.*; -import net.java.games.gluegen.cgram.types.*; - -public class JavaGLPAWrapperEmitter extends JavaMethodBindingImplEmitter -{ - private static final CommentEmitter commentEmitterForWrappedMethod = - new WrappedMethodCommentEmitter(); - - private JavaMethodBindingEmitter emitterBeingWrapped; - private String getProcAddressTableExpr; - - public JavaGLPAWrapperEmitter(JavaMethodBindingEmitter methodToWrap, String getProcAddressTableExpr) - { - super(methodToWrap.getBinding(), methodToWrap.getDefaultOutput(), methodToWrap.getRuntimeExceptionType()); - this.getProcAddressTableExpr = getProcAddressTableExpr; - - if (methodToWrap.getBinding().hasContainingType()) - { - throw new IllegalArgumentException( - "Cannot create OpenGL proc. address wrapper; method has containing type: \"" + - methodToWrap.getBinding() + "\""); - } - - // make a new emitter that will emit the original method's binding, but - // with WRAP_PREFIX before its name. If a body is needed (for array - // length checking, unwrapping of wrapper objects to java.nio.Buffers, - // etc.) then it will be generated; therefore the emitter being wrapped - // should be an "NIO buffer variant" (i.e., after all unpacking has - // occurred). - emitterBeingWrapped = - new JavaMethodBindingEmitter(methodToWrap.getBinding().createNIOBufferVariant(), - methodToWrap.getDefaultOutput(), - methodToWrap.getRuntimeExceptionType()) - { - protected void emitName(PrintWriter writer) - { - writer.print(GLEmitter.WRAP_PREFIX); - super.emitName(writer); - } - protected int emitArguments(PrintWriter writer) - { - int numEmitted = super.emitArguments(writer); - if (numEmitted > 0) - { - writer.print(", "); - } - writer.print("long glProcAddress"); - ++numEmitted; - - return numEmitted; - } - }; - - // copy the modifiers from the original emitter - emitterBeingWrapped.addModifiers(methodToWrap.getModifiers()); - - // Change the access of the method we're wrapping to PRIVATE - EmissionModifier origAccess = null; // null is equivalent if package access - if (emitterBeingWrapped.hasModifier(PUBLIC)) - { - origAccess = PUBLIC; - } - else if (emitterBeingWrapped.hasModifier(PROTECTED)) - { - origAccess = PROTECTED; - } - else if (emitterBeingWrapped.hasModifier(PRIVATE)) - { - origAccess = PRIVATE; - } - - if (origAccess != null) - { - emitterBeingWrapped.removeModifier(origAccess); - } - emitterBeingWrapped.addModifier(PRIVATE); - emitterBeingWrapped.addModifier(NATIVE); - - // Now make our binding use the original access of the wrapped method - this.addModifier(origAccess); - if (emitterBeingWrapped.hasModifier(STATIC)) { - this.addModifier(STATIC); - } - } - - protected boolean needsBody() { - return true; - } - - protected String getImplMethodName() { - return GLEmitter.WRAP_PREFIX + getBinding().getName(); - } - - public void emit(PrintWriter writer) - { - // Emit a wrapper that will call the method we want to wrap - //writer.println(" // Emitter being wrapped = " + emitterBeingWrapped.getClass().getName()); - super.emit(writer); - writer.println(); - - // emit the wrapped method - CommentEmitter origComment = emitterBeingWrapped.getCommentEmitter(); - emitterBeingWrapped.setCommentEmitter(commentEmitterForWrappedMethod); - emitterBeingWrapped.emit(writer); - emitterBeingWrapped.setCommentEmitter(origComment); - writer.println(); - } - - protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) { - super.emitPreCallSetup(binding, writer); - - MethodBinding wrappedBinding = emitterBeingWrapped.getBinding(); - String procAddressVariable = - GLEmitter.PROCADDRESS_VAR_PREFIX + wrappedBinding.getName(); - - writer.println(" final long __addr_ = " + getProcAddressTableExpr + "." + procAddressVariable + ";"); - writer.println(" if (__addr_ == 0) {"); - writer.println(" throw new GLException(\"Method \\\"" + binding.getName() + "\\\" not available\");"); - writer.println(" }"); - } - - protected int emitCallArguments(MethodBinding binding, PrintWriter writer) { - int numEmitted = super.emitCallArguments(binding, writer); - if (numEmitted > 0) { - writer.print(", "); - } - writer.print("__addr_"); - return 1 + numEmitted; - } - - /** This class emits the comment for the wrapper method */ - private static class WrappedMethodCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { - protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { - writer.print("Encapsulates function pointer for OpenGL function
: "); - } - } -} // end class JavaGLPAWrapperEmitter diff --git a/src/net/java/games/gluegen/pcpp/PCPP.java b/src/net/java/games/gluegen/pcpp/PCPP.java deleted file mode 100644 index 0990bb155..000000000 --- a/src/net/java/games/gluegen/pcpp/PCPP.java +++ /dev/null @@ -1,845 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.pcpp; - -import java.io.*; -import java.util.*; - -/** A minimal pseudo-C-preprocessor designed in particular to preserve - #define statements defining constants so they can be observed by a - glue code generator. */ - -public class PCPP { - private static final boolean disableDebugPrint = true; - - public PCPP(List/**/ includePaths) { - this.includePaths = includePaths; - setOut(System.out); - } - - public OutputStream out() { return out; } - public void setOut(OutputStream out) { this.out = out; writer = new PrintWriter(out); } - - public void run(Reader reader, String filename) throws IOException { - StreamTokenizer tok = new StreamTokenizer(reader); - tok.resetSyntax(); - tok.wordChars('a', 'z'); - tok.wordChars('A', 'Z'); - tok.wordChars('0', '9'); - tok.wordChars('_', '_'); - tok.wordChars('.', '.'); - tok.wordChars(128 + 32, 255); - tok.whitespaceChars(0, ' '); - tok.quoteChar('"'); - tok.quoteChar('\''); - tok.eolIsSignificant(true); - tok.slashSlashComments(true); - tok.slashStarComments(true); - ParseState curState = new ParseState(tok, filename); - ParseState oldState = state; - state = curState; - lineDirective(); - parse(); - state = oldState; - if (state != null) { - lineDirective(); - } - } - - public static void main(String[] args) { - try { - Reader reader = null; - String filename = null; - - if (args.length == 0) { - usage(); - } - - List includePaths = new ArrayList(); - for (int i = 0; i < args.length; i++) { - if (i < args.length - 1) { - String arg = args[i]; - if (arg.startsWith("-I")) { - String[] paths = arg.substring(2).split(System.getProperty("path.separator")); - for (int j = 0; j < paths.length; j++) { - includePaths.add(paths[j]); - } - } else { - usage(); - } - } else { - String arg = args[i]; - if (arg.equals("-")) { - reader = new InputStreamReader(System.in); - filename = "standard input"; - } else { - if (arg.startsWith("-")) { - usage(); - } - filename = arg; - reader = new BufferedReader(new FileReader(filename)); - } - } - } - - new PCPP(includePaths).run(reader, filename); - } catch (IOException e) { - e.printStackTrace(); - } - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private static void usage() { - System.out.println("Usage: java PCPP [filename | -]"); - System.out.println("Minimal pseudo-C-preprocessor."); - System.out.println("Output goes to standard output. Standard input can be used as input"); - System.out.println("by passing '-' as the argument."); - System.exit(1); - } - - /** Map containing the results of #define statements. We must - evaluate certain very simple definitions (to properly handle - OpenGL's gl.h) but preserve the text of definitions evaluating - to constants. Macros and multi-line defines (which typically - contain either macro definitions or expressions) are currently - not handled. */ - private Map/**/ defineMap = new HashMap(); - private Set/**/ nonConstantDefines = new HashSet(); - - /** List containing the #include paths as Strings */ - private List/**/ includePaths; - - // State - static class ParseState { - private StreamTokenizer tok; - private String filename; - private int lineNumber; - private boolean startOfLine; - private boolean startOfFile; - - ParseState(StreamTokenizer tok, String filename) { - this.tok = tok; - this.filename = filename; - lineNumber = 1; - startOfLine = true; - startOfFile = true; - } - - StreamTokenizer tok() { return tok; } - String filename() { return filename; } - int lineNumber() { return tok.lineno(); } - boolean startOfLine() { return startOfLine; } - void setStartOfLine(boolean val) { startOfLine = val; } - boolean startOfFile() { return startOfFile; } - void setStartOfFile(boolean val) { startOfFile = val; } - } - - private ParseState state; - - // Accessors - - private void pushBackToken() throws IOException { - state.tok().pushBack(); - } - - /** Equivalent to nextToken(false) */ - private int nextToken() throws IOException { - return nextToken(false); - } - - private int nextToken(boolean returnEOLs) throws IOException { - int lineno = lineNumber(); - // Check to see whether the previous call to nextToken() left an - // EOL on the stream - if (curToken() == StreamTokenizer.TT_EOL) { - state.setStartOfLine(true); - } else if (!state.startOfFile()) { - state.setStartOfLine(false); - } - state.setStartOfFile(false); - int val = state.tok().nextToken(); - if (!returnEOLs) { - if (val == StreamTokenizer.TT_EOL) { - do { - // Consume and return next token, setting state appropriately - val = state.tok().nextToken(); - state.setStartOfLine(true); - println(); - } while (val == StreamTokenizer.TT_EOL); - } - } - if (lineNumber() > lineno + 1) { - // This is a little noisier than it needs to be, but does handle - // the case of multi-line comments properly - lineDirective(); - } - return val; - } - - /** - * Reads the next token and throws an IOException if it is not the specified - * token character. - */ - private void nextRequiredToken(int requiredToken) throws IOException { - int nextTok = nextToken(); - if (nextTok != requiredToken) { - String msg = "Expected token '" + requiredToken + "' but got "; - switch (nextTok) { - case StreamTokenizer.TT_EOF: msg += ""; break; - case StreamTokenizer.TT_EOL: msg += ""; break; - default: msg += "'" + curTokenAsString() + "'"; break; - } - msg += " at file " + filename() + ", line " + lineNumber(); - throw new IOException(msg); - } - } - - private int curToken() { - return state.tok().ttype; - } - - private String curTokenAsString() { - int t = curToken(); - if (t == StreamTokenizer.TT_WORD) { - return curWord(); - } - if (t == StreamTokenizer.TT_EOL) { - throw new RuntimeException("Should not be converting EOL characters to strings"); - } - char c = (char) t; - if (c == '"' || c == '\'') { - StringBuffer buf = new StringBuffer(); - buf.append(c); - buf.append(state.tok().sval); - buf.append(c); - return buf.toString(); - } - return new String(new char[] { c }); - } - - private String nextWord() throws IOException { - int val = nextToken(); - if (val != StreamTokenizer.TT_WORD) { - throw new RuntimeException("Expected word at file " + filename() + - ", line " + lineNumber()); - } - return curWord(); - } - - private String curWord() { - return state.tok().sval; - } - - private boolean startOfLine() { - return state.startOfLine(); - } - - private String filename() { - return state.filename(); - } - - private int lineNumber() { - return state.lineNumber(); - } - - ///////////// - // Parsing // - ///////////// - - private void parse() throws IOException { - int tok = 0; - while ((tok = nextToken()) != StreamTokenizer.TT_EOF) { - // A '#' at the beginning of a line is a preprocessor directive - if (startOfLine() && (tok == '#')) { - preprocessorDirective(); - } else { - // Output white space plus current token, handling #defines - // (though not properly -- only handling #defines to constants and the empty string) - print(" "); - String s = curTokenAsString(); - String newS = (String) defineMap.get(s); - if (newS == null) { - newS = s; - } - print(newS); - } - } - flush(); - } - - private void preprocessorDirective() throws IOException { - String w = nextWord(); - boolean shouldPrint = true; - if (w.equals("define")) { - handleDefine(); - shouldPrint = false; - } else if (w.equals("undef")) { - handleUndefine(); - shouldPrint = false; - } else if (w.equals("if") || w.equals("elif")) { - handleIf(w.equals("if")); - shouldPrint = false; - } else if (w.equals("ifdef") || w.equals("ifndef")) { - handleIfdef(w.equals("ifdef")); - shouldPrint = false; - } else if (w.equals("else")) { - handleElse(); - shouldPrint = false; - } else if (w.equals("endif")) { - handleEndif(); - shouldPrint = false; - } else if (w.equals("include")) { - handleInclude(); - shouldPrint = false; - } else { - // Unknown preprocessor directive (#pragma?) -- ignore - } - if (shouldPrint) { - print("# "); - printToken(); - } - } - - //////////////////////////////////// - // Handling of #define directives // - //////////////////////////////////// - - private void handleUndefine() throws IOException { - // Next token is the name of the #undef - String name = nextWord(); - - debugPrint(true, "#undef " + name); - - // there shouldn't be any extra symbols after the name, but just in case... - List values = new ArrayList(); - while (nextToken(true) != StreamTokenizer.TT_EOL) { - values.add(curTokenAsString()); - } - - if (enabled()) { - String oldDef = (String)defineMap.remove(name); - if (oldDef == null) { - System.err.println("WARNING: ignoring redundant \"#undef " + - name + "\", at \"" + filename() + "\" line " + lineNumber() + - ": \"" + name + "\" was not previously defined"); - } else { - // System.err.println("UNDEFINED: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); - } - nonConstantDefines.remove(name); - } - else System.err.println("FAILED TO UNDEFINE: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); - } - - private void handleDefine() throws IOException { - // Next token is the name of the #define - String name = nextWord(); - //System.err.println("IN HANDLE_DEFINE: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); - // (Note that this is not actually proper handling for multi-line #defines) - List values = new ArrayList(); - while (nextToken(true) != StreamTokenizer.TT_EOL) { - values.add(curTokenAsString()); - } - // if we're not within an active block of code (like inside an "#ifdef - // FOO" where FOO isn't defined), then don't actually alter the definition - // map. - debugPrint(true, "#define " + name); - if (enabled()) - { - boolean emitDefine = true; - - // Handle #definitions to nothing or to a constant value - int sz = values.size(); - if (sz == 0) { - // definition to nothing, like "#define FOO" - String oldDef = (String)defineMap.put(name, ""); - if (oldDef != null) { - System.err.println("WARNING: \"" + name + "\" redefined from \"" + - oldDef + "\" to \"\""); - } - // We don't want to emit the define, because it would serve no purpose - // and cause GlueGen errors (confuse the GnuCParser) - emitDefine = false; - //System.out.println("//---DEFINED: " + name + "to \"\""); - } else if (sz == 1) { - // See whether the value is a constant - String value = (String) values.get(0); - if (isConstant(value)) { - // Value is numeric constant like "#define FOO 5". - // Put it in the #define map - String oldDef = (String)defineMap.put(name, value); - if (oldDef != null) { - System.err.println("WARNING: \"" + name + "\" redefined from \"" + - oldDef + "\" to \"" + value + "\""); - } - //System.out.println("//---DEFINED: " + name + " to \"" + value + "\""); - } else { - // Value is a symbolic constant like "#define FOO BAR". - // Try to look up the symbol's value - String newValue = resolveDefine(value, true); - if (newValue != null) { - // Set the value to the value of the symbol. - // - // TO DO: Is this correct? Why not output the symbol unchanged? - // I think that it's a good thing to see that some symbols are - // defined in terms of others. -chris - values.set(0, newValue); - } - else - { - // Still perform textual replacement - defineMap.put(name, value); - nonConstantDefines.add(name); - emitDefine = false; - } - } - } - else - { - // Non-constant define; try to do reasonable textual substitution anyway - // (FIXME: should identify some of these, like (-1), as constants) - emitDefine = false; - StringBuffer val = new StringBuffer(); - for (int i = 0; i < sz; i++) { - if (i != 0) { - val.append(" "); - } - val.append(resolveDefine((String) values.get(i), false)); - } - if (defineMap.get(name) != null) { - // This is probably something the user should investigate. - throw new RuntimeException("Cannot redefine symbol \"" + name + - " from \"" + defineMap.get(name) + "\" to non-constant " + - " definition \"" + val.toString() + "\""); - } - defineMap.put(name, val.toString()); - nonConstantDefines.add(name); - } - - if (emitDefine) - { - // Print name and value - print("# define "); - print(name); - for (Iterator iter = values.iterator(); iter.hasNext(); ) { - print(" "); - print((String) iter.next()); - } - println(); - } - - } // end if (enabled()) - - //System.err.println("OUT HANDLE_DEFINE: " + name); - } - - private boolean isConstant(String s) { - if (s.startsWith("0x") || s.startsWith("0X")) { - return checkHex(s); - } else { - return checkDecimal(s); - } - } - - private boolean checkHex(String s) { - for (int i = 2; i < s.length(); i++) { - char c = s.charAt(i); - if (!((c >= '0' && c <= '9') || - (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F'))) { - return false; - } - } - return true; - } - - private boolean checkDecimal(String s) { - try { - Float.valueOf(s); - } - catch (NumberFormatException e) { - // not parsable as a number - return false; - } - return true; - } - - private String resolveDefine(String word, boolean returnNullIfNotFound) { - String lastWord = (String) defineMap.get(word); - if (lastWord == null) { - if (returnNullIfNotFound) { - return null; - } - return word; - } - String nextWord = null; - do { - nextWord = (String) defineMap.get(lastWord); - if (nextWord != null) { - lastWord = nextWord; - } - } while (nextWord != null); - return lastWord; - } - - //////////////////////////////////////////////// - // Handling of #if/#ifdef/ifndef/endif directives // - //////////////////////////////////////////////// - - /** - * @param isIfdef if true, we're processing #ifdef; if false, we're - * processing #ifndef. - */ - private void handleIfdef(boolean isIfdef) throws IOException { - // Next token is the name of the #ifdef - String symbolName = nextWord(); - debugPrint(true, (isIfdef ? "#ifdef " : "#ifndef ") + symbolName); - boolean symbolIsDefined = defineMap.get(symbolName) != null; - //debugPrint(true, "HANDLE_IFDEF: ifdef(" + symbolName + ") = " + symbolIsDefined ); - pushEnableBit(enabled() && symbolIsDefined == isIfdef); - } - - /** Handles #else directives */ - private void handleElse() throws IOException { - boolean enabledStatusBeforeElse = enabled(); - popEnableBit(); - pushEnableBit(enabled() && !enabledStatusBeforeElse); - debugPrint(true, "#else "); - } - - private void handleEndif() { - boolean enabledBeforePopping = enabled(); - popEnableBit(); - - // print the endif if we were enabled prior to popEnableBit() (sending - // false to debugPrint means "print regardless of current enabled() state). - debugPrint(!enabledBeforePopping, "#endif/end-else"); - } - - /** - * @param isIf if true, we're processing #if; if false, we're - * processing #elif. - */ - private void handleIf(boolean isIf) throws IOException { - //System.out.println("IN HANDLE_" + (isIf ? "IF" : "ELIF") + " file \"" + filename() + " line " + lineNumber()); - debugPrint(true, (isIf ? "#if" : "#elif")); - boolean defineEvaluatedToTrue = handleIfRecursive(true); - if (!isIf) { - popEnableBit(); - } - pushEnableBit(defineEvaluatedToTrue); - //System.out.println("OUT HANDLE_" + (isIf ? "IF" : "ELIF") +" (evaluated to " + defineEvaluatedToTrue + ")"); - } - - //static int tmp = -1; - - /** - * This method is called recursively to process nested sub-expressions such as: - *

-   *   #if !defined(OPENSTEP) && !(defined(NeXT) || !defined(NeXT_PDO))
-   *
- * - * @param greedy if true, continue evaluating sub-expressions until EOL is - * reached. If false, return as soon as the first sub-expression is - * processed. - * @return the value of the sub-expression or (if greedy==true) - * series of sub-expressions. - */ - private boolean handleIfRecursive(boolean greedy) throws IOException { - //System.out.println("IN HANDLE_IF_RECURSIVE (" + ++tmp + ", greedy = " + greedy + ")"); System.out.flush(); - - // ifValue keeps track of the current value of the potentially nested - // "defined()" expressions as we process them. - boolean ifValue = true; - int openParens = 0; - int tok; - do { - tok = nextToken(true); - //System.out.println("-- READ: [" + (tok == StreamTokenizer.TT_EOL ? "" :curTokenAsString()) + "]"); - switch (tok) { - case '(': - ++openParens; - //System.out.println("OPEN PARENS = " + openParens); - ifValue = ifValue && handleIfRecursive(true); - break; - case ')': - --openParens; - //System.out.println("OPEN PARENS = " + openParens); - break; - case '!': - { - //System.out.println("HANDLE_IF_RECURSIVE HANDLING !"); - boolean rhs = handleIfRecursive(false); - ifValue = !rhs; - //System.out.println("HANDLE_IF_RECURSIVE HANDLED OUT !, RHS = " + rhs); - } - break; - case '&': - { - nextRequiredToken('&'); - //System.out.println("HANDLE_IF_RECURSIVE HANDLING &&, LHS = " + ifValue); - boolean rhs = handleIfRecursive(true); - //System.out.println("HANDLE_IF_RECURSIVE HANDLED &&, RHS = " + rhs); - ifValue = ifValue && rhs; - } - break; - case '|': - { - nextRequiredToken('|'); - //System.out.println("HANDLE_IF_RECURSIVE HANDLING ||, LHS = " + ifValue); - boolean rhs = handleIfRecursive(true); - //System.out.println("HANDLE_IF_RECURSIVE HANDLED ||, RHS = " + rhs); - ifValue = ifValue || rhs; - } - break; - case StreamTokenizer.TT_WORD: - { - String word = curTokenAsString(); - if (word.equals("defined")) { - // Handle things like #if defined(SOMESYMBOL) - nextRequiredToken('('); - String symbol = nextWord(); - boolean isDefined = defineMap.get(symbol) != null; - //System.out.println("HANDLE_IF_RECURSIVE HANDLING defined(" + symbol + ") = " + isDefined); - ifValue = ifValue && isDefined; - nextRequiredToken(')'); - } - else { - // Handle things like #if SOME_SYMBOL. - String symbolValue = (String)defineMap.get(word); - - // See if the statement is "true"; i.e., a non-zero expression - if (symbolValue != null) { - // The statement is true if the symbol is defined and is a constant expression - return (!nonConstantDefines.contains(word)); - } else { - // The statement is true if the symbol evaluates to a non-zero value - // - // NOTE: This doesn't yet handle evaluable expressions like "#if - // SOME_SYMBOL > 5" or "#if SOME_SYMBOL == 0", both of which are - // valid syntax. It only handles numeric symbols like "#if 1" - - try { - // see if it's in decimal form - return Double.parseDouble(word) != 0; - } - catch (NumberFormatException nfe1) { - try { - // ok, it's not a valid decimal value, try hex/octal value - return Long.parseLong(word) != 0; - } - catch (NumberFormatException nfe2) { - try { - // ok, it's not a valid hex/octal value, try boolean - return Boolean.valueOf(word) == Boolean.TRUE; - } - catch (NumberFormatException nfe3) { - // give up; the symbol isn't a numeric or boolean value - return false; - } - } - } - } - } - } // end case TT_WORD - break; - case StreamTokenizer.TT_EOL: - //System.out.println("HANDLE_IF_RECURSIVE HIT !"); - pushBackToken(); // so caller hits EOL as well if we're recursing - break; - case StreamTokenizer.TT_EOF: - throw new RuntimeException("Unexpected end of file while parsing " + - "#if statement at file " + filename() + ", line " + lineNumber()); - - default: - throw new RuntimeException("Unexpected token (" + curTokenAsString() + - ") while parsing " + "#if statement at file " + filename() + - ", line " + lineNumber()); - } - //System.out.println("END OF WHILE: greedy = " + greedy + " parens = " +openParens + " not EOL = " + (tok != StreamTokenizer.TT_EOL) + " --> " + ((greedy && openParens >= 0) && tok != StreamTokenizer.TT_EOL)); - } while ((greedy && openParens >= 0) && tok != StreamTokenizer.TT_EOL); - //System.out.println("OUT HANDLE_IF_RECURSIVE (" + tmp-- + ", returning " + ifValue + ")"); - //System.out.flush(); - return ifValue; - } - - ///////////////////////////////////// - // Handling of #include directives // - ///////////////////////////////////// - - private void handleInclude() throws IOException { - // Two kinds of #includes: one with quoted string for argument, - // one with angle brackets surrounding argument - int t = nextToken(); - String filename = null; - if (t == '"') { - filename = curWord(); - } else if (t == '<') { - // Components of path name are coming in as separate tokens; - // concatenate them - StringBuffer buf = new StringBuffer(); - while ((t = nextToken()) != '>' && (t != StreamTokenizer.TT_EOF)) { - buf.append(curTokenAsString()); - } - if (t == StreamTokenizer.TT_EOF) { - System.err.println("WARNING: unexpected EOF while processing #include directive"); - } - filename = buf.toString(); - } - // if we're not within an active block of code (like inside an "#ifdef - // FOO" where FOO isn't defined), then don't actually process the - // #included file. - debugPrint(true, "#include [" + filename + "]"); - if (enabled()) - { - // Look up file in known #include path - String fullname = findFile(filename); - //System.out.println("ACTIVE BLOCK, LOADING " + filename); - if (fullname == null) { - System.err.println("WARNING: unable to find #include file \"" + filename + "\""); - return; - } - // Process this file in-line - Reader reader = new BufferedReader(new FileReader(fullname)); - run(reader, fullname); - } - else - { - //System.out.println("INACTIVE BLOCK, SKIPPING " + filename); - } - } - - private String findFile(String filename) { - String sep = System.getProperty("file.separator"); - for (Iterator iter = includePaths.iterator(); iter.hasNext(); ) { - String inclPath = (String) iter.next(); - String fullPath = inclPath + sep + filename; - File file = new File(fullPath); - if (file.exists()) { - return fullPath; - } - } - return null; - } - - //////////// - // Output // - //////////// - - private OutputStream out; - private PrintWriter writer; - private ArrayList enabledBits = new ArrayList(); - - private static int debugPrintIndentLevel = 0; - private void debugPrint(boolean onlyPrintIfEnabled, String msg) - { - if (disableDebugPrint) { - return; - } - - if (!onlyPrintIfEnabled || (onlyPrintIfEnabled && enabled())) - { - for (int i = debugPrintIndentLevel; --i >0; ) { - System.out.print(" "); - } - System.out.println(msg + " (line " + lineNumber() + " file " + filename() + ")"); - } - } - - private void pushEnableBit(boolean enabled) { - enabledBits.add(new Boolean(enabled)); - ++debugPrintIndentLevel; - //debugPrint(false, "PUSH_ENABLED, NOW: " + enabled()); - } - - private void popEnableBit() { - if (enabledBits.size() == 0) { - System.err.println("WARNING: mismatched #ifdef/endif pairs"); - return; - } - enabledBits.remove(enabledBits.size() - 1); - --debugPrintIndentLevel; - //debugPrint(false, "POP_ENABLED, NOW: " + enabled()); - } - - private boolean enabled() { - return (enabledBits.size() == 0 || - ((Boolean) enabledBits.get(enabledBits.size() - 1)).booleanValue()); - } - - private void print(String s) { - if (enabled()) { - writer.print(s); - //System.out.print(s);//debug - } - } - - private void print(char c) { - if (enabled()) { - writer.print(c); - //System.err.print(c); //debug - } - } - - private void println() { - if (enabled()) { - writer.println(); - //System.err.println();//debug - } - } - - private void printToken() { - print(curTokenAsString()); - } - - private void flush() { - if (enabled()) { - writer.flush(); - //System.err.flush(); //debug - } - } - - private void lineDirective() { - print("#line " + lineNumber() + " \"" + filename() + "\""); - println(); - } -} diff --git a/src/net/java/games/gluegen/runtime/BufferFactory.java b/src/net/java/games/gluegen/runtime/BufferFactory.java deleted file mode 100644 index 1661026dc..000000000 --- a/src/net/java/games/gluegen/runtime/BufferFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.runtime; - -import java.nio.*; - -public class BufferFactory { - public static ByteBuffer newDirectByteBuffer(int size) { - ByteBuffer buf = ByteBuffer.allocateDirect(size); - buf.order(ByteOrder.nativeOrder()); - return buf; - } - - /** Helper routine to tell whether a buffer is direct or not. Null - pointers are considered direct. isDirect() should really be - public in Buffer and not replicated in all subclasses. */ - public static boolean isDirect(Buffer buf) { - if (buf == null) { - return true; - } - if (buf instanceof ByteBuffer) { - return ((ByteBuffer) buf).isDirect(); - } else if (buf instanceof FloatBuffer) { - return ((FloatBuffer) buf).isDirect(); - } else if (buf instanceof DoubleBuffer) { - return ((DoubleBuffer) buf).isDirect(); - } else if (buf instanceof CharBuffer) { - return ((CharBuffer) buf).isDirect(); - } else if (buf instanceof ShortBuffer) { - return ((ShortBuffer) buf).isDirect(); - } else if (buf instanceof IntBuffer) { - return ((IntBuffer) buf).isDirect(); - } else if (buf instanceof LongBuffer) { - return ((LongBuffer) buf).isDirect(); - } - throw new RuntimeException("Unknown buffer type " + buf.getClass().getName()); - } -} diff --git a/src/net/java/games/gluegen/runtime/ProcAddressHelper.java b/src/net/java/games/gluegen/runtime/ProcAddressHelper.java deleted file mode 100644 index f98ae0c2b..000000000 --- a/src/net/java/games/gluegen/runtime/ProcAddressHelper.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.runtime; - -/** Contains constants used in glue code generation. */ - -public class ProcAddressHelper { - public static final String PROCADDRESS_VAR_PREFIX = "_addressof_"; -} diff --git a/src/net/java/games/gluegen/runtime/StructAccessor.java b/src/net/java/games/gluegen/runtime/StructAccessor.java deleted file mode 100644 index 581eb7202..000000000 --- a/src/net/java/games/gluegen/runtime/StructAccessor.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.gluegen.runtime; - -import java.nio.*; - -public class StructAccessor { - private ByteBuffer bb; - private CharBuffer cb; - private DoubleBuffer db; - private FloatBuffer fb; - private IntBuffer ib; - private LongBuffer lb; - private ShortBuffer sb; - - public StructAccessor(ByteBuffer bb) { - // Setting of byte order is concession to native code which needs - // to instantiate these - this.bb = bb.order(ByteOrder.nativeOrder()); - } - - public ByteBuffer getBuffer() { - return bb; - } - - /** Return a slice of the current ByteBuffer starting at the - specified byte offset and extending the specified number of - bytes. Note that this method is not thread-safe with respect to - the other methods in this class. */ - public ByteBuffer slice(int byteOffset, int byteLength) { - bb.position(byteOffset); - bb.limit(byteOffset + byteLength); - ByteBuffer newBuf = bb.slice(); - bb.position(0); - bb.limit(bb.capacity()); - return newBuf; - } - - /** Retrieves the byte at the specified slot (byte offset). */ - public byte getByteAt(int slot) { - return bb.get(slot); - } - - /** Puts a byte at the specified slot (byte offset). */ - public void setByteAt(int slot, byte v) { - bb.put(slot, v); - } - - /** Retrieves the char at the specified slot (2-byte offset). */ - public char getCharAt(int slot) { - return charBuffer().get(slot); - } - - /** Puts a char at the specified slot (2-byte offset). */ - public void setCharAt(int slot, char v) { - charBuffer().put(slot, v); - } - - /** Retrieves the double at the specified slot (8-byte offset). */ - public double getDoubleAt(int slot) { - return doubleBuffer().get(slot); - } - - /** Puts a double at the specified slot (8-byte offset). */ - public void setDoubleAt(int slot, double v) { - doubleBuffer().put(slot, v); - } - - /** Retrieves the float at the specified slot (4-byte offset). */ - public float getFloatAt(int slot) { - return floatBuffer().get(slot); - } - - /** Puts a float at the specified slot (4-byte offset). */ - public void setFloatAt(int slot, float v) { - floatBuffer().put(slot, v); - } - - /** Retrieves the int at the specified slot (4-byte offset). */ - public int getIntAt(int slot) { - return intBuffer().get(slot); - } - - /** Puts a int at the specified slot (4-byte offset). */ - public void setIntAt(int slot, int v) { - intBuffer().put(slot, v); - } - - /** Retrieves the long at the specified slot (8-byte offset). */ - public long getLongAt(int slot) { - return longBuffer().get(slot); - } - - /** Puts a long at the specified slot (8-byte offset). */ - public void setLongAt(int slot, long v) { - longBuffer().put(slot, v); - } - - /** Retrieves the short at the specified slot (2-byte offset). */ - public short getShortAt(int slot) { - return shortBuffer().get(slot); - } - - /** Puts a short at the specified slot (2-byte offset). */ - public void setShortAt(int slot, short v) { - shortBuffer().put(slot, v); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private CharBuffer charBuffer() { - if (cb == null) { - cb = bb.asCharBuffer(); - } - return cb; - } - - private DoubleBuffer doubleBuffer() { - if (db == null) { - db = bb.asDoubleBuffer(); - } - return db; - } - - private FloatBuffer floatBuffer() { - if (fb == null) { - fb = bb.asFloatBuffer(); - } - return fb; - } - - private IntBuffer intBuffer() { - if (ib == null) { - ib = bb.asIntBuffer(); - } - return ib; - } - - private LongBuffer longBuffer() { - if (lb == null) { - lb = bb.asLongBuffer(); - } - return lb; - } - - private ShortBuffer shortBuffer() { - if (sb == null) { - sb = bb.asShortBuffer(); - } - return sb; - } -} diff --git a/src/net/java/games/jogl/Animator.java b/src/net/java/games/jogl/Animator.java deleted file mode 100644 index ebb6d9aed..000000000 --- a/src/net/java/games/jogl/Animator.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.awt.EventQueue; -import net.java.games.jogl.impl.SingleThreadedWorkaround; - -/**

An Animator can be attached to a GLDrawable to drive its - display() method in a loop. For efficiency, it sets up the - rendering thread for the drawable to be its own internal thread, - so it can not be combined with manual repaints of the - surface.

- -

The Animator currently contains a workaround for a bug in - NVidia's drivers (80174). The current semantics are that once an - Animator is created with a given GLDrawable as a target, repaints - will likely be suspended for that GLDrawable until the Animator is - started. This prevents multithreaded access to the context (which - can be problematic) when the application's intent is for - single-threaded access within the Animator. It is not guaranteed - that repaints will be prevented during this time and applications - should not rely on this behavior for correctness.

-*/ - -public class Animator { - private GLDrawable drawable; - private Runnable runnable; - private Thread thread; - private boolean shouldStop; - - /** Creates a new Animator for a particular drawable. */ - public Animator(GLDrawable drawable) { - this.drawable = drawable; - - // Workaround for NVidia driver bug 80174 - if (drawable instanceof GLCanvas) { - ((GLCanvas) drawable).willSetRenderingThread(); - } - } - - /** Starts this animator. */ - public synchronized void start() { - if (thread != null) { - throw new GLException("Already started"); - } - if (runnable == null) { - runnable = new Runnable() { - public void run() { - boolean noException = false; - try { - // Try to get OpenGL context optimization since we know we - // will be rendering this one drawable continually from - // this thread; make the context current once instead of - // making it current and freeing it each frame. - drawable.setRenderingThread(Thread.currentThread()); - - // Since setRenderingThread is currently advisory (because - // of the poor JAWT implementation in the Motif AWT, which - // performs excessive locking) we also prevent repaint(), - // which is called from the AWT thread, from having an - // effect for better multithreading behavior. This call is - // not strictly necessary, but if end users write their - // own animation loops which update multiple drawables per - // tick then it may be necessary to enforce the order of - // updates. - drawable.setNoAutoRedrawMode(true); - - while (!shouldStop) { - noException = false; - drawable.display(); - noException = true; - } - } finally { - shouldStop = false; - drawable.setNoAutoRedrawMode(false); - try { - // The surface is already unlocked and rendering - // thread is already null if an exception occurred - // during display(), so don't disable the rendering - // thread again. - if (noException) { - // Destruction of the underlying GLContext may have - // disabled the setRenderingThread optimization out - // from under us - if (drawable.getRenderingThread() != null) { - drawable.setRenderingThread(null); - } - } - } finally { - synchronized (Animator.this) { - thread = null; - Animator.this.notify(); - } - } - } - } - }; - } - thread = new Thread(runnable); - thread.start(); - } - - /** Stops this animator, blocking until the animation thread has - finished. */ - public synchronized void stop() { - shouldStop = true; - // It's hard to tell whether the thread which calls stop() has - // dependencies on the Animator's internal thread. Currently we - // use a couple of heuristics to determine whether we should do - // the blocking wait(). - if ((Thread.currentThread() == thread) || EventQueue.isDispatchThread()) { - return; - } - while (shouldStop && thread != null) { - try { - wait(); - } catch (InterruptedException ie) { - } - } - } -} diff --git a/src/net/java/games/jogl/ComponentEvents.java b/src/net/java/games/jogl/ComponentEvents.java deleted file mode 100644 index e21441aeb..000000000 --- a/src/net/java/games/jogl/ComponentEvents.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.awt.event.*; -import java.beans.PropertyChangeListener; - -/** Factors out the listener manipulation for the events supported by - all of the {@link GLDrawable} implementations. Provided to reduce - clutter in the documentation for GLDrawable. */ - -public interface ComponentEvents { - public void addComponentListener(ComponentListener l); - public void removeComponentListener(ComponentListener l); - public void addFocusListener(FocusListener l); - public void removeFocusListener(FocusListener l); - public void addHierarchyBoundsListener(HierarchyBoundsListener l); - public void removeHierarchyBoundsListener(HierarchyBoundsListener l); - public void addHierarchyListener(HierarchyListener l); - public void removeHierarchyListener(HierarchyListener l); - public void addInputMethodListener(InputMethodListener l); - public void removeInputMethodListener(InputMethodListener l); - public void addKeyListener(KeyListener l); - public void removeKeyListener(KeyListener l); - public void addMouseListener(MouseListener l); - public void removeMouseListener(MouseListener l); - public void addMouseMotionListener(MouseMotionListener l); - public void removeMouseMotionListener(MouseMotionListener l); - public void addMouseWheelListener(MouseWheelListener l); - public void removeMouseWheelListener(MouseWheelListener l); - public void addPropertyChangeListener(PropertyChangeListener listener); - public void removePropertyChangeListener(PropertyChangeListener listener); - public void addPropertyChangeListener(String propertyName, - PropertyChangeListener listener); - public void removePropertyChangeListener(String propertyName, - PropertyChangeListener listener); -} diff --git a/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java b/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java deleted file mode 100644 index 119007617..000000000 --- a/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import net.java.games.jogl.impl.Debug; - -/**

The default implementation of the {@link - GLCapabilitiesChooser} interface, which provides consistent visual - selection behavior across platforms. The precise algorithm is - deliberately left loosely specified. Some properties are:

- -
    - -
  • As long as there is at least one available non-null - GLCapabilities which matches the "stereo" option, will return a - valid index. - -
  • Attempts to match as closely as possible the given - GLCapabilities, but will select one with fewer capabilities (i.e., - lower color depth) if necessary. - -
  • Prefers hardware-accelerated visuals to - non-hardware-accelerated. - -
  • If there is no exact match, prefers a more-capable visual to - a less-capable one. - -
  • If there is more than one exact match, chooses an arbitrary - one. - -
  • May select the opposite of a double- or single-buffered - visual (based on the user's request) in dire situations. - -
  • Color depth (including alpha) mismatches are weighted higher - than depth buffer mismatches, which are in turn weighted higher - than accumulation buffer (including alpha) and stencil buffer - depth mismatches. - -
  • If a valid windowSystemRecommendedChoice parameter is - supplied, chooses that instead of using the cross-platform code. - -
-*/ - -public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { - private static final boolean DEBUG = Debug.debug("DefaultGLCapabilitiesChooser"); - - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, - int windowSystemRecommendedChoice) { - if (DEBUG) { - for (int i = 0; i < available.length; i++) { - System.err.println("Available " + i + ": " + available[i]); - } - } - - if (windowSystemRecommendedChoice >= 0 && - windowSystemRecommendedChoice < available.length && - available[windowSystemRecommendedChoice] != null) { - if (DEBUG) { - System.err.println("Choosing window system's recommended choice of " + windowSystemRecommendedChoice); - System.err.println(available[windowSystemRecommendedChoice]); - } - return windowSystemRecommendedChoice; - } - - // Create score array - int[] scores = new int[available.length]; - int NO_SCORE = -9999999; - int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; - int STENCIL_MISMATCH_PENALTY = 500; - // Pseudo attempt to keep equal rank penalties scale-equivalent - // (e.g., stencil mismatch is 3 * accum because there are 3 accum - // components) - int COLOR_MISMATCH_PENALTY_SCALE = 36; - int DEPTH_MISMATCH_PENALTY_SCALE = 6; - int ACCUM_MISMATCH_PENALTY_SCALE = 1; - int STENCIL_MISMATCH_PENALTY_SCALE = 3; - for (int i = 0; i < scores.length; i++) { - scores[i] = NO_SCORE; - } - // Compute score for each - for (int i = 0; i < scores.length; i++) { - GLCapabilities cur = available[i]; - if (cur == null) { - continue; - } - if (desired.getStereo() != cur.getStereo()) { - continue; - } - int score = 0; - // Compute difference in color depth - // (Note that this decides the direction of all other penalties) - score += (COLOR_MISMATCH_PENALTY_SCALE * - ((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) - - (desired.getRedBits() + desired.getGreenBits() + desired.getBlueBits() + desired.getAlphaBits()))); - // Compute difference in depth buffer depth - score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * - Math.abs(cur.getDepthBits() - desired.getDepthBits())); - // Compute difference in accumulation buffer depth - score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) * - Math.abs((cur.getAccumRedBits() + cur.getAccumGreenBits() + cur.getAccumBlueBits() + cur.getAccumAlphaBits()) - - (desired.getAccumRedBits() + desired.getAccumGreenBits() + desired.getAccumBlueBits() + desired.getAccumAlphaBits()))); - // Compute difference in stencil bits - score += STENCIL_MISMATCH_PENALTY_SCALE * sign(score) * (cur.getStencilBits() - desired.getStencilBits()); - if (cur.getDoubleBuffered() != desired.getDoubleBuffered()) { - score += sign(score) * DOUBLE_BUFFER_MISMATCH_PENALTY; - } - if ((desired.getStencilBits() > 0) && (cur.getStencilBits() == 0)) { - score += sign(score) * STENCIL_MISMATCH_PENALTY; - } - scores[i] = score; - } - // Now prefer hardware-accelerated visuals by pushing scores of - // non-hardware-accelerated visuals out - boolean gotHW = false; - int maxAbsoluteHWScore = 0; - for (int i = 0; i < scores.length; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - GLCapabilities cur = available[i]; - if (cur.getHardwareAccelerated()) { - int absScore = Math.abs(score); - if (!gotHW || - (absScore > maxAbsoluteHWScore)) { - gotHW = true; - maxAbsoluteHWScore = absScore; - } - } - } - if (gotHW) { - for (int i = 0; i < scores.length; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - GLCapabilities cur = available[i]; - if (!cur.getHardwareAccelerated()) { - if (score <= 0) { - score -= maxAbsoluteHWScore; - } else if (score > 0) { - score += maxAbsoluteHWScore; - } - scores[i] = score; - } - } - } - - if (DEBUG) { - System.err.print("Scores: ["); - for (int i = 0; i < available.length; i++) { - if (i > 0) { - System.err.print(","); - } - System.err.print(" " + scores[i]); - } - System.err.println(" ]"); - } - - // Ready to select. Choose score closest to 0. - int scoreClosestToZero = NO_SCORE; - int chosenIndex = -1; - for (int i = 0; i < scores.length; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - // Don't substitute a positive score for a smaller negative score - if ((scoreClosestToZero == NO_SCORE) || - (Math.abs(score) < Math.abs(scoreClosestToZero) && - ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { - scoreClosestToZero = score; - chosenIndex = i; - } - } - if (chosenIndex < 0) { - throw new GLException("Unable to select one of the provided GLCapabilities"); - } - if (DEBUG) { - System.err.println("Chosen index: " + chosenIndex); - System.err.println("Chosen capabilities:"); - System.err.println(available[chosenIndex]); - } - - return chosenIndex; - } - - private static int sign(int score) { - if (score < 0) { - return -1; - } - return 1; - } -} diff --git a/src/net/java/games/jogl/GLCanvas.java b/src/net/java/games/jogl/GLCanvas.java deleted file mode 100644 index f73a006ae..000000000 --- a/src/net/java/games/jogl/GLCanvas.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.awt.Canvas; -import java.awt.EventQueue; -import java.awt.Graphics; -import java.awt.GraphicsConfiguration; -import net.java.games.jogl.impl.*; - -// FIXME: Subclasses need to call resetGLFunctionAvailability() on their -// context whenever the displayChanged() function is called on our -// GLEventListeners - -/** A heavyweight AWT component which provides OpenGL rendering - support. This is the primary implementation of {@link GLDrawable}; - {@link GLJPanel} is provided for compatibility with Swing user - interfaces when adding a heavyweight doesn't work either because - of Z-ordering or LayoutManager problems. This class can not be - instantiated directly; use {@link GLDrawableFactory} to construct - them. */ - -public final class GLCanvas extends Canvas implements GLDrawable { - - protected static final boolean DEBUG = Debug.debug("GLCanvas"); - - private GLDrawableHelper drawableHelper = new GLDrawableHelper(); - private GLContext context; - - GLCanvas(GraphicsConfiguration config, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLDrawable shareWith) { - super(config); - context = GLContextFactory.getFactory().createGLContext(this, capabilities, chooser, - GLContextHelper.getContext(shareWith)); - } - - public void display() { - maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction, - displayAction, - false); - } - - /** Overridden from Canvas; calls {@link #display}. Should not be - invoked by applications directly. */ - public void paint(Graphics g) { - if (!context.getNoAutoRedrawMode()) { - display(); - } - } - - /** Overridden from Canvas; used to indicate when it's safe to - create an OpenGL context for the component. */ - public void addNotify() { - super.addNotify(); - context.setRealized(); - if (DEBUG) { - System.err.println("GLCanvas.addNotify()"); - } - } - - /** Overridden from Canvas; used to indicate that it's no longer - safe to have an OpenGL context for the component. */ - public void removeNotify() { - context.destroy(); - super.removeNotify(); - if (DEBUG) { - System.err.println("GLCanvas.removeNotify()"); - } - } - - /** Overridden from Canvas; causes {@link GLDrawableHelper#reshape} - to be called on all registered {@link GLEventListener}s. Called - automatically by the AWT; should not be invoked by applications - directly. */ - public void reshape(int x, int y, int width, int height) { - super.reshape(x, y, width, height); - // Note: we ignore the given x and y within the parent component - // since we are drawing directly into this heavyweight component. - final int fx = 0; - final int fy = 0; - final int fwidth = width; - final int fheight = height; - final Runnable reshapeRunnable = new Runnable() { - public void run() { - getGL().glViewport(fx, fy, fwidth, fheight); - drawableHelper.reshape(GLCanvas.this, fx, fy, fwidth, fheight); - } - }; - final Runnable reshapeOnEDTRunnable = new Runnable() { - public void run() { - context.invokeGL(reshapeRunnable, true, initAction); - } - }; - maybeDoSingleThreadedWorkaround(reshapeOnEDTRunnable, reshapeRunnable, true); - } - - /** Overridden from Canvas to prevent Java2D's clearing of the - canvas from interfering with the OpenGL rendering. */ - public void update(Graphics g) { - paint(g); - } - - public void addGLEventListener(GLEventListener listener) { - drawableHelper.addGLEventListener(listener); - } - - public void removeGLEventListener(GLEventListener listener) { - drawableHelper.removeGLEventListener(listener); - } - - public GL getGL() { - return context.getGL(); - } - - public void setGL(GL gl) { - context.setGL(gl); - } - - public GLU getGLU() { - return context.getGLU(); - } - - public void setGLU(GLU glu) { - context.setGLU(glu); - } - - void willSetRenderingThread() { - context.willSetRenderingThread(); - } - - public void setRenderingThread(Thread currentThreadOrNull) throws GLException { - context.setRenderingThread(currentThreadOrNull, initAction); - } - - public Thread getRenderingThread() { - return context.getRenderingThread(); - } - - public void setNoAutoRedrawMode(boolean noAutoRedraw) { - context.setNoAutoRedrawMode(noAutoRedraw); - } - - public boolean getNoAutoRedrawMode() { - return context.getNoAutoRedrawMode(); - } - - public void setAutoSwapBufferMode(boolean onOrOff) { - context.setAutoSwapBufferMode(onOrOff); - } - - public boolean getAutoSwapBufferMode() { - return context.getAutoSwapBufferMode(); - } - - public void swapBuffers() { - maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction, false); - } - - public boolean canCreateOffscreenDrawable() { - return context.canCreatePbufferContext(); - } - - public GLPbuffer createOffscreenDrawable(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - return new GLPbufferImpl(context.createPbufferContext(capabilities, initialWidth, initialHeight)); - } - - GLContext getContext() { - return context; - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private void maybeDoSingleThreadedWorkaround(Runnable eventDispatchThreadAction, - Runnable invokeGLAction, - boolean isReshape) { - if (SingleThreadedWorkaround.doWorkaround() && !EventQueue.isDispatchThread()) { - try { - // Reshape events must not block on the event queue due to the - // possibility of deadlocks during initial component creation. - // This solution is not optimal, because it changes the - // semantics of reshape() to have some of the processing being - // done asynchronously, but at least it preserves the - // semantics of the single-threaded workaround. - if (!isReshape) { - EventQueue.invokeAndWait(eventDispatchThreadAction); - } else { - EventQueue.invokeLater(eventDispatchThreadAction); - } - } catch (Exception e) { - throw new GLException(e); - } - } else { - context.invokeGL(invokeGLAction, isReshape, initAction); - } - } - - class InitAction implements Runnable { - public void run() { - drawableHelper.init(GLCanvas.this); - } - } - private InitAction initAction = new InitAction(); - - class DisplayAction implements Runnable { - public void run() { - drawableHelper.display(GLCanvas.this); - } - } - private DisplayAction displayAction = new DisplayAction(); - - class SwapBuffersAction implements Runnable { - public void run() { - context.swapBuffers(); - } - } - private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); - - // Workaround for ATI driver bugs related to multithreading issues - // like simultaneous rendering via Animators to canvases that are - // being resized on the AWT event dispatch thread - class DisplayOnEventDispatchThreadAction implements Runnable { - public void run() { - context.invokeGL(displayAction, false, initAction); - } - } - private DisplayOnEventDispatchThreadAction displayOnEventDispatchThreadAction = - new DisplayOnEventDispatchThreadAction(); - class SwapBuffersOnEventDispatchThreadAction implements Runnable { - public void run() { - context.invokeGL(swapBuffersAction, false, initAction); - } - } - private SwapBuffersOnEventDispatchThreadAction swapBuffersOnEventDispatchThreadAction = - new SwapBuffersOnEventDispatchThreadAction(); -} diff --git a/src/net/java/games/jogl/GLCapabilities.java b/src/net/java/games/jogl/GLCapabilities.java deleted file mode 100644 index d645a71a6..000000000 --- a/src/net/java/games/jogl/GLCapabilities.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -/** Specifies a set of OpenGL capabilities that a rendering context - must support, such as color depth and whether stereo is enabled. - It currently contains the minimal number of routines which allow - configuration on all supported window systems. */ - -public class GLCapabilities implements Cloneable { - private boolean doubleBuffered = true; - private boolean stereo = false; - private boolean hardwareAccelerated = true; - private int depthBits = 24; - private int stencilBits = 0; - private int redBits = 8; - private int greenBits = 8; - private int blueBits = 8; - private int alphaBits = 0; - private int accumRedBits = 0; - private int accumGreenBits = 0; - private int accumBlueBits = 0; - private int accumAlphaBits = 0; - // Shift bits from PIXELFORMATDESCRIPTOR not present because they - // are unlikely to be supported on Windows anyway - - // Support for full-scene antialiasing (FSAA) - private boolean sampleBuffers = false; - private int numSamples = 2; - - // Bits for pbuffer creation - private boolean offscreenFloatingPointBuffers; - private boolean offscreenRenderToTexture; - private boolean offscreenRenderToTextureRectangle; - - /** Creates a GLCapabilities object. All attributes are in a default - state. - */ - public GLCapabilities() {} - - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - throw new GLException(e); - } - } - - /** Indicates whether double-buffering is enabled. */ - public boolean getDoubleBuffered() { - return doubleBuffered; - } - - /** Enables or disables double buffering. */ - public void setDoubleBuffered(boolean onOrOff) { - doubleBuffered = onOrOff; - } - - /** Indicates whether stereo is enabled. */ - public boolean getStereo() { - return stereo; - } - - /** Enables or disables stereo viewing. */ - public void setStereo(boolean onOrOff) { - stereo = onOrOff; - } - - /** Indicates whether hardware acceleration is enabled. */ - public boolean getHardwareAccelerated() { - return hardwareAccelerated; - } - - /** Enables or disables hardware acceleration. */ - public void setHardwareAccelerated(boolean onOrOff) { - hardwareAccelerated = onOrOff; - } - - /** Returns the number of bits requested for the depth buffer. */ - public int getDepthBits() { - return depthBits; - } - - /** Sets the number of bits requested for the depth buffer. */ - public void setDepthBits(int depthBits) { - this.depthBits = depthBits; - } - - /** Returns the number of bits requested for the stencil buffer. */ - public int getStencilBits() { - return stencilBits; - } - - /** Sets the number of bits requested for the stencil buffer. */ - public void setStencilBits(int stencilBits) { - this.stencilBits = stencilBits; - } - - /** Returns the number of bits requested for the color buffer's red - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public int getRedBits() { - return redBits; - } - - /** Sets the number of bits requested for the color buffer's red - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setRedBits(int redBits) { - this.redBits = redBits; - } - - /** Returns the number of bits requested for the color buffer's - green component. On some systems only the color depth, which is - the sum of the red, green, and blue bits, is considered. */ - public int getGreenBits() { - return greenBits; - } - - /** Sets the number of bits requested for the color buffer's green - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setGreenBits(int greenBits) { - this.greenBits = greenBits; - } - - /** Returns the number of bits requested for the color buffer's blue - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public int getBlueBits() { - return blueBits; - } - - /** Sets the number of bits requested for the color buffer's blue - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setBlueBits(int blueBits) { - this.blueBits = blueBits; - } - - /** Returns the number of bits requested for the color buffer's - alpha component. On some systems only the color depth, which is - the sum of the red, green, and blue bits, is considered. */ - public int getAlphaBits() { - return alphaBits; - } - - /** Sets the number of bits requested for the color buffer's alpha - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setAlphaBits(int alphaBits) { - this.alphaBits = alphaBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's red component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumRedBits() { - return accumRedBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - red component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumRedBits(int accumRedBits) { - this.accumRedBits = accumRedBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's green component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumGreenBits() { - return accumGreenBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - green component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumGreenBits(int accumGreenBits) { - this.accumGreenBits = accumGreenBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's blue component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumBlueBits() { - return accumBlueBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - blue component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumBlueBits(int accumBlueBits) { - this.accumBlueBits = accumBlueBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's alpha component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumAlphaBits() { - return accumAlphaBits; - } - - /** Sets number of bits requested for accumulation buffer's alpha - component. On some systems only the accumulation buffer depth, - which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumAlphaBits(int accumAlphaBits) { - this.accumAlphaBits = accumAlphaBits; - } - - /** Indicates whether sample buffers for full-scene antialiasing - (FSAA) should be allocated for this drawable. Defaults to - false. */ - public void setSampleBuffers(boolean onOrOff) { - sampleBuffers = onOrOff; - } - - /** Returns whether sample buffers for full-scene antialiasing - (FSAA) should be allocated for this drawable. Defaults to - false. */ - public boolean getSampleBuffers() { - return sampleBuffers; - } - - /** If sample buffers are enabled, indicates the number of buffers - to be allocated. Defaults to 2. */ - public void setNumSamples(int numSamples) { - this.numSamples = numSamples; - } - - /** Returns the number of sample buffers to be allocated if sample - buffers are enabled. Defaults to 2. */ - public int getNumSamples() { - return numSamples; - } - - /** For offscreen surfaces only (pbuffers), indicates whether - floating-point buffers should be used if available. Defaults to - false. */ - public void setOffscreenFloatingPointBuffers(boolean onOrOff) { - offscreenFloatingPointBuffers = onOrOff; - } - - /** For offscreen surfaces only (pbuffers), returns whether - floating-point buffers should be used if available. Defaults to - false. */ - public boolean getOffscreenFloatingPointBuffers() { - return offscreenFloatingPointBuffers; - } - - /** For offscreen surfaces only (pbuffers), indicates whether the - render-to-texture extension should be used if available. - Defaults to false. */ - public void setOffscreenRenderToTexture(boolean onOrOff) { - offscreenRenderToTexture = onOrOff; - } - - /** For offscreen surfaces only (pbuffers), returns whether the - render-to-texture extension should be used if available. - Defaults to false. */ - public boolean getOffscreenRenderToTexture() { - return offscreenRenderToTexture; - } - - /** For offscreen surfaces only (pbuffers), indicates whether the - render-to-texture-rectangle extension should be used if - available. Defaults to false. */ - public void setOffscreenRenderToTextureRectangle(boolean onOrOff) { - offscreenRenderToTextureRectangle = onOrOff; - } - - /** For offscreen surfaces only (pbuffers), returns whether the - render-to-texture extension should be used. Defaults to false. */ - public boolean getOffscreenRenderToTextureRectangle() { - return offscreenRenderToTextureRectangle; - } - - /** Returns a textual representation of this GLCapabilities - object. */ - public String toString() { - return ("GLCapabilities [" + - "DoubleBuffered: " + doubleBuffered + - ", Stereo: " + stereo + - ", HardwareAccelerated: " + hardwareAccelerated + - ", DepthBits: " + depthBits + - ", StencilBits: " + stencilBits + - ", Red: " + redBits + - ", Green: " + greenBits + - ", Blue: " + blueBits + - ", Alpha: " + alphaBits + - ", Red Accum: " + accumRedBits + - ", Green Accum: " + accumGreenBits + - ", Blue Accum: " + accumBlueBits + - ", Alpha Accum: " + accumAlphaBits + - " ]"); - } -} diff --git a/src/net/java/games/jogl/GLCapabilitiesChooser.java b/src/net/java/games/jogl/GLCapabilitiesChooser.java deleted file mode 100644 index 951dd52a1..000000000 --- a/src/net/java/games/jogl/GLCapabilitiesChooser.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -/** Provides a mechanism by which applications can customize the - window type selection for a given {@link GLCapabilities}. - Developers can implement this interface and pass an instance into - the appropriate method of {@link GLDrawableFactory}; the chooser - will be called during the OpenGL context creation process. */ - -public interface GLCapabilitiesChooser { - /** Chooses the index (0..available.length - 1) of the {@link - GLCapabilities} most closely matching the desired one from the - list of all supported. Some of the entries in the - available array may be null; the chooser must - ignore these. The windowSystemRecommendedChoice - parameter may be provided to the chooser by the underlying - window system; if this index is valid, it is recommended, but - not necessarily required, that the chooser select that entry. - -

Note: this method is called automatically by the - {@link GLDrawableFactory} when an instance of this class is - passed in to one of its factory methods. It should generally not - be invoked by users directly, unless it is desired to delegate - the choice to some other GLCapabilitiesChooser object. - */ - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, - int windowSystemRecommendedChoice); -} diff --git a/src/net/java/games/jogl/GLContextHelper.java b/src/net/java/games/jogl/GLContextHelper.java deleted file mode 100644 index f4878a723..000000000 --- a/src/net/java/games/jogl/GLContextHelper.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import net.java.games.jogl.impl.*; - -/** This package-private class helps extract a GLContext from a - GLDrawable. The getContext() method can not be placed in the - public API of GLDrawable without exposing the GLContext class to - the public API, which is not desired. */ - -class GLContextHelper { - static GLContext getContext(GLDrawable drawable) throws GLException { - if (drawable == null) { - return null; - } - - if (drawable instanceof GLCanvas) { - return ((GLCanvas) drawable).getContext(); - } else if (drawable instanceof GLJPanel) { - return ((GLJPanel) drawable).getContext(); - } else if (drawable instanceof GLPbufferImpl) { - return ((GLPbufferImpl) drawable).getContext(); - } else { - throw new GLException( - "Sharing of contexts and display lists not supported among user-defined GLDrawables " + - "(unknown drawable type " + drawable.getClass().getName() + ")" - ); - } - } -} diff --git a/src/net/java/games/jogl/GLDrawable.java b/src/net/java/games/jogl/GLDrawable.java deleted file mode 100644 index 9ca86ca79..000000000 --- a/src/net/java/games/jogl/GLDrawable.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.awt.Dimension; - -// FIXME: We need some way to tell when the device upon which the canvas is -// being displayed has changed (e.g., the user drags the canvas's parent -// window from one screen on multi-screen environment to another, when the -// user changes the display bit depth or screen resolution, etc). When this -// occurs, we need the canvas to reset the gl function pointer tables for the -// canvas, because the new device may have different capabilities (e.g., -// doesn't support as many opengl extensions) from the original device. This -// hook would also be useful in other GLDrawables (for example, offscreen -// buffers such as pbuffers, whose contents may or may not be invalidated when -// the display mode changes, depending on the vendor's GL implementation). -// -// Right now I'm not sure how hook into when this change occurs. There isn't -// any AWT event corresponding to a device change (as far as I can -// tell). We could constantly check the GraphicsConfiguration of the canvas's top-level -// parent to see if it has changed, but this would be very slow (we'd have to -// do it every time the context is made current). There has got to be a better -// solution, but I'm not sure what it is. - -// FIXME: Subclasses need to call resetGLFunctionAvailability() on their -// context whenever the displayChanged() function is called on our -// GLEventListeners - -/** Abstracts common functionality among the OpenGL components {@link - GLCanvas} and {@link GLJPanel}. */ - -public interface GLDrawable extends ComponentEvents { - /** Adds a {@link GLEventListener} to this drawable. If multiple - listeners are added to a given drawable, they are notified of - events in an arbitrary order. */ - public void addGLEventListener(GLEventListener listener); - - /** Removes a {@link GLEventListener} from this drawable. Note that - if this is done from within a particular drawable's {@link - GLEventListener} handler (reshape, display, etc.) that it is not - guaranteed that all other listeners will be evaluated properly - during this update cycle. */ - public void removeGLEventListener(GLEventListener listener); - - /** Sets the size of this GLDrawable. */ - public void setSize(int width, int height); - - /** Sets the size of this GLDrawable. */ - public void setSize(Dimension d); - - /** Returns the size of this GLDrawable as a newly-created Dimension - object. */ - public Dimension getSize(); - - /** Stores the size of this GLDrawable into the user-provided - Dimension object, returning that object. If the provided - Dimension is null a new one will be allocated and returned. */ - public Dimension getSize(Dimension d); - - /** Returns the {@link GL} pipeline object this GLDrawable uses. If - this method is called outside of the {@link GLEventListener}'s - callback methods (init, display, etc.) it may return null. Users - should not rely on the identity of the returned GL object; for - example, users should not maintain a hash table with the GL - object as the key. Additionally, the GL object should not be - cached in client code, but should be re-fetched from the - GLDrawable at the beginning of each call to init, display, - etc. */ - public GL getGL(); - - /** Sets the {@link GL} pipeline object this GLDrawable uses. This - should only be called from within the GLEventListener's callback - methods, and usually only from within the init() method, in - order to install a composable pipeline. See the JOGL demos for - examples. */ - public void setGL(GL gl); - - /** Returns the {@link GLU} pipeline object this GLDrawable uses. */ - public GLU getGLU(); - - /** Sets the {@link GLU} pipeline object this GLDrawable uses. */ - public void setGLU(GLU glu); - - /** Causes OpenGL rendering to be performed for this GLDrawable by - calling {@link GLEventListener#display} for all registered - {@link GLEventListener}s. Called automatically by the window - system toolkit upon receiving a repaint() request. When used in - conjunction with {@link - net.java.games.jogl.GLDrawable#setRenderingThread}, this routine - may be called manually by the application's main loop for higher - performance and better control over the rendering process. It is - legal to call another GLDrawable's display method from within - {@link GLEventListener#display}. */ - public void display(); - - /**

Changes this GLDrawable to allow OpenGL rendering only from - the supplied thread, which must either be the current thread or - null. Attempts by other threads to perform OpenGL operations - like rendering or resizing the window will be ignored as long as - the thread is set. Setting up the rendering thread is not - required but enables the system to perform additional - optimizations, in particular when the application requires - control over the rendering loop. Before exiting, - setRenderingThread(null) must be called or other - threads will be unable to perform OpenGL rendering to this - drawable. Throws {@link GLException} if the rendering thread for - this drawable has been set and attempts are made to set or clear - the rendering thread from another thread, or if the passed - thread is not equal to the current thread or null. Also throws - {@link GLException} if the current thread attempts to call - setRenderingThread on more than one drawable.

- -

NOTE: Currently this routine is only advisory, which - means that on some platforms the underlying optimizations are - disabled and setting the rendering thread has no effect. - Applications should not rely on setRenderingThread to prevent - rendering from other threads.

- - @throws GLException if the rendering thread for this drawable has - been set by another thread or if the passed thread is not equal - to the current thread or null - */ - public void setRenderingThread(Thread currentThreadOrNull) throws GLException; - - /** Returns the rendering thread for this drawable, or null if none - has been set. */ - public Thread getRenderingThread(); - - /** Disables automatic redraws of this drawable if possible. This is - provided as an overriding mechanism for applications which - perform animation on the drawable and for which the (currently - advisory) {@link #setRenderingThread} does not provide strict - enough guarantees. Its sole purpose is to avoid deadlocks that - are unfortunately all too easy to run into when both animating a - drawable from a given thread as well as having updates performed - by the AWT event thread (repaints, etc.). When it is enabled, - repaint requests driven by the AWT will not result in the OpenGL - event listeners' display methods being called from the AWT - thread, unless (as with GLJPanel) this is the only mechanism by - which repaints are done. The necessity of this API may be - rethought in a future release. Defaults to false. */ - public void setNoAutoRedrawMode(boolean noAutoRedraws); - - /** Returns whether automatic redraws are disabled for this - drawable. Defaults to false. */ - public boolean getNoAutoRedrawMode(); - - /** Enables or disables automatic buffer swapping for this drawable. - By default this property is set to true; when true, after all - GLEventListeners have been called for a display() event, the - front and back buffers are swapped, displaying the results of - the render. When disabled, the user is responsible for calling - {@link #swapBuffers} manually. */ - public void setAutoSwapBufferMode(boolean onOrOff); - - /** Indicates whether automatic buffer swapping is enabled for this - drawable. See {@link #setAutoSwapBufferMode}. */ - public boolean getAutoSwapBufferMode(); - - /** Swaps the front and back buffers of this drawable. When - automatic buffer swapping is enabled (as is the default), it is - not necessary to call this method and doing so may have - undefined results. */ - public void swapBuffers(); - - /** Indicates whether this drawable is capable of fabricating a - subordinate offscreen drawable for advanced rendering techniques - which require offscreen hardware-accelerated surfaces. Note that - this method is only guaranteed to return a correct result once - your GLEventListener's init() method has been called. */ - public boolean canCreateOffscreenDrawable(); - - /** Creates a subordinate offscreen drawable (pbuffer) for this - drawable. This routine should only be called if {@link - #canCreateOffscreenDrawable} returns true. The passed - capabilities are matched according to the platform-dependent - pbuffer format selection algorithm, which currently can not be - overridden. */ - public GLPbuffer createOffscreenDrawable(GLCapabilities capabilities, - int initialWidth, - int initialHeight); -} diff --git a/src/net/java/games/jogl/GLDrawableFactory.java b/src/net/java/games/jogl/GLDrawableFactory.java deleted file mode 100644 index 8204fde7d..000000000 --- a/src/net/java/games/jogl/GLDrawableFactory.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import net.java.games.jogl.impl.*; - -/**

Provides a virtual machine- and operating system-independent - mechanism for creating {@link net.java.games.jogl.GLCanvas} and {@link - net.java.games.jogl.GLJPanel} objects.

- -

The {@link net.java.games.jogl.GLCapabilities} objects passed in to the - various factory methods are used as a hint for the properties of - the returned drawable. The default capabilities selection - algorithm (equivalent to passing in a null {@link - GLCapabilitiesChooser}) is described in {@link - DefaultGLCapabilitiesChooser}. Sophisticated applications needing - to change the selection algorithm may pass in their own {@link - GLCapabilitiesChooser} which can select from the available pixel - formats.

- -

Because of the multithreaded nature of the Java platform's - window system toolkit, it is typically not possible to immediately - reject a given {@link GLCapabilities} as being unsupportable by - either returning null from the creation routines or - raising a {@link GLException}. The semantics of the rejection - process are (unfortunately) left unspecified for now. The current - implementation will cause a {@link GLException} to be raised - during the first repaint of the {@link GLCanvas} or {@link - GLJPanel} if the capabilities can not be met.

-*/ - -public class GLDrawableFactory { - private static GLDrawableFactory factory = new GLDrawableFactory(); - - private GLDrawableFactory() {} - - /** Returns the sole GLDrawableFactory instance. */ - public static GLDrawableFactory getFactory() { - return factory; - } - - /** Creates a {@link GLCanvas} on the default graphics device with - the specified capabilities using the default capabilities - selection algorithm. */ - public GLCanvas createGLCanvas(GLCapabilities capabilities) { - return createGLCanvas(capabilities, null, null); - } - - /** Creates a {@link GLCanvas} on the default graphics device with - the specified capabilities using the default capabilities - selection algorithm. The canvas will share textures and display - lists with the specified {@link GLDrawable}; the drawable must - either be null or have been fabricated from this factory or by - classes in this package. A null drawable indicates no - sharing. */ - public GLCanvas createGLCanvas(GLCapabilities capabilities, GLDrawable shareWith) { - return createGLCanvas(capabilities, null, shareWith); - } - - /** Creates a {@link GLCanvas} on the default graphics device with - the specified capabilities using the supplied capabilities - selection algorithm. A null chooser is equivalent to using the - {@link DefaultGLCapabilitiesChooser}. */ - public GLCanvas createGLCanvas(GLCapabilities capabilities, GLCapabilitiesChooser chooser) { - return createGLCanvas(capabilities, chooser, null); - } - - /** Creates a {@link GLCanvas} on the default graphics device with - the specified capabilities using the supplied capabilities - selection algorithm. A null chooser is equivalent to using the - {@link DefaultGLCapabilitiesChooser}. The canvas will share - textures and display lists with the specified {@link - GLDrawable}; the drawable must either be null or have been - fabricated from this factory or by classes in this package. A - null drawable indicates no sharing. */ - public GLCanvas createGLCanvas(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLDrawable shareWith) { - return createGLCanvas(capabilities, chooser, shareWith, null); - } - - /** Creates a {@link GLCanvas} on the specified graphics device with - the specified capabilities using the supplied capabilities - selection algorithm. A null chooser is equivalent to using the - {@link DefaultGLCapabilitiesChooser}. The canvas will share - textures and display lists with the specified {@link - GLDrawable}; the drawable must either be null or have been - fabricated from this factory or by classes in this package. A - null drawable indicates no sharing. A null GraphicsDevice is - equivalent to using that returned from - GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(). */ - public GLCanvas createGLCanvas(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLDrawable shareWith, - GraphicsDevice device) { - if (chooser == null) { - chooser = new DefaultGLCapabilitiesChooser(); - } - if (device == null) { - device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); - } - // The platform-specific GLContextFactory will only provide a - // non-null GraphicsConfiguration on platforms where this is - // necessary (currently only X11, as Windows allows the pixel - // format of the window to be set later and Mac OS X seems to - // handle this very differently than all other platforms). On - // other platforms this method returns null; it is the case (at - // least in the Sun AWT implementation) that this will result in - // equivalent behavior to calling the no-arg super() constructor - // for Canvas. - return new GLCanvas(GLContextFactory.getFactory(). - chooseGraphicsConfiguration(capabilities, chooser, device), - capabilities, - chooser, - shareWith); - } - - /** Creates a {@link GLJPanel} with the specified capabilities using - the default capabilities selection algorithm. */ - public GLJPanel createGLJPanel(GLCapabilities capabilities) { - return createGLJPanel(capabilities, null, null); - } - - /** Creates a {@link GLJPanel} with the specified capabilities using - the default capabilities selection algorithm. The panel will - share textures and display lists with the specified {@link - GLDrawable}; the drawable must either be null or have been - fabricated from this factory or by classes in this package. A - null drawable indicates no sharing. */ - public GLJPanel createGLJPanel(GLCapabilities capabilities, GLDrawable shareWith) { - return createGLJPanel(capabilities, null, shareWith); - } - - /** Creates a {@link GLJPanel} with the specified capabilities using - the supplied capabilities selection algorithm. A null chooser is - equivalent to using the {@link DefaultGLCapabilitiesChooser}. */ - public GLJPanel createGLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser) { - return createGLJPanel(capabilities, chooser, null); - } - - /** Creates a {@link GLJPanel} with the specified capabilities using - the supplied capabilities selection algorithm. A null chooser is - equivalent to using the {@link DefaultGLCapabilitiesChooser}. - The panel will share textures and display lists with the - specified {@link GLDrawable}; the drawable must either be null - or have been fabricated from this factory or by classes in this - package. A null drawable indicates no sharing. */ - public GLJPanel createGLJPanel(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLDrawable shareWith) { - if (chooser == null) { - chooser = new DefaultGLCapabilitiesChooser(); - } - return new GLJPanel(capabilities, chooser, shareWith); - } -} diff --git a/src/net/java/games/jogl/GLEventListener.java b/src/net/java/games/jogl/GLEventListener.java deleted file mode 100644 index 0f345e6c7..000000000 --- a/src/net/java/games/jogl/GLEventListener.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.util.EventListener; - -/** Declares events which client code can use to manage OpenGL - rendering into a {@link GLDrawable}. At the time any of these - methods is called, the drawable has made its associated OpenGL - context current, so it is valid to make OpenGL calls. */ - -public interface GLEventListener extends EventListener { - /** Called by the drawable immediately after the OpenGL context is - initialized. Can be used to perform one-time OpenGL - initialization such as setup of lights and display lists. Note - that this method may be called more than once if the underlying - OpenGL context for the GLDrawable is destroyed and recreated, - for example if a GLCanvas is removed from the widget hierarchy - and later added again. - */ - public void init(GLDrawable drawable); - - /** Called by the drawable to initiate OpenGL rendering by the - client. After all GLEventListeners have been notified of a - display event, the drawable will swap its buffers if necessary. - */ - public void display(GLDrawable drawable); - - /** Called by the drawable during the first repaint after the - component has been resized. The client can update the viewport - and view volume of the window appropriately, for example by a - call to {@link net.java.games.jogl.GL#glViewport}; note that for - convenience the component has already called glViewport(x, - y, width, height) when this method is called, so the - client may not have to do anything in this method. - */ - public void reshape(GLDrawable drawable, int x, int y, int width, int height); - - /** Called by the drawable when the display mode or the display device - associated with the GLDrawable has changed. The two boolean parameters - indicate the types of change(s) that have occurred. ( !!! CURRENTLY - UNIMPLEMENTED !!! ) -

- - An example of a display mode change is when the bit depth changes (e.g., - from 32-bit to 16-bit color) on monitor upon which the GLDrawable is - currently being displayed.

- - An example of a display device change is when the user drags the - window containing the GLDrawable from one monitor to another in a - multiple-monitor setup.

- - The reason that this function handles both types of changes (instead of - handling mode and device changes in separate methods) is so that - applications have the opportunity to respond to display changes the most - efficient manner. For example, the application may need make fewer - adjustments to compensate for a device change if it knows that the mode - on the new device is identical the previous mode. - */ - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged); -} diff --git a/src/net/java/games/jogl/GLException.java b/src/net/java/games/jogl/GLException.java deleted file mode 100644 index e814ecbc8..000000000 --- a/src/net/java/games/jogl/GLException.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -/** A generic exception for OpenGL errors used throughout the binding - as a substitute for {@link RuntimeException}. */ - -public class GLException extends RuntimeException { - /** Constructs a GLException object. */ - public GLException() { - super(); - } - - /** Constructs a GLException object with the specified detail - message. */ - public GLException(String message) { - super(message); - } - - /** Constructs a GLException object with the specified detail - message and root cause. */ - public GLException(String message, Throwable cause) { - super(message, cause); - } - - /** Constructs a GLException object with the specified root - cause. */ - public GLException(Throwable cause) { - super(cause); - } -} diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java deleted file mode 100644 index e9b58bdae..000000000 --- a/src/net/java/games/jogl/GLJPanel.java +++ /dev/null @@ -1,730 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl; - -import java.awt.Component; -import java.awt.EventQueue; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.GraphicsConfiguration; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import java.awt.image.DataBufferByte; -import java.awt.image.DataBufferInt; -import java.security.*; -import javax.swing.JComponent; -import javax.swing.JPanel; -import net.java.games.jogl.impl.*; - -// FIXME: Subclasses need to call resetGLFunctionAvailability() on their -// context whenever the displayChanged() function is called on their -// GLEventListeners - -/** A lightweight Swing component which provides OpenGL rendering - support. Provided for compatibility with Swing user interfaces - when adding a heavyweight doesn't work either because of - Z-ordering or LayoutManager problems. This component attempts to - use hardware-accelerated rendering via pbuffers and falls back on - to software rendering if problems occur. This class can not be - instantiated directly; use {@link GLDrawableFactory} to construct - them.

- - Note that because this component attempts to use pbuffers for - rendering, and because pbuffers can not be resized, somewhat - surprising behavior may occur during resize operations; the {@link - GLEventListener#init} method may be called multiple times as the - pbuffer is resized to be able to cover the size of the GLJPanel. - This behavior is correct, as the textures and display lists for - the GLJPanel will have been lost during the resize operation. The - application should attempt to make its GLEventListener.init() - methods as side-effect-free as possible. -*/ - -public final class GLJPanel extends JPanel implements GLDrawable { - protected static final boolean DEBUG = Debug.debug("GLJPanel"); - - private GLDrawableHelper drawableHelper = new GLDrawableHelper(); - private volatile boolean isInitialized; - - // Data used for either pbuffers or pixmap-based offscreen surfaces - private GLCapabilities offscreenCaps; - private GLCapabilitiesChooser chooser; - private GLDrawable shareWith; - // This image is exactly the correct size to render into the panel - private BufferedImage offscreenImage; - // One of these is used to store the read back pixels before storing - // in the BufferedImage - private byte[] readBackBytes; - private int[] readBackInts; - private int readBackWidthInPixels; - private int readBackHeightInPixels; - // Width of the actual GLJPanel - private int panelWidth = 0; - private int panelHeight = 0; - private Updater updater; - private int awtFormat; - private int glFormat; - private int glType; - - // Implementation using pbuffers - private static boolean hardwareAccelerationDisabled = - Debug.isPropertyDefined("jogl.gljpanel.nohw"); - private boolean pbufferInitializationCompleted; - private GLPbuffer pbuffer; - private int pbufferWidth = 256; - private int pbufferHeight = 256; - private GLCanvas heavyweight; - private Frame toplevel; - - // Implementation using software rendering - private GLContext offscreenContext; - - // For saving/restoring of OpenGL state during ReadPixels - private int[] swapbytes = new int[1]; - private int[] rowlength = new int[1]; - private int[] skiprows = new int[1]; - private int[] skippixels = new int[1]; - private int[] alignment = new int[1]; - - GLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLDrawable shareWith) { - super(); - - // Works around problems on many vendors' cards; we don't need a - // back buffer for the offscreen surface anyway - offscreenCaps = (GLCapabilities) capabilities.clone(); - offscreenCaps.setDoubleBuffered(false); - this.chooser = chooser; - this.shareWith = shareWith; - } - - public void display() { - if (!isInitialized) { - return; - } - - if (EventQueue.isDispatchThread()) { - // Want display() to be synchronous, so call paintImmediately() - paintImmediately(0, 0, getWidth(), getHeight()); - } else { - // Multithreaded redrawing of Swing components is not allowed, - // so do everything on the event dispatch thread - try { - EventQueue.invokeAndWait(paintImmediatelyAction); - } catch (Exception e) { - throw new GLException(e); - } - } - } - - /** Overridden from JComponent; calls {@link - GLEventListener#display}. Should not be invoked by applications - directly. */ - public void paintComponent(Graphics g) { - if (!isInitialized) { - return; - } - - updater.setGraphics(g); - if (!hardwareAccelerationDisabled) { - if (!pbufferInitializationCompleted) { - try { - heavyweight.display(); - pbuffer.display(); - } catch (GLException e) { - if (DEBUG) { - e.printStackTrace(); - } - // We consider any exception thrown during updating of the - // heavyweight or pbuffer during the initialization phases - // to be an indication that there was a problem - // instantiating the pbuffer, regardless of whether the - // exception originated in the user's GLEventListener. In - // these cases we immediately back off and use software - // rendering. - disableHardwareRendering(); - } - } else { - pbuffer.display(); - } - } else { - offscreenContext.invokeGL(displayAction, false, initAction); - } - } - - public void addNotify() { - super.addNotify(); - initialize(); - if (DEBUG) { - System.err.println("GLJPanel.addNotify()"); - } - } - - /** Overridden from JPanel; used to indicate that it's no longer - safe to have an OpenGL context for the component. */ - public void removeNotify() { - if (DEBUG) { - System.err.println("GLJPanel.removeNotify()"); - } - if (!hardwareAccelerationDisabled) { - if (pbuffer != null) { - pbuffer.destroy(); - } - if (toplevel != null) { - toplevel.dispose(); - } - pbuffer = null; - heavyweight = null; - toplevel = null; - } else { - offscreenContext.destroy(); - } - isInitialized = false; - super.removeNotify(); - } - - /** Overridden from Canvas; causes {@link GLDrawableHelper#reshape} - to be called on all registered {@link GLEventListener}s. Called - automatically by the AWT; should not be invoked by applications - directly. */ - public void reshape(int x, int y, int width, int height) { - super.reshape(x, y, width, height); - - if (!isInitialized) { - return; - } - - // Move all reshape requests onto AWT EventQueue thread - final int fx = x; - final int fy = y; - final int fwidth = width; - final int fheight = height; - - Runnable r = new Runnable() { - public void run() { - GLContext context = null; - readBackWidthInPixels = 0; - readBackHeightInPixels = 0; - - if (!hardwareAccelerationDisabled) { - // Use factor larger than 2 during shrinks for some hysteresis - float shrinkFactor = 2.5f; - if ((fwidth > pbufferWidth ) || (fheight > pbufferHeight) || - (fwidth < (pbufferWidth / shrinkFactor)) || (fheight < (pbufferWidth / shrinkFactor))) { - if (DEBUG) { - System.err.println("Resizing pbuffer from (" + pbufferWidth + ", " + pbufferHeight + ") " + - " to fit (" + fwidth + ", " + fheight + ")"); - } - // Must destroy and recreate pbuffer to fit - if (pbuffer != null) { - pbuffer.destroy(); - } - if (toplevel != null) { - toplevel.dispose(); - } - pbuffer = null; - isInitialized = false; - pbufferWidth = getNextPowerOf2(fwidth); - pbufferHeight = getNextPowerOf2(fheight); - if (DEBUG) { - System.err.println("New pbuffer size is (" + pbufferWidth + ", " + pbufferHeight + ")"); - } - initialize(); - } - GLPbufferImpl pbufferImpl = (GLPbufferImpl) pbuffer; - context = pbufferImpl.getContext(); - // It looks like NVidia's drivers (at least the ones on my - // notebook) are buggy and don't allow a rectangle of less than - // the pbuffer's width to be read...this doesn't really matter - // because it's the Graphics.drawImage() calls that are the - // bottleneck. Should probably make the size of the offscreen - // image be the exact size of the pbuffer to save some work on - // resize operations... - readBackWidthInPixels = pbufferWidth; - readBackHeightInPixels = fheight; - } else { - offscreenContext.resizeOffscreenContext(fwidth, fheight); - context = offscreenContext; - readBackWidthInPixels = fwidth; - readBackHeightInPixels = fheight; - } - - if (offscreenImage != null) { - offscreenImage.flush(); - offscreenImage = null; - } - - panelWidth = fwidth; - panelHeight = fheight; - - context.invokeGL(new Runnable() { - public void run() { - getGL().glViewport(0, 0, panelWidth, panelHeight); - drawableHelper.reshape(GLJPanel.this, 0, 0, panelWidth, panelHeight); - } - }, true, initAction); - } - }; - if (EventQueue.isDispatchThread()) { - r.run(); - } else { - // Avoid blocking EventQueue thread due to possible deadlocks - // during component creation - EventQueue.invokeLater(r); - } - } - - public void setOpaque(boolean opaque) { - if (opaque != isOpaque()) { - if (offscreenImage != null) { - offscreenImage.flush(); - offscreenImage = null; - } - } - super.setOpaque(opaque); - } - - public void addGLEventListener(GLEventListener listener) { - drawableHelper.addGLEventListener(listener); - } - - public void removeGLEventListener(GLEventListener listener) { - drawableHelper.removeGLEventListener(listener); - } - - public GL getGL() { - if (!hardwareAccelerationDisabled) { - if (pbuffer == null) { - return null; - } - return pbuffer.getGL(); - } else { - if (offscreenContext == null) { - return null; - } - return offscreenContext.getGL(); - } - } - - public void setGL(GL gl) { - if (!hardwareAccelerationDisabled) { - if (pbuffer != null) { - pbuffer.setGL(gl); - } - } else { - if (offscreenContext != null) { - offscreenContext.setGL(gl); - } - } - } - - public GLU getGLU() { - if (!hardwareAccelerationDisabled) { - return pbuffer.getGLU(); - } else { - return offscreenContext.getGLU(); - } - } - - public void setGLU(GLU glu) { - if (!hardwareAccelerationDisabled) { - pbuffer.setGLU(glu); - } else { - offscreenContext.setGLU(glu); - } - } - - public void setRenderingThread(Thread currentThreadOrNull) throws GLException { - // Not supported for GLJPanel because all repaint requests must be - // handled by the AWT thread - } - - public Thread getRenderingThread() { - return null; - } - - public void setNoAutoRedrawMode(boolean noAutoRedraws) { - } - - public boolean getNoAutoRedrawMode() { - return false; - } - - public void setAutoSwapBufferMode(boolean onOrOff) { - if (!hardwareAccelerationDisabled) { - pbuffer.setAutoSwapBufferMode(onOrOff); - } else { - offscreenContext.setAutoSwapBufferMode(onOrOff); - } - } - - public boolean getAutoSwapBufferMode() { - if (!hardwareAccelerationDisabled) { - return pbuffer.getAutoSwapBufferMode(); - } else { - return offscreenContext.getAutoSwapBufferMode(); - } - } - - public void swapBuffers() { - if (!hardwareAccelerationDisabled) { - pbuffer.swapBuffers(); - } else { - offscreenContext.invokeGL(swapBuffersAction, false, initAction); - } - } - - public boolean canCreateOffscreenDrawable() { - // For now let's say no, although we could using the heavyweight - // if hardware acceleration is still enabled - return false; - } - - public GLPbuffer createOffscreenDrawable(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - GLContext getContext() { - if (!hardwareAccelerationDisabled) { - return ((GLPbufferImpl) pbuffer).getContext(); - } else { - return offscreenContext; - } - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private void disableHardwareRendering() { - if (Debug.verbose()) { - System.err.println("GLJPanel: Falling back on software rendering due to pbuffer problems"); - } - hardwareAccelerationDisabled = true; - pbufferInitializationCompleted = false; - EventQueue.invokeLater(new Runnable() { - public void run() { - toplevel.setVisible(false); - // Should dispose of this -- not sure about stability on - // various cards -- should test (FIXME) - // toplevel.dispose(); - } - }); - initialize(); - } - - private void initialize() { - // Initialize either the hardware-accelerated rendering path or - // the lightweight rendering path - if (!hardwareAccelerationDisabled) { - boolean firstTime = false; - if (heavyweight == null) { - // Make the heavyweight share with the "shareWith" parameter. - // The pbuffer shares textures and display lists with the - // heavyweight, so by transitivity the pbuffer will share with - // it as well. - heavyweight = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities(), shareWith); - firstTime = true; - } - if (heavyweight.canCreateOffscreenDrawable()) { - if (firstTime) { - toplevel = new Frame(); - toplevel.setUndecorated(true); - } - pbuffer = heavyweight.createOffscreenDrawable(offscreenCaps, pbufferWidth, pbufferHeight); - updater = new Updater(); - pbuffer.addGLEventListener(updater); - pbufferInitializationCompleted = false; - if (firstTime) { - toplevel.add(heavyweight); - toplevel.setSize(1, 1); - } - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - toplevel.setVisible(true); - } catch (GLException e) { - if (DEBUG) { - e.printStackTrace(); - } - disableHardwareRendering(); - } - } - }); - isInitialized = true; - return; - } else { - // If the heavyweight reports that it can't create an - // offscreen drawable (pbuffer), don't try again the next - // time, and fall through to the software rendering path - hardwareAccelerationDisabled = true; - } - } - - // Create an offscreen context instead - offscreenContext = GLContextFactory.getFactory().createGLContext(null, offscreenCaps, chooser, - GLContextHelper.getContext(shareWith)); - offscreenContext.resizeOffscreenContext(panelWidth, panelHeight); - updater = new Updater(); - if (panelWidth > 0 && panelHeight > 0) { - offscreenContext.invokeGL(new Runnable() { - public void run() { - getGL().glViewport(0, 0, panelWidth, panelHeight); - drawableHelper.reshape(GLJPanel.this, 0, 0, panelWidth, panelHeight); - } - }, true, initAction); - } - - isInitialized = true; - } - - class Updater implements GLEventListener { - private Graphics g; - - public void setGraphics(Graphics g) { - this.g = g; - } - - public void init(GLDrawable drawable) { - if (!hardwareAccelerationDisabled) { - if (DEBUG) { - System.err.println("GLJPanel$Updater.init(): pbufferInitializationCompleted = true"); - } - pbufferInitializationCompleted = true; - EventQueue.invokeLater(new Runnable() { - public void run() { - // Race conditions might dispose of this before now - if (toplevel != null) { - toplevel.setVisible(false); - } - } - }); - } - drawableHelper.init(GLJPanel.this); - } - - public void display(GLDrawable drawable) { - drawableHelper.display(GLJPanel.this); - - // Must now copy pixels from offscreen context into surface - if (offscreenImage == null) { - if (panelWidth > 0 && panelHeight > 0) { - // It looks like NVidia's drivers (at least the ones on my - // notebook) are buggy and don't allow a sub-rectangle to be - // read from a pbuffer...this doesn't really matter because - // it's the Graphics.drawImage() calls that are the - // bottleneck - - int awtFormat = 0; - int hwGLFormat = 0; - if (!hardwareAccelerationDisabled) { - // This seems to be a good choice on all platforms - hwGLFormat = GL.GL_UNSIGNED_INT_8_8_8_8_REV; - } - - // Should be more flexible in these BufferedImage formats; - // perhaps see what the preferred image types are on the - // given platform - if (isOpaque()) { - awtFormat = BufferedImage.TYPE_INT_RGB; - } else { - awtFormat = BufferedImage.TYPE_INT_ARGB; - } - - offscreenImage = new BufferedImage(panelWidth, - panelHeight, - awtFormat); - switch (awtFormat) { - case BufferedImage.TYPE_3BYTE_BGR: - glFormat = GL.GL_BGR; - glType = GL.GL_UNSIGNED_BYTE; - readBackBytes = new byte[readBackWidthInPixels * readBackHeightInPixels * 3]; - break; - - case BufferedImage.TYPE_INT_RGB: - case BufferedImage.TYPE_INT_ARGB: - glFormat = GL.GL_BGRA; - glType = (hardwareAccelerationDisabled - ? offscreenContext.getOffscreenContextPixelDataType() - : hwGLFormat); - readBackInts = new int[readBackWidthInPixels * readBackHeightInPixels]; - break; - - default: - // FIXME: Support more off-screen image types (current - // offscreen context implementations don't use others, and - // some of the OpenGL formats aren't supported in the 1.1 - // headers, which we're currently using) - throw new GLException("Unsupported offscreen image type " + awtFormat); - } - } - } - - if (offscreenImage != null) { - GL gl = getGL(); - // Save current modes - gl.glGetIntegerv(GL.GL_PACK_SWAP_BYTES, swapbytes); - gl.glGetIntegerv(GL.GL_PACK_ROW_LENGTH, rowlength); - gl.glGetIntegerv(GL.GL_PACK_SKIP_ROWS, skiprows); - gl.glGetIntegerv(GL.GL_PACK_SKIP_PIXELS, skippixels); - gl.glGetIntegerv(GL.GL_PACK_ALIGNMENT, alignment); - - gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, GL.GL_FALSE); - gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, readBackWidthInPixels); - gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0); - gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0); - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); - - // Actually read the pixels. - gl.glReadBuffer(GL.GL_FRONT); - if (readBackBytes != null) { - gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackBytes); - } else if (readBackInts != null) { - gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackInts); - } - - // Restore saved modes. - gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, swapbytes[0]); - gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, rowlength[0]); - gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, skiprows[0]); - gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, skippixels[0]); - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, alignment[0]); - - if (readBackBytes != null || readBackInts != null) { - // Copy temporary data into raster of BufferedImage for faster - // blitting Note that we could avoid this copy in the cases - // where !offscreenContext.offscreenImageNeedsVerticalFlip(), - // but that's the software rendering path which is very slow - // anyway - Object src = null; - Object dest = null; - int srcIncr = 0; - int destIncr = 0; - - if (readBackBytes != null) { - src = readBackBytes; - dest = ((DataBufferByte) offscreenImage.getRaster().getDataBuffer()).getData(); - srcIncr = readBackWidthInPixels * 3; - destIncr = offscreenImage.getWidth() * 3; - } else { - src = readBackInts; - dest = ((DataBufferInt) offscreenImage.getRaster().getDataBuffer()).getData(); - srcIncr = readBackWidthInPixels; - destIncr = offscreenImage.getWidth(); - } - - if (!hardwareAccelerationDisabled || - offscreenContext.offscreenImageNeedsVerticalFlip()) { - int srcPos = 0; - int destPos = (offscreenImage.getHeight() - 1) * destIncr; - for (; destPos >= 0; srcPos += srcIncr, destPos -= destIncr) { - System.arraycopy(src, srcPos, dest, destPos, destIncr); - } - } else { - int srcPos = 0; - int destEnd = destIncr * offscreenImage.getHeight(); - for (int destPos = 0; destPos < destEnd; srcPos += srcIncr, destPos += destIncr) { - System.arraycopy(src, srcPos, dest, destPos, destIncr); - } - } - - // Draw resulting image in one shot - g.drawImage(offscreenImage, 0, 0, offscreenImage.getWidth(), offscreenImage.getHeight(), GLJPanel.this); - } - } - } - - public void reshape(GLDrawable drawable, int x, int y, int width, int height) { - // This is handled above and dispatched directly to the appropriate context - } - - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) { - } - } - - class InitAction implements Runnable { - public void run() { - updater.init(GLJPanel.this); - } - } - private InitAction initAction = new InitAction(); - - class DisplayAction implements Runnable { - public void run() { - updater.display(GLJPanel.this); - } - } - private DisplayAction displayAction = new DisplayAction(); - - // This one is used exclusively in the non-hardware-accelerated case - class SwapBuffersAction implements Runnable { - public void run() { - offscreenContext.swapBuffers(); - } - } - private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); - - class PaintImmediatelyAction implements Runnable { - public void run() { - paintImmediately(0, 0, getWidth(), getHeight()); - } - } - private PaintImmediatelyAction paintImmediatelyAction = new PaintImmediatelyAction(); - - private int getNextPowerOf2(int number) { - // Workaround for problems where 0 width or height are transiently - // seen during layout - if (number == 0) { - return 2; - } - - if (((number-1) & number) == 0) { - //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0 - return number; - } - int power = 0; - while (number > 0) { - number = number>>1; - power++; - } - return (1<GLUtesselator object is used to hold the data, such as the - * vertices, edges and callback objects, to describe and tessellate complex - * polygons. A GLUtesselator object is used with the - * {@link net.java.games.jogl.GLU GLU} tesselator methods and - * {@link net.java.games.jogl.GLUtesselatorCallback GLU callbacks}. - * - * @author Eric Veach, July 1994 - * @author Java Port: Pepijn Van Eechhoudt, July 2003 - * @author Java Port: Nathan Parker Burg, August 2003 - */ -public interface GLUtesselator {} diff --git a/src/net/java/games/jogl/GLUtesselatorCallback.java b/src/net/java/games/jogl/GLUtesselatorCallback.java deleted file mode 100644 index 0da9a15fd..000000000 --- a/src/net/java/games/jogl/GLUtesselatorCallback.java +++ /dev/null @@ -1,353 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl; - -/** - * GLUtesselatorCallback interface provides methods that the user will - * override to define the callbacks for a tessellation object. - * - * @author Eric Veach, July 1994 - * @author Java Port: Pepijn Van Eeckhoudt, July 2003 - * @author Java Port: Nathan Parker Burg, August 2003 - */ -public interface GLUtesselatorCallback { - /** - * The begin callback method is invoked like - * {@link net.java.games.jogl.GL#glBegin glBegin} to indicate the start of a - * (triangle) primitive. The method takes a single argument of type int. If - * the GLU_TESS_BOUNDARY_ONLY property is set to GL_FALSE, then - * the argument is set to either GL_TRIANGLE_FAN, - * GL_TRIANGLE_STRIP, or GL_TRIANGLES. If the - * GLU_TESS_BOUNDARY_ONLY property is set to GL_TRUE, then the - * argument will be set to GL_LINE_LOOP. - * - * @param type - * Specifics the type of begin/end pair being defined. The following - * values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, - * GL_TRIANGLES or GL_LINE_LOOP. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#end end - * @see net.java.games.jogl.GLUtesselatorCallback#begin begin - */ - public void begin(int type); - - /** - * The same as the {@link net.java.games.jogl.GLUtesselatorCallback#begin - * begin} callback method except that it takes an additional reference - * argument. This reference is identical to the opaque reference provided when - * {@link net.java.games.jogl.GLU#gluTessBeginPolygon gluTessBeginPolygon} was - * called. - * - * @param type - * Specifics the type of begin/end pair being defined. The following - * values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, - * GL_TRIANGLES or GL_LINE_LOOP. - * @param polygonData - * Specifics a reference to user-defined data. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#endData endData - * @see net.java.games.jogl.GLUtesselatorCallback#begin begin - */ - public void beginData(int type, Object polygonData); - - - /** - * The edgeFlag callback method is similar to - * {@link net.java.games.jogl.GL#glEdgeFlag glEdgeFlag}. The method takes - * a single boolean boundaryEdge that indicates which edges lie on the - * polygon boundary. If the boundaryEdge is GL_TRUE, then each vertex - * that follows begins an edge that lies on the polygon boundary, that is, - * an edge that separates an interior region from an exterior one. If the - * boundaryEdge is GL_FALSE, then each vertex that follows begins an - * edge that lies in the polygon interior. The edge flag callback (if - * defined) is invoked before the first vertex callback.

- * - * Since triangle fans and triangle strips do not support edge flags, the - * begin callback is not called with GL_TRIANGLE_FAN or - * GL_TRIANGLE_STRIP if a non-null edge flag callback is provided. - * (If the callback is initialized to null, there is no impact on - * performance). Instead, the fans and strips are converted to independent - * triangles. - * - * @param boundaryEdge - * Specifics which edges lie on the polygon boundary. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#edgeFlagData edgeFlagData - */ - public void edgeFlag(boolean boundaryEdge); - - - /** - * The same as the {@link net.java.games.jogl.GLUtesselatorCallback#edgeFlag - * edgeFlage} callback method except that it takes an additional reference - * argument. This reference is identical to the opaque reference provided when - * {@link net.java.games.jogl.GLU#gluTessBeginPolygon gluTessBeginPolygon} was - * called. - * - * @param boundaryEdge - * Specifics which edges lie on the polygon boundary. - * @param polygonData - * Specifics a reference to user-defined data. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#edgeFlag edgeFlag - */ - public void edgeFlagData(boolean boundaryEdge, Object polygonData); - - - /** - * The vertex callback method is invoked between the - * {@link net.java.games.jogl.GLUtesselatorCallback#begin begin} and - * {@link net.java.games.jogl.GLUtesselatorCallback#end end} callback methods. - * It is similar to {@link net.java.games.jogl.GL#glVertex3f glVertex3f}, and it - * defines the vertices of the triangles created by the tessellation process. - * The method takes a reference as its only argument. This reference is - * identical to the opaque reference provided by the user when the vertex was - * described (see {@link net.java.games.jogl.GLU#gluTessVertex - * gluTessVertex}). - * - * @param vertexData - * Specifics a reference to the vertices of the triangles created - * byt the tessellatin process. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#vertexData vertexData - */ - public void vertex(Object vertexData); - - - /** - * The same as the {@link net.java.games.jogl.GLUtesselatorCallback#vertex - * vertex} callback method except that it takes an additional reference - * argument. This reference is identical to the opaque reference provided when - * {@link net.java.games.jogl.GLU#gluTessBeginPolygon gluTessBeginPolygon} was - * called. - * - * @param vertexData - * Specifics a reference to the vertices of the triangles created - * byt the tessellatin process. - * @param polygonData - * Specifics a reference to user-defined data. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#vertex vertex - */ - public void vertexData(Object vertexData, Object polygonData); - - - /** - * The end callback serves the same purpose as - * {@link net.java.games.jogl.GL#glEnd glEnd}. It indicates the end of a - * primitive and it takes no arguments. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#begin begin - * @see net.java.games.jogl.GLUtesselatorCallback#endData endData - */ - public void end(); - - - /** - * The same as the {@link net.java.games.jogl.GLUtesselatorCallback#end end} - * callback method except that it takes an additional reference argument. This - * reference is identical to the opaque reference provided when - * {@link net.java.games.jogl.GLU#gluTessBeginPolygon gluTessBeginPolygon} was - * called. - * - * @param polygonData - * Specifics a reference to user-defined data. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#beginData beginData - * @see net.java.games.jogl.GLUtesselatorCallback#end end - */ - public void endData(Object polygonData); - - - /** - * The combine callback method is called to create a new vertex when - * the tessellation detects an intersection, or wishes to merge features. The - * method takes four arguments: an array of three elements each of type - * double, an array of four references, an array of four elements each of - * type float, and a reference to a reference.

- * - * The vertex is defined as a linear combination of up to four existing - * vertices, stored in data. The coefficients of the linear combination - * are given by weight; these weights always add up to 1. All vertex - * pointers are valid even when some of the weights are 0. coords gives - * the location of the new vertex.

- * - * The user must allocate another vertex, interpolate parameters using - * data and weight, and return the new vertex pointer in - * outData. This handle is supplied during rendering callbacks. The - * user is responsible for freeing the memory some time after - * {@link net.java.games.jogl.GLU#gluTessEndPolygon gluTessEndPolygon} is - * called.

- * - * For example, if the polygon lies in an arbitrary plane in 3-space, and a - * color is associated with each vertex, the GLU_TESS_COMBINE - * callback might look like this: - * - *

-   *         void myCombine(double[] coords, Object[] data,
-   *                        float[] weight, Object[] outData)
-   *         {
-   *            MyVertex newVertex = new MyVertex();
-   *
-   *            newVertex.x = coords[0];
-   *            newVertex.y = coords[1];
-   *            newVertex.z = coords[2];
-   *            newVertex.r = weight[0]*data[0].r +
-   *                          weight[1]*data[1].r +
-   *                          weight[2]*data[2].r +
-   *                          weight[3]*data[3].r;
-   *            newVertex.g = weight[0]*data[0].g +
-   *                          weight[1]*data[1].g +
-   *                          weight[2]*data[2].g +
-   *                          weight[3]*data[3].g;
-   *            newVertex.b = weight[0]*data[0].b +
-   *                          weight[1]*data[1].b +
-   *                          weight[2]*data[2].b +
-   *                          weight[3]*data[3].b;
-   *            newVertex.a = weight[0]*data[0].a +
-   *                          weight[1]*data[1].a +
-   *                          weight[2]*data[2].a +
-   *                          weight[3]*data[3].a;
-   *            outData = newVertex;
-   *         }
- * - * @param coords - * Specifics the location of the new vertex. - * @param data - * Specifics the vertices used to create the new vertex. - * @param weight - * Specifics the weights used to create the new vertex. - * @param outData - * Reference user the put the coodinates of the new vertex. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#combineData combineData - */ - public void combine(double[] coords, Object[] data, - float[] weight, Object[] outData); - - - /** - * The same as the {@link net.java.games.jogl.GLUtesselatorCallback#combine - * combine} callback method except that it takes an additional reference - * argument. This reference is identical to the opaque reference provided when - * {@link net.java.games.jogl.GLU#gluTessBeginPolygon gluTessBeginPolygon} was - * called. - * - * @param coords - * Specifics the location of the new vertex. - * @param data - * Specifics the vertices used to create the new vertex. - * @param weight - * Specifics the weights used to create the new vertex. - * @param outData - * Reference user the put the coodinates of the new vertex. - * @param polygonData - * Specifics a reference to user-defined data. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#combine combine - */ - public void combineData(double[] coords, Object[] data, - float[] weight, Object[] outData, - Object polygonData); - - - /** - * The error callback method is called when an error is encountered. - * The one argument is of type int; it indicates the specific error that - * occurred and will be set to one of GLU_TESS_MISSING_BEGIN_POLYGON, - * GLU_TESS_MISSING_END_POLYGON, GLU_TESS_MISSING_BEGIN_CONTOUR, - * GLU_TESS_MISSING_END_CONTOUR, GLU_TESS_COORD_TOO_LARGE, - * GLU_TESS_NEED_COMBINE_CALLBACK or GLU_OUT_OF_MEMORY. - * Character strings describing these errors can be retrieved with the - * {@link net.java.games.jogl.GLU#gluErrorString gluErrorString} call.

- * - * The GLU library will recover from the first four errors by inserting the - * missing call(s). GLU_TESS_COORD_TOO_LARGE indicates that some - * vertex coordinate exceeded the predefined constant - * GLU_TESS_MAX_COORD in absolute value, and that the value has been - * clamped. (Coordinate values must be small enough so that two can be - * multiplied together without overflow.) - * GLU_TESS_NEED_COMBINE_CALLBACK indicates that the tessellation - * detected an intersection between two edges in the input data, and the - * GLU_TESS_COMBINE or GLU_TESS_COMBINE_DATA callback was not - * provided. No output is generated. GLU_OUT_OF_MEMORY indicates that - * there is not enough memory so no output is generated. - * - * @param errnum - * Specifics the error number code. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#errorData errorData - */ - public void error(int errnum); - - - /** - * The same as the {@link net.java.games.jogl.GLUtesselatorCallback#error - * error} callback method except that it takes an additional reference - * argument. This reference is identical to the opaque reference provided when - * {@link net.java.games.jogl.GLU#gluTessBeginPolygon gluTessBeginPolygon} was - * called. - * - * @param errnum - * Specifics the error number code. - * @param polygonData - * Specifics a reference to user-defined data. - * - * @see net.java.games.jogl.GLU#gluTessCallback gluTessCallback - * @see net.java.games.jogl.GLUtesselatorCallback#error error - */ - public void errorData(int errnum, Object polygonData); - - //void mesh(net.java.games.jogl.impl.tesselator.GLUmesh mesh); -} diff --git a/src/net/java/games/jogl/GLUtesselatorCallbackAdapter.java b/src/net/java/games/jogl/GLUtesselatorCallbackAdapter.java deleted file mode 100644 index 162eaec93..000000000 --- a/src/net/java/games/jogl/GLUtesselatorCallbackAdapter.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl; - -import net.java.games.jogl.GLUtesselatorCallback; - -/** - * The GLUtesselatorCallbackAdapter provides a default implementation of - * {@link net.java.games.jogl.GLUtesselatorCallback GLUtesselatorCallback} - * with empty callback methods. This class can be extended to provide user - * defined callback methods. - * - * @author Eric Veach, July 1994 - * @author Java Port: Pepijn Van Eechhoudt, July 2003 - * @author Java Port: Nathan Parker Burg, August 2003 - */ - -public class GLUtesselatorCallbackAdapter implements GLUtesselatorCallback { - public void begin(int type) {} - public void edgeFlag(boolean boundaryEdge) {} - public void vertex(Object vertexData) {} - public void end() {} -// public void mesh(net.java.games.jogl.impl.tesselator.GLUmesh mesh) {} - public void error(int errnum) {} - public void combine(double[] coords, Object[] data, - float[] weight, Object[] outData) {} - public void beginData(int type, Object polygonData) {} - public void edgeFlagData(boolean boundaryEdge, - Object polygonData) {} - public void vertexData(Object vertexData, Object polygonData) {} - public void endData(Object polygonData) {} - public void errorData(int errnum, Object polygonData) {} - public void combineData(double[] coords, Object[] data, - float[] weight, Object[] outData, - Object polygonData) {} -} diff --git a/src/net/java/games/jogl/Version.java b/src/net/java/games/jogl/Version.java deleted file mode 100644 index 7d28f7fc8..000000000 --- a/src/net/java/games/jogl/Version.java +++ /dev/null @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -package net.java.games.jogl; - -/** - * The version and build number of this implementation. - * Version numbers for a release are of the form: w.x.y[-a]-z, where: - *

    - *
  • - * w - the major version number of the release. This number should - * start at 1. Typically, a bump in the major version number - * signifies that the release breaks backwards compatibility - * with some older release. - *
  • - *
  • - * x - minor version number. This number starts at 0. A bump in - * the minor version number signifies a release that has significant - * new functionality. - *
  • - *
  • - * y - minor-minor version number number. This number starts at 0. A - * bump in the minor-minor version number signifies that new bug - * fixes have been added to the build. - *
  • - *
  • - * a - an optional build designator followed by a digit. Valid build - * designators are: - *
      - *
    • alpha
    • - *
    • beta
    • - *
    - *
  • - *
  • - * z - build number. This is used to specify the build number of the - * release. This is usually only important to people that use - * the daily build of a project. The format is the lower-case - * letter 'b' followed by a two digit number. - *
  • - *
- * - * For example, the following are all valid version strings: - *
    - *
  • 1.1.2-b02
  • - *
  • 1.3.5-alpha1-b19
  • - *
  • 4.7.1-beta3-b20
  • - *
- * - */ -public final class Version { - - /** - * Private constructor - no need for user to create - * an instance of this class. - */ - private Version() { - } - - /** - * Version string of this build. - */ - private static final String version = "1.1.1"; - - /** - * Returns the version string and build number of - * this implementation. See the class description - * for the version string format. - * - * @return The version string of this implementation. - */ - public static String getVersion() { - return version; - } -} diff --git a/src/net/java/games/jogl/impl/Debug.java b/src/net/java/games/jogl/impl/Debug.java deleted file mode 100755 index 164c5afbd..000000000 --- a/src/net/java/games/jogl/impl/Debug.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.security.*; -import net.java.games.jogl.Version; - -/** Helper routines for logging and debugging. */ - -public class Debug { - // Some common properties - private static boolean verbose; - private static boolean debugAll; - - static { - verbose = isPropertyDefined("jogl.verbose"); - debugAll = isPropertyDefined("jogl.debug"); - if (verbose) { - System.err.println("JOGL version " + Version.getVersion()); - } - } - - public static boolean getBooleanProperty(final String property) { - Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - boolean val = Boolean.getBoolean(property); - return (val ? Boolean.TRUE : Boolean.FALSE); - } - }); - return b.booleanValue(); - } - - public static boolean isPropertyDefined(final String property) { - Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String val = System.getProperty(property); - return (val != null ? Boolean.TRUE : Boolean.FALSE); - } - }); - return b.booleanValue(); - } - - public static boolean verbose() { - return verbose; - } - - public static boolean debugAll() { - return debugAll; - } - - public static boolean debug(String subcomponent) { - return debugAll() || isPropertyDefined("jogl.debug." + subcomponent); - } -} diff --git a/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java b/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java deleted file mode 100644 index be5e26067..000000000 --- a/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import net.java.games.jogl.*; -import java.util.*; -import java.awt.Canvas; -import java.awt.Graphics; -import java.awt.GraphicsConfiguration; -import java.lang.reflect.*; - -/** - * A utility object intended to be used by implementations to act as a cache - * of which OpenGL functions are currently available on both the host machine - * and display. - */ -public final class FunctionAvailabilityCache { - private static final boolean DEBUG = Debug.debug("FunctionAvailabilityCache"); - - FunctionAvailabilityCache(GLContext context) - { - this.context = context; - } - - /** - * Flush the cache. The cache will be rebuilt lazily as calls to {@link - * #isFunctionAvailable(String)} are received. - */ - public void flush() - { - availabilityCache.clear(); - availableExtensionCache.clear(); - } - - public boolean isFunctionAvailable(String glFunctionName) - { - if (DEBUG) { - System.err.println("!!! CHECKING FOR AVAILABILITY OF: "+ glFunctionName); - } - - Boolean available = (Boolean)availabilityCache.get(glFunctionName); - - if (available == null) // not in availabilityCache - { - if (isPartOfAvailableExtensions(glFunctionName) || - isPartOfGLCore(context.getGL().glGetString(GL.GL_VERSION), glFunctionName)) - { - available = Boolean.TRUE; - } - else - { - available = Boolean.FALSE; - } - - availabilityCache.put(glFunctionName, available); - } - - if (DEBUG) { - System.err.println("!!! AVAILABILITY OF "+ glFunctionName + ": " + available.booleanValue()); - } - - return available.booleanValue(); - } - - public boolean isExtensionAvailable(String glExtensionName) { - initAvailableExtensions(); - return availableExtensionCache.contains(glExtensionName); - } - - protected void initAvailableExtensions() { - // if hash is empty (meaning it was flushed), pre-cache it with the list - // of extensions that are in the GL_EXTENSIONS string - if (availableExtensionCache.isEmpty()) { - GL gl = context.getGL(); - if (DEBUG) { - System.err.println("!!! Pre-caching extension availability"); - } - String allAvailableExtensions = - gl.glGetString(GL.GL_EXTENSIONS) + " " + context.getPlatformExtensionsString(); - if (DEBUG) { - System.err.println("!!! Available extensions: " + allAvailableExtensions); - System.err.println("!!! GL vendor: " + gl.glGetString(GL.GL_VENDOR)); - } - StringTokenizer tok = new StringTokenizer(allAvailableExtensions); - while (tok.hasMoreTokens()) { - String availableExt = tok.nextToken().trim(); - availableExt = availableExt.intern(); - availableExtensionCache.add(availableExt); - if (DEBUG) { - System.err.println("!!! Available: " + availableExt); - } - } - - // put a dummy var in here so that the cache is no longer empty even if - // no extensions are in the GL_EXTENSIONS string - availableExtensionCache.add(""); - } - } - - protected boolean isPartOfAvailableExtensions(String glFunctionName) - { - initAvailableExtensions(); - - // First, find the extension to which the function corresponds - String extensionName = getExtensionCorrespondingToFunction(glFunctionName); - - // Now see if that extension is available - boolean extensionAvailable = availableExtensionCache.contains(extensionName); - - return extensionAvailable; - } - - /** - * Returns true if the given OpenGL function is part of the OpenGL core - * that corresponds to the give OpenGL version string. - * - * @param glVersionString must be of the form "X" or "X.Y" or "X.Y.Z", where - * X, Y, and Z are integers - * @exception GLException if the glFunctionName passed in is - * not the name of any known OpenGL extension function. - */ - public static boolean isPartOfGLCore(String glVersionString, String glFunctionName) - { - String funcCoreVersionString = - StaticGLInfo.getFunctionAssociation(glFunctionName); - - if (funcCoreVersionString == null) { - // No extension string was found in the glext.h/wglext.h/glxext.h - // headers when building the StaticGLInfo class. So either it's a new - // extension that's not in those headers, or it's not an opengl - // extension. Either way it's an illegal argument. - throw new GLException( - "Function \"" + glFunctionName + "\" does not " + - "correspond to any known OpenGL extension or core version."); - } - - Version actualVersion; - try - { - actualVersion = new Version(funcCoreVersionString); - } - catch (IllegalArgumentException e) - { - // funcCoreVersionString is not an OpenGL version identifier (i.e., not - // of the form GL_VERSION_XXX or X.Y). - // - // Since the association string returned from - // StaticGLInfo.getFunctionAssociation() was not null, this function - // must be an OpenGL extension function. - // - // Therefore this function can't be part of any OpenGL core. - return false; - } - - Version versionToCheck; - try - { - versionToCheck = new Version(glVersionString); - } - catch (IllegalArgumentException e) - { - // user did not supply a valid OpenGL version identifier - throw new IllegalArgumentException( - "Illegally formatted OpenGL version identifier: \"" + glVersionString + "\""); - } - - // See if the version number of glVersionString is less than or equal to - // the OpenGL specification number to which the given function actually - // belongs. - if (actualVersion.compareTo(versionToCheck) <= 0) - { - if (DEBUG) { - System.err.println( - glFunctionName + " is in core OpenGL " + glVersionString + - " because it is in OpenGL " + funcCoreVersionString); - } - return true; - } - - if (DEBUG) { - System.err.println( - glFunctionName + " is NOT a part of the OpenGL " + glVersionString + " core" + - "; it is part of OpenGL " + funcCoreVersionString); - } - - return false; - } - - /** Returns the extension name that corresponds to the given extension - * function. For example, it will return "GL_EXT_vertex_array" when the - * argument is "glNormalPointerEXT". - * - * Please see http://oss.sgi.com/projects/ogl-sample/registry/index.html for - * a list of extension names and the functions they expose. - */ - protected static String getExtensionCorrespondingToFunction(String glFunctionName) - { - // HACK: FIXME!!! return something I know is supported so I can test other - // functions. - return StaticGLInfo.getFunctionAssociation(glFunctionName); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private HashMap availabilityCache = new HashMap(50); - private HashSet availableExtensionCache = new HashSet(50); - private GLContext context; - - /** - * A class for storing and comparing revision version numbers. - */ - private static class Version implements Comparable - { - private int major, minor, sub; - public Version(int majorRev, int minorRev, int subMinorRev) - { - major = majorRev; - minor = minorRev; - sub = subMinorRev; - } - - /** - * @param versionString must be of the form "GL_VERSION_X" or - * "GL_VERSION_X_Y" or "GL_VERSION_X_Y_Z" or "X.Y", where X, Y, - * and Z are integers. - * - * @exception IllegalArgumentException if the argument is not a valid - * OpenGL version identifier - */ - public Version(String versionString) - { - try - { - if (versionString.startsWith("GL_VERSION_")) - { - StringTokenizer tok = new StringTokenizer(versionString, "_"); - - tok.nextToken(); // GL_ - tok.nextToken(); // VERSION_ - if (!tok.hasMoreTokens()) { major = 0; return; } - major = Integer.valueOf(tok.nextToken()).intValue(); - if (!tok.hasMoreTokens()) { minor = 0; return; } - minor = Integer.valueOf(tok.nextToken()).intValue(); - if (!tok.hasMoreTokens()) { sub = 0; return; } - sub = Integer.valueOf(tok.nextToken()).intValue(); - } - else - { - StringTokenizer tok = new StringTokenizer(versionString, ". "); - major = Integer.valueOf(tok.nextToken()).intValue(); - minor = Integer.valueOf(tok.nextToken()).intValue(); - } - } - catch (Exception e) - { - throw new IllegalArgumentException( - "Illegally formatted version identifier: \"" + versionString + "\""); - } - } - - public int compareTo(Object o) - { - Version vo = (Version)o; - if (major > vo.major) return 1; - else if (major < vo.major) return -1; - else if (minor > vo.minor) return 1; - else if (minor < vo.minor) return -1; - else if (sub > vo.sub) return 1; - else if (sub < vo.sub) return -1; - - return 0; // they are equal - } - - } // end class Version -} - diff --git a/src/net/java/games/jogl/impl/GLContext.java b/src/net/java/games/jogl/impl/GLContext.java deleted file mode 100644 index 41fa98c4b..000000000 --- a/src/net/java/games/jogl/impl/GLContext.java +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.awt.Component; -import net.java.games.jogl.*; -import net.java.games.gluegen.runtime.*; - -public abstract class GLContext { - protected static final boolean DEBUG = Debug.debug("GLContext"); - protected static final boolean VERBOSE = Debug.verbose(); - protected static final boolean NO_FREE = Debug.isPropertyDefined("jogl.GLContext.nofree"); - - static { - NativeLibLoader.load(); - } - - protected Component component; - - // Indicates whether the component (if an onscreen context) has been - // realized. Plausibly, before the component is realized the JAWT - // should return an error or NULL object from some of its - // operations; this appears to be the case on Win32 but is not true - // at least with Sun's current X11 implementation (1.4.x), which - // crashes with no other error reported if the DrawingSurfaceInfo is - // fetched from a locked DrawingSurface during the validation as a - // result of calling show() on the main thread. To work around this - // we prevent any JAWT or OpenGL operations from being done until - // addNotify() is called on the component. - protected boolean realized; - - protected GLCapabilities capabilities; - protected GLCapabilitiesChooser chooser; - protected GL gl; - protected static final GLUProcAddressTable gluProcAddressTable = new GLUProcAddressTable(); - protected static boolean haveResetGLUProcAddressTable; - protected GLU glu = new GLUImpl(gluProcAddressTable); - protected Thread renderingThread; - protected Runnable deferredReshapeAction; - // Support for OpenGL context destruction and recreation in the face - // of the setRenderingThread optimization, which makes the context - // permanently current on the animation thread. FIXME: should make - // this more uniform and general, possibly by implementing in terms - // of Runnables; however, necessary sequence of operations in - // invokeGL makes this tricky. - protected boolean deferredDestroy; - protected boolean deferredSetRealized; - - // Error checking for setRenderingThread to ensure that one thread - // doesn't attempt to call setRenderingThread on more than one - // drawable - protected static final ThreadLocal perThreadRenderingContext = new ThreadLocal(); - - // This is a workaround for a bug in NVidia's drivers where - // vertex_array_range is only safe for single-threaded use; a bug - // has been filed, ID 80174. When an Animator is created for a - // GLDrawable, the expectation is that the Animator will be started - // shortly and that the user doesn't want rendering to occur from - // the AWT thread. However, there is a small window between when the - // Animator is created and attached to the GLDrawable and when it's - // started (and sets the rendering thread) when repaint events can - // be issued by the AWT thread if the component is realized. To work - // around this problem, we currently specify in the Animator's API - // that between the time it's created and started no redraws will - // occur. - protected volatile boolean willSetRenderingThread; - - // Flag for disabling all repaint and resize processing on the AWT - // thread to avoid application-level deadlocks; only really used for - // GLCanvas - protected boolean noAutoRedraw; - - // Flag for enabling / disabling automatic swapping of the front and - // back buffers - protected boolean autoSwapBuffers = true; - - // Offscreen context handling. Offscreen contexts should handle - // these resize requests in makeCurrent and clear the - // pendingOffscreenResize flag. - protected boolean pendingOffscreenResize; - protected int pendingOffscreenWidth; - protected int pendingOffscreenHeight; - - // Cache of the functions that are available to be called at the current - // moment in time - protected FunctionAvailabilityCache functionAvailability; - - // Support for recursive makeCurrent() calls as well as calling - // other drawables' display() methods from within another one's - protected static final ThreadLocal perThreadContextStack = new ThreadLocal() { - protected synchronized Object initialValue() { - return new GLContextStack(); - } - }; - // This thread-local variable helps implement setRenderingThread()'s - // optimized context handling. When the bottommost invokeGL() on the - // execution stack finishes for the rendering thread for that - // context, we pop the context off the context stack but do not free - // it, instead storing it in this thread-local variable. This gives - // us enough information to recover the context stack state in - // subsequent invokeGL() calls. - protected static final ThreadLocal perThreadSavedCurrentContext = new ThreadLocal() { - protected synchronized Object initialValue() { - return new GLContextInitActionPair(null, null); - } - }; - - public GLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - this.component = component; - this.capabilities = (GLCapabilities) capabilities.clone(); - this.chooser = chooser; - setGL(createGL()); - functionAvailability = new FunctionAvailabilityCache(this); - if (shareWith != null) { - GLContextShareSet.registerSharing(this, shareWith); - } - } - - /** Runs the given runnable with this OpenGL context valid. */ - public synchronized void invokeGL(Runnable runnable, boolean isReshape, Runnable initAction) throws GLException { - // Could be more clever about not calling this every time, but - // Thread.currentThread() is very fast and this makes the logic simpler - Thread currentThread = Thread.currentThread(); - - // Defer JAWT and OpenGL operations until onscreen components are - // realized - if (!isRealized() || - willSetRenderingThread || - (renderingThread != null && - renderingThread != currentThread)) { - // Support for removeNotify()/addNotify() when the - // setRenderingThread optimization is in effect and before the - // animation thread gets a chance to handle either request - if (!isRealized() && deferredSetRealized) { - setRealized(); - deferredSetRealized = false; - } else { - if (isReshape) { - deferredReshapeAction = runnable; - } - return; - } - } - - if (isReshape && noAutoRedraw && !SingleThreadedWorkaround.doWorkaround()) { - // Don't process reshape requests on the AWT thread - deferredReshapeAction = runnable; - return; - } - - if (deferredDestroy) { - deferredDestroy = false; - if (renderingThread != null) { - // Need to disable the setRenderingThread optimization to free - // up the context - setRenderingThread(null, initAction); - } - destroy(); - return; - } - - // The goal of this code is to optimize OpenGL context handling as - // much as possible. In particular: - // - // - setRenderingThread() works by making the "bottommost" OpenGL - // context current once and not freeing it until the rendering - // thread has been unset. Note that subsequent pushes of other - // contexts will still necessarily cause them to be made current - // and freed. - // - // - If the same context is pushed on the per-thread context stack - // more than once back-to-back, the subsequent pushes will not - // actually cause a makeCurrent/free to occur. - // - // Complexities occur because setRenderingThread() can be called - // at any time. Currently we implement the rendering thread - // optimization by popping it off the OpenGL context stack and - // storing it in a thread-local variable. - - GLContextStack ctxStack = getPerThreadContextStack(); - GLContext savedPerThreadContext = getPerThreadSavedCurrentContext(); - Runnable savedPerThreadInitAction = getPerThreadSavedInitAction(); - setPerThreadSavedCurrentContext(null, null); - if (ctxStack.size() == 0 && - savedPerThreadContext != null) { - // The setRenderingThread optimization moved the current context - // into thread-local storage. Put it back on the context stack, - // because we might need to free it later. - ctxStack.push(savedPerThreadContext, savedPerThreadInitAction); - } - - GLContext curContext = ctxStack.peekContext(); - Runnable curInitAction = ctxStack.peekInitAction(); - boolean mustDoMakeCurrent = true; - - if (curContext == this) { - mustDoMakeCurrent = false; - } - - if (mustDoMakeCurrent) { - if (curContext != null) { - if (DEBUG && VERBOSE) { - System.err.println(getThreadName() + ": Freeing context " + curContext + " due to recursive makeCurrent"); - } - curContext.free(); - } - - if (!makeCurrent(initAction)) { - // Couldn't make the thread current because the component has not yet - // been visualized, and therefore the context cannot be created. - // We'll defer any actions until invokeGL() is called again at a time - // when the component has been visualized. - if (isReshape) { - deferredReshapeAction = runnable; - } - - // Clean up after ourselves on the way out. - // NOTE that this is an abbreviated version of the code below - // and should probably be refactored/cleaned up -- this bug - // fix was done without a lot of intense thought about the - // situation - if (curContext != null) { - curContext.makeCurrent(curInitAction); - } - return; - } - if (DEBUG && VERBOSE) { - System.err.println(getThreadName() + ": Making context " + this + " current"); - } - } - ctxStack.push(this, initAction); - - // At this point the OpenGL context is current. Offscreen contexts - // handle resizing the backing bitmap in makeCurrent. Therefore we - // may need to free and make the context current again if we - // didn't actually make it current above. - if (pendingOffscreenResize && renderingThread != null) { - ctxStack.pop(); - free(); - if (!makeCurrent(initAction)) { - throw new GLException("Error while resizing offscreen context"); - } - ctxStack.push(this, initAction); - } - - RuntimeException userException = null; - GLException internalException = null; - - try { - if (deferredReshapeAction != null) { - deferredReshapeAction.run(); - deferredReshapeAction = null; - } - runnable.run(); - if (autoSwapBuffers && !isReshape) { - swapBuffers(); - } - } catch (RuntimeException e) { - userException = e; - throw(userException); - } finally { - if (userException != null) { - // Disallow setRenderingThread if display action is throwing exceptions - renderingThread = null; - } - - boolean mustSkipFreeForRenderingThread = false; - if (currentThread == renderingThread && curContext == null) { - mustSkipFreeForRenderingThread = true; - setPerThreadSavedCurrentContext(this, initAction); - } - - // Always pop myself off the per-thread context stack - ctxStack.pop(); - - // Free the context unless the setRenderingThread optimization - // kicks in. - if (mustDoMakeCurrent && !mustSkipFreeForRenderingThread) { - if (DEBUG && VERBOSE) { - System.err.println(getThreadName() + ": Freeing context " + this); - } - - try { - free(); - } catch (GLException e) { - internalException = e; - } - - if (curContext != null) { - if (DEBUG && VERBOSE) { - System.err.println(getThreadName() + ": Making context " + curContext + " current again"); - } - try { - curContext.makeCurrent(curInitAction); - } catch (GLException e) { - internalException = e; - } - } - } - - // Check to see whether we pushed any remaining entry on the - // per-thread context stack. If so, put it back in thread-local - // storage unless the rendering thread optimization was recently - // disabled. - if (savedPerThreadContext != null) { - assert(savedPerThreadContext == curContext); - ctxStack.pop(); - if (savedPerThreadContext.getRenderingThread() == null) { - try { - savedPerThreadContext.free(); - } catch (GLException e) { - internalException = e; - } - } else { - setPerThreadSavedCurrentContext(savedPerThreadContext, savedPerThreadInitAction); - } - } - - // Make sure the end user's exception shows up in any stack - // traces; the rethrow of the userException above should take - // precedence if the internalException will otherwise squelch it - if (internalException != null) { - if (userException != null && - internalException.getCause() == null) { - internalException.initCause(userException); - throw(internalException); - } else if (userException == null) { - throw(internalException); - } - } - } - } - - public GL getGL() { - return gl; - } - - public void setGL(GL gl) { - this.gl = gl; - // Also reset the GL object for the pure-Java GLU implementation - ((GLUImpl) glu).setGL(gl); - } - - public GLU getGLU() { - return glu; - } - - public void setGLU(GLU glu) { - this.glu = glu; - } - - /** Gives a hint to the context that setRenderingThread will be - called in the near future; causes redraws to be halted. This is - a workaround for bugs in NVidia's drivers and is used only by - the Animator class. */ - public synchronized void willSetRenderingThread() { - this.willSetRenderingThread = true; - } - - public synchronized void setRenderingThread(Thread currentThreadOrNull, Runnable initAction) { - if (SingleThreadedWorkaround.doWorkaround()) { - willSetRenderingThread = false; - return; - } - - Thread currentThread = Thread.currentThread(); - if (currentThreadOrNull != null && currentThreadOrNull != currentThread) { - throw new GLException("Argument must be either the current thread or null"); - } - if (renderingThread != null && currentThreadOrNull != null) { - throw new GLException("Attempt to re-set or change rendering thread"); - } - if (renderingThread == null && currentThreadOrNull == null) { - throw new GLException("Attempt to clear rendering thread when already cleared"); - } - - Object currentThreadRenderingContext = perThreadRenderingContext.get(); - if (currentThreadOrNull != null && - currentThreadRenderingContext != null && - currentThreadRenderingContext != this) { - throw new GLException("Attempt to call setRenderingThread on more than one drawable in this thread"); - } - - this.willSetRenderingThread = false; - if (currentThreadOrNull == null) { - renderingThread = null; - perThreadRenderingContext.set(null); - // Just in case the end user wasn't planning on drawing the - // drawable even once more (which would give us a chance to free - // the context), try to free the context now by performing an - // invokeGL with a do-nothing action - invokeGL(new Runnable() { - public void run() { - } - }, false, initAction); - } else { - renderingThread = currentThreadOrNull; - perThreadRenderingContext.set(this); - } - } - - public Thread getRenderingThread() { - return renderingThread; - } - - public void setNoAutoRedrawMode(boolean noAutoRedraw) { - this.noAutoRedraw = noAutoRedraw; - } - - public boolean getNoAutoRedrawMode() { - return noAutoRedraw; - } - - public void setAutoSwapBufferMode(boolean autoSwapBuffers) { - this.autoSwapBuffers = autoSwapBuffers; - } - - public boolean getAutoSwapBufferMode() { - return autoSwapBuffers; - } - - /** Swaps the buffers of the OpenGL context if necessary. All error - conditions cause a GLException to be thrown. */ - public abstract void swapBuffers() throws GLException; - - /** Routine needed only for offscreen contexts in order to resize - the underlying bitmap. Called by GLJPanel. */ - public void resizeOffscreenContext(int newWidth, int newHeight) { - if (!isOffscreen()) { - throw new GLException("Should only call for offscreen OpenGL contexts"); - } - pendingOffscreenResize = true; - pendingOffscreenWidth = newWidth; - pendingOffscreenHeight = newHeight; - } - - /** Indicates which floating-point pbuffer implementation is in - use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT, - or GLPbuffer.NV_FLOAT. */ - public int getFloatingPointMode() throws GLException { - throw new GLException("Not supported on non-pbuffer contexts"); - } - - /** Returns a non-null (but possibly empty) string containing the - space-separated list of available platform-dependent (e.g., WGL, - GLX) extensions. Can only be called while this context is - current. */ - public abstract String getPlatformExtensionsString(); - - /** - * Resets the cache of which GL functions are available for calling through this - * context. See {@link #isFunctionAvailable(String)} for more information on - * the definition of "available". - */ - protected void resetGLFunctionAvailability() { - // In order to be able to allow the user to uniformly install the - // debug and trace pipelines in their GLEventListener.init() - // method (for both GLCanvas and GLJPanel), we need to reset the - // actual GL object in the GLDrawable as well - setGL(createGL()); - - functionAvailability.flush(); - if (!haveResetGLUProcAddressTable) { - if (DEBUG) { - System.err.println(getThreadName() + ": !!! Initializing GLU extension address table"); - } - resetProcAddressTable(gluProcAddressTable); - haveResetGLUProcAddressTable = true; // Only need to do this once globally - } - recomputeSingleThreadedWorkaround(); - } - - /** - * Returns true if the specified OpenGL core- or extension-function can be - * successfully called using this GL context given the current host (OpenGL - * client) and display (OpenGL server) configuration. - * - * See {@link GL#isFunctionAvailable(String)} for more details. - * - * @param glFunctionName the name of the OpenGL function (e.g., use - * "glPolygonOffsetEXT" to check if the {@link - * net.java.games.jogl.GL#glPolygonOffsetEXT(float,float)} is available). - */ - protected boolean isFunctionAvailable(String glFunctionName) { - return functionAvailability.isFunctionAvailable(mapToRealGLFunctionName(glFunctionName)); - } - - /** - * Returns true if the specified OpenGL extension can be - * successfully called using this GL context given the current host (OpenGL - * client) and display (OpenGL server) configuration. - * - * See {@link GL#isExtensionAvailable(String)} for more details. - * - * @param glExtensionName the name of the OpenGL extension (e.g., - * "GL_VERTEX_PROGRAM_ARB"). - */ - public boolean isExtensionAvailable(String glExtensionName) { - return functionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName)); - } - - /** - * Pbuffer support; indicates whether this context is capable of - * creating a subordinate pbuffer context (distinct from an - * "offscreen context", which is typically software-rendered on all - * platforms). - */ - public abstract boolean canCreatePbufferContext(); - - /** - * Pbuffer support; creates a subordinate GLContext for a pbuffer - * associated with this context. - */ - public abstract GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight); - - /** - * Pbuffer support; given that this is a GLContext associated with a - * pbuffer, binds this pbuffer to its texture target. - */ - public abstract void bindPbufferToTexture(); - - /** - * Pbuffer support; given that this is a GLContext associated with a - * pbuffer, releases this pbuffer from its texture target. - */ - public abstract void releasePbufferFromTexture(); - - /* - * Sets the swap interval for onscreen OpenGL contexts. Has no - * effect for offscreen contexts. - */ - public void setSwapInterval(final int interval) { - } - - /** Maps the given "platform-independent" function name to a real function - name. Currently this is only used to map "glAllocateMemoryNV" and - associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */ - protected abstract String mapToRealGLFunctionName(String glFunctionName); - - /** Maps the given "platform-independent" extension name to a real - function name. Currently this is only used to map - "GL_ARB_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pbuffer" - and "WGL_ARB_pixel_format" (not yet mapped to X11). */ - protected abstract String mapToRealGLExtensionName(String glExtensionName); - - /** Create the GL for this context. */ - protected abstract GL createGL(); - - /** Hook indicating whether the concrete GLContext implementation is - offscreen and therefore whether we need to process resize - requests. */ - protected abstract boolean isOffscreen(); - - /** Only called for offscreen contexts; returns the buffer from - which to read pixels (GL.GL_FRONT or GL.GL_BACK). */ - public abstract int getOffscreenContextReadBuffer(); - - /** Only called for offscreen contexts; needed by glReadPixels */ - public abstract int getOffscreenContextWidth(); - - /** Only called for offscreen contexts; needed by glReadPixels */ - public abstract int getOffscreenContextHeight(); - - /** Only called for offscreen contexts; needed by glReadPixels */ - public abstract int getOffscreenContextPixelDataType(); - - /** On some platforms the mismatch between OpenGL's coordinate - system (origin at bottom left) and the window system's - coordinate system (origin at top left) necessitates a vertical - flip of pixels read from offscreen contexts. */ - public abstract boolean offscreenImageNeedsVerticalFlip(); - - /** Attempts to make the GL context current. If necessary, creates a - context and calls the initAction once the context is current. - Most error conditions cause an exception to be thrown, except - for the case where the context can not be created because the - component has not yet been visualized. In this case makeCurrent - returns false and the caller should abort any OpenGL event - processing and instead return immediately. */ - protected abstract boolean makeCurrent(Runnable initAction) throws GLException; - - /** Frees the OpenGL context. All error conditions cause a - GLException to be thrown. */ - protected abstract void free() throws GLException; - - /** Inform the system that the associated heavyweight widget has - been realized and that it is safe to create an associated OpenGL - context. If the widget is later destroyed then destroy() should - be called, which will cause the underlying OpenGL context to be - destroyed as well as the realized bit to be set to false. */ - public void setRealized() { - if (getRenderingThread() != null && - Thread.currentThread() != getRenderingThread()) { - deferredSetRealized = true; - return; - } - setRealized(true); - } - - /** Sets only the "realized" bit. Should be called by subclasses - from within the destroy() implementation. */ - protected synchronized void setRealized(boolean realized) { - this.realized = realized; - if (DEBUG) { - System.err.println(getThreadName() + ": GLContext.setRealized(" + realized + ") for context " + this); - } - } - - /** Indicates whether the component associated with this context has - been realized. */ - public synchronized boolean getRealized() { - return realized; - } - - /** Destroys the underlying OpenGL context and changes the realized - state to false. This should be called when the widget is being - destroyed. */ - public synchronized void destroy() throws GLException { - if (getRenderingThread() != null && - Thread.currentThread() != getRenderingThread()) { - if (DEBUG) { - System.err.println(getThreadName() + ": Deferred destroy for context " + this); - } - deferredDestroy = true; - return; - } - setRealized(false); - GLContextShareSet.contextDestroyed(this); - destroyImpl(); - } - - /** Destroys the underlying OpenGL context. */ - protected abstract void destroyImpl() throws GLException; - - public synchronized boolean isRealized() { - return (component == null || getRealized()); - } - - /** Helper routine which resets a ProcAddressTable generated by the - GLEmitter by looking up anew all of its function pointers. */ - protected void resetProcAddressTable(Object table) { - Class tableClass = table.getClass(); - java.lang.reflect.Field[] fields = tableClass.getDeclaredFields(); - - for (int i = 0; i < fields.length; ++i) { - String addressFieldName = fields[i].getName(); - if (!addressFieldName.startsWith(ProcAddressHelper.PROCADDRESS_VAR_PREFIX)) { - // not a proc address variable - continue; - } - int startOfMethodName = ProcAddressHelper.PROCADDRESS_VAR_PREFIX.length(); - String glFuncName = addressFieldName.substring(startOfMethodName); - try { - java.lang.reflect.Field addressField = tableClass.getDeclaredField(addressFieldName); - assert(addressField.getType() == Long.TYPE); - long newProcAddress = dynamicLookupFunction(glFuncName); - // set the current value of the proc address variable in the table object - addressField.setLong(table, newProcAddress); - if (DEBUG) { - // System.err.println(glFuncName + " = 0x" + Long.toHexString(newProcAddress)); - } - } catch (Exception e) { - throw new GLException("Cannot get GL proc address for method \"" + - glFuncName + "\": Couldn't set value of field \"" + addressFieldName + - "\" in class " + tableClass.getName(), e); - } - } - } - - /** Dynamically looks up the given function. */ - protected abstract long dynamicLookupFunction(String glFuncName); - - /** Indicates whether the underlying OpenGL context has been - created. This is used to manage sharing of display lists and - textures between contexts. */ - public abstract boolean isCreated(); - - /** Support for recursive makeCurrent() calls as well as calling - other drawables' display() methods from within another one's */ - protected static GLContextStack getPerThreadContextStack() { - return (GLContextStack) perThreadContextStack.get(); - } - - /** Support for setRenderingThread()'s optimized context handling */ - protected static GLContext getPerThreadSavedCurrentContext() { - return ((GLContextInitActionPair) perThreadSavedCurrentContext.get()).getContext(); - } - - /** Support for setRenderingThread()'s optimized context handling */ - protected static Runnable getPerThreadSavedInitAction() { - return ((GLContextInitActionPair) perThreadSavedCurrentContext.get()).getInitAction(); - } - - /** Support for setRenderingThread()'s optimized context handling */ - protected static void setPerThreadSavedCurrentContext(GLContext context, Runnable initAction) { - perThreadSavedCurrentContext.set(new GLContextInitActionPair(context, initAction)); - } - - /** Support for automatic detection of whether we need to enable the - single-threaded workaround for ATI and other vendors' cards. - Should be called by subclasses for onscreen rendering inside - their makeCurrent() implementation once the context is - current. */ - private void recomputeSingleThreadedWorkaround() { - GL gl = getGL(); - String str = gl.glGetString(GL.GL_VENDOR); - if (str != null && str.indexOf("ATI") >= 0) { - // Doing this instead of calling setRenderingThread(null) should - // be OK since we are doing this very early in the maintenance - // of the per-thread context stack, before we are actually - // pushing any GLContext objects on it - SingleThreadedWorkaround.shouldDoWorkaround(); - if( SingleThreadedWorkaround.doWorkaround() ) { - renderingThread = null; - } - } - } - - protected static String getThreadName() { - return Thread.currentThread().getName(); - } -} diff --git a/src/net/java/games/jogl/impl/GLContextFactory.java b/src/net/java/games/jogl/impl/GLContextFactory.java deleted file mode 100644 index 40a90f883..000000000 --- a/src/net/java/games/jogl/impl/GLContextFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.awt.Component; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import net.java.games.jogl.*; - -public abstract class GLContextFactory { - private static GLContextFactory factory; - - public static GLContextFactory getFactory() { - if (factory == null) { - try { - String osName = System.getProperty("os.name"); - String osNameLowerCase = osName.toLowerCase(); - Class factoryClass = null; - - // Because there are some complications with generating all - // platforms' Java glue code on all platforms (among them that we - // would have to include jawt.h and jawt_md.h in the jogl - // sources, which we currently don't have to do) we break the only - // static dependencies with platform-specific code here using reflection. - - if (osNameLowerCase.startsWith("wind")) { - factoryClass = Class.forName("net.java.games.jogl.impl.windows.WindowsGLContextFactory"); - } else if (osNameLowerCase.startsWith("mac os x")) { - factoryClass = Class.forName("net.java.games.jogl.impl.macosx.MacOSXGLContextFactory"); - } else { - // Assume Linux, Solaris, etc. Should probably test for these explicitly. - factoryClass = Class.forName("net.java.games.jogl.impl.x11.X11GLContextFactory"); - } - - if (factoryClass == null) { - throw new GLException("OS " + osName + " not yet supported"); - } - - factory = (GLContextFactory) factoryClass.newInstance(); - } catch (ClassNotFoundException e) { - throw new GLException(e); - } catch (InstantiationException e) { - throw new GLException(e); - } catch (IllegalAccessException e) { - throw new GLException(e); - } - } - - return factory; - } - - /** Selects a GraphicsConfiguration on the specified GraphicsDevice - that matches the desired GLCapabilities according to the - specified GLCapabilitiesChooser's selection algorithm and any - hints provided by the underlying window system. This routine is - currently only implemented on X11, where it is necessary to - choose the desired visual before creating the underlying AWT - Canvas; on other platforms it returns null, yielding the default - behavior. */ - public abstract GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device); - - public abstract GLContext createGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith); -} diff --git a/src/net/java/games/jogl/impl/GLContextInitActionPair.java b/src/net/java/games/jogl/impl/GLContextInitActionPair.java deleted file mode 100755 index 379dda3ee..000000000 --- a/src/net/java/games/jogl/impl/GLContextInitActionPair.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -public class GLContextInitActionPair { - private GLContext ctx; - private Runnable initAction; - - public GLContextInitActionPair(GLContext ctx, Runnable initAction) { - this.ctx = ctx; - this.initAction = initAction; - } - - public GLContext getContext() { - return ctx; - } - - public Runnable getInitAction() { - return initAction; - } -} diff --git a/src/net/java/games/jogl/impl/GLContextShareSet.java b/src/net/java/games/jogl/impl/GLContextShareSet.java deleted file mode 100644 index 60c6b7d59..000000000 --- a/src/net/java/games/jogl/impl/GLContextShareSet.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.lang.ref.*; -import java.util.*; - -/** Provides a mechanism by which OpenGL contexts can share textures - and display lists in the face of multithreading and asynchronous - context creation as is inherent in the AWT and Swing. */ - -public class GLContextShareSet { - // This class is implemented with a WeakHashMap that goes from the - // contexts as keys to a complex data structure as value that tracks - // context creation and deletion. - - private static Map/*>*/ shareMap = new WeakHashMap(); - private static Object dummyValue = new Object(); - - private static class ShareSet { - private Map allShares = new WeakHashMap(); - private Map createdShares = new WeakHashMap(); - private Map destroyedShares = new WeakHashMap(); - - public void add(GLContext ctx) { - if (allShares.put(ctx, dummyValue) == null) { - if (ctx.isCreated()) { - createdShares.put(ctx, dummyValue); - } else { - destroyedShares.put(ctx, dummyValue); - } - } - } - - public GLContext getCreatedShare(GLContext ignore) { - for (Iterator iter = createdShares.keySet().iterator(); iter.hasNext(); ) { - GLContext ctx = (GLContext) iter.next(); - if (ctx != ignore) { - return ctx; - } - } - return null; - } - - public void contextCreated(GLContext ctx) { - Object res = destroyedShares.remove(ctx); - assert res != null : "State of ShareSet corrupted; thought context " + - ctx + " should have been in destroyed set but wasn't"; - res = createdShares.put(ctx, dummyValue); - assert res == null : "State of ShareSet corrupted; thought context " + - ctx + " shouldn't have been in created set but was"; - } - - public void contextDestroyed(GLContext ctx) { - Object res = createdShares.remove(ctx); - assert res != null : "State of ShareSet corrupted; thought context " + - ctx + " should have been in created set but wasn't"; - res = destroyedShares.put(ctx, dummyValue); - assert res == null : "State of ShareSet corrupted; thought context " + - ctx + " shouldn't have been in destroyed set but was"; - } - } - - - /** Indicate that contexts share1 and - share2 will share textures and display lists. */ - public static synchronized void registerSharing(GLContext share1, GLContext share2) { - ShareSet share = entryFor(share1); - if (share == null) { - share = entryFor(share2); - } - if (share == null) { - share = new ShareSet(); - } - share.add(share1); - share.add(share2); - addEntry(share1, share); - addEntry(share2, share); - } - - public static synchronized GLContext getShareContext(GLContext contextToCreate) { - ShareSet share = entryFor(contextToCreate); - if (share == null) { - return null; - } - return share.getCreatedShare(contextToCreate); - } - - public static synchronized void contextCreated(GLContext context) { - ShareSet share = entryFor(context); - if (share != null) { - share.contextCreated(context); - } - } - - public static synchronized void contextDestroyed(GLContext context) { - ShareSet share = entryFor(context); - if (share != null) { - share.contextDestroyed(context); - } - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private static ShareSet entryFor(GLContext context) { - return (ShareSet) shareMap.get(context); - } - - private static void addEntry(GLContext context, ShareSet share) { - if (shareMap.get(context) == null) { - shareMap.put(context, share); - } - } -} diff --git a/src/net/java/games/jogl/impl/GLContextStack.java b/src/net/java/games/jogl/impl/GLContextStack.java deleted file mode 100755 index 089d53525..000000000 --- a/src/net/java/games/jogl/impl/GLContextStack.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.util.*; - -/** Implements a stack of GLContext objects along with the initActions - that need to be run if their creation is necessary. This is used - to detect redundant makeCurrent() calls and to allow one drawable - to call display() of another from within the first drawable's - display() method. */ - -public class GLContextStack { - private ArrayList data = new ArrayList(); - - /** Pushes this GLContext on the stack. The passed context must be non-null. */ - public void push(GLContext ctx, Runnable initAction) { - if (ctx == null) { - throw new IllegalArgumentException("Null contexts are not allowed here"); - } - - data.add(new GLContextInitActionPair(ctx, initAction)); - } - - /** Removes and returns the top GLContext and associated - initialization action, or null if there is none. */ - public GLContextInitActionPair pop() { - if (data.size() == 0) { - return null; - } - - return (GLContextInitActionPair) data.remove(data.size() - 1); - } - - /** Returns the top GLContext and associated initialization action - without removing it, or null if there is none. */ - public GLContextInitActionPair peek() { - return peek(0); - } - - /** Returns the ith GLContext and associated initialization - action from the top without removing it, or null if there is - none. */ - public GLContextInitActionPair peek(int i) { - if (data.size() - i <= 0) { - return null; - } - - return (GLContextInitActionPair) data.get(data.size() - i - 1); - } - - /** Returns the top GLContext without removing it, or null if there - is none. */ - public GLContext peekContext() { - return peekContext(0); - } - - /** Returns the ith GLContext from the top without removing - it, or null if there is none. */ - public GLContext peekContext(int i) { - GLContextInitActionPair pair = peek(i); - if (pair == null) { - return null; - } - - return pair.getContext(); - } - - /** Returns the top initialization action without removing it, or - null if there is none. */ - public Runnable peekInitAction() { - return peekInitAction(0); - } - - /** Returns the ith initialization action from the top - without removing it, or null if there is none. */ - public Runnable peekInitAction(int i) { - GLContextInitActionPair pair = peek(i); - if (pair == null) { - return null; - } - - return pair.getInitAction(); - } - - /** Returns the number of entries on the GLContext stack. */ - public int size() { - return data.size(); - } -} diff --git a/src/net/java/games/jogl/impl/GLDrawableHelper.java b/src/net/java/games/jogl/impl/GLDrawableHelper.java deleted file mode 100644 index dd5d7c17f..000000000 --- a/src/net/java/games/jogl/impl/GLDrawableHelper.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.util.*; -import net.java.games.jogl.*; - -/** Encapsulates the implementation of most of the GLDrawable's - methods to be able to share it between GLCanvas and GLJPanel. */ - -public class GLDrawableHelper { - private volatile List listeners = new ArrayList(); - - public GLDrawableHelper() { - } - - public synchronized void addGLEventListener(GLEventListener listener) { - List newListeners = (List) ((ArrayList) listeners).clone(); - newListeners.add(listener); - listeners = newListeners; - } - - public synchronized void removeGLEventListener(GLEventListener listener) { - List newListeners = (List) ((ArrayList) listeners).clone(); - newListeners.remove(listener); - listeners = newListeners; - } - - public void init(GLDrawable drawable) { - for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { - ((GLEventListener) iter.next()).init(drawable); - } - } - - public void display(GLDrawable drawable) { - for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { - ((GLEventListener) iter.next()).display(drawable); - } - } - - public void reshape(GLDrawable drawable, - int x, int y, int width, int height) { - for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { - ((GLEventListener) iter.next()).reshape(drawable, x, y, width, height); - } - } -} diff --git a/src/net/java/games/jogl/impl/GLPbufferImpl.java b/src/net/java/games/jogl/impl/GLPbufferImpl.java deleted file mode 100644 index 7b17c3010..000000000 --- a/src/net/java/games/jogl/impl/GLPbufferImpl.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.awt.Dimension; -import java.awt.EventQueue; -import java.awt.event.*; -import java.beans.PropertyChangeListener; - -import net.java.games.jogl.*; - -/** Platform-independent class exposing pbuffer functionality to - applications. This class is not exposed in the public API as it - would probably add no value; however it implements the GLDrawable - interface so can be interacted with via its display() method. */ - -public class GLPbufferImpl implements GLPbuffer { - // GLPbufferContext - private GLContext context; - private GLDrawableHelper drawableHelper = new GLDrawableHelper(); - private boolean isInitialized=false; - private int floatMode; - - public GLPbufferImpl(GLContext context) { - this.context = context; - } - - public void display() { - maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction, - displayAction, - false); - } - - public void setSize(int width, int height) { - // FIXME - throw new GLException("Not yet implemented"); - } - - public void setSize(Dimension d) { - setSize(d.width, d.height); - } - - public Dimension getSize() { - return getSize(null); - } - - public Dimension getSize(Dimension d) { - // FIXME - throw new GLException("Not yet implemented"); - } - - public void addGLEventListener(GLEventListener listener) { - drawableHelper.addGLEventListener(listener); - } - - public void removeGLEventListener(GLEventListener listener) { - drawableHelper.removeGLEventListener(listener); - } - - public GL getGL() { - return context.getGL(); - } - - public void setGL(GL gl) { - context.setGL(gl); - } - - public GLU getGLU() { - return context.getGLU(); - } - - public void setGLU(GLU glu) { - context.setGLU(glu); - } - - void willSetRenderingThread() { - // Not supported for pbuffers - } - - public void setRenderingThread(Thread currentThreadOrNull) throws GLException { - // Not supported for pbuffers - } - - public Thread getRenderingThread() { - // Not supported for pbuffers - return null; - } - - public void setNoAutoRedrawMode(boolean noAutoRedraws) { - } - - public boolean getNoAutoRedrawMode() { - return false; - } - - public void setAutoSwapBufferMode(boolean onOrOff) { - context.setAutoSwapBufferMode(onOrOff); - } - - public boolean getAutoSwapBufferMode() { - return context.getAutoSwapBufferMode(); - } - - public void swapBuffers() { - maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction, false); - } - - public boolean canCreateOffscreenDrawable() { - return false; - } - - public GLPbuffer createOffscreenDrawable(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - public void bindTexture() { - // Doesn't make much sense to try to do this on the event dispatch - // thread given that it has to be called while the context is current - context.bindPbufferToTexture(); - } - - public void releaseTexture() { - // Doesn't make much sense to try to do this on the event dispatch - // thread given that it has to be called while the context is current - context.releasePbufferFromTexture(); - } - - public GLContext getContext() { - return context; - } - - //---------------------------------------------------------------------- - // No-ops for ComponentEvents - // - - public void addComponentListener(ComponentListener l) {} - public void removeComponentListener(ComponentListener l) {} - public void addFocusListener(FocusListener l) {} - public void removeFocusListener(FocusListener l) {} - public void addHierarchyBoundsListener(HierarchyBoundsListener l) {} - public void removeHierarchyBoundsListener(HierarchyBoundsListener l) {} - public void addHierarchyListener(HierarchyListener l) {} - public void removeHierarchyListener(HierarchyListener l) {} - public void addInputMethodListener(InputMethodListener l) {} - public void removeInputMethodListener(InputMethodListener l) {} - public void addKeyListener(KeyListener l) {} - public void removeKeyListener(KeyListener l) {} - public void addMouseListener(MouseListener l) {} - public void removeMouseListener(MouseListener l) {} - public void addMouseMotionListener(MouseMotionListener l) {} - public void removeMouseMotionListener(MouseMotionListener l) {} - public void addMouseWheelListener(MouseWheelListener l) {} - public void removeMouseWheelListener(MouseWheelListener l) {} - public void addPropertyChangeListener(PropertyChangeListener listener) {} - public void removePropertyChangeListener(PropertyChangeListener listener) {} - public void addPropertyChangeListener(String propertyName, - PropertyChangeListener listener) {} - public void removePropertyChangeListener(String propertyName, - PropertyChangeListener listener) {} - - /** Queries initialization status of this pBuffer. - * @return true if initialized - * */ - public boolean isInitialized(){ - return isInitialized; - } - - public void destroy() { - context.destroy(); - } - - public int getFloatingPointMode() { - if (floatMode == 0) { - throw new GLException("Pbuffer not initialized, or floating-point support not requested"); - } - return floatMode; - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private void maybeDoSingleThreadedWorkaround(Runnable eventDispatchThreadAction, - Runnable invokeGLAction, - boolean isReshape) { - if (SingleThreadedWorkaround.doWorkaround() && !EventQueue.isDispatchThread()) { - try { - // Reshape events must not block on the event queue due to the - // possibility of deadlocks during initial component creation. - // This solution is not optimal, because it changes the - // semantics of reshape() to have some of the processing being - // done asynchronously, but at least it preserves the - // semantics of the single-threaded workaround. - if (!isReshape) { - EventQueue.invokeAndWait(eventDispatchThreadAction); - } else { - EventQueue.invokeLater(eventDispatchThreadAction); - } - } catch (Exception e) { - throw new GLException(e); - } - } else { - context.invokeGL(invokeGLAction, isReshape, initAction); - } - } - - class InitAction implements Runnable { - public void run() { - isInitialized=true; - floatMode = context.getFloatingPointMode(); - drawableHelper.init(GLPbufferImpl.this); - } - } - private InitAction initAction = new InitAction(); - - class DisplayAction implements Runnable { - public void run() { - drawableHelper.display(GLPbufferImpl.this); - } - } - private DisplayAction displayAction = new DisplayAction(); - - class SwapBuffersAction implements Runnable { - public void run() { - context.swapBuffers(); - } - } - private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); - - // Workaround for ATI driver bugs related to multithreading issues - // like simultaneous rendering via Animators to canvases that are - // being resized on the AWT event dispatch thread - class DisplayOnEventDispatchThreadAction implements Runnable { - public void run() { - context.invokeGL(displayAction, false, initAction); - } - } - private DisplayOnEventDispatchThreadAction displayOnEventDispatchThreadAction = - new DisplayOnEventDispatchThreadAction(); - class SwapBuffersOnEventDispatchThreadAction implements Runnable { - public void run() { - context.invokeGL(swapBuffersAction, false, initAction); - } - } - private SwapBuffersOnEventDispatchThreadAction swapBuffersOnEventDispatchThreadAction = - new SwapBuffersOnEventDispatchThreadAction(); -} diff --git a/src/net/java/games/jogl/impl/GLUquadricImpl.java b/src/net/java/games/jogl/impl/GLUquadricImpl.java deleted file mode 100755 index dfc167dcb..000000000 --- a/src/net/java/games/jogl/impl/GLUquadricImpl.java +++ /dev/null @@ -1,1049 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** $Date$ $Revision$ -** $Header$ -*/ - -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -package net.java.games.jogl.impl; - -import net.java.games.jogl.*; - -/** - * GLUquadricImpl.java - * - * - * Created 22-dec-2003 (originally Quadric.java) - * @author Erik Duijs - * @author Kenneth Russell - */ - -class GLUquadricImpl implements GLUquadric { - private int drawStyle; - private int orientation; - private boolean textureFlag; - private int normals; - - GLUquadricImpl() { - drawStyle = GLU.GLU_FILL; - orientation = GLU.GLU_OUTSIDE; - textureFlag = false; - normals = GLU.GLU_SMOOTH; - } - - /** - * specifies the draw style for quadrics. - * - * The legal values are as follows: - * - * GLU.FILL: Quadrics are rendered with polygon primitives. The polygons - * are drawn in a counterclockwise fashion with respect to - * their normals (as defined with glu.quadricOrientation). - * - * GLU.LINE: Quadrics are rendered as a set of lines. - * - * GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges - * separating coplanar faces will not be drawn. - * - * GLU.POINT: Quadrics are rendered as a set of points. - * - * @param drawStyle The drawStyle to set - */ - void setDrawStyle(int drawStyle) { - this.drawStyle = drawStyle; - } - - /** - * specifies what kind of normals are desired for quadrics. - * The legal values are as follows: - * - * GLU.NONE: No normals are generated. - * - * GLU.FLAT: One normal is generated for every facet of a quadric. - * - * GLU.SMOOTH: One normal is generated for every vertex of a quadric. This - * is the default. - * - * @param normals The normals to set - */ - void setNormals(int normals) { - this.normals = normals; - } - - /** - * specifies what kind of orientation is desired for. - * The orientation values are as follows: - * - * GLU.OUTSIDE: Quadrics are drawn with normals pointing outward. - * - * GLU.INSIDE: Normals point inward. The default is GLU.OUTSIDE. - * - * Note that the interpretation of outward and inward depends on the quadric - * being drawn. - * - * @param orientation The orientation to set - */ - void setOrientation(int orientation) { - this.orientation = orientation; - } - - /** - * specifies if texture coordinates should be generated for - * quadrics rendered with qobj. If the value of textureCoords is true, - * then texture coordinates are generated, and if textureCoords is false, - * they are not.. The default is false. - * - * The manner in which texture coordinates are generated depends upon the - * specific quadric rendered. - * - * @param textureFlag The textureFlag to set - */ - void setTextureFlag(boolean textureFlag) { - this.textureFlag = textureFlag; - } - - /** - * Returns the drawStyle. - * @return int - */ - int getDrawStyle() { - return drawStyle; - } - - /** - * Returns the normals. - * @return int - */ - int getNormals() { - return normals; - } - - /** - * Returns the orientation. - * @return int - */ - int getOrientation() { - return orientation; - } - - /** - * Returns the textureFlag. - * @return boolean - */ - boolean getTextureFlag() { - return textureFlag; - } - - /** - * draws a cylinder oriented along the z axis. The base of the - * cylinder is placed at z = 0, and the top at z=height. Like a sphere, a - * cylinder is subdivided around the z axis into slices, and along the z axis - * into stacks. - * - * Note that if topRadius is set to zero, then this routine will generate a - * cone. - * - * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then - * any generated normals point away from the z axis. Otherwise, they point - * toward the z axis. - * - * If texturing is turned on (with glu.quadricTexture), then texture - * coordinates are generated so that t ranges linearly from 0.0 at z = 0 to - * 1.0 at z = height, and s ranges from 0.0 at the +y axis, to 0.25 at the +x - * axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the - * +y axis. - * - * @param baseRadius Specifies the radius of the cylinder at z = 0. - * @param topRadius Specifies the radius of the cylinder at z = height. - * @param height Specifies the height of the cylinder. - * @param slices Specifies the number of subdivisions around the z axis. - * @param stacks Specifies the number of subdivisions along the z axis. - */ - void drawCylinder(GL gl, float baseRadius, float topRadius, float height, int slices, int stacks) { - - float da, r, dr, dz; - float x, y, z, nz, nsign; - int i, j; - - if (orientation == GLU.GLU_INSIDE) { - nsign = -1.0f; - } else { - nsign = 1.0f; - } - - da = 2.0f * PI / slices; - dr = (topRadius - baseRadius) / stacks; - dz = height / stacks; - nz = (baseRadius - topRadius) / height; - // Z component of normal vectors - - if (drawStyle == GLU.GLU_POINT) { - gl.glBegin(GL.GL_POINTS); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(gl, x * nsign, y * nsign, nz * nsign); - - z = 0.0f; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - gl.glVertex3f((x * r), (y * r), z); - z += dz; - r += dr; - } - } - gl.glEnd(); - } else if (drawStyle == GLU.GLU_LINE || drawStyle == GLU.GLU_SILHOUETTE) { - // Draw rings - if (drawStyle == GLU.GLU_LINE) { - z = 0.0f; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - gl.glBegin(GL.GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(gl, x * nsign, y * nsign, nz * nsign); - gl.glVertex3f((x * r), (y * r), z); - } - gl.glEnd(); - z += dz; - r += dr; - } - } else { - // draw one ring at each end - if (baseRadius != 0.0) { - gl.glBegin(GL.GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(gl, x * nsign, y * nsign, nz * nsign); - gl.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); - } - gl.glEnd(); - gl.glBegin(GL.GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(gl, x * nsign, y * nsign, nz * nsign); - gl.glVertex3f((x * topRadius), (y * topRadius), height); - } - gl.glEnd(); - } - } - // draw length lines - gl.glBegin(GL.GL_LINES); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(gl, x * nsign, y * nsign, nz * nsign); - gl.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); - gl.glVertex3f((x * topRadius), (y * topRadius), (height)); - } - gl.glEnd(); - } else if (drawStyle == GLU.GLU_FILL) { - float ds = 1.0f / slices; - float dt = 1.0f / stacks; - float t = 0.0f; - z = 0.0f; - r = baseRadius; - for (j = 0; j < stacks; j++) { - float s = 0.0f; - gl.glBegin(GL.GL_QUAD_STRIP); - for (i = 0; i <= slices; i++) { - if (i == slices) { - x = sin(0.0f); - y = cos(0.0f); - } else { - x = sin((i * da)); - y = cos((i * da)); - } - if (nsign == 1.0f) { - normal3f(gl, (x * nsign), (y * nsign), (nz * nsign)); - TXTR_COORD(gl, s, t); - gl.glVertex3f((x * r), (y * r), z); - normal3f(gl, (x * nsign), (y * nsign), (nz * nsign)); - TXTR_COORD(gl, s, t + dt); - gl.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); - } else { - normal3f(gl, x * nsign, y * nsign, nz * nsign); - TXTR_COORD(gl, s, t); - gl.glVertex3f((x * r), (y * r), z); - normal3f(gl, x * nsign, y * nsign, nz * nsign); - TXTR_COORD(gl, s, t + dt); - gl.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); - } - s += ds; - } // for slices - gl.glEnd(); - r += dr; - t += dt; - z += dz; - } // for stacks - } - } - - /** - * renders a disk on the z = 0 plane. The disk has a radius of - * outerRadius, and contains a concentric circular hole with a radius of - * innerRadius. If innerRadius is 0, then no hole is generated. The disk is - * subdivided around the z axis into slices (like pizza slices), and also - * about the z axis into rings (as specified by slices and loops, - * respectively). - * - * With respect to orientation, the +z side of the disk is considered to be - * "outside" (see glu.quadricOrientation). This means that if the orientation - * is set to GLU.OUTSIDE, then any normals generated point along the +z axis. - * Otherwise, they point along the -z axis. - * - * If texturing is turned on (with glu.quadricTexture), texture coordinates are - * generated linearly such that where r=outerRadius, the value at (r, 0, 0) is - * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at - * (0, -r, 0) it is (0.5, 0). - */ - public void drawDisk(GL gl, float innerRadius, float outerRadius, int slices, int loops) - { - float da, dr; - - /* Normal vectors */ - if (normals != GLU.GLU_NONE) { - if (orientation == GLU.GLU_OUTSIDE) { - gl.glNormal3f(0.0f, 0.0f, +1.0f); - } - else { - gl.glNormal3f(0.0f, 0.0f, -1.0f); - } - } - - da = 2.0f * PI / slices; - dr = (outerRadius - innerRadius) / loops; - - switch (drawStyle) { - case GLU.GLU_FILL: - { - /* texture of a gluDisk is a cut out of the texture unit square - * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] - * (linear mapping) - */ - float dtc = 2.0f * outerRadius; - float sa, ca; - float r1 = innerRadius; - int l; - for (l = 0; l < loops; l++) { - float r2 = r1 + dr; - if (orientation == GLU.GLU_OUTSIDE) { - int s; - gl.glBegin(gl.GL_QUAD_STRIP); - for (s = 0; s <= slices; s++) { - float a; - if (s == slices) - a = 0.0f; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(gl, 0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc); - gl.glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(gl, 0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc); - gl.glVertex2f(r1 * sa, r1 * ca); - } - gl.glEnd(); - } - else { - int s; - gl.glBegin(GL.GL_QUAD_STRIP); - for (s = slices; s >= 0; s--) { - float a; - if (s == slices) - a = 0.0f; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(gl, 0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc); - gl.glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(gl, 0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc); - gl.glVertex2f(r1 * sa, r1 * ca); - } - gl.glEnd(); - } - r1 = r2; - } - break; - } - case GLU.GLU_LINE: - { - int l, s; - /* draw loops */ - for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; - gl.glBegin(GL.GL_LINE_LOOP); - for (s = 0; s < slices; s++) { - float a = s * da; - gl.glVertex2f(r * sin(a), r * cos(a)); - } - gl.glEnd(); - } - /* draw spokes */ - for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); - gl.glBegin(GL.GL_LINE_STRIP); - for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; - gl.glVertex2f(r * x, r * y); - } - gl.glEnd(); - } - break; - } - case GLU.GLU_POINT: - { - int s; - gl.glBegin(GL.GL_POINTS); - for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); - int l; - for (l = 0; l <= loops; l++) { - float r = innerRadius * l * dr; - gl.glVertex2f(r * x, r * y); - } - } - gl.glEnd(); - break; - } - case GLU.GLU_SILHOUETTE: - { - if (innerRadius != 0.0) { - float a; - gl.glBegin(GL.GL_LINE_LOOP); - for (a = 0.0f; a < 2.0 * PI; a += da) { - float x = innerRadius * sin(a); - float y = innerRadius * cos(a); - gl.glVertex2f(x, y); - } - gl.glEnd(); - } - { - float a; - gl.glBegin(GL.GL_LINE_LOOP); - for (a = 0; a < 2.0f * PI; a += da) { - float x = outerRadius * sin(a); - float y = outerRadius * cos(a); - gl.glVertex2f(x, y); - } - gl.glEnd(); - } - break; - } - default: - return; - } - } - - /** - * renders a partial disk on the z=0 plane. A partial disk is similar to a - * full disk, except that only the subset of the disk from startAngle - * through startAngle + sweepAngle is included (where 0 degrees is along - * the +y axis, 90 degrees along the +x axis, 180 along the -y axis, and - * 270 along the -x axis). - * - * The partial disk has a radius of outerRadius, and contains a concentric - * circular hole with a radius of innerRadius. If innerRadius is zero, then - * no hole is generated. The partial disk is subdivided around the z axis - * into slices (like pizza slices), and also about the z axis into rings - * (as specified by slices and loops, respectively). - * - * With respect to orientation, the +z side of the partial disk is - * considered to be outside (see gluQuadricOrientation). This means that if - * the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point - * along the +z axis. Otherwise, they point along the -z axis. - * - * If texturing is turned on (with gluQuadricTexture), texture coordinates - * are generated linearly such that where r=outerRadius, the value at (r, 0, 0) - * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), - * and at (0, -r, 0) it is (0.5, 0). - */ - public void drawPartialDisk(GL gl, - float innerRadius, - float outerRadius, - int slices, - int loops, - float startAngle, - float sweepAngle) { - int i, j, max; - float[] sinCache = new float[CACHE_SIZE]; - float[] cosCache = new float[CACHE_SIZE]; - float angle; - float x, y; - float sintemp, costemp; - float deltaRadius; - float radiusLow, radiusHigh; - float texLow = 0, texHigh = 0; - float angleOffset; - int slices2; - int finish; - - if (slices >= CACHE_SIZE) - slices = CACHE_SIZE - 1; - if (slices < 2 - || loops < 1 - || outerRadius <= 0.0f - || innerRadius < 0.0f - || innerRadius > outerRadius) { - //gluQuadricError(qobj, GLU.GLU_INVALID_VALUE); - System.err.println("PartialDisk: GLU_INVALID_VALUE"); - return; - } - - if (sweepAngle < -360.0f) - sweepAngle = 360.0f; - if (sweepAngle > 360.0f) - sweepAngle = 360.0f; - if (sweepAngle < 0) { - startAngle += sweepAngle; - sweepAngle = -sweepAngle; - } - - if (sweepAngle == 360.0f) { - slices2 = slices; - } else { - slices2 = slices + 1; - } - - /* Compute length (needed for normal calculations) */ - deltaRadius = outerRadius - innerRadius; - - /* Cache is the vertex locations cache */ - - angleOffset = startAngle / 180.0f * PI; - for (i = 0; i <= slices; i++) { - angle = angleOffset + ((PI * sweepAngle) / 180.0f) * i / slices; - sinCache[i] = sin(angle); - cosCache[i] = cos(angle); - } - - if (sweepAngle == 360.0f) { - sinCache[slices] = sinCache[0]; - cosCache[slices] = cosCache[0]; - } - - switch (normals) { - case GLU.GLU_FLAT : - case GLU.GLU_SMOOTH : - if (orientation == GLU.GLU_OUTSIDE) { - gl.glNormal3f(0.0f, 0.0f, 1.0f); - } else { - gl.glNormal3f(0.0f, 0.0f, -1.0f); - } - break; - default : - case GLU.GLU_NONE : - break; - } - - switch (drawStyle) { - case GLU.GLU_FILL : - if (innerRadius == .0f) { - finish = loops - 1; - /* Triangle strip for inner polygons */ - gl.glBegin(GL.GL_TRIANGLE_FAN); - if (textureFlag) { - gl.glTexCoord2f(0.5f, 0.5f); - } - gl.glVertex3f(0.0f, 0.0f, 0.0f); - radiusLow = outerRadius - deltaRadius * ((float) (loops - 1) / loops); - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - } - - if (orientation == GLU.GLU_OUTSIDE) { - for (i = slices; i >= 0; i--) { - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); - } - } else { - for (i = 0; i <= slices; i++) { - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); - } - } - gl.glEnd(); - } else { - finish = loops; - } - for (j = 0; j < finish; j++) { - radiusLow = outerRadius - deltaRadius * ((float) j / loops); - radiusHigh = outerRadius - deltaRadius * ((float) (j + 1) / loops); - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - texHigh = radiusHigh / outerRadius / 2; - } - - gl.glBegin(GL.GL_QUAD_STRIP); - for (i = 0; i <= slices; i++) { - if (orientation == GLU.GLU_OUTSIDE) { - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); - - if (textureFlag) { - gl.glTexCoord2f(texHigh * sinCache[i] + 0.5f, - texHigh * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusHigh * sinCache[i], - radiusHigh * cosCache[i], - 0.0f); - } else { - if (textureFlag) { - gl.glTexCoord2f(texHigh * sinCache[i] + 0.5f, - texHigh * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusHigh * sinCache[i], - radiusHigh * cosCache[i], - 0.0f); - - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); - } - } - gl.glEnd(); - } - break; - case GLU.GLU_POINT : - gl.glBegin(GL.GL_POINTS); - for (i = 0; i < slices2; i++) { - sintemp = sinCache[i]; - costemp = cosCache[i]; - for (j = 0; j <= loops; j++) { - radiusLow = outerRadius - deltaRadius * ((float) j / loops); - - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); - } - } - gl.glEnd(); - break; - case GLU.GLU_LINE : - if (innerRadius == outerRadius) { - gl.glBegin(GL.GL_LINE_STRIP); - - for (i = 0; i <= slices; i++) { - if (textureFlag) { - gl.glTexCoord2f(sinCache[i] / 2 + 0.5f, cosCache[i] / 2 + 0.5f); - } - gl.glVertex3f(innerRadius * sinCache[i], innerRadius * cosCache[i], 0.0f); - } - gl.glEnd(); - break; - } - for (j = 0; j <= loops; j++) { - radiusLow = outerRadius - deltaRadius * ((float) j / loops); - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - } - - gl.glBegin(GL.GL_LINE_STRIP); - for (i = 0; i <= slices; i++) { - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); - } - gl.glEnd(); - } - for (i = 0; i < slices2; i++) { - sintemp = sinCache[i]; - costemp = cosCache[i]; - gl.glBegin(GL.GL_LINE_STRIP); - for (j = 0; j <= loops; j++) { - radiusLow = outerRadius - deltaRadius * ((float) j / loops); - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - } - - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); - } - gl.glEnd(); - } - break; - case GLU.GLU_SILHOUETTE : - if (sweepAngle < 360.0f) { - for (i = 0; i <= slices; i += slices) { - sintemp = sinCache[i]; - costemp = cosCache[i]; - gl.glBegin(GL.GL_LINE_STRIP); - for (j = 0; j <= loops; j++) { - radiusLow = outerRadius - deltaRadius * ((float) j / loops); - - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0f); - } - gl.glEnd(); - } - } - for (j = 0; j <= loops; j += loops) { - radiusLow = outerRadius - deltaRadius * ((float) j / loops); - if (textureFlag) { - texLow = radiusLow / outerRadius / 2; - } - - gl.glBegin(GL.GL_LINE_STRIP); - for (i = 0; i <= slices; i++) { - if (textureFlag) { - gl.glTexCoord2f(texLow * sinCache[i] + 0.5f, - texLow * cosCache[i] + 0.5f); - } - gl.glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 0.0f); - } - gl.glEnd(); - if (innerRadius == outerRadius) - break; - } - break; - default : - break; - } - } - - /** - * draws a sphere of the given radius centered around the origin. - * The sphere is subdivided around the z axis into slices and along the z axis - * into stacks (similar to lines of longitude and latitude). - * - * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then - * any normals generated point away from the center of the sphere. Otherwise, - * they point toward the center of the sphere. - - * If texturing is turned on (with glu.quadricTexture), then texture - * coordinates are generated so that t ranges from 0.0 at z=-radius to 1.0 at - * z=radius (t increases linearly along longitudinal lines), and s ranges from - * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 - * at the -x axis, and back to 1.0 at the +y axis. - */ - public void drawSphere(GL gl, float radius, int slices, int stacks) { - // TODO - - float rho, drho, theta, dtheta; - float x, y, z; - float s, t, ds, dt; - int i, j, imin, imax; - boolean normals; - float nsign; - - normals = (this.normals != GLU.GLU_NONE); - - if (orientation == GLU.GLU_INSIDE) { - nsign = -1.0f; - } else { - nsign = 1.0f; - } - - drho = PI / stacks; - dtheta = 2.0f * PI / slices; - - if (drawStyle == GLU.GLU_FILL) { - if (!textureFlag) { - // draw +Z end as a triangle fan - gl.glBegin(GL.GL_TRIANGLE_FAN); - gl.glNormal3f(0.0f, 0.0f, 1.0f); - gl.glVertex3f(0.0f, 0.0f, nsign * radius); - for (j = 0; j <= slices; j++) { - theta = (j == slices) ? 0.0f : j * dtheta; - x = -sin(theta) * sin(drho); - y = cos(theta) * sin(drho); - z = nsign * cos(drho); - if (normals) { - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - } - gl.glVertex3f(x * radius, y * radius, z * radius); - } - gl.glEnd(); - } - - ds = 1.0f / slices; - dt = 1.0f / stacks; - t = 1.0f; // because loop now runs from 0 - if (textureFlag) { - imin = 0; - imax = stacks; - } else { - imin = 1; - imax = stacks - 1; - } - - // draw intermediate stacks as quad strips - for (i = imin; i < imax; i++) { - rho = i * drho; - gl.glBegin(GL.GL_QUAD_STRIP); - s = 0.0f; - for (j = 0; j <= slices; j++) { - theta = (j == slices) ? 0.0f : j * dtheta; - x = -sin(theta) * sin(rho); - y = cos(theta) * sin(rho); - z = nsign * cos(rho); - if (normals) { - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - } - TXTR_COORD(gl, s, t); - gl.glVertex3f(x * radius, y * radius, z * radius); - x = -sin(theta) * sin(rho + drho); - y = cos(theta) * sin(rho + drho); - z = nsign * cos(rho + drho); - if (normals) { - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - } - TXTR_COORD(gl, s, t - dt); - s += ds; - gl.glVertex3f(x * radius, y * radius, z * radius); - } - gl.glEnd(); - t -= dt; - } - - if (!textureFlag) { - // draw -Z end as a triangle fan - gl.glBegin(GL.GL_TRIANGLE_FAN); - gl.glNormal3f(0.0f, 0.0f, -1.0f); - gl.glVertex3f(0.0f, 0.0f, -radius * nsign); - rho = PI - drho; - s = 1.0f; - for (j = slices; j >= 0; j--) { - theta = (j == slices) ? 0.0f : j * dtheta; - x = -sin(theta) * sin(rho); - y = cos(theta) * sin(rho); - z = nsign * cos(rho); - if (normals) - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - s -= ds; - gl.glVertex3f(x * radius, y * radius, z * radius); - } - gl.glEnd(); - } - } else if ( - drawStyle == GLU.GLU_LINE - || drawStyle == GLU.GLU_SILHOUETTE) { - // draw stack lines - for (i = 1; - i < stacks; - i++) { // stack line at i==stacks-1 was missing here - rho = i * drho; - gl.glBegin(GL.GL_LINE_LOOP); - for (j = 0; j < slices; j++) { - theta = j * dtheta; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - if (normals) - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - gl.glVertex3f(x * radius, y * radius, z * radius); - } - gl.glEnd(); - } - // draw slice lines - for (j = 0; j < slices; j++) { - theta = j * dtheta; - gl.glBegin(GL.GL_LINE_STRIP); - for (i = 0; i <= stacks; i++) { - rho = i * drho; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - if (normals) - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - gl.glVertex3f(x * radius, y * radius, z * radius); - } - gl.glEnd(); - } - } else if (drawStyle == GLU.GLU_POINT) { - // top and bottom-most points - gl.glBegin(GL.GL_POINTS); - if (normals) - gl.glNormal3f(0.0f, 0.0f, nsign); - gl.glVertex3f(0.0f, 0.0f, radius); - if (normals) - gl.glNormal3f(0.0f, 0.0f, -nsign); - gl.glVertex3f(0.0f, 0.0f, -radius); - - // loop over stacks - for (i = 1; i < stacks - 1; i++) { - rho = i * drho; - for (j = 0; j < slices; j++) { - theta = j * dtheta; - x = cos(theta) * sin(rho); - y = sin(theta) * sin(rho); - z = cos(rho); - if (normals) - gl.glNormal3f(x * nsign, y * nsign, z * nsign); - gl.glVertex3f(x * radius, y * radius, z * radius); - } - } - gl.glEnd(); - } - } - - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private static final float PI = (float)Math.PI; - private static final int CACHE_SIZE = 240; - - /** - * Call glNormal3f after scaling normal to unit length. - * - * @param x - * @param y - * @param z - */ - private void normal3f(GL gl, float x, float y, float z) { - float mag; - - mag = (float)Math.sqrt(x * x + y * y + z * z); - if (mag > 0.00001F) { - x /= mag; - y /= mag; - z /= mag; - } - gl.glNormal3f(x, y, z); - } - - private void TXTR_COORD(GL gl, float x, float y) { - if (textureFlag) gl.glTexCoord2f(x,y); - } - - private float sin(float r) { - return (float)Math.sin(r); - } - - private float cos(float r) { - return (float)Math.cos(r); - } -} diff --git a/src/net/java/games/jogl/impl/InternalBufferUtils.java b/src/net/java/games/jogl/impl/InternalBufferUtils.java deleted file mode 100644 index 7ae5efb0e..000000000 --- a/src/net/java/games/jogl/impl/InternalBufferUtils.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.nio.*; - -/** Utility routines available only to the JOGL implementation. */ - -public class InternalBufferUtils { - /** Allocates a new direct byte buffer at the given address with the - given capacity. This is exposed only because of glMapBufferARB - and its semantics; it is undesirable to allocate a new buffer - every frame because (a) ByteBuffers are finalizable and (b) the - application would typically need to re-slice the buffer every - frame. Instead we cache these ByteBuffer objects up in Java and - look them up in a HashMap by base address and capacity. */ - public static native ByteBuffer newDirectByteBuffer(long address, int capacity); -} diff --git a/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java b/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java deleted file mode 100644 index 55eb43d42..000000000 --- a/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -/** Marker class for all window system-specific JAWT data structures. */ - -public interface JAWT_PlatformInfo { -} diff --git a/src/net/java/games/jogl/impl/NativeLibLoader.java b/src/net/java/games/jogl/impl/NativeLibLoader.java deleted file mode 100644 index 54d37f6ce..000000000 --- a/src/net/java/games/jogl/impl/NativeLibLoader.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.security.*; - -public class NativeLibLoader { - private static volatile boolean doLoading = true; - private static volatile boolean doneLoading = false; - - public static void disableLoading() { - doLoading = false; - } - - public static void enableLoading() { - doLoading = true; - } - - public static synchronized void load() { - if (doLoading && !doneLoading) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - boolean isOSX = System.getProperty("os.name").equals("Mac OS X"); - if (!isOSX) { - try { - System.loadLibrary("jawt"); - } catch (UnsatisfiedLinkError e) { - // Accessibility technologies load JAWT themselves; safe to continue - // as long as JAWT is loaded by any loader - if (e.getMessage().indexOf("already loaded") == -1) { - throw e; - } - } - } - System.loadLibrary("jogl"); - - // Workaround for 4845371. - // Make sure the first reference to the JNI GetDirectBufferAddress is done - // from a privileged context so the VM's internal class lookups will succeed. - JAWT jawt = new JAWT(); - JAWTFactory.JAWT_GetAWT(jawt); - - return null; - } - }); - doneLoading = true; - } - } -} diff --git a/src/net/java/games/jogl/impl/Project.java b/src/net/java/games/jogl/impl/Project.java deleted file mode 100755 index 90770309f..000000000 --- a/src/net/java/games/jogl/impl/Project.java +++ /dev/null @@ -1,592 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** $Date$ $Revision$ -** $Header$ -*/ - -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ -package net.java.games.jogl.impl; - -import net.java.games.jogl.*; -import net.java.games.jogl.util.*; - -import java.nio.DoubleBuffer; - -/** - * Project.java - *

- *

- * Created 11-jan-2004 - * - * @author Erik Duijs - * @author Kenneth Russell - */ -class Project { - private static final double[] IDENTITY_MATRIX = - new double[] { - 1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0 }; - - private final DoubleBuffer matrix = BufferUtils.newDoubleBuffer(16); - private final double[] finalMatrix = new double[16]; - - private final double[][] tempMatrix = new double[4][4]; - private final double[] in = new double[4]; - private final double[] out = new double[4]; - - private final double[] forward = new double[3]; - private final double[] side = new double[3]; - private final double[] up = new double[3]; - - /** - * Make matrix an identity matrix - */ - private void __gluMakeIdentityd(DoubleBuffer m) { - int oldPos = m.position(); - m.put(IDENTITY_MATRIX); - m.position(oldPos); - } - - private void __gluMakeIdentityd(double[] m) { - for (int i = 0; i < 16; i++) { - m[i] = IDENTITY_MATRIX[i]; - } - } - - /** - * Method __gluMultMatrixVecd - * - * @param matrix - * @param in - * @param out - */ - private void __gluMultMatrixVecd(double[] matrix, double[] in, double[] out) { - for (int i = 0; i < 4; i++) { - out[i] = - in[0] * matrix[0*4+i] + - in[1] * matrix[1*4+i] + - in[2] * matrix[2*4+i] + - in[3] * matrix[3*4+i]; - - } - } - - /** - * @param src - * @param inverse - * - * @return - */ - private boolean __gluInvertMatrixd(double[] src, double[] inverse) { - int i, j, k, swap; - double t; - double[][] temp = tempMatrix; - - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - temp[i][j] = src[i*4+j]; - } - } - __gluMakeIdentityd(inverse); - - for (i = 0; i < 4; i++) { - /* - * * Look for largest element in column - */ - swap = i; - for (j = i + 1; j < 4; j++) { - if (Math.abs(temp[j][i]) > Math.abs(temp[i][i])) { - swap = j; - } - } - - if (swap != i) { - /* - * * Swap rows. - */ - for (k = 0; k < 4; k++) { - t = temp[i][k]; - temp[i][k] = temp[swap][k]; - temp[swap][k] = t; - - t = inverse[i*4+k]; - inverse[i*4+k] = inverse[swap*4+k]; - inverse[swap*4+k] = t; - } - } - - if (temp[i][i] == 0) { - /* - * No non-zero pivot. The matrix is singular, which shouldn't - * happen. This means the user gave us a bad matrix. - */ - return false; - } - - t = temp[i][i]; - for (k = 0; k < 4; k++) { - temp[i][k] /= t; - inverse[i*4+k] /= t; - } - for (j = 0; j < 4; j++) { - if (j != i) { - t = temp[j][i]; - for (k = 0; k < 4; k++) { - temp[j][k] -= temp[i][k] * t; - inverse[j*4+k] -= inverse[i*4+k]*t; - } - } - } - } - return true; - } - - /** - * @param a - * @param b - * @param r - */ - private void __gluMultMatricesd(double[] a, double[] b, double[] r) { - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - r[i*4+j] = - a[i*4+0]*b[0*4+j] + - a[i*4+1]*b[1*4+j] + - a[i*4+2]*b[2*4+j] + - a[i*4+3]*b[3*4+j]; - } - } - } - - /** - * Normalize vector - * - * @param v - */ - private static void normalize(double[] v) { - double r; - - r = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - if ( r == 0.0 ) - return; - - r = 1.0 / r; - - v[0] *= r; - v[1] *= r; - v[2] *= r; - - return; - } - - /** - * Calculate cross-product - * - * @param v1 - * @param v2 - * @param result - */ - private static void cross(double[] v1, double[] v2, double[] result) { - result[0] = v1[1] * v2[2] - v1[2] * v2[1]; - result[1] = v1[2] * v2[0] - v1[0] * v2[2]; - result[2] = v1[0] * v2[1] - v1[1] * v2[0]; - } - - /** - * Method gluOrtho2D. - * - * @param left - * @param right - * @param bottom - * @param top - */ - public void gluOrtho2D(GL gl, double left, double right, double bottom, double top) { - gl.glOrtho(left, right, bottom, top, -1, 1); - } - - /** - * Method gluPerspective. - * - * @param fovy - * @param aspect - * @param zNear - * @param zFar - */ - public void gluPerspective(GL gl, double fovy, double aspect, double zNear, double zFar) { - double sine, cotangent, deltaZ; - double radians = fovy / 2 * Math.PI / 180; - - deltaZ = zFar - zNear; - sine = Math.sin(radians); - - if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) { - return; - } - - cotangent = Math.cos(radians) / sine; - - __gluMakeIdentityd(matrix); - - matrix.put(0 * 4 + 0, cotangent / aspect); - matrix.put(1 * 4 + 1, cotangent); - matrix.put(2 * 4 + 2, - (zFar + zNear) / deltaZ); - matrix.put(2 * 4 + 3, -1); - matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ); - matrix.put(3 * 4 + 3, 0); - - gl.glMultMatrixd(matrix); - } - - /** - * Method gluLookAt - * - * @param eyex - * @param eyey - * @param eyez - * @param centerx - * @param centery - * @param centerz - * @param upx - * @param upy - * @param upz - */ - public void gluLookAt(GL gl, - double eyex, - double eyey, - double eyez, - double centerx, - double centery, - double centerz, - double upx, - double upy, - double upz) { - double[] forward = this.forward; - double[] side = this.side; - double[] up = this.up; - - forward[0] = centerx - eyex; - forward[1] = centery - eyey; - forward[2] = centerz - eyez; - - up[0] = upx; - up[1] = upy; - up[2] = upz; - - normalize(forward); - - /* Side = forward x up */ - cross(forward, up, side); - normalize(side); - - /* Recompute up as: up = side x forward */ - cross(side, forward, up); - - __gluMakeIdentityd(matrix); - matrix.put(0 * 4 + 0, side[0]); - matrix.put(1 * 4 + 0, side[1]); - matrix.put(2 * 4 + 0, side[2]); - - matrix.put(0 * 4 + 1, up[0]); - matrix.put(1 * 4 + 1, up[1]); - matrix.put(2 * 4 + 1, up[2]); - - matrix.put(0 * 4 + 2, -forward[0]); - matrix.put(1 * 4 + 2, -forward[1]); - matrix.put(2 * 4 + 2, -forward[2]); - - gl.glMultMatrixd(matrix); - gl.glTranslated(-eyex, -eyey, -eyez); - } - - /** - * Method gluProject - * - * @param objx - * @param objy - * @param objz - * @param modelMatrix - * @param projMatrix - * @param viewport - * @param win_pos - * - * @return - */ - public boolean gluProject(double objx, - double objy, - double objz, - double[] modelMatrix, - double[] projMatrix, - int[] viewport, - double[] win_pos) { - - double[] in = this.in; - double[] out = this.out; - - in[0] = objx; - in[1] = objy; - in[2] = objz; - in[3] = 1.0; - - __gluMultMatrixVecd(modelMatrix, in, out); - __gluMultMatrixVecd(projMatrix, out, in); - - if (in[3] == 0.0) - return false; - - in[3] = (1.0 / in[3]) * 0.5; - - // Map x, y and z to range 0-1 - in[0] = in[0] * in[3] + 0.5f; - in[1] = in[1] * in[3] + 0.5f; - in[2] = in[2] * in[3] + 0.5f; - - // Map x,y to viewport - win_pos[0] = in[0] * viewport[2] + viewport[0]; - win_pos[1] = in[1] * viewport[3] + viewport[1]; - win_pos[2] = in[2]; - - return true; - } - - /** - * Method gluUnproject - * - * @param winx - * @param winy - * @param winz - * @param modelMatrix - * @param projMatrix - * @param viewport - * @param obj_pos - * - * @return - */ - public boolean gluUnProject(double winx, - double winy, - double winz, - double[] modelMatrix, - double[] projMatrix, - int[] viewport, - double[] obj_pos) { - double[] in = this.in; - double[] out = this.out; - - __gluMultMatricesd(modelMatrix, projMatrix, finalMatrix); - - if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) - return false; - - in[0] = winx; - in[1] = winy; - in[2] = winz; - in[3] = 1.0; - - // Map x and y from window coordinates - in[0] = (in[0] - viewport[0]) / viewport[2]; - in[1] = (in[1] - viewport[1]) / viewport[3]; - - // Map to range -1 to 1 - in[0] = in[0] * 2 - 1; - in[1] = in[1] * 2 - 1; - in[2] = in[2] * 2 - 1; - - __gluMultMatrixVecd(finalMatrix, in, out); - - if (out[3] == 0.0) - return false; - - out[3] = 1.0 / out[3]; - - obj_pos[0] = out[0] * out[3]; - obj_pos[1] = out[1] * out[3]; - obj_pos[2] = out[2] * out[3]; - - return true; - } - - /** - * Method gluUnproject4 - * - * @param winx - * @param winy - * @param winz - * @param clipw - * @param modelMatrix - * @param projMatrix - * @param viewport - * @param near - * @param far - * @param obj_pos - * - * @return - */ - public boolean gluUnProject4(double winx, - double winy, - double winz, - double clipw, - double[] modelMatrix, - double[] projMatrix, - int[] viewport, - double near, - double far, - double[] obj_pos) { - double[] in = this.in; - double[] out = this.out; - - __gluMultMatricesd(modelMatrix, projMatrix, finalMatrix); - - if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) - return false; - - in[0] = winx; - in[1] = winy; - in[2] = winz; - in[3] = clipw; - - // Map x and y from window coordinates - in[0] = (in[0] - viewport[0]) / viewport[2]; - in[1] = (in[1] - viewport[1]) / viewport[3]; - in[2] = (in[2] - near) / (far - near); - - // Map to range -1 to 1 - in[0] = in[0] * 2 - 1; - in[1] = in[1] * 2 - 1; - in[2] = in[2] * 2 - 1; - - __gluMultMatrixVecd(finalMatrix, in, out); - - if (out[3] == 0.0) - return false; - - obj_pos[0] = out[0]; - obj_pos[1] = out[1]; - obj_pos[2] = out[2]; - obj_pos[3] = out[3]; - return true; - } - - /** - * Method gluPickMatrix - * - * @param x - * @param y - * @param deltaX - * @param deltaY - * @param viewport - */ - public void gluPickMatrix(GL gl, - double x, - double y, - double deltaX, - double deltaY, - int[] viewport) { - if (deltaX <= 0 || deltaY <= 0) { - return; - } - - /* Translate and scale the picked region to the entire window */ - gl.glTranslated((viewport[2] - 2 * (x - viewport[0])) / deltaX, - (viewport[3] - 2 * (y - viewport[1])) / deltaY, - 0); - gl.glScaled(viewport[2] / deltaX, viewport[3] / deltaY, 1.0); - } -} diff --git a/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java b/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java deleted file mode 100755 index f19c1fb67..000000000 --- a/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** Encapsulates the workaround of running all display operations on - the AWT event queue thread for the purposes of working around - problems seen primarily on ATI cards when rendering into a surface - that is simultaneously being resized by the event queue thread. -

- - As of JOGL 1.1 b10, this property defaults to true. Problems have - been seen on Windows, Linux and Mac OS X platforms that are solved - by switching all OpenGL work to a single thread, which this - workaround provides. The forthcoming JSR-231 work will rethink how - such a mechanism is implemented, but the core result of needing to - perform all OpenGL work on a single thread for best compatibility - will remain. -*/ - -public class SingleThreadedWorkaround { - private static boolean singleThreadedWorkaround = true; - // If the user specified the workaround's system property (either - // true or false), don't let the automatic detection have any effect - private static boolean systemPropertySpecified = false; - - static { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String workaround = System.getProperty("jogl.1thread"); - if (workaround == null) { - // Old system property (for compatibility) - workaround = System.getProperty("JOGL_SINGLE_THREADED_WORKAROUND"); - } - if (workaround == null) { - // Older system property (for compatibility) - workaround = System.getProperty("ATI_WORKAROUND"); - } - if (workaround != null && (!workaround.equals("auto"))) { - systemPropertySpecified = true; - singleThreadedWorkaround = Boolean.valueOf(workaround).booleanValue(); - } - printWorkaroundNotice(); - return null; - } - }); - } - - /** Public method for users to disable the single-threaded - workaround in application code. Should perhaps eventually - promote this method to the public API. */ - public static void disableWorkaround() { - systemPropertySpecified = true; - singleThreadedWorkaround = false; - if (Debug.verbose()) { - System.err.println("Application forced disabling of single-threaded workaround of dispatching display() on event thread"); - } - } - - public static void shouldDoWorkaround() { - if (!systemPropertySpecified) { - singleThreadedWorkaround = true; - printWorkaroundNotice(); - } - } - - public static boolean doWorkaround() { - return singleThreadedWorkaround; - } - - private static void printWorkaroundNotice() { - if (singleThreadedWorkaround && Debug.verbose()) { - System.err.println("Using single-threaded workaround of dispatching display() on event thread"); - } - } -} diff --git a/src/net/java/games/jogl/impl/Util.java b/src/net/java/games/jogl/impl/Util.java deleted file mode 100755 index 46bdfc79a..000000000 --- a/src/net/java/games/jogl/impl/Util.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -package net.java.games.jogl.impl; - -import java.nio.IntBuffer; -import net.java.games.jogl.*; - -/** - * Util.java - *

- *

- * Created 7-jan-2004 - * - * @author Erik Duijs - */ -class Util { - - /** - * temp int[] of one for getting an int from some GL functions - */ - private int[] scratch = new int[1]; - - /** - * Return ceiling of integer division - * - * @param a - * @param b - * - * @return int - */ - protected static int ceil(int a, int b) { - return (a % b == 0 ? a / b : a / b + 1); - } - - /** - * Method compPerPix. - * - * @param format - * - * @return int - */ - protected static int compPerPix(int format) { - /* Determine number of components per pixel */ - switch ( format ) { - case GL.GL_COLOR_INDEX: - case GL.GL_STENCIL_INDEX: - case GL.GL_DEPTH_COMPONENT: - case GL.GL_RED: - case GL.GL_GREEN: - case GL.GL_BLUE: - case GL.GL_ALPHA: - case GL.GL_LUMINANCE: - return 1; - case GL.GL_LUMINANCE_ALPHA: - return 2; - case GL.GL_RGB: - case GL.GL_BGR: - return 3; - case GL.GL_RGBA: - case GL.GL_BGRA: - return 4; - default : - return -1; - } - } - - /** - * Method nearestPower. - *

- * Compute the nearest power of 2 number. This algorithm is a little strange, but it works quite well. - * - * @param value - * - * @return int - */ - protected static int nearestPower(int value) { - int i; - - i = 1; - - /* Error! */ - if ( value == 0 ) - return -1; - - for ( ; ; ) { - if ( value == 1 ) { - return i; - } else if ( value == 3 ) { - return i << 2; - } - value >>= 1; - i <<= 1; - } - } - - /** - * Method bytesPerPixel. - * - * @param format - * @param type - * - * @return int - */ - protected static int bytesPerPixel(int format, int type) { - int n, m; - - switch ( format ) { - case GL.GL_COLOR_INDEX: - case GL.GL_STENCIL_INDEX: - case GL.GL_DEPTH_COMPONENT: - case GL.GL_RED: - case GL.GL_GREEN: - case GL.GL_BLUE: - case GL.GL_ALPHA: - case GL.GL_LUMINANCE: - n = 1; - break; - case GL.GL_LUMINANCE_ALPHA: - n = 2; - break; - case GL.GL_RGB: - case GL.GL_BGR: - n = 3; - break; - case GL.GL_RGBA: - case GL.GL_BGRA: - n = 4; - break; - default : - n = 0; - } - - switch ( type ) { - case GL.GL_UNSIGNED_BYTE: - m = 1; - break; - case GL.GL_BYTE: - m = 1; - break; - case GL.GL_BITMAP: - m = 1; - break; - case GL.GL_UNSIGNED_SHORT: - m = 2; - break; - case GL.GL_SHORT: - m = 2; - break; - case GL.GL_UNSIGNED_INT: - m = 4; - break; - case GL.GL_INT: - m = 4; - break; - case GL.GL_FLOAT: - m = 4; - break; - default : - m = 0; - } - - return n * m; - } - - /** - * Convenience method for returning an int, rather than getting it out of a buffer yourself. - * - * @param what - * - * @return int - */ - protected int glGetIntegerv(GL gl, int what) { - gl.glGetIntegerv(what, scratch); - return scratch[0]; - } -} diff --git a/src/net/java/games/jogl/impl/error/Error.java b/src/net/java/games/jogl/impl/error/Error.java deleted file mode 100644 index a9b4c48f1..000000000 --- a/src/net/java/games/jogl/impl/error/Error.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.error; - -import net.java.games.jogl.GL; -import net.java.games.jogl.GLU; -import net.java.games.jogl.impl.GLUImpl; - -/** - * - * @author Administrator - */ -public class Error { - - private static String[] glErrorStrings = { - "invalid enumerant", - "invalid value", - "invalid operation", - "stack overflow", - "stack underflow", - "out of memory" - }; - - private static String[] gluErrorStrings = { - "invalid enumerant", - "invalid value", - "out of memory", - "", - "invalid operation" - }; - - /** Creates a new instance of Error */ - public Error() { - } - - public static String gluErrorString( int errorCode ) { - if( errorCode == 0 ) { - return( "no error" ); - } - if( (errorCode >= GL.GL_INVALID_ENUM) && (errorCode <= GL.GL_OUT_OF_MEMORY) ) { - return( glErrorStrings[ errorCode - GL.GL_INVALID_ENUM ] ); - } - if( errorCode == GL.GL_TABLE_TOO_LARGE ) { - return( "table too large" ); - } - if( (errorCode >= GLUImpl.GLU_INVALID_ENUM) && (errorCode <= GLUImpl.GLU_INVALID_OPERATION) ) { - return( gluErrorStrings[ errorCode - GLUImpl.GLU_INVALID_ENUM ] ); - } - if( (errorCode >= GLUImpl.GLU_NURBS_ERROR1) && (errorCode <= GLUImpl.GLU_NURBS_ERROR37) ) { - return( gluErrorStrings[ errorCode - (GLUImpl.GLU_NURBS_ERROR1 - 1) ] ); - } - if( (errorCode >= GLUImpl.GLU_TESS_ERROR1) && (errorCode <= GLUImpl.GLU_TESS_ERROR8) ) { - return( gluErrorStrings[ errorCode - (GLUImpl.GLU_TESS_ERROR1 - 1) ] ); - } - return( null ); - } -} diff --git a/src/net/java/games/jogl/impl/glue/Glue.java b/src/net/java/games/jogl/impl/glue/Glue.java deleted file mode 100644 index 65ba2ad9d..000000000 --- a/src/net/java/games/jogl/impl/glue/Glue.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.glue; - -/** - * - * @author Administrator - */ -public class Glue { - private static String[] __gluNurbsErrors = { - " ", - "spline order un-supported", - "too few knots", - "valid knot range is empty", - "decreasing knot sequence knot", - "knot multiplicity greater than order of spline", - "gluEndCurve() must follow gluBeginCurve()", - "gluBeginCurve() must precede gluEndCurve()", - "missing or extra geometric data", - "can't draw piecewise linear trimming curves", - "missing or extra domain data", - "missing or extra domain data", - "gluEndTrim() must precede gluEndSurface()", - "gluBeginSurface() must precede gluEndSurface()", - "curve of improper type passed as trim curve", - "gluBeginSurface() must precede gluBeginTrim()", - "gluEndTrim() must follow gluBeginTrim()", - "gluBeginTrim() must follow gluEndTrim()", - "invalid or missing trim curve", - "gluBeginTrim() must precede gluPwlCurve()", - "piecewise linear trimming curve referenced twice", - "piecewise linear trimming curve and nurbs curve mixed", - "improper usage of trim data type", - "nurbs curve referenced twice", - "nurbs curve and piecewise linear trimming curve mixed", - "nurbs surface referenced twice", - "invalid property", - "gluEndSurface() must follow gluBeginSurface()", - "intersecting or misoriented trim curve", - "intersecting trim curves", - "UNUSED", - "inconnected trim curves", - "unknown knot error", - "negative vertex count encountered", - "negative byte-stride encountered", - "unknown type descriptor", - "null control point reference", - "duplicate point on piecewise linear trimming curve" - } ; - - /** Creates a new instance of Glue */ - public Glue() { - } - - public static String __gluNURBSErrorString( int errno ) { - return( __gluNurbsErrors[ errno ] ); - } - - private static String[] __gluTessErrors = { - " ", - "gluTessBeginPolygon() must precede a gluTessEndPolygon", - "gluTessBeginContour() must precede a gluTessEndContour()", - "gluTessEndPolygon() must follow a gluTessBeginPolygon()", - "gluTessEndContour() must follow a gluTessBeginContour()", - "a coordinate is too large", - "need combine callback" - }; - - public static String __gluTessErrorString( int errno ) { - return( __gluTessErrors[ errno ] ); - } -} diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java deleted file mode 100644 index 29a3ef63b..000000000 --- a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.macosx; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -/** This MacOSXGLContext implementation provides interoperability with - the NSOpenGLView Cocoa widget. The MacOSXGLImpl can be - instantiated without a GLContext, in which case it expects that - the end user will handle all OpenGL context management. Dynamic - function lookup is supported in this configuration by having this - object provide the FunctionAvailabilityTable. */ - -class MacOSXDummyGLContext extends MacOSXGLContext -{ - private MacOSXGLImpl gl; - - MacOSXDummyGLContext(MacOSXGLImpl gl) { - super(null, null, null, null); - this.gl = gl; - } - - protected GL createGL() { - return gl; - } - - protected boolean isOffscreen() { - return false; - } - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - public boolean canCreatePbufferContext() { - throw new GLException("Should not call this"); - } - - public synchronized GLContext createPbufferContext(GLCapabilities capabilities, int initialWidth, int initialHeight) { - throw new GLException("Should not call this"); - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - throw new GLException("Should not call this"); - } - - public synchronized void swapBuffers() throws GLException { - throw new GLException("Should not call this"); - } - - protected synchronized void free() throws GLException { - throw new GLException("Should not call this"); - } - - protected boolean create() { - throw new GLException("Should not call this"); - } - - public void destroy() { - throw new GLException("Should not call this"); - } - - public void resetGLFunctionAvailability() { - super.resetGLFunctionAvailability(); - } -} diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java deleted file mode 100644 index ec58de9a6..000000000 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.macosx; - -import java.awt.Component; -import java.util.*; -import net.java.games.gluegen.runtime.*; // for PROCADDRESS_VAR_PREFIX -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public abstract class MacOSXGLContext extends GLContext -{ - private static JAWT jawt; - protected long nsContext; // NSOpenGLContext - protected long nsView; // NSView - protected long updater; // ContextUpdater - // Table that holds the addresses of the native C-language entry points for - // OpenGL functions. - private GLProcAddressTable glProcAddressTable; - - public MacOSXGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) - { - super(component, capabilities, chooser, shareWith); - } - - protected GL createGL() - { - return new MacOSXGLImpl(this); - } - - protected String mapToRealGLFunctionName(String glFunctionName) - { - return glFunctionName; - } - - protected String mapToRealGLExtensionName(String glExtensionName) - { - return glExtensionName; - } - - protected boolean isFunctionAvailable(String glFunctionName) - { - return super.isFunctionAvailable(glFunctionName); - } - - public boolean isExtensionAvailable(String glExtensionName) { - if (glExtensionName.equals("GL_ARB_pbuffer") || - glExtensionName.equals("GL_ARB_pixel_format")) { - return true; - } - return super.isExtensionAvailable(glExtensionName); - } - - protected abstract boolean isOffscreen(); - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextWidth() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextHeight() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextPixelDataType() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - protected boolean create() { - return create(false, false); - } - - /** - * Creates and initializes an appropriate OpenGl nsContext. Should only be - * called by {@link makeCurrent(Runnable)}. - */ - protected boolean create(boolean pbuffer, boolean floatingPoint) { - MacOSXGLContext other = (MacOSXGLContext) GLContextShareSet.getShareContext(this); - long share = 0; - if (other != null) { - share = other.getNSContext(); - if (share == 0) { - throw new GLException("GLContextShareSet returned an invalid OpenGL context"); - } - } - int[] viewNotReady = new int[1]; - nsContext = CGL.createContext(share, - nsView, - capabilities.getDoubleBuffered() ? 1 : 0, - capabilities.getStereo() ? 1 : 0, - capabilities.getRedBits(), - capabilities.getGreenBits(), - capabilities.getBlueBits(), - capabilities.getAlphaBits(), - capabilities.getDepthBits(), - capabilities.getStencilBits(), - capabilities.getAccumRedBits(), - capabilities.getAccumGreenBits(), - capabilities.getAccumBlueBits(), - capabilities.getAccumAlphaBits(), - capabilities.getSampleBuffers() ? 1 : 0, - capabilities.getNumSamples(), - (pbuffer ? 1 : 0), - (floatingPoint ? 1 : 0), - viewNotReady); - if (nsContext == 0) { - if (viewNotReady[0] == 1) { - if (DEBUG) { - System.err.println("!!! View not ready for " + getClass().getName()); - } - // View not ready at the window system level -- this is OK - return false; - } - throw new GLException("Error creating nsContext"); - } - //updater = CGL.updateContextRegister(nsContext, nsView); // gznote: not thread safe yet! - GLContextShareSet.contextCreated(this); - return true; - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - boolean created = false; - if (nsContext == 0) { - if (!create()) { - return false; - } - if (DEBUG) { - System.err.println("!!! Created GL nsContext for " + getClass().getName()); - } - created = true; - } - - if (!CGL.makeCurrentContext(nsContext, nsView)) { - throw new GLException("Error making nsContext current"); - } - - if (created) { - resetGLFunctionAvailability(); - if (initAction != null) { - initAction.run(); - } - } - return true; - } - - protected synchronized void free() throws GLException { - if (!CGL.clearCurrentContext(nsContext, nsView)) { - throw new GLException("Error freeing OpenGL nsContext"); - } - } - - protected void destroyImpl() throws GLException { - if (nsContext != 0) { - if (!CGL.deleteContext(nsContext, 0)) { - throw new GLException("Unable to delete OpenGL context"); - } - if (DEBUG) { - System.err.println("!!! Destroyed OpenGL context " + nsContext); - } - nsContext = 0; - } - } - - public abstract void swapBuffers() throws GLException; - - protected long dynamicLookupFunction(String glFuncName) { - return CGL.getProcAddress(glFuncName); - } - - public boolean isCreated() { - return (nsContext != 0); - } - - protected void resetGLFunctionAvailability() - { - super.resetGLFunctionAvailability(); - if (DEBUG) { - System.err.println("!!! Initializing OpenGL extension address table"); - } - resetProcAddressTable(getGLProcAddressTable()); - } - - public GLProcAddressTable getGLProcAddressTable() - { - if (glProcAddressTable == null) { - // FIXME: cache ProcAddressTables by capability bits so we can - // share them among contexts with the same capabilities - glProcAddressTable = new GLProcAddressTable(); - } - return glProcAddressTable; - } - - public String getPlatformExtensionsString() - { - return ""; - } - - public void setSwapInterval(int interval) { - if (nsContext == 0) { - throw new GLException("OpenGL context not current"); - } - CGL.setSwapInterval(nsContext, interval); - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected long getNSContext() { - return nsContext; - } - - protected long getNSView() { - return nsView; - } - - protected JAWT getJAWT() - { - if (jawt == null) - { - JAWT j = new JAWT(); - j.version(JAWTFactory.JAWT_VERSION_1_4); - if (!JAWTFactory.JAWT_GetAWT(j)) - { - throw new RuntimeException("Unable to initialize JAWT"); - } - jawt = j; - } - return jawt; - } -} diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java deleted file mode 100644 index 25f15b3f2..000000000 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.macosx; - -import java.awt.Component; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class MacOSXGLContextFactory extends GLContextFactory { - public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device) { - return null; - } - - public GLContext createGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - if (component != null) { - return new MacOSXOnscreenGLContext(component, capabilities, chooser, shareWith); - } else { - return new MacOSXOffscreenGLContext(capabilities, chooser, shareWith); - } - } -} diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java deleted file mode 100644 index 37b2302c0..000000000 --- a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.macosx; - -import java.awt.image.BufferedImage; -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class MacOSXOffscreenGLContext extends MacOSXPbufferGLContext -{ - public MacOSXOffscreenGLContext(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(capabilities, -1, -1); - } - - protected boolean isOffscreen() { - return true; - } - - public boolean offscreenImageNeedsVerticalFlip() { - return true; - } - - public int getOffscreenContextWidth() { - return initWidth; - } - - public int getOffscreenContextHeight() { - return initWidth; - } - - public int getOffscreenContextPixelDataType() { - return GL.GL_UNSIGNED_INT_8_8_8_8_REV; - } - - public int getOffscreenContextReadBuffer() { - return GL.GL_BACK; - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - if (pendingOffscreenResize && (nsContext != 0)) { - if (pendingOffscreenWidth != width || pendingOffscreenHeight != height) { - destroyPBuffer(); - initWidth = pendingOffscreenWidth; - initHeight = pendingOffscreenHeight; - createPbuffer(0, 0); - pendingOffscreenResize = false; - } - } - return super.makeCurrent(initAction); - } - - public synchronized void swapBuffers() throws GLException { - } -} diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java deleted file mode 100644 index ba4eee0ef..000000000 --- a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.macosx; - -import java.awt.Component; -import java.util.*; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -import java.security.*; - -public class MacOSXOnscreenGLContext extends MacOSXGLContext { - // Variables for lockSurface/unlockSurface - private JAWT_DrawingSurface ds; - private JAWT_DrawingSurfaceInfo dsi; - private JAWT_MacOSXDrawingSurfaceInfo macosxdsi; - - // Variables for pbuffer support - List pbuffersToInstantiate = new ArrayList(); - - // Workaround for instance of 4796548 - private boolean firstLock = true; - - public MacOSXOnscreenGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(component, capabilities, chooser, shareWith); - } - - protected boolean isOffscreen() { - return false; - } - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - public boolean canCreatePbufferContext() { - return true; - } - - public synchronized GLContext createPbufferContext(GLCapabilities capabilities, int initialWidth, int initialHeight) { - MacOSXPbufferGLContext ctx = new MacOSXPbufferGLContext(capabilities, initialWidth, initialHeight); - GLContextShareSet.registerSharing(this, ctx); - pbuffersToInstantiate.add(ctx); - return ctx; - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - public synchronized void setRenderingThread(Thread currentThreadOrNull, Runnable initAction) { - this.willSetRenderingThread = false; - // FIXME: the JAWT in the Panther developer release - // requires all JAWT operations to be done on the AWT - // thread. This means that setRenderingThread won't work - // yet on this platform. This method can be deleted once - // the update for that release ships. - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - try { - if (!lockSurface()) { - return false; - } - boolean ret = super.makeCurrent(initAction); - if (ret) { - // Assume the canvas might have been resized or moved and tell the OpenGL - // context to update itself. This used to be done only upon receiving a - // reshape event but that doesn't appear to be sufficient. An experiment - // was also done to add a HierarchyBoundsListener to the GLCanvas and - // do this updating only upon reshape of this component or reshape or movement - // of an ancestor, but this also wasn't sufficient and left garbage on the - // screen in some situations. - CGL.updateContext(nsContext, nsView); - // Instantiate any pending pbuffers - while (!pbuffersToInstantiate.isEmpty()) { - MacOSXPbufferGLContext ctx = - (MacOSXPbufferGLContext) pbuffersToInstantiate.remove(pbuffersToInstantiate.size() - 1); - ctx.createPbuffer(nsView, nsContext); - } - } else { - // View might not have been ready - unlockSurface(); - } - return ret; - } catch (RuntimeException e) { - try { - unlockSurface(); - } catch (Exception e2) { - // do nothing if unlockSurface throws - } - throw(e); - } - } - - protected synchronized void free() throws GLException { - try { - super.free(); - } finally { - unlockSurface(); - } - } - - public synchronized void swapBuffers() throws GLException { - if (!CGL.flushBuffer(nsContext, nsView)) { - throw new GLException("Error swapping buffers"); - } - } - - private boolean lockSurface() throws GLException { - if (nsView != 0) { - throw new GLException("Surface already locked"); - } - - ds = getJAWT().GetDrawingSurface(component); - if (ds == null) { - // Widget not yet realized - return false; - } - - int res = ds.Lock(); - if ((res & JAWTFactory.JAWT_LOCK_ERROR) != 0) { - throw new GLException("Unable to lock surface"); - } - - // See whether the surface changed and if so destroy the old - // OpenGL nsContext so it will be recreated - if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { - if (nsContext != 0) { - //CGL.updateContextUnregister(nsContext, nsView, updater); // gznote: not thread safe yet! - if (!CGL.deleteContext(nsContext, nsView)) { - throw new GLException("Unable to delete old GL nsContext after surface changed"); - } - } - } - - if (firstLock) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - dsi = ds.GetDrawingSurfaceInfo(); - return null; - } - }); - } else { - dsi = ds.GetDrawingSurfaceInfo(); - } - if (dsi == null) { - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - - // Widget not yet realized - return false; - } - - firstLock = false; - - macosxdsi = (JAWT_MacOSXDrawingSurfaceInfo) dsi.platformInfo(); - if (macosxdsi == null) { - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - - // Widget not yet realized - return false; - } - - nsView = macosxdsi.cocoaViewRef(); - if (nsView == 0) { - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - macosxdsi = null; - - // Widget not yet realized - return false; - } - - return true; - } - - private void unlockSurface() throws GLException { - if (nsView == 0) { - throw new GLException("Surface already unlocked"); - } - - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - macosxdsi = null; - nsView = 0; - } -} diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java deleted file mode 100644 index 93bde269b..000000000 --- a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java +++ /dev/null @@ -1,203 +0,0 @@ -package net.java.games.jogl.impl.macosx; - -import java.security.*; -import java.util.*; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class MacOSXPbufferGLContext extends MacOSXGLContext { - private static final boolean DEBUG = Debug.debug("MacOSXPbufferGLContext"); - private static boolean isTigerOrLater; - - static { - String osVersion = - (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return System.getProperty("os.version"); - } - }); - StringTokenizer tok = new StringTokenizer(osVersion, ". "); - int major = Integer.parseInt(tok.nextToken()); - int minor = Integer.parseInt(tok.nextToken()); - isTigerOrLater = ((major > 10) || (minor > 3)); - } - - protected int initWidth; - protected int initHeight; - - private long pBuffer; - - protected int width; - protected int height; - - // State for render-to-texture and render-to-texture-rectangle support - private boolean created; - private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV - private int texture; // actual texture object - - public MacOSXPbufferGLContext(GLCapabilities capabilities, int initialWidth, int initialHeight) { - super(null, capabilities, null, null); - this.initWidth = initialWidth; - this.initHeight = initialHeight; - } - - public boolean canCreatePbufferContext() { - return false; - } - - public GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - public void bindPbufferToTexture() { - GL gl = getGL(); - gl.glBindTexture(textureTarget, texture); - // FIXME: not clear whether this is really necessary, but since - // the API docs seem to imply it is and since it doesn't seem to - // impact performance, leaving it in - CGL.setContextTextureImageToPBuffer(nsContext, pBuffer, GL.GL_FRONT); - } - - public void releasePbufferFromTexture() { - } - - public void createPbuffer(long parentView, long parentContext) { - GL gl = getGL(); - // Must initally grab OpenGL function pointers while parent's - // context is current because otherwise we don't have the cgl - // extensions available to us - resetGLFunctionAvailability(); - - int renderTarget; - if (capabilities.getOffscreenRenderToTextureRectangle()) { - width = initWidth; - height = initHeight; - renderTarget = GL.GL_TEXTURE_RECTANGLE_EXT; - } else { - width = getNextPowerOf2(initWidth); - height = getNextPowerOf2(initHeight); - renderTarget = GL.GL_TEXTURE_2D; - } - - int internalFormat = GL.GL_RGBA; - if (capabilities.getOffscreenFloatingPointBuffers()) { - if (!gl.isExtensionAvailable("GL_APPLE_float_pixels")) { - throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available"); - } - switch (capabilities.getRedBits()) { - case 16: internalFormat = GL.GL_RGBA_FLOAT16_APPLE; break; - case 32: internalFormat = GL.GL_RGBA_FLOAT32_APPLE; break; - default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)"); - } - } - - pBuffer = CGL.createPBuffer(renderTarget, internalFormat, width, height); - if (pBuffer == 0) { - throw new GLException("pbuffer creation error: CGL.createPBuffer() failed"); - } - - if (DEBUG) { - System.err.println("Created pbuffer 0x" + Long.toHexString(pBuffer) + ", " + width + " x " + height + " for " + this); - } - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - created = false; - - if (pBuffer == 0) { - if (DEBUG) { - System.err.println("Pbuffer not instantiated yet for " + this); - } - // pbuffer not instantiated yet - return false; - } - - boolean res = super.makeCurrent(initAction); - if (created) { - // Initialize render-to-texture support if requested - boolean rect = capabilities.getOffscreenRenderToTextureRectangle(); - GL gl = getGL(); - if (rect) { - if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) { - System.err.println("MacOSXPbufferGLContext: WARNING: GL_EXT_texture_rectangle extension not " + - "supported; skipping requested render_to_texture_rectangle support for pbuffer"); - rect = false; - } - } - textureTarget = (rect ? GL.GL_TEXTURE_RECTANGLE_EXT : GL.GL_TEXTURE_2D); - int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); - texture = tmp[0]; - gl.glBindTexture(textureTarget, texture); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); - gl.glCopyTexImage2D(textureTarget, 0, GL.GL_RGB, 0, 0, width, height, 0); - } - return res; - } - - public void destroyPBuffer() { - if (this.pBuffer != 0) { - CGL.destroyPBuffer(nsContext, pBuffer); - } - this.pBuffer = 0; - - if (DEBUG) { - System.err.println("Destroyed pbuffer " + width + " x " + height); - } - } - - public void handleModeSwitch(long parentView, long parentContext) { - throw new GLException("Not yet implemented"); - } - - protected boolean isOffscreen() { - // FIXME: currently the only caller of this won't cause proper - // resizing of the pbuffer anyway. - return false; - } - - protected void destroyImpl() throws GLException { - destroyPBuffer(); - } - - public void swapBuffers() throws GLException { - // FIXME: do we need to do anything if the pbuffer is double-buffered? - } - - public int getFloatingPointMode() { - return GLPbuffer.APPLE_FLOAT; - } - - private int getNextPowerOf2(int number) { - if (((number-1) & number) == 0) { - //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0 - return number; - } - int power = 0; - while (number > 0) { - number = number>>1; - power++; - } - return (1<= 1 ); - - newwidth = widthPowerOf2; - levels = Mipmap.computeLog( newwidth ); - - levels += userLevel; - - Mipmap.retrieveStoreModes( gl, psm ); - try { - newImage = ByteBuffer.allocateDirect( Mipmap.image_size( width, 1, format, - GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - return( GLU.GLU_OUT_OF_MEMORY ); - } - newImage_width = width; - - Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); - cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); - - // if swap_bytes was set, swapping occurred in fill_image - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); - - for( level = userLevel; level <= levels; level++ ) { - if( newImage_width == newwidth ) { - // user newimage for this level - if( baseLevel <= level && level <= maxLevel ) { - gl.glTexImage1D( target, level, internalFormat, newImage_width, 0, format, - GL.GL_UNSIGNED_SHORT, newImage ); - } - } else { - if( otherImage == null ) { - memreq = Mipmap.image_size( newwidth, 1, format, GL.GL_UNSIGNED_SHORT ); - try { - otherImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - } - ScaleInternal.scale_internal( cmpts, newImage_width, 1, newImage, newwidth, 1, otherImage ); - // swap newImage and otherImage - imageTemp = otherImage; - otherImage = newImage; - newImage = imageTemp; - - newImage_width = newwidth; - if( baseLevel <= level && level <= maxLevel ) { - gl.glTexImage1D( target, level, internalFormat, newImage_width, 0, - format, GL.GL_UNSIGNED_SHORT, newImage ); - } - } - if( newwidth > 1 ) { - newwidth /= 2; - } - } - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - - return( 0 ); - } - - public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, ByteBuffer data ) { - int newwidth[] = new int[1]; - int newheight[] = new int[1]; - int level, levels; - ShortBuffer newImage = null; - int newImage_width; - int newImage_height; - ShortBuffer otherImage = null; - ShortBuffer tempImage = null; - int memreq; - int maxsize; - int cmpts; - PixelStorageModes psm = new PixelStorageModes(); - - Mipmap.retrieveStoreModes( gl, psm ); - - Mipmap.closestFit( gl, target, width, height, internalFormat, format, type, newwidth, newheight ); - - levels = Mipmap.computeLog( newwidth[0] ); - level = Mipmap.computeLog( newheight[0] ); - if( level > levels ) { - levels = level; - } - - try { - newImage = ByteBuffer.allocateDirect( Mipmap.image_size( width, height, - format, GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - return( GLU.GLU_OUT_OF_MEMORY ); - } - newImage_width = width; - newImage_height = height; - - Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); - - cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); - - // if swap_bytes is set, swapping occurred in fill_image - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); - - for( level = 0; level < levels; level++ ) { - if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { - gl.glTexImage2D( target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL.GL_UNSIGNED_SHORT, newImage ); - } else { - if( otherImage == null ) { - memreq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_SHORT ); - try { - otherImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - } - ScaleInternal.scale_internal( cmpts, newImage_width, newImage_height, - newImage, newwidth[0], newheight[0], otherImage ); - // swap newImage and otherImage - tempImage = otherImage; - otherImage = newImage; - newImage = tempImage; - - newImage_width = newwidth[0]; - newImage_height = newheight[0]; - gl.glTexImage2D( target, level, internalFormat, newImage_width, newImage_height, - 0, format, GL.GL_UNSIGNED_SHORT, newImage ); - } - if( newheight[0] > 1 ) { - newwidth[0] /= 2; - } - if( newheight[0] > 1 ) { - newheight[0] /= 2; - } - } - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - - return( 0 ); - } - - public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int widthPowerOf2, int heightPowerOf2, - int format, int type, int userLevel, int baseLevel, int maxLevel, - ByteBuffer data ) { // PointerWrapper data - int newwidth; - int newheight; - int level, levels; - int usersImage; - ByteBuffer srcImage = null; - ByteBuffer dstImage = null; - ByteBuffer tempImage = null; - int newImage_width; - int newImage_height; - short[] SWAP_IMAGE = null; - int memreq; - int maxsize; - int cmpts; - - boolean myswap_bytes; - int groups_per_line, element_size, group_size; - int rowsize, padding; - PixelStorageModes psm = new PixelStorageModes(); - - assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); - assert( width >= 1 && height >= 1 ); - - if( type == GL.GL_BITMAP ) { - return( bitmapBuild2DMipmaps( gl, target, internalFormat, width, height, format, type, data ) ); - } - - newwidth = widthPowerOf2; - newheight = heightPowerOf2; - levels = Mipmap.computeLog( newwidth ); - level = Mipmap.computeLog( newheight ); - if( level > levels ) { - levels = level; - } - - levels += userLevel; - - Mipmap.retrieveStoreModes( gl, psm ); - myswap_bytes = psm.getUnpackSwapBytes(); - cmpts = Mipmap.elements_per_group( format, type ); - if( psm.getUnpackRowLength() > 0 ) { - groups_per_line = psm.getUnpackRowLength(); - } else { - groups_per_line = width; - } - - element_size = Mipmap.bytes_per_element( type ); - group_size = element_size * cmpts; - if( element_size == 1 ) { - myswap_bytes = false; - } - - rowsize = groups_per_line * group_size; - padding = ( rowsize % psm.getUnpackAlignment() ); - if( padding != 0 ) { - rowsize += psm.getUnpackAlignment() - padding; - } - - data.position( psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size ); - data.mark(); - - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); - - level = userLevel; - - // already power of two square - if( width == newwidth && height == newheight ) { - // use usersImage for level userLevel - if( baseLevel <= level && level <= maxLevel ) { - gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data ); - } - if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( 0 ); - } - int nextWidth = newwidth / 2; - int nextHeight = newheight / 2; - - // clamp to 1 - if( nextWidth < 1 ) { - nextWidth = 1; - } - if( nextHeight < 1 ) { - nextHeight = 1; - } - memreq = Mipmap.image_size( nextWidth, nextHeight, format, type ); - - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - if( dstImage != null ) { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - HalveImage.halveImage_ubyte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); - break; - case( GL.GL_BYTE ): - HalveImage.halveImage_byte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); - break; - case( GL.GL_UNSIGNED_SHORT ): - HalveImage.halveImage_ushort( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_SHORT ): - HalveImage.halveImage_short( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT ): - HalveImage.halveImage_uint( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_INT ): - HalveImage.halveImage_int( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_FLOAT ): - HalveImage.halveImage_float( cmpts, width, height, data, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL.GL_RGB ); - HalveImage.halveImagePackedPixel( 3, new Extract332(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL.GL_RGB ); - HalveImage.halveImagePackedPixel( 3, new Extract233rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - HalveImage.halveImagePackedPixel( 3, new Extract565(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - HalveImage.halveImagePackedPixel( 3, new Extract565rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - HalveImage.halveImagePackedPixel( 4, new Extract4444(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - HalveImage.halveImagePackedPixel( 4, new Extract5551(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - HalveImage.halveImagePackedPixel( 4, new Extract8888(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - HalveImage.halveImagePackedPixel( 4, new Extract1010102(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); - break; - default: - assert( false ); - break; - } - } - newwidth = width / 2; - newheight = height / 2; - // clamp to 1 - if( newwidth < 1 ) { - newwidth = 1; - } - if( newheight < 1 ) { - newheight = 1; - } - - myswap_bytes = false; - rowsize = newwidth * group_size; - memreq = Mipmap.image_size( newwidth, newheight, format, type ); - // swap srcImage and dstImage - tempImage = srcImage; - srcImage = dstImage; - dstImage = tempImage; - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - // level userLevel+1 is in srcImage; level userLevel already saved - level = userLevel + 1; - } else { // user's image is not nice powerof2 size square - memreq = Mipmap.image_size( newwidth, newheight, format, type ); - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - data.reset(); - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, - newwidth, newheight, dstImage, element_size, rowsize, group_size ); - break; - case( GL.GL_BYTE ): - ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, group_size ); - break; - case( GL.GL_UNSIGNED_SHORT ): - ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, - newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_SHORT ): - ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, - newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT ): - ScaleInternal.scale_internal_uint( cmpts, width, height, data, newwidth, - newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_INT ): - ScaleInternal.scale_internal_int( cmpts, width, height, data, newwidth, - newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_FLOAT ): - ScaleInternal.scale_internal_float( cmpts, width, height, data, newwidth, - newheight, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - ScaleInternal.scaleInternalPackedPixel( 3, new Extract332(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - ScaleInternal.scaleInternalPackedPixel( 3, new Extract233rev(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - ScaleInternal.scaleInternalPackedPixel( 3, new Extract565(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - ScaleInternal.scaleInternalPackedPixel( 3, new Extract565rev(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444rev(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract5551(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract1555rev(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888rev(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract1010102(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - ScaleInternal.scaleInternalPackedPixel( 4, new Extract2101010rev(), width, height, data, newwidth, - newheight, dstImage, element_size, rowsize, myswap_bytes ); - break; - default: - assert( false ); - break; - } - myswap_bytes = false; - rowsize = newwidth * group_size; - // swap dstImage and srcImage - tempImage = srcImage; - srcImage = dstImage; - dstImage = tempImage; - - if( levels != 0 ) { // use as little memory as possible - int nextWidth = newwidth / 2; - int nextHeight = newheight / 2; - if( nextWidth < 1 ) { - nextWidth = 1; - } - if( nextHeight < 1 ) { - nextHeight = 1; - } - - memreq = Mipmap.image_size( nextWidth, nextHeight, format, type ); - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - } - // level userLevel is in srcImage; nothing saved yet - level = userLevel; - } - - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); - if( baseLevel <= level && level <= maxLevel ) { - srcImage.rewind(); - if (DEBUG) { - System.err.println("GL Error(" + level + "): " + gl.glGetError() ); - } - gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); - if (DEBUG) { - System.err.println("GL Error(" + level + "): " + gl.glGetError() ); - try { - File file = new File( "glu2DMipmapJ" + level + ".bin" ); - FileOutputStream fos = new FileOutputStream( file ); - srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) ); - fos.getChannel().write( srcImage ); - srcImage.clear(); - fos.close(); - } catch( IOException e ) { - System.err.println("IOException"); - System.err.println(e.getMessage()); - } - } - } - - level++; // update current level for the loop - for( ; level <= levels; level++ ) { - srcImage.rewind(); - dstImage.rewind(); - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - HalveImage.halveImage_ubyte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); - break; - case( GL.GL_BYTE ): - HalveImage.halveImage_byte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); - break; - case( GL.GL_UNSIGNED_SHORT ): - HalveImage.halveImage_ushort( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_SHORT ): - HalveImage.halveImage_short( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT ): - HalveImage.halveImage_uint( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_INT ): - HalveImage.halveImage_int( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_FLOAT ): - HalveImage.halveImage_float( cmpts, newwidth, newheight, srcImage, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL.GL_RGB ); - HalveImage.halveImagePackedPixel( 3, new Extract332(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL.GL_RGB ); - HalveImage.halveImagePackedPixel( 3, new Extract233rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - HalveImage.halveImagePackedPixel( 3, new Extract565(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - HalveImage.halveImagePackedPixel( 3, new Extract565rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - HalveImage.halveImagePackedPixel( 4, new Extract4444(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - HalveImage.halveImagePackedPixel( 4, new Extract5551(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - HalveImage.halveImagePackedPixel( 4, new Extract8888(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - HalveImage.halveImagePackedPixel( 4, new Extract1010102(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); - break; - default: - assert( false ); - break; - } - - // swap dstImage and srcImage - tempImage = srcImage; - srcImage = dstImage; - dstImage = tempImage; - - if( newwidth > 1 ) { - newwidth /= 2; - rowsize /= 2; - } - if( newheight > 1 ) { - newheight /= 2; - } - // compute amount to pad per row if any - int rowPad = rowsize % psm.getUnpackAlignment(); - - // should row be padded - if( rowPad == 0 ) { - // call teximage with srcImage untouched since its not padded - if( baseLevel <= level && level <= maxLevel ) { - srcImage.rewind(); - gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); - if (DEBUG) { - System.err.println("GL Error(" + level + "): " + gl.glGetError() ); - try { - File file = new File( "glu2DMipmapJ" + level + ".bin" ); - FileOutputStream fos = new FileOutputStream( file ); - srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) ); - fos.getChannel().write( srcImage ); - srcImage.clear(); - } catch( IOException e ) { - System.err.println("IOException"); - System.err.println(e.getMessage()); - } - } - } - } else { - // compute length of new row in bytes, including padding - int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; - int ii, jj; - int dstTrav; - int srcTrav; - - // allocate new image for mipmap of size newRowLength x newheight - ByteBuffer newMipmapImage = null; - try { - newMipmapImage = ByteBuffer.allocateDirect( newRowLength * newheight ); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - srcImage.rewind(); - // copy image from srcImage into newMipmapImage by rows - for( ii = 0; ii < newheight; ii++ ) { - for( jj = 0; jj < rowsize; jj++ ) { - newMipmapImage.put( srcImage.get() ); - } - if( jj < rowsize - 1 ) { - newMipmapImage.position( newMipmapImage.position() + rowPad ); - } - } - - // and use this new image for mipmapping instead - if( baseLevel <= level && level <= maxLevel ) { - newMipmapImage.rewind(); - gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, newMipmapImage ); - if (DEBUG) { - System.err.println("GL Error: " + gl.glGetError() ); - try { - File file = new File( "glu2DMipmapJ" + level + ".bin" ); - FileOutputStream fos = new FileOutputStream( file ); - srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) ); - fos.getChannel().write( newMipmapImage ); - srcImage.clear(); - } catch( IOException e ) { - System.err.println("IOException"); - System.err.println(e.getMessage()); - } - } - } - } - } - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - - return( 0 ); - } - - public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, - int components, int width, int height, int format, int type, ByteBuffer data ) { - int[] newwidth = new int[1]; - int[] newheight = new int[1]; - int level, levels; - ByteBuffer newImage; - int newImage_width; - int newImage_height; - ByteBuffer otherImage; - ByteBuffer imageTemp; - int memreq; - int maxsize; - int cmpts; - - Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, - newheight ); - - levels = Mipmap.computeLog( newwidth[0] ); - level = Mipmap.computeLog( newheight[0] ); - if( level > levels ) { - levels = level; - } - - cmpts = Mipmap.elements_per_group( format, type ); - - otherImage = null; - // No need to copy the user data if its packed correctly. - // Make sure that later routines don't change that data. - - if( psm.getUnpackSkipRows() == 0 && psm.getUnpackSkipPixels() == 0 ) { - newImage = data; - newImage_width = width; - newImage_height = height; - } else { - int rowsize; - int group_per_line; - int elements_per_line; - int start; - int iter; - int iter2; - int i, j; - - try { - newImage = ByteBuffer.allocateDirect( Mipmap.image_size( - width, height, format, GL.GL_UNSIGNED_BYTE ) ).order( ByteOrder.nativeOrder() ); - } catch( OutOfMemoryError err ) { - return( GLU.GLU_OUT_OF_MEMORY ); - } - newImage_width = width; - newImage_height = height; - - // Abbreviated version of fill_image for the restricted case. - if( psm.getUnpackRowLength() > 0 ) { - group_per_line = psm.getUnpackRowLength(); - } else { - group_per_line = width; - } - rowsize = group_per_line * cmpts; - elements_per_line = width * cmpts; - start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * cmpts; - - for( i = 0; i < height; i++ ) { - iter = start; - data.position( iter ); - for( j = 0; j < elements_per_line; j++ ) { - newImage.put( data.get() ); - } - start += rowsize; - } - } - - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); - - for( level = 0; level <= levels; level++ ) { - if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { - // use newImage for this level - gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL.GL_UNSIGNED_BYTE, newImage ); - } else { - if( otherImage == null ) { - memreq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_BYTE ); - try { - otherImage = ByteBuffer.allocateDirect( memreq ).order( ByteOrder.nativeOrder() ); - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; - return( GLU.GLU_OUT_OF_MEMORY ); - } - } - // swap newImage and otherImage - imageTemp = otherImage; - otherImage = newImage; - newImage = imageTemp; - - newImage_width = newwidth[0]; - newImage_height = newheight[0]; - gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL.GL_UNSIGNED_BYTE, newImage ); - } - if( newwidth[0] > 1 ) { - newwidth[0] /= 2; - } - if( newheight[0] > 1 ) { - newheight[0] /= 2; - } - } - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; - - return( 0 ); - } - - public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, - int depthPowerOf2, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { - int newWidth; - int newHeight; - int newDepth; - int level, levels; - ByteBuffer usersImage; - ByteBuffer srcImage, dstImage, tempImage; - int newImageWidth; - int newImageHeight; - int newImageDepth; - int memReq; - int maxSize; - int cmpts; - - boolean myswapBytes; - int groupsPerLine, elementSize, groupSize; - int rowsPerImage, imageSize; - int rowSize, padding; - PixelStorageModes psm = new PixelStorageModes(); - - assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); - assert( width >= 1 && height >= 1 && depth >= 1 ); - assert( type != GL.GL_BITMAP ); - - srcImage = dstImage = null; - - newWidth = widthPowerOf2; - newHeight = heightPowerOf2; - newDepth = depthPowerOf2; - levels = Mipmap.computeLog( newWidth ); - level = Mipmap.computeLog( newHeight ); - if( level > levels ) { - levels = level; - } - level = Mipmap.computeLog( newDepth ); - if( level > levels ) { - levels = level; - } - - levels += userLevel; - - Mipmap.retrieveStoreModes3D( gl, psm ); - myswapBytes = psm.getUnpackSwapBytes(); - cmpts = Mipmap.elements_per_group( format, type ); - if( psm.getUnpackRowLength() > 0 ) { - groupsPerLine = psm.getUnpackRowLength(); - } else { - groupsPerLine = width; - } - - elementSize = Mipmap.bytes_per_element( type ); - groupSize = elementSize * cmpts; - if( elementSize == 1 ) { - myswapBytes = false; - } - - // 3dstuff - if( psm.getUnpackImageHeight() > 0 ) { - rowsPerImage = psm.getUnpackImageHeight(); - } else { - rowsPerImage = height; - } - - rowSize = groupsPerLine * groupSize; - padding = ( rowSize % psm.getUnpackAlignment() ); - if( padding != 0 ) { - rowSize += psm.getUnpackAlignment() - padding; - } - - imageSize = rowsPerImage * rowSize; - - usersImage = data.duplicate(); - usersImage.position( psm.getUnpackSkipRows() * rowSize + - psm.getUnpackSkipPixels() * groupSize + - psm.getUnpackSkipImages() * imageSize ); - usersImage.mark(); - - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, 0 ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, 0 ); - - level = userLevel; - - if( width == newWidth && height == newHeight && depth == newDepth ) { - // use usersImage for level userlevel - if( baseLevel <= level && level <= maxLevel ) { - gl.glTexImage3D( target, level, internalFormat, width, height, depth, - 0, format, type, usersImage ); - } - if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); - return( 0 ); - } - int nextWidth = newWidth / 2; - int nextHeight = newHeight / 2; - int nextDepth = newDepth / 2; - - // clamp to one - if( nextWidth < 1 ) { - nextWidth = 1; - } - if( nextHeight < 1 ) { - nextHeight = 1; - } - if( nextDepth < 1 ) { - nextDepth = 1; - } - memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - - if( dstImage != null ) { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, - usersImage, dstImage, elementSize, - groupSize, rowSize, imageSize, myswapBytes ); - } else { - HalveImage.halveImage_ubyte( cmpts, width, height, usersImage, - dstImage, elementSize, rowSize, groupSize ); - } - break; - case( GL.GL_BYTE ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_byte( cmpts, width, height, usersImage, - dstImage, elementSize, rowSize, groupSize ); - } - break; - case( GL.GL_UNSIGNED_SHORT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_ushort( cmpts, width, height, usersImage, - dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_SHORT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_short( cmpts, width, height, usersImage, - dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_UNSIGNED_INT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_uint( cmpts, width, height, usersImage, - dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_INT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_int( cmpts, width, height, usersImage, - dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_FLOAT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_float( cmpts, width, height, usersImage, - dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL.GL_RGB ); - HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL.GL_RGB ); - HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - default: - assert( false ); - break; - } - } - newWidth = width / 2; - newHeight = height / 2; - newDepth = depth / 2; - // clamp to 1 - if( newWidth < 1 ) { - newWidth = 1; - } - if( newHeight < 1 ) { - newHeight = 1; - } - if( newDepth < 1 ) { - newDepth = 1; - } - - myswapBytes = false; - rowSize = newWidth * groupSize; - imageSize = rowSize * newHeight; - memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); - // swap srcImage and dstImage - tempImage = srcImage; - srcImage = dstImage; - dstImage = tempImage; - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - - // level userLevel + 1 is in srcImage; level userLevel already saved - level = userLevel + 1; - } else { - memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - - ScaleInternal.gluScaleImage3D( gl, format, width, height, depth, type, - usersImage, newWidth, newHeight, newDepth, type, dstImage ); - - myswapBytes = false; - rowSize = newWidth * groupSize; - imageSize = rowSize * newHeight; - // swap dstImage and srcImage - tempImage = srcImage; - srcImage = dstImage; - dstImage = tempImage; - - if( levels != 0 ) { - int nextWidth = newWidth / 2; - int nextHeight = newHeight / 2; - int nextDepth = newDepth / 2; - if( nextWidth < 1 ) { - nextWidth = 1; - } - if( nextHeight < 1 ) { - nextHeight = 1; - } - if( nextDepth < 1 ) { - nextDepth = 1; - } - memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); - try { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - dstImage = ByteBuffer.allocateDirect( memReq ).order( ByteOrder.nativeOrder() ); - break; - default: - return( GLU.GLU_INVALID_ENUM ); - } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); - return( GLU.GLU_OUT_OF_MEMORY ); - } - } - // level userLevel is in srcImage; nothing saved yet - level = userLevel; - } - - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); - if( baseLevel <= level && level <= maxLevel ) { - usersImage.reset(); - gl.glTexImage3D( target, level, internalFormat, width, height, depth, - 0, format, type, usersImage ); - } - level++; - for( ; level <= levels; level++ ) { - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_ubyte( cmpts, width, height, usersImage, - dstImage, elementSize, rowSize, groupSize ); - } - break; - case( GL.GL_BYTE ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_byte( cmpts, width, height, usersImage, - dstImage, elementSize, rowSize, groupSize ); - } - break; - case( GL.GL_UNSIGNED_SHORT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_ushort( cmpts, width, height, usersImage, - dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_SHORT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_short( cmpts, width, height, usersImage, - dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_UNSIGNED_INT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_uint( cmpts, width, height, usersImage, - dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_INT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_int( cmpts, width, height, usersImage, - dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_FLOAT ): - if( depth > 1 ) { - HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, - usersImage, dstImage, elementSize, groupSize, rowSize, - imageSize, myswapBytes ); - } else { - HalveImage.halveImage_float( cmpts, width, height, usersImage, - dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); - } - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, - dstImage, elementSize, rowSize, imageSize, myswapBytes ); - break; - default: - assert( false ); - break; - } - - tempImage = srcImage; - srcImage = dstImage; - dstImage = tempImage; - - if( newWidth > 1 ) { - newWidth /= 2; - rowSize /= 2; - } - if( newHeight > 1 ) { - newHeight /= 2; - imageSize = rowSize * newHeight; - } - if( newDepth > 1 ) { - newDepth /= 2; - } - if( baseLevel <= level && level <= maxLevel ) { - usersImage.reset(); - gl.glTexImage3D( target, level, internalFormat, width, height, depth, - 0, format, type, usersImage ); - } - } - gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); - return( 0 ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract.java b/src/net/java/games/jogl/impl/mipmap/Extract.java deleted file mode 100644 index c78bcd9ce..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public interface Extract { - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ); - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ); -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract1010102.java b/src/net/java/games/jogl/impl/mipmap/Extract1010102.java deleted file mode 100644 index d6fcc5977..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract1010102.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class Extract1010102 implements Extract { - - /** Creates a new instance of Extract1010102 */ - public Extract1010102() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - long uint = 0; - - if( isSwap ) { - uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); - } else { - uint = 0x00000000FFFFFFFF & packedPixel.getInt(); - } - - // 11111111,11000000,00000000,00000000 == 0xFFC00000 - // 00000000,00111111,11110000,00000000 == 0x003F0000 - // 00000000,00000000,00001111,11111100 == 0x00000FFC - // 00000000,00000000,00000000,00000011 == 0x00000003 - - extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) << 22) & 0xFFC00000 ); - uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 12) & 0x003FF000 ); - uint |= (((int)((shoveComponents[2] * 1023) + 0.5f) << 2) & 0x00000FFC ); - uint |= (((int)((shoveComponents[3] * 3) + 0.5f) ) & 0x00000003 ); - packedPixel.asIntBuffer().put( index, (int)uint ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract1555rev.java b/src/net/java/games/jogl/impl/mipmap/Extract1555rev.java deleted file mode 100644 index 10a132417..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract1555rev.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class Extract1555rev implements Extract { - - /** Creates a new instance of Extract1555rev */ - public Extract1555rev() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - int ushort = 0; - - if( isSwap ) { - ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); - } else { - ushort = 0x0000FFFF & packedPixel.getShort(); - } - - // 00000000,00011111 == 0x001F - // 00000011,11100000 == 0x03E0 - // 01111100,00000000 == 0x7C00 - // 10000000,00000000 == 0x8000 - - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 00000000,00011111 == 0x001F - // 00000011,11100000 == 0x03E0 - // 01111100,00000000 == 0x7C00 - // 10000000,00000000 == 0x8000 - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F ); - ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 5) & 0x000003E0 ); - ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) << 10) & 0x00007C00 ); - ushort |= (((int)((shoveComponents[3]) + 0.5f) << 15) & 0x00008000 ); - packedPixel.asShortBuffer().put( index, (short)ushort ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract2101010rev.java b/src/net/java/games/jogl/impl/mipmap/Extract2101010rev.java deleted file mode 100644 index 5d98f19a7..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract2101010rev.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class Extract2101010rev implements Extract { - - /** Creates a new instance of Extract2101010 */ - public Extract2101010rev() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - long uint = 0; - - if( isSwap ) { - uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); - } else { - uint = 0x00000000FFFFFFFF & packedPixel.getInt(); - } - - // 11111111,11000000,00000000,00000000 == 0xFFC00000 - // 00000000,00111111,11110000,00000000 == 0x003F0000 - // 00000000,00000000,00001111,11111100 == 0x00000FFC - // 00000000,00000000,00000000,00000011 == 0x00000003 - - extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) ) & 0x000003FF ); - uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 10) & 0x000FFC00 ); - uint |= (((int)((shoveComponents[2] * 1023) + 0.5f) << 20) & 0x3FF00000 ); - uint |= (((int)((shoveComponents[3] * 3) + 0.5f) << 30) & 0xC0000000 ); - packedPixel.asIntBuffer().put( index, (int)uint ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract233rev.java b/src/net/java/games/jogl/impl/mipmap/Extract233rev.java deleted file mode 100644 index 46d45cbcb..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract233rev.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class Extract233rev implements Extract { - - /** Creates a new instance of Extract223rev */ - public Extract233rev() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - // 11100000 == 0xe0 - // 00011100 == 0x1c - // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0x07) ) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; - extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11100000 == 0xE0 - // 00011100 == 0x1C - // 00000011 == 0x03 - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - - // due to limited precision, need to round before shoving - byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) ) & 0x07 ); - b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 3 ) & 0x38 ); - b |= (byte)( ( (int)( ( shoveComponents[2] * 3 ) + 0.5f ) << 6 ) & 0xC0 ); - packedPixel.position( index ); - packedPixel.put( b ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract332.java b/src/net/java/games/jogl/impl/mipmap/Extract332.java deleted file mode 100644 index 6a3bcdc0a..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract332.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class Extract332 implements Extract { - - /** Creates a new instance of Extract332 */ - public Extract332() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - // 11100000 == 0xe0 - // 00011100 == 0x1c - // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0xe0) >> 5) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; - extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11100000 == 0xE0 - // 00011100 == 0x1C - // 00000011 == 0x03 - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - - // due to limited precision, need to round before shoving - byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) << 5 ) & 0xE0 ); - b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 2 ) & 0x1C ); - b |= (byte)( ( (int)( ( shoveComponents[2] * 3 ) + 0.5f ) ) & 0x03 ); - packedPixel.put( index, b ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract4444.java b/src/net/java/games/jogl/impl/mipmap/Extract4444.java deleted file mode 100644 index c2b5fc95f..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract4444.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract4444 implements Extract { - - /** Creates a new instance of Extract4444 */ - public Extract4444() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - int ushort = 0; - - if( isSwap ) { - ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); - } else { - ushort = 0x0000FFFF & packedPixel.getShort(); - } - - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - - // due to limited precision, need to round before shoving - int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) << 12) & 0x0000F000 ); - ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 8) & 0x00000F00 ); - ushort |= (((int)((shoveComponents[2] * 15) + 0.5f) << 4) & 0x000000F0 ); - ushort |= (((int)((shoveComponents[3] * 15) + 0.5f) ) & 0x0000000F ); - packedPixel.asShortBuffer().put( index, (short)ushort ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract4444rev.java b/src/net/java/games/jogl/impl/mipmap/Extract4444rev.java deleted file mode 100644 index e8adf3004..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract4444rev.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract4444rev implements Extract { - - /** Creates a new instance of Extract4444rev */ - public Extract4444rev() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - int ushort = 0; - - if( isSwap ) { - ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); - } else { - ushort = 0x0000FFFF & packedPixel.getShort(); - } - - // 00000000,00001111 == 0x000F - // 00000000,11110000 == 0x00F0 - // 00001111,00000000 == 0x0F00 - // 11110000,00000000 == 0xF000 - - extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) ) & 0x0000000F ); - ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 4) & 0x000000F0 ); - ushort |= (((int)((shoveComponents[2] * 15) + 0.5f) << 8) & 0x00000F00 ); - ushort |= (((int)((shoveComponents[3] * 15) + 0.5f) << 12) & 0x0000F000 ); - packedPixel.asShortBuffer().put( index, (short)ushort ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract5551.java b/src/net/java/games/jogl/impl/mipmap/Extract5551.java deleted file mode 100644 index b7e3a027b..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract5551.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract5551 implements Extract { - - /** Creates a new instance of Extract5551 */ - public Extract5551() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - int ushort = 0; - - if( isSwap ) { - ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); - } else { - ushort = 0x0000FFFF & packedPixel.getShort(); - } - - // 11111000,00000000 == 0xF800 - // 00000111,11000000 == 0x07C0 - // 00000000,00111110 == 0x003E - // 00000000,00000001 == 0x0001 - - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) ); - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 ); - ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 6) & 0x000007C0 ); - ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) << 1) & 0x0000003E ); - ushort |= (((int)((shoveComponents[3]) + 0.5f)) & 0x00000001 ); - packedPixel.asShortBuffer().put( index, (short)ushort ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract565.java b/src/net/java/games/jogl/impl/mipmap/Extract565.java deleted file mode 100644 index 43158bb6c..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract565.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract565 implements Extract { - - /** Creates a new instance of Extract565 */ - public Extract565() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - int ushort = 0; - - if( isSwap ) { - ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); - } else { - ushort = 0x0000FFFF & packedPixel.getShort(); - } - - // 11111000,00000000 == 0xF800 - // 00000111,11100000 == 0x07E0 - // 00000000,00111111 == 0x001F - - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11111000,00000000 == 0xF800 - // 00000111,11100000 == 0x07E0 - // 00000000,00111111 == 0x001F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - - // due to limited precision, need to round before shoving - int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 ); - ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 ); - ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) ) & 0x0000001F ); - packedPixel.asShortBuffer().put( index, (short)ushort ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract565rev.java b/src/net/java/games/jogl/impl/mipmap/Extract565rev.java deleted file mode 100644 index b6f3af966..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract565rev.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract565rev implements Extract { - - /** Creates a new instance of Extract565rev */ - public Extract565rev() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - int ushort = 0; - - if( isSwap ) { - ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); - } else { - ushort = 0x0000FFFF & packedPixel.getShort(); - } - - // 00000000,00011111 == 0x001F - // 00000111,11100000 == 0x07E0 - // 11111000,00000000 == 0xF800 - - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 00000000,00111111 == 0x001F - // 00000111,11100000 == 0x07E0 - // 11111000,00000000 == 0xF800 - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - - // due to limited precision, need to round before shoving - int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F ); - ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 ); - ushort |= (((int)((shoveComponents[2] * 31) + 0.5f) << 11) & 0x0000F800 ); - packedPixel.asShortBuffer().put( index, (short)ushort ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract8888.java b/src/net/java/games/jogl/impl/mipmap/Extract8888.java deleted file mode 100644 index c013fae28..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract8888.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract8888 implements Extract { - - /** Creates a new instance of Extract8888 */ - public Extract8888() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - long uint = 0; - - if( isSwap ) { - uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); - } else { - uint = 0x00000000FFFFFFFF & packedPixel.getInt(); - } - - // 11111000,00000000 == 0xF800 - // 00000111,11000000 == 0x07C0 - // 00000000,00111110 == 0x003E - // 00000000,00000001 == 0x0001 - - extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - long uint = (((int)((shoveComponents[0] * 255) + 0.5f) << 24) & 0xFF000000 ); - uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 16) & 0x00FF0000 ); - uint |= (((int)((shoveComponents[2] * 255) + 0.5f) << 8) & 0x0000FF00 ); - uint |= (((int)((shoveComponents[3] * 255) + 0.5f) ) & 0x000000FF ); - packedPixel.asIntBuffer().put( index, (int)uint ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Extract8888rev.java b/src/net/java/games/jogl/impl/mipmap/Extract8888rev.java deleted file mode 100644 index 9104ed7b1..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Extract8888rev.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Extract8888rev implements Extract { - - /** Creates a new instance of Extract8888rev */ - public Extract8888rev() { - } - - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { - long uint = 0; - - if( isSwap ) { - uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); - } else { - uint = 0x00000000FFFFFFFF & packedPixel.getInt(); - } - - // 11111000,00000000 == 0xF800 - // 00000111,11000000 == 0x07C0 - // 00000000,00111110 == 0x003E - // 00000000,00000001 == 0x0001 - - extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; - } - - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { - // 11110000,00000000 == 0xF000 - // 00001111,00000000 == 0x0F00 - // 00000000,11110000 == 0x00F0 - // 00000000,00001111 == 0x000F - - assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); - assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); - assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - - // due to limited precision, need to round before shoving - long uint = (((int)((shoveComponents[0] * 255) + 0.5f) ) & 0x000000FF ); - uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 8) & 0x0000FF00 ); - uint |= (((int)((shoveComponents[2] * 255) + 0.5f) << 16) & 0x00FF0000 ); - uint |= (((int)((shoveComponents[3] * 255) + 0.5f) << 24) & 0xFF000000 ); - packedPixel.asIntBuffer().put( index, (int)uint ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractFloat.java b/src/net/java/games/jogl/impl/mipmap/ExtractFloat.java deleted file mode 100644 index 3dad2de29..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractFloat.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class ExtractFloat implements ExtractPrimitive { - - /** Creates a new instance of ExtractFloat */ - public ExtractFloat() { - } - - public double extract( boolean isSwap, ByteBuffer data ) { - float f = 0; - if( isSwap ) { - f = Mipmap.GLU_SWAP_4_BYTES( data.getInt() ); - } else { - f = data.getInt(); - } - assert( f <= 1.0f ); - return( f ); - } - - public void shove( double value, int index, ByteBuffer data ) { - assert(0.0 <= value && value < 1.0); - data.asFloatBuffer().put( index, (float)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractPrimitive.java b/src/net/java/games/jogl/impl/mipmap/ExtractPrimitive.java deleted file mode 100644 index 242d8f331..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractPrimitive.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public interface ExtractPrimitive { - public double extract( boolean isSwap, ByteBuffer pointer ); - public void shove( double value, int index, ByteBuffer pointer ); -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractSByte.java b/src/net/java/games/jogl/impl/mipmap/ExtractSByte.java deleted file mode 100644 index f925eb7bd..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractSByte.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class ExtractSByte implements ExtractPrimitive { - - /** Creates a new instance of ExtractUByte */ - public ExtractSByte() { - } - - public double extract( boolean isSwap, ByteBuffer sbyte ) { - byte b = sbyte.get(); - assert( b <= 127 ); - return( b ); - } - - public void shove( double value, int index, ByteBuffer data ) { - data.position( index ); - data.put( (byte)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractSInt.java b/src/net/java/games/jogl/impl/mipmap/ExtractSInt.java deleted file mode 100644 index c874c82f1..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractSInt.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class ExtractSInt implements ExtractPrimitive { - - /** Creates a new instance of ExtractSInt */ - public ExtractSInt() { - } - - public double extract( boolean isSwap, ByteBuffer uint ) { - int i = 0; - if( isSwap ) { - i = Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); - } else { - i = uint.getInt(); - } - assert( i <= 0x7FFFFFFF ); - return( i ); - } - - public void shove( double value, int index, ByteBuffer data ) { - assert(0.0 <= value && value < Integer.MAX_VALUE); - IntBuffer ib = data.asIntBuffer(); - ib.position( index ); - ib.put( (int)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractSShort.java b/src/net/java/games/jogl/impl/mipmap/ExtractSShort.java deleted file mode 100644 index 73a0f9c5e..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractSShort.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class ExtractSShort implements ExtractPrimitive { - - /** Creates a new instance of ExtractSShort */ - public ExtractSShort() { - } - - public double extract( boolean isSwap, ByteBuffer ushort ) { - short s = 0; - if( isSwap ) { - s = Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); - } else { - s = ushort.getShort(); - } - assert( s <= 32767 ); - return( s ); - } - - public void shove( double value, int index, ByteBuffer data ) { - assert(0.0 <= value && value < 32768.0); - ShortBuffer sb = data.asShortBuffer(); - sb.position( index ); - sb.put( (short)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractUByte.java b/src/net/java/games/jogl/impl/mipmap/ExtractUByte.java deleted file mode 100644 index 031aa74ce..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractUByte.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.ByteBuffer; - -/** - * - * @author Administrator - */ -public class ExtractUByte implements ExtractPrimitive { - - /** Creates a new instance of ExtractUByte */ - public ExtractUByte() { - } - - public double extract( boolean isSwap, ByteBuffer ubyte ) { - int i = 0x000000FF & ubyte.get(); - assert( i <= 255 ); - return( i ); - } - - public void shove( double value, int index, ByteBuffer data ) { - assert(0.0 <= value && value < 256.0); - data.position( index ); - data.put( (byte)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractUInt.java b/src/net/java/games/jogl/impl/mipmap/ExtractUInt.java deleted file mode 100644 index b80afd41e..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractUInt.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class ExtractUInt implements ExtractPrimitive { - - /** Creates a new instance of ExtractUInt */ - public ExtractUInt() { - } - - public double extract( boolean isSwap, ByteBuffer uint ) { - long i = 0; - if( isSwap ) { - i = 0xFFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); - } else { - i = 0xFFFFFFFF & uint.getInt(); - } - assert( i <= 0xFFFFFFFF ); - return( i ); - } - - public void shove( double value, int index, ByteBuffer data ) { - assert(0.0 <= value && value < 0xFFFFFFFF); - IntBuffer ib = data.asIntBuffer(); - ib.position( index ); - ib.put( (int)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/ExtractUShort.java b/src/net/java/games/jogl/impl/mipmap/ExtractUShort.java deleted file mode 100644 index 130f2c833..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ExtractUShort.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class ExtractUShort implements ExtractPrimitive { - - /** Creates a new instance of ExtracUShort */ - public ExtractUShort() { - } - - public double extract( boolean isSwap, ByteBuffer ushort ) { - int i = 0; - if( isSwap ) { - i = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); - } else { - i = 0x0000FFFF & ushort.getShort(); - } - assert( i <= 65535 ); - return( i ); - } - - public void shove( double value, int index, ByteBuffer data ) { - assert(0.0 <= value && value < 65536.0); - ShortBuffer sb = data.asShortBuffer(); - sb.position( index ); - sb.put( (short)value ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/HalveImage.java b/src/net/java/games/jogl/impl/mipmap/HalveImage.java deleted file mode 100644 index ea12577b9..000000000 --- a/src/net/java/games/jogl/impl/mipmap/HalveImage.java +++ /dev/null @@ -1,1523 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import net.java.games.jogl.GL; -import java.nio.*; - -/** - * - * @author Administrator - */ -public class HalveImage { - - private static final int BOX2 = 2; - private static final int BOX4 = 4; - private static final int BOX8 = 8; - - public static void halveImage( int components, int width, int height, - ShortBuffer datain, ShortBuffer dataout ) { - int i, j, k; - int newwidth, newheight; - int delta; - int t = 0; - short temp = 0; - - newwidth = width / 2; - newheight = height /2; - delta = width * components; - - // Piece of cake - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = datain.get(); - datain.position( t + components ); - temp += datain.get(); - datain.position( t + delta ); - temp += datain.get(); - datain.position( t + delta + components ); - temp +=datain.get(); - temp += 2; - temp /= 4; - dataout.put( temp ); - t++; - } - t += components; - } - t += delta; - } - } - - public static void halveImage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { - int i, j, k; - int newwidth, newheight; - int s; - int t; - - // Handle case where there is only 1 column/row - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); // can't be 1x1 - halve1Dimage_ubyte( components, width, height, datain, dataout, element_size, ysize, group_size ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - s = 0; - t = 0; - - int temp = 0; - // piece of cake - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = ( 0x000000FF & datain.get() ); - datain.position( t + group_size ); - temp += ( 0x000000FF & datain.get() ); - datain.position( t + ysize ); - temp += ( 0x000000FF & datain.get() ); - datain.position( t + ysize + group_size ); - temp += ( 0x000000FF & datain.get() ) + 2; - dataout.put( (byte)(temp / 4) ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - - public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int dest = 0; - int jj; - int temp = 0; - - assert( width == 1 || height == 1 ); // Must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // widthxheight can't be 1x1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - datain.position( src ); - temp = ( 0x000000FF & datain.get() ); - datain.position( src + group_size ); - temp += ( 0x000000FF & datain.get() ); - temp /= 2; - dataout.put( (byte)temp ); - /* - dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + - (0x000000FF & datain.setIndexInBytes( src + group_size ).getByte())) / 2 ) ); - */ - src += element_size; - //dataout.plusPlus(); - dest++; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assertion only - } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - datain.position( src ); - temp = ( 0x000000FF & datain.get() ); - datain.position( src + ysize ); - temp += ( 0x000000FF & datain.get() ); - temp /= 2; - dataout.put( (byte)temp ); - /* - dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + - (0x000000FF & datain.setIndexInBytes(src + ysize).getByte()) ) / 2 ) ); - */ - src += element_size; - //dataout.plusPlus(); - dest++; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - } - assert( src == ysize * height ); - assert( dest == components * element_size * halfWidth * halfHeight ); - } - - public static void halveImage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, int element_size, - int ysize, int group_size ) { - int i, j, k; - int newwidth, newheight; - int s = 0; - int t = 0; - byte temp = (byte)0; - - // handle case where there is only 1 column - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); - halve1Dimage_byte( components, width, height, datain, dataout, element_size, - ysize, group_size ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = datain.get(); - datain.position( t + group_size ); - temp += datain.get(); - datain.position( t + ysize ); - temp += datain.get(); - datain.position( t + ysize + group_size ); - temp += datain.get(); - temp += 2; - temp /= 4; - dataout.put( temp ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - - public static void halve1Dimage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { - int halfWidth = width / 2; - int halfHeight = width / 2; - int src = 0; - int dest = 0; - int jj; - byte temp = (byte)0; - - assert( width == 1 || height == 1 ); // must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // widthxheight can't be 1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - datain.position( src ); - temp = datain.get(); - datain.position( src + group_size ); - temp += datain.get(); - temp /= 2; - dataout.put( temp ); - src += element_size; - dest++; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assert only - } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); // widthxheight can't be 1 - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - datain.position( src ); - temp = datain.get(); - datain.position( src + ysize ); - temp += datain.get(); - temp /= 2; - src += element_size; - dest++; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - assert( src == ysize * height ); - } - assert( dest == components * element_size * halfWidth * halfHeight ); - } - - public static void halveImage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; - int newwidth, newheight; - int s = 0; - int t = 0; - int temp = 0; - // handle case where there is only 1 column/row - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); // can't be 1x1 - halve1Dimage_ushort( components, width, height, datain, dataout, element_size, - ysize, group_size, myswap_bytes ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - - // Piece of cake - if( !myswap_bytes ) { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = ( 0x0000FFFF & datain.getShort() ); - datain.position( t + group_size ); - temp += ( 0x0000FFFF & datain.getShort() ); - datain.position( t + ysize ); - temp += ( 0x0000FFFF & datain.getShort() ); - datain.position( t + ysize + group_size ); - temp += ( 0x0000FFFF & datain.getShort() ); - dataout.put( (short)( ( temp + 2 ) / 4 ) ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } else { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - datain.position( t + group_size ); - temp += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - datain.position( t + ysize ); - temp += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - datain.position( t + ysize + group_size ); - temp += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - dataout.put( (short)( ( temp + 2 ) / 4 ) ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - } - - public static void halve1Dimage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int dest = 0; - int jj; - - assert( width == 1 || height == 1 ); // must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // widthxheight can't be 1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < halfHeight; kk++ ) { - int[] ushort = new int[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - datain.position( src + group_size ); - ushort[1] = (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - } else { - datain.position( src ); - ushort[0] = (0x0000FFFF & datain.getShort() ); - datain.position( src + group_size ); - ushort[1] = (0x0000FFFF & datain.getShort() ); - } - dataout.put( (short)( (ushort[0] + ushort[1]) / 2 ) ); - src += element_size; - dest += 2; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assertion only - } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); // widthxheight can't be 1 - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - int[] ushort = new int[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - datain.position( src + ysize ); - ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); - } else { - datain.position( src ); - ushort[0] = ( 0x0000FFFF & datain.getShort() ); - datain.position( src + ysize ); - ushort[1] = ( 0x0000FFFF & datain.getShort() ); - } - dataout.put( (short)((ushort[0] + ushort[1]) / 2) ); - src += element_size; - dest += 2; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - assert( src == ysize * height ); - } - assert( dest == components * element_size * halfWidth * halfHeight ); - } - - public static void halveImage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; - int newwidth, newheight; - int s = 0; - int t = 0; - short temp = (short)0; - // handle case where there is only 1 column/row - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); // can't be 1x1 - halve1Dimage_short( components, width, height, datain, dataout, element_size, - ysize, group_size, myswap_bytes ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - - // Piece of cake - if( !myswap_bytes ) { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = datain.getShort(); - datain.position( t + group_size ); - temp += datain.getShort(); - datain.position( t + ysize ); - temp += datain.getShort(); - datain.position( t + ysize + group_size ); - temp += datain.getShort(); - temp += 2; - temp /= 4; - dataout.put( (short)temp ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } else { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - short b; - int buf; - datain.position( t ); - temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - datain.position( t + group_size ); - temp += Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - datain.position( t + ysize ); - temp += Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - datain.position( t + ysize + group_size ); - temp += Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - temp += 2; - temp /= 4; - dataout.put( temp ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - } - - public static void halve1Dimage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int dest = 0; - int jj; - - assert( width == 1 || height == 1 ); // must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // can't be 1x1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - datain.position( src + group_size ); - sshort[1] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - } else { - datain.position( src ); - sshort[0] = datain.getShort(); - datain.position( src + group_size ); - sshort[1] = datain.getShort(); - } - dataout.put( (short)(( sshort[0] + sshort[1] ) / 2) ); - src += element_size; - dest += 2; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assertion only - } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - datain.position( src + ysize ); - sshort[1] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - } else { - datain.position( src ); - sshort[0] = datain.getShort(); - datain.position( src + ysize ); - sshort[1] = datain.getShort(); - } - dataout.put( (short)(( sshort[0] + sshort[1] ) / 2) ); - src += element_size; - dest += 2; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - assert( src == ysize * height ); - } - assert( dest == ( components * element_size * halfWidth * halfHeight ) ); - } - - public static void halveImage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; - int newwidth, newheight; - int s = 0; - int t = 0; - double temp = 0; - - // handle case where there is only 1 column/row - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); // can't be 1x1 - halve1Dimage_uint( components, width, height, datain, dataout, element_size, - ysize, group_size, myswap_bytes ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - - // Piece of cake - if( !myswap_bytes ) { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = (0x000000007FFFFFFFL & datain.getInt() ); - datain.position( t + group_size ); - temp += (0x000000007FFFFFFFL & datain.getInt() ); - datain.position( t + ysize ); - temp += (0x000000007FFFFFFFL & datain.getInt() ); - datain.position( t + ysize + group_size ); - temp += (0x000000007FFFFFFFL & datain.getInt() ); - dataout.put( (int)( ( temp / 4 ) + 0.5 ) ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } else { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - // need to cast to double to hold large unsigned ints - double buf; - datain.position( t ); - buf = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( t + group_size ); - buf += ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( t + ysize ); - buf += ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( t + ysize + group_size ); - buf += ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - temp /= 4; - temp += 0.5; - dataout.put( (int)temp ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - } - - public static void halve1Dimage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int dest = 0; - int jj; - - assert( width == 1 || height == 1 ); // must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // widthxheight can't be 1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < halfHeight; kk++ ) { - long[] uint = new long[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( src + group_size ); - uint[1] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - } else { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); - datain.position( src + group_size ); - uint[1] = (0x00000000FFFFFFFF & datain.getInt() ); - } - dataout.put( (int)( ( uint[0] + uint[1] ) / 2.0 ) ); - src += element_size; - dest += 4; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assertion only - } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); // widthxheight can't be 1 - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( src + group_size ); - uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - } else { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); - datain.position( src + ysize ); - uint[1] = ( 0x00000000FFFFFFFF & datain.getInt() ); - } - dataout.put( (int)( ( uint[0] + uint[1] ) / 2.0 ) ); - src += element_size; - dest += 4; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - assert( src == ysize * height ); - } - assert( dest == components * element_size * halfWidth * halfHeight ); - } - - public static void halveImage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; - int newwidth, newheight; - int s = 0; - int t = 0; - int temp = 0; - - // handle case where there is only 1 column/row - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); // can't be 1x1 - halve1Dimage_int( components, width, height, datain, dataout, element_size, - ysize, group_size, myswap_bytes ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - - // Piece of cake - if( !myswap_bytes ) { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = datain.getInt(); - datain.position( t + group_size ); - temp += datain.getInt(); - datain.position( t + ysize ); - temp += datain.getInt(); - datain.position( t + ysize + group_size ); - temp += datain.getInt(); - temp = (int)( ( temp / 4.0f ) + 0.5f ); - dataout.put( temp ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } else { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - long b; - float buf; - datain.position( t ); - b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - buf = b; - datain.position( t + group_size ); - b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - buf += b; - datain.position( t + ysize ); - b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - buf += b; - datain.position( t + ysize + group_size ); - b = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - buf += b; - dataout.put( (int)( ( buf / 4.0f ) + 0.5f ) ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - } - - public static void halve1Dimage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int dest = 0; - int jj; - - assert( width == 1 || height == 1 ); // must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // can't be 1x1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( src + group_size ); - uint[1] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - } else { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); - datain.position( src + group_size ); - uint[1] = ( 0x00000000FFFFFFFF & datain.getInt() ); - } - dataout.put( (int)( ( (float)uint[0] + (float)uint[1] ) / 2.0f) ); - src += element_size; - dest += 4; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assertion only - } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - datain.position( src + ysize ); - uint[1] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); - } else { - datain.position( src ); - uint[0] = ( 0x00000000FFFFFFFF & datain.getInt() ); - datain.position( src + ysize ); - uint[1] = ( 0x00000000FFFFFFFF & datain.getInt() ); - } - dataout.put( (int)(( (float)uint[0] + (float)uint[1] ) / 2.0f) ); - src += element_size; - dest += 4; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - assert( src == ysize * height ); - } - assert( dest == ( components * element_size * halfWidth * halfHeight ) ); - } - - public static void halveImage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; - int newwidth, newheight; - int s = 0; - int t = 0; - float temp = 0.0f; - // handle case where there is only 1 column/row - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); // can't be 1x1 - halve1Dimage_float( components, width, height, datain, dataout, element_size, - ysize, group_size, myswap_bytes ); - return; - } - - newwidth = width / 2; - newheight = height / 2; - - // Piece of cake - if( !myswap_bytes ) { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - datain.position( t ); - temp = datain.getFloat(); - datain.position( t + group_size ); - temp += datain.getFloat(); - datain.position( t + ysize ); - temp += datain.getFloat(); - datain.position( t + ysize + group_size ); - temp /= 4.0f; - dataout.put( temp ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } else { - for( i = 0; i < newheight; i++ ) { - for( j = 0; j < newwidth; j++ ) { - for( k = 0; k < components; k++ ) { - float buf; - datain.position( t ); - buf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - datain.position( t + group_size ); - buf += Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - datain.position( t + ysize ); - buf += Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - datain.position( t + ysize + group_size ); - buf += Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - dataout.put( buf / 4.0f ); - t += element_size; - } - t += group_size; - } - t += ysize; - } - } - } - - public static void halve1Dimage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int dest = 0; - int jj; - - assert( width == 1 || height == 1 ); // must be 1D - assert( width != height ); // can't be square - - if( height == 1 ) { // 1 row - assert( width != 1 ); // can't be 1x1 - halfHeight = 1; - - for( jj = 0; jj < halfWidth; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - datain.position( src + group_size ); - sfloat[1] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - } else { - datain.position( src ); - sfloat[0] = datain.getFloat(); - datain.position( src + group_size ); - sfloat[1] = datain.getFloat(); - } - dataout.put( (sfloat[0] + sfloat[1]) / 2.0f ); - src += element_size; - dest += 4; - } - src += group_size; // skip to next 2 - } - int padBytes = ysize - ( width * group_size ); - src += padBytes; // for assertion only - } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); - assert( height != 1 ); - halfWidth = 1; - // one vertical column with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - int kk; - for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; - if( myswap_bytes ) { - datain.position( src ); - sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - datain.position( src + ysize ); - sfloat[1] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - } else { - datain.position( src ); - sfloat[0] = datain.getFloat(); - datain.position( src + ysize ); - sfloat[1] = datain.getFloat(); - } - dataout.put( ( sfloat[0] + sfloat[1] ) / 2.0f ); - src += element_size; - dest += 4; - } - src += padBytes; // add pad bytes, if any, to get to end of row - src += ysize; - } - assert( src == ysize * height ); - } - assert( dest == ( components * element_size * halfWidth * halfHeight ) ); - } - - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { - if( width == 1 || height == 1 ) { - assert( !( width == 1 && height == 1 ) ); - halve1DimagePackedPixel( components, extract, width, height, datain, dataout, - pixelSizeInBytes, rowSizeInBytes, isSwap ); - return; - } - int ii, jj; - - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); - int outIndex = 0; - - for( ii = 0; ii < halfHeight; ii++ ) { - for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; - int cc; - - datain.position( src ); - extract.extract( isSwap, datain, extractTotals[0] ); - datain.position( src + pixelSizeInBytes ); - extract.extract( isSwap, datain, extractTotals[1] ); - datain.position( src + rowSizeInBytes ); - extract.extract( isSwap, datain, extractTotals[2] ); - datain.position( src + rowSizeInBytes + pixelSizeInBytes ); - extract.extract( isSwap, datain, extractTotals[3] ); - for( cc = 0; cc < components; cc++ ) { - int kk = 0; - // grab 4 pixels to average - totals[cc] = 0.0f; - for( kk = 0; kk < BOX4; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= BOX4; - } - extract.shove( totals, outIndex, dataout ); - outIndex++; - src += pixelSizeInBytes + pixelSizeInBytes; - } - // skip past pad bytes, if any, to get to next row - src += padBytes; - src += rowSizeInBytes; - } - assert( src == rowSizeInBytes * height ); - assert( outIndex == halfWidth * halfHeight ); - } - - public static void halve1DimagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { - int halfWidth = width / 2; - int halfHeight = height / 2; - int src = 0; - int jj; - - assert( width == 1 || height == 1 ); - assert( width != height ); - - if( height == 1 ) { - int outIndex = 0; - - assert( width != 1 ); - halfHeight = 1; - - // one horizontal row with possible pad bytes - - for( jj = 0; jj < halfWidth; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; - int cc; - - datain.position( src ); - extract.extract( isSwap, datain, extractTotals[0] ); - datain.position( src + pixelSizeInBytes ); - extract.extract( isSwap, datain, extractTotals[1] ); - for( cc = 0; cc < components; cc++ ) { - int kk = 0; - // grab 4 pixels to average - totals[cc] = 0.0f; - for( kk = 0; kk < BOX2; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= BOX2; - } - extract.shove( totals, outIndex, dataout ); - outIndex++; - // skip over to next group of 2 - src += pixelSizeInBytes + pixelSizeInBytes; - } - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); - src += padBytes; - - assert( src == rowSizeInBytes ); - assert( outIndex == halfWidth * halfHeight ); - } else if( width == 1 ) { - int outIndex = 0; - - assert( height != 1 ); - halfWidth = 1; - // one vertical volumn with possible pad bytes per row - // average two at a time - - for( jj = 0; jj < halfHeight; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; - int cc; - // average two at a time, instead of four - datain.position( src ); - extract.extract( isSwap, datain, extractTotals[0] ); - datain.position( src + rowSizeInBytes ); - extract.extract( isSwap, datain, extractTotals[1] ); - for( cc = 0; cc < components; cc++ ) { - int kk = 0; - // grab 4 pixels to average - totals[cc] = 0.0f; - for( kk = 0; kk < BOX2; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= BOX2; - } - extract.shove( totals, outIndex, dataout ); - outIndex++; - // skip over to next group of 2 - src += rowSizeInBytes + rowSizeInBytes; - } - assert( src == rowSizeInBytes ); - assert( outIndex == halfWidth * halfHeight ); - } - } - - public static void halveImagePackedPixelSlice( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { - int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; - int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); - int outIndex = 0; - - assert( (width == 1 || height == 1) && depth >= 2 ); - - if( width == height ) { - assert( width == 1 && height == 1 ); - assert( depth >= 2 ); - - for( ii = 0; ii < halfDepth; ii++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX2][4]; - int cc; - - dataIn.position( src ); - extract.extract( isSwap, dataIn, extractTotals[0] ); - dataIn.position( src + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[1] ); - - for( cc = 0; cc < components; cc++ ) { - int kk; - - // average only 2 pixels since a column - totals[cc]= 0.0f; - for( kk = 0; kk < BOX2; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= BOX2; - } // for cc - - extract.shove( totals, outIndex, dataOut ); - outIndex++; - // skip over to next group of 2 - src += imageSizeInBytes + imageSizeInBytes; - } // for ii - } else if( height == 1 ) { - assert( width != 1 ); - - for( ii = 0; ii < halfDepth; ii++ ) { - for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; - int cc; - - dataIn.position( src ); - extract.extract( isSwap, dataIn, extractTotals[0] ); - dataIn.position( src + pixelSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[1] ); - dataIn.position( src + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[2] ); - dataIn.position( src + pixelSizeInBytes + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[3] ); - - for( cc = 0; cc < components; cc++ ) { - int kk; - - // grab 4 pixels to average - totals[cc] = 0.0f; - for( kk = 0; kk < BOX4; kk++ ) { - totals[cc]+= extractTotals[kk][cc]; - } - totals[cc]/= (float)BOX4; - } - extract.shove( totals, outIndex, dataOut ); - outIndex++; - // skip over to next horizontal square of 4 - src += imageSizeInBytes + imageSizeInBytes; - } - } - } else if( width == 1 ) { - assert( height != 1 ); - - for( ii = 0; ii < halfDepth; ii++ ) { - for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; - int cc; - - dataIn.position( src ); - extract.extract( isSwap, dataIn, extractTotals[0] ); - dataIn.position( src + rowSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[1] ); - dataIn.position( src + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[2] ); - dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[3] ); - - for( cc = 0; cc < components; cc++ ) { - int kk; - - // grab 4 pixels to average - totals[cc] = 0.0f; - for( kk = 0; kk < BOX4; kk++ ) { - totals[cc]+= extractTotals[kk][cc]; - } - totals[cc]/= (float)BOX4; - } - extract.shove( totals, outIndex, dataOut ); - outIndex++; - // skip over to next horizontal square of 4 - src += imageSizeInBytes + imageSizeInBytes; - } - } - } - } - - public static void halveImageSlice( int components, ExtractPrimitive extract, int width, - int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { - int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; - int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); - int outIndex = 0; - - assert( (width == 1 || height == 1) && depth >= 2 ); - - if( width == height ) { - assert( width == 1 && height == 1 ); - assert( depth >= 2 ); - - for( ii = 0; ii < halfDepth; ii++ ) { - int cc; - for( cc = 0; cc < components; cc++ ) { - double[] totals = new double[4]; - double[][] extractTotals = new double[BOX2][4]; - int kk; - - dataIn.position( src ); - extractTotals[0][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + imageSizeInBytes ); - extractTotals[1][cc] = extract.extract( isSwap, dataIn ); - - // average 2 pixels since only a column - totals[cc] = 0.0f; - // totals[red] = extractTotals[0][red] + extractTotals[1][red]; - // totals[red] = red / 2; - for( kk = 0; kk < BOX2; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= (double)BOX2; - - extract.shove( totals[cc], outIndex, dataOut ); - outIndex++; - src += elementSizeInBytes; - } // for cc - // skip over next group of 2 - src += rowSizeInBytes; - } // for ii - - assert( src == rowSizeInBytes * height * depth ); - assert( outIndex == halfDepth * components ); - } else if( height == 1 ) { - assert( width != 1 ); - - for( ii = 0; ii < halfDepth; ii++ ) { - for( jj = 0; jj < halfWidth; jj++ ) { - int cc; - for( cc = 0; cc < components; cc++ ) { - int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; - - dataIn.position( src ); - extractTotals[0][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + groupSizeInBytes ); - extractTotals[1][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + imageSizeInBytes ); - extractTotals[2][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + imageSizeInBytes + groupSizeInBytes ); - extractTotals[3][cc] = extract.extract( isSwap, dataIn ); - - // grab 4 pixels to average - totals[cc] = 0.0f; - // totals[red] = extractTotals[0][red] + extractTotals[1][red] + - // extractTotals[2][red] + extractTotals[3][red]; - // totals[red] /= (double)BOX4; - for( kk = 0; kk < BOX4; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= (double)BOX4; - - extract.shove( totals[cc], outIndex, dataOut ); - outIndex++; - src += elementSizeInBytes; - } // for cc - // skip over to next horizontal square of 4 - src += elementSizeInBytes; - } // for jj - src += padBytes; - src += rowSizeInBytes; - } // for ii - assert( src == rowSizeInBytes * height * depth ); - assert( outIndex == halfWidth * halfDepth * components ); - } else if( width == 1 ) { - assert( height != 1 ); - - for( ii = 0; ii < halfDepth; ii++ ) { - for( jj = 0; jj < halfHeight; jj++ ) { - int cc; - for( cc = 0; cc < components; cc++ ) { - int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; - - dataIn.position( src ); - extractTotals[0][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + rowSizeInBytes ); - extractTotals[1][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + imageSizeInBytes ); - extractTotals[2][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + imageSizeInBytes + groupSizeInBytes ); - extractTotals[3][cc] = extract.extract( isSwap, dataIn ); - - - // grab 4 pixels to average - totals[cc] = 0.0f; - // totals[red] = extractTotals[0][red] + extractTotals[1][red] + - // extractTotals[2][red] + extractTotals[3][red]; - // totals[red] /= (double)BOX4; - for( kk = 0; kk < BOX4; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= (double)BOX4; - - extract.shove( totals[cc], outIndex, dataOut ); - outIndex++; - src += elementSizeInBytes; - } // for cc - // skip over to next horizontal square of 4 - src += padBytes; - src += rowSizeInBytes; - } // for jj - src += imageSizeInBytes; - } // for ii - assert( src == rowSizeInBytes * height * depth ); - assert( outIndex == halfWidth * halfDepth * components ); - } - } - - public static void halveImage3D( int components, ExtractPrimitive extract, - int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { - assert( depth > 1 ); - - // horizontal/vertical/onecolumn slice viewed from top - if( width == 1 || height == 1 ) { - assert( 1 <= depth ); - - halveImageSlice( components, extract, width, height, depth, dataIn, dataOut, - elementSizeInBytes, groupSizeInBytes, rowSizeInBytes, imageSizeInBytes, - isSwap ); - return; - } - - int ii, jj, dd; - - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; - int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); - int outIndex = 0; - - for( dd = 0; dd < halfDepth; dd++ ) { - for( ii = 0; ii < halfHeight; ii++ ) { - for( jj = 0; jj < halfWidth; jj++ ) { - int cc; - for( cc = 0; cc < components; cc++ ) { - int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX8][4]; - - dataIn.position( src ); - extractTotals[0][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + groupSizeInBytes ); - extractTotals[1][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + rowSizeInBytes ); - extractTotals[2][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + rowSizeInBytes + groupSizeInBytes ); - extractTotals[3][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + imageSizeInBytes ); - extractTotals[4][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + groupSizeInBytes + imageSizeInBytes ); - extractTotals[5][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); - extractTotals[6][cc] = extract.extract( isSwap, dataIn ); - dataIn.position( src + rowSizeInBytes + imageSizeInBytes + groupSizeInBytes ); - extractTotals[7][cc] = extract.extract( isSwap, dataIn ); - - totals[cc] = 0.0f; - - for( kk = 0; kk < BOX8; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= (double)BOX8; - - extract.shove( totals[cc], outIndex, dataOut ); - outIndex++; - - src += elementSizeInBytes; - } // for cc - // skip over to next square of 4 - src += groupSizeInBytes; - } // for jj - // skip past pad bytes, if any, to get to next row - src += padBytes; - src += rowSizeInBytes; - } // for ii - src += imageSizeInBytes; - } // for dd - assert( src == rowSizeInBytes * height * depth ); - assert( outIndex == halfWidth * halfHeight * halfDepth * components ); - } - - public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { - if( depth == 1 ) { - assert( 1 <= width && 1 <= height ); - - halveImagePackedPixel( components, extract, width, height, dataIn, dataOut, - pixelSizeInBytes, rowSizeInBytes, isSwap ); - return; - } else if( width == 1 || height == 1 ) { // a horizontal or vertical slice viewed from top - assert( 1 <= depth ); - - halveImagePackedPixelSlice( components, extract, width, height, depth, dataIn, - dataOut, pixelSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap ); - return; - } - int ii, jj, dd; - - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; - int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); - int outIndex = 0; - - for( dd = 0; dd < halfDepth; dd++ ) { - for( ii = 0; ii < halfHeight; ii++ ) { - for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; // 4 is max components - float extractTotals[][] = new float[BOX8][4]; - int cc; - - dataIn.position( src ); - extract.extract( isSwap, dataIn, extractTotals[0] ); - dataIn.position( src + pixelSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[1] ); - dataIn.position( src + rowSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[2] ); - dataIn.position( src + rowSizeInBytes + pixelSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[3] ); - dataIn.position( src + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[4] ); - dataIn.position( src + pixelSizeInBytes + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[5] ); - dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[6] ); - dataIn.position( src + rowSizeInBytes + pixelSizeInBytes + imageSizeInBytes ); - extract.extract( isSwap, dataIn, extractTotals[7] ); - - for( cc = 0; cc < components; cc++ ) { - int kk; - // grab 8 pixels to average - totals[cc] = 0.0f; - for( kk = 0; kk < BOX8; kk++ ) { - totals[cc] += extractTotals[kk][cc]; - } - totals[cc] /= (float)BOX8; - } - extract.shove( totals, outIndex, dataOut ); - outIndex++; - // skip over to next square of 4 - src += pixelSizeInBytes + pixelSizeInBytes; - } - // skip past pad bytes, if any, to get to next row - src += padBytes; - src += rowSizeInBytes; - } - src += imageSizeInBytes; - } - assert( src == rowSizeInBytes * height * depth ); - assert( outIndex == halfWidth * halfHeight * halfDepth ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Image.java b/src/net/java/games/jogl/impl/mipmap/Image.java deleted file mode 100644 index 1ea3b1f52..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Image.java +++ /dev/null @@ -1,1402 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import net.java.games.jogl.GL; -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Image { - - /** Creates a new instance of Image */ - public Image() { - } - - public static short getShortFromByteArray( byte[] array, int index ) { - short s; - s = (short)(array[index] << 8 ); - s |= (short)(0x00FF & array[index+1]); - return( s ); - } - - public static int getIntFromByteArray( byte[] array, int index ) { - int i; - i = ( array[index] << 24 ) & 0xFF000000; - i |= ( array[index+1] << 16 ) & 0x00FF0000; - i |= ( array[index+2] << 8 ) & 0x0000FF00; - i |= ( array[index+3] ) & 0x000000FF; - return( i ); - } - - public static float getFloatFromByteArray( byte[] array, int index ) { - int i = getIntFromByteArray( array, index ); - return( Float.intBitsToFloat(i) ); - } - - /* - * Extract array from user's data applying all pixel store modes. - * The internal format used is an array of unsigned shorts. - */ - public static void fill_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, ByteBuffer userdata, - ShortBuffer newimage ) { - int components; - int element_size; - int rowsize; - int padding; - int groups_per_line; - int group_size; - int elements_per_line; - int start; - int iter = 0; - int iter2; - int i, j, k; - boolean myswap_bytes; - - // Create a Extract interface object - Extract extract = null; - switch( type ) { - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - extract = new Extract332(); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - extract = new Extract233rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - extract = new Extract565(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - extract = new Extract565rev(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - extract = new Extract4444(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - extract = new Extract4444rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - extract = new Extract5551(); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - extract = new Extract1555rev(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - extract = new Extract8888(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - extract = new Extract8888rev(); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - extract = new Extract1010102(); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - extract = new Extract2101010rev(); - break; - } - - myswap_bytes = psm.getUnpackSwapBytes(); - components = Mipmap.elements_per_group( format, type ); - if( psm.getUnpackRowLength() > 0 ) { - groups_per_line = psm.getUnpackRowLength(); - } else { - groups_per_line = width; - } - - // All formats except GL_BITMAP fall out trivially - if( type == GL.GL_BITMAP ) { - int bit_offset; - int current_bit; - - rowsize = ( groups_per_line * components + 7 ) / 8; - padding = ( rowsize % psm.getUnpackAlignment() ); - if( padding != 0 ) { - rowsize += psm.getUnpackAlignment() - padding; - } - start = psm.getUnpackSkipRows() * rowsize + ( psm.getUnpackSkipPixels() * components / 8 ); - elements_per_line = width * components; - iter2 = 0; - for( i = 0; i < height; i++ ) { - iter = start; - userdata.position( iter ); // **************************************** - bit_offset = (psm.getUnpackSkipPixels() * components) % 8; - for( j = 0; j < elements_per_line; j++ ) { - // retrieve bit - if( psm.getUnpackLsbFirst() ) { - userdata.position( iter ); - current_bit = ( userdata.get() & 0x000000FF ) & ( 1 << bit_offset );//userdata[iter] & ( 1 << bit_offset ); - } else { - current_bit = ( userdata.get() & 0x000000FF ) & ( 1 << ( 7 - bit_offset ) ); - } - if( current_bit != 0 ) { - if( index_format ) { - newimage.position( iter2 ); - newimage.put( (short)1 ); - } else { - newimage.position( iter2 ); - newimage.put( (short)65535 ); - } - } else { - newimage.position( iter2 ); - newimage.put( (short)0 ); - } - bit_offset++; - if( bit_offset == 8 ) { - bit_offset = 0; - iter++; - } - iter2++; - } - start += rowsize; - } - } else { - element_size = Mipmap.bytes_per_element( type ); - group_size = element_size * components; - if( element_size == 1 ) { - myswap_bytes = false; - } - - rowsize = groups_per_line * group_size; - padding = ( rowsize % psm.getUnpackAlignment() ); - if( padding != 0 ) { - rowsize += psm.getUnpackAlignment() - padding; - } - start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; - elements_per_line = width * components; - - iter2 = 0; - for( i = 0; i < height; i++ ) { - iter = start; - userdata.position( iter ); //*************************************** - for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); - float[] extractComponents = new float[4]; - userdata.position( iter ); - switch( type ) { - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); - for( k = 0; k < 3; k++ ) { - newimage.put( (short)(extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); - for( k = 0; k < 3; k++ ) { - newimage.put( (short)(extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_BYTE ): - if( index_format ) { - newimage.put( (short)( 0x000000FF & userdata.get() ) );//userdata[iter]; - } else { - newimage.put( (short)( 0x000000FF & userdata.get()/*userdata[iter]*/ * 257 ) ); - } - break; - case( GL.GL_BYTE ): - if( index_format ) { - newimage.put( userdata.get() ); //userdata[iter]; - } else { - newimage.put( (short)(userdata.get()/*userdata[iter]*/ * 516 ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - extract.extract( myswap_bytes, userdata/*userdata[iter]*/, extractComponents ); - for( k = 0; k < 3; k++ ) { - newimage.put( (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 3; k++ ) { - newimage.put( (short)(extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)(extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)(extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - if( myswap_bytes ) { - widget.setUB1( userdata.get() ); - widget.setUB0( userdata.get() ); - } else { - widget.setUB0( userdata.get() ); - widget.setUB1( userdata.get() ); - } - if( type == GL.GL_SHORT ) { - if( index_format ) { - newimage.put( widget.getS0() ); - } else { - newimage.put( (short)(widget.getS0() * 2) ); - } - } else { - newimage.put( widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - extract.extract( myswap_bytes, userdata, extractComponents ); - for( k = 0; k < 4; k++ ) { - newimage.put( (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_INT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_FLOAT ): - if( myswap_bytes ) { - widget.setUB3( userdata.get() ); - widget.setUB2( userdata.get() ); - widget.setUB1( userdata.get() ); - widget.setUB0( userdata.get() ); - } else { - widget.setUB0( userdata.get() ); - widget.setUB1( userdata.get() ); - widget.setUB2( userdata.get() ); - widget.setUB3( userdata.get() ); - } - if( type == GL.GL_FLOAT ) { - if( index_format ) { - newimage.put( (short)widget.getF() ); - } else { - newimage.put( (short)(widget.getF() * 65535 ) ); - } - } else if( type == GL.GL_UNSIGNED_INT ) { - if( index_format ) { - newimage.put( (short)( widget.getUI() ) ); - } else { - newimage.put( (short)( widget.getUI() >> 16 ) ); - } - } else { - if( index_format ) { - newimage.put( (short)( widget.getI() ) ); - } else { - newimage.put( (short)( widget.getI() >> 15 ) ); - } - } - break; - } - iter += element_size; - } // for j - start += rowsize; - // want iter pointing at start, not within, row for assertion purposes - iter = start; - } // for i - - // iterators should be one byte past end - if( !Mipmap.isTypePackedPixel( type ) ) { - assert( iter2 == ( width * height * components ) ); - } else { - assert( iter2 == ( width * height * Mipmap.elements_per_group( format, 0 ) ) ); - } - assert( iter == ( rowsize * height + psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size ) ); - } - } - - /* - * Insert array into user's data applying all pixel store modes. - * Theinternal format is an array of unsigned shorts. - * empty_image() because it is the opposet of fill_image(). - */ - public static void empty_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, - ShortBuffer oldimage, ByteBuffer userdata ) { - - int components; - int element_size; - int rowsize; - int padding; - int groups_per_line; - int group_size; - int elements_per_line; - int start; - int iter = 0; - int iter2; - int i, j, k; - boolean myswap_bytes; - - // Create a Extract interface object - Extract extract = null; - switch( type ) { - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - extract = new Extract332(); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - extract = new Extract233rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - extract = new Extract565(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - extract = new Extract565rev(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - extract = new Extract4444(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - extract = new Extract4444rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - extract = new Extract5551(); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - extract = new Extract1555rev(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - extract = new Extract8888(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - extract = new Extract8888rev(); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - extract = new Extract1010102(); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - extract = new Extract2101010rev(); - break; - } - - myswap_bytes = psm.getPackSwapBytes(); - components = Mipmap.elements_per_group( format, type ); - if( psm.getPackRowLength() > 0 ) { - groups_per_line = psm.getPackRowLength(); - } else { - groups_per_line = width; - } - - // all formats except GL_BITMAP fall out trivially - if( type == GL.GL_BITMAP ) { - int bit_offset; - int current_bit; - - rowsize = ( groups_per_line * components + 7 ) / 8; - padding = ( rowsize % psm.getPackAlignment() ); - if( padding != 0 ) { - rowsize += psm.getPackAlignment() - padding; - } - start = psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * components / 8; - elements_per_line = width * components; - iter2 = 0; - for( i = 0; i < height; i++ ) { - iter = start; - bit_offset = ( psm.getPackSkipPixels() * components ) % 8; - for( j = 0; j < elements_per_line; j++ ) { - if( index_format ) { - current_bit = oldimage.get( iter2 ) & 1; - } else { - if( oldimage.get( iter2 ) < 0 ) { // must check for negative rather than 32767 - current_bit = 1; - } else { - current_bit = 0; - } - } - - if( current_bit != 0 ) { - if( psm.getPackLsbFirst() ) { - userdata.put( iter, (byte)( ( userdata.get( iter ) | ( 1 << bit_offset ) ) ) ); - } else { - userdata.put( iter, (byte)( ( userdata.get( iter ) | ( 7 - bit_offset ) ) ) ); - } - } else { - if( psm.getPackLsbFirst() ) { - //userdata[iter] &= ~( 1 << bit_offset ); - userdata.put( iter, (byte)( ( userdata.get( iter ) & ~( 1 << bit_offset ) ) ) ); - } else { - //userdata[iter] &= ~( 1 << ( 7 - bit_offset ) ); - userdata.put( iter, (byte)( ( userdata.get( iter ) & ~( 7 - bit_offset ) ) ) ); - } - } - - bit_offset++; - if( bit_offset == 8 ) { - bit_offset = 0; - iter++; - } - iter2++; - } - start += rowsize; - } - } else { - float shoveComponents[] = new float[4]; - - element_size = Mipmap.bytes_per_element( type ); - group_size = element_size * components; - if( element_size == 1 ) { - myswap_bytes = false; - } - - rowsize = groups_per_line * group_size; - padding = ( rowsize % psm.getPackAlignment() ); - if( padding != 0 ) { - rowsize += psm.getPackAlignment() - padding; - } - start = psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size; - elements_per_line = width * components; - - iter2 = 0; - for( i = 0; i < height; i++ ) { - iter = start; - for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); - - switch( type ) { - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - for( k = 0; k < 3; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, userdata ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - for( k = 0; k < 3; k++ ) { - shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; - } - extract.shove( shoveComponents, 0, userdata ); - break; - case( GL.GL_UNSIGNED_BYTE ): - if( index_format ) { - //userdata[iter] = (byte)oldimage[iter2++]; - userdata.put( iter, (byte)oldimage.get(iter2++) ); - } else { - //userdata[iter] = (byte)( oldimage[iter2++] >> 8 ); - userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); - } - break; - case( GL.GL_BYTE ): - if( index_format ) { - //userdata[iter] = (byte)oldimage[iter2++]; - userdata.put( iter, (byte)oldimage.get(iter2++) ); - } else { - //userdata[iter] = (byte)( oldimage[iter2++] >> 9 ); - userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - for( k = 0; k < 3; k++ ) { - shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1,widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter+1] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - for( k = 0; k < 3; k++ ) { - shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter+1] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter+1] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter+1] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter+1] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter+1] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - if( type == GL.GL_SHORT ) { - if( index_format ) { - widget.setS0( oldimage.get( iter2++ ) ); - } else { - widget.setS0( (short)(oldimage.get( iter2++ ) >> 1) ); - } - } else { - widget.setUS0( oldimage.get( iter2++ ) ); - } - if( myswap_bytes ) { - //userdata[iter] = widget.getUB1(); - //userdata[iter+1] = widget.getUB0(); - userdata.put( iter, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB0() ); - } else { - //userdata[iter] = widget.getUB0(); - //userdata[iter] = widget.getUB1(); - userdata.put( iter, widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter+3] = widget.getUB0(); - //userdata[iter+2] = widget.getUB1(); - //userdata[iter+1] = widget.getUB2(); - //userdata[iter ] = widget.getUB3(); - userdata.put( iter + 3, widget.getUB0() ); - userdata.put( iter + 2, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB2() ); - userdata.put( iter , widget.getUB3() ); - } else { - userdata.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter+3] = widget.getUB0(); - //userdata[iter+2] = widget.getUB1(); - //userdata[iter+1] = widget.getUB2(); - //userdata[iter ] = widget.getUB3(); - userdata.put( iter + 3, widget.getUB0() ); - userdata.put( iter + 2, widget.getUB1() ); - userdata.put( iter + 2, widget.getUB2() ); - userdata.put( iter , widget.getUB3() ); - } else { - userdata.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter+3] = widget.getUB0(); - //userdata[iter+2] = widget.getUB1(); - //userdata[iter+1] = widget.getUB2(); - //userdata[iter ] = widget.getUB3(); - userdata.put( iter + 3, widget.getUB0() ); - userdata.put( iter + 2, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB2() ); - userdata.put( iter , widget.getUB3() ); - } else { - userdata.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswap_bytes ) { - //userdata[iter+3] = widget.getUB0(); - //userdata[iter+2] = widget.getUB1(); - //userdata[iter+1] = widget.getUB2(); - //userdata[iter ] = widget.getUB3(); - userdata.put( iter + 3, widget.getUB0() ); - userdata.put( iter + 2, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB2() ); - userdata.put( iter , widget.getUB3() ); - } else { - userdata.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_INT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_FLOAT ): - if( type == GL.GL_FLOAT ) { - if( index_format ) { - widget.setF( oldimage.get( iter2++ ) ); - } else { - widget.setF( oldimage.get( iter2++ ) / 65535.0f ); - } - } else if( type == GL.GL_UNSIGNED_INT ) { - if( index_format ) { - widget.setUI( oldimage.get( iter2++ ) ); - } else { - widget.setUI( oldimage.get( iter2++ ) * 65537 ); - } - } else { - if( index_format ) { - widget.setI( oldimage.get( iter2++ ) ); - } else { - widget.setI( (oldimage.get( iter2++ ) * 65537) / 2 ); - } - } - if( myswap_bytes ) { - userdata.put( iter + 3, widget.getUB0() ); - userdata.put( iter + 2, widget.getUB1() ); - userdata.put( iter + 1, widget.getUB2() ); - userdata.put( iter , widget.getUB3() ); - } else { - userdata.put( iter , widget.getUB0() ); - userdata.put( iter + 1, widget.getUB1() ); - userdata.put( iter + 2, widget.getUB2() ); - userdata.put( iter + 3, widget.getUB3() ); - } - break; - } - iter += element_size; - } // for j - start += rowsize; - // want iter pointing at start, not within, row for assertion purposes - iter = start; - } // for i - // iterators should be one byte past end - if( !Mipmap.isTypePackedPixel( type ) ) { - assert( iter2 == width * height * components ); - } else { - assert( iter2 == width * height * Mipmap.elements_per_group( format, 0 ) ); - } - assert( iter == rowsize * height + psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size ); - } - } - - public static void fillImage3D( PixelStorageModes psm, int width, int height, - int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, - ShortBuffer newImage ) { - boolean myswapBytes; - int components; - int groupsPerLine; - int elementSize; - int groupSize; - int rowSize; - int padding; - int elementsPerLine; - int rowsPerImage; - int imageSize; - int start, rowStart; - int iter = 0; - int iter2 = 0; - int ww, hh, dd, k; - Type_Widget widget = new Type_Widget(); - float extractComponents[] = new float[4]; - - // Create a Extract interface object - Extract extract = null; - switch( type ) { - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - extract = new Extract332(); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - extract = new Extract233rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - extract = new Extract565(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - extract = new Extract565rev(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - extract = new Extract4444(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - extract = new Extract4444rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - extract = new Extract5551(); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - extract = new Extract1555rev(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - extract = new Extract8888(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - extract = new Extract8888rev(); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - extract = new Extract1010102(); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - extract = new Extract2101010rev(); - break; - } - - myswapBytes = psm.getUnpackSwapBytes(); - components = Mipmap.elements_per_group( format, type ); - if( psm.getUnpackRowLength() > 0 ) { - groupsPerLine = psm.getUnpackRowLength(); - } else { - groupsPerLine = width; - } - elementSize = Mipmap.bytes_per_element( type ); - groupSize = elementSize * components; - if( elementSize == 1 ) { - myswapBytes = false; - } - - // 3dstuff begin - if( psm.getUnpackImageHeight() > 0 ) { - rowsPerImage = psm.getUnpackImageHeight(); - } else { - rowsPerImage = height; - } - // 3dstuff end - - rowSize = groupsPerLine * groupSize; - padding = rowSize % psm.getUnpackAlignment(); - if( padding != 0 ) { - rowSize += psm.getUnpackAlignment() - padding; - } - - imageSize = rowsPerImage * rowSize; // 3dstuff - - start = psm.getUnpackSkipRows() * rowSize + - psm.getUnpackSkipPixels() * groupSize + - psm.getUnpackSkipImages() * imageSize; - elementsPerLine = width * components; - - iter2 = 0; - for( dd = 0; dd < depth; dd++ ) { - rowStart = start; - for( hh = 0; hh < height; hh++ ) { - iter = rowStart; - for( ww = 0; ww < elementsPerLine; ww++ ) { - - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - if( indexFormat ) { - newImage.put( iter2++, (short)(0x000000FF & userImage.get( iter ) ) ); - } else { - newImage.put( iter2++, (short)((0x000000FF & userImage.get( iter ) ) * 257 ) ); - } - break; - case( GL.GL_BYTE ): - if( indexFormat ) { - newImage.put( iter2++, userImage.get( iter ) ); - } else { - newImage.put( iter2++, (short)(userImage.get( iter ) * 516 ) ); - } - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - userImage.position( iter ); - extract.extract( false, userImage, extractComponents ); - for( k = 0; k < 3; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - userImage.position( iter ); - extract.extract( false, userImage, extractComponents ); - for( k = 0; k < 3; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); - } - break; - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - if( myswapBytes ) { - widget.setUB0( userImage.get( iter + 1 ) ); - widget.setUB1( userImage.get( iter ) ); - } else { - widget.setUB0( userImage.get( iter ) ); - widget.setUB1( userImage.get( iter + 1 ) ); - } - if( type == GL.GL_SHORT ) { - if( indexFormat ) { - newImage.put( iter2++, widget.getUS0() ); - } else { - newImage.put( iter2++, (short)(widget.getUS0() * 2) ); - } - } else { - newImage.put( iter2++, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - userImage.position( iter ); - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - extract.extract( myswapBytes, userImage, extractComponents ); - for( k = 0; k < 4; k++ ) { - newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); - } - break; - case( GL.GL_INT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_FLOAT ): - if( myswapBytes ) { - widget.setUB0( userImage.get( iter + 3 ) ); - widget.setUB1( userImage.get( iter + 2 ) ); - widget.setUB2( userImage.get( iter + 1 ) ); - widget.setUB3( userImage.get( iter ) ); - } else { - widget.setUB0( userImage.get( iter ) ); - widget.setUB1( userImage.get( iter + 1 ) ); - widget.setUB2( userImage.get( iter + 2 ) ); - widget.setUB3( userImage.get( iter + 3 ) ); - } - if( type == GL.GL_FLOAT ) { - if( indexFormat ) { - newImage.put( iter2++, (short)widget.getF() ); - } else { - newImage.put( iter2++, (short)( widget.getF() * 65535.0f ) ); - } - } else if( type == GL.GL_UNSIGNED_INT ) { - if( indexFormat ) { - newImage.put( iter2++, (short)widget.getUI() ); - } else { - newImage.put( iter2++, (short)(widget.getUI() >> 16) ); - } - } else { - if( indexFormat ) { - newImage.put( iter2++, (short)widget.getI() ); - } else { - newImage.put( iter2++, (short)(widget.getI() >> 15) ); - } - } - break; - default: - assert( false ); - } - iter += elementSize; - } // for ww - rowStart += rowSize; - iter = rowStart; // for assert - } // for hh - start += imageSize; - }// for dd - - // iterators should be one byte past end - if( !Mipmap.isTypePackedPixel( type ) ) { - assert( iter2 == width * height * depth * components ); - } else { - assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) ); - } - assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize + - psm.getUnpackSkipPixels() * groupSize + - psm.getUnpackSkipImages() * imageSize ); - } - - public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, - int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { - boolean myswapBytes; - int components; - int groupsPerLine; - int elementSize; - int groupSize; - int rowSize; - int padding; - int start, rowStart, iter; - int elementsPerLine; - int iter2; - int ii, jj, dd, k; - int rowsPerImage; - int imageSize; - Type_Widget widget = new Type_Widget(); - float[] shoveComponents = new float[4]; - - // Create a Extract interface object - Extract extract = null; - switch( type ) { - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - extract = new Extract332(); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - extract = new Extract233rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - extract = new Extract565(); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - extract = new Extract565rev(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - extract = new Extract4444(); - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - extract = new Extract4444rev(); - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - extract = new Extract5551(); - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - extract = new Extract1555rev(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - extract = new Extract8888(); - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - extract = new Extract8888rev(); - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - extract = new Extract1010102(); - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - extract = new Extract2101010rev(); - break; - } - - iter = 0; - - myswapBytes = psm.getPackSwapBytes(); - components = Mipmap.elements_per_group( format, type ); - if( psm.getPackRowLength() > 0 ) { - groupsPerLine = psm.getPackRowLength(); - } else { - groupsPerLine = width; - } - - elementSize = Mipmap.bytes_per_element( type ); - groupSize = elementSize * components; - if( elementSize == 1 ) { - myswapBytes = false; - } - - // 3dstuff begin - if( psm.getPackImageHeight() > 0 ) { - rowsPerImage = psm.getPackImageHeight(); - } else { - rowsPerImage = height; - } - - // 3dstuff end - - rowSize = groupsPerLine * groupSize; - padding = rowSize % psm.getPackAlignment(); - if( padding != 0 ) { - rowSize += psm.getPackAlignment() - padding; - } - - imageSize = rowsPerImage * rowSize; - - start = psm.getPackSkipRows() * rowSize + - psm.getPackSkipPixels() * groupSize + - psm.getPackSkipImages() * imageSize; - elementsPerLine = width * components; - - iter2 = 0; - for( dd = 0; dd < depth; dd++ ) { - rowStart = start; - - for( ii = 0; ii < height; ii++ ) { - iter = rowStart; - - for( jj = 0; jj < elementsPerLine; jj++ ) { - - switch( type ) { - case( GL.GL_UNSIGNED_BYTE ): - if( indexFormat ) { - userImage.put( iter, (byte)(oldImage.get( iter2++ ) ) ); - } else { - userImage.put( iter, (byte)(oldImage.get( iter2++ ) >> 8 ) ); - } - break; - case( GL.GL_BYTE ): - if( indexFormat ) { - userImage.put( iter, (byte)(oldImage.get(iter2++) ) ); - } else { - userImage.put( iter, (byte)(oldImage.get(iter2++) >> 9) ); - } - break; - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - for( k = 0; k < 3; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, userImage ); - break; - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - for( k = 0; k < 3; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, userImage ); - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.putShort( iter, widget.getUB1() ); - userImage.putShort( iter + 1, widget.getUB0() ); - } else { - userImage.putShort( iter, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB0() ); - } else { - userImage.putShort( iter, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB0() ); - } else { - userImage.putShort( iter, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB0() ); - } else { - userImage.putShort( iter, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB0() ); - } else { - userImage.putShort( iter, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB0() ); - } else { - userImage.putShort( iter, widget.getUS0() ); - } - break; - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_SHORT ): - if( type == GL.GL_SHORT ) { - if( indexFormat ) { - widget.setS0( (short)oldImage.get( iter2++ ) ); - } else { - widget.setS0( (short)(oldImage.get( iter2++ ) >> 1) ); - } - } else { - widget.setUS0( (short)oldImage.get( iter2++ ) ); - } - if( myswapBytes ) { - userImage.put( iter, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB0() ); - } else { - userImage.put( iter, widget.getUB0() ); - userImage.put( iter + 1, widget.getUB1() ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter + 3, widget.getUB0() ); - userImage.put( iter + 2, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB2() ); - userImage.put( iter , widget.getUB3() ); - } else { - userImage.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter + 3, widget.getUB0() ); - userImage.put( iter + 2, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB2() ); - userImage.put( iter , widget.getUB3() ); - } else { - userImage.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter + 3, widget.getUB0() ); - userImage.put( iter + 2, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB2() ); - userImage.put( iter ,widget.getUB3() ); - } else { - userImage.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - for( k = 0; k < 4; k++ ) { - shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; - } - extract.shove( shoveComponents, 0, widget.getBuffer() ); - if( myswapBytes ) { - userImage.put( iter + 3, widget.getUB0() ); - userImage.put( iter + 2, widget.getUB2() ); - userImage.put( iter + 1, widget.getUB1() ); - userImage.put( iter , widget.getUB0() ); - } else { - userImage.putInt( iter, widget.getUI() ); - } - break; - case( GL.GL_INT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_FLOAT ): - if( type == GL.GL_FLOAT ) { - if( indexFormat ) { - widget.setF( oldImage.get( iter2++ ) ); - } else { - widget.setF( oldImage.get( iter2++ ) / 65535.0f ); - } - } else if( type == GL.GL_UNSIGNED_INT ) { - if( indexFormat ) { - widget.setUI( oldImage.get( iter2++ ) ); - } else { - widget.setUI( oldImage.get( iter2++ ) * 65537 ); - } - } else { - if( indexFormat ) { - widget.setI( oldImage.get( iter2++ ) ); - } else { - widget.setI( ( oldImage.get( iter2++ ) * 65535 ) / 2 ); - } - } - if( myswapBytes ) { - userImage.put( iter + 3, widget.getUB0() ); - userImage.put( iter + 2, widget.getUB1() ); - userImage.put( iter + 1, widget.getUB2() ); - userImage.put( iter , widget.getUB3() ); - } else { - userImage.put( iter , widget.getUB0() ); - userImage.put( iter + 1, widget.getUB1() ); - userImage.put( iter + 2, widget.getUB2() ); - userImage.put( iter + 3, widget.getUB3() ); - } - break; - default: - assert( false ); - } - - iter += elementSize; - } // for jj - rowStart += rowSize; - } // for ii - start += imageSize; - } // for dd - - if( !Mipmap.isTypePackedPixel( type ) ) { - assert( iter2 == width * height * depth * components ); - } else { - assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) ); - } - assert( iter == rowSize * height * depth + - psm.getUnpackSkipRows() * rowSize + - psm.getUnpackSkipPixels() * groupSize + - psm.getUnpackSkipImages() * imageSize ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Mipmap.java b/src/net/java/games/jogl/impl/mipmap/Mipmap.java deleted file mode 100644 index b3954704d..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Mipmap.java +++ /dev/null @@ -1,799 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import net.java.games.jogl.GL; -import net.java.games.jogl.GLU; -import net.java.games.jogl.GLException; -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Mipmap { - - /** Creates a new instance of Mipmap */ - public Mipmap() { - } - - public static int computeLog( int value ) { - int i = 0; - // Error - if( value == 0 ) { - return( -1 ); - } - for( ;; ) { - if( (value & 1) >= 1 ) { - if( value != 1 ) { - return( -1 ); - } - return( i ); - } - value = value >> 1; - i++; - } - } - - /* Compute the nearest power of 2 number. This algorithm is a little strange - * but it works quite well. - */ - public static int nearestPower( int value ) { - int i = 1; - // Error! - if( value == 0 ) { - return( -1 ); - } - for( ;; ) { - if( value == 1 ) { - return( i ); - } else if( value == 3 ) { - return( i * 4 ); - } - value = value >> 1; - i *= 2; - } - } - - public static short GLU_SWAP_2_BYTES( short s ) { - byte b = 0; - b = (byte)( s >>> 8 ); - s = (short)( s << 8 ); - s = (short)( s | (0x00FF & b) ); - return( s ); - } - - public static int GLU_SWAP_4_BYTES( int i ) { - int t = i << 24; - t |= 0x00FF0000 & ( i << 8 ); - t |= 0x0000FF00 & ( i >>> 8 ); - t |= 0x000000FF & ( i >>> 24 ); - return( t ); - } - - public static float GLU_SWAP_4_BYTES( float f ) { - int i = Float.floatToRawIntBits( f ); - float temp = Float.intBitsToFloat( i ); - return( temp ); - } - - public static int checkMipmapArgs( int internalFormat, int format, int type ) { - if( !legalFormat( format ) || !legalType( type ) ) { - return( GLU.GLU_INVALID_ENUM ); - } - if( format == GL.GL_STENCIL_INDEX ) { - return( GLU.GLU_INVALID_ENUM ); - } - if( !isLegalFormatForPackedPixelType( format, type ) ) { - return( GLU.GLU_INVALID_OPERATION ); - } - return( 0 ); - } - - public static boolean legalFormat( int format ) { - switch( format ) { - case( GL.GL_COLOR_INDEX ): - case( GL.GL_STENCIL_INDEX ): - case( GL.GL_DEPTH_COMPONENT ): - case( GL.GL_RED ): - case( GL.GL_GREEN ): - case( GL.GL_BLUE ): - case( GL.GL_ALPHA ): - case( GL.GL_RGB ): - case( GL.GL_RGBA ): - case( GL.GL_LUMINANCE ): - case( GL.GL_LUMINANCE_ALPHA ): - case( GL.GL_BGR ): - case( GL.GL_BGRA ): - return( true ); - default: - return( false ); - } - } - - public static boolean legalType( int type ) { - switch( type ) { - case( GL.GL_BITMAP ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_INT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_FLOAT ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - return( true ); - default: - return( false ); - } - } - - public static boolean isTypePackedPixel( int type ) { - assert( legalType( type ) ); - - if( type == GL.GL_UNSIGNED_BYTE_3_3_2 || - type == GL.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL.GL_UNSIGNED_SHORT_5_6_5 || - type == GL.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || - type == GL.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || - type == GL.GL_UNSIGNED_SHORT_1_5_5_5_REV || - type == GL.GL_UNSIGNED_INT_8_8_8_8 || - type == GL.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL.GL_UNSIGNED_INT_10_10_10_2 || - type == GL.GL_UNSIGNED_INT_2_10_10_10_REV ) { - return( true ); - } - return( false ); - } - - public static boolean isLegalFormatForPackedPixelType( int format, int type ) { - // if not a packed pixel type then return true - if( isTypePackedPixel( type ) ) { - return( true ); - } - - // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB - if( (type == GL.GL_UNSIGNED_BYTE_3_3_2 || type == GL.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL.GL_UNSIGNED_SHORT_5_6_5_REV ) - & format != GL.GL_RGB ) { - return( false ); - } - - // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & - // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT - if( ( type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || - type == GL.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || - type == GL.GL_UNSIGNED_SHORT_1_5_5_5_REV || - type == GL.GL_UNSIGNED_INT_8_8_8_8 || - type == GL.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL.GL_UNSIGNED_INT_10_10_10_2 || - type == GL.GL_UNSIGNED_INT_2_10_10_10_REV ) && - (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { - return( false ); - } - return( true ); - } - - public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, - int totalLevels ) { - if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || - (totalLevels < maxLevel) ) { - return( false ); - } - return( true ); - } - - /* Given user requested textures size, determine if it fits. If it doesn't then - * halve both sides and make the determination again until it does fit ( for - * IR only ). - * Note that proxy textures are not implemented in RE* even though they - * advertise the texture extension. - * Note that proxy textures are implemented but not according to spec in IMPACT* - */ - public static void closestFit( GL gl, int target, int width, int height, int internalFormat, - int format, int type, int[] newWidth, int[] newHeight ) { - // Use proxy textures if OpenGL version >= 1.1 - if( Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) ) >= 1.1 ) { - int widthPowerOf2 = nearestPower( width ); - int heightPowerOf2 = nearestPower( height ); - int[] proxyWidth = new int[1]; - boolean noProxyTextures = false; - - // Some drivers (in particular, ATI's) seem to set a GL error - // when proxy textures are used even though this is in violation - // of the spec. Guard against this and interactions with the - // DebugGL by watching for GLException. - try { - do { - // compute level 1 width & height, clamping each at 1 - int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); - int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); - int proxyTarget; - - assert( widthAtLevelOne > 0 ); - assert( heightAtLevelOne > 0 ); - - // does width x height at level 1 & all their mipmaps fit? - if( target == GL.GL_TEXTURE_2D || target == GL.GL_PROXY_TEXTURE_2D ) { - proxyTarget = GL.GL_PROXY_TEXTURE_2D; - gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, - heightAtLevelOne, 0, format, type, (double[])null ); - } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) || - (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) || - (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) || - (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB) || - (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB) || - (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ) { - proxyTarget = GL.GL_PROXY_TEXTURE_CUBE_MAP_ARB; - gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, - heightAtLevelOne, 0, format, type, (double[])null ); - } else { - assert( target == GL.GL_TEXTURE_1D || target == GL.GL_PROXY_TEXTURE_1D ); - proxyTarget = GL.GL_PROXY_TEXTURE_1D; - gl.glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne, - 0, format, type, (double[])null ); - } - gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth ); - // does it fit? - if( proxyWidth[0] == 0 ) { // nope, so try again with theses sizes - if( widthPowerOf2 == 1 && heightPowerOf2 == 1 ) { - /* A 1x1 texture couldn't fit for some reason so break out. This - * should never happen. But things happen. The disadvantage with - * this if-statement is that we will never be aware of when this - * happens since it will silently branch out. - */ - noProxyTextures = true; - break; - } - widthPowerOf2 = widthAtLevelOne; - heightPowerOf2 = heightAtLevelOne; - } - // else it does fit - } while( proxyWidth[0] == 0 ); - } catch (GLException e) { - noProxyTextures = true; - } - // loop must terminate - // return the width & height at level 0 that fits - if( !noProxyTextures ) { - newWidth[0] = widthPowerOf2; - newHeight[0] = heightPowerOf2; - return; - } - } - int[] maxsize = new int[1]; - gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize ); - // clamp user's texture sizes to maximum sizes, if necessary - newWidth[0] = nearestPower( width ); - if( newWidth[0] > maxsize[0] ) { - newWidth[0] = maxsize[0]; - } - newHeight[0] = nearestPower( height ); - if( newHeight[0] > maxsize[0] ) { - newHeight[0] = maxsize[0]; - } - } - - public static void closestFit3D( GL gl, int target, int width, int height, int depth, - int internalFormat, int format, int type, int[] newWidth, int[] newHeight, - int[] newDepth ) { - int widthPowerOf2 = nearestPower( width ); - int heightPowerOf2 = nearestPower( height ); - int depthPowerOf2 = nearestPower( depth ); - int[] proxyWidth = new int[1]; - - do { - // compute level 1 width & height & depth, clamping each at 1 - int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; - int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; - int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; - int proxyTarget = 0; - assert( widthAtLevelOne > 0 ); - assert( heightAtLevelOne > 0 ); - assert( depthAtLevelOne > 0 ); - - // does width x height x depth at level 1 & all their mipmaps fit? - if( target == GL.GL_TEXTURE_3D || target == GL.GL_PROXY_TEXTURE_3D ) { - proxyTarget = GL.GL_PROXY_TEXTURE_3D; - gl.glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, - heightAtLevelOne, depthAtLevelOne, 0, format, type, (double[])null ); - } - gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth ); - // does it fit - if( proxyWidth[0] == 0 ) { - if( widthPowerOf2 == 1 && heightPowerOf2 == 1 && depthPowerOf2 == 1 ) { - newWidth[0] = newHeight[0] = newDepth[0] = 1; - return; - } - widthPowerOf2 = widthAtLevelOne; - heightPowerOf2 = heightAtLevelOne; - depthPowerOf2 = depthAtLevelOne; - } - } while( proxyWidth[0] == 0 ); - // loop must terminate - - // return the width & height at level 0 that fits - newWidth[0] = widthPowerOf2; - newHeight[0] = heightPowerOf2; - newDepth[0] = depthPowerOf2; - } - - public static int elements_per_group( int format, int type ) { - // Return the number of elements per grtoup of a specified gromat - - // If the type is packedpixels then answer is 1 - if( type == GL.GL_UNSIGNED_BYTE_3_3_2 || - type == GL.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL.GL_UNSIGNED_SHORT_5_6_5 || - type == GL.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || - type == GL.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || - type == GL.GL_UNSIGNED_SHORT_1_5_5_5_REV || - type == GL.GL_UNSIGNED_INT_8_8_8_8 || - type == GL.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL.GL_UNSIGNED_INT_10_10_10_2 || - type == GL.GL_UNSIGNED_INT_2_10_10_10_REV ) { - return( 1 ); - } - - // Types are not packed pixels so get elements per group - switch( format ) { - case( GL.GL_RGB ): - case( GL.GL_BGR ): - return( 3 ); - case( GL.GL_LUMINANCE_ALPHA ): - return( 2 ); - case( GL.GL_RGBA ): - case( GL.GL_BGRA ): - return( 4 ); - default: - return( 1 ); - } - } - - public static int bytes_per_element( int type ) { - // return the number of bytes per element, based on the element type - - switch( type ) { - case( GL.GL_BITMAP ): - case( GL.GL_BYTE ): - case( GL.GL_UNSIGNED_BYTE ): - case( GL.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL.GL_UNSIGNED_BYTE_2_3_3_REV ): - return( 1 ); - case( GL.GL_SHORT ): - case( GL.GL_UNSIGNED_SHORT ): - case( GL.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - return( 2 ); - case( GL.GL_INT ): - case( GL.GL_UNSIGNED_INT ): - case( GL.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL.GL_UNSIGNED_INT_2_10_10_10_REV ): - case( GL.GL_FLOAT ): - return( 4 ); - default: - return( 4 ); - } - } - - public static boolean is_index( int format ) { - return( format == GL.GL_COLOR_INDEX || format == GL.GL_STENCIL_INDEX ); - } - - /* Compute memory required for internal packed array of data of given type and format. */ - - public static int image_size( int width, int height, int format, int type ) { - int bytes_per_row; - int components; - - assert( width > 0 ); - assert( height > 0 ); - components = elements_per_group( format, type ); - if( type == GL.GL_BITMAP ) { - bytes_per_row = (width + 7) / 8; - } else { - bytes_per_row = bytes_per_element( type ) * width; - } - return( bytes_per_row * height * components ); - } - - public static int imageSize3D( int width, int height, int depth, int format, int type ) { - int components = elements_per_group( format, type ); - int bytes_per_row = bytes_per_element( type ) * width; - - assert( width > 0 && height > 0 && depth > 0 ); - assert( type != GL.GL_BITMAP ); - - return( bytes_per_row * height * depth * components ); - } - - public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a ); - psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a ); - psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a ); - psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a ); - psm.setUnpackSkipPixels( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a ); - psm.setUnpackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a ); - psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - - gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a ); - psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a ); - psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a ); - psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a ); - psm.setPackSkipPixels( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a ); - psm.setPackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a ); - psm.setPackSwapBytes( ( a[0] == 1 ) ); - } - - public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a ); - psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a ); - psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a ); - psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a ); - psm.setUnpackSkipPixels( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a ); - psm.setUnpackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a ); - psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL.GL_UNPACK_SKIP_IMAGES, a ); - psm.setUnpackSkipImages( a[0] ); - gl.glGetIntegerv( GL.GL_UNPACK_IMAGE_HEIGHT, a ); - psm.setUnpackImageHeight( a[0] ); - - gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a ); - psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a ); - psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a ); - psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a ); - psm.setPackSkipPixels( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a ); - psm.setPackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a ); - psm.setPackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL.GL_PACK_SKIP_IMAGES, a ); - psm.setPackSkipImages( a[0] ); - gl.glGetIntegerv( GL.GL_PACK_IMAGE_HEIGHT, a ); - psm.setPackImageHeight( a[0] ); - } - - public static int gluScaleImage( GL gl, int format, int widthin, int heightin, - int typein, ByteBuffer datain, int widthout, int heightout, - int typeout, ByteBuffer dataout ) { - int components; - ByteBuffer beforeimage; - ByteBuffer afterimage; - PixelStorageModes psm = new PixelStorageModes(); - - if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { - return( 0 ); - } - if( (widthin < 0) || (heightin < 0) || (widthout < 0) || (heightout < 0) ) { - return( GLU.GLU_INVALID_VALUE ); - } - if( !legalFormat( format ) || !legalType( typein ) || !legalType( typeout ) ) { - return( GLU.GLU_INVALID_ENUM ); - } - if( !isLegalFormatForPackedPixelType( format, typein ) ) { - return( GLU.GLU_INVALID_OPERATION ); - } - if( !isLegalFormatForPackedPixelType( format, typeout ) ) { - return( GLU.GLU_INVALID_OPERATION ); - } - beforeimage = ByteBuffer.allocateDirect( image_size( widthin, heightin, format, GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ); - afterimage = ByteBuffer.allocateDirect( image_size( widthout, heightout, format, GL.GL_UNSIGNED_SHORT ) ).order( ByteOrder.nativeOrder() ); - if( beforeimage == null || afterimage == null ) { - return( GLU.GLU_OUT_OF_MEMORY ); - } - - retrieveStoreModes( gl, psm ); - Image.fill_image( psm, widthin, heightin, format, typein, is_index( format ), datain, beforeimage.asShortBuffer() ); - components = elements_per_group( format, 0 ); - ScaleInternal.scale_internal( components, widthin, heightin, beforeimage.asShortBuffer(), widthout, heightout, afterimage.asShortBuffer() ); - Image.empty_image( psm, widthout, heightout, format, typeout, is_index( format ), afterimage.asShortBuffer(), dataout ); - - return( 0 ); - } - - public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, - int width, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { - int levels; - - int rc = checkMipmapArgs( internalFormat, format, type ); - if( rc != 0 ) { - return( rc ); - } - - if( width < 1 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - levels = computeLog( width ); - - levels += userLevel; - if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { - return( GLU.GLU_INVALID_VALUE ); - } - - return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, width, - width, format, type, userLevel, baseLevel, maxLevel, data ) ); - } - - public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, - int format, int type, ByteBuffer data ) { - int[] widthPowerOf2 = new int[1]; - int levels; - int[] dummy = new int[1]; - - int rc = checkMipmapArgs( internalFormat, format, type ); - if( rc != 0 ) { - return( rc ); - } - - if( width < 1 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - closestFit( gl, target, width, 1, internalFormat, format, type, widthPowerOf2, dummy ); - levels = computeLog( widthPowerOf2[0] ); - - return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, - width, widthPowerOf2[0], format, type, 0, 0, levels, data ) ); - } - - public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int format, int type, int userLevel, - int baseLevel, int maxLevel, Object data ) { - int level, levels; - - int rc = checkMipmapArgs( internalFormat, format, type ); - if( rc != 0 ) { - return( rc ); - } - - if( width < 1 || height < 1 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - levels = computeLog( width ); - level = computeLog( height ); - if( level > levels ) { - levels = level; - } - - levels += userLevel; - if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { - return( GLU.GLU_INVALID_VALUE ); - } - - //PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data ); - ByteBuffer buffer = null; - if( data instanceof ByteBuffer ) { - buffer = (ByteBuffer)data; - } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; - buffer = ByteBuffer.allocateDirect(array.length); - buffer.put(array); - } else if( data instanceof short[] ) { - short[] array = (short[])data; - buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); - sb.put( array ); - } else if( data instanceof int[] ) { - int[] array = (int[])data; - buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); - ib.put( array ); - } else if( data instanceof float[] ) { - float[] array = (float[])data; - buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); - fb.put( array ); - } - - return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, - width, height, width, height, format, type, userLevel, baseLevel, - maxLevel, buffer ) ); - } - - public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, Object data ) { - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; - int level, levels; - - int rc = checkMipmapArgs( internalFormat, format, type ); - if( rc != 0 ) { - return( rc ); - } - - if( width < 1 || height < 1 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - closestFit( gl, target, width, height, internalFormat, format, type, - widthPowerOf2, heightPowerOf2 ); - - levels = computeLog( widthPowerOf2[0] ); - level = computeLog( heightPowerOf2[0] ); - if( level > levels ) { - levels = level; - } - - //PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data ); - ByteBuffer buffer = null; - if( data instanceof ByteBuffer ) { - buffer = (ByteBuffer)data; - } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; - buffer = ByteBuffer.allocateDirect(array.length); - buffer.put(array); - } else if( data instanceof short[] ) { - short[] array = (short[])data; - buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); - sb.put( array ); - } else if( data instanceof int[] ) { - int[] array = (int[])data; - buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); - ib.put( array ); - } else if( data instanceof float[] ) { - float[] array = (float[])data; - buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); - fb.put( array ); - } - - return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, - width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0, - 0, levels, buffer ) ); - } - - public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, ByteBuffer data ) { - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; - int[] depthPowerOf2 = new int[1]; - int level, levels; - - int rc = checkMipmapArgs( internalFormat, format, type ); - if( rc != 0 ) { - return( rc ); - } - - if( width < 1 || height < 1 || depth < 1 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - if( type == GL.GL_BITMAP ) { - return( GLU.GLU_INVALID_ENUM ); - } - - closestFit3D( gl, target, width, height, depth, internalFormat, format, - type, widthPowerOf2, heightPowerOf2, depthPowerOf2 ); - - levels = computeLog( widthPowerOf2[0] ); - level = computeLog( heightPowerOf2[0] ); - if( level > levels ) { - levels = level; - } - level = computeLog( depthPowerOf2[0] ); - if( level > levels ) { - levels = level; - } - - return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width, - height, depth, widthPowerOf2[0], heightPowerOf2[0], depthPowerOf2[0], - format, type, 0, 0, levels, data ) ); - } - - public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { - int level, levels; - - int rc = checkMipmapArgs( internalFormat, format, type ); - if( rc != 0 ) { - return( rc ); - } - - if( width < 1 || height < 1 || depth < 1 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - if( type == GL.GL_BITMAP ) { - return( GLU.GLU_INVALID_ENUM ); - } - - levels = computeLog( width ); - level = computeLog( height ); - if( level > levels ) { - levels = level; - } - level = computeLog( depth ); - if( level > levels ) { - levels = level; - } - - levels += userLevel; - if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { - return( GLU.GLU_INVALID_VALUE ); - } - - return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width, - height, depth, width, height, depth, format, type, userLevel, - baseLevel, maxLevel, data ) ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/PixelStorageModes.java b/src/net/java/games/jogl/impl/mipmap/PixelStorageModes.java deleted file mode 100644 index cc3b4ed47..000000000 --- a/src/net/java/games/jogl/impl/mipmap/PixelStorageModes.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -/** - * - * @author Administrator - */ -public class PixelStorageModes { - - /** - * Holds value of property packAlignment. - */ - private int packAlignment; - - /** - * Holds value of property packRowLength. - */ - private int packRowLength; - - /** - * Holds value of property packSkipRows. - */ - private int packSkipRows; - - /** - * Holds value of property packSkipPixels. - */ - private int packSkipPixels; - - /** - * Holds value of property packLsbFirst. - */ - private boolean packLsbFirst; - - /** - * Holds value of property packSwapBytes. - */ - private boolean packSwapBytes; - - /** - * Holds value of property packSkipImages. - */ - private int packSkipImages; - - /** - * Holds value of property packImageHeight. - */ - private int packImageHeight; - - /** - * Holds value of property unpackAlignment. - */ - private int unpackAlignment; - - /** - * Holds value of property unpackRowLength. - */ - private int unpackRowLength; - - /** - * Holds value of property unpackSkipRows. - */ - private int unpackSkipRows; - - /** - * Holds value of property unpackSkipPixels. - */ - private int unpackSkipPixels; - - /** - * Holds value of property unpackLsbFirst. - */ - private boolean unpackLsbFirst; - - /** - * Holds value of property unpackSwapBytes. - */ - private boolean unpackSwapBytes; - - /** - * Holds value of property unpackSkipImages. - */ - private int unpackSkipImages; - - /** - * Holds value of property unpackImageHeight. - */ - private int unpackImageHeight; - - /** Creates a new instance of PixelStorageModes */ - public PixelStorageModes() { - } - - /** - * Getter for property packAlignment. - * @return Value of property packAlignment. - */ - public int getPackAlignment() { - - return this.packAlignment; - } - - /** - * Setter for property packAlignment. - * @param packAlignment New value of property packAlignment. - */ - public void setPackAlignment(int packAlignment) { - - this.packAlignment = packAlignment; - } - - /** - * Getter for property packRowLength. - * @return Value of property packRowLength. - */ - public int getPackRowLength() { - - return this.packRowLength; - } - - /** - * Setter for property packRowLength. - * @param packRowLength New value of property packRowLength. - */ - public void setPackRowLength(int packRowLength) { - - this.packRowLength = packRowLength; - } - - /** - * Getter for property packSkipRows. - * @return Value of property packSkipRows. - */ - public int getPackSkipRows() { - - return this.packSkipRows; - } - - /** - * Setter for property packSkipRows. - * @param packSkipRows New value of property packSkipRows. - */ - public void setPackSkipRows(int packSkipRows) { - - this.packSkipRows = packSkipRows; - } - - /** - * Getter for property packSkipPixels. - * @return Value of property packSkipPixels. - */ - public int getPackSkipPixels() { - - return this.packSkipPixels; - } - - /** - * Setter for property packSkipPixels. - * @param packSkipPixels New value of property packSkipPixels. - */ - public void setPackSkipPixels(int packSkipPixels) { - - this.packSkipPixels = packSkipPixels; - } - - /** - * Getter for property packLsbFirst. - * @return Value of property packLsbFirst. - */ - public boolean getPackLsbFirst() { - - return this.packLsbFirst; - } - - /** - * Setter for property packLsbFirst. - * @param packLsbFirst New value of property packLsbFirst. - */ - public void setPackLsbFirst(boolean packLsbFirst) { - - this.packLsbFirst = packLsbFirst; - } - - /** - * Getter for property packSwapBytes. - * @return Value of property packSwapBytes. - */ - public boolean getPackSwapBytes() { - - return this.packSwapBytes; - } - - /** - * Setter for property packSwapBytes. - * @param packSwapBytes New value of property packSwapBytes. - */ - public void setPackSwapBytes(boolean packSwapBytes) { - - this.packSwapBytes = packSwapBytes; - } - - /** - * Getter for property packSkipImages. - * @return Value of property packSkipImages. - */ - public int getPackSkipImages() { - - return this.packSkipImages; - } - - /** - * Setter for property packSkipImages. - * @param packSkipImages New value of property packSkipImages. - */ - public void setPackSkipImages(int packSkipImages) { - - this.packSkipImages = packSkipImages; - } - - /** - * Getter for property packImageHeight. - * @return Value of property packImageHeight. - */ - public int getPackImageHeight() { - - return this.packImageHeight; - } - - /** - * Setter for property packImageHeight. - * @param packImageHeight New value of property packImageHeight. - */ - public void setPackImageHeight(int packImageHeight) { - - this.packImageHeight = packImageHeight; - } - - /** - * Getter for property unpackAlignment. - * @return Value of property unpackAlignment. - */ - public int getUnpackAlignment() { - - return this.unpackAlignment; - } - - /** - * Setter for property unpackAlignment. - * @param unpackAlignment New value of property unpackAlignment. - */ - public void setUnpackAlignment(int unpackAlignment) { - - this.unpackAlignment = unpackAlignment; - } - - /** - * Getter for property unpackRowLength. - * @return Value of property unpackRowLength. - */ - public int getUnpackRowLength() { - - return this.unpackRowLength; - } - - /** - * Setter for property unpackRowLength. - * @param unpackRowLength New value of property unpackRowLength. - */ - public void setUnpackRowLength(int unpackRowLength) { - - this.unpackRowLength = unpackRowLength; - } - - /** - * Getter for property unpackSkipRows. - * @return Value of property unpackSkipRows. - */ - public int getUnpackSkipRows() { - - return this.unpackSkipRows; - } - - /** - * Setter for property unpackSkipRows. - * @param unpackSkipRows New value of property unpackSkipRows. - */ - public void setUnpackSkipRows(int unpackSkipRows) { - - this.unpackSkipRows = unpackSkipRows; - } - - /** - * Getter for property unpackSkipPixels. - * @return Value of property unpackSkipPixels. - */ - public int getUnpackSkipPixels() { - - return this.unpackSkipPixels; - } - - /** - * Setter for property unpackSkipPixels. - * @param unpackSkipPixels New value of property unpackSkipPixels. - */ - public void setUnpackSkipPixels(int unpackSkipPixels) { - - this.unpackSkipPixels = unpackSkipPixels; - } - - /** - * Getter for property unpackLsbFirst. - * @return Value of property unpackLsbFirst. - */ - public boolean getUnpackLsbFirst() { - - return this.unpackLsbFirst; - } - - /** - * Setter for property unpackLsbFirst. - * @param unpackLsbFirst New value of property unpackLsbFirst. - */ - public void setUnpackLsbFirst(boolean unpackLsbFirst) { - - this.unpackLsbFirst = unpackLsbFirst; - } - - /** - * Getter for property unpackSwapBytes. - * @return Value of property unpackSwapBytes. - */ - public boolean getUnpackSwapBytes() { - - return this.unpackSwapBytes; - } - - /** - * Setter for property unpackSwapBytes. - * @param unpackSwapBytes New value of property unpackSwapBytes. - */ - public void setUnpackSwapBytes(boolean unpackSwapBytes) { - - this.unpackSwapBytes = unpackSwapBytes; - } - - /** - * Getter for property unpackSkipImages. - * @return Value of property unpackSkipImages. - */ - public int getUnpackSkipImages() { - - return this.unpackSkipImages; - } - - /** - * Setter for property unpackSkipImages. - * @param unpackSkipImages New value of property unpackSkipImages. - */ - public void setUnpackSkipImages(int unpackSkipImages) { - - this.unpackSkipImages = unpackSkipImages; - } - - /** - * Getter for property unpackImageHeight. - * @return Value of property unpackImageHeight. - */ - public int getUnpackImageHeight() { - - return this.unpackImageHeight; - } - - /** - * Setter for property unpackImageHeight. - * @param unpackImageHeight New value of property unpackImageHeight. - */ - public void setUnpackImageHeight(int unpackImageHeight) { - - this.unpackImageHeight = unpackImageHeight; - } - - -} diff --git a/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java b/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java deleted file mode 100644 index 06c8e582f..000000000 --- a/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java +++ /dev/null @@ -1,2381 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import net.java.games.jogl.GLU; -import net.java.games.jogl.GL; -import java.nio.*; - -/** - * - * @author Administrator - */ -public class ScaleInternal { - - public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); - - public static void scale_internal( int components, int widthin, int heightin, - ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { - float x, lowx, highx, convx, halfconvx; - float y, lowy, highy, convy, halfconvy; - float xpercent, ypercent; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, yint, xint, xindex, yindex; - int temp; - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage( components, widthin, heightin, datain, dataout ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - halfconvx = convx / 2; - halfconvy = convy / 2; - for( i = 0; i < heightout; i++ ) { - y = convy * ( i + 0.5f ); - if( heightin > heightout ) { - highy = y + halfconvy; - lowy = y - halfconvy; - } else { - highy = y + 0.5f; - lowy = y - 0.5f; - } - for( j = 0; j < widthout; j++ ) { - x = convx * ( j + 0.5f ); - if( widthin > widthout ) { - highx = x + halfconvx; - lowx = x - halfconvx; - } else { - highx = x + 0.5f; - lowx = x - 0.5f; - } - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - area = 0.0f; - - y = lowy; - yint = (int)Math.floor( y ); - while( y < highy ) { - yindex = ( yint + heightin ) % heightin; - if( highy < yint + 1 ) { - ypercent = highy - y; - } else { - ypercent = yint + 1 - y; - } - - x = lowx; - xint = (int)Math.floor( x ); - - while( x < highx ) { - xindex = ( xint + widthin ) % widthin; - if( highx < xint + 1 ) { - xpercent = highx -x; - } else { - xpercent = xint + 1 - x; - } - - percent = xpercent * ypercent; - area += percent; - temp = ( xindex + ( yindex * widthin) ) * components; - for( k = 0; k < components; k++ ) { - totals[k] += datain.get( temp + k ) * percent; - } - - xint++; - x = xint; - } - yint++; - y = yint; - } - - temp = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - // totals[] should be rounded in the case of enlarging an RGB - // ramp when the type is 332 or 4444 - dataout.put( temp + k, (short)((totals[k] + 0.5f) / area) ); - } - } - } - } - - public static void scale_internal_ubyte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, int group_size ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_ubyte( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size ); - return; - } - convy = (float)heightin / heightout; - convx = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * y_percent; - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * y_percent; - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - float f = 0.0f; - datain.position( left ); - f = ( 0x000000FF & datain.get() ) * ( 1.0f - lowx_float ); - datain.position( right ); - f += ( 0x000000FF & datain.get() ) * highx_float; - totals[k] += f; - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * x_percent; - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * y_percent; - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ) * percent; - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += ( 0x000000FF & datain.get() ); - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - dataout.position( outindex + k ); - dataout.put( (byte)(totals[k] / area) ); - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scale_internal_byte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, - int group_size ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_byte( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * y_percent; - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * y_percent; - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - float f = 0.0f; - datain.position( left ); - f = datain.get() * ( 1 - lowx_float ); - datain.position( right ); - f += datain.get() * highx_float; - totals[k] += f; - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * x_percent; - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * y_percent; - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get() * percent; - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - totals[k] += datain.get(); - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - dataout.position( outindex + k ); - dataout.put( (byte)(totals[k] / area) ); - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scale_internal_ushort( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_ushort( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size, myswap_bytes ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; - } else { - totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; - } - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; - } else { - totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; - } else { - totals[k] += ( 0x0000FFFF & datain.getShort()) * percent; - } - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; - } else { - totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * y_percent; - } else { - totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; - } else { - totals[k] += ( 0x0000FFFF & datain.getShort()) * percent; - } - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - if( myswap_bytes ) { - datain.position( left ); - float f = (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES(datain.getShort())) * ( 1 - lowx_float ); - datain.position( right ); - f += ((0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES(datain.getShort())) * highx_float); - totals[k] += f; - } else { - datain.position( left ); - float f = ((0x0000FFFF & datain.getShort()) * ( 1 - lowx_float )); - datain.position( right ); - f += ((0x0000FFFF & datain.getShort()) * highx_float); - totals[k] += f; - } - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() )) * percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * percent; - } - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * x_percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() )) * percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * percent; - } - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * y_percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * percent; - } - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort()) ) * percent; - } else { - totals[k] += (0x0000FFFF & datain.getShort()) * percent; - } - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort())); - } else { - totals[k] += (0x0000FFFF & datain.getShort()); - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - dataout.position( outindex + k ); - dataout.put( (short)(totals[k] / area) ); - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scale_internal_short( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - int swapbuf; // unsigned buffer - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_short( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size, myswap_bytes ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getShort() * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getShort() * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - if( myswap_bytes ) { - datain.position( left ); - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * ( 1 - lowx_float ); - datain.position( right ); - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * highx_float; - } else { - datain.position( left ); - totals[k] += datain.getShort() * ( 1 - lowx_float ); - datain.position( right ); - totals[k] += datain.getShort() * highx_float; - } - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort()); - totals[k] += swapbuf * x_percent; - } else { - totals[k] += datain.getShort() * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getShort() * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getShort() * percent; - } - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); - totals[k] += swapbuf; - } else { - totals[k] += datain.getShort(); - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - dataout.position( outindex + k ); - dataout.put( (short)(totals[k] / area) ); - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scale_internal_uint( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_uint( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size, myswap_bytes ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * y_percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * y_percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt()) ) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - if( myswap_bytes ) { - datain.position( left ); - totals[k] += ((0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES(datain.getInt())) * ( 1 - lowx_float )); - datain.position( right ); - totals[k] += ((0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES(datain.getInt())) * highx_float); - } else { - datain.position( left ); - totals[k] += ((0x00000000FFFFFFFF & datain.getInt()) * ( 1 - lowx_float )); - datain.position( right ); - totals[k] += ((0x00000000FFFFFFFF & datain.getInt()) * highx_float); - } - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * x_percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * y_percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); - datain.position( temp_index ); - long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; - } - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())); - } else { - totals[k] += (0x00000000FFFFFFFF & datain.getInt()); - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - float value = 0.0f; - for( k = 0; k < components; k++ ) { - value = totals[k] / area; - dataout.position( outindex + k ); - if( value >= UINT_MAX ) { - dataout.put( (int)value ); - } else { - dataout.put( (int)(totals[k] / area) ); - } - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scale_internal_int( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - long swapbuf; // unsigned buffer - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_int( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size, myswap_bytes ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getInt() * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getInt() * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - if( myswap_bytes ) { - datain.position( left ); - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * ( 1 - lowx_float ); - datain.position( right ); - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * highx_float; - } else { - datain.position( left ); - totals[k] += (datain.getInt() * ( 1 - lowx_float )); - datain.position( right ); - totals[k] += (datain.getInt() * highx_float); - } - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * x_percent; - } else { - totals[k] += datain.getInt() * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getInt() * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getInt() * percent; - } - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ); - totals[k] += swapbuf; - } else { - totals[k] += datain.getInt(); - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - dataout.position( outindex + k ); - dataout.put( (int)(totals[k] / area) ); - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scale_internal_float( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; - float percent; - // Max components in a format is 4, so... - float[] totals = new float[4]; - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outindex; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - float swapbuf; // unsigned buffer - - if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_float( components, widthin, heightin, datain, dataout, - element_size, ysize, group_size, myswap_bytes ); - return; - } - convx = (float)heightin / heightout; - convy = (float)widthin / widthout; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convy_float; - - for( i = 0; i < heightout; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightin) - highy_int = heightin - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthout; j++ ) { - - // Ok, now apply box filter to box that goes from (lowx, lowy) - // to (highx, highy) on input data into this pixel on output - // data. - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // caulate the value for pixels in the 1st row - xindex = lowx_int * group_size; - if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * ysize; - percent = y_percent * ( 1 - lowx_float ); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getFloat() * y_percent; - } - } - } - temp += group_size; - right = temp; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - - // calculate the value for pixels in the last row - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getFloat() * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - - // calculate the value for the pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += ysize; - right += ysize; - for( k = 0; k < components; k++, left += element_size, right += element_size ) { - if( myswap_bytes ) { - datain.position( left ); - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * ( 1 - lowx_float ); - datain.position( right ); - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * highx_float; - } else { - datain.position( left ); - totals[k] += (datain.getFloat() * ( 1 - lowx_float )); - datain.position( right ); - totals[k] += (datain.getFloat() * highx_float); - } - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float) * x_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * x_percent; - } else { - totals[k] += datain.getFloat() * x_percent; - } - } - } - percent = x_percent * highy_float; - temp += ysize; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += group_size; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * y_percent; - } else { - totals[k] += datain.getFloat() * y_percent; - } - } - } - temp += group_size; - percent = y_percent * highx_float; - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + (lowy_int * ysize); - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf * percent; - } else { - totals[k] += datain.getFloat() * percent; - } - } - } - - // this is for the pixels in the body - temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - datain.position( temp_index ); - if( myswap_bytes ) { - swapbuf = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); - totals[k] += swapbuf; - } else { - totals[k] += datain.getFloat(); - } - } - temp += group_size; - } - temp0 += ysize; - } - - outindex = ( j + ( i * widthout ) ) * components; - for( k = 0; k < components; k++ ) { - dataout.position( outindex + k ); - dataout.put( (totals[k] / area) ); - } - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - } - - public static void scaleInternalPackedPixel( int components, Extract extract, - int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, - int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, - int rowSizeInBytes, boolean isSwap ) { - float x, convx; - float y, convy; - float percent; - - // max components in a format is 4, so - float[] totals = new float[4]; - float[] extractTotals = new float[4]; - float[] extractMoreTotals = new float[4]; - float[] shoveTotals = new float[4]; - - float area; - int i, j, k, xindex; - - int temp, temp0; - int temp_index; - int outIndex = 0; - - int lowx_int, highx_int, lowy_int, highy_int; - float x_percent, y_percent; - float lowx_float, highx_float, lowy_float, highy_float; - float convy_float, convx_float; - int convy_int, convx_int; - int l, m; - int left, right; - - if( widthIn == widthOut * 2 && heightIn == heightOut * 2 ) { - HalveImage.halveImagePackedPixel( components, extract, widthIn, heightIn, dataIn, dataOut, - pixelSizeInBytes, rowSizeInBytes, isSwap ); - return; - } - convy = (float)heightIn / (float)heightOut; - convx = (float)widthIn / (float)widthOut; - convy_int = (int)Math.floor( convy ); - convy_float = convy - convy_int; - convx_int = (int)Math.floor( convx ); - convx_float = convx - convx_int; - - area = convx * convy; - - lowy_int = 0; - lowy_float = 0.0f; - highy_int = convy_int; - highy_float = convx_float; - - for( i = 0; i < heightOut; i++ ) { - // Clamp here to be sure we don't read beyond input buffer. - if (highy_int >= heightIn) - highy_int = heightIn - 1; - lowx_int = 0; - lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; - - for( j = 0; j < widthOut; j++ ) { - // ok now apply box filter to box that goes from( lowx, lowy ) - // to ( highx, highy ) on input data into this pixel on output data - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - - // calculate that value for pixels in the 1st row - xindex = lowx_int * pixelSizeInBytes; - if( (highy_int > lowy_int) && (highx_int > lowx_int) ) { - - y_percent = 1 - lowy_float; - temp = xindex + lowy_int * rowSizeInBytes; - percent = y_percent * ( 1 - lowx_float ); - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - left = temp; - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += pixelSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * y_percent; - } - } - temp += pixelSizeInBytes; - right = temp; - percent = y_percent * highx_float; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - // calculate the value for pixels in the last row - - y_percent = highy_float; - percent = y_percent * ( 1 - lowx_float ); - temp = xindex + highy_int * rowSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += pixelSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * y_percent; - } - } - temp += pixelSizeInBytes; - percent = y_percent * highx_float; - dataIn.position( temp ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - - // calculate the value for pixels in the 1st and last column - for( m = lowy_int + 1; m < highy_int; m++ ) { - left += rowSizeInBytes; - right += rowSizeInBytes; - dataIn.position( left ); - extract.extract( isSwap, dataIn, extractTotals ); - dataIn.position( right ); - extract.extract( isSwap, dataIn, extractMoreTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += ( extractTotals[k] * ( 1 - lowx_float ) + extractMoreTotals[k] * highx_float ); - } - } - } else if( highy_int > lowy_int ) { - x_percent = highx_float - lowx_float; - percent = ( 1 - lowy_float ) * x_percent; - temp = xindex + lowy_int * rowSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp += rowSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * x_percent; - } - } - percent = x_percent * highy_float; - temp += rowSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - } else if( highx_int > lowx_int ) { - y_percent = highy_float - lowy_float; - percent = ( 1 - lowx_float ) * y_percent; - temp = xindex + lowy_int * rowSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - for( l = lowx_int + 1; l < highx_int; l++ ) { - temp += pixelSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * y_percent; - } - } - temp += pixelSizeInBytes; - percent = y_percent * highx_float; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - } else { - percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); - temp = xindex + lowy_int * rowSizeInBytes; - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - } - - // this is for the pixels in the body - temp0 = xindex + pixelSizeInBytes + ( lowy_int + 1 ) * rowSizeInBytes; - for( m = lowy_int + 1; m < highy_int; m++ ) { - temp = temp0; - for( l = lowx_int + 1; l < highx_int; l++ ) { - dataIn.position( temp ); - extract.extract( isSwap, dataIn, extractTotals ); - for( k = 0; k < components; k++ ) { - totals[k] += extractTotals[k] * percent; - } - temp += pixelSizeInBytes; - } - temp0 += rowSizeInBytes; - } - - outIndex = ( j + ( i * widthOut ) ); - for( k = 0; k < components; k++ ) { - shoveTotals[k] = totals[k] / area; - } - extract.shove( shoveTotals, outIndex, dataOut ); - lowx_int = highx_int; - lowx_float = highx_float; - highx_int += convx_int; - highx_float += convx_float; - if( highx_float > 1.0f ) { - highx_float -= 1.0f; - highx_int++; - } - } - lowy_int = highy_int; - lowy_float = highy_float; - highy_int += convy_int; - highy_float += convy_float; - if( highy_float > 1.0f ) { - highy_float -= 1.0f; - highy_int++; - } - } - assert( outIndex == ( widthOut * heightOut - 1) ); - } - - public static void scaleInternal3D( int components, int widthIn, int heightIn, - int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, - int depthOut, ShortBuffer dataOut ) { - float x, lowx, highx, convx, halfconvx; - float y, lowy, highy, convy, halfconvy; - float z, lowz, highz, convz, halfconvz; - float xpercent, ypercent, zpercent; - float percent; - // max compnents in a format is 4 - float[] totals = new float[4]; - float volume; - int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; - int temp; - - lowy = highy = lowx = highx = 0.0f; - - convz = (float)depthIn / depthOut; - convy = (float)heightIn / heightOut; - convx = (float)widthIn / widthOut; - halfconvz = convz / 2.0f; - halfconvy = convy / 2.0f; - halfconvx = convx / 2.0f; - for( d = 0; d < depthOut; d++ ) { - z = convz * ( d + 0.5f ); - if( depthIn > depthOut ) { - highz = z + halfconvz; - lowz = z - halfconvz; - } else { - highz = z + 0.5f; - lowz = z - 0.5f; - } - for( i = 0; i < heightOut; i++ ) { - y = convy * ( i + 0.5f ); - if( heightIn > heightOut ) { - highz = y + halfconvy; - lowz = y - halfconvy; - } else { - highz = y + 0.5f; - lowz = y - 0.5f; - } - for( j = 0; j < widthOut; j++ ) { - x = convx * ( j + 0.5f ); - if( depthIn > depthOut ) { - highz = x + halfconvx; - lowz = x - halfconvx; - } else { - highz = x + 0.5f; - lowz = x - 0.5f; - } - - // Ok, now apply box filter to box that goes from ( lowx, lowy, lowz ) - // to ( highx, highy, highz ) on input data into this pixel on output data - - totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - volume = 0.0f; - - z = lowz; - zint = (int)(Math.floor( z ) ); - while( z < highz ) { - zindex = ( zint + depthIn ) % depthIn; - if( highz < zint + 1 ) { - zpercent = highz - z; - } else { - zpercent = zint + 1 - z; - } - - y = lowy; - yint = (int)(Math.floor( y ) ); - while( y < highy ) { - yindex = ( yint + heightIn ) % heightIn; - if( highy < yint + 1 ) { - ypercent = highy - y; - } else { - ypercent = yint + 1 - y; - } - - x = lowx; - xint = (int)(Math.floor( x ) ); - - while( x < highx ) { - xindex = (xint + widthIn ) % widthIn; - if( highx < xint + 1 ) { - xpercent = highx - x; - } else { - xpercent = xint + 1 - x; - } - - percent = xpercent * ypercent * zpercent; - volume += percent; - - temp = (xindex + ( yindex *widthIn) + (zindex * widthIn *heightIn)) * components; - for( k = 0; k < components; k++ ) { - assert( 0 <= (temp+k) && (temp+k) < (widthIn * heightIn * depthIn * components) ); - totals[k] += dataIn.get( temp + k ) * percent; - } - xint++; - x = xint; - } // while x - yint++; - y = yint; - } // while y - zint++; - z = zint; - } // while z - - temp = ( j + ( i * widthOut ) + (d * widthOut * heightOut ) ) * components; - for( k = 0; k < components; k++ ) { - // totals should be rounded in the case of enlarging an rgb ramp when the type is 332 or 4444 - assert( 0 <= ( temp + k ) && ( temp + k ) < (widthOut * heightOut* depthOut * components) ); - dataOut.put( temp + k, (short)((totals[k] + 0.5f) / volume ) ); - } - } - } - } - } - - public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, - int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, - int depthOut, int typeOut, ByteBuffer dataOut ) { - int components; - ShortBuffer beforeImage, afterImage; - PixelStorageModes psm = new PixelStorageModes(); - - if( widthIn == 0 || heightIn == 0 || depthIn == 0 || - widthOut == 0 || heightOut == 0 || depthOut == 0 ) { - return( 0 ); - } - - if( widthIn < 0 || heightIn < 0 || depthIn < 0 || - widthOut < 0 || heightOut < 0 || depthOut < 0 ) { - return( GLU.GLU_INVALID_VALUE ); - } - - if( !Mipmap.legalFormat(format) || !Mipmap.legalType(typeIn) || - !Mipmap.legalType(typeOut) || typeIn == GL.GL_BITMAP || - typeOut == GL.GL_BITMAP ) { - return( GLU.GLU_INVALID_ENUM ); - } - - if( !Mipmap.isLegalFormatForPackedPixelType( format, typeIn ) ) { - return( GLU.GLU_INVALID_OPERATION ); - } - - if( !Mipmap.isLegalFormatForPackedPixelType( format, typeOut ) ) { - return( GLU.GLU_INVALID_OPERATION ); - } - - try { - beforeImage = ByteBuffer.allocateDirect( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).order( - ByteOrder.nativeOrder() ).asShortBuffer(); - afterImage = ByteBuffer.allocateDirect( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).order( - ByteOrder.nativeOrder() ).asShortBuffer(); - } catch( OutOfMemoryError err ) { - return( GLU.GLU_OUT_OF_MEMORY ); - } - Mipmap.retrieveStoreModes3D( gl, psm ); - - Image.fillImage3D( psm, widthIn, heightIn, depthIn, format, typeIn, - Mipmap.is_index( format ), dataIn, beforeImage ); - components = Mipmap.elements_per_group( format, 0 ); - ScaleInternal.scaleInternal3D( components, widthIn, heightIn, depthIn, - beforeImage, widthOut, heightOut, depthOut, afterImage ); - Image.emptyImage3D( psm, widthOut, heightOut, depthOut, format, typeOut, - Mipmap.is_index( format ), afterImage, dataOut ); - - return( 0 ); - } -} diff --git a/src/net/java/games/jogl/impl/mipmap/Type_Widget.java b/src/net/java/games/jogl/impl/mipmap/Type_Widget.java deleted file mode 100644 index f749d5348..000000000 --- a/src/net/java/games/jogl/impl/mipmap/Type_Widget.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * License Applicability. Except to the extent portions of this file are - * made subject to an alternative license as permitted in the SGI Free - * Software License B, Version 1.1 (the "License"), the contents of this - * file are subject only to the provisions of the License. You may not use - * this file except in compliance with the License. You may obtain a copy - * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * - * http://oss.sgi.com/projects/FreeB - * - * Note that, as provided in the License, the Software is distributed on an - * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * - * Original Code. The Original Code is: OpenGL Sample Implementation, - * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - * Copyright in any portions created by third parties is as indicated - * elsewhere herein. All Rights Reserved. - * - * Additional Notice Provisions: The application programming interfaces - * established by SGI in conjunction with the Original Code are The - * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - * April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - * 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - * Window System(R) (Version 1.3), released October 19, 1998. This software - * was created using the OpenGL(R) version 1.2.1 Sample Implementation - * published by SGI, but has not been independently verified as being - * compliant with the OpenGL(R) version 1.2.1 Specification. - */ - -package net.java.games.jogl.impl.mipmap; - -import java.nio.*; - -/** - * - * @author Administrator - */ -public class Type_Widget { - - ByteBuffer buffer; - - /** Creates a new instance of Type_Widget */ - public Type_Widget() { - buffer = ByteBuffer.allocate( 4 ); - } - - public void setUB0( byte b ) { - buffer.position( 0 ); - buffer.put( b ); - } - - public byte getUB0() { - buffer.position( 0 ); - return( buffer.get() ); - } - - public void setUB1( byte b ) { - buffer.position( 1 ); - buffer.put( b ); - } - - public byte getUB1() { - buffer.position( 1 ); - return( buffer.get() ); - } - - public void setUB2( byte b ) { - buffer.position( 2 ); - buffer.put( b ); - } - - public byte getUB2() { - buffer.position( 2 ); - return( buffer.get() ); - } - - public void setUB3( byte b ) { - buffer.position( 3 ); - buffer.put( b ); - } - - public byte getUB3() { - buffer.position( 3 ); - return( buffer.get() ); - } - - public void setUS0( short s ) { - buffer.position( 0 ); - buffer.putShort( s ); - } - - public short getUS0() { - buffer.position( 0 ); - return( buffer.getShort() ); - } - - public void setUS1( short s ) { - buffer.position( 2 ); - buffer.putShort( s ); - } - - public short getUS1() { - buffer.position( 2 ); - return( buffer.getShort() ); - } - - public void setUI( int i ) { - buffer.position( 0 ); - buffer.putInt( i ); - } - - public int getUI() { - buffer.position( 0 ); - return( buffer.getInt() ); - } - - public void setB0( byte b ) { - buffer.position( 0 ); - buffer.put( b ); - } - - public byte getB0() { - buffer.position( 0 ); - return( buffer.get() ); - } - - public void setB1( byte b ) { - buffer.position( 1 ); - buffer.put( b ); - } - - public byte getB1() { - buffer.position( 1 ); - return( buffer.get() ); - } - - public void setB2( byte b ) { - buffer.position( 2 ); - buffer.put( b ); - } - - public byte getB2() { - buffer.position( 2 ); - return( buffer.get() ); - } - - public void setB3( byte b ) { - buffer.position( 3 ); - buffer.put( b ); - } - - public byte getB3() { - buffer.position( 3 ); - return( buffer.get() ); - } - - public void setS0( short s ) { - buffer.position( 0 ); - buffer.putShort( s ); - } - - public short getS0() { - buffer.position( 0 ); - return( buffer.getShort() ); - } - - public void setS1( short s ) { - buffer.position( 2 ); - buffer.putShort( s ); - } - - public short getS1() { - buffer.position( 2 ); - return( buffer.getShort() ); - } - - public void setI( int i ) { - buffer.position( 0 ); - buffer.putInt( i ); - } - - public int getI() { - buffer.position( 0 ); - return( buffer.getInt() ); - } - - public void setF( float f ) { - buffer.position( 0 ); - buffer.putFloat( f ); - } - - public float getF() { - buffer.position( 0 ); - return( buffer.getFloat() ); - } - - public ByteBuffer getBuffer() { - buffer.rewind(); - return( buffer ); - } - - public static void main( String args[] ) { - Type_Widget t = new Type_Widget(); - t.setI( 1000000 ); - - System.out.println("int: " + Integer.toHexString( t.getI() ) ); - - } -} diff --git a/src/net/java/games/jogl/impl/nurbs/README-PORTING.txt b/src/net/java/games/jogl/impl/nurbs/README-PORTING.txt deleted file mode 100755 index df5f41782..000000000 --- a/src/net/java/games/jogl/impl/nurbs/README-PORTING.txt +++ /dev/null @@ -1,40 +0,0 @@ -This is a currently incomplete port of SGI's GLU NURBS library from -C++ to Java. There are a few reasons for doing such a port: - - - The C interface is structured around function pointers. It is - generally difficult to bind such interfaces up to Java. - - - Some people have reported crashes on certain Linux distributions - when trying to use any routines out of the C GLU library. To date - we have not been able to diagnose the root cause of these failures. - Porting the code involved from C++ to Java has solved these - problems. - -The port so far has been started in the internals/ directory. The C++ -sources have been gone through roughly alphabetically and -transliterated into the appropriate files. The large Subdivider class -was the current focus of attention at the time of this writing, and a -closer look indicates that at least a few classes were skipped on the -way down to some of the Subdivider's sources like intersect.cc. It may -be a good idea to continue the port in this directory first, since it -looks like the other directories' sources are built on top of these -and it would be good to firm up the Java interfaces for the internals -(and perhaps get the sources to compile) before porting lots of code -built on top of them. - -A couple of notes on the translation: - - - All object pool classes have been removed. The intention is to have - a static allocate() method on the appropriate classes which will - instantiate populated arrays of these types (not just arrays of - null references). See uses of TrimVertex.allocate(). - - - There are a significant number of places in the original C++ code - where pointer arithmetic is used. Some of these are not obvious - until the code has been ported and examined. Bin.java was a good - example of this where the algorithms needed some restructuring. At - the time of this writing intersect.cc was in the process of being - ported and it wasn't clear whether we would need to change some of - the APIs or add more utility routines to be able to do pointer - arithmetic on, for example, the TrimVertex arrays returned from the - allocate() routine. diff --git a/src/net/java/games/jogl/impl/nurbs/internals/Arc.java b/src/net/java/games/jogl/impl/nurbs/internals/Arc.java deleted file mode 100755 index 076c68b72..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/Arc.java +++ /dev/null @@ -1,274 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -/* an arc, in two list, the trim list and bin */ -public class Arc { - public static final int SIDE_NONE = 0; - public static final int SIDE_RIGHT = 1; - public static final int SIDE_TOP = 2; - public static final int SIDE_LEFT = 3; - public static final int SIDE_BOTTOM = 4; - - public static final int bezier_tag = (1 << 13); - public static final int arc_tag = (1 << 3); - public static final int tail_tag = (1 << 6); - public Arc prev; /* trim list pointer */ - public Arc next; /* trim list pointer */ - public Arc link; /* bin pointers */ - public BezierArc bezierArc; /* associated bezier arc */ - public PwlArc pwlArc; /* associated pwl arc */ - public long type; /* curve type */ - public long nuid; - - private static final float ZERO = 0.00001f; - - public Arc(Arc j, PwlArc p) { - pwlArc = p; - type = j.type; - nuid = j.nuid; - } - - public Arc(int arcSide, long nuid) { - type = 0; - setside(arcSide); - this.nuid = nuid; - } - - public Arc append(Arc jarc) { - if ( jarc != null ) { - next = jarc.next; - prev = jarc; - next.prev = prev.next = this; - } else { - next = prev = this; - } - return this; - } - - public boolean check() { - Arc jarc = this; - do { - assert( (jarc.pwlArc != null) || (jarc.bezierArc != null) ); - - if (jarc.prev == 0 || jarc.next == 0) { - System.out.println( "checkjarc:null next/prev pointer"); - jarc.print( ); - return false; - } - - if (jarc.next.prev != jarc) { - System.out.println( "checkjarc: pointer linkage screwed up"); - jarc.print( ); - return false; - } - - if( jarc.pwlArc != null ) { - assert( jarc.pwlArc.npts >= 1 ); - assert( jarc.pwlArc.npts < 100000 ); - if( jarc.prev.pwlArc != null ) { - if( jarc.tail()[1] != jarc.prev.rhead()[1] ) { - System.out.println( "checkjarc: geometric linkage screwed up 1"); - jarc.prev.show(); - jarc.show(); - return false; - } - if( jarc.tail()[0] != jarc.prev.rhead()[0] ) { - System.out.println( "checkjarc: geometric linkage screwed up 2"); - jarc.prev.show(); - jarc.show(); - return false; - } - } - if( jarc.next.pwlArc ) { - if( jarc.next.tail()[0] != jarc.rhead()[0] ) { - System.out.println( "checkjarc: geometric linkage screwed up 3"); - jarc.show(); - jarc.next.show(); - return false; - } - if( jarc.next.tail()[1] != jarc.rhead()[1] ) { - System.out.println( "checkjarc: geometric linkage screwed up 4"); - jarc.show(); - jarc.next.show(); - return false; - } - } - if( jarc.isbezier() ) { - assert( jarc.pwlArc.npts == 2 ); - assert( (jarc.pwlArc.pts[0].param[0] == - jarc.pwlArc.pts[1].param[0]) || - (jarc.pwlArc.pts[0].param[1] == - jarc.pwlArc.pts[1].param[1]) ); - } - } - jarc = jarc.next; - } while (jarc != this); - return true; - } - - /** - * Checks if tail of arc and head of prev meet. - */ - public boolean isDisconnected() { - if( pwlArc == 0 ) return 0; - if( prev.pwlArc == 0 ) return 0; - - float[] p0 = tail(); - float[] p1 = prev.rhead(); - - if( ((p0[0] - p1[0]) > ZERO) || ((p1[0] - p0[0]) > ZERO) || - ((p0[1] - p1[1]) > ZERO) || ((p1[1] - p0[1]) > ZERO) ) { - return true; - } else { - /* average two points together */ - p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5f; - p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5f; - return false; - } - } - - /** - * Counts number of points on arc loop. - */ - public int numpts( ) { - Arc jarc = this; - int npts = 0; - do { - npts += jarc.pwlArc.npts; - jarc = jarc.next; - } while( jarc != this ); - return npts; - } - - /** - * Marks each point with id of arc. - */ - public void markverts( void ) { - Arc jarc = this; - - do { - TrimVertex p = jarc.pwlArc.pts; - for( int i=0; i rightpt || - (jarc.tail()[0] >= rightpt && jarc.rhead()[0] >= rightpt)) { - rightpt = jarc.pwlArc.pts.param[0]; - extrema[3] = jarc; - } - if ( jarc.tail()[1] < botpt || - (jarc.tail()[1] <= botpt && jarc.rhead()[1] <= botpt )) { - botpt = jarc.pwlArc.pts.param[1]; - extrema[2] = jarc; - } - if ( jarc.tail()[1] > toppt || - (jarc.tail()[1] >= toppt && jarc.rhead()[1] >= toppt)) { - toppt = jarc.pwlArc.pts.param[1]; - extrema[0] = jarc; - } - } - } - - /** - * Prints out the vertices of all pwl arcs on a loop. - */ - public void print( ) { - Arc jarc = this; - - do { - jarc.show( ); - jarc = jarc.next; - } while (jarc != this); - } - - public void show( ) { - System.out.println( "\tPWLARC NP: " + pwlArc.npts + " FL: 1"); - for( int i = 0; i < pwlArc.npts; i++ ) { - System.out.println( "\t\tVERTEX " + pwlArc.pts[i].param[0] + " " + - pwlArc.pts[i].param[1] ); - } - } - - /** - * Attaches a pwl arc to an arc and mark it as a border arc. - */ - public void makeSide( PwlArc pwl, int arcSide ) { - assert( pwl != 0); - assert( pwlArc == 0 ); - assert( pwl.npts > 0 ); - assert( pwl.pts != 0); - pwlArc = pwl; - clearbezier(); - setside( arcSide ); - } - - public boolean isTessellated() { return (pwlArc != null); } - public boolean isbezier() { return (type & bezier_tag) != 0; } - public void setbezier() { type |= bezier_tag; } - public void clearbezier() { type &= ~bezier_tag; } - public long npts() { return pwlArc.npts; } - public TrimVertex[] pts() { return pwlArc.pts; } - public float[] tail() { return pwlArc.pts[0].param; } - public float[] head() { return next.pwlArc.pts[0].param; } - public float[] rhead() { return pwlArc.pts[pwlArc.npts-1].param; } - public long ismarked() { return type & arc_tag; } - public void setmark() { type |= arc_tag; } - public void clearmark() { type &= (~arc_tag); } - public void clearside() { type &= ~(0x7 << 8); } - public void setside( int arcSide ) { clearside(); type |= (((long)arcSide)<<8); } - public int getside() { return ((type>>8) & 0x7); } - public int getitail() { return type & tail_tag; } - public void setitail() { type |= tail_tag; } - public void clearitail() { type &= (~tail_tag); } -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/ArcTesselator.java b/src/net/java/games/jogl/impl/nurbs/internals/ArcTesselator.java deleted file mode 100755 index cb77dfbd0..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/ArcTesselator.java +++ /dev/null @@ -1,449 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class ArcTessellator { - /** - * Constructs a bezier arc and attaches it to an Arc. - */ - public void bezier( Arc arc, float s1, float s2, float t1, float t2 ) { - assert( arc != null ); - assert( ! arc.isTessellated() ); - - switch( arc.getside() ) { - case Arc.SIDE_LEFT: - assert( s1 == s2 ); - assert( t2 < t1 ); - break; - case Arc.SIDE_RIGHT: - assert( s1 == s2 ); - assert( t1 < t2 ); - break; - case Arc.SIDE_TOP: - assert( t1 == t2 ); - assert( s2 < s1 ); - break; - case Arc.SIDE_BOTTOM: - assert( t1 == t2 ); - assert( s1 < s2 ); - break; - case Arc.SIDE_NONE: - throw new InternalError(); - break; - } - - TrimVertex[] p = TrimVertex.allocate(2); - arc.pwlArc = new PwlArc( p ); - p[0].param[0] = s1; - p[0].param[1] = t1; - p[1].param[0] = s2; - p[1].param[1] = t2; - assert( (s1 == s2) || (t1 == t2) ); - arc.setbezier(); - } - - /** - * Constructs a pwl arc and attaches it to an arc. - */ - public void pwl( Arc arc, float s1, float s2, float t1, float t2, float rate ) { - int snsteps = 1 + (int) (Math.abs(s2 - s1) / rate ); - int tnsteps = 1 + (int) (Math.abs(t2 - t1) / rate ); - int nsteps = (int) Math.max(1, Math.max( snsteps, tnsteps )); - - float sstepsize = (s2 - s1) / (float) nsteps; - float tstepsize = (t2 - t1) / (float) nsteps; - TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); - long i; - for( i = 0; i < nsteps; i++ ) { - newvert[i].param[0] = s1; - newvert[i].param[1] = t1; - s1 += sstepsize; - t1 += tstepsize; - } - newvert[i].param[0] = s2; - newvert[i].param[1] = t2; - - arc.pwlArc = new PwlArc( newvert ); - - arc.clearbezier(); - arc.clearside( ); - } - - /** - * Constructs a left boundary pwl arc and attaches it to an arc. - */ - public void pwl_left( Arc arc, float s, float t1, float t2, float rate ) { - assert( t2 < t1 ); - - int nsteps = steps_function(t1, t2, rate); - - float stepsize = (t1 - t2) / (float) nsteps; - - TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); - int i; - for( i = nsteps; i > 0; i-- ) { - newvert[i].param[0] = s; - newvert[i].param[1] = t2; - t2 += stepsize; - } - newvert[i].param[0] = s; - newvert[i].param[1] = t1; - - arc.makeSide( new PwlArc( newvert ), Arc.SIDE_LEFT ); - } - - /** - * Constructs a right boundary pwl arc and attaches it to an arc. - */ - public void pwl_right( Arc arc, float s, float t1, float t2, float rate ) { - assert( t1 < t2 ); - - int nsteps = steps_function(t2,t1,rate); - float stepsize = (t2 - t1) / (float) nsteps; - - TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); - int i; - for( i = 0; i < nsteps; i++ ) { - newvert[i].param[0] = s; - newvert[i].param[1] = t1; - t1 += stepsize; - } - newvert[i].param[0] = s; - newvert[i].param[1] = t2; - - arc.makeSide( new PwlArc( newvert ), Arc.SIDE_RIGHT ); - } - - /** - * Constructs a top boundary pwl arc and attaches it to an arc. - */ - public void pwl_top( Arc arc, float t, float s1, float s2, float rate ) { - assert( s2 < s1 ); - - int nsteps = steps_function(s1,s2,rate); - float stepsize = (s1 - s2) / (float) nsteps; - - TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); - int i; - for( i = nsteps; i > 0; i-- ) { - newvert[i].param[0] = s2; - newvert[i].param[1] = t; - s2 += stepsize; - } - newvert[i].param[0] = s1; - newvert[i].param[1] = t; - - arc.makeSide( new PwlArc( newvert ), Arc.SIDE_TOP ); - } - - /** - * Constructs a bottom boundary pwl arc and attaches it to an arc. - */ - public void pwl_bottom( Arc arc, float t, float s1, float s2, float rate ) { - assert( s1 < s2 ); - - int nsteps = steps_function(s2,s1,rate); - float stepsize = (s2 - s1) / (float) nsteps; - - TrimVertex[] newvert = TrimVertex.allocate( nsteps+1 ); - int i; - for( i = 0; i < nsteps; i++ ) { - newvert[i].param[0] = s1; - newvert[i].param[1] = t; - s1 += stepsize; - } - newvert[i].param[0] = s2; - newvert[i].param[1] = t; - - arc.makeSide( new PwlArc( newvert ), Arc.SIDE_BOTTOM ); - } - - /** - * Constucts a linear pwl arc and attaches it to an Arc. - */ - public void tessellateLinear( Arc arc, float geo_stepsize, float arc_stepsize, boolean isrational ) { - assert( arc.pwlArc == null ); - float s1, s2, t1, t2; - - //we don't need to scale by arc_stepsize if the trim curve - //is piecewise linear. Reason: In pwl_right, pwl_left, pwl_top, pwl_left, - //and pwl, the nsteps is computed by deltaU (or V) /stepsize. - //The quantity deltaU/arc_stepsize doesn't have any meaning. And - //it causes problems: see bug 517641 - float stepsize = geo_stepsize; /* * arc_stepsize*/; - - BezierArc b = arc.bezierArc; - - if( isrational ) { - s1 = b.cpts[0] / b.cpts[2]; - t1 = b.cpts[1] / b.cpts[2]; - s2 = b.cpts[b.stride+0] / b.cpts[b.stride+2]; - t2 = b.cpts[b.stride+1] / b.cpts[b.stride+2]; - } else { - s1 = b.cpts[0]; - t1 = b.cpts[1]; - s2 = b.cpts[b.stride+0]; - t2 = b.cpts[b.stride+1]; - } - if( s1 == s2 ) - if( t1 < t2 ) - pwl_right( arc, s1, t1, t2, stepsize ); - else - pwl_left( arc, s1, t1, t2, stepsize ); - else if( t1 == t2 ) - if( s1 < s2 ) - pwl_bottom( arc, t1, s1, s2, stepsize ); - else - pwl_top( arc, t1, s1, s2, stepsize ); - else - pwl( arc, s1, s2, t1, t2, stepsize ); - } - - /** - * Constucts a nonlinear pwl arc and attaches it to an Arc. - */ - public void tessellateNonlinear( Arc arc, float geo_stepsize, float arc_stepsize, int isrational ) { - assert( arc.pwlArc == null ); - - float stepsize = geo_stepsize * arc_stepsize; - - BezierArc *bezierArc = arc.bezierArc; - - float size; //bounding box size of the curve in UV - { - int i,j; - float min_u, min_v, max_u,max_v; - min_u = max_u = bezierArc.cpts[0]; - min_v = max_v = bezierArc.cpts[1]; - for(i=1, j=2; i max_u) - max_u = bezierArc.cpts[j]; - if(bezierArc.cpts[j+1] < min_v) - min_v = bezierArc.cpts[j+1]; - if(bezierArc.cpts[j+1] > max_v) - max_v = bezierArc.cpts[j+1]; - } - - size = max_u - min_u; - if(size < max_v - min_v) - size = max_v - min_v; - } - - /*int nsteps = 1 + (int) (1.0/stepsize);*/ - - int nsteps = (int) (size/stepsize); - if(nsteps <=0) - nsteps=1; - - TrimVertex[] vert = TrimVertex.allocate( nsteps+1 ); - float dp = 1.0/nsteps; - int vi = 0; // vertIdx - - arc.pwlArc = new PwlArc(); - arc.pwlArc.pts = vert; - - if( isrational ) { - float[] pow_u = new float[Defines.MAXORDER]; - float[] pow_v = new float[Defines.MAXORDER]; - float[] pow_w = new float[Defines.MAXORDER]; - trim_power_coeffs( bezierArc, pow_u, 0 ); - trim_power_coeffs( bezierArc, pow_v, 1 ); - trim_power_coeffs( bezierArc, pow_w, 2 ); - - /* compute first point exactly */ - float[] b = bezierArc.cpts; - vert[vi].param[0] = b[0]/b[2]; - vert[vi].param[1] = b[1]/b[2]; - - /* strength reduction on p = dp * step would introduce error */ - long order = bezierArc.order; - for( int step=1, ++vi; step= 3 ) { - surfaceEvaluator.bgnclosedline(); - if( mesh[0][2] == 0 ) - surfaceEvaluator.evalcoord2f( mesh[0][3], mesh[0][0], mesh[0][1] ); - else - surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); - if( mesh[1][2] == 0 ) - surfaceEvaluator.evalcoord2f( mesh[1][3], mesh[1][0], mesh[1][1] ); - else - surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); - surfaceEvaluator.evalcoord2f( nuid, u, v ); - surfaceEvaluator.endclosedline(); - } - mesh[meshindex][0] = u; - mesh[meshindex][1] = v; - mesh[meshindex][2] = 0; - mesh[meshindex][3] = nuid; - meshindex = (meshindex+1) % 2; - } else { - surfaceEvaluator.evalcoord2f( nuid, u, v ); - } - } - /** - * tmeshvert - evaluate a grid point of a triangle mesh - */ - public void tmeshvert( GridVertex g ) { - long u = g->gparam[0]; - long v = g->gparam[1]; - - npts++; - if( wireframetris ) { - if( npts >= 3 ) { - surfaceEvaluator.bgnclosedline(); - if( mesh[0][2] == 0 ) - surfaceEvaluator.evalcoord2f( (long) mesh[0][3], mesh[0][0], mesh[0][1] ); - else - surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); - if( mesh[1][2] == 0 ) - surfaceEvaluator.evalcoord2f( (long) mesh[1][3], mesh[1][0], mesh[1][1] ); - else - surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); - surfaceEvaluator.evalpoint2i( u, v ); - surfaceEvaluator.endclosedline(); - } - mesh[meshindex][0] = u; - mesh[meshindex][1] = v; - mesh[meshindex][2] = 1; - meshindex = (meshindex+1) % 2; - } else { - surfaceEvaluator.evalpoint2i( u, v ); - } - } - /** the same as tmeshvert(trimvertex), for efficiency purpose */ - public void tmeshvert( float u, float v ) { - long nuid = 0; - - npts++; - if( wireframetris ) { - if( npts >= 3 ) { - surfaceEvaluator.bgnclosedline(); - if( mesh[0][2] == 0 ) - surfaceEvaluator.evalcoord2f( mesh[0][3], mesh[0][0], mesh[0][1] ); - else - surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); - if( mesh[1][2] == 0 ) - surfaceEvaluator.evalcoord2f( mesh[1][3], mesh[1][0], mesh[1][1] ); - else - surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); - surfaceEvaluator.evalcoord2f( nuid, u, v ); - surfaceEvaluator.endclosedline(); - } - mesh[meshindex][0] = u; - mesh[meshindex][1] = v; - mesh[meshindex][2] = 0; - mesh[meshindex][3] = nuid; - meshindex = (meshindex+1) % 2; - } else { - surfaceEvaluator.evalcoord2f( nuid, u, v ); - } - } - /** - * linevert - evaluate a point on an outlined contour - */ - public void linevert( TrimVertex t ) { - surfaceEvaluator.evalcoord2f( t.nuid, t.param[0], t.param[1] ); - } - /** - * linevert - evaluate a grid point of an outlined contour - */ - public void linevert( GridVertex g ) { - surfaceEvaluator.evalpoint2i( g.gparam[0], g.gparam[1] ); - } - /** - * bgnoutline - preamble to outlined rendering - */ - public void bgnoutline( ) { - surfaceEvaluator.bgnline(); - } - /** - * endoutline - postamble to outlined rendering - */ - public void endoutline( ) { - surfaceEvaluator.endline(); - } - /** - * endsurf - postamble to surface - */ - public void endsurf( ) { - surfaceEvaluator.endmap2f(); - } - /** - * triangle - output a triangle - */ - public void triangle( TrimVertex a, TrimVertex b, TrimVertex c ) { - bgntfan(); - tmeshvert( a ); - tmeshvert( b ); - tmeshvert( c ); - endtfan(); - } - - public void bgntfan() { - surfaceEvaluator.bgntfan(); - } - public void endtfan() { - surfaceEvaluator.endtfan(); - } - public void bgnqstrip() { - surfaceEvaluator.bgnqstrip(); - } - public void endqstrip() { - surfaceEvaluator.endqstrip(); - } - public void evalUStrip(int n_upper, float v_upper, float[] upper_val, - int n_lower, float v_lower, float[] lower_val) { - surfaceEvaluator.evalUStrip(n_upper, v_upper, upper_val, - n_lower, v_lower, lower_val); - } - public void evalVStrip(int n_left, float u_left, float[] left_val, - int n_right, float v_right, float[] right_val) { - surfaceEvaluator.evalVStrip(n_left, u_left, left_val, - n_right, u_right, right_val); - } - public void tmeshvertNOGE(TrimVertex *t) { - // NOTE: under undefined USE_OPTTT #ifdef - } - public void tmeshvertNOGE_BU(TrimVertex *t) { - // NOTE: under undefined USE_OPTTT #ifdef - } - public void tmeshvertNOGE_BV(TrimVertex *t) { - // NOTE: under undefined USE_OPTTT #ifdef - } - public void preEvaluateBU(float u) { - surfaceEvaluator.inPreEvaluateBU_intfac(u); - } - public void preEvaluateBV(float v) { - surfaceEvaluator.inPreEvaluateBV_intfac(v); - } - - /* curve backend routines */ - public void bgncurv( void ) { - curveEvaluator.bgnmap1f( 0 ); - } - public void segment( float ulo, float uhi ) { - curveEvaluator.domain1f( ulo, uhi ); - } - public void curvpts(long type, /* geometry, color, texture, normal */ - float[] pts, /* control points */ - long stride, /* distance to next point */ - int order, /* parametric order */ - float ulo, /* lower parametric bound */ - float uhi ) /* upper parametric bound */ { - curveEvaluator.map1f( type, ulo, uhi, stride, order, pts ); - curveEvaluator.enable( type ); - } - public void curvgrid( float u0, float u1, long nu ) { - curveEvaluator.mapgrid1f( nu, u0, u1 ); - } - public void curvmesh( long from, long n ) { - curveEvaluator.mapmesh1f( N_MESHFILL, from, from+n ); - } - public void curvpt( float u ) { - curveEvaluator.evalcoord1f( 0, u ); - } - public void bgnline( ) { - curveEvaluator.bgnline(); - } - public void endline( ) { - curveEvaluator.endline(); - } - public void endcurv( ) { - curveEvaluator.endmap1f(); - } - - private boolean wireframetris; - private boolean wireframequads; - private int npts; - private float[][] mesh = new float[3][4]; - private int meshindex; -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/BasicCurveEvaluator.java b/src/net/java/games/jogl/impl/nurbs/internals/BasicCurveEvaluator.java deleted file mode 100755 index 3aae3674b..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/BasicCurveEvaluator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class BasicCurveEvaluator extends CachingEvaluator { - public void domain1f(float ulo, float uhi) {} - public void range1f(long type, float[] from, float[] to) {} - - public void enable(long type) {} - public void disable(long type) {} - public void bgnmap1f(long type) {} - public void map1f(long type, float ulo, float uhi, long stride, long order, float[] pts) {} - public void mapgrid1f(long nu, float u0, float u1) {} - public void mapmesh1f(long style, long from, long to) {} - public void evalcoord1f(long type, float u) {} - public void endmap1f() {} - - public void bgnline() {} - public void endline() {} -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/BasicSurfaceEvaluator.java b/src/net/java/games/jogl/impl/nurbs/internals/BasicSurfaceEvaluator.java deleted file mode 100755 index f2b4a6679..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/BasicSurfaceEvaluator.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public abstract class BasicSurfaceEvaluator extends CachingEvaluator { - public void range2f(long, float[] from, float[] to) {} - public void domain2f(float ulo, float uhi, float vlo, float vhi) {} - - public void enable(long type) {} - public void disable(long type) {} - public void bgnmap2f(long type) {} - public void map2f(long type, float ulower, float uupper, long ustride, long uorder, - float vlower, float vupper, long vstride, long vorder, - float[] pts) {} - public void mapgrid2f(long nu, float u0, float u1, - long nv, float v0, float v1) {} - public void mapmesh2f(long style, long umin, long umax, - long vmin, long vmax) {} - public void evalcoord2f(long type, float u, float v) {} - public void evalpoint2i(long u, long v) {} - public void endmap2f() {} - - public void polymode(long style) {} - public void bgnline() {} - public void endline() {} - public void bgnclosedline() {} - public void endclosedline() {} - public void bgntmesh() {} - public void swaptmesh() {} - public void endtmesh() {} - public void bgnqstrip() {} - public void endqstrip() {} - - public void bgntfan() {} - public void endtfan() {} - - public abstract void evalUStrip(int n_upper, float v_upper, float[] upper_val, - int n_lower, float v_lower, float[] lower_val); - public abstract void evalVStrip(int n_left, float u_left, float[] left_val, - int n_right, float u_right, float[] right_val); - public abstract void inDoEvalCoord2NOGE(float u, float v, float[] ret_point, float[] ret_normal); - public abstract void inDoEvalCoord2NOGE_BU(float u, float v, float[] ret_point, float[] ret_normal); - public abstract void inDoEvalCoord2NOGE_BV(float u, float v, float[] ret_point, float[] ret_normal); - public abstract void inPreEvaluateBV_intfac(float v); - public abstract void inPreEvaluateBU_intfac(float u); -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/BezierArc.java b/src/net/java/games/jogl/impl/nurbs/internals/BezierArc.java deleted file mode 100755 index feac7d544..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/BezierArc.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -/** A bezier arc. */ -class BezierArc { - public float[] cpts; /* control points of arc */ - public int order; /* order of arc */ - public int stride; /* REAL distance between points */ - public long type; /* curve type */ - public Mapdesc mapdesc; -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/Bin.java b/src/net/java/games/jogl/impl/nurbs/internals/Bin.java deleted file mode 100755 index 55bec5eae..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/Bin.java +++ /dev/null @@ -1,147 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class Bin { - private Arc head; /*first arc on list */ - private Arc current; /* current arc on list */ - - /** - * Sets current arc to first arc of bin; advances to next arc. - */ - public Arc firstarc( ) { - current = head; - return nextarc( ); - } - /** - * Returns current arc in bin and advances pointer to next arc. - */ - public Arc nextarc( ) { - Arc jarc = current; - - assert( (jarc == null) || jarc.check() ); - - if( jarc != null ) current = jarc.link; - return jarc; - } - /** - * Removes first Arc from bin. - */ - public Arc removearc( ) { - Arc jarc = head; - - if( jarc != null ) head = jarc.link; - return jarc; - } - public boolean isnonempty( ) { return (head != null); } - /** - * Adds an Arc to head of the linked list of Arcs. - */ - public void addarc( Arc jarc ) { - jarc.link = head; - head = jarc; - } - /** - * Removes given Arc from bin. - */ - public void remove_this_arc( Arc arc ) { - Arc j, prev; - for( j = head; (j != null) && (j != arc); prev = j, j = j.link ); - - if( j != null ) { - if( j == current ) - current = j.link; - if ( prev != null ) - prev.link = j.link; - } - } - /** - * Counts number of arcs in bin. - */ - public int numarcs( ) { - long count = 0; - for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) - count++; - return count; - } - /** - * Places an orphaned arc into its new parent's bin. - */ - public void adopt( ) { - markall(); - - Arc orphan; - while( (orphan = removearc()) != null ) { - for( Arc parent = orphan.next; parent != orphan; parent = parent.next ) { - if (! parent.ismarked() ) { - orphan.link = parent.link; - parent.link = orphan; - orphan.clearmark(); - break; - } - } - } - } - /** - * Marks all arcs with an identifying tag. - */ - public void markall( ) { - for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) - jarc.setmark(); - } - /** - * Prints out descriptions of the arcs in the bin. - */ - public void show( String name ) { - System.out.println( name ); - for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) - jarc.show( ); - } - /** - * Prints out all arcs that are untessellated border arcs. - */ - public void listBezier( ) { - for( Arc jarc = firstarc(); jarc != null; jarc = nextarc() ) { - if( jarc.isbezier( ) ) { - assert( jarc.pwlArc.npts == 2 ); - TrimVertex[] pts = jarc.pwlArc.pts; - float s1 = pts[0].param[0]; - float t1 = pts[0].param[1]; - float s2 = pts[1].param[0]; - float t2 = pts[1].param[1]; - System.out.println( "arc ( " + s1 + "," + t1 + ") (" + - s2 + "," + t2 + ")"); - } - } - } -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/CachingEvaluator.java b/src/net/java/games/jogl/impl/nurbs/internals/CachingEvaluator.java deleted file mode 100755 index c9c8c5cf9..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/CachingEvaluator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class CachingEvaluator { - public int ServiceModePlay = 0; - public int ServiceModeRecord = 1; - public int ServiceModePlayAndRecord = 2; - - public int canRecord() { - return 0; - } - - public int canPlayAndRecord() { - return 0; - } - - public int createHandle( int handle ) { - return 0; - } - - public void beginOutput( int serviceMode, int handle ) {} - public void endOutput() {} - public void discardRecording(int handle) {} - public void playRecording(int handle) {} -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/Defines.java b/src/net/java/games/jogl/impl/nurbs/internals/Defines.java deleted file mode 100755 index fc284abbd..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/Defines.java +++ /dev/null @@ -1,46 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class Defines { - /* culling constants */ - public static final int CULL_TRIVIAL_REJECT = 0; - public static final int CULL_TRIVIAL_ACCEPT = 1; - public static final int CULL_ACCEPT = 2; - - /* maximum order of a B-Spline */ - public static final int MAXORDER = 24; - - /* maximum dimension of any B-spline range space */ - public static final int MAXCOORDS = 5; -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/NurbsConsts.java b/src/net/java/games/jogl/impl/nurbs/internals/NurbsConsts.java deleted file mode 100755 index 74c9c150c..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/NurbsConsts.java +++ /dev/null @@ -1,117 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class NurbsConsts { - /* NURBS Properties - one set per map, - each takes a single INREAL arg */ - public static final int N_SAMPLING_TOLERANCE = 1; - public static final int N_S_RATE = 6; - public static final int N_T_RATE = 7; - public static final int N_CLAMPFACTOR = 13; - public static final float N_NOCLAMPING = 0.0f; - public static final int N_MINSAVINGS = 14; - public static final float N_NOSAVINGSSUBDIVISION = 0.0f; - - /* NURBS Properties - one set per map, - each takes an enumerated value */ - public static final int N_CULLING = 2; - public static final float N_NOCULLING = 0.0f; - public static final float N_CULLINGON = 1.0f; - public static final int N_SAMPLINGMETHOD 10; - public static final float N_NOSAMPLING = 0.0f; - public static final float N_FIXEDRATE = 3.0f; - public static final float N_DOMAINDISTANCE = 2.0f; - public static final float N_PARAMETRICDISTANCE = 5.0f; - public static final float N_PATHLENGTH = 6.0f; - public static final float N_SURFACEAREA = 7.0f; - public static final float N_OBJECTSPACE_PARA = 8.0f; - public static final float N_OBJECTSPACE_PATH = 9.0f; - public static final int N_BBOX_SUBDIVIDING = 17; - public static final float N_NOBBOXSUBDIVISION = 0.0f; - public static final float N_BBOXTIGHT = 1.0f; - public static final float N_BBOXROUND = 2.0f; - - /* NURBS Rendering Properties - one set per renderer - each takes an enumerated value */ -public static final int N_DISPLAY 3 -public static final int N_FILL 1.0 -public static final int N_OUTLINE_POLY 2.0 -public static final int N_OUTLINE_TRI 3.0 -public static final int N_OUTLINE_QUAD 4.0 -public static final int N_OUTLINE_PATCH 5.0 -public static final int N_OUTLINE_PARAM 6.0 -public static final int N_OUTLINE_PARAM_S 7.0 -public static final int N_OUTLINE_PARAM_ST 8.0 -public static final int N_OUTLINE_SUBDIV 9.0 -public static final int N_OUTLINE_SUBDIV_S 10.0 -public static final int N_OUTLINE_SUBDIV_ST 11.0 -public static final int N_ISOLINE_S 12.0 -public static final int N_ERRORCHECKING 4 -public static final int N_NOMSG 0.0 -public static final int N_MSG 1.0 - -/* GL 4.0 propeties not defined above */ -#ifndef N_PIXEL_TOLERANCE -public static final int N_PIXEL_TOLERANCE N_SAMPLING_TOLERANCE -public static final int N_ERROR_TOLERANCE 20 -public static final int N_SUBDIVISIONS 5 -public static final int N_TILES 8 -public static final int N_TMP1 9 -public static final int N_TMP2 N_SAMPLINGMETHOD -public static final int N_TMP3 11 -public static final int N_TMP4 12 -public static final int N_TMP5 N_CLAMPFACTOR -public static final int N_TMP6 N_MINSAVINGS -public static final int N_S_STEPS N_S_RATE -public static final int N_T_STEPS N_T_RATE -#endif - -/* NURBS Rendering Properties - one set per map, - each takes an INREAL matrix argument */ -public static final int N_CULLINGMATRIX 1 -public static final int N_SAMPLINGMATRIX 2 -public static final int N_BBOXMATRIX 3 - - -/* NURBS Rendering Properties - one set per map, - each takes an INREAL vector argument */ -public static final int N_BBOXSIZE 4 - -/* type argument for trimming curves */ -#ifndef N_P2D -public static final int N_P2D 0x8 -public static final int N_P2DR 0xd -#endif - -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/NurbsException.java b/src/net/java/games/jogl/impl/nurbs/internals/NurbsException.java deleted file mode 100755 index 5453807cd..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/NurbsException.java +++ /dev/null @@ -1,30 +0,0 @@ -/** Encapsulates functionality of the C GLU NURBS implementation's - setjmp/longjmp wrappers. */ - -public class NurbsException extends RuntimeException { - private int errorCode; - - public NurbsException(int code) { - super(); - errorCode = code; - } - - public NurbsException(String message, int code) { - super(message); - errorCode = code; - } - - public NurbsException(String message, Throwable cause, int code) { - super(message, cause); - errorCode = code; - } - - public NurbsException(Throwable cause, int code) { - super(cause); - errorCode = code; - } - - public int errorCode() { - return errorCode; - } -} diff --git a/src/net/java/games/jogl/impl/nurbs/internals/Subdivider.java b/src/net/java/games/jogl/impl/nurbs/internals/Subdivider.java deleted file mode 100755 index 155b6b7ac..000000000 --- a/src/net/java/games/jogl/impl/nurbs/internals/Subdivider.java +++ /dev/null @@ -1,1781 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -*/ - -public class Subdivider { - - /** - * Constructs a subdivider. - */ - public Subdivider(RenderHints hints, Backend b) { - renderhints = hints; - arctessellator = new ArcTesselator(); - backend = b; - slicer = new Slicer(b); - } - - /** - * Resets all state after possible error condition. - */ - public void clear() { - // FIXME: looks like nothing to do given that we have no object pools - } - public void beginTrims() {} - public void beginLoop() { - pjarc = 0; - } - - /** - * Adds a bezier arc to a trim loop and to a bin. - */ - public void addArc(float[] cpts, Quilt quilt, long _nuid) { - BezierArc bezierArc = new BezierArc(); - Arc jarc = new Arc(Arc.SIDE_NONE, _nuid); - jarc.bezierArc = bezierArc; - bezierArc.order = quilt.qspec.order; - bezierArc.stride = quilt.qspec.stride; - bezierArc.mapdesc = quilt.mapdesc; - bezierArc.cpts = cpts; - initialbin.addarc( jarc ); - pjarc = jarc.append( pjarc ); - } - - /** - * Adds a pwl arc to a trim loop and to a bin. - */ - public void addArc(int npts, TrimVertex[] pts, long _nuid) { - Arc jarc = new Arc( Arc.SIDE_NONE, _nuid ); - jarc.pwlArc = new PwlArc( npts, pts ); - initialbin.addarc( jarc ); - pjarc = jarc.append( pjarc ); - } - public void endLoop() {} - public void endTrims() {} - - public void beginQuilts() { - qlist = null; - } - public void addQuilt( Quilt quilt ) { - quilt.next = qlist; - qlist = quilt; - } - public void endQuilts() {} - - /** - * Main curve rendering entry point - */ - public void drawCurves() { - float[] from = new float[1]; - float[] to = new float[1]; - Flist bpts = new Flist(); - qlist.getRange( from, to, bpts ); - - renderhints.init( ); - - backend.bgncurv(); - float[] pta = new float[0]; - float[] ptb = new float[1]; - for( int i=bpts.start; i v2.param[0] || v1next.param[0] > v1.param[0] ) - throw new NurbsException(28); - - if( v1.param[1] < v2.param[1] ) - return 1; - else if( v1.param[1] > v2.param[1] ) - return 0; - - while( true ) { - if( v1next.param[0] > v2next.param[0] ) { - assert( v1.param[0] >= v1next.param[0] ); - assert( v2.param[0] >= v1next.param[0] ); - switch( bbox( v2next, v2, v1next, 1 ) ) { - case -1: - return 1; - case 0: - sgn = ccw( v1next, v2, v2next ); - if( sgn != -1 ) - return sgn; - else { - v1i = v1nexti--; - v1 = j1.pwlArc.pts[v1i]; - v1next = j1.pwlArc.pts[v1nexti]; - if( v1 == v1last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 0; - } - } else if( v1next.param[0] < v2next.param[0] ) { - assert( v1.param[0] >= v2next.param[0] ); - assert( v2.param[0] >= v2next.param[0] ); - switch( bbox( v1next, v1, v2next, 1 ) ) { - case -1: - return 0; - case 0: - sgn = ccw( v1next, v1, v2next ); - if( sgn != -1 ) - return sgn; - else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 1; - } - } else { - if( v1next.param[1] < v2next.param[1] ) - return 1; - else if( v1next.param[1] > v2next.param[1] ) - return 0; - else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - } - } - } - - public int ccwTurn_sr(Arc j1, Arc j2 ) { - // dir = 1 - int v1i = j1.pwlArc.npts-1; - int v1lasti = 0; - int v2i = 0; - int v2lasti = j2.pwlArc.npts-1; - int v1nexti = v1i-1; - int v2nexti = v2i+1; - TrimVertex v1 = j1.pwlArc.pts[v1i]; - TrimVertex v1last = j1.pwlArc.pts[v1lasti]; - TrimVertex v2 = j2.pwlArc.pts[v2i]; - TrimVertex v2last = j2.pwlArc.pts[v2lasti]; - TrimVertex v1next = j1.pwlArc.pts[v1nexti]; - TrimVertex v2next = j2.pwlArc.pts[v2nexti]; - int sgn; - - assert( v1 != v1last ); - assert( v2 != v2last ); - - // the arcs lie on the line (0 == v1.param[0]) - if( v1.param[0] == v1next.param[0] && v2.param[0] == v2next.param[0] ) - return 0; - - if( v2next.param[0] < v2.param[0] || v1next.param[0] < v1.param[0] ) - throw new NurbsException(28); - - if( v1.param[1] < v2.param[1] ) - return 0; - else if( v1.param[1] > v2.param[1] ) - return 1; - - while( true ) { - if( v1next.param[0] < v2next.param[0] ) { - assert( v1.param[0] <= v1next.param[0] ); - assert( v2.param[0] <= v1next.param[0] ); - switch( bbox( v2, v2next, v1next, 1 ) ) { - case -1: - return 0; - case 0: - sgn = ccw( v1next, v2, v2next ); - if( sgn != -1 ) { - return sgn; - } else { - v1i = v1nexti--; - v1 = j1.pwlArc.pts[v1i]; - v1next = j1.pwlArc.pts[v1nexti]; - if( v1 == v1last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 1; - } - } else if( v1next.param[0] > v2next.param[0] ) { - assert( v1.param[0] <= v2next.param[0] ); - assert( v2.param[0] <= v2next.param[0] ); - switch( bbox( v1, v1next, v2next, 1 ) ) { - case -1: - return 1; - case 0: - sgn = ccw( v1next, v1, v2next ); - if( sgn != -1 ) { - return sgn; - } else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 0; - } - } else { - if( v1next.param[1] < v2next.param[1] ) - return 0; - else if( v1next.param[1] > v2next.param[1] ) - return 1; - else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - } - } - } - - public int ccwTurn_tl(Arc j1, Arc j2 ) { - int v1i = j1.pwlArc.npts-1; - int v1lasti = 0; - int v2i = 0; - int v2lasti = j2.pwlArc.npts-1; - int v1nexti = v1i-1; - int v2nexti = v2i+1; - TrimVertex v1 = j1.pwlArc.pts[v1i]; - TrimVertex v1last = j1.pwlArc.pts[v1lasti]; - TrimVertex v2 = j2.pwlArc.pts[v2i]; - TrimVertex v2last = j2.pwlArc.pts[v2lasti]; - TrimVertex v1next = j1.pwlArc.pts[v1nexti]; - TrimVertex v2next = j2.pwlArc.pts[v2nexti]; - int sgn; - - assert( v1 != v1last ); - assert( v2 != v2last ); - - // the arcs lie on the line (1 == v1.param[1]) - if( v1.param[1] == v1next.param[1] && v2.param[1] == v2next.param[1] ) - return 0; - - if( v2next.param[1] > v2.param[1] || v1next.param[1] > v1.param[1] ) - throw new NurbsException(28 ); - - if( v1.param[0] < v2.param[0] ) - return 0; - else if( v1.param[0] > v2.param[0] ) - return 1; - - while( true ) { - if( v1next.param[1] > v2next.param[1] ) { - assert( v1.param[1] >= v1next.param[1] ); - assert( v2.param[1] >= v1next.param[1] ); - switch( bbox( v2next, v2, v1next, 0 ) ) { - case -1: - return 0; - case 0: - sgn = ccw( v1next, v2, v2next ); - if( sgn != -1 ) - return sgn; - else { - v1i = v1nexti--; - v1 = j1.pwlArc.pts[v1i]; - v1next = j1.pwlArc.pts[v1nexti]; - if( v1 == v1last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 1; - } - } else if( v1next.param[1] < v2next.param[1] ) { - switch( bbox( v1next, v1, v2next, 0 ) ) { - case -1: - return 1; - case 0: - sgn = ccw( v1next, v1, v2next ); - if( sgn != -1 ) - return sgn; - else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 0; - } - } else { - if( v1next.param[0] < v2next.param[0] ) - return 0; - else if( v1next.param[0] > v2next.param[0] ) - return 1; - else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - } - } - } - - public int ccwTurn_tr(Arc j1, Arc j2) { - int v1i = j1.pwlArc.npts-1; - int v1lasti = 0; - int v2i = 0; - int v2lasti = j2.pwlArc.npts-1; - int v1nexti = v1i-1; - int v2nexti = v2i+1; - TrimVertex v1 = j1.pwlArc.pts[v1i]; - TrimVertex v1last = j1.pwlArc.pts[v1lasti]; - TrimVertex v2 = j2.pwlArc.pts[v2i]; - TrimVertex v2last = j2.pwlArc.pts[v2lasti]; - TrimVertex v1next = j1.pwlArc.pts[v1nexti]; - TrimVertex v2next = j2.pwlArc.pts[v2nexti]; - int sgn; - - assert( v1 != v1last ); - assert( v2 != v2last ); - - // the arcs lie on the line (1 == v1.param[1]) - if( v1.param[1] == v1next.param[1] && v2.param[1] == v2next.param[1] ) - return 0; - - if( v2next.param[1] < v2.param[1] || v1next.param[1] < v1.param[1] ) - throw new NurbsException( 28 ); - - if( v1.param[0] < v2.param[0] ) - return 1; - else if( v1.param[0] > v2.param[0] ) - return 0; - - while( 1 ) { - if( v1next.param[1] < v2next.param[1] ) { - assert( v1.param[1] <= v1next.param[1] ); - assert( v2.param[1] <= v1next.param[1] ); - switch( bbox( v2, v2next, v1next, 0 ) ) { - case -1: - return 1; - case 0: - sgn = ccw( v1next, v2, v2next ); - if( sgn != -1 ) { - return sgn; - } else { - v1i = v1nexti--; - v1 = j1.pwlArc.pts[v1i]; - v1next = j1.pwlArc.pts[v1nexti]; - if( v1 == v1last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 0; - } - } else if( v1next.param[1] > v2next.param[1] ) { - assert( v1.param[1] <= v2next.param[1] ); - assert( v2.param[1] <= v2next.param[1] ); - switch( bbox( v1, v1next, v2next, 0 ) ) { - case -1: - return 0; - case 0: - sgn = ccw( v1next, v1, v2next ); - if( sgn != -1 ) { - return sgn; - } else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - break; - case 1: - return 1; - } - } else { - if( v1next.param[0] < v2next.param[0] ) - return 1; - else if( v1next.param[0] > v2next.param[0] ) - return 0; - else { - v2i = v2nexti++; - v2 = j2.pwlArc.pts[v2i]; - v2next = j2.pwlArc.pts[v2nexti]; - if( v2 == v2last ) { - return 0; // ill-conditioned, guess answer - } - } - } - } - } - - public void set_domain_distance_u_rate(float u_rate) { - domain_distance_u_rate = u_rate; - } - - public void set_domain_distance_v_rate(float v_rate) { - domain_distance_v_rate = v_rate; - } - - public void set_is_domain_distance_sampling(int flag) { - is_domain_distance_sampling = flag; - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - /** - * Determine which side of a line a jarc lies (for debugging only) - */ - private int arc_classify( Arc jarc, int param, float value ) - { - float tdiff, hdiff; - if( param == 0 ) { - tdiff = jarc.tail()[0] - value; - hdiff = jarc.head()[0] - value; - } else { - tdiff = jarc.tail()[1] - value; - hdiff = jarc.head()[1] - value; - } - - if( tdiff > 0.0 ) { - if( hdiff > 0.0 ) { - return 0x11; - } else if( hdiff == 0.0 ) { - return 0x12; - } else { - return 0x10; - } - } else if( tdiff == 0.0 ) { - if( hdiff > 0.0 ) { - return 0x21; - } else if( hdiff == 0.0 ) { - return 0x22; - } else { - return 0x20; - } - } else { - if( hdiff > 0.0 ) { - return 0x01; - } else if( hdiff == 0.0 ) { - return 0x02; - } else { - return 0; - } - } - } - - private void classify_headonleft_s( Bin bin, Bin in, Bin out, float val ) { - /* tail on line, head at left */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 0, val ) == 0x20 ); - - j.setitail(); - - float diff = j.prev.tail()[0] - val; - if( diff > 0.0 ) { - out.addarc( j ); - } else if( diff < 0.0 ) { - if( ccwTurn_sl( j.prev, j ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else { - if( j.prev.tail()[1] > j.prev.head()[1] ) - in.addarc( j ); - else - out.addarc( j ); - } - } - } - - private void classify_tailonleft_s( Bin bin, Bin in, Bin out, float val ) { - /* tail at left, head on line */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 1, val ) == 0x02 ); - j.clearitail(); - - float diff = j.next.head()[1] - val; - if( diff > 0.0 ) { - in.addarc( j ); - } else if( diff < 0.0 ) { - if( ccwTurn_tl( j, j.next ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else { - if (j.next.tail()[0] > j.next.head()[0] ) - out.addarc( j ); - else - in.addarc( j ); - } - } - } - - private void classify_headonright_s( Bin bin, Bin in, Bin out, float val ) { - /* tail on line, head at right */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 0, val ) == 0x21 ); - - j.setitail(); - - float diff = j.prev.tail()[0] - val; - if( diff > 0.0 ) { - if( ccwTurn_sr( j.prev, j ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else if( diff < 0.0 ) { - out.addarc( j ); - } else { - if( j.prev.tail()[1] > j.prev.head()[1] ) - out.addarc( j ); - else - in.addarc( j ); - } - } - } - - private void classify_tailonright_s( Bin bin, Bin in, Bin out, float val ) { - /* tail at right, head on line */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 0, val ) == 0x12); - - j.clearitail(); - - float diff = j.next.head()[0] - val; - if( diff > 0.0 ) { - if( ccwTurn_sr( j, j.next ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else if( diff < 0.0 ) { - in.addarc( j ); - } else { - if( j.next.tail()[1] > j.next.head()[1] ) - out.addarc( j ); - else - in.addarc( j ); - } - } - } - - private void classify_headonleft_t( Bin bin, Bin in, Bin out, float val ) { - /* tail on line, head at left */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 1, val ) == 0x20 ); - j.setitail(); - - float diff = j.prev.tail()[1] - val; - if( diff > 0.0 ) { - out.addarc( j ); - } else if( diff < 0.0 ) { - if( ccwTurn_tl( j.prev, j ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else { - if( j.prev.tail()[0] > j.prev.head()[0] ) - out.addarc( j ); - else - in.addarc( j ); - } - } - } - - private void classify_tailonleft_t( Bin bin, Bin in, Bin out, float val ) { - /* tail at left, head on line */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 1, val ) == 0x02 ); - j.clearitail(); - - float diff = j.next.head()[1] - val; - if( diff > 0.0 ) { - in.addarc( j ); - } else if( diff < 0.0 ) { - if( ccwTurn_tl( j, j.next ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else { - if (j.next.tail()[0] > j.next.head()[0] ) - out.addarc( j ); - else - in.addarc( j ); - } - } - } - - private void classify_headonright_t( Bin bin, Bin in, Bin out, float val ) { - /* tail on line, head at right */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 1, val ) == 0x21 ); - - j.setitail(); - - float diff = j.prev.tail()[1] - val; - if( diff > 0.0 ) { - if( ccwTurn_tr( j.prev, j ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else if( diff < 0.0 ) { - out.addarc( j ); - } else { - if( j.prev.tail()[0] > j.prev.head()[0] ) - in.addarc( j ); - else - out.addarc( j ); - } - } - } - - private void classify_tailonright_t( Bin bin, Bin in, Bin out, float val ) { - /* tail at right, head on line */ - Arc j; - - while( (j = bin.removearc()) != null ) { - assert( arc_classify( j, 1, val ) == 0x12); - - j.clearitail(); - - float diff = j.next.head()[1] - val; - if( diff > 0.0 ) { - if( ccwTurn_tr( j, j.next ) != 0 ) - out.addarc( j ); - else - in.addarc( j ); - } else if( diff < 0.0 ) { - in.addarc( j ); - } else { - if( j.next.tail()[0] > j.next.head()[0] ) - in.addarc( j ); - else - out.addarc( j ); - } - } - } - - private int DIR_DOWN = 0; - private int DIR_SAME = 1; - private int DIR_UP = 2; - private int DIR_NONE = 3; - - private void tessellate( Arc_ptr, float ); - private void monotonize( Arc_ptr , Bin & ); - private int isMonotone( Arc_ptr ); - private int decompose( Bin &, float ); - - - private Slicer slicer; - private ArcTessellator arctessellator; - // private Pool arcpool; - // private Pool bezierarcpool; - // private Pool pwlarcpool; - // private TrimVertexPool trimvertexpool; - - private JumpBuffer* jumpbuffer; - private Renderhints& renderhints; - private Backend& backend; - - private Bin initialbin; - private Arc pjarc; - private int s_index; - private int t_index; - private Quilt *qlist; - private Flist spbrkpts; - private Flist tpbrkpts; - private Flist smbrkpts; - private Flist tmbrkpts; - private float stepsizes[4]; - private int showDegenerate; - private int isArcTypeBezier; - - // FIXME: NOT FINISHED - private void samplingSplit( Curvelist&, int ); - - private void subdivideInS( Bin source ) { - if( renderhints.display_method == N_OUTLINE_PARAM ) { - outline( source ); - freejarcs( source ); - } else { - setArcTypeBezier(); - setNonDegenerate(); - splitInS( source, spbrkpts.start, spbrkpts.end ); - } - } - - /** - * Splits a patch and a bin by an isoparametric line. - */ - private void splitInS( Bin source, int start, int end ) { - if( source.isnonempty() ) { - if( start != end ) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); - split( source, left, right, 0, spbrkpts.pts[i] ); - splitInS( left, start, i ); - splitInS( right, i+1, end ); - } else { - if( start == spbrkpts.start || start == spbrkpts.end ) { - freejarcs( source ); - } else if( renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM_S ) { - outline( source ); - freejarcs( source ); - } else { - setArcTypeBezier(); - setNonDegenerate(); - s_index = start; - splitInT( source, tpbrkpts.start, tpbrkpts.end ); - } - } - } - } - - /** - * Splits a patch and a bin by an isoparametric line. - */ - private void splitInT( Bin source, int start, int end ) { - if( source.isnonempty() ) { - if( start != end ) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); - split( source, left, right, 1, tpbrkpts.pts[i] ); - splitInT( left, start, i ); - splitInT( right, i+1, end ); - } else { - if( start == tpbrkpts.start || start == tpbrkpts.end ) { - freejarcs( source ); - } else if( renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM_ST ) { - outline( source ); - freejarcs( source ); - } else { - t_index = start; - setArcTypeBezier(); - setDegenerate(); - - float[] pta = new float[2]; - float[] ptb = new float[2]; - pta[0] = spbrkpts.pts[s_index-1]; - pta[1] = tpbrkpts.pts[t_index-1]; - - ptb[0] = spbrkpts.pts[s_index]; - ptb[1] = tpbrkpts.pts[t_index]; - qlist.downloadAll( pta, ptb, backend ); - - Patchlist patchlist = new Patchlist( qlist, pta, ptb ); - /* - printf("-------samplingSplit-----\n"); - source.show("samplingSplit source"); - */ - samplingSplit( source, patchlist, renderhints.maxsubdivisions, 0 ); - setNonDegenerate(); - setArcTypeBezier(); - } - } - } - } - - /** - * Recursively subdivides patch, cull checks each subpatch - */ - private void samplingSplit( Bin source, Patchlist patchlist, int subdivisions, int param ) { - if( ! source.isnonempty() ) return; - - if( patchlist.cullCheck() == Defines.CULL_TRIVIAL_REJECT ) { - freejarcs( source ); - return; - } - - patchlist.getstepsize(); - - if( renderhints.display_method == NurbsConsts.N_OUTLINE_PATCH ) { - tessellation( source, patchlist ); - outline( source ); - freejarcs( source ); - return; - } - - //patchlist.clamp(); - - tessellation( source, patchlist ); - - if( patchlist.needsSamplingSubdivision() && (subdivisions > 0) ) { - if( ! patchlist.needsSubdivision( 0 ) ) - param = 1; - else if( ! patchlist.needsSubdivision( 1 ) ) - param = 0; - else - param = 1 - param; - - Bin left = new Bin(); - Bin right = new Bin(); - float mid = ( patchlist.pspec[param].range[0] + - patchlist.pspec[param].range[1] ) * 0.5; - split( source, left, right, param, mid ); - Patchlist subpatchlist = new Patchlist( patchlist, param, mid ); - samplingSplit( left, subpatchlist, subdivisions-1, param ); - samplingSplit( right, patchlist, subdivisions-1, param ); - } else { - setArcTypePwl(); - setDegenerate(); - nonSamplingSplit( source, patchlist, subdivisions, param ); - setDegenerate(); - setArcTypeBezier(); - } - } - - private void nonSamplingSplit( Bin source, Patchlist patchlist, int subdivisions, int param ) { - if( patchlist.needsNonSamplingSubdivision() && (subdivisions > 0) ) { - param = 1 - param; - - Bin left = new Bin(); - Bin right = new Bin(); - float mid = ( patchlist.pspec[param].range[0] + - patchlist.pspec[param].range[1] ) * 0.5; - split( source, left, right, param, mid ); - Patchlist subpatchlist = new Patchlist( patchlist, param, mid ); - if( left.isnonempty() ) - if( subpatchlist.cullCheck() == Defines.CULL_TRIVIAL_REJECT ) - freejarcs( left ); - else - nonSamplingSplit( left, subpatchlist, subdivisions-1, param ); - if( right.isnonempty() ) - if( patchlist.cullCheck() == Defines.CULL_TRIVIAL_REJECT ) - freejarcs( right ); - else - nonSamplingSplit( right, patchlist, subdivisions-1, param ); - - } else { - // make bbox calls - patchlist.bbox(); - backend.patch( patchlist.pspec[0].range[0], patchlist.pspec[0].range[1], - patchlist.pspec[1].range[0], patchlist.pspec[1].range[1] ); - - if( renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV ) { - outline( source ); - freejarcs( source ); - } else { - setArcTypePwl(); - setDegenerate(); - findIrregularS( source ); - monosplitInS( source, smbrkpts.start, smbrkpts.end ); - } - } - } - - /** - * Sets tessellation of interior and boundary of patch. - */ - private void tessellation( Bin bin, Patchlist patchlist ) { - // tessellate unsampled trim curves - tessellate( bin, patchlist.pspec[1].sidestep[1], patchlist.pspec[0].sidestep[1], - patchlist.pspec[1].sidestep[0], patchlist.pspec[0].sidestep[0] ); - - // set interior sampling rates - slicer.setstriptessellation( patchlist.pspec[0].stepsize, patchlist.pspec[1].stepsize ); - - //added by zl: set the order which will be used in slicer.c++ - slicer.set_ulinear( (patchlist.get_uorder() == 2)); - slicer.set_vlinear( (patchlist.get_vorder() == 2)); - - // set boundary sampling rates - stepsizes[0] = patchlist.pspec[1].stepsize; - stepsizes[1] = patchlist.pspec[0].stepsize; - stepsizes[2] = patchlist.pspec[1].stepsize; - stepsizes[3] = patchlist.pspec[0].stepsize; - } - - /** - * Splits a patch and a bin by an isoparametric line. - */ - private void monosplitInS( Bin source, int start, int end ) { - if( source.isnonempty() ) { - if( start != end ) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); - split( source, left, right, 0, smbrkpts.pts[i] ); - monosplitInS( left, start, i ); - monosplitInS( right, i+1, end ); - } else { - if( renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV_S ) { - outline( source ); - freejarcs( source ); - } else { - setArcTypePwl(); - setDegenerate(); - findIrregularT( source ); - monosplitInT( source, tmbrkpts.start, tmbrkpts.end ); - } - } - } - } - - /** - * Splits a patch and a bin by an isoparametric line. - */ - private void monosplitInT( Bin source, int start, int end ) { - if( source.isnonempty() ) { - if( start != end ) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); - split( source, left, right, 1, tmbrkpts.pts[i] ); - monosplitInT( left, start, i ); - monosplitInT( right, i+1, end ); - } else { - if( renderhints.display_method == NurbsConsts.N_OUTLINE_SUBDIV_ST ) { - outline( source ); - freejarcs( source ); - } else { - /* - printf("*******render\n"); - source.show("source\n"); - */ - render( source ); - freejarcs( source ); - } - } - } - } - - /** - * Renders the trimmed patch by outlining the boundary . - */ - private void outline( Bin bin ) { - bin.markall(); - for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { - if( jarc.ismarked() ) { - assert( jarc.check( ) ); - Arc jarchead = jarc; - do { - slicer.outline( jarc ); - jarc.clearmark(); - jarc = jarc.prev; - } while (jarc != jarchead); - } - } - } - - /** - * Frees all arcs in a bin. - */ - private void freejarcs( Bin & ) { - bin.adopt(); /* XXX - should not be necessary */ - - Arc jarc; - while( (jarc = bin.removearc()) != null ) { - if( jarc.pwlArc != null ) jarc.pwlArc.deleteMe( ); jarc.pwlArc = null; - if( jarc.bezierArc != null) jarc.bezierArc.deleteMe( ); jarc.bezierArc = null; - jarc.deleteMe( ); - } - } - - /** - * Renders all monotone regions in a bin and frees the bin. - */ - private void render( Bin bin ) { - bin.markall(); - - slicer.setisolines( ( renderhints.display_method == N_ISOLINE_S ) ? 1 : 0 ); - - for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { - if( jarc.ismarked() ) { - assert( jarc.check( ) != 0 ); - Arc jarchead = jarc; - do { - jarc.clearmark(); - jarc = jarc.next; - } while (jarc != jarchead); - slicer.slice( jarc ); - } - } - } - - private void split( Bin &, Bin &, Bin &, int, float ); - - /** - * Tessellates all Bezier arcs in a bin. - *

    - *
  1. only accepts linear Bezier arcs as input - *
  2. the Bezier arcs are stored in the pwlArc structure - *
  3. only vertical or horizontal lines work - *
- * should: - *
    - *
  1. represent Bezier arcs in BezierArc structure - * (this requires a multitude of changes to the code) - *
  2. accept high degree Bezier arcs (hard) - * map the curve onto the surface to determine tessellation - *
  3. work for curves of arbitrary geometry - *
- *---------------------------------------------------------------------------- - */ - private void tessellate( Bin bin, float rrate, float trate, float lrate, float brate ) { - for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { - if( jarc.isbezier( ) ) { - assert( jarc.pwlArc.npts == 2 ); - TrimVertex[] pts = jarc.pwlArc.pts; - float s1 = pts[0].param[0]; - float t1 = pts[0].param[1]; - float s2 = pts[1].param[0]; - float t2 = pts[1].param[1]; - - jarc.pwlArc.deleteMe( ); - jarc.pwlArc = null; - - switch( jarc.getside() ) { - case Arc.SIDE_LEFT: - assert( s1 == s2 ); - arctessellator.pwl_left( jarc, s1, t1, t2, lrate ); - break; - case Arc.SIDE_RIGHT: - assert( s1 == s2 ); - arctessellator.pwl_right( jarc, s1, t1, t2, rrate ); - break; - case Arc.SIDE_TOP: - assert( t1 == t2 ); - arctessellator.pwl_top( jarc, t1, s1, s2, trate ); - break; - case Arc.SIDE_BOTTOM: - assert( t1 == t2 ); - arctessellator.pwl_bottom( jarc, t1, s1, s2, brate ); - break; - case Arc.SIDE_NONE: - throw new InternalError("Incorrect tesselation state"); - break; - } - assert( ! jarc.isbezier() ); - assert( jarc.check() != 0 ); - } - } - } - - private inline void setDegenerate( void ) { showDegenerate = 1; } - private inline void setNonDegenerate( void ) { showDegenerate = 0; } - private inline int showingDegenerate( void ) { return showDegenerate; } - private inline void setArcTypeBezier( void ) { isArcTypeBezier = 1; } - private inline void setArcTypePwl( void ) { isArcTypeBezier = 0; } - private inline int isBezierArcType( void ) { return isArcTypeBezier; } - - /** - * If no user input trimming data, then create a trimming curve - * around the boundaries of the Quilt. The curve consists of four - * Jordan arcs, one for each side of the Quilt, connected, of - * course, head to tail. - */ - private void makeBorderTrim( float[] from, float[] to ) { - float smin = from[0]; - float smax = to[0]; - float tmin = from[1]; - float tmax = to[1]; - - pjarc = null; - - Arc jarc = new Arc( Arc.SIDE_BOTTOM, 0 ); - arctessellator.bezier( jarc, smin, smax, tmin, tmin ); - initialbin.addarc( jarc ); - pjarc = jarc.append( pjarc ); - - jarc = new Arc( Arc.SIDE_RIGHT, 0 ); - arctessellator.bezier( jarc, smax, smax, tmin, tmax ); - initialbin.addarc( jarc ); - pjarc = jarc.append( pjarc ); - - jarc = new Arc( Arc.SIDE_TOP, 0 ); - arctessellator.bezier( jarc, smax, smin, tmax, tmax ); - initialbin.addarc( jarc ); - pjarc = jarc.append( pjarc ); - - jarc = new Arc( Arc.SIDE_LEFT, 0 ); - arctessellator.bezier( jarc, smin, smin, tmax, tmin ); - initialbin.addarc( jarc ); - jarc.append( pjarc ); - - assert( jarc.check() ); - } - - private void split( Bin &, int, const float *, int, int ); - private void partition( Bin bin, Bin left, Bin intersections, Bin right, Bin unknown, int param, float value ) { - Bin headonleft = new Bin(); - Bin headonright = new Bin(); - Bin tailonleft = new Bin(); - Bin tailonright = new Bin(); - - for( Arc jarc = bin.removearc(); jarc != null; jarc = bin.removearc() ) { - - float tdiff = jarc.tail()[param] - value; - float hdiff = jarc.head()[param] - value; - - if( tdiff > 0.0 ) { - if( hdiff > 0.0 ) { - right.addarc( jarc ); - } else if( hdiff == 0.0 ) { - tailonright.addarc( jarc ); - } else { - Arc jtemp; - switch( arc_split(jarc, param, value, 0) ) { - case 2: - tailonright.addarc( jarc ); - headonleft.addarc( jarc.next ); - break; - case 31: - assert( jarc.head()[param] > value ); - right.addarc( jarc ); - tailonright.addarc( jtemp = jarc.next ); - headonleft.addarc( jtemp.next ); - break; - case 32: - assert( jarc.head()[param] <= value ); - tailonright .addarc( jarc ); - headonleft.addarc( jtemp = jarc.next ); - left.addarc( jtemp.next ); - break; - case 4: - right.addarc( jarc ); - tailonright.addarc( jtemp = jarc.next ); - headonleft.addarc( jtemp = jtemp.next ); - left.addarc( jtemp.next ); - } - } - } else if( tdiff == 0.0 ) { - if( hdiff > 0.0 ) { - headonright.addarc( jarc ); - } else if( hdiff == 0.0 ) { - unknown.addarc( jarc ); - } else { - headonleft.addarc( jarc ); - } - } else { - if( hdiff > 0.0 ) { - Arc jtemp; - switch( arc_split(jarc, param, value, 1) ) { - case 2: - tailonleft.addarc( jarc ); - headonright.addarc( jarc.next ); - break; - case 31: - assert( jarc.head()[param] < value ); - left.addarc( jarc ); - tailonleft.addarc( jtemp = jarc.next ); - headonright.addarc( jtemp.next ); - break; - case 32: - assert( jarc.head()[param] >= value ); - tailonleft.addarc( jarc ); - headonright.addarc( jtemp = jarc.next ); - right.addarc( jtemp.next ); - break; - case 4: - left.addarc( jarc ); - tailonleft.addarc( jtemp = jarc.next ); - headonright.addarc( jtemp = jtemp.next ); - right.addarc( jtemp.next ); - } - } else if( hdiff == 0.0 ) { - tailonleft.addarc( jarc ); - } else { - left.addarc( jarc ); - } - } - } - if( param == 0 ) { - classify_headonleft_s( headonleft, intersections, left, value ); - classify_tailonleft_s( tailonleft, intersections, left, value ); - classify_headonright_s( headonright, intersections, right, value ); - classify_tailonright_s( tailonright, intersections, right, value ); - } else { - classify_headonleft_t( headonleft, intersections, left, value ); - classify_tailonleft_t( tailonleft, intersections, left, value ); - classify_headonright_t( headonright, intersections, right, value ); - classify_tailonright_t( tailonright, intersections, right, value ); - } - } - - /** - * Determine points of non-monotonicity in s direction. - */ - private void findIrregularS( Bin bin ) { - assert( bin.firstarc() == null || bin.firstarc().check() ); - - smbrkpts.grow( bin.numarcs() ); - - for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { - float[] a = jarc.prev.tail(); - float[] b = jarc.tail(); - float[] c = jarc.head(); - - if( b[1] == a[1] && b[1] == c[1] ) continue; - - //corrected code - if((b[1]<=a[1] && b[1] <= c[1]) || - (b[1]>=a[1] && b[1] >= c[1])) - { - //each arc (jarc, jarc.prev, jarc.next) is a - //monotone arc consisting of multiple line segements. - //it may happen that jarc.prev and jarc.next are the same, - //that is, jarc.prev and jarc form a closed loop. - //In such case, a and c will be the same. - if(a[0]==c[0] && a[1] == c[1]) - { - if(jarc.pwlArc.npts >2) - { - c = jarc.pwlArc.pts[jarc.pwlArc.npts-2].param; - } - else - { - assert(jarc.prev.pwlArc.npts>2); - a = jarc.prev.pwlArc.pts[jarc.prev.pwlArc.npts-2].param; - } - - } - if(area(a,b,c) < 0) - { - smbrkpts.add(b[0]); - } - - } - - /* old code, - if( b[1] <= a[1] && b[1] <= c[1] ) { - if( ! ccwTurn_tr( jarc.prev, jarc ) ) - smbrkpts.add( b[0] ); - } else if( b[1] >= a[1] && b[1] >= c[1] ) { - if( ! ccwTurn_tl( jarc.prev, jarc ) ) - smbrkpts.add( b[0] ); - } - */ - - } - - smbrkpts.filter(); - } - - /** - * Determines points of non-monotonicity in t direction where one - * arc is parallel to the s axis. - */ - private void findIrregularT( Bin bin ) { - assert( bin.firstarc() == null || bin.firstarc().check() ); - - tmbrkpts.grow( bin.numarcs() ); - - for( Arc jarc=bin.firstarc(); jarc != null; jarc=bin.nextarc() ) { - float[] a = jarc.prev.tail(); - float[] b = jarc.tail(); - float[] c = jarc.head(); - - if( b[0] == a[0] && b[0] == c[0] ) continue; - - if( b[0] <= a[0] && b[0] <= c[0] ) { - if( a[1] != b[1] && b[1] != c[1] ) continue; - if( ccwTurn_sr( jarc.prev, jarc ) == 0) - tmbrkpts.add( b[1] ); - } else if ( b[0] >= a[0] && b[0] >= c[0] ) { - if( a[1] != b[1] && b[1] != c[1] ) continue; - if( ccwTurn_sl( jarc.prev, jarc ) == 0) - tmbrkpts.add( b[1] ); - } - } - tmbrkpts.filter( ); - } - - - private int bbox( TrimVertex a, TrimVertex b, TrimVertex c, int p ) { - return bbox( a.param[p], b.param[p], c.param[p], - a.param[1-p], b.param[1-p], c.param[1-p] ); - } - - private static int bbox( float sa, float sb, float sc, float ta, float tb, float tc ) { - assert( tc >= ta ); - assert( tc <= tb ); - - if( sa < sb ) { - if( sc <= sa ) { - return -1; - } else if( sb <= sc ) { - return 1; - } else { - return 0; - } - } else if( sa > sb ) { - if( sc >= sa ) { - return 1; - } else if( sb >= sc ) { - return -1; - } else { - return 0; - } - } else { - if( sc > sa ) { - return 1; - } else if( sb > sc ) { - return -1; - } else { - return 0; - } - } - } - /** - * Determines how three points are oriented by computing their - * determinant. - * - * @return 1 if the vertices are ccw oriented, 0 if they are cw - * oriented, or -1 if the computation is ill-conditioned. - */ - private static int ccw( TrimVertex a, TrimVertex b, TrimVertex c ) { - float d = TrimVertex.det3( a, b, c ); - if( Math.abs(d) < 0.0001 ) return -1; - return (d < 0.0) ? 0 : 1; - } - private void join_s( Bin &, Bin &, Arc_ptr, Arc_ptr ); - private void join_t( Bin &, Bin &, Arc_ptr , Arc_ptr ); - - private static void vert_interp( TrimVertex n, TrimVertex l, TrimVertex r, int p, float val ) { - assert( val > l.param[p]); - assert( val < r.param[p]); - - n.nuid = l.nuid; - - n.param[p] = val; - if( l.param[1-p] != r.param[1-p] ) { - float ratio = (val - l.param[p]) / (r.param[p] - l.param[p]); - n.param[1-p] = l.param[1-p] + - ratio * (r.param[1-p] - l.param[1-p]); - } else { - n.param[1-p] = l.param[1-p]; - } - } - - private static final int INTERSECT_VERTEX = 1; - private static final int INTERSECT_EDGE = 2; - - /** - * Finds intersection of pwlArc and isoparametric line. - */ - private static int pwlarc_intersect( PwlArc pwlArc, int param, float value, int dir, int[] loc ) { - assert( pwlArc.npts > 0 ); - - if( dir != 0 ) { - TrimVertex[] v = pwlArc.pts; - int imin = 0; - int imax = pwlArc.npts - 1; - assert( value > v[imin].param[param] ); - assert( value < v[imax].param[param] ); - while( (imax - imin) > 1 ) { - int imid = (imax + imin)/2; - if( v[imid].param[param] > value ) - imax = imid; - else if( v[imid].param[param] < value ) - imin = imid; - else { - loc[1] = imid; - return INTERSECT_VERTEX; - } - } - loc[0] = imin; - loc[2] = imax; - return INTERSECT_EDGE; - } else { - TrimVertex[] v = pwlArc.pts; - int imax = 0; - int imin = pwlArc.npts - 1; - assert( value > v[imin].param[param] ); - assert( value < v[imax].param[param] ); - while( (imin - imax) > 1 ) { - int imid = (imax + imin)/2; - if( v[imid].param[param] > value ) - imax = imid; - else if( v[imid].param[param] < value ) - imin = imid; - else { - loc[1] = imid; - return INTERSECT_VERTEX; - } - } - loc[0] = imin; - loc[2] = imax; - return INTERSECT_EDGE; - } - } - - private int arc_split( Arc jarc , int param, float value, int dir ) { - int maxvertex = jarc.pwlArc.npts; - Arc jarc1, jarc2, jarc3; - TrimVertex v = jarc.pwlArc.pts; - - int[] loc = new int[3]; - switch( pwlarc_intersect( jarc.pwlArc, param, value, dir, loc ) ) { - - // When the parameter value lands on a vertex, life is sweet - case INTERSECT_VERTEX: { - jarc1 = new Arc( jarc, new PwlArc( maxvertex-loc[1], /* &v[loc[1]] */ v, loc[1] ) ); - jarc.pwlArc.npts = loc[1] + 1; - jarc1.next = jarc.next; - jarc1.next.prev = jarc1; - jarc.next = jarc1; - jarc1.prev = jarc; - assert(jarc.check()); - return 2; - } - - // When the parameter value intersects an edge, we have to - // interpolate a new vertex. There are special cases - // if the new vertex is adjacent to one or both of the - // endpoints of the arc. - case INTERSECT_EDGE: { - int i, j; - if( dir == 0 ) { - i = loc[0]; - j = loc[2]; - } else { - i = loc[2]; - j = loc[0]; - } - - // The split is between vertices at index j and i, in that - // order (j < i) - - // JEB: This code is my idea of how to do the split without - // increasing the number of links. I'm doing this so that - // the is_rect routine can recognize rectangles created by - // subdivision. In exchange for simplifying the curve list, - // however, it costs in allocated space and vertex copies. - - TrimVertex[] newjunk = TrimVertex.allocate(maxvertex -i+1 /*-j*/); - int k; - for(k=0; knext) */ - public GLUhalfEdge Sym; /* same edge, opposite direction */ - public GLUhalfEdge Onext; /* next edge CCW around origin */ - public GLUhalfEdge Lnext; /* next edge CCW around left face */ - public GLUvertex Org; /* origin vertex (Overtex too long) */ - public net.java.games.jogl.impl.tesselator.GLUface Lface; /* left face */ - - /* Internal data (keep hidden) */ - public net.java.games.jogl.impl.tesselator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */ - public int winding; /* change in winding number when crossing */ - public boolean first; - - public GLUhalfEdge(boolean first) { - this.first = first; - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/GLUmesh.java b/src/net/java/games/jogl/impl/tesselator/GLUmesh.java deleted file mode 100644 index 0ab3b2626..000000000 --- a/src/net/java/games/jogl/impl/tesselator/GLUmesh.java +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - - - -class GLUmesh { - GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */ - net.java.games.jogl.impl.tesselator.GLUface fHead = new GLUface(); /* dummy header for face list */ - net.java.games.jogl.impl.tesselator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */ - net.java.games.jogl.impl.tesselator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */ -} diff --git a/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java b/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java deleted file mode 100644 index 90de5bcc9..000000000 --- a/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java +++ /dev/null @@ -1,624 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.tesselator.*; - -public class GLUtesselatorImpl implements GLUtesselator { - public static final int TESS_MAX_CACHE = 100; - - private int state; /* what begin/end calls have we seen? */ - - private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */ - GLUmesh mesh; /* stores the input contours, and eventually - the tessellation itself */ - - /*** state needed for projecting onto the sweep plane ***/ - - double[] normal = new double[3]; /* user-specified normal (if provided) */ - double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */ - double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */ - - /*** state needed for the line sweep ***/ - - private double relTolerance; /* tolerance for merging features */ - int windingRule; /* rule for determining polygon interior */ - boolean fatalError; /* fatal error: needed combine callback */ - - Dict dict; /* edge dictionary for sweep line */ - PriorityQ pq; /* priority queue of vertex events */ - GLUvertex event; /* current sweep event being processed */ - - /*** state needed for rendering callbacks (see render.c) ***/ - - boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ - boolean boundaryOnly; /* Extract contours, not triangles */ - GLUface lonelyTriList; - /* list of triangles which could not be rendered as strips or fans */ - - - - /*** state needed to cache single-contour polygons for renderCache() */ - - private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */ - int cacheCount; /* number of cached vertices */ - CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */ - - /*** rendering callbacks that also pass polygon data ***/ - private Object polygonData; /* client data for current polygon */ - - private GLUtesselatorCallback callBegin; - private GLUtesselatorCallback callEdgeFlag; - private GLUtesselatorCallback callVertex; - private GLUtesselatorCallback callEnd; -// private GLUtesselatorCallback callMesh; - private GLUtesselatorCallback callError; - private GLUtesselatorCallback callCombine; - - private GLUtesselatorCallback callBeginData; - private GLUtesselatorCallback callEdgeFlagData; - private GLUtesselatorCallback callVertexData; - private GLUtesselatorCallback callEndData; -// private GLUtesselatorCallback callMeshData; - private GLUtesselatorCallback callErrorData; - private GLUtesselatorCallback callCombineData; - - private static final double GLU_TESS_DEFAULT_TOLERANCE = 0.0; -// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */ - private static GLUtesselatorCallback NULL_CB = new GLUtesselatorCallbackAdapter(); - -// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ -// MAX(sizeof(GLUvertex),sizeof(GLUface)))) - - private GLUtesselatorImpl() { - state = TessState.T_DORMANT; - - normal[0] = 0; - normal[1] = 0; - normal[2] = 0; - - relTolerance = GLU_TESS_DEFAULT_TOLERANCE; - windingRule = GLU.GLU_TESS_WINDING_ODD; - flagBoundary = false; - boundaryOnly = false; - - callBegin = NULL_CB; - callEdgeFlag = NULL_CB; - callVertex = NULL_CB; - callEnd = NULL_CB; - callError = NULL_CB; - callCombine = NULL_CB; -// callMesh = NULL_CB; - - callBeginData = NULL_CB; - callEdgeFlagData = NULL_CB; - callVertexData = NULL_CB; - callEndData = NULL_CB; - callErrorData = NULL_CB; - callCombineData = NULL_CB; - - polygonData = null; - - for (int i = 0; i < cache.length; i++) { - cache[i] = new CachedVertex(); - } - } - - static public GLUtesselator gluNewTess() - { - return new GLUtesselatorImpl(); - } - - - private void makeDormant() { - /* Return the tessellator to its original dormant state. */ - - if (mesh != null) { - Mesh.__gl_meshDeleteMesh(mesh); - } - state = TessState.T_DORMANT; - lastEdge = null; - mesh = null; - } - - private void requireState(int newState) { - if (state != newState) gotoState(newState); - } - - private void gotoState(int newState) { - while (state != newState) { - /* We change the current state one level at a time, to get to - * the desired state. - */ - if (state < newState) { - if (state == TessState.T_DORMANT) { - callErrorOrErrorData(GLU.GLU_TESS_MISSING_BEGIN_POLYGON); - gluTessBeginPolygon(null); - } else if (state == TessState.T_IN_POLYGON) { - callErrorOrErrorData(GLU.GLU_TESS_MISSING_BEGIN_CONTOUR); - gluTessBeginContour(); - } - } else { - if (state == TessState.T_IN_CONTOUR) { - callErrorOrErrorData(GLU.GLU_TESS_MISSING_END_CONTOUR); - gluTessEndContour(); - } else if (state == TessState.T_IN_POLYGON) { - callErrorOrErrorData(GLU.GLU_TESS_MISSING_END_POLYGON); - /* gluTessEndPolygon( tess ) is too much work! */ - makeDormant(); - } - } - } - } - - public void gluDeleteTess() { - requireState(TessState.T_DORMANT); - } - - public void gluTessProperty(int which, double value) { - switch (which) { - case GLU.GLU_TESS_TOLERANCE: - if (value < 0.0 || value > 1.0) break; - relTolerance = value; - return; - - case GLU.GLU_TESS_WINDING_RULE: - int windingRule = (int) value; - if (windingRule != value) break; /* not an integer */ - - switch (windingRule) { - case GLU.GLU_TESS_WINDING_ODD: - case GLU.GLU_TESS_WINDING_NONZERO: - case GLU.GLU_TESS_WINDING_POSITIVE: - case GLU.GLU_TESS_WINDING_NEGATIVE: - case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO: - this.windingRule = windingRule; - return; - default: - break; - } - - case GLU.GLU_TESS_BOUNDARY_ONLY: - boundaryOnly = (value != 0); - return; - - default: - callErrorOrErrorData(GLU.GLU_INVALID_ENUM); - return; - } - callErrorOrErrorData(GLU.GLU_INVALID_VALUE); - } - -/* Returns tessellator property */ - public void gluGetTessProperty(int which, double[] value) { - switch (which) { - case GLU.GLU_TESS_TOLERANCE: -/* tolerance should be in range [0..1] */ - assert (0.0 <= relTolerance && relTolerance <= 1.0); - value[0] = relTolerance; - break; - case GLU.GLU_TESS_WINDING_RULE: - assert (windingRule == GLU.GLU_TESS_WINDING_ODD || - windingRule == GLU.GLU_TESS_WINDING_NONZERO || - windingRule == GLU.GLU_TESS_WINDING_POSITIVE || - windingRule == GLU.GLU_TESS_WINDING_NEGATIVE || - windingRule == GLU.GLU_TESS_WINDING_ABS_GEQ_TWO); - value[0] = windingRule; - break; - case GLU.GLU_TESS_BOUNDARY_ONLY: - assert (boundaryOnly == true || boundaryOnly == false); - value[0] = boundaryOnly ? 1 : 0; - break; - default: - value[0] = 0.0; - callErrorOrErrorData(GLU.GLU_INVALID_ENUM); - break; - } - } /* gluGetTessProperty() */ - - public void gluTessNormal(double x, double y, double z) { - normal[0] = x; - normal[1] = y; - normal[2] = z; - } - - public void gluTessCallback(int which, GLUtesselatorCallback aCallback) { - switch (which) { - case GLU.GLU_TESS_BEGIN: - callBegin = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_BEGIN_DATA: - callBeginData = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_EDGE_FLAG: - callEdgeFlag = aCallback == null ? NULL_CB : aCallback; -/* If the client wants boundary edges to be flagged, - * we render everything as separate triangles (no strips or fans). - */ - flagBoundary = aCallback != null; - return; - case GLU.GLU_TESS_EDGE_FLAG_DATA: - callEdgeFlagData = callBegin = aCallback == null ? NULL_CB : aCallback; -/* If the client wants boundary edges to be flagged, - * we render everything as separate triangles (no strips or fans). - */ - flagBoundary = (aCallback != null); - return; - case GLU.GLU_TESS_VERTEX: - callVertex = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_VERTEX_DATA: - callVertexData = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_END: - callEnd = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_END_DATA: - callEndData = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_ERROR: - callError = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_ERROR_DATA: - callErrorData = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_COMBINE: - callCombine = aCallback == null ? NULL_CB : aCallback; - return; - case GLU.GLU_TESS_COMBINE_DATA: - callCombineData = aCallback == null ? NULL_CB : aCallback; - return; -// case GLU_TESS_MESH: -// callMesh = aCallback == null ? NULL_CB : aCallback; -// return; - default: - callErrorOrErrorData(GLU.GLU_INVALID_ENUM); - return; - } - } - - private boolean addVertex(double[] coords, Object vertexData) { - GLUhalfEdge e; - - e = lastEdge; - if (e == null) { -/* Make a self-loop (one vertex, one edge). */ - - e = Mesh.__gl_meshMakeEdge(mesh); - if (e == null) return false; - if (!Mesh.__gl_meshSplice(e, e.Sym)) return false; - } else { -/* Create a new vertex and edge which immediately follow e - * in the ordering around the left face. - */ - if (Mesh.__gl_meshSplitEdge(e) == null) return false; - e = e.Lnext; - } - -/* The new vertex is now e.Org. */ - e.Org.data = vertexData; - e.Org.coords[0] = coords[0]; - e.Org.coords[1] = coords[1]; - e.Org.coords[2] = coords[2]; - -/* The winding of an edge says how the winding number changes as we - * cross from the edge''s right face to its left face. We add the - * vertices in such an order that a CCW contour will add +1 to - * the winding number of the region inside the contour. - */ - e.winding = 1; - e.Sym.winding = -1; - - lastEdge = e; - - return true; - } - - private void cacheVertex(double[] coords, Object vertexData) { - if (cache[cacheCount] == null) { - cache[cacheCount] = new CachedVertex(); - } - - CachedVertex v = cache[cacheCount]; - - v.data = vertexData; - v.coords[0] = coords[0]; - v.coords[1] = coords[1]; - v.coords[2] = coords[2]; - ++cacheCount; - } - - - private boolean flushCache() { - CachedVertex[] v = cache; - - mesh = Mesh.__gl_meshNewMesh(); - if (mesh == null) return false; - - for (int i = 0; i < cacheCount; i++) { - CachedVertex vertex = v[i]; - if (!addVertex(vertex.coords, vertex.data)) return false; - } - cacheCount = 0; - flushCacheOnNextVertex = false; - - return true; - } - - public void gluTessVertex(double[] coords, Object vertexData) { - int i; - boolean tooLarge = false; - double x; - double[] clamped = new double[3]; - - requireState(TessState.T_IN_CONTOUR); - - if (flushCacheOnNextVertex) { - if (!flushCache()) { - callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); - return; - } - lastEdge = null; - } - for (i = 0; i < 3; ++i) { - x = coords[i]; - if (x < -GLU.GLU_TESS_MAX_COORD) { - x = -GLU.GLU_TESS_MAX_COORD; - tooLarge = true; - } - if (x > GLU.GLU_TESS_MAX_COORD) { - x = GLU.GLU_TESS_MAX_COORD; - tooLarge = true; - } - clamped[i] = x; - } - if (tooLarge) { - callErrorOrErrorData(GLU.GLU_TESS_COORD_TOO_LARGE); - } - - if (mesh == null) { - if (cacheCount < TESS_MAX_CACHE) { - cacheVertex(clamped, vertexData); - return; - } - if (!flushCache()) { - callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); - return; - } - } - - if (!addVertex(clamped, vertexData)) { - callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); - } - } - - - public void gluTessBeginPolygon(Object data) { - requireState(TessState.T_DORMANT); - - state = TessState.T_IN_POLYGON; - cacheCount = 0; - flushCacheOnNextVertex = false; - mesh = null; - - polygonData = data; - } - - - public void gluTessBeginContour() { - requireState(TessState.T_IN_POLYGON); - - state = TessState.T_IN_CONTOUR; - lastEdge = null; - if (cacheCount > 0) { -/* Just set a flag so we don't get confused by empty contours - * -- these can be generated accidentally with the obsolete - * NextContour() interface. - */ - flushCacheOnNextVertex = true; - } - } - - - public void gluTessEndContour() { - requireState(TessState.T_IN_CONTOUR); - state = TessState.T_IN_POLYGON; - } - - public void gluTessEndPolygon() { - GLUmesh mesh; - - try { - requireState(TessState.T_IN_POLYGON); - state = TessState.T_DORMANT; - - if (this.mesh == null) { - if (!flagBoundary /*&& callMesh == NULL_CB*/) { - -/* Try some special code to make the easy cases go quickly - * (eg. convex polygons). This code does NOT handle multiple contours, - * intersections, edge flags, and of course it does not generate - * an explicit mesh either. - */ - if (Render.__gl_renderCache(this)) { - polygonData = null; - return; - } - } - if (!flushCache()) throw new RuntimeException(); /* could've used a label*/ - } - -/* Determine the polygon normal and project vertices onto the plane - * of the polygon. - */ - Normal.__gl_projectPolygon(this); - -/* __gl_computeInterior( tess ) computes the planar arrangement specified - * by the given contours, and further subdivides this arrangement - * into regions. Each region is marked "inside" if it belongs - * to the polygon, according to the rule given by windingRule. - * Each interior region is guaranteed be monotone. - */ - if (!Sweep.__gl_computeInterior(this)) { - throw new RuntimeException(); /* could've used a label */ - } - - mesh = this.mesh; - if (!fatalError) { - boolean rc = true; - -/* If the user wants only the boundary contours, we throw away all edges - * except those which separate the interior from the exterior. - * Otherwise we tessellate all the regions marked "inside". - */ - if (boundaryOnly) { - rc = TessMono.__gl_meshSetWindingNumber(mesh, 1, true); - } else { - rc = TessMono.__gl_meshTessellateInterior(mesh); - } - if (!rc) throw new RuntimeException(); /* could've used a label */ - - Mesh.__gl_meshCheckMesh(mesh); - - if (callBegin != NULL_CB || callEnd != NULL_CB - || callVertex != NULL_CB || callEdgeFlag != NULL_CB - || callBeginData != NULL_CB - || callEndData != NULL_CB - || callVertexData != NULL_CB - || callEdgeFlagData != NULL_CB) { - if (boundaryOnly) { - Render.__gl_renderBoundary(this, mesh); /* output boundary contours */ - } else { - Render.__gl_renderMesh(this, mesh); /* output strips and fans */ - } - } -// if (callMesh != NULL_CB) { -// -///* Throw away the exterior faces, so that all faces are interior. -// * This way the user doesn't have to check the "inside" flag, -// * and we don't need to even reveal its existence. It also leaves -// * the freedom for an implementation to not generate the exterior -// * faces in the first place. -// */ -// TessMono.__gl_meshDiscardExterior(mesh); -// callMesh.mesh(mesh); /* user wants the mesh itself */ -// mesh = null; -// polygonData = null; -// return; -// } - } - Mesh.__gl_meshDeleteMesh(mesh); - polygonData = null; - mesh = null; - } catch (Exception e) { - e.printStackTrace(); - callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); - } - } - - /*******************************************************/ - -/* Obsolete calls -- for backward compatibility */ - - public void gluBeginPolygon() { - gluTessBeginPolygon(null); - gluTessBeginContour(); - } - - -/*ARGSUSED*/ - public void gluNextContour(int type) { - gluTessEndContour(); - gluTessBeginContour(); - } - - - public void gluEndPolygon() { - gluTessEndContour(); - gluTessEndPolygon(); - } - - void callBeginOrBeginData(int a) { - if (callBeginData != NULL_CB) - callBeginData.beginData(a, polygonData); - else - callBegin.begin(a); - } - - void callVertexOrVertexData(Object a) { - if (callVertexData != NULL_CB) - callVertexData.vertexData(a, polygonData); - else - callVertex.vertex(a); - } - - void callEdgeFlagOrEdgeFlagData(boolean a) { - if (callEdgeFlagData != NULL_CB) - callEdgeFlagData.edgeFlagData(a, polygonData); - else - callEdgeFlag.edgeFlag(a); - } - - void callEndOrEndData() { - if (callEndData != NULL_CB) - callEndData.endData(polygonData); - else - callEnd.end(); - } - - void callCombineOrCombineData(double[] coords, Object[] vertexData, float[] weights, Object[] outData) { - if (callCombineData != NULL_CB) - callCombineData.combineData(coords, vertexData, weights, outData, polygonData); - else - callCombine.combine(coords, vertexData, weights, outData); - } - - void callErrorOrErrorData(int a) { - if (callErrorData != NULL_CB) - callErrorData.errorData(a, polygonData); - else - callError.error(a); - } - -} diff --git a/src/net/java/games/jogl/impl/tesselator/GLUvertex.java b/src/net/java/games/jogl/impl/tesselator/GLUvertex.java deleted file mode 100644 index 6497aa2d7..000000000 --- a/src/net/java/games/jogl/impl/tesselator/GLUvertex.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -class GLUvertex { - public GLUvertex next; /* next vertex (never NULL) */ - public GLUvertex prev; /* previous vertex (never NULL) */ - public net.java.games.jogl.impl.tesselator.GLUhalfEdge anEdge; /* a half-edge with this origin */ - public Object data; /* client's data */ - - /* Internal data (keep hidden) */ - public double[] coords = new double[3]; /* vertex location in 3D */ - public double s, t; /* projection onto the sweep plane */ - public int pqHandle; /* to allow deletion from priority queue */ -} diff --git a/src/net/java/games/jogl/impl/tesselator/Geom.java b/src/net/java/games/jogl/impl/tesselator/Geom.java deleted file mode 100644 index 9693b3a48..000000000 --- a/src/net/java/games/jogl/impl/tesselator/Geom.java +++ /dev/null @@ -1,308 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -class Geom { - private Geom() { - } - - /* Given three vertices u,v,w such that VertLeq(u,v) && VertLeq(v,w), - * evaluates the t-coord of the edge uw at the s-coord of the vertex v. - * Returns v->t - (uw)(v->s), ie. the signed distance from uw to v. - * If uw is vertical (and thus passes thru v), the result is zero. - * - * The calculation is extremely accurate and stable, even when v - * is very close to u or w. In particular if we set v->t = 0 and - * let r be the negated result (this evaluates (uw)(v->s)), then - * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). - */ - static double EdgeEval(GLUvertex u, GLUvertex v, GLUvertex w) { - double gapL, gapR; - - assert (VertLeq(u, v) && VertLeq(v, w)); - - gapL = v.s - u.s; - gapR = w.s - v.s; - - if (gapL + gapR > 0) { - if (gapL < gapR) { - return (v.t - u.t) + (u.t - w.t) * (gapL / (gapL + gapR)); - } else { - return (v.t - w.t) + (w.t - u.t) * (gapR / (gapL + gapR)); - } - } - /* vertical line */ - return 0; - } - - static double EdgeSign(GLUvertex u, GLUvertex v, GLUvertex w) { - double gapL, gapR; - - assert (VertLeq(u, v) && VertLeq(v, w)); - - gapL = v.s - u.s; - gapR = w.s - v.s; - - if (gapL + gapR > 0) { - return (v.t - w.t) * gapL + (v.t - u.t) * gapR; - } - /* vertical line */ - return 0; - } - - - /*********************************************************************** - * Define versions of EdgeSign, EdgeEval with s and t transposed. - */ - - static double TransEval(GLUvertex u, GLUvertex v, GLUvertex w) { - /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), - * evaluates the t-coord of the edge uw at the s-coord of the vertex v. - * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. - * If uw is vertical (and thus passes thru v), the result is zero. - * - * The calculation is extremely accurate and stable, even when v - * is very close to u or w. In particular if we set v->s = 0 and - * let r be the negated result (this evaluates (uw)(v->t)), then - * r is guaranteed to satisfy MIN(u->s,w->s) <= r <= MAX(u->s,w->s). - */ - double gapL, gapR; - - assert (TransLeq(u, v) && TransLeq(v, w)); - - gapL = v.t - u.t; - gapR = w.t - v.t; - - if (gapL + gapR > 0) { - if (gapL < gapR) { - return (v.s - u.s) + (u.s - w.s) * (gapL / (gapL + gapR)); - } else { - return (v.s - w.s) + (w.s - u.s) * (gapR / (gapL + gapR)); - } - } - /* vertical line */ - return 0; - } - - static double TransSign(GLUvertex u, GLUvertex v, GLUvertex w) { - /* Returns a number whose sign matches TransEval(u,v,w) but which - * is cheaper to evaluate. Returns > 0, == 0 , or < 0 - * as v is above, on, or below the edge uw. - */ - double gapL, gapR; - - assert (TransLeq(u, v) && TransLeq(v, w)); - - gapL = v.t - u.t; - gapR = w.t - v.t; - - if (gapL + gapR > 0) { - return (v.s - w.s) * gapL + (v.s - u.s) * gapR; - } - /* vertical line */ - return 0; - } - - - static boolean VertCCW(GLUvertex u, GLUvertex v, GLUvertex w) { - /* For almost-degenerate situations, the results are not reliable. - * Unless the floating-point arithmetic can be performed without - * rounding errors, *any* implementation will give incorrect results - * on some degenerate inputs, so the client must have some way to - * handle this situation. - */ - return (u.s * (v.t - w.t) + v.s * (w.t - u.t) + w.s * (u.t - v.t)) >= 0; - } - -/* Given parameters a,x,b,y returns the value (b*x+a*y)/(a+b), - * or (x+y)/2 if a==b==0. It requires that a,b >= 0, and enforces - * this in the rare case that one argument is slightly negative. - * The implementation is extremely stable numerically. - * In particular it guarantees that the result r satisfies - * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate - * even when a and b differ greatly in magnitude. - */ - static double Interpolate(double a, double x, double b, double y) { - a = (a < 0) ? 0 : a; - b = (b < 0) ? 0 : b; - if (a <= b) { - if (b == 0) { - return (x + y) / 2.0; - } else { - return (x + (y - x) * (a / (a + b))); - } - } else { - return (y + (x - y) * (b / (a + b))); - } - } - - static void EdgeIntersect(GLUvertex o1, GLUvertex d1, - GLUvertex o2, GLUvertex d2, - GLUvertex v) -/* Given edges (o1,d1) and (o2,d2), compute their point of intersection. - * The computed point is guaranteed to lie in the intersection of the - * bounding rectangles defined by each edge. - */ { - double z1, z2; - - /* This is certainly not the most efficient way to find the intersection - * of two line segments, but it is very numerically stable. - * - * Strategy: find the two middle vertices in the VertLeq ordering, - * and interpolate the intersection s-value from these. Then repeat - * using the TransLeq ordering to find the intersection t-value. - */ - - if (!VertLeq(o1, d1)) { - GLUvertex temp = o1; - o1 = d1; - d1 = temp; - } - if (!VertLeq(o2, d2)) { - GLUvertex temp = o2; - o2 = d2; - d2 = temp; - } - if (!VertLeq(o1, o2)) { - GLUvertex temp = o1; - o1 = o2; - o2 = temp; - temp = d1; - d1 = d2; - d2 = temp; - } - - if (!VertLeq(o2, d1)) { - /* Technically, no intersection -- do our best */ - v.s = (o2.s + d1.s) / 2.0; - } else if (VertLeq(d1, d2)) { - /* Interpolate between o2 and d1 */ - z1 = EdgeEval(o1, o2, d1); - z2 = EdgeEval(o2, d1, d2); - if (z1 + z2 < 0) { - z1 = -z1; - z2 = -z2; - } - v.s = Interpolate(z1, o2.s, z2, d1.s); - } else { - /* Interpolate between o2 and d2 */ - z1 = EdgeSign(o1, o2, d1); - z2 = -EdgeSign(o1, d2, d1); - if (z1 + z2 < 0) { - z1 = -z1; - z2 = -z2; - } - v.s = Interpolate(z1, o2.s, z2, d2.s); - } - - /* Now repeat the process for t */ - - if (!TransLeq(o1, d1)) { - GLUvertex temp = o1; - o1 = d1; - d1 = temp; - } - if (!TransLeq(o2, d2)) { - GLUvertex temp = o2; - o2 = d2; - d2 = temp; - } - if (!TransLeq(o1, o2)) { - GLUvertex temp = o2; - o2 = o1; - o1 = temp; - temp = d2; - d2 = d1; - d1 = temp; - } - - if (!TransLeq(o2, d1)) { - /* Technically, no intersection -- do our best */ - v.t = (o2.t + d1.t) / 2.0; - } else if (TransLeq(d1, d2)) { - /* Interpolate between o2 and d1 */ - z1 = TransEval(o1, o2, d1); - z2 = TransEval(o2, d1, d2); - if (z1 + z2 < 0) { - z1 = -z1; - z2 = -z2; - } - v.t = Interpolate(z1, o2.t, z2, d1.t); - } else { - /* Interpolate between o2 and d2 */ - z1 = TransSign(o1, o2, d1); - z2 = -TransSign(o1, d2, d1); - if (z1 + z2 < 0) { - z1 = -z1; - z2 = -z2; - } - v.t = Interpolate(z1, o2.t, z2, d2.t); - } - } - - static boolean VertEq(GLUvertex u, GLUvertex v) { - return u.s == v.s && u.t == v.t; - } - - static boolean VertLeq(GLUvertex u, GLUvertex v) { - return u.s < v.s || (u.s == v.s && u.t <= v.t); - } - -/* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ - - static boolean TransLeq(GLUvertex u, GLUvertex v) { - return u.t < v.t || (u.t == v.t && u.s <= v.s); - } - - static boolean EdgeGoesLeft(GLUhalfEdge e) { - return VertLeq(e.Sym.Org, e.Org); - } - - static boolean EdgeGoesRight(GLUhalfEdge e) { - return VertLeq(e.Org, e.Sym.Org); - } - - static double VertL1dist(GLUvertex u, GLUvertex v) { - return Math.abs(u.s - v.s) + Math.abs(u.t - v.t); - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/Mesh.java b/src/net/java/games/jogl/impl/tesselator/Mesh.java deleted file mode 100644 index 4eee1f8ac..000000000 --- a/src/net/java/games/jogl/impl/tesselator/Mesh.java +++ /dev/null @@ -1,724 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -class Mesh { - private Mesh() { - } - - /************************ Utility Routines ************************/ -/* MakeEdge creates a new pair of half-edges which form their own loop. - * No vertex or face structures are allocated, but these must be assigned - * before the current edge operation is completed. - */ - static net.java.games.jogl.impl.tesselator.GLUhalfEdge MakeEdge(net.java.games.jogl.impl.tesselator.GLUhalfEdge eNext) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - net.java.games.jogl.impl.tesselator.GLUhalfEdge eSym; - net.java.games.jogl.impl.tesselator.GLUhalfEdge ePrev; - -// EdgePair * pair = (EdgePair *) -// memAlloc(sizeof(EdgePair)); -// if (pair == NULL) return NULL; -// -// e = &pair - > e; - e = new net.java.games.jogl.impl.tesselator.GLUhalfEdge(true); -// eSym = &pair - > eSym; - eSym = new net.java.games.jogl.impl.tesselator.GLUhalfEdge(false); - - - /* Make sure eNext points to the first edge of the edge pair */ - if (!eNext.first) { - eNext = eNext.Sym; - } - - /* Insert in circular doubly-linked list before eNext. - * Note that the prev pointer is stored in Sym->next. - */ - ePrev = eNext.Sym.next; - eSym.next = ePrev; - ePrev.Sym.next = e; - e.next = eNext; - eNext.Sym.next = eSym; - - e.Sym = eSym; - e.Onext = e; - e.Lnext = eSym; - e.Org = null; - e.Lface = null; - e.winding = 0; - e.activeRegion = null; - - eSym.Sym = e; - eSym.Onext = eSym; - eSym.Lnext = e; - eSym.Org = null; - eSym.Lface = null; - eSym.winding = 0; - eSym.activeRegion = null; - - return e; - } - -/* Splice( a, b ) is best described by the Guibas/Stolfi paper or the - * CS348a notes (see mesh.h). Basically it modifies the mesh so that - * a->Onext and b->Onext are exchanged. This can have various effects - * depending on whether a and b belong to different face or vertex rings. - * For more explanation see __gl_meshSplice() below. - */ - static void Splice(net.java.games.jogl.impl.tesselator.GLUhalfEdge a, net.java.games.jogl.impl.tesselator.GLUhalfEdge b) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge aOnext = a.Onext; - net.java.games.jogl.impl.tesselator.GLUhalfEdge bOnext = b.Onext; - - aOnext.Sym.Lnext = b; - bOnext.Sym.Lnext = a; - a.Onext = bOnext; - b.Onext = aOnext; - } - -/* MakeVertex( newVertex, eOrig, vNext ) attaches a new vertex and makes it the - * origin of all edges in the vertex loop to which eOrig belongs. "vNext" gives - * a place to insert the new vertex in the global vertex list. We insert - * the new vertex *before* vNext so that algorithms which walk the vertex - * list will not see the newly created vertices. - */ - static void MakeVertex(net.java.games.jogl.impl.tesselator.GLUvertex newVertex, - net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrig, net.java.games.jogl.impl.tesselator.GLUvertex vNext) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - net.java.games.jogl.impl.tesselator.GLUvertex vPrev; - net.java.games.jogl.impl.tesselator.GLUvertex vNew = newVertex; - - assert (vNew != null); - - /* insert in circular doubly-linked list before vNext */ - vPrev = vNext.prev; - vNew.prev = vPrev; - vPrev.next = vNew; - vNew.next = vNext; - vNext.prev = vNew; - - vNew.anEdge = eOrig; - vNew.data = null; - /* leave coords, s, t undefined */ - - /* fix other edges on this vertex loop */ - e = eOrig; - do { - e.Org = vNew; - e = e.Onext; - } while (e != eOrig); - } - -/* MakeFace( newFace, eOrig, fNext ) attaches a new face and makes it the left - * face of all edges in the face loop to which eOrig belongs. "fNext" gives - * a place to insert the new face in the global face list. We insert - * the new face *before* fNext so that algorithms which walk the face - * list will not see the newly created faces. - */ - static void MakeFace(net.java.games.jogl.impl.tesselator.GLUface newFace, net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrig, net.java.games.jogl.impl.tesselator.GLUface fNext) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - net.java.games.jogl.impl.tesselator.GLUface fPrev; - net.java.games.jogl.impl.tesselator.GLUface fNew = newFace; - - assert (fNew != null); - - /* insert in circular doubly-linked list before fNext */ - fPrev = fNext.prev; - fNew.prev = fPrev; - fPrev.next = fNew; - fNew.next = fNext; - fNext.prev = fNew; - - fNew.anEdge = eOrig; - fNew.data = null; - fNew.trail = null; - fNew.marked = false; - - /* The new face is marked "inside" if the old one was. This is a - * convenience for the common case where a face has been split in two. - */ - fNew.inside = fNext.inside; - - /* fix other edges on this face loop */ - e = eOrig; - do { - e.Lface = fNew; - e = e.Lnext; - } while (e != eOrig); - } - -/* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym), - * and removes from the global edge list. - */ - static void KillEdge(net.java.games.jogl.impl.tesselator.GLUhalfEdge eDel) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge ePrev, eNext; - - /* Half-edges are allocated in pairs, see EdgePair above */ - if (!eDel.first) { - eDel = eDel.Sym; - } - - /* delete from circular doubly-linked list */ - eNext = eDel.next; - ePrev = eDel.Sym.next; - eNext.Sym.next = ePrev; - ePrev.Sym.next = eNext; - } - - -/* KillVertex( vDel ) destroys a vertex and removes it from the global - * vertex list. It updates the vertex loop to point to a given new vertex. - */ - static void KillVertex(net.java.games.jogl.impl.tesselator.GLUvertex vDel, net.java.games.jogl.impl.tesselator.GLUvertex newOrg) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge e, eStart = vDel.anEdge; - net.java.games.jogl.impl.tesselator.GLUvertex vPrev, vNext; - - /* change the origin of all affected edges */ - e = eStart; - do { - e.Org = newOrg; - e = e.Onext; - } while (e != eStart); - - /* delete from circular doubly-linked list */ - vPrev = vDel.prev; - vNext = vDel.next; - vNext.prev = vPrev; - vPrev.next = vNext; - } - -/* KillFace( fDel ) destroys a face and removes it from the global face - * list. It updates the face loop to point to a given new face. - */ - static void KillFace(net.java.games.jogl.impl.tesselator.GLUface fDel, net.java.games.jogl.impl.tesselator.GLUface newLface) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge e, eStart = fDel.anEdge; - net.java.games.jogl.impl.tesselator.GLUface fPrev, fNext; - - /* change the left face of all affected edges */ - e = eStart; - do { - e.Lface = newLface; - e = e.Lnext; - } while (e != eStart); - - /* delete from circular doubly-linked list */ - fPrev = fDel.prev; - fNext = fDel.next; - fNext.prev = fPrev; - fPrev.next = fNext; - } - - - /****************** Basic Edge Operations **********************/ - -/* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). - * The loop consists of the two new half-edges. - */ - public static net.java.games.jogl.impl.tesselator.GLUhalfEdge __gl_meshMakeEdge(net.java.games.jogl.impl.tesselator.GLUmesh mesh) { - net.java.games.jogl.impl.tesselator.GLUvertex newVertex1 = new net.java.games.jogl.impl.tesselator.GLUvertex(); - net.java.games.jogl.impl.tesselator.GLUvertex newVertex2 = new net.java.games.jogl.impl.tesselator.GLUvertex(); - net.java.games.jogl.impl.tesselator.GLUface newFace = new net.java.games.jogl.impl.tesselator.GLUface(); - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - - e = MakeEdge(mesh.eHead); - if (e == null) return null; - - MakeVertex(newVertex1, e, mesh.vHead); - MakeVertex(newVertex2, e.Sym, mesh.vHead); - MakeFace(newFace, e, mesh.fHead); - return e; - } - - -/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the - * mesh connectivity and topology. It changes the mesh so that - * eOrg->Onext <- OLD( eDst->Onext ) - * eDst->Onext <- OLD( eOrg->Onext ) - * where OLD(...) means the value before the meshSplice operation. - * - * This can have two effects on the vertex structure: - * - if eOrg->Org != eDst->Org, the two vertices are merged together - * - if eOrg->Org == eDst->Org, the origin is split into two vertices - * In both cases, eDst->Org is changed and eOrg->Org is untouched. - * - * Similarly (and independently) for the face structure, - * - if eOrg->Lface == eDst->Lface, one loop is split into two - * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one - * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. - * - * Some special cases: - * If eDst == eOrg, the operation has no effect. - * If eDst == eOrg->Lnext, the new face will have a single edge. - * If eDst == eOrg->Lprev, the old face will have a single edge. - * If eDst == eOrg->Onext, the new vertex will have a single edge. - * If eDst == eOrg->Oprev, the old vertex will have a single edge. - */ - public static boolean __gl_meshSplice(net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrg, net.java.games.jogl.impl.tesselator.GLUhalfEdge eDst) { - boolean joiningLoops = false; - boolean joiningVertices = false; - - if (eOrg == eDst) return true; - - if (eDst.Org != eOrg.Org) { - /* We are merging two disjoint vertices -- destroy eDst->Org */ - joiningVertices = true; - KillVertex(eDst.Org, eOrg.Org); - } - if (eDst.Lface != eOrg.Lface) { - /* We are connecting two disjoint loops -- destroy eDst.Lface */ - joiningLoops = true; - KillFace(eDst.Lface, eOrg.Lface); - } - - /* Change the edge structure */ - Splice(eDst, eOrg); - - if (!joiningVertices) { - net.java.games.jogl.impl.tesselator.GLUvertex newVertex = new net.java.games.jogl.impl.tesselator.GLUvertex(); - - /* We split one vertex into two -- the new vertex is eDst.Org. - * Make sure the old vertex points to a valid half-edge. - */ - MakeVertex(newVertex, eDst, eOrg.Org); - eOrg.Org.anEdge = eOrg; - } - if (!joiningLoops) { - net.java.games.jogl.impl.tesselator.GLUface newFace = new net.java.games.jogl.impl.tesselator.GLUface(); - - /* We split one loop into two -- the new loop is eDst.Lface. - * Make sure the old face points to a valid half-edge. - */ - MakeFace(newFace, eDst, eOrg.Lface); - eOrg.Lface.anEdge = eOrg; - } - - return true; - } - - -/* __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: - * if (eDel.Lface != eDel.Rface), we join two loops into one; the loop - * eDel.Lface is deleted. Otherwise, we are splitting one loop into two; - * the newly created loop will contain eDel.Dst. If the deletion of eDel - * would create isolated vertices, those are deleted as well. - * - * This function could be implemented as two calls to __gl_meshSplice - * plus a few calls to memFree, but this would allocate and delete - * unnecessary vertices and faces. - */ - static boolean __gl_meshDelete(net.java.games.jogl.impl.tesselator.GLUhalfEdge eDel) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge eDelSym = eDel.Sym; - boolean joiningLoops = false; - - /* First step: disconnect the origin vertex eDel.Org. We make all - * changes to get a consistent mesh in this "intermediate" state. - */ - if (eDel.Lface != eDel.Sym.Lface) { - /* We are joining two loops into one -- remove the left face */ - joiningLoops = true; - KillFace(eDel.Lface, eDel.Sym.Lface); - } - - if (eDel.Onext == eDel) { - KillVertex(eDel.Org, null); - } else { - /* Make sure that eDel.Org and eDel.Sym.Lface point to valid half-edges */ - eDel.Sym.Lface.anEdge = eDel.Sym.Lnext; - eDel.Org.anEdge = eDel.Onext; - - Splice(eDel, eDel.Sym.Lnext); - if (!joiningLoops) { - net.java.games.jogl.impl.tesselator.GLUface newFace = new net.java.games.jogl.impl.tesselator.GLUface(); - - /* We are splitting one loop into two -- create a new loop for eDel. */ - MakeFace(newFace, eDel, eDel.Lface); - } - } - - /* Claim: the mesh is now in a consistent state, except that eDel.Org - * may have been deleted. Now we disconnect eDel.Dst. - */ - if (eDelSym.Onext == eDelSym) { - KillVertex(eDelSym.Org, null); - KillFace(eDelSym.Lface, null); - } else { - /* Make sure that eDel.Dst and eDel.Lface point to valid half-edges */ - eDel.Lface.anEdge = eDelSym.Sym.Lnext; - eDelSym.Org.anEdge = eDelSym.Onext; - Splice(eDelSym, eDelSym.Sym.Lnext); - } - - /* Any isolated vertices or faces have already been freed. */ - KillEdge(eDel); - - return true; - } - - - /******************** Other Edge Operations **********************/ - -/* All these routines can be implemented with the basic edge - * operations above. They are provided for convenience and efficiency. - */ - - -/* __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that - * eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex. - * eOrg and eNew will have the same left face. - */ - static net.java.games.jogl.impl.tesselator.GLUhalfEdge __gl_meshAddEdgeVertex(net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrg) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge eNewSym; - net.java.games.jogl.impl.tesselator.GLUhalfEdge eNew = MakeEdge(eOrg); - - eNewSym = eNew.Sym; - - /* Connect the new edge appropriately */ - Splice(eNew, eOrg.Lnext); - - /* Set the vertex and face information */ - eNew.Org = eOrg.Sym.Org; - { - net.java.games.jogl.impl.tesselator.GLUvertex newVertex = new net.java.games.jogl.impl.tesselator.GLUvertex(); - - MakeVertex(newVertex, eNewSym, eNew.Org); - } - eNew.Lface = eNewSym.Lface = eOrg.Lface; - - return eNew; - } - - -/* __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, - * such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org. - * eOrg and eNew will have the same left face. - */ - public static net.java.games.jogl.impl.tesselator.GLUhalfEdge __gl_meshSplitEdge(net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrg) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge eNew; - net.java.games.jogl.impl.tesselator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); - - eNew = tempHalfEdge.Sym; - - /* Disconnect eOrg from eOrg.Sym.Org and connect it to eNew.Org */ - Splice(eOrg.Sym, eOrg.Sym.Sym.Lnext); - Splice(eOrg.Sym, eNew); - - /* Set the vertex and face information */ - eOrg.Sym.Org = eNew.Org; - eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */ - eNew.Sym.Lface = eOrg.Sym.Lface; - eNew.winding = eOrg.winding; /* copy old winding information */ - eNew.Sym.winding = eOrg.Sym.winding; - - return eNew; - } - - -/* __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg.Sym.Org - * to eDst.Org, and returns the corresponding half-edge eNew. - * If eOrg.Lface == eDst.Lface, this splits one loop into two, - * and the newly created loop is eNew.Lface. Otherwise, two disjoint - * loops are merged into one, and the loop eDst.Lface is destroyed. - * - * If (eOrg == eDst), the new face will have only two edges. - * If (eOrg.Lnext == eDst), the old face is reduced to a single edge. - * If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges. - */ - static net.java.games.jogl.impl.tesselator.GLUhalfEdge __gl_meshConnect(net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrg, net.java.games.jogl.impl.tesselator.GLUhalfEdge eDst) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge eNewSym; - boolean joiningLoops = false; - net.java.games.jogl.impl.tesselator.GLUhalfEdge eNew = MakeEdge(eOrg); - - eNewSym = eNew.Sym; - - if (eDst.Lface != eOrg.Lface) { - /* We are connecting two disjoint loops -- destroy eDst.Lface */ - joiningLoops = true; - KillFace(eDst.Lface, eOrg.Lface); - } - - /* Connect the new edge appropriately */ - Splice(eNew, eOrg.Lnext); - Splice(eNewSym, eDst); - - /* Set the vertex and face information */ - eNew.Org = eOrg.Sym.Org; - eNewSym.Org = eDst.Org; - eNew.Lface = eNewSym.Lface = eOrg.Lface; - - /* Make sure the old face points to a valid half-edge */ - eOrg.Lface.anEdge = eNewSym; - - if (!joiningLoops) { - net.java.games.jogl.impl.tesselator.GLUface newFace = new net.java.games.jogl.impl.tesselator.GLUface(); - - /* We split one loop into two -- the new loop is eNew.Lface */ - MakeFace(newFace, eNew, eOrg.Lface); - } - return eNew; - } - - - /******************** Other Operations **********************/ - -/* __gl_meshZapFace( fZap ) destroys a face and removes it from the - * global face list. All edges of fZap will have a null pointer as their - * left face. Any edges which also have a null pointer as their right face - * are deleted entirely (along with any isolated vertices this produces). - * An entire mesh can be deleted by zapping its faces, one at a time, - * in any order. Zapped faces cannot be used in further mesh operations! - */ - static void __gl_meshZapFace(net.java.games.jogl.impl.tesselator.GLUface fZap) { - net.java.games.jogl.impl.tesselator.GLUhalfEdge eStart = fZap.anEdge; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e, eNext, eSym; - net.java.games.jogl.impl.tesselator.GLUface fPrev, fNext; - - /* walk around face, deleting edges whose right face is also null */ - eNext = eStart.Lnext; - do { - e = eNext; - eNext = e.Lnext; - - e.Lface = null; - if (e.Sym.Lface == null) { - /* delete the edge -- see __gl_MeshDelete above */ - - if (e.Onext == e) { - KillVertex(e.Org, null); - } else { - /* Make sure that e.Org points to a valid half-edge */ - e.Org.anEdge = e.Onext; - Splice(e, e.Sym.Lnext); - } - eSym = e.Sym; - if (eSym.Onext == eSym) { - KillVertex(eSym.Org, null); - } else { - /* Make sure that eSym.Org points to a valid half-edge */ - eSym.Org.anEdge = eSym.Onext; - Splice(eSym, eSym.Sym.Lnext); - } - KillEdge(e); - } - } while (e != eStart); - - /* delete from circular doubly-linked list */ - fPrev = fZap.prev; - fNext = fZap.next; - fNext.prev = fPrev; - fPrev.next = fNext; - } - - -/* __gl_meshNewMesh() creates a new mesh with no edges, no vertices, - * and no loops (what we usually call a "face"). - */ - public static net.java.games.jogl.impl.tesselator.GLUmesh __gl_meshNewMesh() { - net.java.games.jogl.impl.tesselator.GLUvertex v; - net.java.games.jogl.impl.tesselator.GLUface f; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - net.java.games.jogl.impl.tesselator.GLUhalfEdge eSym; - net.java.games.jogl.impl.tesselator.GLUmesh mesh = new net.java.games.jogl.impl.tesselator.GLUmesh(); - - v = mesh.vHead; - f = mesh.fHead; - e = mesh.eHead; - eSym = mesh.eHeadSym; - - v.next = v.prev = v; - v.anEdge = null; - v.data = null; - - f.next = f.prev = f; - f.anEdge = null; - f.data = null; - f.trail = null; - f.marked = false; - f.inside = false; - - e.next = e; - e.Sym = eSym; - e.Onext = null; - e.Lnext = null; - e.Org = null; - e.Lface = null; - e.winding = 0; - e.activeRegion = null; - - eSym.next = eSym; - eSym.Sym = e; - eSym.Onext = null; - eSym.Lnext = null; - eSym.Org = null; - eSym.Lface = null; - eSym.winding = 0; - eSym.activeRegion = null; - - return mesh; - } - - -/* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in - * both meshes, and returns the new mesh (the old meshes are destroyed). - */ - static net.java.games.jogl.impl.tesselator.GLUmesh __gl_meshUnion(net.java.games.jogl.impl.tesselator.GLUmesh mesh1, net.java.games.jogl.impl.tesselator.GLUmesh mesh2) { - net.java.games.jogl.impl.tesselator.GLUface f1 = mesh1.fHead; - net.java.games.jogl.impl.tesselator.GLUvertex v1 = mesh1.vHead; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e1 = mesh1.eHead; - net.java.games.jogl.impl.tesselator.GLUface f2 = mesh2.fHead; - net.java.games.jogl.impl.tesselator.GLUvertex v2 = mesh2.vHead; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e2 = mesh2.eHead; - - /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ - if (f2.next != f2) { - f1.prev.next = f2.next; - f2.next.prev = f1.prev; - f2.prev.next = f1; - f1.prev = f2.prev; - } - - if (v2.next != v2) { - v1.prev.next = v2.next; - v2.next.prev = v1.prev; - v2.prev.next = v1; - v1.prev = v2.prev; - } - - if (e2.next != e2) { - e1.Sym.next.Sym.next = e2.next; - e2.next.Sym.next = e1.Sym.next; - e2.Sym.next.Sym.next = e1; - e1.Sym.next = e2.Sym.next; - } - - return mesh1; - } - - -/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. - */ - static void __gl_meshDeleteMeshZap(net.java.games.jogl.impl.tesselator.GLUmesh mesh) { - net.java.games.jogl.impl.tesselator.GLUface fHead = mesh.fHead; - - while (fHead.next != fHead) { - __gl_meshZapFace(fHead.next); - } - assert (mesh.vHead.next == mesh.vHead); - } - -/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. - */ - public static void __gl_meshDeleteMesh(net.java.games.jogl.impl.tesselator.GLUmesh mesh) { - net.java.games.jogl.impl.tesselator.GLUface f, fNext; - net.java.games.jogl.impl.tesselator.GLUvertex v, vNext; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e, eNext; - - for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) { - fNext = f.next; - } - - for (v = mesh.vHead.next; v != mesh.vHead; v = vNext) { - vNext = v.next; - } - - for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { - /* One call frees both e and e.Sym (see EdgePair above) */ - eNext = e.next; - } - } - -/* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. - */ - public static void __gl_meshCheckMesh(net.java.games.jogl.impl.tesselator.GLUmesh mesh) { - net.java.games.jogl.impl.tesselator.GLUface fHead = mesh.fHead; - net.java.games.jogl.impl.tesselator.GLUvertex vHead = mesh.vHead; - net.java.games.jogl.impl.tesselator.GLUhalfEdge eHead = mesh.eHead; - net.java.games.jogl.impl.tesselator.GLUface f, fPrev; - net.java.games.jogl.impl.tesselator.GLUvertex v, vPrev; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e, ePrev; - - fPrev = fHead; - for (fPrev = fHead; (f = fPrev.next) != fHead; fPrev = f) { - assert (f.prev == fPrev); - e = f.anEdge; - do { - assert (e.Sym != e); - assert (e.Sym.Sym == e); - assert (e.Lnext.Onext.Sym == e); - assert (e.Onext.Sym.Lnext == e); - assert (e.Lface == f); - e = e.Lnext; - } while (e != f.anEdge); - } - assert (f.prev == fPrev && f.anEdge == null && f.data == null); - - vPrev = vHead; - for (vPrev = vHead; (v = vPrev.next) != vHead; vPrev = v) { - assert (v.prev == vPrev); - e = v.anEdge; - do { - assert (e.Sym != e); - assert (e.Sym.Sym == e); - assert (e.Lnext.Onext.Sym == e); - assert (e.Onext.Sym.Lnext == e); - assert (e.Org == v); - e = e.Onext; - } while (e != v.anEdge); - } - assert (v.prev == vPrev && v.anEdge == null && v.data == null); - - ePrev = eHead; - for (ePrev = eHead; (e = ePrev.next) != eHead; ePrev = e) { - assert (e.Sym.next == ePrev.Sym); - assert (e.Sym != e); - assert (e.Sym.Sym == e); - assert (e.Org != null); - assert (e.Sym.Org != null); - assert (e.Lnext.Onext.Sym == e); - assert (e.Onext.Sym.Lnext == e); - } - assert (e.Sym.next == ePrev.Sym - && e.Sym == mesh.eHeadSym - && e.Sym.Sym == e - && e.Org == null && e.Sym.Org == null - && e.Lface == null && e.Sym.Lface == null); - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/Normal.java b/src/net/java/games/jogl/impl/tesselator/Normal.java deleted file mode 100644 index 900219662..000000000 --- a/src/net/java/games/jogl/impl/tesselator/Normal.java +++ /dev/null @@ -1,277 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -import net.java.games.jogl.*; - -class Normal { - private Normal() { - } - - static boolean SLANTED_SWEEP = false; - static double S_UNIT_X; /* Pre-normalized */ - static double S_UNIT_Y; - private static final boolean TRUE_PROJECT = false; - - static { - if (SLANTED_SWEEP) { -/* The "feature merging" is not intended to be complete. There are - * special cases where edges are nearly parallel to the sweep line - * which are not implemented. The algorithm should still behave - * robustly (ie. produce a reasonable tesselation) in the presence - * of such edges, however it may miss features which could have been - * merged. We could minimize this effect by choosing the sweep line - * direction to be something unusual (ie. not parallel to one of the - * coordinate axes). - */ - S_UNIT_X = 0.50941539564955385; /* Pre-normalized */ - S_UNIT_Y = 0.86052074622010633; - } else { - S_UNIT_X = 1.0; - S_UNIT_Y = 0.0; - } - } - - private static double Dot(double[] u, double[] v) { - return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]); - } - - static void Normalize(double[] v) { - double len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; - - assert (len > 0); - len = Math.sqrt(len); - v[0] /= len; - v[1] /= len; - v[2] /= len; - } - - static int LongAxis(double[] v) { - int i = 0; - - if (Math.abs(v[1]) > Math.abs(v[0])) { - i = 1; - } - if (Math.abs(v[2]) > Math.abs(v[i])) { - i = 2; - } - return i; - } - - static void ComputeNormal(GLUtesselatorImpl tess, double[] norm) { - net.java.games.jogl.impl.tesselator.GLUvertex v, v1, v2; - double c, tLen2, maxLen2; - double[] maxVal, minVal, d1, d2, tNorm; - net.java.games.jogl.impl.tesselator.GLUvertex[] maxVert, minVert; - net.java.games.jogl.impl.tesselator.GLUvertex vHead = tess.mesh.vHead; - int i; - - maxVal = new double[3]; - minVal = new double[3]; - minVert = new net.java.games.jogl.impl.tesselator.GLUvertex[3]; - maxVert = new net.java.games.jogl.impl.tesselator.GLUvertex[3]; - d1 = new double[3]; - d2 = new double[3]; - tNorm = new double[3]; - - maxVal[0] = maxVal[1] = maxVal[2] = -2 * GLU.GLU_TESS_MAX_COORD; - minVal[0] = minVal[1] = minVal[2] = 2 * GLU.GLU_TESS_MAX_COORD; - - for (v = vHead.next; v != vHead; v = v.next) { - for (i = 0; i < 3; ++i) { - c = v.coords[i]; - if (c < minVal[i]) { - minVal[i] = c; - minVert[i] = v; - } - if (c > maxVal[i]) { - maxVal[i] = c; - maxVert[i] = v; - } - } - } - -/* Find two vertices separated by at least 1/sqrt(3) of the maximum - * distance between any two vertices - */ - i = 0; - if (maxVal[1] - minVal[1] > maxVal[0] - minVal[0]) { - i = 1; - } - if (maxVal[2] - minVal[2] > maxVal[i] - minVal[i]) { - i = 2; - } - if (minVal[i] >= maxVal[i]) { -/* All vertices are the same -- normal doesn't matter */ - norm[0] = 0; - norm[1] = 0; - norm[2] = 1; - return; - } - -/* Look for a third vertex which forms the triangle with maximum area - * (Length of normal == twice the triangle area) - */ - maxLen2 = 0; - v1 = minVert[i]; - v2 = maxVert[i]; - d1[0] = v1.coords[0] - v2.coords[0]; - d1[1] = v1.coords[1] - v2.coords[1]; - d1[2] = v1.coords[2] - v2.coords[2]; - for (v = vHead.next; v != vHead; v = v.next) { - d2[0] = v.coords[0] - v2.coords[0]; - d2[1] = v.coords[1] - v2.coords[1]; - d2[2] = v.coords[2] - v2.coords[2]; - tNorm[0] = d1[1] * d2[2] - d1[2] * d2[1]; - tNorm[1] = d1[2] * d2[0] - d1[0] * d2[2]; - tNorm[2] = d1[0] * d2[1] - d1[1] * d2[0]; - tLen2 = tNorm[0] * tNorm[0] + tNorm[1] * tNorm[1] + tNorm[2] * tNorm[2]; - if (tLen2 > maxLen2) { - maxLen2 = tLen2; - norm[0] = tNorm[0]; - norm[1] = tNorm[1]; - norm[2] = tNorm[2]; - } - } - - if (maxLen2 <= 0) { -/* All points lie on a single line -- any decent normal will do */ - norm[0] = norm[1] = norm[2] = 0; - norm[LongAxis(d1)] = 1; - } - } - - static void CheckOrientation(GLUtesselatorImpl tess) { - double area; - net.java.games.jogl.impl.tesselator.GLUface f, fHead = tess.mesh.fHead; - net.java.games.jogl.impl.tesselator.GLUvertex v, vHead = tess.mesh.vHead; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - -/* When we compute the normal automatically, we choose the orientation - * so that the the sum of the signed areas of all contours is non-negative. - */ - area = 0; - for (f = fHead.next; f != fHead; f = f.next) { - e = f.anEdge; - if (e.winding <= 0) continue; - do { - area += (e.Org.s - e.Sym.Org.s) * (e.Org.t + e.Sym.Org.t); - e = e.Lnext; - } while (e != f.anEdge); - } - if (area < 0) { -/* Reverse the orientation by flipping all the t-coordinates */ - for (v = vHead.next; v != vHead; v = v.next) { - v.t = -v.t; - } - tess.tUnit[0] = -tess.tUnit[0]; - tess.tUnit[1] = -tess.tUnit[1]; - tess.tUnit[2] = -tess.tUnit[2]; - } - } - -/* Determine the polygon normal and project vertices onto the plane - * of the polygon. - */ - public static void __gl_projectPolygon(GLUtesselatorImpl tess) { - net.java.games.jogl.impl.tesselator.GLUvertex v, vHead = tess.mesh.vHead; - double w; - double[] norm = new double[3]; - double[] sUnit, tUnit; - int i; - boolean computedNormal = false; - - norm[0] = tess.normal[0]; - norm[1] = tess.normal[1]; - norm[2] = tess.normal[2]; - if (norm[0] == 0 && norm[1] == 0 && norm[2] == 0) { - ComputeNormal(tess, norm); - computedNormal = true; - } - sUnit = tess.sUnit; - tUnit = tess.tUnit; - i = LongAxis(norm); - - if (TRUE_PROJECT) { -/* Choose the initial sUnit vector to be approximately perpendicular - * to the normal. - */ - Normalize(norm); - - sUnit[i] = 0; - sUnit[(i + 1) % 3] = S_UNIT_X; - sUnit[(i + 2) % 3] = S_UNIT_Y; - -/* Now make it exactly perpendicular */ - w = Dot(sUnit, norm); - sUnit[0] -= w * norm[0]; - sUnit[1] -= w * norm[1]; - sUnit[2] -= w * norm[2]; - Normalize(sUnit); - -/* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */ - tUnit[0] = norm[1] * sUnit[2] - norm[2] * sUnit[1]; - tUnit[1] = norm[2] * sUnit[0] - norm[0] * sUnit[2]; - tUnit[2] = norm[0] * sUnit[1] - norm[1] * sUnit[0]; - Normalize(tUnit); - } else { -/* Project perpendicular to a coordinate axis -- better numerically */ - sUnit[i] = 0; - sUnit[(i + 1) % 3] = S_UNIT_X; - sUnit[(i + 2) % 3] = S_UNIT_Y; - - tUnit[i] = 0; - tUnit[(i + 1) % 3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y; - tUnit[(i + 2) % 3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X; - } - -/* Project the vertices onto the sweep plane */ - for (v = vHead.next; v != vHead; v = v.next) { - v.s = Dot(v.coords, sUnit); - v.t = Dot(v.coords, tUnit); - } - if (computedNormal) { - CheckOrientation(tess); - } - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/PriorityQ.java b/src/net/java/games/jogl/impl/tesselator/PriorityQ.java deleted file mode 100644 index 0f92dcecd..000000000 --- a/src/net/java/games/jogl/impl/tesselator/PriorityQ.java +++ /dev/null @@ -1,90 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -abstract class PriorityQ { - public static final int INIT_SIZE = 32; - - public static class PQnode { - int handle; - } - - public static class PQhandleElem { - Object key; - int node; - } - - public static interface Leq { - boolean leq(Object key1, Object key2); - } - - // #ifdef FOR_TRITE_TEST_PROGRAM -// private static boolean LEQ(PriorityQCommon.Leq leq, Object x,Object y) { -// return pq.leq.leq(x,y); -// } -// #else -/* Violates modularity, but a little faster */ -// #include "geom.h" - public static boolean LEQ(Leq leq, Object x, Object y) { - return net.java.games.jogl.impl.tesselator.Geom.VertLeq((net.java.games.jogl.impl.tesselator.GLUvertex) x, (net.java.games.jogl.impl.tesselator.GLUvertex) y); - } - - static PriorityQ pqNewPriorityQ(Leq leq) { - return new PriorityQSort(leq); - } - - abstract void pqDeletePriorityQ(); - - abstract boolean pqInit(); - - abstract int pqInsert(Object keyNew); - - abstract Object pqExtractMin(); - - abstract void pqDelete(int hCurr); - - abstract Object pqMinimum(); - - abstract boolean pqIsEmpty(); -// #endif -} diff --git a/src/net/java/games/jogl/impl/tesselator/PriorityQHeap.java b/src/net/java/games/jogl/impl/tesselator/PriorityQHeap.java deleted file mode 100644 index b360e37d3..000000000 --- a/src/net/java/games/jogl/impl/tesselator/PriorityQHeap.java +++ /dev/null @@ -1,254 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - - - -class PriorityQHeap extends net.java.games.jogl.impl.tesselator.PriorityQ { - net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[] nodes; - net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[] handles; - int size, max; - int freeList; - boolean initialized; - net.java.games.jogl.impl.tesselator.PriorityQ.Leq leq; - -/* really __gl_pqHeapNewPriorityQ */ - public PriorityQHeap(net.java.games.jogl.impl.tesselator.PriorityQ.Leq leq) { - size = 0; - max = net.java.games.jogl.impl.tesselator.PriorityQ.INIT_SIZE; - nodes = new net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[net.java.games.jogl.impl.tesselator.PriorityQ.INIT_SIZE + 1]; - for (int i = 0; i < nodes.length; i++) { - nodes[i] = new PQnode(); - } - handles = new net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[net.java.games.jogl.impl.tesselator.PriorityQ.INIT_SIZE + 1]; - for (int i = 0; i < handles.length; i++) { - handles[i] = new PQhandleElem(); - } - initialized = false; - freeList = 0; - this.leq = leq; - - nodes[1].handle = 1; /* so that Minimum() returns NULL */ - handles[1].key = null; - } - -/* really __gl_pqHeapDeletePriorityQ */ - void pqDeletePriorityQ() { - handles = null; - nodes = null; - } - - void FloatDown(int curr) { - net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[] n = nodes; - net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[] h = handles; - int hCurr, hChild; - int child; - - hCurr = n[curr].handle; - for (; ;) { - child = curr << 1; - if (child < size && LEQ(leq, h[n[child + 1].handle].key, - h[n[child].handle].key)) { - ++child; - } - - assert (child <= max); - - hChild = n[child].handle; - if (child > size || LEQ(leq, h[hCurr].key, h[hChild].key)) { - n[curr].handle = hCurr; - h[hCurr].node = curr; - break; - } - n[curr].handle = hChild; - h[hChild].node = curr; - curr = child; - } - } - - - void FloatUp(int curr) { - net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[] n = nodes; - net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[] h = handles; - int hCurr, hParent; - int parent; - - hCurr = n[curr].handle; - for (; ;) { - parent = curr >> 1; - hParent = n[parent].handle; - if (parent == 0 || LEQ(leq, h[hParent].key, h[hCurr].key)) { - n[curr].handle = hCurr; - h[hCurr].node = curr; - break; - } - n[curr].handle = hParent; - h[hParent].node = curr; - curr = parent; - } - } - -/* really __gl_pqHeapInit */ - boolean pqInit() { - int i; - - /* This method of building a heap is O(n), rather than O(n lg n). */ - - for (i = size; i >= 1; --i) { - FloatDown(i); - } - initialized = true; - - return true; - } - -/* really __gl_pqHeapInsert */ -/* returns LONG_MAX iff out of memory */ - int pqInsert(Object keyNew) { - int curr; - int free; - - curr = ++size; - if ((curr * 2) > max) { - net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[] saveNodes = nodes; - net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[] saveHandles = handles; - - /* If the heap overflows, double its size. */ - max <<= 1; -// pq->nodes = (PQnode *)memRealloc( pq->nodes, (size_t) ((pq->max + 1) * sizeof( pq->nodes[0] ))); - PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; - System.arraycopy( nodes, 0, pqNodes, 0, nodes.length ); - for (int i = nodes.length; i < pqNodes.length; i++) { - pqNodes[i] = new PQnode(); - } - nodes = pqNodes; - if (nodes == null) { - nodes = saveNodes; /* restore ptr to free upon return */ - return Integer.MAX_VALUE; - } - -// pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); - PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; - System.arraycopy( handles, 0, pqHandles, 0, handles.length ); - for (int i = handles.length; i < pqHandles.length; i++) { - pqHandles[i] = new PQhandleElem(); - } - handles = pqHandles; - if (handles == null) { - handles = saveHandles; /* restore ptr to free upon return */ - return Integer.MAX_VALUE; - } - } - - if (freeList == 0) { - free = curr; - } else { - free = freeList; - freeList = handles[free].node; - } - - nodes[curr].handle = free; - handles[free].node = curr; - handles[free].key = keyNew; - - if (initialized) { - FloatUp(curr); - } - assert (free != Integer.MAX_VALUE); - return free; - } - -/* really __gl_pqHeapExtractMin */ - Object pqExtractMin() { - net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[] n = nodes; - net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[] h = handles; - int hMin = n[1].handle; - Object min = h[hMin].key; - - if (size > 0) { - n[1].handle = n[size].handle; - h[n[1].handle].node = 1; - - h[hMin].key = null; - h[hMin].node = freeList; - freeList = hMin; - - if (--size > 0) { - FloatDown(1); - } - } - return min; - } - -/* really __gl_pqHeapDelete */ - void pqDelete(int hCurr) { - net.java.games.jogl.impl.tesselator.PriorityQ.PQnode[] n = nodes; - net.java.games.jogl.impl.tesselator.PriorityQ.PQhandleElem[] h = handles; - int curr; - - assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null); - - curr = h[hCurr].node; - n[curr].handle = n[size].handle; - h[n[curr].handle].node = curr; - - if (curr <= --size) { - if (curr <= 1 || LEQ(leq, h[n[curr >> 1].handle].key, h[n[curr].handle].key)) { - FloatDown(curr); - } else { - FloatUp(curr); - } - } - h[hCurr].key = null; - h[hCurr].node = freeList; - freeList = hCurr; - } - - Object pqMinimum() { - return handles[nodes[1].handle].key; - } - - boolean pqIsEmpty() { - return size == 0; - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/PriorityQSort.java b/src/net/java/games/jogl/impl/tesselator/PriorityQSort.java deleted file mode 100644 index d37580ff2..000000000 --- a/src/net/java/games/jogl/impl/tesselator/PriorityQSort.java +++ /dev/null @@ -1,270 +0,0 @@ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - - - -class PriorityQSort extends net.java.games.jogl.impl.tesselator.PriorityQ { - net.java.games.jogl.impl.tesselator.PriorityQHeap heap; - Object[] keys; - - // JAVA: 'order' contains indices into the keys array. - // This simulates the indirect pointers used in the original C code - // (from Frank Suykens, Luciad.com). - int[] order; - int size, max; - boolean initialized; - net.java.games.jogl.impl.tesselator.PriorityQ.Leq leq; - - public PriorityQSort(net.java.games.jogl.impl.tesselator.PriorityQ.Leq leq) { - heap = new net.java.games.jogl.impl.tesselator.PriorityQHeap(leq); - - keys = new Object[net.java.games.jogl.impl.tesselator.PriorityQ.INIT_SIZE]; - - size = 0; - max = net.java.games.jogl.impl.tesselator.PriorityQ.INIT_SIZE; - initialized = false; - this.leq = leq; - } - -/* really __gl_pqSortDeletePriorityQ */ - void pqDeletePriorityQ() { - if (heap != null) heap.pqDeletePriorityQ(); - order = null; - keys = null; - } - - private static boolean LT(net.java.games.jogl.impl.tesselator.PriorityQ.Leq leq, Object x, Object y) { - return (!net.java.games.jogl.impl.tesselator.PriorityQHeap.LEQ(leq, y, x)); - } - - private static boolean GT(net.java.games.jogl.impl.tesselator.PriorityQ.Leq leq, Object x, Object y) { - return (!net.java.games.jogl.impl.tesselator.PriorityQHeap.LEQ(leq, x, y)); - } - - private static void Swap(int[] array, int a, int b) { - if (true) { - int tmp = array[a]; - array[a] = array[b]; - array[b] = tmp; - } else { - - } - } - - private static class Stack { - int p, r; - } - -/* really __gl_pqSortInit */ - boolean pqInit() { - int p, r, i, j; - int piv; - Stack[] stack = new Stack[50]; - for (int k = 0; k < stack.length; k++) { - stack[k] = new Stack(); - } - int top = 0; - - int seed = 2016473283; - - /* Create an array of indirect pointers to the keys, so that we - * the handles we have returned are still valid. - */ - order = new int[size + 1]; -/* the previous line is a patch to compensate for the fact that IBM */ -/* machines return a null on a malloc of zero bytes (unlike SGI), */ -/* so we have to put in this defense to guard against a memory */ -/* fault four lines down. from fossum@austin.ibm.com. */ - p = 0; - r = size - 1; - for (piv = 0, i = p; i <= r; ++piv, ++i) { - // indirect pointers: keep an index into the keys array, not a direct pointer to its contents - order[i] = piv; - } - - /* Sort the indirect pointers in descending order, - * using randomized Quicksort - */ - stack[top].p = p; - stack[top].r = r; - ++top; - while (--top >= 0) { - p = stack[top].p; - r = stack[top].r; - while (r > p + 10) { - seed = Math.abs( seed * 1539415821 + 1 ); - i = p + seed % (r - p + 1); - piv = order[i]; - order[i] = order[p]; - order[p] = piv; - i = p - 1; - j = r + 1; - do { - do { - ++i; - } while (GT(leq, keys[order[i]], keys[piv])); - do { - --j; - } while (LT(leq, keys[order[j]], keys[piv])); - Swap(order, i, j); - } while (i < j); - Swap(order, i, j); /* Undo last swap */ - if (i - p < r - j) { - stack[top].p = j + 1; - stack[top].r = r; - ++top; - r = i - 1; - } else { - stack[top].p = p; - stack[top].r = i - 1; - ++top; - p = j + 1; - } - } - /* Insertion sort small lists */ - for (i = p + 1; i <= r; ++i) { - piv = order[i]; - for (j = i; j > p && LT(leq, keys[order[j - 1]], keys[piv]); --j) { - order[j] = order[j - 1]; - } - order[j] = piv; - } - } - max = size; - initialized = true; - heap.pqInit(); /* always succeeds */ - -/* #ifndef NDEBUG - p = order; - r = p + size - 1; - for (i = p; i < r; ++i) { - Assertion.doAssert(LEQ( * * (i + 1), **i )); - } - #endif*/ - - return true; - } - -/* really __gl_pqSortInsert */ -/* returns LONG_MAX iff out of memory */ - int pqInsert(Object keyNew) { - int curr; - - if (initialized) { - return heap.pqInsert(keyNew); - } - curr = size; - if (++size >= max) { - Object[] saveKey = keys; - - /* If the heap overflows, double its size. */ - max <<= 1; -// pq->keys = (PQHeapKey *)memRealloc( pq->keys,(size_t)(pq->max * sizeof( pq->keys[0] ))); - Object[] pqKeys = new Object[max]; - System.arraycopy( keys, 0, pqKeys, 0, keys.length ); - keys = pqKeys; - if (keys == null) { - keys = saveKey; /* restore ptr to free upon return */ - return Integer.MAX_VALUE; - } - } - assert curr != Integer.MAX_VALUE; - keys[curr] = keyNew; - - /* Negative handles index the sorted array. */ - return -(curr + 1); - } - -/* really __gl_pqSortExtractMin */ - Object pqExtractMin() { - Object sortMin, heapMin; - - if (size == 0) { - return heap.pqExtractMin(); - } - sortMin = keys[order[size - 1]]; - if (!heap.pqIsEmpty()) { - heapMin = heap.pqMinimum(); - if (LEQ(leq, heapMin, sortMin)) { - return heap.pqExtractMin(); - } - } - do { - --size; - } while (size > 0 && keys[order[size - 1]] == null); - return sortMin; - } - -/* really __gl_pqSortMinimum */ - Object pqMinimum() { - Object sortMin, heapMin; - - if (size == 0) { - return heap.pqMinimum(); - } - sortMin = keys[order[size - 1]]; - if (!heap.pqIsEmpty()) { - heapMin = heap.pqMinimum(); - if (net.java.games.jogl.impl.tesselator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) { - return heapMin; - } - } - return sortMin; - } - -/* really __gl_pqSortIsEmpty */ - boolean pqIsEmpty() { - return (size == 0) && heap.pqIsEmpty(); - } - -/* really __gl_pqSortDelete */ - void pqDelete(int curr) { - if (curr >= 0) { - heap.pqDelete(curr); - return; - } - curr = -(curr + 1); - assert curr < max && keys[curr] != null; - - keys[curr] = null; - while (size > 0 && keys[order[size - 1]] == null) { - --size; - } - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/Render.java b/src/net/java/games/jogl/impl/tesselator/Render.java deleted file mode 100644 index 4763992b8..000000000 --- a/src/net/java/games/jogl/impl/tesselator/Render.java +++ /dev/null @@ -1,546 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -import net.java.games.jogl.*; - -class Render { - private static final boolean USE_OPTIMIZED_CODE_PATH = false; - - private Render() { - } - - private static final RenderFan renderFan = new RenderFan(); - private static final RenderStrip renderStrip = new RenderStrip(); - private static final RenderTriangle renderTriangle = new RenderTriangle(); - -/* This structure remembers the information we need about a primitive - * to be able to render it later, once we have determined which - * primitive is able to use the most triangles. - */ - private static class FaceCount { - public FaceCount() { - } - - public FaceCount(long size, net.java.games.jogl.impl.tesselator.GLUhalfEdge eStart, renderCallBack render) { - this.size = size; - this.eStart = eStart; - this.render = render; - } - - long size; /* number of triangles used */ - net.java.games.jogl.impl.tesselator.GLUhalfEdge eStart; /* edge where this primitive starts */ - renderCallBack render; - }; - - private static interface renderCallBack { - void render(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUhalfEdge e, long size); - } - - /************************ Strips and Fans decomposition ******************/ - -/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle - * fans, strips, and separate triangles. A substantial effort is made - * to use as few rendering primitives as possible (ie. to make the fans - * and strips as large as possible). - * - * The rendering output is provided as callbacks (see the api). - */ - public static void __gl_renderMesh(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUmesh mesh) { - net.java.games.jogl.impl.tesselator.GLUface f; - - /* Make a list of separate triangles so we can render them all at once */ - tess.lonelyTriList = null; - - for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { - f.marked = false; - } - for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { - - /* We examine all faces in an arbitrary order. Whenever we find - * an unprocessed face F, we output a group of faces including F - * whose size is maximum. - */ - if (f.inside && !f.marked) { - RenderMaximumFaceGroup(tess, f); - assert (f.marked); - } - } - if (tess.lonelyTriList != null) { - RenderLonelyTriangles(tess, tess.lonelyTriList); - tess.lonelyTriList = null; - } - } - - - static void RenderMaximumFaceGroup(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUface fOrig) { - /* We want to find the largest triangle fan or strip of unmarked faces - * which includes the given face fOrig. There are 3 possible fans - * passing through fOrig (one centered at each vertex), and 3 possible - * strips (one for each CCW permutation of the vertices). Our strategy - * is to try all of these, and take the primitive which uses the most - * triangles (a greedy approach). - */ - net.java.games.jogl.impl.tesselator.GLUhalfEdge e = fOrig.anEdge; - FaceCount max = new FaceCount(); - FaceCount newFace = new FaceCount(); - - max.size = 1; - max.eStart = e; - max.render = renderTriangle; - - if (!tess.flagBoundary) { - newFace = MaximumFan(e); - if (newFace.size > max.size) { - max = newFace; - } - newFace = MaximumFan(e.Lnext); - if (newFace.size > max.size) { - max = newFace; - } - newFace = MaximumFan(e.Onext.Sym); - if (newFace.size > max.size) { - max = newFace; - } - - newFace = MaximumStrip(e); - if (newFace.size > max.size) { - max = newFace; - } - newFace = MaximumStrip(e.Lnext); - if (newFace.size > max.size) { - max = newFace; - } - newFace = MaximumStrip(e.Onext.Sym); - if (newFace.size > max.size) { - max = newFace; - } - } - max.render.render(tess, max.eStart, max.size); - } - - -/* Macros which keep track of faces we have marked temporarily, and allow - * us to backtrack when necessary. With triangle fans, this is not - * really necessary, since the only awkward case is a loop of triangles - * around a single origin vertex. However with strips the situation is - * more complicated, and we need a general tracking method like the - * one here. - */ - private static boolean Marked(net.java.games.jogl.impl.tesselator.GLUface f) { - return !f.inside || f.marked; - } - - private static GLUface AddToTrail(net.java.games.jogl.impl.tesselator.GLUface f, net.java.games.jogl.impl.tesselator.GLUface t) { - f.trail = t; - f.marked = true; - return f; - } - - private static void FreeTrail(net.java.games.jogl.impl.tesselator.GLUface t) { - if (true) { - while (t != null) { - t.marked = false; - t = t.trail; - } - } else { - /* absorb trailing semicolon */ - } - } - - static FaceCount MaximumFan(net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrig) { - /* eOrig.Lface is the face we want to render. We want to find the size - * of a maximal fan around eOrig.Org. To do this we just walk around - * the origin vertex as far as possible in both directions. - */ - FaceCount newFace = new FaceCount(0, null, renderFan); - net.java.games.jogl.impl.tesselator.GLUface trail = null; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - - for (e = eOrig; !Marked(e.Lface); e = e.Onext) { - trail = AddToTrail(e.Lface, trail); - ++newFace.size; - } - for (e = eOrig; !Marked(e.Sym.Lface); e = e.Sym.Lnext) { - trail = AddToTrail(e.Sym.Lface, trail); - ++newFace.size; - } - newFace.eStart = e; - /*LINTED*/ - FreeTrail(trail); - return newFace; - } - - - private static boolean IsEven(long n) { - return (n & 0x1L) == 0; - } - - static FaceCount MaximumStrip(net.java.games.jogl.impl.tesselator.GLUhalfEdge eOrig) { - /* Here we are looking for a maximal strip that contains the vertices - * eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the - * reverse, such that all triangles are oriented CCW). - * - * Again we walk forward and backward as far as possible. However for - * strips there is a twist: to get CCW orientations, there must be - * an *even* number of triangles in the strip on one side of eOrig. - * We walk the strip starting on a side with an even number of triangles; - * if both side have an odd number, we are forced to shorten one side. - */ - FaceCount newFace = new FaceCount(0, null, renderStrip); - long headSize = 0, tailSize = 0; - net.java.games.jogl.impl.tesselator.GLUface trail = null; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e, eTail, eHead; - - for (e = eOrig; !Marked(e.Lface); ++tailSize, e = e.Onext) { - trail = AddToTrail(e.Lface, trail); - ++tailSize; - e = e.Lnext.Sym; - if (Marked(e.Lface)) break; - trail = AddToTrail(e.Lface, trail); - } - eTail = e; - - for (e = eOrig; !Marked(e.Sym.Lface); ++headSize, e = e.Sym.Onext.Sym) { - trail = AddToTrail(e.Sym.Lface, trail); - ++headSize; - e = e.Sym.Lnext; - if (Marked(e.Sym.Lface)) break; - trail = AddToTrail(e.Sym.Lface, trail); - } - eHead = e; - - newFace.size = tailSize + headSize; - if (IsEven(tailSize)) { - newFace.eStart = eTail.Sym; - } else if (IsEven(headSize)) { - newFace.eStart = eHead; - } else { - /* Both sides have odd length, we must shorten one of them. In fact, - * we must start from eHead to guarantee inclusion of eOrig.Lface. - */ - --newFace.size; - newFace.eStart = eHead.Onext; - } - /*LINTED*/ - FreeTrail(trail); - return newFace; - } - - private static class RenderTriangle implements renderCallBack { - public void render(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUhalfEdge e, long size) { - /* Just add the triangle to a triangle list, so we can render all - * the separate triangles at once. - */ - assert (size == 1); - tess.lonelyTriList = AddToTrail(e.Lface, tess.lonelyTriList); - } - } - - - static void RenderLonelyTriangles(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUface f) { - /* Now we render all the separate triangles which could not be - * grouped into a triangle fan or strip. - */ - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - int newState; - int edgeState = -1; /* force edge state output for first vertex */ - - tess.callBeginOrBeginData(GL.GL_TRIANGLES); - - for (; f != null; f = f.trail) { - /* Loop once for each edge (there will always be 3 edges) */ - - e = f.anEdge; - do { - if (tess.flagBoundary) { - /* Set the "edge state" to true just before we output the - * first vertex of each edge on the polygon boundary. - */ - newState = (!e.Sym.Lface.inside) ? 1 : 0; - if (edgeState != newState) { - edgeState = newState; - tess.callEdgeFlagOrEdgeFlagData( edgeState != 0); - } - } - tess.callVertexOrVertexData( e.Org.data); - - e = e.Lnext; - } while (e != f.anEdge); - } - tess.callEndOrEndData(); - } - - private static class RenderFan implements renderCallBack { - public void render(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUhalfEdge e, long size) { - /* Render as many CCW triangles as possible in a fan starting from - * edge "e". The fan *should* contain exactly "size" triangles - * (otherwise we've goofed up somewhere). - */ - tess.callBeginOrBeginData( GL.GL_TRIANGLE_FAN); - tess.callVertexOrVertexData( e.Org.data); - tess.callVertexOrVertexData( e.Sym.Org.data); - - while (!Marked(e.Lface)) { - e.Lface.marked = true; - --size; - e = e.Onext; - tess.callVertexOrVertexData( e.Sym.Org.data); - } - - assert (size == 0); - tess.callEndOrEndData(); - } - } - - private static class RenderStrip implements renderCallBack { - public void render(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUhalfEdge e, long size) { - /* Render as many CCW triangles as possible in a strip starting from - * edge "e". The strip *should* contain exactly "size" triangles - * (otherwise we've goofed up somewhere). - */ - tess.callBeginOrBeginData( GL.GL_TRIANGLE_STRIP); - tess.callVertexOrVertexData( e.Org.data); - tess.callVertexOrVertexData( e.Sym.Org.data); - - while (!Marked(e.Lface)) { - e.Lface.marked = true; - --size; - e = e.Lnext.Sym; - tess.callVertexOrVertexData( e.Org.data); - if (Marked(e.Lface)) break; - - e.Lface.marked = true; - --size; - e = e.Onext; - tess.callVertexOrVertexData( e.Sym.Org.data); - } - - assert (size == 0); - tess.callEndOrEndData(); - } - } - - /************************ Boundary contour decomposition ******************/ - -/* __gl_renderBoundary( tess, mesh ) takes a mesh, and outputs one - * contour for each face marked "inside". The rendering output is - * provided as callbacks (see the api). - */ - public static void __gl_renderBoundary(GLUtesselatorImpl tess, net.java.games.jogl.impl.tesselator.GLUmesh mesh) { - net.java.games.jogl.impl.tesselator.GLUface f; - net.java.games.jogl.impl.tesselator.GLUhalfEdge e; - - for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) { - if (f.inside) { - tess.callBeginOrBeginData( GL.GL_LINE_LOOP); - e = f.anEdge; - do { - tess.callVertexOrVertexData( e.Org.data); - e = e.Lnext; - } while (e != f.anEdge); - tess.callEndOrEndData(); - } - } - } - - - /************************ Quick-and-dirty decomposition ******************/ - - private static final int SIGN_INCONSISTENT = 2; - - static int ComputeNormal(GLUtesselatorImpl tess, double[] norm, boolean check) -/* - * If check==false, we compute the polygon normal and place it in norm[]. - * If check==true, we check that each triangle in the fan from v0 has a - * consistent orientation with respect to norm[]. If triangles are - * consistently oriented CCW, return 1; if CW, return -1; if all triangles - * are degenerate return 0; otherwise (no consistent orientation) return - * SIGN_INCONSISTENT. - */ { - net.java.games.jogl.impl.tesselator.CachedVertex[] v = tess.cache; -// CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; -// CachedVertex vc; - int vc; - double dot, xc, yc, zc, xp, yp, zp; - double[] n = new double[3]; - int sign = 0; - - /* Find the polygon normal. It is important to get a reasonable - * normal even when the polygon is self-intersecting (eg. a bowtie). - * Otherwise, the computed normal could be very tiny, but perpendicular - * to the true plane of the polygon due to numerical noise. Then all - * the triangles would appear to be degenerate and we would incorrectly - * decompose the polygon as a fan (or simply not render it at all). - * - * We use a sum-of-triangles normal algorithm rather than the more - * efficient sum-of-trapezoids method (used in CheckOrientation() - * in normal.c). This lets us explicitly reverse the signed area - * of some triangles to get a reasonable normal in the self-intersecting - * case. - */ - if (!check) { - norm[0] = norm[1] = norm[2] = 0.0; - } - - vc = 1; - xc = v[vc].coords[0] - v[0].coords[0]; - yc = v[vc].coords[1] - v[0].coords[1]; - zc = v[vc].coords[2] - v[0].coords[2]; - while (++vc < vn) { - xp = xc; - yp = yc; - zp = zc; - xc = v[vc].coords[0] - v[0].coords[0]; - yc = v[vc].coords[1] - v[0].coords[1]; - zc = v[vc].coords[2] - v[0].coords[2]; - - /* Compute (vp - v0) cross (vc - v0) */ - n[0] = yp * zc - zp * yc; - n[1] = zp * xc - xp * zc; - n[2] = xp * yc - yp * xc; - - dot = n[0] * norm[0] + n[1] * norm[1] + n[2] * norm[2]; - if (!check) { - /* Reverse the contribution of back-facing triangles to get - * a reasonable normal for self-intersecting polygons (see above) - */ - if (dot >= 0) { - norm[0] += n[0]; - norm[1] += n[1]; - norm[2] += n[2]; - } else { - norm[0] -= n[0]; - norm[1] -= n[1]; - norm[2] -= n[2]; - } - } else if (dot != 0) { - /* Check the new orientation for consistency with previous triangles */ - if (dot > 0) { - if (sign < 0) return SIGN_INCONSISTENT; - sign = 1; - } else { - if (sign > 0) return SIGN_INCONSISTENT; - sign = -1; - } - } - } - return sign; - } - -/* __gl_renderCache( tess ) takes a single contour and tries to render it - * as a triangle fan. This handles convex polygons, as well as some - * non-convex polygons if we get lucky. - * - * Returns true if the polygon was successfully rendered. The rendering - * output is provided as callbacks (see the api). - */ - public static boolean __gl_renderCache(GLUtesselatorImpl tess) { - net.java.games.jogl.impl.tesselator.CachedVertex[] v = tess.cache; -// CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; -// CachedVertex vc; - int vc; - double[] norm = new double[3]; - int sign; - - if (tess.cacheCount < 3) { - /* Degenerate contour -- no output */ - return true; - } - - norm[0] = tess.normal[0]; - norm[1] = tess.normal[1]; - norm[2] = tess.normal[2]; - if (norm[0] == 0 && norm[1] == 0 && norm[2] == 0) { - ComputeNormal( tess, norm, false); - } - - sign = ComputeNormal( tess, norm, true); - if (sign == SIGN_INCONSISTENT) { - /* Fan triangles did not have a consistent orientation */ - return false; - } - if (sign == 0) { - /* All triangles were degenerate */ - return true; - } - - if ( !USE_OPTIMIZED_CODE_PATH ) { - return false; - } else { - /* Make sure we do the right thing for each winding rule */ - switch (tess.windingRule) { - case GLU.GLU_TESS_WINDING_ODD: - case GLU.GLU_TESS_WINDING_NONZERO: - break; - case GLU.GLU_TESS_WINDING_POSITIVE: - if (sign < 0) return true; - break; - case GLU.GLU_TESS_WINDING_NEGATIVE: - if (sign > 0) return true; - break; - case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO: - return true; - } - - tess.callBeginOrBeginData( tess.boundaryOnly ? GL.GL_LINE_LOOP - : (tess.cacheCount > 3) ? GL.GL_TRIANGLE_FAN - : GL.GL_TRIANGLES); - - tess.callVertexOrVertexData( v[0].data); - if (sign > 0) { - for (vc = 1; vc < vn; ++vc) { - tess.callVertexOrVertexData( v[vc].data); - } - } else { - for (vc = vn - 1; vc > 0; --vc) { - tess.callVertexOrVertexData( v[vc].data); - } - } - tess.callEndOrEndData(); - return true; - } - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/Sweep.java b/src/net/java/games/jogl/impl/tesselator/Sweep.java deleted file mode 100644 index 3674d12e1..000000000 --- a/src/net/java/games/jogl/impl/tesselator/Sweep.java +++ /dev/null @@ -1,1342 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -import net.java.games.jogl.*; - -class Sweep { - private Sweep() { - } - -// #ifdef FOR_TRITE_TEST_PROGRAM -// extern void DebugEvent( GLUtesselator *tess ); -// #else - private static void DebugEvent(GLUtesselatorImpl tess) { - - } -// #endif - -/* - * Invariants for the Edge Dictionary. - * - each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2) - * at any valid location of the sweep event - * - if EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2 - * share a common endpoint - * - for each e, e.Dst has been processed, but not e.Org - * - each edge e satisfies VertLeq(e.Dst,event) && VertLeq(event,e.Org) - * where "event" is the current sweep line event. - * - no edge e has zero length - * - * Invariants for the Mesh (the processed portion). - * - the portion of the mesh left of the sweep line is a planar graph, - * ie. there is *some* way to embed it in the plane - * - no processed edge has zero length - * - no two processed vertices have identical coordinates - * - each "inside" region is monotone, ie. can be broken into two chains - * of monotonically increasing vertices according to VertLeq(v1,v2) - * - a non-invariant: these chains may intersect (very slightly) - * - * Invariants for the Sweep. - * - if none of the edges incident to the event vertex have an activeRegion - * (ie. none of these edges are in the edge dictionary), then the vertex - * has only right-going edges. - * - if an edge is marked "fixUpperEdge" (it is a temporary edge introduced - * by ConnectRightVertex), then it is the only right-going edge from - * its associated vertex. (This says that these edges exist only - * when it is necessary.) - */ - -/* When we merge two edges into one, we need to compute the combined - * winding of the new edge. - */ - private static void AddWinding(GLUhalfEdge eDst, GLUhalfEdge eSrc) { - eDst.winding += eSrc.winding; - eDst.Sym.winding += eSrc.Sym.winding; - } - - - private static ActiveRegion RegionBelow(ActiveRegion r) { - return ((ActiveRegion) Dict.dictKey(Dict.dictPred(r.nodeUp))); - } - - private static ActiveRegion RegionAbove(ActiveRegion r) { - return ((ActiveRegion) Dict.dictKey(Dict.dictSucc(r.nodeUp))); - } - - static boolean EdgeLeq(GLUtesselatorImpl tess, ActiveRegion reg1, ActiveRegion reg2) -/* - * Both edges must be directed from right to left (this is the canonical - * direction for the upper edge of each region). - * - * The strategy is to evaluate a "t" value for each edge at the - * current sweep line position, given by tess.event. The calculations - * are designed to be very stable, but of course they are not perfect. - * - * Special case: if both edge destinations are at the sweep event, - * we sort the edges by slope (they would otherwise compare equally). - */ { - GLUvertex event = tess.event; - GLUhalfEdge e1, e2; - double t1, t2; - - e1 = reg1.eUp; - e2 = reg2.eUp; - - if (e1.Sym.Org == event) { - if (e2.Sym.Org == event) { - /* Two edges right of the sweep line which meet at the sweep event. - * Sort them by slope. - */ - if (Geom.VertLeq(e1.Org, e2.Org)) { - return Geom.EdgeSign(e2.Sym.Org, e1.Org, e2.Org) <= 0; - } - return Geom.EdgeSign(e1.Sym.Org, e2.Org, e1.Org) >= 0; - } - return Geom.EdgeSign(e2.Sym.Org, event, e2.Org) <= 0; - } - if (e2.Sym.Org == event) { - return Geom.EdgeSign(e1.Sym.Org, event, e1.Org) >= 0; - } - - /* General case - compute signed distance *from* e1, e2 to event */ - t1 = Geom.EdgeEval(e1.Sym.Org, event, e1.Org); - t2 = Geom.EdgeEval(e2.Sym.Org, event, e2.Org); - return (t1 >= t2); - } - - - static void DeleteRegion(GLUtesselatorImpl tess, ActiveRegion reg) { - if (reg.fixUpperEdge) { - /* It was created with zero winding number, so it better be - * deleted with zero winding number (ie. it better not get merged - * with a real edge). - */ - assert (reg.eUp.winding == 0); - } - reg.eUp.activeRegion = null; - Dict.dictDelete(tess.dict, reg.nodeUp); /* __gl_dictListDelete */ - } - - - static boolean FixUpperEdge(ActiveRegion reg, GLUhalfEdge newEdge) -/* - * Replace an upper edge which needs fixing (see ConnectRightVertex). - */ { - assert (reg.fixUpperEdge); - if (!Mesh.__gl_meshDelete(reg.eUp)) return false; - reg.fixUpperEdge = false; - reg.eUp = newEdge; - newEdge.activeRegion = reg; - - return true; - } - - static ActiveRegion TopLeftRegion(ActiveRegion reg) { - GLUvertex org = reg.eUp.Org; - GLUhalfEdge e; - - /* Find the region above the uppermost edge with the same origin */ - do { - reg = RegionAbove(reg); - } while (reg.eUp.Org == org); - - /* If the edge above was a temporary edge introduced by ConnectRightVertex, - * now is the time to fix it. - */ - if (reg.fixUpperEdge) { - e = Mesh.__gl_meshConnect(RegionBelow(reg).eUp.Sym, reg.eUp.Lnext); - if (e == null) return null; - if (!FixUpperEdge(reg, e)) return null; - reg = RegionAbove(reg); - } - return reg; - } - - static ActiveRegion TopRightRegion(ActiveRegion reg) { - GLUvertex dst = reg.eUp.Sym.Org; - - /* Find the region above the uppermost edge with the same destination */ - do { - reg = RegionAbove(reg); - } while (reg.eUp.Sym.Org == dst); - return reg; - } - - static ActiveRegion AddRegionBelow(GLUtesselatorImpl tess, - ActiveRegion regAbove, - GLUhalfEdge eNewUp) -/* - * Add a new active region to the sweep line, *somewhere* below "regAbove" - * (according to where the new edge belongs in the sweep-line dictionary). - * The upper edge of the new region will be "eNewUp". - * Winding number and "inside" flag are not updated. - */ { - ActiveRegion regNew = new ActiveRegion(); - if (regNew == null) throw new RuntimeException(); - - regNew.eUp = eNewUp; - /* __gl_dictListInsertBefore */ - regNew.nodeUp = Dict.dictInsertBefore(tess.dict, regAbove.nodeUp, regNew); - if (regNew.nodeUp == null) throw new RuntimeException(); - regNew.fixUpperEdge = false; - regNew.sentinel = false; - regNew.dirty = false; - - eNewUp.activeRegion = regNew; - return regNew; - } - - static boolean IsWindingInside(GLUtesselatorImpl tess, int n) { - switch (tess.windingRule) { - case GLU.GLU_TESS_WINDING_ODD: - return (n & 1) != 0; - case GLU.GLU_TESS_WINDING_NONZERO: - return (n != 0); - case GLU.GLU_TESS_WINDING_POSITIVE: - return (n > 0); - case GLU.GLU_TESS_WINDING_NEGATIVE: - return (n < 0); - case GLU.GLU_TESS_WINDING_ABS_GEQ_TWO: - return (n >= 2) || (n <= -2); - } - /*LINTED*/ -// assert (false); - throw new InternalError(); - /*NOTREACHED*/ - } - - - static void ComputeWinding(GLUtesselatorImpl tess, ActiveRegion reg) { - reg.windingNumber = RegionAbove(reg).windingNumber + reg.eUp.winding; - reg.inside = IsWindingInside(tess, reg.windingNumber); - } - - - static void FinishRegion(GLUtesselatorImpl tess, ActiveRegion reg) -/* - * Delete a region from the sweep line. This happens when the upper - * and lower chains of a region meet (at a vertex on the sweep line). - * The "inside" flag is copied to the appropriate mesh face (we could - * not do this before -- since the structure of the mesh is always - * changing, this face may not have even existed until now). - */ { - GLUhalfEdge e = reg.eUp; - GLUface f = e.Lface; - - f.inside = reg.inside; - f.anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ - DeleteRegion(tess, reg); - } - - - static GLUhalfEdge FinishLeftRegions(GLUtesselatorImpl tess, - ActiveRegion regFirst, ActiveRegion regLast) -/* - * We are given a vertex with one or more left-going edges. All affected - * edges should be in the edge dictionary. Starting at regFirst.eUp, - * we walk down deleting all regions where both edges have the same - * origin vOrg. At the same time we copy the "inside" flag from the - * active region to the face, since at this point each face will belong - * to at most one region (this was not necessarily true until this point - * in the sweep). The walk stops at the region above regLast; if regLast - * is null we walk as far as possible. At the same time we relink the - * mesh if necessary, so that the ordering of edges around vOrg is the - * same as in the dictionary. - */ { - ActiveRegion reg, regPrev; - GLUhalfEdge e, ePrev; - - regPrev = regFirst; - ePrev = regFirst.eUp; - while (regPrev != regLast) { - regPrev.fixUpperEdge = false; /* placement was OK */ - reg = RegionBelow(regPrev); - e = reg.eUp; - if (e.Org != ePrev.Org) { - if (!reg.fixUpperEdge) { - /* Remove the last left-going edge. Even though there are no further - * edges in the dictionary with this origin, there may be further - * such edges in the mesh (if we are adding left edges to a vertex - * that has already been processed). Thus it is important to call - * FinishRegion rather than just DeleteRegion. - */ - FinishRegion(tess, regPrev); - break; - } - /* If the edge below was a temporary edge introduced by - * ConnectRightVertex, now is the time to fix it. - */ - e = Mesh.__gl_meshConnect(ePrev.Onext.Sym, e.Sym); - if (e == null) throw new RuntimeException(); - if (!FixUpperEdge(reg, e)) throw new RuntimeException(); - } - - /* Relink edges so that ePrev.Onext == e */ - if (ePrev.Onext != e) { - if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(ePrev, e)) throw new RuntimeException(); - } - FinishRegion(tess, regPrev); /* may change reg.eUp */ - ePrev = reg.eUp; - regPrev = reg; - } - return ePrev; - } - - - static void AddRightEdges(GLUtesselatorImpl tess, ActiveRegion regUp, - GLUhalfEdge eFirst, GLUhalfEdge eLast, GLUhalfEdge eTopLeft, - boolean cleanUp) -/* - * Purpose: insert right-going edges into the edge dictionary, and update - * winding numbers and mesh connectivity appropriately. All right-going - * edges share a common origin vOrg. Edges are inserted CCW starting at - * eFirst; the last edge inserted is eLast.Sym.Lnext. If vOrg has any - * left-going edges already processed, then eTopLeft must be the edge - * such that an imaginary upward vertical segment from vOrg would be - * contained between eTopLeft.Sym.Lnext and eTopLeft; otherwise eTopLeft - * should be null. - */ { - ActiveRegion reg, regPrev; - GLUhalfEdge e, ePrev; - boolean firstTime = true; - - /* Insert the new right-going edges in the dictionary */ - e = eFirst; - do { - assert (Geom.VertLeq(e.Org, e.Sym.Org)); - AddRegionBelow(tess, regUp, e.Sym); - e = e.Onext; - } while (e != eLast); - - /* Walk *all* right-going edges from e.Org, in the dictionary order, - * updating the winding numbers of each region, and re-linking the mesh - * edges to match the dictionary ordering (if necessary). - */ - if (eTopLeft == null) { - eTopLeft = RegionBelow(regUp).eUp.Sym.Onext; - } - regPrev = regUp; - ePrev = eTopLeft; - for (; ;) { - reg = RegionBelow(regPrev); - e = reg.eUp.Sym; - if (e.Org != ePrev.Org) break; - - if (e.Onext != ePrev) { - /* Unlink e from its current position, and relink below ePrev */ - if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(ePrev.Sym.Lnext, e)) throw new RuntimeException(); - } - /* Compute the winding number and "inside" flag for the new regions */ - reg.windingNumber = regPrev.windingNumber - e.winding; - reg.inside = IsWindingInside(tess, reg.windingNumber); - - /* Check for two outgoing edges with same slope -- process these - * before any intersection tests (see example in __gl_computeInterior). - */ - regPrev.dirty = true; - if (!firstTime && CheckForRightSplice(tess, regPrev)) { - AddWinding(e, ePrev); - DeleteRegion(tess, regPrev); - if (!Mesh.__gl_meshDelete(ePrev)) throw new RuntimeException(); - } - firstTime = false; - regPrev = reg; - ePrev = e; - } - regPrev.dirty = true; - assert (regPrev.windingNumber - e.winding == reg.windingNumber); - - if (cleanUp) { - /* Check for intersections between newly adjacent edges. */ - WalkDirtyRegions(tess, regPrev); - } - } - - - static void CallCombine(GLUtesselatorImpl tess, GLUvertex isect, - Object[] data, float[] weights, boolean needed) { - double[] coords = new double[3]; - - /* Copy coord data in case the callback changes it. */ - coords[0] = isect.coords[0]; - coords[1] = isect.coords[1]; - coords[2] = isect.coords[2]; - - Object[] outData = new Object[1]; - tess.callCombineOrCombineData(coords, data, weights, outData); - isect.data = outData[0]; - if (isect.data == null) { - if (!needed) { - isect.data = data[0]; - } else if (!tess.fatalError) { - /* The only way fatal error is when two edges are found to intersect, - * but the user has not provided the callback necessary to handle - * generated intersection points. - */ - tess.callErrorOrErrorData(GLU.GLU_TESS_NEED_COMBINE_CALLBACK); - tess.fatalError = true; - } - } - } - - static void SpliceMergeVertices(GLUtesselatorImpl tess, GLUhalfEdge e1, - GLUhalfEdge e2) -/* - * Two vertices with idential coordinates are combined into one. - * e1.Org is kept, while e2.Org is discarded. - */ { - Object[] data = new Object[4]; - float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; - - data[0] = e1.Org.data; - data[1] = e2.Org.data; - CallCombine(tess, e1.Org, data, weights, false); - if (!Mesh.__gl_meshSplice(e1, e2)) throw new RuntimeException(); - } - - static void VertexWeights(GLUvertex isect, GLUvertex org, GLUvertex dst, - float[] weights) -/* - * Find some weights which describe how the intersection vertex is - * a linear combination of "org" and "dest". Each of the two edges - * which generated "isect" is allocated 50% of the weight; each edge - * splits the weight between its org and dst according to the - * relative distance to "isect". - */ { - double t1 = Geom.VertL1dist(org, isect); - double t2 = Geom.VertL1dist(dst, isect); - - weights[0] = (float) (0.5 * t2 / (t1 + t2)); - weights[1] = (float) (0.5 * t1 / (t1 + t2)); - isect.coords[0] += weights[0] * org.coords[0] + weights[1] * dst.coords[0]; - isect.coords[1] += weights[0] * org.coords[1] + weights[1] * dst.coords[1]; - isect.coords[2] += weights[0] * org.coords[2] + weights[1] * dst.coords[2]; - } - - - static void GetIntersectData(GLUtesselatorImpl tess, GLUvertex isect, - GLUvertex orgUp, GLUvertex dstUp, - GLUvertex orgLo, GLUvertex dstLo) -/* - * We've computed a new intersection point, now we need a "data" pointer - * from the user so that we can refer to this new vertex in the - * rendering callbacks. - */ { - Object[] data = new Object[4]; - float[] weights = new float[4]; - float[] weights1 = new float[2]; - float[] weights2 = new float[2]; - - data[0] = orgUp.data; - data[1] = dstUp.data; - data[2] = orgLo.data; - data[3] = dstLo.data; - - isect.coords[0] = isect.coords[1] = isect.coords[2] = 0; - VertexWeights(isect, orgUp, dstUp, weights1); - VertexWeights(isect, orgLo, dstLo, weights2); - System.arraycopy(weights1, 0, weights, 0, 2); - System.arraycopy(weights2, 0, weights, 2, 2); - - CallCombine(tess, isect, data, weights, true); - } - - static boolean CheckForRightSplice(GLUtesselatorImpl tess, ActiveRegion regUp) -/* - * Check the upper and lower edge of "regUp", to make sure that the - * eUp.Org is above eLo, or eLo.Org is below eUp (depending on which - * origin is leftmost). - * - * The main purpose is to splice right-going edges with the same - * dest vertex and nearly identical slopes (ie. we can't distinguish - * the slopes numerically). However the splicing can also help us - * to recover from numerical errors. For example, suppose at one - * point we checked eUp and eLo, and decided that eUp.Org is barely - * above eLo. Then later, we split eLo into two edges (eg. from - * a splice operation like this one). This can change the result of - * our test so that now eUp.Org is incident to eLo, or barely below it. - * We must correct this condition to maintain the dictionary invariants. - * - * One possibility is to check these edges for intersection again - * (ie. CheckForIntersect). This is what we do if possible. However - * CheckForIntersect requires that tess.event lies between eUp and eLo, - * so that it has something to fall back on when the intersection - * calculation gives us an unusable answer. So, for those cases where - * we can't check for intersection, this routine fixes the problem - * by just splicing the offending vertex into the other edge. - * This is a guaranteed solution, no matter how degenerate things get. - * Basically this is a combinatorial solution to a numerical problem. - */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; - - if (Geom.VertLeq(eUp.Org, eLo.Org)) { - if (Geom.EdgeSign(eLo.Sym.Org, eUp.Org, eLo.Org) > 0) return false; - - /* eUp.Org appears to be below eLo */ - if (!Geom.VertEq(eUp.Org, eLo.Org)) { - /* Splice eUp.Org into eLo */ - if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eUp, eLo.Sym.Lnext)) throw new RuntimeException(); - regUp.dirty = regLo.dirty = true; - - } else if (eUp.Org != eLo.Org) { - /* merge the two vertices, discarding eUp.Org */ - tess.pq.pqDelete(eUp.Org.pqHandle); /* __gl_pqSortDelete */ - SpliceMergeVertices(tess, eLo.Sym.Lnext, eUp); - } - } else { - if (Geom.EdgeSign(eUp.Sym.Org, eLo.Org, eUp.Org) < 0) return false; - - /* eLo.Org appears to be above eUp, so splice eLo.Org into eUp */ - RegionAbove(regUp).dirty = regUp.dirty = true; - if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eLo.Sym.Lnext, eUp)) throw new RuntimeException(); - } - return true; - } - - static boolean CheckForLeftSplice(GLUtesselatorImpl tess, ActiveRegion regUp) -/* - * Check the upper and lower edge of "regUp", to make sure that the - * eUp.Sym.Org is above eLo, or eLo.Sym.Org is below eUp (depending on which - * destination is rightmost). - * - * Theoretically, this should always be true. However, splitting an edge - * into two pieces can change the results of previous tests. For example, - * suppose at one point we checked eUp and eLo, and decided that eUp.Sym.Org - * is barely above eLo. Then later, we split eLo into two edges (eg. from - * a splice operation like this one). This can change the result of - * the test so that now eUp.Sym.Org is incident to eLo, or barely below it. - * We must correct this condition to maintain the dictionary invariants - * (otherwise new edges might get inserted in the wrong place in the - * dictionary, and bad stuff will happen). - * - * We fix the problem by just splicing the offending vertex into the - * other edge. - */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; - GLUhalfEdge e; - - assert (!Geom.VertEq(eUp.Sym.Org, eLo.Sym.Org)); - - if (Geom.VertLeq(eUp.Sym.Org, eLo.Sym.Org)) { - if (Geom.EdgeSign(eUp.Sym.Org, eLo.Sym.Org, eUp.Org) < 0) return false; - - /* eLo.Sym.Org is above eUp, so splice eLo.Sym.Org into eUp */ - RegionAbove(regUp).dirty = regUp.dirty = true; - e = Mesh.__gl_meshSplitEdge(eUp); - if (e == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eLo.Sym, e)) throw new RuntimeException(); - e.Lface.inside = regUp.inside; - } else { - if (Geom.EdgeSign(eLo.Sym.Org, eUp.Sym.Org, eLo.Org) > 0) return false; - - /* eUp.Sym.Org is below eLo, so splice eUp.Sym.Org into eLo */ - regUp.dirty = regLo.dirty = true; - e = Mesh.__gl_meshSplitEdge(eLo); - if (e == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eUp.Lnext, eLo.Sym)) throw new RuntimeException(); - e.Sym.Lface.inside = regUp.inside; - } - return true; - } - - - static boolean CheckForIntersect(GLUtesselatorImpl tess, ActiveRegion regUp) -/* - * Check the upper and lower edges of the given region to see if - * they intersect. If so, create the intersection and add it - * to the data structures. - * - * Returns true if adding the new intersection resulted in a recursive - * call to AddRightEdges(); in this case all "dirty" regions have been - * checked for intersections, and possibly regUp has been deleted. - */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; - GLUvertex orgUp = eUp.Org; - GLUvertex orgLo = eLo.Org; - GLUvertex dstUp = eUp.Sym.Org; - GLUvertex dstLo = eLo.Sym.Org; - double tMinUp, tMaxLo; - GLUvertex isect = new GLUvertex(); - GLUvertex orgMin; - GLUhalfEdge e; - - assert (!Geom.VertEq(dstLo, dstUp)); - assert (Geom.EdgeSign(dstUp, tess.event, orgUp) <= 0); - assert (Geom.EdgeSign(dstLo, tess.event, orgLo) >= 0); - assert (orgUp != tess.event && orgLo != tess.event); - assert (!regUp.fixUpperEdge && !regLo.fixUpperEdge); - - if (orgUp == orgLo) return false; /* right endpoints are the same */ - - tMinUp = Math.min(orgUp.t, dstUp.t); - tMaxLo = Math.max(orgLo.t, dstLo.t); - if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */ - - if (Geom.VertLeq(orgUp, orgLo)) { - if (Geom.EdgeSign(dstLo, orgUp, orgLo) > 0) return false; - } else { - if (Geom.EdgeSign(dstUp, orgLo, orgUp) < 0) return false; - } - - /* At this point the edges intersect, at least marginally */ - DebugEvent(tess); - - Geom.EdgeIntersect(dstUp, orgUp, dstLo, orgLo, isect); - /* The following properties are guaranteed: */ - assert (Math.min(orgUp.t, dstUp.t) <= isect.t); - assert (isect.t <= Math.max(orgLo.t, dstLo.t)); - assert (Math.min(dstLo.s, dstUp.s) <= isect.s); - assert (isect.s <= Math.max(orgLo.s, orgUp.s)); - - if (Geom.VertLeq(isect, tess.event)) { - /* The intersection point lies slightly to the left of the sweep line, - * so move it until it''s slightly to the right of the sweep line. - * (If we had perfect numerical precision, this would never happen - * in the first place). The easiest and safest thing to do is - * replace the intersection by tess.event. - */ - isect.s = tess.event.s; - isect.t = tess.event.t; - } - /* Similarly, if the computed intersection lies to the right of the - * rightmost origin (which should rarely happen), it can cause - * unbelievable inefficiency on sufficiently degenerate inputs. - * (If you have the test program, try running test54.d with the - * "X zoom" option turned on). - */ - orgMin = Geom.VertLeq(orgUp, orgLo) ? orgUp : orgLo; - if (Geom.VertLeq(orgMin, isect)) { - isect.s = orgMin.s; - isect.t = orgMin.t; - } - - if (Geom.VertEq(isect, orgUp) || Geom.VertEq(isect, orgLo)) { - /* Easy case -- intersection at one of the right endpoints */ - CheckForRightSplice(tess, regUp); - return false; - } - - if ((!Geom.VertEq(dstUp, tess.event) - && Geom.EdgeSign(dstUp, tess.event, isect) >= 0) - || (!Geom.VertEq(dstLo, tess.event) - && Geom.EdgeSign(dstLo, tess.event, isect) <= 0)) { - /* Very unusual -- the new upper or lower edge would pass on the - * wrong side of the sweep event, or through it. This can happen - * due to very small numerical errors in the intersection calculation. - */ - if (dstLo == tess.event) { - /* Splice dstLo into eUp, and process the new region(s) */ - if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eLo.Sym, eUp)) throw new RuntimeException(); - regUp = TopLeftRegion(regUp); - if (regUp == null) throw new RuntimeException(); - eUp = RegionBelow(regUp).eUp; - FinishLeftRegions(tess, RegionBelow(regUp), regLo); - AddRightEdges(tess, regUp, eUp.Sym.Lnext, eUp, eUp, true); - return true; - } - if (dstUp == tess.event) { - /* Splice dstUp into eLo, and process the new region(s) */ - if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eUp.Lnext, eLo.Sym.Lnext)) throw new RuntimeException(); - regLo = regUp; - regUp = TopRightRegion(regUp); - e = RegionBelow(regUp).eUp.Sym.Onext; - regLo.eUp = eLo.Sym.Lnext; - eLo = FinishLeftRegions(tess, regLo, null); - AddRightEdges(tess, regUp, eLo.Onext, eUp.Sym.Onext, e, true); - return true; - } - /* Special case: called from ConnectRightVertex. If either - * edge passes on the wrong side of tess.event, split it - * (and wait for ConnectRightVertex to splice it appropriately). - */ - if (Geom.EdgeSign(dstUp, tess.event, isect) >= 0) { - RegionAbove(regUp).dirty = regUp.dirty = true; - if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); - eUp.Org.s = tess.event.s; - eUp.Org.t = tess.event.t; - } - if (Geom.EdgeSign(dstLo, tess.event, isect) <= 0) { - regUp.dirty = regLo.dirty = true; - if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); - eLo.Org.s = tess.event.s; - eLo.Org.t = tess.event.t; - } - /* leave the rest for ConnectRightVertex */ - return false; - } - - /* General case -- split both edges, splice into new vertex. - * When we do the splice operation, the order of the arguments is - * arbitrary as far as correctness goes. However, when the operation - * creates a new face, the work done is proportional to the size of - * the new face. We expect the faces in the processed part of - * the mesh (ie. eUp.Lface) to be smaller than the faces in the - * unprocessed original contours (which will be eLo.Sym.Lnext.Lface). - */ - if (Mesh.__gl_meshSplitEdge(eUp.Sym) == null) throw new RuntimeException(); - if (Mesh.__gl_meshSplitEdge(eLo.Sym) == null) throw new RuntimeException(); - if (!Mesh.__gl_meshSplice(eLo.Sym.Lnext, eUp)) throw new RuntimeException(); - eUp.Org.s = isect.s; - eUp.Org.t = isect.t; - eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */ - if (eUp.Org.pqHandle == Long.MAX_VALUE) { - tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ - tess.pq = null; - throw new RuntimeException(); - } - GetIntersectData(tess, eUp.Org, orgUp, dstUp, orgLo, dstLo); - RegionAbove(regUp).dirty = regUp.dirty = regLo.dirty = true; - return false; - } - - static void WalkDirtyRegions(GLUtesselatorImpl tess, ActiveRegion regUp) -/* - * When the upper or lower edge of any region changes, the region is - * marked "dirty". This routine walks through all the dirty regions - * and makes sure that the dictionary invariants are satisfied - * (see the comments at the beginning of this file). Of course - * new dirty regions can be created as we make changes to restore - * the invariants. - */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp, eLo; - - for (; ;) { - /* Find the lowest dirty region (we walk from the bottom up). */ - while (regLo.dirty) { - regUp = regLo; - regLo = RegionBelow(regLo); - } - if (!regUp.dirty) { - regLo = regUp; - regUp = RegionAbove(regUp); - if (regUp == null || !regUp.dirty) { - /* We've walked all the dirty regions */ - return; - } - } - regUp.dirty = false; - eUp = regUp.eUp; - eLo = regLo.eUp; - - if (eUp.Sym.Org != eLo.Sym.Org) { - /* Check that the edge ordering is obeyed at the Dst vertices. */ - if (CheckForLeftSplice(tess, regUp)) { - - /* If the upper or lower edge was marked fixUpperEdge, then - * we no longer need it (since these edges are needed only for - * vertices which otherwise have no right-going edges). - */ - if (regLo.fixUpperEdge) { - DeleteRegion(tess, regLo); - if (!Mesh.__gl_meshDelete(eLo)) throw new RuntimeException(); - regLo = RegionBelow(regUp); - eLo = regLo.eUp; - } else if (regUp.fixUpperEdge) { - DeleteRegion(tess, regUp); - if (!Mesh.__gl_meshDelete(eUp)) throw new RuntimeException(); - regUp = RegionAbove(regLo); - eUp = regUp.eUp; - } - } - } - if (eUp.Org != eLo.Org) { - if (eUp.Sym.Org != eLo.Sym.Org - && !regUp.fixUpperEdge && !regLo.fixUpperEdge - && (eUp.Sym.Org == tess.event || eLo.Sym.Org == tess.event)) { - /* When all else fails in CheckForIntersect(), it uses tess.event - * as the intersection location. To make this possible, it requires - * that tess.event lie between the upper and lower edges, and also - * that neither of these is marked fixUpperEdge (since in the worst - * case it might splice one of these edges into tess.event, and - * violate the invariant that fixable edges are the only right-going - * edge from their associated vertex). - */ - if (CheckForIntersect(tess, regUp)) { - /* WalkDirtyRegions() was called recursively; we're done */ - return; - } - } else { - /* Even though we can't use CheckForIntersect(), the Org vertices - * may violate the dictionary edge ordering. Check and correct this. - */ - CheckForRightSplice(tess, regUp); - } - } - if (eUp.Org == eLo.Org && eUp.Sym.Org == eLo.Sym.Org) { - /* A degenerate loop consisting of only two edges -- delete it. */ - AddWinding(eLo, eUp); - DeleteRegion(tess, regUp); - if (!Mesh.__gl_meshDelete(eUp)) throw new RuntimeException(); - regUp = RegionAbove(regLo); - } - } - } - - - static void ConnectRightVertex(GLUtesselatorImpl tess, ActiveRegion regUp, - GLUhalfEdge eBottomLeft) -/* - * Purpose: connect a "right" vertex vEvent (one where all edges go left) - * to the unprocessed portion of the mesh. Since there are no right-going - * edges, two regions (one above vEvent and one below) are being merged - * into one. "regUp" is the upper of these two regions. - * - * There are two reasons for doing this (adding a right-going edge): - * - if the two regions being merged are "inside", we must add an edge - * to keep them separated (the combined region would not be monotone). - * - in any case, we must leave some record of vEvent in the dictionary, - * so that we can merge vEvent with features that we have not seen yet. - * For example, maybe there is a vertical edge which passes just to - * the right of vEvent; we would like to splice vEvent into this edge. - * - * However, we don't want to connect vEvent to just any vertex. We don''t - * want the new edge to cross any other edges; otherwise we will create - * intersection vertices even when the input data had no self-intersections. - * (This is a bad thing; if the user's input data has no intersections, - * we don't want to generate any false intersections ourselves.) - * - * Our eventual goal is to connect vEvent to the leftmost unprocessed - * vertex of the combined region (the union of regUp and regLo). - * But because of unseen vertices with all right-going edges, and also - * new vertices which may be created by edge intersections, we don''t - * know where that leftmost unprocessed vertex is. In the meantime, we - * connect vEvent to the closest vertex of either chain, and mark the region - * as "fixUpperEdge". This flag says to delete and reconnect this edge - * to the next processed vertex on the boundary of the combined region. - * Quite possibly the vertex we connected to will turn out to be the - * closest one, in which case we won''t need to make any changes. - */ { - GLUhalfEdge eNew; - GLUhalfEdge eTopLeft = eBottomLeft.Onext; - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; - boolean degenerate = false; - - if (eUp.Sym.Org != eLo.Sym.Org) { - CheckForIntersect(tess, regUp); - } - - /* Possible new degeneracies: upper or lower edge of regUp may pass - * through vEvent, or may coincide with new intersection vertex - */ - if (Geom.VertEq(eUp.Org, tess.event)) { - if (!Mesh.__gl_meshSplice(eTopLeft.Sym.Lnext, eUp)) throw new RuntimeException(); - regUp = TopLeftRegion(regUp); - if (regUp == null) throw new RuntimeException(); - eTopLeft = RegionBelow(regUp).eUp; - FinishLeftRegions(tess, RegionBelow(regUp), regLo); - degenerate = true; - } - if (Geom.VertEq(eLo.Org, tess.event)) { - if (!Mesh.__gl_meshSplice(eBottomLeft, eLo.Sym.Lnext)) throw new RuntimeException(); - eBottomLeft = FinishLeftRegions(tess, regLo, null); - degenerate = true; - } - if (degenerate) { - AddRightEdges(tess, regUp, eBottomLeft.Onext, eTopLeft, eTopLeft, true); - return; - } - - /* Non-degenerate situation -- need to add a temporary, fixable edge. - * Connect to the closer of eLo.Org, eUp.Org. - */ - if (Geom.VertLeq(eLo.Org, eUp.Org)) { - eNew = eLo.Sym.Lnext; - } else { - eNew = eUp; - } - eNew = Mesh.__gl_meshConnect(eBottomLeft.Onext.Sym, eNew); - if (eNew == null) throw new RuntimeException(); - - /* Prevent cleanup, otherwise eNew might disappear before we've even - * had a chance to mark it as a temporary edge. - */ - AddRightEdges(tess, regUp, eNew, eNew.Onext, eNew.Onext, false); - eNew.Sym.activeRegion.fixUpperEdge = true; - WalkDirtyRegions(tess, regUp); - } - -/* Because vertices at exactly the same location are merged together - * before we process the sweep event, some degenerate cases can't occur. - * However if someone eventually makes the modifications required to - * merge features which are close together, the cases below marked - * TOLERANCE_NONZERO will be useful. They were debugged before the - * code to merge identical vertices in the main loop was added. - */ - private static final boolean TOLERANCE_NONZERO = false; - - static void ConnectLeftDegenerate(GLUtesselatorImpl tess, - ActiveRegion regUp, GLUvertex vEvent) -/* - * The event vertex lies exacty on an already-processed edge or vertex. - * Adding the new vertex involves splicing it into the already-processed - * part of the mesh. - */ { - GLUhalfEdge e, eTopLeft, eTopRight, eLast; - ActiveRegion reg; - - e = regUp.eUp; - if (Geom.VertEq(e.Org, vEvent)) { - /* e.Org is an unprocessed vertex - just combine them, and wait - * for e.Org to be pulled from the queue - */ - assert (TOLERANCE_NONZERO); - SpliceMergeVertices(tess, e, vEvent.anEdge); - return; - } - - if (!Geom.VertEq(e.Sym.Org, vEvent)) { - /* General case -- splice vEvent into edge e which passes through it */ - if (Mesh.__gl_meshSplitEdge(e.Sym) == null) throw new RuntimeException(); - if (regUp.fixUpperEdge) { - /* This edge was fixable -- delete unused portion of original edge */ - if (!Mesh.__gl_meshDelete(e.Onext)) throw new RuntimeException(); - regUp.fixUpperEdge = false; - } - if (!Mesh.__gl_meshSplice(vEvent.anEdge, e)) throw new RuntimeException(); - SweepEvent(tess, vEvent); /* recurse */ - return; - } - - /* vEvent coincides with e.Sym.Org, which has already been processed. - * Splice in the additional right-going edges. - */ - assert (TOLERANCE_NONZERO); - regUp = TopRightRegion(regUp); - reg = RegionBelow(regUp); - eTopRight = reg.eUp.Sym; - eTopLeft = eLast = eTopRight.Onext; - if (reg.fixUpperEdge) { - /* Here e.Sym.Org has only a single fixable edge going right. - * We can delete it since now we have some real right-going edges. - */ - assert (eTopLeft != eTopRight); /* there are some left edges too */ - DeleteRegion(tess, reg); - if (!Mesh.__gl_meshDelete(eTopRight)) throw new RuntimeException(); - eTopRight = eTopLeft.Sym.Lnext; - } - if (!Mesh.__gl_meshSplice(vEvent.anEdge, eTopRight)) throw new RuntimeException(); - if (!Geom.EdgeGoesLeft(eTopLeft)) { - /* e.Sym.Org had no left-going edges -- indicate this to AddRightEdges() */ - eTopLeft = null; - } - AddRightEdges(tess, regUp, eTopRight.Onext, eLast, eTopLeft, true); - } - - - static void ConnectLeftVertex(GLUtesselatorImpl tess, GLUvertex vEvent) -/* - * Purpose: connect a "left" vertex (one where both edges go right) - * to the processed portion of the mesh. Let R be the active region - * containing vEvent, and let U and L be the upper and lower edge - * chains of R. There are two possibilities: - * - * - the normal case: split R into two regions, by connecting vEvent to - * the rightmost vertex of U or L lying to the left of the sweep line - * - * - the degenerate case: if vEvent is close enough to U or L, we - * merge vEvent into that edge chain. The subcases are: - * - merging with the rightmost vertex of U or L - * - merging with the active edge of U or L - * - merging with an already-processed portion of U or L - */ { - ActiveRegion regUp, regLo, reg; - GLUhalfEdge eUp, eLo, eNew; - ActiveRegion tmp = new ActiveRegion(); - - /* assert ( vEvent.anEdge.Onext.Onext == vEvent.anEdge ); */ - - /* Get a pointer to the active region containing vEvent */ - tmp.eUp = vEvent.anEdge.Sym; - /* __GL_DICTLISTKEY */ /* __gl_dictListSearch */ - regUp = (ActiveRegion) Dict.dictKey(Dict.dictSearch(tess.dict, tmp)); - regLo = RegionBelow(regUp); - eUp = regUp.eUp; - eLo = regLo.eUp; - - /* Try merging with U or L first */ - if (Geom.EdgeSign(eUp.Sym.Org, vEvent, eUp.Org) == 0) { - ConnectLeftDegenerate(tess, regUp, vEvent); - return; - } - - /* Connect vEvent to rightmost processed vertex of either chain. - * e.Sym.Org is the vertex that we will connect to vEvent. - */ - reg = Geom.VertLeq(eLo.Sym.Org, eUp.Sym.Org) ? regUp : regLo; - - if (regUp.inside || reg.fixUpperEdge) { - if (reg == regUp) { - eNew = Mesh.__gl_meshConnect(vEvent.anEdge.Sym, eUp.Lnext); - if (eNew == null) throw new RuntimeException(); - } else { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); - if (tempHalfEdge == null) throw new RuntimeException(); - - eNew = tempHalfEdge.Sym; - } - if (reg.fixUpperEdge) { - if (!FixUpperEdge(reg, eNew)) throw new RuntimeException(); - } else { - ComputeWinding(tess, AddRegionBelow(tess, regUp, eNew)); - } - SweepEvent(tess, vEvent); - } else { - /* The new vertex is in a region which does not belong to the polygon. - * We don''t need to connect this vertex to the rest of the mesh. - */ - AddRightEdges(tess, regUp, vEvent.anEdge, vEvent.anEdge, null, true); - } - } - - - static void SweepEvent(GLUtesselatorImpl tess, GLUvertex vEvent) -/* - * Does everything necessary when the sweep line crosses a vertex. - * Updates the mesh and the edge dictionary. - */ { - ActiveRegion regUp, reg; - GLUhalfEdge e, eTopLeft, eBottomLeft; - - tess.event = vEvent; /* for access in EdgeLeq() */ - DebugEvent(tess); - - /* Check if this vertex is the right endpoint of an edge that is - * already in the dictionary. In this case we don't need to waste - * time searching for the location to insert new edges. - */ - e = vEvent.anEdge; - while (e.activeRegion == null) { - e = e.Onext; - if (e == vEvent.anEdge) { - /* All edges go right -- not incident to any processed edges */ - ConnectLeftVertex(tess, vEvent); - return; - } - } - - /* Processing consists of two phases: first we "finish" all the - * active regions where both the upper and lower edges terminate - * at vEvent (ie. vEvent is closing off these regions). - * We mark these faces "inside" or "outside" the polygon according - * to their winding number, and delete the edges from the dictionary. - * This takes care of all the left-going edges from vEvent. - */ - regUp = TopLeftRegion(e.activeRegion); - if (regUp == null) throw new RuntimeException(); - reg = RegionBelow(regUp); - eTopLeft = reg.eUp; - eBottomLeft = FinishLeftRegions(tess, reg, null); - - /* Next we process all the right-going edges from vEvent. This - * involves adding the edges to the dictionary, and creating the - * associated "active regions" which record information about the - * regions between adjacent dictionary edges. - */ - if (eBottomLeft.Onext == eTopLeft) { - /* No right-going edges -- add a temporary "fixable" edge */ - ConnectRightVertex(tess, regUp, eBottomLeft); - } else { - AddRightEdges(tess, regUp, eBottomLeft.Onext, eTopLeft, eTopLeft, true); - } - } - - -/* Make the sentinel coordinates big enough that they will never be - * merged with real input features. (Even with the largest possible - * input contour and the maximum tolerance of 1.0, no merging will be - * done with coordinates larger than 3 * GLU_TESS_MAX_COORD). - */ - private static final double SENTINEL_COORD = (4.0 * GLU.GLU_TESS_MAX_COORD); - - static void AddSentinel(GLUtesselatorImpl tess, double t) -/* - * We add two sentinel edges above and below all other edges, - * to avoid special cases at the top and bottom. - */ { - GLUhalfEdge e; - ActiveRegion reg = new ActiveRegion(); - if (reg == null) throw new RuntimeException(); - - e = Mesh.__gl_meshMakeEdge(tess.mesh); - if (e == null) throw new RuntimeException(); - - e.Org.s = SENTINEL_COORD; - e.Org.t = t; - e.Sym.Org.s = -SENTINEL_COORD; - e.Sym.Org.t = t; - tess.event = e.Sym.Org; /* initialize it */ - - reg.eUp = e; - reg.windingNumber = 0; - reg.inside = false; - reg.fixUpperEdge = false; - reg.sentinel = true; - reg.dirty = false; - reg.nodeUp = Dict.dictInsert(tess.dict, reg); /* __gl_dictListInsertBefore */ - if (reg.nodeUp == null) throw new RuntimeException(); - } - - - static void InitEdgeDict(final GLUtesselatorImpl tess) -/* - * We maintain an ordering of edge intersections with the sweep line. - * This order is maintained in a dynamic dictionary. - */ { - /* __gl_dictListNewDict */ - tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() { - public boolean leq(Object frame, Object key1, Object key2) { - return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2); - } - }); - if (tess.dict == null) throw new RuntimeException(); - - AddSentinel(tess, -SENTINEL_COORD); - AddSentinel(tess, SENTINEL_COORD); - } - - - static void DoneEdgeDict(GLUtesselatorImpl tess) { - ActiveRegion reg; - int fixedEdges = 0; - - /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ - while ((reg = (ActiveRegion) Dict.dictKey(Dict.dictMin(tess.dict))) != null) { - /* - * At the end of all processing, the dictionary should contain - * only the two sentinel edges, plus at most one "fixable" edge - * created by ConnectRightVertex(). - */ - if (!reg.sentinel) { - assert (reg.fixUpperEdge); - assert (++fixedEdges == 1); - } - assert (reg.windingNumber == 0); - DeleteRegion(tess, reg); -/* __gl_meshDelete( reg.eUp );*/ - } - Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */ - } - - - static void RemoveDegenerateEdges(GLUtesselatorImpl tess) -/* - * Remove zero-length edges, and contours with fewer than 3 vertices. - */ { - GLUhalfEdge e, eNext, eLnext; - GLUhalfEdge eHead = tess.mesh.eHead; - - /*LINTED*/ - for (e = eHead.next; e != eHead; e = eNext) { - eNext = e.next; - eLnext = e.Lnext; - - if (Geom.VertEq(e.Org, e.Sym.Org) && e.Lnext.Lnext != e) { - /* Zero-length edge, contour has at least 3 edges */ - - SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */ - if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); /* e is a self-loop */ - e = eLnext; - eLnext = e.Lnext; - } - if (eLnext.Lnext == e) { - /* Degenerate contour (one or two edges) */ - - if (eLnext != e) { - if (eLnext == eNext || eLnext == eNext.Sym) { - eNext = eNext.next; - } - if (!Mesh.__gl_meshDelete(eLnext)) throw new RuntimeException(); - } - if (e == eNext || e == eNext.Sym) { - eNext = eNext.next; - } - if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); - } - } - } - - static boolean InitPriorityQ(GLUtesselatorImpl tess) -/* - * Insert all vertices into the priority queue which determines the - * order in which vertices cross the sweep line. - */ { - PriorityQ pq; - GLUvertex v, vHead; - - /* __gl_pqSortNewPriorityQ */ - pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() { - public boolean leq(Object key1, Object key2) { - return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); - } - }); - if (pq == null) return false; - - vHead = tess.mesh.vHead; - for (v = vHead.next; v != vHead; v = v.next) { - v.pqHandle = pq.pqInsert(v); /* __gl_pqSortInsert */ - if (v.pqHandle == Long.MAX_VALUE) break; - } - if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */ - tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ - tess.pq = null; - return false; - } - - return true; - } - - - static void DonePriorityQ(GLUtesselatorImpl tess) { - tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ - } - - - static boolean RemoveDegenerateFaces(GLUmesh mesh) -/* - * Delete any degenerate faces with only two edges. WalkDirtyRegions() - * will catch almost all of these, but it won't catch degenerate faces - * produced by splice operations on already-processed edges. - * The two places this can happen are in FinishLeftRegions(), when - * we splice in a "temporary" edge produced by ConnectRightVertex(), - * and in CheckForLeftSplice(), where we splice already-processed - * edges to ensure that our dictionary invariants are not violated - * by numerical errors. - * - * In both these cases it is *very* dangerous to delete the offending - * edge at the time, since one of the routines further up the stack - * will sometimes be keeping a pointer to that edge. - */ { - GLUface f, fNext; - GLUhalfEdge e; - - /*LINTED*/ - for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) { - fNext = f.next; - e = f.anEdge; - assert (e.Lnext != e); - - if (e.Lnext.Lnext == e) { - /* A face with only two edges */ - AddWinding(e.Onext, e); - if (!Mesh.__gl_meshDelete(e)) return false; - } - } - return true; - } - - public static boolean __gl_computeInterior(GLUtesselatorImpl tess) -/* - * __gl_computeInterior( tess ) computes the planar arrangement specified - * by the given contours, and further subdivides this arrangement - * into regions. Each region is marked "inside" if it belongs - * to the polygon, according to the rule given by tess.windingRule. - * Each interior region is guaranteed be monotone. - */ { - GLUvertex v, vNext; - - tess.fatalError = false; - - /* Each vertex defines an event for our sweep line. Start by inserting - * all the vertices in a priority queue. Events are processed in - * lexicographic order, ie. - * - * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) - */ - RemoveDegenerateEdges(tess); - if (!InitPriorityQ(tess)) return false; /* if error */ - InitEdgeDict(tess); - - /* __gl_pqSortExtractMin */ - while ((v = (GLUvertex) tess.pq.pqExtractMin()) != null) { - for (; ;) { - vNext = (GLUvertex) tess.pq.pqMinimum(); /* __gl_pqSortMinimum */ - if (vNext == null || !Geom.VertEq(vNext, v)) break; - - /* Merge together all vertices at exactly the same location. - * This is more efficient than processing them one at a time, - * simplifies the code (see ConnectLeftDegenerate), and is also - * important for correct handling of certain degenerate cases. - * For example, suppose there are two identical edges A and B - * that belong to different contours (so without this code they would - * be processed by separate sweep events). Suppose another edge C - * crosses A and B from above. When A is processed, we split it - * at its intersection point with C. However this also splits C, - * so when we insert B we may compute a slightly different - * intersection point. This might leave two edges with a small - * gap between them. This kind of error is especially obvious - * when using boundary extraction (GLU_TESS_BOUNDARY_ONLY). - */ - vNext = (GLUvertex) tess.pq.pqExtractMin(); /* __gl_pqSortExtractMin*/ - SpliceMergeVertices(tess, v.anEdge, vNext.anEdge); - } - SweepEvent(tess, v); - } - - /* Set tess.event for debugging purposes */ - /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ - tess.event = ((ActiveRegion) Dict.dictKey(Dict.dictMin(tess.dict))).eUp.Org; - DebugEvent(tess); - DoneEdgeDict(tess); - DonePriorityQ(tess); - - if (!RemoveDegenerateFaces(tess.mesh)) return false; - Mesh.__gl_meshCheckMesh(tess.mesh); - - return true; - } -} diff --git a/src/net/java/games/jogl/impl/tesselator/TessMono.java b/src/net/java/games/jogl/impl/tesselator/TessMono.java deleted file mode 100644 index 9e55e1194..000000000 --- a/src/net/java/games/jogl/impl/tesselator/TessMono.java +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - -class TessMono { -/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region - * (what else would it do??) The region must consist of a single - * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this - * case means that any vertical line intersects the interior of the - * region in a single interval. - * - * Tessellation consists of adding interior edges (actually pairs of - * half-edges), to split the region into non-overlapping triangles. - * - * The basic idea is explained in Preparata and Shamos (which I don''t - * have handy right now), although their implementation is more - * complicated than this one. The are two edge chains, an upper chain - * and a lower chain. We process all vertices from both chains in order, - * from right to left. - * - * The algorithm ensures that the following invariant holds after each - * vertex is processed: the untessellated region consists of two - * chains, where one chain (say the upper) is a single edge, and - * the other chain is concave. The left vertex of the single edge - * is always to the left of all vertices in the concave chain. - * - * Each step consists of adding the rightmost unprocessed vertex to one - * of the two chains, and forming a fan of triangles from the rightmost - * of two chain endpoints. Determining whether we can add each triangle - * to the fan is a simple orientation test. By making the fan as large - * as possible, we restore the invariant (check it yourself). - */ - static boolean __gl_meshTessellateMonoRegion(GLUface face) { - GLUhalfEdge up, lo; - - /* All edges are oriented CCW around the boundary of the region. - * First, find the half-edge whose origin vertex is rightmost. - * Since the sweep goes from left to right, face->anEdge should - * be close to the edge we want. - */ - up = face.anEdge; - assert (up.Lnext != up && up.Lnext.Lnext != up); - - for (; Geom.VertLeq(up.Sym.Org, up.Org); up = up.Onext.Sym) - ; - for (; Geom.VertLeq(up.Org, up.Sym.Org); up = up.Lnext) - ; - lo = up.Onext.Sym; - - while (up.Lnext != lo) { - if (Geom.VertLeq(up.Sym.Org, lo.Org)) { - /* up.Sym.Org is on the left. It is safe to form triangles from lo.Org. - * The EdgeGoesLeft test guarantees progress even when some triangles - * are CW, given that the upper and lower chains are truly monotone. - */ - while (lo.Lnext != up && (Geom.EdgeGoesLeft(lo.Lnext) - || Geom.EdgeSign(lo.Org, lo.Sym.Org, lo.Lnext.Sym.Org) <= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); - if (tempHalfEdge == null) return false; - lo = tempHalfEdge.Sym; - } - lo = lo.Onext.Sym; - } else { - /* lo.Org is on the left. We can make CCW triangles from up.Sym.Org. */ - while (lo.Lnext != up && (Geom.EdgeGoesRight(up.Onext.Sym) - || Geom.EdgeSign(up.Sym.Org, up.Org, up.Onext.Sym.Org) >= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); - if (tempHalfEdge == null) return false; - up = tempHalfEdge.Sym; - } - up = up.Lnext; - } - } - - /* Now lo.Org == up.Sym.Org == the leftmost vertex. The remaining region - * can be tessellated in a fan from this leftmost vertex. - */ - assert (lo.Lnext != up); - while (lo.Lnext.Lnext != up) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); - if (tempHalfEdge == null) return false; - lo = tempHalfEdge.Sym; - } - - return true; - } - - -/* __gl_meshTessellateInterior( mesh ) tessellates each region of - * the mesh which is marked "inside" the polygon. Each such region - * must be monotone. - */ - public static boolean __gl_meshTessellateInterior(GLUmesh mesh) { - GLUface f, next; - - /*LINTED*/ - for (f = mesh.fHead.next; f != mesh.fHead; f = next) { - /* Make sure we don''t try to tessellate the new triangles. */ - next = f.next; - if (f.inside) { - if (!__gl_meshTessellateMonoRegion(f)) return false; - } - } - - return true; - } - - -/* __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces - * which are not marked "inside" the polygon. Since further mesh operations - * on NULL faces are not allowed, the main purpose is to clean up the - * mesh so that exterior loops are not represented in the data structure. - */ - public static void __gl_meshDiscardExterior(GLUmesh mesh) { - GLUface f, next; - - /*LINTED*/ - for (f = mesh.fHead.next; f != mesh.fHead; f = next) { - /* Since f will be destroyed, save its next pointer. */ - next = f.next; - if (!f.inside) { - Mesh.__gl_meshZapFace(f); - } - } - } - - private static final int MARKED_FOR_DELETION = 0x7fffffff; - -/* __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the - * winding numbers on all edges so that regions marked "inside" the - * polygon have a winding number of "value", and regions outside - * have a winding number of 0. - * - * If keepOnlyBoundary is TRUE, it also deletes all edges which do not - * separate an interior region from an exterior one. - */ - public static boolean __gl_meshSetWindingNumber(GLUmesh mesh, int value, boolean keepOnlyBoundary) { - GLUhalfEdge e, eNext; - - for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { - eNext = e.next; - if (e.Sym.Lface.inside != e.Lface.inside) { - - /* This is a boundary edge (one side is interior, one is exterior). */ - e.winding = (e.Lface.inside) ? value : -value; - } else { - - /* Both regions are interior, or both are exterior. */ - if (!keepOnlyBoundary) { - e.winding = 0; - } else { - if (!Mesh.__gl_meshDelete(e)) return false; - } - } - } - return true; - } - -} diff --git a/src/net/java/games/jogl/impl/tesselator/TessState.java b/src/net/java/games/jogl/impl/tesselator/TessState.java deleted file mode 100644 index 6d89d4678..000000000 --- a/src/net/java/games/jogl/impl/tesselator/TessState.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Portions Copyright (C) 2003 Sun Microsystems, Inc. -* All rights reserved. -*/ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -** Author: Eric Veach, July 1994 -** Java Port: Pepijn Van Eeckhoudt, July 2003 -** Java Port: Nathan Parker Burg, August 2003 -*/ -package net.java.games.jogl.impl.tesselator; - - -class TessState { - public static final int T_DORMANT = 0; - public static final int T_IN_POLYGON = 1; - public static final int T_IN_CONTOUR = 2; -} diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java deleted file mode 100644 index e838c68aa..000000000 --- a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java +++ /dev/null @@ -1,717 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.windows; - -import java.awt.Component; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.awt.Rectangle; -import java.util.*; -import net.java.games.gluegen.runtime.*; // for PROCADDRESS_VAR_PREFIX -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public abstract class WindowsGLContext extends GLContext { - private static JAWT jawt; - protected long hglrc; - protected long hdc; - private boolean wglGetExtensionsStringEXTInitialized; - private boolean wglGetExtensionsStringEXTAvailable; - private static final Map/**/ functionNameMap; - private static final Map/**/ extensionNameMap; - // Table that holds the addresses of the native C-language entry points for - // OpenGL functions. - private GLProcAddressTable glProcAddressTable; - // Handle to GLU32.dll - private long hglu32; - private boolean haveWGLARBPbuffer = true; - - private static final int MAX_PFORMATS = 256; - private static final int MAX_ATTRIBS = 256; - - static { - functionNameMap = new HashMap(); - functionNameMap.put("glAllocateMemoryNV", "wglAllocateMemoryNV"); - functionNameMap.put("glFreeMemoryNV", "wglFreeMemoryNV"); - - extensionNameMap = new HashMap(); - extensionNameMap.put("GL_ARB_pbuffer", "WGL_ARB_pbuffer"); - extensionNameMap.put("GL_ARB_pixel_format", "WGL_ARB_pixel_format"); - } - - public WindowsGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(component, capabilities, chooser, shareWith); - } - - protected GL createGL() - { - return new WindowsGLImpl(this); - } - - protected String mapToRealGLFunctionName(String glFunctionName) { - String lookup = (String) functionNameMap.get(glFunctionName); - if (lookup != null) { - return lookup; - } - return glFunctionName; - } - - protected String mapToRealGLExtensionName(String glExtensionName) { - String lookup = (String) extensionNameMap.get(glExtensionName); - if (lookup != null) { - return lookup; - } - return glExtensionName; - } - - protected abstract boolean isOffscreen(); - - public int getOffscreenContextWidth() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextHeight() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextPixelDataType() { - throw new GLException("Should not call this"); - } - - public abstract int getOffscreenContextReadBuffer(); - - public abstract boolean offscreenImageNeedsVerticalFlip(); - - /** - * Creates and initializes an appropriate OpenGL context. Should only be - * called by {@link #makeCurrent(Runnable)}. - */ - protected abstract void create(); - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - boolean created = false; - if (hglrc == 0) { - create(); - if (DEBUG) { - System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName()); - } - created = true; - } - - boolean skipMakeCurrent = false; - if (NO_FREE) { - if (WGL.wglGetCurrentContext() == hglrc) { - if (DEBUG && VERBOSE) { - System.err.println(getThreadName() + ": skipping wglMakeCurrent because context already current"); - } - skipMakeCurrent = true; - } - } - - if (!skipMakeCurrent) { - if (!WGL.wglMakeCurrent(hdc, hglrc)) { - throw new GLException("Error making context current: " + WGL.GetLastError()); - } else { - if (DEBUG && VERBOSE) { - System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + hdcToString(hdc) + - ", hglrc " + hdcToString(hglrc) + ") succeeded"); - } - } - } - - if (created) { - resetGLFunctionAvailability(); - haveWGLARBPbuffer = (isExtensionAvailable("WGL_ARB_pbuffer") && - isExtensionAvailable("WGL_ARB_pixel_format")); - // Windows can set up sharing of display lists after creation time - WindowsGLContext other = (WindowsGLContext) GLContextShareSet.getShareContext(this); - if (other != null) { - long hglrc2 = other.getHGLRC(); - if (hglrc2 == 0) { - throw new GLException("GLContextShareSet returned an invalid OpenGL context"); - } - if (!WGL.wglShareLists(hglrc2, hglrc)) { - throw new GLException("wglShareLists(0x" + Long.toHexString(hglrc2) + - ", 0x" + Long.toHexString(hglrc) + ") failed: error code " + - WGL.GetLastError()); - } - } - GLContextShareSet.contextCreated(this); - - initAction.run(); - } - return true; - } - - protected synchronized void free() throws GLException { - if (!NO_FREE) { - if (!WGL.wglMakeCurrent(0, 0)) { - throw new GLException("Error freeing OpenGL context: " + WGL.GetLastError()); - } - } - } - - protected void destroyImpl() throws GLException { - if (hglrc != 0) { - if (!WGL.wglDeleteContext(hglrc)) { - throw new GLException("Unable to delete OpenGL context"); - } - if (DEBUG) { - System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + hglrc); - } - hglrc = 0; - } - } - - public abstract void swapBuffers() throws GLException; - - protected long dynamicLookupFunction(String glFuncName) { - long res = WGL.wglGetProcAddress(glFuncName); - if (res == 0) { - // GLU routines aren't known to the OpenGL function lookup - if (hglu32 == 0) { - hglu32 = WGL.LoadLibraryA("GLU32"); - if (hglu32 == 0) { - throw new GLException("Error loading GLU32.DLL"); - } - } - res = WGL.GetProcAddress(hglu32, glFuncName); - } - return res; - } - - public boolean isCreated() { - return (hglrc != 0); - } - - protected void resetGLFunctionAvailability() { - super.resetGLFunctionAvailability(); - if (DEBUG) { - System.err.println(getThreadName() + ": !!! Initializing OpenGL extension address table"); - } - resetProcAddressTable(getGLProcAddressTable()); - } - - public GLProcAddressTable getGLProcAddressTable() { - if (glProcAddressTable == null) { - // FIXME: cache ProcAddressTables by capability bits so we can - // share them among contexts with the same capabilities - glProcAddressTable = new GLProcAddressTable(); - } - return glProcAddressTable; - } - - public String getPlatformExtensionsString() { - if (!wglGetExtensionsStringEXTInitialized) { - wglGetExtensionsStringEXTAvailable = (WGL.wglGetProcAddress("wglGetExtensionsStringEXT") != 0); - wglGetExtensionsStringEXTInitialized = true; - } - if (wglGetExtensionsStringEXTAvailable) { - return gl.wglGetExtensionsStringEXT(); - } else { - return ""; - } - } - - protected boolean isFunctionAvailable(String glFunctionName) - { - boolean available = super.isFunctionAvailable(glFunctionName); - - // Sanity check for implementations that use proc addresses for run-time - // linking: if the function IS available, then make sure there's a proc - // address for it if it's an extension or not part of the OpenGL 1.1 core - // (post GL 1.1 functions are run-time linked on windows). - assert(!available || - (getGLProcAddressTable().getAddressFor(mapToRealGLFunctionName(glFunctionName)) != 0 || - FunctionAvailabilityCache.isPartOfGLCore("1.1", mapToRealGLFunctionName(glFunctionName))) - ); - - return available; - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected JAWT getJAWT() { - if (jawt == null) { - JAWT j = new JAWT(); - j.version(JAWTFactory.JAWT_VERSION_1_4); - if (!JAWTFactory.JAWT_GetAWT(j)) { - throw new RuntimeException("Unable to initialize JAWT"); - } - jawt = j; - } - return jawt; - } - - // Helper routine for the overridden create() to call - protected void choosePixelFormatAndCreateContext(boolean onscreen) { - PIXELFORMATDESCRIPTOR pfd = null; - int pixelFormat = 0; - if (onscreen) { - GLCapabilities[] availableCaps = null; - int numFormats = 0; - pfd = newPixelFormatDescriptor(); - GraphicsConfiguration config = component.getGraphicsConfiguration(); - GraphicsDevice device = config.getDevice(); - // Produce a recommended pixel format selection for the GLCapabilitiesChooser. - // Use wglChoosePixelFormatARB if user requested multisampling and if we have it available - GL dummyGL = null; - if (capabilities.getSampleBuffers()) { - dummyGL = WindowsGLContextFactory.getDummyGL(device); - } - int recommendedPixelFormat = -1; - boolean haveWGLChoosePixelFormatARB = false; - boolean haveWGLARBMultisample = false; - if (dummyGL != null) { - String availableWGLExtensions = WindowsGLContextFactory.getDummyGLExtensions(device); - if (availableWGLExtensions.indexOf("WGL_ARB_pixel_format") >= 0) { - haveWGLChoosePixelFormatARB = true; - if (availableWGLExtensions.indexOf("WGL_ARB_multisample") >= 0) { - haveWGLARBMultisample = true; - } - } - } - Rectangle rect = config.getBounds(); - long dc = 0; - long rc = 0; - boolean freeWGLC = false; - if( dummyGL != null ) { - dc = WindowsGLContextFactory.getDummyGLContext( device ).hdc; - rc = WindowsGLContextFactory.getDummyGLContext( device ).hglrc; - if( !WGL.wglMakeCurrent( dc, rc ) ) { - System.err.println(getThreadName() + ": Error Making WGLC Current: " + WGL.GetLastError() ); - } else { - freeWGLC = true; - } - } - // Fallback path for older cards, in particular Intel Extreme motherboard graphics - boolean gotAvailableCaps = false; - if (dummyGL != null && haveWGLChoosePixelFormatARB) { - int[] iattributes = new int [2 * MAX_ATTRIBS]; - int[] iresults = new int [2 * MAX_ATTRIBS]; - float[] fattributes = new float[2 * MAX_ATTRIBS]; - int niattribs = 0; - int nfattribs = 0; - iattributes[niattribs++] = GL.WGL_SUPPORT_OPENGL_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - iattributes[niattribs++] = GL.WGL_DRAW_TO_WINDOW_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB; - iattributes[niattribs++] = GL.WGL_TYPE_RGBA_ARB; - iattributes[niattribs++] = GL.WGL_DOUBLE_BUFFER_ARB; - if (capabilities.getDoubleBuffered()) { - iattributes[niattribs++] = GL.GL_TRUE; - } else { - iattributes[niattribs++] = GL.GL_FALSE; - } - iattributes[niattribs++] = GL.WGL_STEREO_ARB; - if (capabilities.getStereo()) { - iattributes[niattribs++] = GL.GL_TRUE; - } else { - iattributes[niattribs++] = GL.GL_FALSE; - } - iattributes[niattribs++] = GL.WGL_DEPTH_BITS_ARB; - iattributes[niattribs++] = capabilities.getDepthBits(); - iattributes[niattribs++] = GL.WGL_RED_BITS_ARB; - iattributes[niattribs++] = capabilities.getRedBits(); - iattributes[niattribs++] = GL.WGL_GREEN_BITS_ARB; - iattributes[niattribs++] = capabilities.getGreenBits(); - iattributes[niattribs++] = GL.WGL_BLUE_BITS_ARB; - iattributes[niattribs++] = capabilities.getBlueBits(); - iattributes[niattribs++] = GL.WGL_ALPHA_BITS_ARB; - iattributes[niattribs++] = capabilities.getAlphaBits(); - iattributes[niattribs++] = GL.WGL_STENCIL_BITS_ARB; - iattributes[niattribs++] = capabilities.getStencilBits(); - if (capabilities.getAccumRedBits() > 0 || - capabilities.getAccumGreenBits() > 0 || - capabilities.getAccumBlueBits() > 0 || - capabilities.getAccumAlphaBits() > 0) { - iattributes[niattribs++] = GL.WGL_ACCUM_BITS_ARB; - iattributes[niattribs++] = (capabilities.getAccumRedBits() + - capabilities.getAccumGreenBits() + - capabilities.getAccumBlueBits() + - capabilities.getAccumAlphaBits()); - iattributes[niattribs++] = GL.WGL_ACCUM_RED_BITS_ARB; - iattributes[niattribs++] = capabilities.getAccumRedBits(); - iattributes[niattribs++] = GL.WGL_ACCUM_GREEN_BITS_ARB; - iattributes[niattribs++] = capabilities.getAccumGreenBits(); - iattributes[niattribs++] = GL.WGL_ACCUM_BLUE_BITS_ARB; - iattributes[niattribs++] = capabilities.getAccumBlueBits(); - iattributes[niattribs++] = GL.WGL_ACCUM_ALPHA_BITS_ARB; - iattributes[niattribs++] = capabilities.getAccumAlphaBits(); - } - if (haveWGLARBMultisample) { - if (capabilities.getSampleBuffers()) { - iattributes[niattribs++] = GL.WGL_SAMPLE_BUFFERS_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - iattributes[niattribs++] = GL.WGL_SAMPLES_ARB; - iattributes[niattribs++] = capabilities.getNumSamples(); - } - } - - int[] pformats = new int[MAX_PFORMATS]; - int[] numFormatsTmp = new int[1]; - if (dummyGL.wglChoosePixelFormatARB(hdc, - iattributes, - fattributes, - MAX_PFORMATS, - pformats, - numFormatsTmp)) { - numFormats = numFormatsTmp[0]; - if (numFormats > 0) { - // Remove one-basing of pixel format (added on later) - recommendedPixelFormat = pformats[0] - 1; - if (DEBUG) { - System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat); - } - } - } else { - if (DEBUG) { - System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + WGL.GetLastError() ); - Thread.dumpStack(); - } - } - if (DEBUG) { - if (recommendedPixelFormat < 0) { - System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format"); - if (capabilities.getSampleBuffers()) { - System.err.print(" for multisampled GLCapabilities"); - } - System.err.println(); - } - } - - // Produce a list of GLCapabilities to give to the - // GLCapabilitiesChooser. - // Use wglGetPixelFormatAttribivARB instead of - // DescribePixelFormat to get higher-precision information - // about the pixel format (should make the GLCapabilities - // more precise as well...i.e., remove the - // "HardwareAccelerated" bit, which is basically - // meaningless, and put in whether it can render to a - // window, to a pbuffer, or to a pixmap) - niattribs = 0; - iattributes[0] = GL.WGL_NUMBER_PIXEL_FORMATS_ARB; - if (dummyGL.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, iresults)) { - numFormats = iresults[0]; - // Should we be filtering out the pixel formats which aren't - // applicable, as we are doing here? - // We don't have enough information in the GLCapabilities to - // represent those that aren't... - iattributes[niattribs++] = GL.WGL_DRAW_TO_WINDOW_ARB; - iattributes[niattribs++] = GL.WGL_ACCELERATION_ARB; - iattributes[niattribs++] = GL.WGL_SUPPORT_OPENGL_ARB; - iattributes[niattribs++] = GL.WGL_DEPTH_BITS_ARB; - iattributes[niattribs++] = GL.WGL_STENCIL_BITS_ARB; - iattributes[niattribs++] = GL.WGL_DOUBLE_BUFFER_ARB; - iattributes[niattribs++] = GL.WGL_STEREO_ARB; - iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB; - iattributes[niattribs++] = GL.WGL_RED_BITS_ARB; - iattributes[niattribs++] = GL.WGL_GREEN_BITS_ARB; - iattributes[niattribs++] = GL.WGL_BLUE_BITS_ARB; - iattributes[niattribs++] = GL.WGL_ALPHA_BITS_ARB; - iattributes[niattribs++] = GL.WGL_ACCUM_RED_BITS_ARB; - iattributes[niattribs++] = GL.WGL_ACCUM_GREEN_BITS_ARB; - iattributes[niattribs++] = GL.WGL_ACCUM_BLUE_BITS_ARB; - iattributes[niattribs++] = GL.WGL_ACCUM_ALPHA_BITS_ARB; - if (haveWGLARBMultisample) { - iattributes[niattribs++] = GL.WGL_SAMPLE_BUFFERS_ARB; - iattributes[niattribs++] = GL.WGL_SAMPLES_ARB; - } - - availableCaps = new GLCapabilities[numFormats]; - for (int i = 0; i < numFormats; i++) { - if (!dummyGL.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, iresults)) { - throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); - } - availableCaps[i] = iattributes2GLCapabilities(iattributes, iresults, niattribs, true); - } - if( freeWGLC ) { - WGL.wglMakeCurrent( 0, 0 ); - } - gotAvailableCaps = true; - } else { - int lastErr = WGL.GetLastError(); - // Intel Extreme graphics fails with a zero error code - if (lastErr != 0) { - throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError()); - } - } - } - - if (!gotAvailableCaps) { - if (DEBUG) { - if (!capabilities.getSampleBuffers()) { - System.err.println(getThreadName() + ": Using ChoosePixelFormat because multisampling not requested"); - } else { - System.err.println(getThreadName() + ": Using ChoosePixelFormat because no wglChoosePixelFormatARB: dummyGL = " + dummyGL); - } - } - pfd = glCapabilities2PFD(capabilities, onscreen); - // Remove one-basing of pixel format (added on later) - recommendedPixelFormat = WGL.ChoosePixelFormat(hdc, pfd) - 1; - - numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null); - if (numFormats == 0) { - throw new GLException("Unable to enumerate pixel formats of window for GLCapabilitiesChooser"); - } - availableCaps = new GLCapabilities[numFormats]; - for (int i = 0; i < numFormats; i++) { - if (WGL.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) { - throw new GLException("Error describing pixel format " + (1 + i) + " of device context"); - } - availableCaps[i] = pfd2GLCapabilities(pfd); - } - } - - // Supply information to chooser - pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); - if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { - throw new GLException("Invalid result " + pixelFormat + - " from GLCapabilitiesChooser (should be between 0 and " + - (numFormats - 1) + ")"); - } - if (DEBUG) { - System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):"); - System.err.println(availableCaps[pixelFormat]); - } - pixelFormat += 1; // one-base the index - if (WGL.DescribePixelFormat(hdc, pixelFormat, pfd.size(), pfd) == 0) { - throw new GLException("Error re-describing the chosen pixel format: " + WGL.GetLastError()); - } - } else { - // For now, use ChoosePixelFormat for offscreen surfaces until - // we figure out how to properly choose an offscreen- - // compatible pixel format - pfd = glCapabilities2PFD(capabilities, onscreen); - pixelFormat = WGL.ChoosePixelFormat(hdc, pfd); - } - if (!WGL.SetPixelFormat(hdc, pixelFormat, pfd)) { - int lastError = WGL.GetLastError(); - if (DEBUG) { - System.err.println(getThreadName() + ": SetPixelFormat failed: current context = " + WGL.wglGetCurrentContext() + - ", current DC = " + WGL.wglGetCurrentDC()); - System.err.println(getThreadName() + ": GetPixelFormat(hdc " + hdcToString(hdc) + ") returns " + WGL.GetPixelFormat(hdc)); - } - throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + hdcToString(hdc) + ": error code " + lastError); - } - hglrc = WGL.wglCreateContext(hdc); - if (DEBUG) { - System.err.println(getThreadName() + ": !!! Created OpenGL context " + hglrc + " for device context " + hdcToString(hdc) + " using pixel format " + pixelFormat); - } - if (hglrc == 0) { - throw new GLException("Unable to create OpenGL context"); - } - } - - protected long getHGLRC() { - return hglrc; - } - - static PIXELFORMATDESCRIPTOR glCapabilities2PFD(GLCapabilities caps, boolean onscreen) { - int colorDepth = (caps.getRedBits() + - caps.getGreenBits() + - caps.getBlueBits()); - if (colorDepth < 15) { - throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported"); - } - PIXELFORMATDESCRIPTOR pfd = newPixelFormatDescriptor(); - int pfdFlags = (WGL.PFD_SUPPORT_OPENGL | - WGL.PFD_GENERIC_ACCELERATED); - if (caps.getDoubleBuffered()) { - pfdFlags |= WGL.PFD_DOUBLEBUFFER; - } - if (onscreen) { - pfdFlags |= WGL.PFD_DRAW_TO_WINDOW; - } else { - pfdFlags |= WGL.PFD_DRAW_TO_BITMAP; - } - pfd.dwFlags(pfdFlags); - pfd.iPixelType((byte) WGL.PFD_TYPE_RGBA); - pfd.cColorBits((byte) colorDepth); - pfd.cRedBits ((byte) caps.getRedBits()); - pfd.cGreenBits((byte) caps.getGreenBits()); - pfd.cBlueBits ((byte) caps.getBlueBits()); - pfd.cAlphaBits((byte) caps.getAlphaBits()); - int accumDepth = (caps.getAccumRedBits() + - caps.getAccumGreenBits() + - caps.getAccumBlueBits()); - pfd.cAccumBits ((byte) accumDepth); - pfd.cAccumRedBits ((byte) caps.getAccumRedBits()); - pfd.cAccumGreenBits((byte) caps.getAccumGreenBits()); - pfd.cAccumBlueBits ((byte) caps.getAccumBlueBits()); - pfd.cAccumAlphaBits((byte) caps.getAccumAlphaBits()); - pfd.cDepthBits((byte) caps.getDepthBits()); - pfd.cStencilBits((byte) caps.getStencilBits()); - pfd.iLayerType((byte) WGL.PFD_MAIN_PLANE); - return pfd; - } - - static PIXELFORMATDESCRIPTOR newPixelFormatDescriptor() { - PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR(); - pfd.nSize((short) pfd.size()); - pfd.nVersion((short) 1); - return pfd; - } - - static GLCapabilities pfd2GLCapabilities(PIXELFORMATDESCRIPTOR pfd) { - if ((pfd.dwFlags() & WGL.PFD_SUPPORT_OPENGL) == 0) { - return null; - } - GLCapabilities res = new GLCapabilities(); - res.setRedBits (pfd.cRedBits()); - res.setGreenBits (pfd.cGreenBits()); - res.setBlueBits (pfd.cBlueBits()); - res.setAlphaBits (pfd.cAlphaBits()); - res.setAccumRedBits (pfd.cAccumRedBits()); - res.setAccumGreenBits(pfd.cAccumGreenBits()); - res.setAccumBlueBits (pfd.cAccumBlueBits()); - res.setAccumAlphaBits(pfd.cAccumAlphaBits()); - res.setDepthBits (pfd.cDepthBits()); - res.setStencilBits (pfd.cStencilBits()); - res.setDoubleBuffered((pfd.dwFlags() & WGL.PFD_DOUBLEBUFFER) != 0); - res.setStereo ((pfd.dwFlags() & WGL.PFD_STEREO) != 0); - res.setHardwareAccelerated(((pfd.dwFlags() & WGL.PFD_GENERIC_FORMAT) == 0) || - ((pfd.dwFlags() & WGL.PFD_GENERIC_ACCELERATED) != 0)); - return res; - } - - static GLCapabilities iattributes2GLCapabilities(int[] iattribs, - int[] iresults, - int niattribs, - boolean requireRenderToWindow) { - GLCapabilities res = new GLCapabilities(); - for (int i = 0; i < niattribs; i++) { - switch (iattribs[i]) { - case GL.WGL_DRAW_TO_WINDOW_ARB: - if (iresults[i] != GL.GL_TRUE) - return null; - break; - - case GL.WGL_ACCELERATION_ARB: - res.setHardwareAccelerated(iresults[i] == GL.WGL_FULL_ACCELERATION_ARB); - break; - - case GL.WGL_SUPPORT_OPENGL_ARB: - if (iresults[i] != GL.GL_TRUE) - return null; - break; - - case GL.WGL_DEPTH_BITS_ARB: - res.setDepthBits(iresults[i]); - break; - - case GL.WGL_STENCIL_BITS_ARB: - res.setStencilBits(iresults[i]); - break; - - case GL.WGL_DOUBLE_BUFFER_ARB: - res.setDoubleBuffered(iresults[i] == GL.GL_TRUE); - break; - - case GL.WGL_STEREO_ARB: - res.setStereo(iresults[i] == GL.GL_TRUE); - break; - - case GL.WGL_PIXEL_TYPE_ARB: - if (iresults[i] != GL.WGL_TYPE_RGBA_ARB) - return null; - break; - - case GL.WGL_RED_BITS_ARB: - res.setRedBits(iresults[i]); - break; - - case GL.WGL_GREEN_BITS_ARB: - res.setGreenBits(iresults[i]); - break; - - case GL.WGL_BLUE_BITS_ARB: - res.setBlueBits(iresults[i]); - break; - - case GL.WGL_ALPHA_BITS_ARB: - res.setAlphaBits(iresults[i]); - break; - - case GL.WGL_ACCUM_RED_BITS_ARB: - res.setAccumRedBits(iresults[i]); - break; - - case GL.WGL_ACCUM_GREEN_BITS_ARB: - res.setAccumGreenBits(iresults[i]); - break; - - case GL.WGL_ACCUM_BLUE_BITS_ARB: - res.setAccumBlueBits(iresults[i]); - break; - - case GL.WGL_ACCUM_ALPHA_BITS_ARB: - res.setAccumAlphaBits(iresults[i]); - break; - - case GL.WGL_SAMPLE_BUFFERS_ARB: - res.setSampleBuffers(iresults[i] == GL.GL_TRUE); - break; - - case GL.WGL_SAMPLES_ARB: - res.setNumSamples(iresults[i]); - break; - - default: - throw new GLException("Unknown pixel format attribute " + iattribs[i]); - } - } - return res; - } - - protected static String hdcToString(long hdc) { - return "0x" + Long.toHexString(hdc); - } - - protected boolean haveWGLARBPbuffer() { - return haveWGLARBPbuffer; - } -} diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java b/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java deleted file mode 100644 index dd6f8daca..000000000 --- a/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.windows; - -import java.awt.Component; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.awt.Rectangle; -import java.io.File; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.Collection; -import java.util.Iterator; -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class WindowsGLContextFactory extends GLContextFactory { - private static final boolean DEBUG = Debug.debug("WindowsGLContextFactory"); - private static final boolean VERBOSE = Debug.verbose(); - - // On Windows we want to be able to use some extension routines like - // wglChoosePixelFormatARB during the creation of the user's first - // GLContext. However, this and other routines' function pointers - // aren't loaded by the driver until the first OpenGL context is - // created. The standard way of working around this chicken-and-egg - // problem is to create a dummy window, show it, send it a paint - // message, create an OpenGL context, fetch the needed function - // pointers, and then destroy the dummy window and context. It turns - // out that ATI cards need the dummy context to be current while - // wglChoosePixelFormatARB is called, so we cache the extension - // strings the dummy context reports as being available. - private static Map/**/ dummyContextMap = new HashMap(); - private static Map/**/ dummyExtensionsMap = new HashMap(); - private static Set/**/ pendingContextSet = new HashSet(); - - public WindowsGLContextFactory() { - AccessController.doPrivileged( new PrivilegedAction() { - public Object run() { - Runtime.getRuntime().addShutdownHook( new ShutdownHook() ); - - // Test for whether we should enable the single-threaded - // workaround for ATI cards. It appears that if we make any - // OpenGL context current on more than one thread on ATI cards - // on Windows then we see random failures like the inability - // to create more OpenGL contexts, or having just the next - // OpenGL SetPixelFormat operation fail with a GetNextError() - // code of 0 (but subsequent ones on subsequently-created - // windows succeed). These kinds of failures are obviously due - // to bugs in ATI's OpenGL drivers. Through trial and error it - // was found that specifying - // -DJOGL_SINGLE_THREADED_WORKAROUND=true on the command line - // caused these problems to completely disappear. Therefore at - // least on Windows we try to enable the single-threaded - // workaround before creating any OpenGL contexts. In the - // future, if problems are encountered on other platforms and - // -DJOGL_SINGLE_THREADED_WORKAROUND=true works around them, - // we may want to implement a workaround like this on other - // platforms. - - // The algorithm here is to try to find the system directory - // (assuming it is on the same drive as TMPDIR, exposed - // through the system property java.io.tmpdir) and see whether - // a known file in the ATI drivers is present; if it is, we - // enable the single-threaded workaround. - - // If any path down this code fails, we simply bail out -- we - // don't go to great lengths to figure out if the ATI drivers - // are present. We could add more checks here in the future if - // these appear to be insufficient. - - String tmpDirProp = System.getProperty("java.io.tmpdir"); - if (tmpDirProp != null) { - File file = new File(tmpDirProp); - if (file.isAbsolute()) { - File parent = null; - do { - parent = file.getParentFile(); - if (parent != null) { - file = parent; - } - } while (parent != null); - // Now the file contains just the drive letter - file = new File(new File(new File(file, "windows"), "system32"), "atioglxx.dll"); - if (file.exists()) { - SingleThreadedWorkaround.shouldDoWorkaround(); - } - } - } - - return( null ); - } - }); - } - - public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device) { - return null; - } - - public GLContext createGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - if (component != null) { - return new WindowsOnscreenGLContext(component, capabilities, chooser, shareWith); - } else { - return new WindowsOffscreenGLContext(capabilities, chooser, shareWith); - } - } - - // Return cached GL context - public static WindowsGLContext getDummyGLContext( final GraphicsDevice device ) { - checkForDummyContext( device ); - NativeWindowStruct nws = (NativeWindowStruct) dummyContextMap.get(device); - return nws.getWindowsContext(); - } - - // Return cached extension string - public static String getDummyGLExtensions(final GraphicsDevice device) { - checkForDummyContext( device ); - String exts = (String) dummyExtensionsMap.get(device); - return (exts == null) ? "" : exts; - } - - // Return cached GL function pointers - public static GL getDummyGL(final GraphicsDevice device) { - checkForDummyContext( device ); - NativeWindowStruct nws = (NativeWindowStruct) dummyContextMap.get(device); - return( nws.getWindowsContext().getGL() ); - } - - /* - * Locate a cached native window, if one doesn't exist create one amd - * cache it. - */ - private static void checkForDummyContext( final GraphicsDevice device ) { - if (!pendingContextSet.contains(device) && !dummyContextMap.containsKey( device ) ) { - if (DEBUG) { - System.err.println("WindowsGLContextFactory.checkForDummyContext() called on thread " + - Thread.currentThread().getName()); - } - - pendingContextSet.add(device); - GraphicsConfiguration config = device.getDefaultConfiguration(); - Rectangle rect = config.getBounds(); - GLCapabilities caps = new GLCapabilities(); - caps.setDepthBits( 16 ); - // Create a context that we use to query pixel formats - WindowsOnscreenGLContext context = new WindowsOnscreenGLContext( null, caps, null, null ); - // Start a native thread and grab native screen resources from the thread - NativeWindowThread nwt = new NativeWindowThread( rect ); - nwt.start(); - long hWnd = 0; - long tempHDC = 0; - while( (hWnd = nwt.getHWND()) == 0 || (tempHDC = nwt.getHDC()) == 0 ) { - Thread.yield(); - } - // Choose a hardware accelerated pixel format - PIXELFORMATDESCRIPTOR pfd = context.glCapabilities2PFD( caps, true ); - int pixelFormat = WGL.ChoosePixelFormat( tempHDC, pfd ); - if( pixelFormat == 0 ) { - System.err.println("Pixel Format is Zero"); - pendingContextSet.remove(device); - return; - } - // Set the hardware accelerated pixel format - if (!WGL.SetPixelFormat(tempHDC, pixelFormat, pfd)) { - System.err.println("SetPixelFormat Failed"); - pendingContextSet.remove( device ); - return; - } - // Create a rendering context - long tempHGLRC = WGL.wglCreateContext( tempHDC ); - if( hWnd == 0 || tempHDC == 0 || tempHGLRC == 0 ) { - pendingContextSet.remove( device ); - return; - } - // Store native handles for later use - NativeWindowStruct nws = new NativeWindowStruct(); - nws.setHWND( hWnd ); - nws.setWindowsContext( context ); - nws.setWindowThread( nwt ); - long currentHDC = WGL.wglGetCurrentDC(); - long currentHGLRC = WGL.wglGetCurrentContext(); - // Make the new hardware accelerated context current - if( !WGL.wglMakeCurrent( tempHDC, tempHGLRC ) ) { - pendingContextSet.remove( device ); - return; - } - // Grab function pointers - context.hdc = tempHDC; - context.hglrc = tempHGLRC; - context.resetGLFunctionAvailability(); - context.createGL(); - pendingContextSet.remove( device ); - dummyContextMap.put( device, nws ); - String availableGLExtensions = ""; - String availableWGLExtensions = ""; - String availableEXTExtensions = ""; - try { - availableWGLExtensions = context.getGL().wglGetExtensionsStringARB( currentHDC ); - } catch( GLException e ) { - } - try { - availableEXTExtensions = context.getGL().wglGetExtensionsStringEXT(); - } catch( GLException e ) { - } - availableGLExtensions = context.getGL().glGetString( GL.GL_EXTENSIONS ); - dummyExtensionsMap.put(device, availableGLExtensions + " " + availableEXTExtensions + " " + availableWGLExtensions); - WGL.wglMakeCurrent( currentHDC, currentHGLRC ); - } - } - - /* - * This class stores handles to native resources that need to be destroyed - * at JVM shutdown. - */ - static class NativeWindowStruct { - private long HWND; - private WindowsGLContext windowsContext; - private Thread windowThread; - - public NativeWindowStruct() { - } - - public long getHDC() { - return( windowsContext.hdc ); - } - - public long getHGLRC() { - return( windowsContext.hglrc ); - } - - public void setHWND( long hwnd ) { - HWND = hwnd; - } - - public long getHWND() { - return( HWND ); - } - - public void setWindowsContext( WindowsGLContext context ) { - windowsContext = context; - } - - public WindowsGLContext getWindowsContext() { - return( windowsContext ); - } - - public void setWindowThread( Thread thread ) { - windowThread = thread; - } - - public Thread getWindowThread() { - return( windowThread ); - } - } - - /* - * Native HWDN and HDC handles must be created and destroyed on the same - * thread. - */ - - static class NativeWindowThread extends Thread { - private long HWND = 0; - private long HDC = 0; - private Rectangle rectangle; - - public NativeWindowThread( Rectangle rect ) { - rectangle = rect; - } - - public synchronized long getHWND() { - return( HWND ); - } - - public synchronized long getHDC() { - return( HDC ); - } - - public void run() { - // Create a native window and device context - synchronized (WindowsGLContextFactory.class) { - HWND = WGL.CreateDummyWindow( rectangle.x, rectangle.y, rectangle.width, rectangle.height ); - } - HDC = WGL.GetDC( HWND ); - - // Start the message pump at shutdown - WGL.NativeEventLoop(); - } - } - - /* - * This class is registered with the JVM to destroy all cached redering - * contexts, device contexts, and window handles. - */ - - class ShutdownHook extends Thread { - public void run() { - // Collect all saved screen resources - Collection c = dummyContextMap.values(); - Iterator iter = c.iterator(); - while( iter.hasNext() ) { - // NativeWindowStruct holds refs to native resources that need to be destroyed - NativeWindowStruct struct = (NativeWindowStruct)iter.next(); - // Restart native window threads to respond to window closing events - synchronized( struct.getWindowThread() ) { - struct.getWindowThread().notifyAll(); - } - // Destroy OpenGL rendering context - if( !WGL.wglDeleteContext( struct.getHGLRC() ) ) { - System.err.println( "Error Destroying NativeWindowStruct RC: " + WGL.GetLastError() ); - } - // Send context handles to native method for deletion - WGL.DestroyDummyWindow( struct.getHWND(), struct.getHDC() ); - } - } - } -} diff --git a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java deleted file mode 100644 index c70607da7..000000000 --- a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.windows; - -import java.awt.image.BufferedImage; -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class WindowsOffscreenGLContext extends WindowsGLContext { - private long origbitmap; - private long hbitmap; - // Width and height of the underlying bitmap - private int width; - private int height; - - public WindowsOffscreenGLContext(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(null, capabilities, chooser, shareWith); - } - - protected GL createGL() - { - return new WindowsGLImpl(this); - } - - protected boolean isOffscreen() { - return true; - } - - public int getOffscreenContextWidth() { - return width; - } - - public int getOffscreenContextHeight() { - return height; - } - - public int getOffscreenContextPixelDataType() { - return GL.GL_UNSIGNED_BYTE; - } - - public int getOffscreenContextReadBuffer() { - // On Windows these contexts are always single-buffered - return GL.GL_FRONT; - } - - public boolean offscreenImageNeedsVerticalFlip() { - // We can take care of this in the DIB creation (see below) - return false; - } - - public boolean canCreatePbufferContext() { - // For now say no - return false; - } - - public synchronized GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - if (pendingOffscreenResize) { - if (pendingOffscreenWidth != width || pendingOffscreenHeight != height) { - if (hglrc != 0) { - destroyImpl(); - } - width = pendingOffscreenWidth; - height = pendingOffscreenHeight; - pendingOffscreenResize = false; - } - } - return super.makeCurrent(initAction); - } - - protected void destroyImpl() { - if (hglrc != 0) { - super.destroyImpl(); - // Must destroy OpenGL context, bitmap and device context - WGL.SelectObject(hdc, origbitmap); - WGL.DeleteObject(hbitmap); - WGL.DeleteDC(hdc); - origbitmap = 0; - hbitmap = 0; - hdc = 0; - } - } - - public synchronized void swapBuffers() throws GLException { - } - - protected void create() { - BITMAPINFO info = new BITMAPINFO(); - BITMAPINFOHEADER header = info.bmiHeader(); - int bitsPerPixel = (capabilities.getRedBits() + - capabilities.getGreenBits() + - capabilities.getBlueBits()); - header.biSize(header.size()); - header.biWidth(width); - // NOTE: negating the height causes the DIB to be in top-down row - // order rather than bottom-up; ends up being correct during pixel - // readback - header.biHeight(-1 * height); - header.biPlanes((short) 1); - header.biBitCount((short) bitsPerPixel); - header.biXPelsPerMeter(0); - header.biYPelsPerMeter(0); - header.biClrUsed(0); - header.biClrImportant(0); - header.biCompression(WGL.BI_RGB); - header.biSizeImage(width * height * bitsPerPixel / 8); - - hdc = WGL.CreateCompatibleDC(0); - if (hdc == 0) { - System.out.println("LastError: " + WGL.GetLastError()); - throw new GLException("Error creating device context for offscreen OpenGL context"); - } - hbitmap = WGL.CreateDIBSection(hdc, info, WGL.DIB_RGB_COLORS, 0, 0, 0); - if (hbitmap == 0) { - throw new GLException("Error creating offscreen bitmap of width " + width + - ", height " + height); - } - if ((origbitmap = WGL.SelectObject(hdc, hbitmap)) == 0) { - throw new GLException("Error selecting bitmap into new device context"); - } - - choosePixelFormatAndCreateContext(false); - } -} diff --git a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java deleted file mode 100644 index 0dc1818fb..000000000 --- a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.windows; - -import java.awt.Component; -import java.util.*; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class WindowsOnscreenGLContext extends WindowsGLContext { - // Variables for lockSurface/unlockSurface - JAWT_DrawingSurface ds; - JAWT_DrawingSurfaceInfo dsi; - JAWT_Win32DrawingSurfaceInfo win32dsi; - - // Variables for pbuffer support - List pbuffersToInstantiate = new ArrayList(); - - public WindowsOnscreenGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(component, capabilities, chooser, shareWith); - } - - public void invokeGL(Runnable runnable, boolean isReshape, Runnable initAction) throws GLException { - // Unfortunately, invokeGL can be called with the AWT tree lock - // held, and the Windows onscreen implementation of - // choosePixelFormatAndCreateContext calls - // Component.getGraphicsConfiguration(), which grabs the tree - // lock. To avoid deadlock we have to lock the tree lock before - // grabbing the GLContext's lock if we're going to create an - // OpenGL context during this call. This code might not be - // completely correct, and we might need to uniformly grab the AWT - // tree lock, which might become a performance issue... - if (hglrc == 0) { - synchronized(component.getTreeLock()) { - super.invokeGL(runnable, isReshape, initAction); - } - } else { - super.invokeGL(runnable, isReshape, initAction); - } - } - - protected GL createGL() - { - return new WindowsGLImpl(this); - } - - protected boolean isOffscreen() { - return false; - } - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - public boolean canCreatePbufferContext() { - return haveWGLARBPbuffer(); - } - - public synchronized GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - WindowsPbufferGLContext ctx = new WindowsPbufferGLContext(capabilities, initialWidth, initialHeight); - pbuffersToInstantiate.add(ctx); - return ctx; - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - try { - if (!lockSurface()) { - return false; - } - boolean ret = super.makeCurrent(initAction); - if (ret) { - // Instantiate any pending pbuffers - while (!pbuffersToInstantiate.isEmpty()) { - WindowsPbufferGLContext ctx = - (WindowsPbufferGLContext) pbuffersToInstantiate.remove(pbuffersToInstantiate.size() - 1); - ctx.createPbuffer(hdc, hglrc); - } - } - return ret; - } catch (RuntimeException e) { - try { - unlockSurface(); - } catch (Exception e2) { - // do nothing if unlockSurface throws - } - throw(e); - } - } - - protected synchronized void free() throws GLException { - try { - super.free(); - } finally { - unlockSurface(); - } - } - - public synchronized void swapBuffers() throws GLException { - if (!WGL.SwapBuffers(hdc) && (WGL.GetLastError() != 0)) { - throw new GLException("Error swapping buffers"); - } - } - - private boolean lockSurface() throws GLException { - if (hdc != 0) { - throw new GLException("Surface already locked"); - } - ds = getJAWT().GetDrawingSurface(component); - if (ds == null) { - // Widget not yet realized - return false; - } - int res = ds.Lock(); - if ((res & JAWTFactory.JAWT_LOCK_ERROR) != 0) { - throw new GLException("Unable to lock surface"); - } - // See whether the surface changed and if so destroy the old - // OpenGL context so it will be recreated (NOTE: removeNotify - // should handle this case, but it may be possible that race - // conditions can cause this code to be triggered -- should test - // more) - if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { - if (hglrc != 0) { - if (!WGL.wglDeleteContext(hglrc)) { - throw new GLException("Unable to delete old GL context after surface changed"); - } - GLContextShareSet.contextDestroyed(this); - if (DEBUG) { - System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + hglrc + " due to JAWT_LOCK_SURFACE_CHANGED"); - } - hglrc = 0; - } - } - dsi = ds.GetDrawingSurfaceInfo(); - if (dsi == null) { - // Widget not yet realized - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - return false; - } - win32dsi = (JAWT_Win32DrawingSurfaceInfo) dsi.platformInfo(); - hdc = win32dsi.hdc(); - if (hdc == 0) { - // Widget not yet realized - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - win32dsi = null; - return false; - } - return true; - } - - private void unlockSurface() { - if (hdc == 0) { - throw new GLException("Surface already unlocked"); - } - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - win32dsi = null; - hdc = 0; - } - - protected void create() { - choosePixelFormatAndCreateContext(true); - } -} diff --git a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java deleted file mode 100644 index 1d5d78296..000000000 --- a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java +++ /dev/null @@ -1,529 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.windows; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class WindowsPbufferGLContext extends WindowsGLContext { - private static final boolean DEBUG = Debug.debug("WindowsPbufferGLContext"); - - private int initWidth; - private int initHeight; - - private long buffer; // pbuffer handle - private int width; - private int height; - - // FIXME: kept around because we create the OpenGL context lazily to - // better integrate with the WindowsGLContext framework - private long parentHglrc; - - private static final int MAX_PFORMATS = 256; - private static final int MAX_ATTRIBS = 256; - - // State for render-to-texture and render-to-texture-rectangle support - private boolean created; - private boolean rtt; // render-to-texture? - private boolean hasRTT; // render-to-texture extension available? - private boolean rect; // render-to-texture-rectangle? - private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV - private int texture; // actual texture object - private int floatMode; - - public WindowsPbufferGLContext(GLCapabilities capabilities, int initialWidth, int initialHeight) { - super(null, capabilities, null, null); - this.initWidth = initialWidth; - this.initHeight = initialHeight; - if (initWidth <= 0 || initHeight <= 0) { - throw new GLException("Initial width and height of pbuffer must be positive (were (" + - initWidth + ", " + initHeight + "))"); - } - - if (DEBUG) { - System.out.println("Pbuffer caps on init: " + capabilities + - (capabilities.getOffscreenRenderToTexture() ? " [rtt]" : "") + - (capabilities.getOffscreenRenderToTextureRectangle() ? " [rect]" : "") + - (capabilities.getOffscreenFloatingPointBuffers() ? " [float]" : "")); - } - } - - public boolean canCreatePbufferContext() { - return false; - } - - public GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - public void bindPbufferToTexture() { - if (!rtt) { - throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); - } - GL gl = getGL(); - gl.glBindTexture(textureTarget, texture); - if (rtt && hasRTT) { - if (!gl.wglBindTexImageARB(buffer, GL.WGL_FRONT_LEFT_ARB)) { - throw new GLException("Binding of pbuffer to texture failed: " + wglGetLastError()); - } - } - // Note that if the render-to-texture extension is not supported, - // we perform a glCopyTexImage2D in swapBuffers(). - } - - public void releasePbufferFromTexture() { - if (!rtt) { - throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); - } - if (rtt && hasRTT) { - GL gl = getGL(); - if (!gl.wglReleaseTexImageARB(buffer, GL.WGL_FRONT_LEFT_ARB)) { - throw new GLException("Releasing of pbuffer from texture failed: " + wglGetLastError()); - } - } - } - - public void createPbuffer(long parentHdc, long parentHglrc) { - GL gl = getGL(); - // Must initally grab OpenGL function pointers while parent's - // context is current because otherwise we don't have the wgl - // extensions available to us - resetGLFunctionAvailability(); - - int[] iattributes = new int [2*MAX_ATTRIBS]; - float[] fattributes = new float[2*MAX_ATTRIBS]; - int nfattribs = 0; - int niattribs = 0; - - if (DEBUG) { - System.out.println("Pbuffer caps: " + capabilities + - (capabilities.getOffscreenRenderToTexture() ? " [rtt]" : "") + - (capabilities.getOffscreenRenderToTextureRectangle() ? " [rect]" : "") + - (capabilities.getOffscreenFloatingPointBuffers() ? " [float]" : "")); - } - - rtt = capabilities.getOffscreenRenderToTexture(); - rect = capabilities.getOffscreenRenderToTextureRectangle(); - boolean useFloat = capabilities.getOffscreenFloatingPointBuffers(); - boolean ati = false; - - // Since we are trying to create a pbuffer, the pixel format we - // request (and subsequently use) must be "p-buffer capable". - iattributes[niattribs++] = GL.WGL_DRAW_TO_PBUFFER_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - - if (rtt && !rect) { - throw new GLException("Render-to-texture-rectangle requires render-to-texture to be specified"); - } - - if (rect) { - if (!gl.isExtensionAvailable("GL_NV_texture_rectangle")) { - throw new GLException("Render-to-texture-rectangle requires GL_NV_texture_rectangle extension"); - } - } - - if (useFloat) { - if (!gl.isExtensionAvailable("WGL_ATI_pixel_format_float") && - !gl.isExtensionAvailable("WGL_NV_float_buffer")) { - throw new GLException("Floating-point pbuffers not supported by this hardware"); - } - - // Prefer NVidia extension over ATI - if (gl.isExtensionAvailable("WGL_NV_float_buffer")) { - ati = false; - floatMode = GLPbuffer.NV_FLOAT; - } else { - ati = true; - floatMode = GLPbuffer.ATI_FLOAT; - } - if (DEBUG) { - System.err.println("Using " + (ati ? "ATI" : "NVidia") + " floating-point extension"); - } - } - - if (useFloat && ati) { - if (rtt) { - throw new GLException("Render-to-floating-point-texture not supported on ATI hardware"); - } else { - iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB; - iattributes[niattribs++] = GL.WGL_TYPE_RGBA_FLOAT_ATI; - } - } else { - if (!rtt) { - // Currently we don't support non-truecolor visuals in the - // GLCapabilities, so we don't offer the option of making - // color-index pbuffers. - iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB; - iattributes[niattribs++] = GL.WGL_TYPE_RGBA_ARB; - } - } - - iattributes[niattribs++] = GL.WGL_DOUBLE_BUFFER_ARB; - if (capabilities.getDoubleBuffered()) { - iattributes[niattribs++] = GL.GL_TRUE; - } else { - iattributes[niattribs++] = GL.GL_FALSE; - } - - iattributes[niattribs++] = GL.WGL_DEPTH_BITS_ARB; - iattributes[niattribs++] = capabilities.getDepthBits(); - - iattributes[niattribs++] = GL.WGL_RED_BITS_ARB; - iattributes[niattribs++] = capabilities.getRedBits(); - - iattributes[niattribs++] = GL.WGL_GREEN_BITS_ARB; - iattributes[niattribs++] = capabilities.getGreenBits(); - - iattributes[niattribs++] = GL.WGL_BLUE_BITS_ARB; - iattributes[niattribs++] = capabilities.getBlueBits(); - - iattributes[niattribs++] = GL.WGL_ALPHA_BITS_ARB; - iattributes[niattribs++] = capabilities.getAlphaBits(); - - iattributes[niattribs++] = GL.WGL_STENCIL_BITS_ARB; - if (capabilities.getStencilBits() > 0) { - iattributes[niattribs++] = GL.GL_TRUE; - } else { - iattributes[niattribs++] = GL.GL_FALSE; - } - - if (capabilities.getAccumRedBits() > 0 || - capabilities.getAccumGreenBits() > 0 || - capabilities.getAccumBlueBits() > 0) { - iattributes[niattribs++] = GL.WGL_ACCUM_BITS_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - } - - if (useFloat && !ati) { - iattributes[niattribs++] = GL.WGL_FLOAT_COMPONENTS_NV; - iattributes[niattribs++] = GL.GL_TRUE; - } - - if (rtt) { - if (useFloat) { - assert(!ati); - if (!rect) { - throw new GLException("Render-to-floating-point-texture only supported on NVidia hardware with render-to-texture-rectangle"); - } - iattributes[niattribs++] = GL.WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV; - iattributes[niattribs++] = GL.GL_TRUE; - } else { - iattributes[niattribs++] = rect ? GL.WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV : GL.WGL_BIND_TO_TEXTURE_RGB_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - } - } - - iattributes[niattribs++] = GL.WGL_SUPPORT_OPENGL_ARB; - iattributes[niattribs++] = GL.GL_TRUE; - - int[] pformats = new int[MAX_PFORMATS]; - int nformats; - int[] nformatsTmp = new int[1]; - if (!gl.wglChoosePixelFormatARB(parentHdc, - iattributes, - fattributes, - MAX_PFORMATS, - pformats, - nformatsTmp)) { - throw new GLException("pbuffer creation error: wglChoosePixelFormatARB() failed"); - } - nformats = nformatsTmp[0]; - if (nformats <= 0) { - throw new GLException("pbuffer creation error: Couldn't find a suitable pixel format"); - } - - if (DEBUG) { - System.err.println("" + nformats + " suitable pixel formats found"); - // query pixel format - iattributes[0] = GL.WGL_RED_BITS_ARB; - iattributes[1] = GL.WGL_GREEN_BITS_ARB; - iattributes[2] = GL.WGL_BLUE_BITS_ARB; - iattributes[3] = GL.WGL_ALPHA_BITS_ARB; - iattributes[4] = GL.WGL_DEPTH_BITS_ARB; - iattributes[5] = (useFloat ? (ati ? GL.WGL_PIXEL_TYPE_ARB : GL.WGL_FLOAT_COMPONENTS_NV) : GL.WGL_RED_BITS_ARB); - iattributes[6] = GL.WGL_SAMPLE_BUFFERS_EXT; - iattributes[7] = GL.WGL_SAMPLES_EXT; - iattributes[8] = GL.WGL_DRAW_TO_PBUFFER_ARB; - int[] ivalues = new int[9]; - for (int i = 0; i < nformats; i++) { - if (!gl.wglGetPixelFormatAttribivARB(parentHdc, pformats[i], 0, 9, iattributes, ivalues)) { - throw new GLException("Error while querying pixel format " + pformats[i] + - "'s (index " + i + "'s) capabilities for debugging"); - } - System.err.print("pixel format " + pformats[i] + " (index " + i + "): "); - System.err.print( "r: " + ivalues[0]); - System.err.print(" g: " + ivalues[1]); - System.err.print(" b: " + ivalues[2]); - System.err.print(" a: " + ivalues[3]); - System.err.print(" depth: " + ivalues[4]); - System.err.print(" multisample: " + ivalues[6]); - System.err.print(" samples: " + ivalues[7]); - if (useFloat) { - if (ati) { - if (ivalues[5] == GL.WGL_TYPE_RGBA_FLOAT_ATI) { - System.err.print(" [ati float]"); - } else if (ivalues[5] != GL.WGL_TYPE_RGBA_ARB) { - System.err.print(" [unknown pixel type " + ivalues[5] + "]"); - } - } else { - if (ivalues[5] != 0) { - System.err.print(" [float]"); - } - } - } - - if (ivalues[8] != 0) { - System.err.print(" [pbuffer]"); - } - System.err.println(); - } - } - - long tmpBuffer = 0; - int whichFormat = 0; - // Loop is a workaround for bugs in NVidia's recent drivers - do { - int format = pformats[whichFormat]; - - // Create the p-buffer. - niattribs = 0; - - if (rtt) { - iattributes[niattribs++] = GL.WGL_TEXTURE_FORMAT_ARB; - if (useFloat) { - iattributes[niattribs++] = GL.WGL_TEXTURE_FLOAT_RGB_NV; - } else { - iattributes[niattribs++] = GL.WGL_TEXTURE_RGBA_ARB; - } - - iattributes[niattribs++] = GL.WGL_TEXTURE_TARGET_ARB; - iattributes[niattribs++] = rect ? GL.WGL_TEXTURE_RECTANGLE_NV : GL.WGL_TEXTURE_2D_ARB; - - iattributes[niattribs++] = GL.WGL_MIPMAP_TEXTURE_ARB; - iattributes[niattribs++] = GL.GL_FALSE; - - iattributes[niattribs++] = GL.WGL_PBUFFER_LARGEST_ARB; - iattributes[niattribs++] = GL.GL_FALSE; - } - - iattributes[niattribs++] = 0; - - tmpBuffer = gl.wglCreatePbufferARB(parentHdc, format, initWidth, initHeight, iattributes); - ++whichFormat; - } while ((tmpBuffer == 0) && (whichFormat < nformats)); - - if (tmpBuffer == 0) { - throw new GLException("pbuffer creation error: wglCreatePbufferARB() failed: tried " + nformats + - " pixel formats, last error was: " + wglGetLastError()); - } - - // Get the device context. - long tmpHdc = gl.wglGetPbufferDCARB(tmpBuffer); - if (tmpHdc == 0) { - throw new GLException("pbuffer creation error: wglGetPbufferDCARB() failed"); - } - - this.parentHglrc = parentHglrc; - - // Set up instance variables - buffer = tmpBuffer; - hdc = tmpHdc; - - // Determine the actual width and height we were able to create. - int[] tmp = new int[1]; - gl.wglQueryPbufferARB( buffer, GL.WGL_PBUFFER_WIDTH_ARB, tmp ); - width = tmp[0]; - gl.wglQueryPbufferARB( buffer, GL.WGL_PBUFFER_HEIGHT_ARB, tmp ); - height = tmp[0]; - - if (DEBUG) { - System.err.println("Created pbuffer " + width + " x " + height); - } - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - created = false; - - if (buffer == 0) { - // pbuffer not instantiated yet - if (DEBUG) { - System.err.println("pbuffer not instantiated yet"); - } - return false; - } - - boolean res = super.makeCurrent(initAction); - if (DEBUG) { - System.err.println("super.makeCurrent() = " + res + ", created = " + created); - } - if (created) { - // Initialize render-to-texture support if requested - rtt = capabilities.getOffscreenRenderToTexture(); - rect = capabilities.getOffscreenRenderToTextureRectangle(); - - if (rtt) { - if (DEBUG) { - System.err.println("Initializing render-to-texture support"); - } - - if (!gl.isExtensionAvailable("WGL_ARB_render_texture")) { - System.err.println("WindowsPbufferGLContext: WARNING: WGL_ARB_render_texture extension not " + - "supported; implementing render_to_texture support using slow texture readback"); - } else { - hasRTT = true; - GL gl = getGL(); - - if (rect && !gl.isExtensionAvailable("GL_NV_texture_rectangle")) { - System.err.println("WindowsPbufferGLContext: WARNING: GL_NV_texture_rectangle extension not " + - "supported; skipping requested render_to_texture_rectangle support for pbuffer"); - rect = false; - } - if (rect) { - if (DEBUG) { - System.err.println(" Using render-to-texture-rectangle"); - } - textureTarget = GL.GL_TEXTURE_RECTANGLE_NV; - } else { - if (DEBUG) { - System.err.println(" Using vanilla render-to-texture"); - } - textureTarget = GL.GL_TEXTURE_2D; - } - int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); - texture = tmp[0]; - gl.glBindTexture(textureTarget, texture); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); - gl.glCopyTexImage2D(textureTarget, 0, GL.GL_RGB, 0, 0, width, height, 0); - } - } - } - return res; - } - - public void handleModeSwitch(long parentHdc, long parentHglrc) { - throw new GLException("Not yet implemented"); - } - - protected boolean isOffscreen() { - // FIXME: currently the only caller of this won't cause proper - // resizing of the pbuffer anyway. - return false; - } - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - protected void create() { - created = true; - // Create a gl context for the p-buffer. - hglrc = WGL.wglCreateContext(hdc); - if (hglrc == 0) { - throw new GLException("pbuffer creation error: wglCreateContext() failed"); - } - - // FIXME: provide option to not share display lists with subordinate pbuffer? - if (!WGL.wglShareLists(parentHglrc, hglrc)) { - throw new GLException("pbuffer: wglShareLists() failed"); - } - } - - protected void destroyImpl() throws GLException { - if (hglrc != 0) { - super.destroyImpl(); - // Must release DC and pbuffer - // NOTE that since the context is not current, glGetError() can - // not be called here, so we skip the use of any composable - // pipelines - GL gl = createGL(); - if (gl.wglReleasePbufferDCARB(buffer, hdc) == 0) { - throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError()); - } - hdc = 0; - if (!gl.wglDestroyPbufferARB(buffer)) { - throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError()); - } - buffer = 0; - } - } - - public void swapBuffers() throws GLException { - // FIXME: do we need to do anything if the pbuffer is double-buffered? - // For now, just grab the pixels for the render-to-texture support. - if (rtt && !hasRTT) { - if (DEBUG) { - System.err.println("Copying pbuffer data to GL_TEXTURE_2D state"); - } - - GL gl = getGL(); - gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, width, height); - } - } - - public int getFloatingPointMode() { - return floatMode; - } - - private String wglGetLastError() { - int err = WGL.GetLastError(); - String detail = null; - switch (err) { - case WGL.ERROR_INVALID_PIXEL_FORMAT: detail = "ERROR_INVALID_PIXEL_FORMAT"; break; - case WGL.ERROR_NO_SYSTEM_RESOURCES: detail = "ERROR_NO_SYSTEM_RESOURCES"; break; - case WGL.ERROR_INVALID_DATA: detail = "ERROR_INVALID_DATA"; break; - case WGL.ERROR_PROC_NOT_FOUND: detail = "ERROR_PROC_NOT_FOUND"; break; - case WGL.ERROR_INVALID_WINDOW_HANDLE:detail = "ERROR_INVALID_WINDOW_HANDLE"; break; - default: detail = "(Unknown error code " + err + ")"; break; - } - return detail; - } -} diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java deleted file mode 100644 index 53f44101f..000000000 --- a/src/net/java/games/jogl/impl/x11/X11GLContext.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.x11; - -import java.awt.Component; -import java.security.*; -import java.util.*; -import net.java.games.gluegen.runtime.*; // for PROCADDRESS_VAR_PREFIX -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public abstract class X11GLContext extends GLContext { - protected long display; - protected long drawable; - protected long visualID; - protected long context; - private boolean glXQueryExtensionsStringInitialized; - private boolean glXQueryExtensionsStringAvailable; - private static final Map/**/ functionNameMap; - private boolean isGLX13; - // Table that holds the addresses of the native C-language entry points for - // OpenGL functions. - private GLProcAddressTable glProcAddressTable; - private static boolean haveResetGLXProcAddressTable; - // Cache the most recent value of the "display" variable (which we - // only guarantee to be valid in between makeCurrent / free pairs) - // so that we can implement displayImpl() (which must be done when - // the context is not current) - protected long mostRecentDisplay; - // There is currently a bug on Linux/AMD64 distributions in glXGetProcAddressARB - protected static boolean isLinuxAMD64; - - static { - functionNameMap = new HashMap(); - functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV"); - functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV"); - - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String os = System.getProperty("os.name").toLowerCase(); - String arch = System.getProperty("os.arch").toLowerCase(); - if (os.startsWith("linux") && arch.equals("amd64")) { - isLinuxAMD64 = true; - } - return null; - } - }); - } - - public X11GLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(component, capabilities, chooser, shareWith); - } - - protected GL createGL() - { - return new X11GLImpl(this); - } - - protected String mapToRealGLFunctionName(String glFunctionName) { - String lookup = (String) functionNameMap.get(glFunctionName); - if (lookup != null) { - return lookup; - } - return glFunctionName; - } - - protected String mapToRealGLExtensionName(String glExtensionName) { - return glExtensionName; - } - - protected abstract boolean isOffscreen(); - - public int getOffscreenContextWidth() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextHeight() { - throw new GLException("Should not call this"); - } - - public int getOffscreenContextPixelDataType() { - throw new GLException("Should not call this"); - } - - public abstract int getOffscreenContextReadBuffer(); - - public abstract boolean offscreenImageNeedsVerticalFlip(); - - public synchronized void setRenderingThread(Thread currentThreadOrNull, Runnable initAction) { - this.willSetRenderingThread = false; - // FIXME: the JAWT on X11 grabs the AWT lock while the - // DrawingSurface is locked, which means that no other events can - // be processed. Currently we handle this by preventing the - // effects of setRenderingThread. We should figure out a better - // solution that is reasonably robust. Must file a bug to be fixed - // in the 1.5 JAWT. - } - - /** - * Creates and initializes an appropriate OpenGl context. Should only be - * called by {@link makeCurrent(Runnable)}. - */ - protected abstract void create(); - - public boolean isExtensionAvailable(String glExtensionName) { - if (glExtensionName.equals("GL_ARB_pbuffer") || - glExtensionName.equals("GL_ARB_pixel_format")) { - return isGLX13; - } - return super.isExtensionAvailable(glExtensionName); - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - boolean created = false; - if (context == 0) { - create(); - if (DEBUG) { - System.err.println("!!! Created GL context for " + getClass().getName()); - } - created = true; - } - if (drawable == 0) { - throw new GLException("Unable to make context current; drawable was null"); - } - - // FIXME: this cast to int would be wrong on 64-bit platforms - // where the argument type to glXMakeCurrent would change (should - // probably make GLXDrawable, and maybe XID, Opaque as long) - if (!GLX.glXMakeCurrent(display, (int) drawable, context)) { - throw new GLException("Error making context current"); - } - - if (created) { - resetGLFunctionAvailability(); - initAction.run(); - } - return true; - } - - protected synchronized void free() throws GLException { - if (!GLX.glXMakeCurrent(display, 0, 0)) { - throw new GLException("Error freeing OpenGL context"); - } - } - - protected void destroyImpl() throws GLException { - lockAWT(); - if (context != 0) { - GLX.glXDestroyContext(mostRecentDisplay, context); - if (DEBUG) { - System.err.println("!!! Destroyed OpenGL context " + context); - } - context = 0; - } - unlockAWT(); - } - - public abstract void swapBuffers() throws GLException; - - protected long dynamicLookupFunction(String glFuncName) { - long res = 0; - if (!isLinuxAMD64) { - res = GLX.glXGetProcAddressARB(glFuncName); - } - if (res == 0) { - // GLU routines aren't known to the OpenGL function lookup - res = GLX.dlsym(glFuncName); - } - return res; - } - - public boolean isCreated() { - return (context != 0); - } - - protected void resetGLFunctionAvailability() { - super.resetGLFunctionAvailability(); - if (DEBUG) { - System.err.println("!!! Initializing OpenGL extension address table"); - } - resetProcAddressTable(getGLProcAddressTable()); - - if (!haveResetGLXProcAddressTable) { - resetProcAddressTable(GLX.getGLXProcAddressTable()); - } - - // Figure out whether we are running GLX version 1.3 or above and - // therefore have pbuffer support - if (display == 0) { - throw new GLException("Expected non-null DISPLAY for querying GLX version"); - } - int[] major = new int[1]; - int[] minor = new int[1]; - if (!GLX.glXQueryVersion(display, major, minor)) { - throw new GLException("glXQueryVersion failed"); - } - if (DEBUG) { - System.err.println("!!! GLX version: major " + major[0] + - ", minor " + minor[0]); - } - - // Work around bugs in ATI's Linux drivers where they report they - // only implement GLX version 1.2 but actually do support pbuffers - if (major[0] == 1 && minor[0] == 2) { - GL gl = getGL(); - String str = gl.glGetString(GL.GL_VENDOR); - if (str != null && str.indexOf("ATI") >= 0) { - isGLX13 = true; - return; - } - } - - isGLX13 = ((major[0] > 1) || (minor[0] > 2)); - } - - public GLProcAddressTable getGLProcAddressTable() { - if (glProcAddressTable == null) { - // FIXME: cache ProcAddressTables by capability bits so we can - // share them among contexts with the same capabilities - glProcAddressTable = new GLProcAddressTable(); - } - return glProcAddressTable; - } - - public synchronized String getPlatformExtensionsString() { - if (display == 0) { - throw new GLException("Context not current"); - } - if (!glXQueryExtensionsStringInitialized) { - glXQueryExtensionsStringAvailable = (dynamicLookupFunction("glXQueryExtensionsString") != 0); - glXQueryExtensionsStringInitialized = true; - } - if (glXQueryExtensionsStringAvailable) { - lockAWT(); - try { - String ret = GLX.glXQueryExtensionsString(display, GLX.DefaultScreen(display)); - if (DEBUG) { - System.err.println("!!! GLX extensions: " + ret); - } - return ret; - } finally { - unlockAWT(); - } - } else { - return ""; - } - } - - protected boolean isFunctionAvailable(String glFunctionName) - { - boolean available = super.isFunctionAvailable(glFunctionName); - - // Sanity check for implementations that use proc addresses for run-time - // linking: if the function IS available, then make sure there's a proc - // address for it if it's an extension or not part of the OpenGL 1.1 core - // (post GL 1.1 functions are run-time linked on windows). - assert(!available || - (getGLProcAddressTable().getAddressFor(mapToRealGLFunctionName(glFunctionName)) != 0 || - FunctionAvailabilityCache.isPartOfGLCore("1.1", mapToRealGLFunctionName(glFunctionName))) - ); - - return available; - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected JAWT getJAWT() { - return X11GLContextFactory.getJAWT(); - } - - protected XVisualInfo chooseVisual() { - if (!isOffscreen()) { - // The visual has already been chosen by the time we get here; - // it's specified by the GraphicsConfiguration of the - // GLCanvas. Fortunately, the JAWT supplies the visual ID for - // the component in a portable fashion, so all we have to do is - // use XGetVisualInfo with a VisualIDMask to get the - // corresponding XVisualInfo to pass into glXChooseVisual. - int[] count = new int[1]; - XVisualInfo template = new XVisualInfo(); - // FIXME: probably not 64-bit clean - template.visualid((int) visualID); - XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualIDMask, template, count); - if (infos == null || infos.length == 0) { - throw new GLException("Error while getting XVisualInfo for visual ID " + visualID); - } - // FIXME: the storage for the infos array is leaked (should - // clean it up somehow when we're done with the visual we're - // returning) - return infos[0]; - } else { - // It isn't clear to me whether we need this much code to handle - // the offscreen case, where we're creating a pixmap into which - // to render...this is what we (incorrectly) used to do for the - // onscreen case - - int screen = 0; // FIXME: provide way to specify this? - XVisualInfo vis = null; - int[] count = new int[1]; - XVisualInfo template = new XVisualInfo(); - template.screen(screen); - XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count); - if (infos == null) { - throw new GLException("Error while enumerating available XVisualInfos"); - } - GLCapabilities[] caps = new GLCapabilities[infos.length]; - for (int i = 0; i < infos.length; i++) { - caps[i] = X11GLContextFactory.xvi2GLCapabilities(display, infos[i]); - } - int chosen = chooser.chooseCapabilities(capabilities, caps, -1); - if (chosen < 0 || chosen >= caps.length) { - throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); - } - if (DEBUG) { - System.err.println("Chosen visual (" + chosen + "):"); - System.err.println(caps[chosen]); - } - vis = infos[chosen]; - if (vis == null) { - throw new GLException("GLCapabilitiesChooser chose an invalid visual"); - } - // FIXME: the storage for the infos array is leaked (should - // clean it up somehow when we're done with the visual we're - // returning) - - return vis; - } - } - - protected long createContext(XVisualInfo vis, boolean onscreen) { - X11GLContext other = (X11GLContext) GLContextShareSet.getShareContext(this); - long share = 0; - if (other != null) { - share = other.getContext(); - if (share == 0) { - throw new GLException("GLContextShareSet returned an invalid OpenGL context"); - } - } - long res = GLX.glXCreateContext(display, vis, share, onscreen); - if (res != 0) { - GLContextShareSet.contextCreated(this); - } - return res; - } - - // Helper routine for the overridden create() to call - protected void chooseVisualAndCreateContext(boolean onscreen) { - XVisualInfo vis = chooseVisual(); - context = createContext(vis, onscreen); - if (context == 0) { - throw new GLException("Unable to create OpenGL context"); - } - } - - protected long getContext() { - return context; - } - - // These synchronization primitives prevent the AWT from making - // requests from the X server asynchronously to this code. - protected void lockAWT() { - X11GLContextFactory.lockAWT(); - } - - protected void unlockAWT() { - X11GLContextFactory.unlockAWT(); - } -} diff --git a/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java b/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java deleted file mode 100644 index a1b299478..000000000 --- a/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.x11; - -import java.awt.Component; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class X11GLContextFactory extends GLContextFactory { - static { - NativeLibLoader.load(); - } - - private static final int MAX_ATTRIBS = 128; - - public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device) { - int screen = X11SunJDKReflection.graphicsDeviceGetScreen(device); - // Until we have a rock-solid visual selection algorithm written - // in pure Java, we're going to provide the underlying window - // system's selection to the chooser as a hint - - int[] attribs = glCapabilities2AttribList(capabilities, isMultisampleAvailable()); - XVisualInfo[] infos = null; - GLCapabilities[] caps = null; - int recommendedIndex = -1; - lockAWT(); - try { - long display = getDisplayConnection(); - XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs); - int[] count = new int[1]; - XVisualInfo template = new XVisualInfo(); - template.screen(screen); - infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count); - if (infos == null) { - throw new GLException("Error while enumerating available XVisualInfos"); - } - caps = new GLCapabilities[infos.length]; - for (int i = 0; i < infos.length; i++) { - caps[i] = xvi2GLCapabilities(display, infos[i]); - // Attempt to find the visual chosen by glXChooseVisual - if (recommendedVis != null && recommendedVis.visualid() == infos[i].visualid()) { - recommendedIndex = i; - } - } - } finally { - unlockAWT(); - } - int chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); - if (chosen < 0 || chosen >= caps.length) { - throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); - } - XVisualInfo vis = infos[chosen]; - if (vis == null) { - throw new GLException("GLCapabilitiesChooser chose an invalid visual"); - } - // FIXME: need to look at glue code and see type of this field - long visualID = vis.visualid(); - // FIXME: the storage for the infos array, as well as that for the - // recommended visual, is leaked; should free them here with XFree() - - // Now figure out which GraphicsConfiguration corresponds to this - // visual by matching the visual ID - GraphicsConfiguration[] configs = device.getConfigurations(); - for (int i = 0; i < configs.length; i++) { - GraphicsConfiguration config = configs[i]; - if (config != null) { - if (X11SunJDKReflection.graphicsConfigurationGetVisualID(config) == visualID) { - return config; - } - } - } - - // Either we weren't able to reflectively introspect on the - // X11GraphicsConfig or something went wrong in the steps above; - // we're going to return null without signaling an error condition - // in this case (although we should distinguish between the two - // and possibly report more of an error in the latter case) - return null; - } - - public GLContext createGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - if (component != null) { - return new X11OnscreenGLContext(component, capabilities, chooser, shareWith); - } else { - return new X11OffscreenGLContext(capabilities, chooser, shareWith); - } - } - - public static GLCapabilities xvi2GLCapabilities(long display, XVisualInfo info) { - int[] tmp = new int[1]; - int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp); - if (val == 0) { - // Visual does not support OpenGL - return null; - } - val = glXGetConfig(display, info, GLX.GLX_RGBA, tmp); - if (val == 0) { - // Visual does not support RGBA - return null; - } - GLCapabilities res = new GLCapabilities(); - res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp) != 0); - res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp) != 0); - // Note: use of hardware acceleration is determined by - // glXCreateContext, not by the XVisualInfo. Optimistically claim - // that all GLCapabilities have the capability to be hardware - // accelerated. - res.setHardwareAccelerated(true); - res.setDepthBits (glXGetConfig(display, info, GLX.GLX_DEPTH_SIZE, tmp)); - res.setStencilBits (glXGetConfig(display, info, GLX.GLX_STENCIL_SIZE, tmp)); - res.setRedBits (glXGetConfig(display, info, GLX.GLX_RED_SIZE, tmp)); - res.setGreenBits (glXGetConfig(display, info, GLX.GLX_GREEN_SIZE, tmp)); - res.setBlueBits (glXGetConfig(display, info, GLX.GLX_BLUE_SIZE, tmp)); - res.setAlphaBits (glXGetConfig(display, info, GLX.GLX_ALPHA_SIZE, tmp)); - res.setAccumRedBits (glXGetConfig(display, info, GLX.GLX_ACCUM_RED_SIZE, tmp)); - res.setAccumGreenBits(glXGetConfig(display, info, GLX.GLX_ACCUM_GREEN_SIZE, tmp)); - res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp)); - res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp)); - if (isMultisampleAvailable()) { - res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS_ARB, tmp) != 0); - res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES_ARB, tmp)); - } - return res; - } - - public static int[] glCapabilities2AttribList(GLCapabilities caps, - boolean isMultisampleAvailable) { - int colorDepth = (caps.getRedBits() + - caps.getGreenBits() + - caps.getBlueBits()); - if (colorDepth < 15) { - throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported"); - } - int[] res = new int[MAX_ATTRIBS]; - int idx = 0; - res[idx++] = GLX.GLX_RGBA; - if (caps.getDoubleBuffered()) { - res[idx++] = GLX.GLX_DOUBLEBUFFER; - } - if (caps.getStereo()) { - res[idx++] = GLX.GLX_STEREO; - } - res[idx++] = GLX.GLX_RED_SIZE; - res[idx++] = caps.getRedBits(); - res[idx++] = GLX.GLX_GREEN_SIZE; - res[idx++] = caps.getGreenBits(); - res[idx++] = GLX.GLX_BLUE_SIZE; - res[idx++] = caps.getBlueBits(); - res[idx++] = GLX.GLX_ALPHA_SIZE; - res[idx++] = caps.getAlphaBits(); - res[idx++] = GLX.GLX_DEPTH_SIZE; - res[idx++] = caps.getDepthBits(); - res[idx++] = GLX.GLX_STENCIL_SIZE; - res[idx++] = caps.getStencilBits(); - res[idx++] = GLX.GLX_ACCUM_RED_SIZE; - res[idx++] = caps.getAccumRedBits(); - res[idx++] = GLX.GLX_ACCUM_GREEN_SIZE; - res[idx++] = caps.getAccumGreenBits(); - res[idx++] = GLX.GLX_ACCUM_BLUE_SIZE; - res[idx++] = caps.getAccumBlueBits(); - if (isMultisampleAvailable && caps.getSampleBuffers()) { - res[idx++] = GL.GLX_SAMPLE_BUFFERS_ARB; - res[idx++] = GL.GL_TRUE; - res[idx++] = GL.GLX_SAMPLES_ARB; - res[idx++] = caps.getNumSamples(); - } - res[idx++] = 0; - return res; - } - - // JAWT access - private static JAWT jawt; - public static JAWT getJAWT() { - if (jawt == null) { - JAWT j = new JAWT(); - j.version(JAWTFactory.JAWT_VERSION_1_4); - if (!JAWTFactory.JAWT_GetAWT(j)) { - throw new RuntimeException("Unable to initialize JAWT"); - } - jawt = j; - } - return jawt; - } - - public static void lockAWT() { - getJAWT().Lock(); - } - - public static void unlockAWT() { - getJAWT().Unlock(); - } - - // Display connection for use by visual selection algorithm and by all offscreen surfaces - private static long staticDisplay; - public static long getDisplayConnection() { - if (staticDisplay == 0) { - lockAWT(); - try { - staticDisplay = GLX.XOpenDisplay(null); - } finally { - unlockAWT(); - } - if (staticDisplay == 0) { - throw new GLException("Unable to open default display, needed for visual selection and offscreen surface handling"); - } - } - return staticDisplay; - } - - private static boolean checkedMultisample; - private static boolean multisampleAvailable; - public static boolean isMultisampleAvailable() { - if (!checkedMultisample) { - long display = getDisplayConnection(); - String exts = GLX.glXGetClientString(display, GLX.GLX_EXTENSIONS); - if (exts != null) { - multisampleAvailable = (exts.indexOf("GLX_ARB_multisample") >= 0); - } - checkedMultisample = true; - } - return multisampleAvailable; - } - - private static String glXGetConfigErrorCode(int err) { - switch (err) { - case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; - case GLX.GLX_BAD_SCREEN: return "GLX_BAD_SCREEN"; - case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE"; - case GLX.GLX_BAD_VISUAL: return "GLX_BAD_VISUAL"; - default: return "Unknown error code " + err; - } - } - - public static int glXGetConfig(long display, XVisualInfo info, int attrib, int[] tmp) { - if (display == 0) { - throw new GLException("No display connection"); - } - int res = GLX.glXGetConfig(display, info, attrib, tmp); - if (res != 0) { - throw new GLException("glXGetConfig failed: error code " + glXGetConfigErrorCode(res)); - } - return tmp[0]; - } -} diff --git a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java deleted file mode 100644 index 8f0aa06a5..000000000 --- a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.x11; - -import java.awt.image.BufferedImage; -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class X11OffscreenGLContext extends X11GLContext { - private long pixmap; - private boolean isDoubleBuffered; - // Width and height of the underlying bitmap - private int width; - private int height; - - public X11OffscreenGLContext(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(null, capabilities, chooser, shareWith); - } - - protected GL createGL() - { - return new X11GLImpl(this); - } - - protected boolean isOffscreen() { - return true; - } - - public int getOffscreenContextWidth() { - return width; - } - - public int getOffscreenContextHeight() { - return height; - } - - public int getOffscreenContextPixelDataType() { - return GL.GL_UNSIGNED_BYTE; - } - - public int getOffscreenContextReadBuffer() { - if (isDoubleBuffered) { - return GL.GL_BACK; - } - return GL.GL_FRONT; - } - - public boolean offscreenImageNeedsVerticalFlip() { - // There doesn't seem to be a way to do this in the construction - // of the Pixmap or GLXPixmap - return true; - } - - public boolean canCreatePbufferContext() { - // For now say no - return false; - } - - public synchronized GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - display = X11GLContextFactory.getDisplayConnection(); - if (pendingOffscreenResize) { - if (pendingOffscreenWidth != width || pendingOffscreenHeight != height) { - if (context != 0) { - destroy(); - } - width = pendingOffscreenWidth; - height = pendingOffscreenHeight; - pendingOffscreenResize = false; - } - } - mostRecentDisplay = display; - return super.makeCurrent(initAction); - } - - public synchronized void swapBuffers() throws GLException { - } - - protected synchronized void free() throws GLException { - try { - super.free(); - } finally { - display = 0; - } - } - - protected void create() { - XVisualInfo vis = chooseVisual(); - int bitsPerPixel = vis.depth(); - - if (display == 0) { - throw new GLException("No active display"); - } - int screen = GLX.DefaultScreen(display); - pixmap = GLX.XCreatePixmap(display, (int) GLX.RootWindow(display, screen), width, height, bitsPerPixel); - if (pixmap == 0) { - throw new GLException("XCreatePixmap failed"); - } - drawable = GLX.glXCreateGLXPixmap(display, vis, pixmap); - if (drawable == 0) { - throw new GLException("glXCreateGLXPixmap failed"); - } - context = createContext(vis, false); - if (context == 0) { - throw new GLException("Unable to create OpenGL context"); - } - isDoubleBuffered = (X11GLContextFactory.glXGetConfig(display, vis, GLX.GLX_DOUBLEBUFFER, new int[1]) != 0); - } - - protected void destroyImpl() { - if (context != 0) { - super.destroyImpl(); - // Must destroy OpenGL context, pixmap and GLXPixmap - GLX.glXDestroyContext(display, context); - GLX.glXDestroyGLXPixmap(display, (int) drawable); - GLX.XFreePixmap(display, pixmap); - context = 0; - drawable = 0; - pixmap = 0; - GLContextShareSet.contextDestroyed(this); - } - } -} diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java deleted file mode 100644 index 2fd340d79..000000000 --- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.x11; - -import java.awt.Component; -import java.util.*; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class X11OnscreenGLContext extends X11GLContext { - // Variables for lockSurface/unlockSurface - private JAWT_DrawingSurface ds; - private JAWT_DrawingSurfaceInfo dsi; - private JAWT_X11DrawingSurfaceInfo x11dsi; - - // Variables for pbuffer support - List pbuffersToInstantiate = new ArrayList(); - - public X11OnscreenGLContext(Component component, - GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GLContext shareWith) { - super(component, capabilities, chooser, shareWith); - } - - protected GL createGL() - { - return new X11GLImpl(this); - } - - protected boolean isOffscreen() { - return false; - } - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - public boolean canCreatePbufferContext() { - // FIXME: should we gate this on GLX 1.3 being available? - return true; - } - - public synchronized GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - X11PbufferGLContext ctx = new X11PbufferGLContext(capabilities, initialWidth, initialHeight); - pbuffersToInstantiate.add(ctx); - return ctx; - } - - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - public void setSwapInterval(int interval) { - GL gl = getGL(); - if (gl.isExtensionAvailable("GLX_SGI_swap_control")) { - gl.glXSwapIntervalSGI(interval); - } - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - try { - if (!lockSurface()) { - return false; - } - boolean ret = super.makeCurrent(initAction); - if (ret) { - // Instantiate any pending pbuffers - while (!pbuffersToInstantiate.isEmpty()) { - X11PbufferGLContext ctx = - (X11PbufferGLContext) pbuffersToInstantiate.remove(pbuffersToInstantiate.size() - 1); - ctx.createPbuffer(display, context, getGL()); - } - } - return ret; - } catch (RuntimeException e) { - try { - unlockSurface(); - } catch (Exception e2) { - // do nothing if unlockSurface throws - } - throw(e); - } - } - - protected synchronized void free() throws GLException { - try { - super.free(); - } finally { - unlockSurface(); - } - } - - public synchronized void swapBuffers() throws GLException { - // FIXME: this cast to int would be wrong on 64-bit platforms - // where the argument type to glXMakeCurrent would change (should - // probably make GLXDrawable, and maybe XID, Opaque as long) - GLX.glXSwapBuffers(display, (int) drawable); - } - - private boolean lockSurface() throws GLException { - if (drawable != 0) { - throw new GLException("Surface already locked"); - } - ds = getJAWT().GetDrawingSurface(component); - if (ds == null) { - // Widget not yet realized - return false; - } - int res = ds.Lock(); - if ((res & JAWTFactory.JAWT_LOCK_ERROR) != 0) { - throw new GLException("Unable to lock surface"); - } - // See whether the surface changed and if so destroy the old - // OpenGL context so it will be recreated - if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { - if (context != 0) { - GLX.glXDestroyContext(display, context); - context = 0; - } - } - dsi = ds.GetDrawingSurfaceInfo(); - if (dsi == null) { - // Widget not yet realized - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - return false; - } - x11dsi = (JAWT_X11DrawingSurfaceInfo) dsi.platformInfo(); - display = x11dsi.display(); - drawable = x11dsi.drawable(); - visualID = x11dsi.visualID(); - if (display == 0 || drawable == 0) { - // Widget not yet realized - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - x11dsi = null; - display = 0; - drawable = 0; - visualID = 0; - return false; - } - mostRecentDisplay = display; - return true; - } - - private void unlockSurface() { - if (drawable == 0) { - throw new GLException("Surface already unlocked"); - } - ds.FreeDrawingSurfaceInfo(dsi); - ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); - ds = null; - dsi = null; - x11dsi = null; - display = 0; - drawable = 0; - visualID = 0; - } - - protected void create() { - chooseVisualAndCreateContext(true); - } -} diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java deleted file mode 100644 index d9f18a760..000000000 --- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.x11; - -import net.java.games.jogl.*; -import net.java.games.jogl.impl.*; - -public class X11PbufferGLContext extends X11GLContext { - private static final boolean DEBUG = Debug.debug("X11PbufferGLContext"); - - private int initWidth; - private int initHeight; - - private long buffer; // GLXPbuffer - private GLXFBConfig fbConfig; - private int width; - private int height; - - // FIXME: kept around because we create the OpenGL context lazily to - // better integrate with the X11GLContext framework - private long parentContext; - - private static final int MAX_PFORMATS = 256; - private static final int MAX_ATTRIBS = 256; - - public X11PbufferGLContext(GLCapabilities capabilities, int initialWidth, int initialHeight) { - super(null, capabilities, null, null); - this.initWidth = initialWidth; - this.initHeight = initialHeight; - if (initWidth <= 0 || initHeight <= 0) { - throw new GLException("Initial width and height of pbuffer must be positive (were (" + - initWidth + ", " + initHeight + "))"); - } - } - - public boolean canCreatePbufferContext() { - return false; - } - - public GLContext createPbufferContext(GLCapabilities capabilities, - int initialWidth, - int initialHeight) { - throw new GLException("Not supported"); - } - - public void bindPbufferToTexture() { - // FIXME: figure out how to implement this - throw new GLException("Not yet implemented"); - } - - public void releasePbufferFromTexture() { - // FIXME: figure out how to implement this - throw new GLException("Not yet implemented"); - } - - public void createPbuffer(long display, long parentContext, GL gl) { - if (display == 0) { - throw new GLException("Null display"); - } - - if (parentContext == 0) { - throw new GLException("Null parentContext"); - } - - if (capabilities.getOffscreenRenderToTexture()) { - throw new GLException("Render-to-texture pbuffers not supported yet on X11"); - } - - if (capabilities.getOffscreenRenderToTextureRectangle()) { - throw new GLException("Render-to-texture-rectangle pbuffers not supported yet on X11"); - } - - int[] iattributes = new int [2*MAX_ATTRIBS]; - float[] fattributes = new float[2*MAX_ATTRIBS]; - int nfattribs = 0; - int niattribs = 0; - - // Since we are trying to create a pbuffer, the GLXFBConfig we - // request (and subsequently use) must be "p-buffer capable". - iattributes[niattribs++] = GL.GLX_DRAWABLE_TYPE; - iattributes[niattribs++] = GL.GLX_PBUFFER_BIT; - - iattributes[niattribs++] = GL.GLX_RENDER_TYPE; - iattributes[niattribs++] = GL.GLX_RGBA_BIT; - - iattributes[niattribs++] = GLX.GLX_DOUBLEBUFFER; - if (capabilities.getDoubleBuffered()) { - iattributes[niattribs++] = GL.GL_TRUE; - } else { - iattributes[niattribs++] = GL.GL_FALSE; - } - - iattributes[niattribs++] = GLX.GLX_DEPTH_SIZE; - iattributes[niattribs++] = capabilities.getDepthBits(); - - iattributes[niattribs++] = GLX.GLX_RED_SIZE; - iattributes[niattribs++] = capabilities.getRedBits(); - - iattributes[niattribs++] = GLX.GLX_GREEN_SIZE; - iattributes[niattribs++] = capabilities.getGreenBits(); - - iattributes[niattribs++] = GLX.GLX_BLUE_SIZE; - iattributes[niattribs++] = capabilities.getBlueBits(); - - iattributes[niattribs++] = GLX.GLX_ALPHA_SIZE; - iattributes[niattribs++] = capabilities.getAlphaBits(); - - if (capabilities.getStencilBits() > 0) { - iattributes[niattribs++] = GLX.GLX_STENCIL_SIZE; - iattributes[niattribs++] = capabilities.getStencilBits(); - } - - if (capabilities.getAccumRedBits() > 0 || - capabilities.getAccumGreenBits() > 0 || - capabilities.getAccumBlueBits() > 0) { - iattributes[niattribs++] = GLX.GLX_ACCUM_RED_SIZE; - iattributes[niattribs++] = capabilities.getAccumRedBits(); - iattributes[niattribs++] = GLX.GLX_ACCUM_GREEN_SIZE; - iattributes[niattribs++] = capabilities.getAccumGreenBits(); - iattributes[niattribs++] = GLX.GLX_ACCUM_BLUE_SIZE; - iattributes[niattribs++] = capabilities.getAccumBlueBits(); - } - - if (capabilities.getOffscreenFloatingPointBuffers()) { - if (!gl.isExtensionAvailable("GLX_NV_float_buffer")) { - throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware"); - } - iattributes[niattribs++] = GLX.GLX_FLOAT_COMPONENTS_NV; - iattributes[niattribs++] = GL.GL_TRUE; - } - - // FIXME: add FSAA support? Don't want to get into a situation - // where we have to retry the glXChooseFBConfig call if it fails - // due to a lack of an antialiased visual... - - iattributes[niattribs++] = 0; // null-terminate - - int screen = 0; // FIXME: provide way to specify this? - int[] nelementsTmp = new int[1]; - GLXFBConfig[] fbConfigs = GLX.glXChooseFBConfig(display, screen, iattributes, nelementsTmp); - if (fbConfigs == null || fbConfigs.length == 0 || fbConfigs[0] == null) { - throw new GLException("pbuffer creation error: glXChooseFBConfig() failed"); - } - // Note that we currently don't allow selection of anything but - // the first GLXFBConfig in the returned list - GLXFBConfig fbConfig = fbConfigs[0]; - int nelements = nelementsTmp[0]; - if (nelements <= 0) { - throw new GLException("pbuffer creation error: couldn't find a suitable frame buffer configuration"); - } - - if (DEBUG) { - System.err.println("Found " + fbConfigs.length + " matching GLXFBConfigs"); - System.err.println("Parameters of default one:"); - System.err.println("render type: 0x" + Integer.toHexString(queryFBConfig(display, fbConfig, GLX.GLX_RENDER_TYPE))); - System.err.println("rgba: " + ((queryFBConfig(display, fbConfig, GLX.GLX_RENDER_TYPE) & GLX.GLX_RGBA_BIT) != 0)); - System.err.println("r: " + queryFBConfig(display, fbConfig, GLX.GLX_RED_SIZE)); - System.err.println("g: " + queryFBConfig(display, fbConfig, GLX.GLX_GREEN_SIZE)); - System.err.println("b: " + queryFBConfig(display, fbConfig, GLX.GLX_BLUE_SIZE)); - System.err.println("a: " + queryFBConfig(display, fbConfig, GLX.GLX_ALPHA_SIZE)); - System.err.println("depth: " + queryFBConfig(display, fbConfig, GLX.GLX_DEPTH_SIZE)); - System.err.println("double buffered: " + queryFBConfig(display, fbConfig, GLX.GLX_DOUBLEBUFFER)); - } - - // Create the p-buffer. - niattribs = 0; - - iattributes[niattribs++] = GL.GLX_PBUFFER_WIDTH; - iattributes[niattribs++] = initWidth; - iattributes[niattribs++] = GL.GLX_PBUFFER_HEIGHT; - iattributes[niattribs++] = initHeight; - - iattributes[niattribs++] = 0; - - long tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes); - if (tmpBuffer == 0) { - // FIXME: query X error code for detail error message - throw new GLException("pbuffer creation error: glXCreatePbuffer() failed"); - } - - // Set up instance variables - this.display = display; - mostRecentDisplay = display; - this.parentContext = parentContext; - buffer = tmpBuffer; - this.fbConfig = fbConfig; - - // Determine the actual width and height we were able to create. - int[] tmp = new int[1]; - GLX.glXQueryDrawable(display, (int) buffer, GL.GLX_WIDTH, tmp); - width = tmp[0]; - GLX.glXQueryDrawable(display, (int) buffer, GL.GLX_HEIGHT, tmp); - height = tmp[0]; - - if (DEBUG) { - System.err.println("Created pbuffer " + width + " x " + height); - } - } - - protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { - if (buffer == 0) { - // pbuffer not instantiated yet - return false; - } - - lockAWT(); - try { - boolean created = false; - if (context == 0) { - create(); - if (DEBUG) { - System.err.println("!!! Created GL context for " + getClass().getName()); - } - created = true; - } - - if (!GLX.glXMakeContextCurrent(display, buffer, buffer, context)) { - throw new GLException("Error making context current"); - } - - if (created) { - resetGLFunctionAvailability(); - initAction.run(); - } - return true; - } finally { - unlockAWT(); - } - } - - protected synchronized void free() throws GLException { - lockAWT(); - try { - if (!GLX.glXMakeContextCurrent(display, 0, 0, 0)) { - throw new GLException("Error freeing OpenGL context"); - } - } finally { - unlockAWT(); - } - } - - public void handleModeSwitch(long parentHdc, long parentHglrc) { - throw new GLException("Not yet implemented"); - } - - protected boolean isOffscreen() { - // FIXME: currently the only caller of this won't cause proper - // resizing of the pbuffer anyway. - return false; - } - - public int getOffscreenContextReadBuffer() { - throw new GLException("Should not call this"); - } - - public boolean offscreenImageNeedsVerticalFlip() { - throw new GLException("Should not call this"); - } - - protected void create() { - if (DEBUG) { - System.err.println("Creating context for pbuffer " + width + " x " + height); - } - - // Create a gl context for the p-buffer. - // FIXME: provide option to not share display lists with subordinate pbuffer? - context = GLX.glXCreateNewContext(display, fbConfig, GL.GLX_RGBA_TYPE, parentContext, true); - if (context == 0) { - throw new GLException("pbuffer creation error: glXCreateNewContext() failed"); - } - - if (DEBUG) { - System.err.println("Created context for pbuffer " + width + " x " + height); - } - } - - protected void destroyImpl() throws GLException { - lockAWT(); - try { - if (context != 0) { - super.destroyImpl(); - GLX.glXDestroyPbuffer(display, buffer); - buffer = 0; - } - } finally { - unlockAWT(); - } - } - - public void swapBuffers() throws GLException { - // FIXME: do we need to do anything if the pbuffer is double-buffered? - } - - public int getFloatingPointMode() { - // Floating-point pbuffers currently require NVidia hardware on X11 - return GLPbuffer.NV_FLOAT; - } - - private int queryFBConfig(long display, GLXFBConfig fbConfig, int attrib) { - int[] tmp = new int[1]; - if (GLX.glXGetFBConfigAttrib(display, fbConfig, attrib, tmp) != 0) { - throw new GLException("glXGetFBConfigAttrib failed"); - } - return tmp[0]; - } -} diff --git a/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java b/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java deleted file mode 100755 index 59208e5a9..000000000 --- a/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.impl.x11; - -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.lang.reflect.*; -import java.security.*; - -/** This class encapsulates the reflection routines necessary to peek - inside a few data structures in the AWT implementation on X11 for - the purposes of correctly enumerating the available visuals. */ - -public class X11SunJDKReflection { - private static Class x11GraphicsDeviceClass; - private static Method x11GraphicsDeviceGetScreenMethod; - private static Class x11GraphicsConfigClass; - private static Method x11GraphicsConfigGetVisualMethod; - private static boolean initted; - - static { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - try { - x11GraphicsDeviceClass = Class.forName("sun.awt.X11GraphicsDevice"); - x11GraphicsDeviceGetScreenMethod = x11GraphicsDeviceClass.getDeclaredMethod("getScreen", new Class[] {}); - x11GraphicsDeviceGetScreenMethod.setAccessible(true); - - x11GraphicsConfigClass = Class.forName("sun.awt.X11GraphicsConfig"); - x11GraphicsConfigGetVisualMethod = x11GraphicsConfigClass.getDeclaredMethod("getVisual", new Class[] {}); - x11GraphicsConfigGetVisualMethod.setAccessible(true); - initted = true; - } catch (Exception e) { - // Either not a Sun JDK or the interfaces have changed since 1.4.2 / 1.5 - } - return null; - } - }); - } - - public static int graphicsDeviceGetScreen(GraphicsDevice device) { - if (!initted) { - return 0; - } - - try { - return ((Integer) x11GraphicsDeviceGetScreenMethod.invoke(device, new Object[] {})).intValue(); - } catch (Exception e) { - return 0; - } - } - - public static int graphicsConfigurationGetVisualID(GraphicsConfiguration config) { - if (!initted) { - return 0; - } - - try { - return ((Integer) x11GraphicsConfigGetVisualMethod.invoke(config, new Object[] {})).intValue(); - } catch (Exception e) { - return 0; - } - } -} diff --git a/src/net/java/games/jogl/util/BitmapCharRec.java b/src/net/java/games/jogl/util/BitmapCharRec.java deleted file mode 100644 index 642bbb465..000000000 --- a/src/net/java/games/jogl/util/BitmapCharRec.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -class BitmapCharRec { - int width; - int height; - float xorig; - float yorig; - float advance; - byte[] bitmap; - - BitmapCharRec(int width, - int height, - float xorig, - float yorig, - float advance, - byte[] bitmap) { - this.width = width; - this.height = height; - this.xorig = xorig; - this.yorig = yorig; - this.advance = advance; - this.bitmap = bitmap; - } -} diff --git a/src/net/java/games/jogl/util/BitmapFontRec.java b/src/net/java/games/jogl/util/BitmapFontRec.java deleted file mode 100644 index 32ea9c183..000000000 --- a/src/net/java/games/jogl/util/BitmapFontRec.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -class BitmapFontRec { - String name; - int num_chars; - int first; - BitmapCharRec[] ch; - - BitmapFontRec(String name, - int num_chars, - int first, - BitmapCharRec[] ch) { - this.name = name; - this.num_chars = num_chars; - this.first = first; - this.ch = ch; - } -} diff --git a/src/net/java/games/jogl/util/BufferUtils.java b/src/net/java/games/jogl/util/BufferUtils.java deleted file mode 100644 index 903a27366..000000000 --- a/src/net/java/games/jogl/util/BufferUtils.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -import java.nio.*; -import java.util.*; - -/** Utility routines for dealing with direct buffers. */ - -public class BufferUtils { - public static final int SIZEOF_DOUBLE = 8; - public static final int SIZEOF_FLOAT = 4; - public static final int SIZEOF_INT = 4; - - public static DoubleBuffer newDoubleBuffer(int numElements) { - ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE); - return bb.asDoubleBuffer(); - } - - public static FloatBuffer newFloatBuffer(int numElements) { - ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT); - return bb.asFloatBuffer(); - } - - public static IntBuffer newIntBuffer(int numElements) { - ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT); - return bb.asIntBuffer(); - } - - public static ByteBuffer newByteBuffer(int numElements) { - ByteBuffer bb = ByteBuffer.allocateDirect(numElements); - bb.order(ByteOrder.nativeOrder()); - return bb; - } - - public static DoubleBuffer copyDoubleBuffer(DoubleBuffer orig) { - DoubleBuffer dest = newDoubleBuffer(orig.capacity()); - orig.rewind(); - dest.put(orig); - return dest; - } - - public static FloatBuffer copyFloatBuffer(FloatBuffer orig) { - FloatBuffer dest = newFloatBuffer(orig.capacity()); - orig.rewind(); - dest.put(orig); - return dest; - } - - public static IntBuffer copyIntBuffer(IntBuffer orig) { - IntBuffer dest = newIntBuffer(orig.capacity()); - orig.rewind(); - dest.put(orig); - return dest; - } - - public static ByteBuffer copyByteBuffer(ByteBuffer orig) { - ByteBuffer dest = newByteBuffer(orig.capacity()); - orig.rewind(); - dest.put(orig); - return dest; - } - - private static Map bufferOffsetCache = Collections.synchronizedMap(new HashMap()); - - /** Creates an "offset buffer" for use with the - ARB_vertex_buffer_object extension. The resulting Buffers are - suitable for use with routines such as glVertexPointer when - used in conjunction with that extension. They have no - capacity and are not suitable for passing to OpenGL routines - that do not support buffer offsets, or to non-OpenGL - routines. */ - public static ByteBuffer bufferOffset(int offset) { - Integer key = new Integer(offset); - ByteBuffer buf = (ByteBuffer) bufferOffsetCache.get(key); - if (buf == null) { - buf = bufferOffset0(offset); - bufferOffsetCache.put(key, buf); - } - return buf; - } - - private static native ByteBuffer bufferOffset0(int offset); -} diff --git a/src/net/java/games/jogl/util/CoordRec.java b/src/net/java/games/jogl/util/CoordRec.java deleted file mode 100644 index 661ed23ff..000000000 --- a/src/net/java/games/jogl/util/CoordRec.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -class CoordRec { - float x; - float y; - - CoordRec(float x, float y) { - this.x = x; - this.y = y; - } -} diff --git a/src/net/java/games/jogl/util/GLUT.java b/src/net/java/games/jogl/util/GLUT.java deleted file mode 100644 index 9f9ed1558..000000000 --- a/src/net/java/games/jogl/util/GLUT.java +++ /dev/null @@ -1,1201 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -import net.java.games.jogl.*; - -/** Subset of the routines provided by the GLUT interface. Note the - signatures of many of the methods are necessarily different than - the corresponding C version. A GLUT object must only be used from - one particular thread at a time.

- - Copyright (c) Mark J. Kilgard, 1994, 1997.

- - (c) Copyright 1993, Silicon Graphics, Inc.

- - ALL RIGHTS RESERVED

- - Permission to use, copy, modify, and distribute this software - for any purpose and without fee is hereby granted, provided - that the above copyright notice appear in all copies and that - both the copyright notice and this permission notice appear in - supporting documentation, and that the name of Silicon - Graphics, Inc. not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission.

- - THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU - "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR - OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF - MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO - EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE - ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR - CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, - INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, - SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR - NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY - OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR - PERFORMANCE OF THIS SOFTWARE.

- - US Government Users Restricted Rights

- - Use, duplication, or disclosure by the Government is subject to - restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - (c)(1)(ii) of the Rights in Technical Data and Computer - Software clause at DFARS 252.227-7013 and/or in similar or - successor clauses in the FAR or the DOD or NASA FAR - Supplement. Unpublished-- rights reserved under the copyright - laws of the United States. Contractor/manufacturer is Silicon - Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA - 94039-7311.

- - OpenGL(TM) is a trademark of Silicon Graphics, Inc.

-*/ - -public class GLUT { - public static final int STROKE_ROMAN = 0; - public static final int STROKE_MONO_ROMAN = 1; - public static final int BITMAP_9_BY_15 = 2; - public static final int BITMAP_8_BY_13 = 3; - public static final int BITMAP_TIMES_ROMAN_10 = 4; - public static final int BITMAP_TIMES_ROMAN_24 = 5; - public static final int BITMAP_HELVETICA_10 = 6; - public static final int BITMAP_HELVETICA_12 = 7; - public static final int BITMAP_HELVETICA_18 = 8; - - //---------------------------------------------------------------------- - // Shapes - // - - public void glutWireSphere(GLU glu, double radius, int slices, int stacks) { - quadObjInit(glu); - glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); - glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - glu.gluSphere(quadObj, radius, slices, stacks); - } - - public void glutSolidSphere(GLU glu, double radius, int slices, int stacks) { - quadObjInit(glu); - glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); - glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - glu.gluSphere(quadObj, radius, slices, stacks); - } - - public void glutWireCone(GLU glu, - double base, double height, - int slices, int stacks) { - quadObjInit(glu); - glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); - glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); - } - - public void glutSolidCone(GLU glu, - double base, double height, - int slices, int stacks) { - quadObjInit(glu); - glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); - glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); - } - - public void glutWireCube(GL gl, float size) { - drawBox(gl, size, GL.GL_LINE_LOOP); - } - - public void glutSolidCube(GL gl, float size) { - drawBox(gl, size, GL.GL_QUADS); - } - - public void glutWireTorus(GL gl, - double innerRadius, double outerRadius, - int nsides, int rings) { - gl.glPushAttrib(GL.GL_POLYGON_BIT); - gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE); - doughnut(gl, innerRadius, outerRadius, nsides, rings); - gl.glPopAttrib(); - } - - public void glutSolidTorus(GL gl, - double innerRadius, double outerRadius, - int nsides, int rings) { - doughnut(gl, innerRadius, outerRadius, nsides, rings); - } - - public void glutWireDodecahedron(GL gl) { - dodecahedron(gl, GL.GL_LINE_LOOP); - } - - public void glutSolidDodecahedron(GL gl) { - dodecahedron(gl, GL.GL_TRIANGLE_FAN); - } - - public void glutWireOctahedron(GL gl) { - octahedron(gl, GL.GL_LINE_LOOP); - } - - public void glutSolidOctahedron(GL gl) { - octahedron(gl, GL.GL_TRIANGLES); - } - - public void glutWireIcosahedron(GL gl) { - icosahedron(gl, GL.GL_LINE_LOOP); - } - - public void glutSolidIcosahedron(GL gl) { - icosahedron(gl, GL.GL_TRIANGLES); - } - - public void glutWireTetrahedron(GL gl) { - tetrahedron(gl, GL.GL_LINE_LOOP); - } - - public void glutSolidTetrahedron(GL gl) { - tetrahedron(gl, GL.GL_TRIANGLES); - } - -/** - * Renders the teapot as a solid shape of the specified size. The teapot is - * created in a way that replicates the C GLUT implementation. - * - * @param gl - * the OpenGL context in which to render the teapot - * @param scale - * the factor by which to scale the teapot - */ - public void glutSolidTeapot(GL gl, double scale) { - glutSolidTeapot(gl, scale, true); - } - - /** - * Renders the teapot as a solid shape of the specified size. The teapot can - * either be created in a way that is backward-compatible with the standard - * C glut library (i.e. broken), or in a more pleasing way (i.e. with - * surfaces whose front-faces point outwards and standing on the z=0 plane, - * instead of the y=-1 plane). Both surface normals and texture coordinates - * for the teapot are generated. The teapot is generated with OpenGL - * evaluators. - * - * @param gl - * the OpenGL context in which to render the teapot - * @param scale - * the factor by which to scale the teapot - * @param cStyle - * whether to create the teapot in exactly the same way as in the C - * implementation of GLUT - */ - public void glutSolidTeapot(GL gl, double scale, boolean cStyle) { - teapot(gl, 14, scale, GL.GL_FILL, cStyle); - } - - /** - * Renders the teapot as a wireframe shape of the specified size. The teapot - * is created in a way that replicates the C GLUT implementation. - * - * @param gl - * the OpenGL context in which to render the teapot - * @param scale - * the factor by which to scale the teapot - */ - public void glutWireTeapot(GL gl, double scale) { - glutWireTeapot(gl, scale, true); - } - - /** - * Renders the teapot as a wireframe shape of the specified size. The teapot - * can either be created in a way that is backward-compatible with the - * standard C glut library (i.e. broken), or in a more pleasing way (i.e. - * with surfaces whose front-faces point outwards and standing on the z=0 - * plane, instead of the y=-1 plane). Both surface normals and texture - * coordinates for the teapot are generated. The teapot is generated with - * OpenGL evaluators. - * - * @param gl - * the OpenGL context in which to render the teapot - * @param scale - * the factor by which to scale the teapot - * @param cStyle - * whether to create the teapot in exactly the same way as in the C - * implementation of GLUT - */ - public void glutWireTeapot(GL gl, double scale, boolean cStyle) { - teapot(gl, 10, scale, GL.GL_LINE, cStyle); - } - - //---------------------------------------------------------------------- - // Fonts - // - - public void glutBitmapCharacter(GL gl, int font, char character) { - int[] swapbytes = new int[1]; - int[] lsbfirst = new int[1]; - int[] rowlength = new int[1]; - int[] skiprows = new int[1]; - int[] skippixels = new int[1]; - int[] alignment = new int[1]; - beginBitmap(gl, - swapbytes, - lsbfirst, - rowlength, - skiprows, - skippixels, - alignment); - bitmapCharacterImpl(gl, font, character); - endBitmap(gl, - swapbytes, - lsbfirst, - rowlength, - skiprows, - skippixels, - alignment); - } - - public void glutBitmapString (GL gl, int font, String string) { - int[] swapbytes = new int[1]; - int[] lsbfirst = new int[1]; - int[] rowlength = new int[1]; - int[] skiprows = new int[1]; - int[] skippixels = new int[1]; - int[] alignment = new int[1]; - beginBitmap(gl, - swapbytes, - lsbfirst, - rowlength, - skiprows, - skippixels, - alignment); - int len = string.length(); - for (int i = 0; i < len; i++) { - bitmapCharacterImpl(gl, font, string.charAt(i)); - } - endBitmap(gl, - swapbytes, - lsbfirst, - rowlength, - skiprows, - skippixels, - alignment); - } - - public int glutBitmapWidth (int font, char character) { - BitmapFontRec fontinfo = getBitmapFont(font); - int c = character & 0xFFFF; - if (c < fontinfo.first || c >= fontinfo.first + fontinfo.num_chars) - return 0; - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; - if (ch != null) - return (int) ch.advance; - else - return 0; - } - - public void glutStrokeCharacter(GL gl, int font, char character) { - StrokeFontRec fontinfo = getStrokeFont(font); - int c = character & 0xFFFF; - if (c < 0 || c >= fontinfo.num_chars) - return; - StrokeCharRec ch = fontinfo.ch[c]; - if (ch != null) { - for (int i = 0; i < ch.num_strokes; i++) { - StrokeRec stroke = ch.stroke[i]; - gl.glBegin(GL.GL_LINE_STRIP); - for (int j = 0; j < stroke.num_coords; j++) { - CoordRec coord = stroke.coord[j]; - gl.glVertex2f(coord.x, coord.y); - } - gl.glEnd(); - } - gl.glTranslatef(ch.right, 0.0f, 0.0f); - } - } - - public void glutStrokeString(GL gl, int font, String string) { - StrokeFontRec fontinfo = getStrokeFont(font); - int len = string.length(); - for (int pos = 0; pos < len; pos++) { - int c = string.charAt(pos) & 0xFFFF; - if (c < 0 || c >= fontinfo.num_chars) - continue; - StrokeCharRec ch = fontinfo.ch[c]; - if (ch != null) { - for (int i = 0; i < ch.num_strokes; i++) { - StrokeRec stroke = ch.stroke[i]; - gl.glBegin(GL.GL_LINE_STRIP); - for (int j = 0; j < stroke.num_coords; j++) { - CoordRec coord = stroke.coord[j]; - gl.glVertex2f(coord.x, coord.y); - } - gl.glEnd(); - } - gl.glTranslatef(ch.right, 0.0f, 0.0f); - } - } - } - - public int glutStrokeWidth (int font, char character) { - return (int) glutStrokeWidthf(font, character); - } - - public float glutStrokeWidthf (int font, char character) { - StrokeFontRec fontinfo = getStrokeFont(font); - int c = character & 0xFFFF; - if (c < 0 || c >= fontinfo.num_chars) - return 0; - StrokeCharRec ch = fontinfo.ch[c]; - if (ch != null) - return ch.right; - else - return 0; - } - - public int glutBitmapLength (int font, String string) { - BitmapFontRec fontinfo = getBitmapFont(font); - int length = 0; - int len = string.length(); - for (int pos = 0; pos < len; pos++) { - int c = string.charAt(pos) & 0xFFFF; - if (c >= fontinfo.first && c < fontinfo.first + fontinfo.num_chars) { - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; - if (ch != null) - length += ch.advance; - } - } - return length; - } - - public int glutStrokeLength (int font, String string) { - return (int) glutStrokeLengthf(font, string); - } - - public float glutStrokeLengthf (int font, String string) { - StrokeFontRec fontinfo = getStrokeFont(font); - float length = 0; - int len = string.length(); - for (int i = 0; i < len; i++) { - char c = string.charAt(i); - if (c >= 0 && c < fontinfo.num_chars) { - StrokeCharRec ch = fontinfo.ch[c]; - if (ch != null) - length += ch.right; - } - } - return length; - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - //---------------------------------------------------------------------- - // Shape implementation - // - - private GLUquadric quadObj; - private void quadObjInit(GLU glu) { - if (quadObj == null) { - quadObj = glu.gluNewQuadric(); - } - if (quadObj == null) { - throw new GLException("Out of memory"); - } - } - - private static void doughnut(GL gl, double r, double R, int nsides, int rings) { - int i, j; - float theta, phi, theta1; - float cosTheta, sinTheta; - float cosTheta1, sinTheta1; - float ringDelta, sideDelta; - - ringDelta = (float) (2.0 * Math.PI / rings); - sideDelta = (float) (2.0 * Math.PI / nsides); - - theta = 0.0f; - cosTheta = 1.0f; - sinTheta = 0.0f; - for (i = rings - 1; i >= 0; i--) { - theta1 = theta + ringDelta; - cosTheta1 = (float) Math.cos(theta1); - sinTheta1 = (float) Math.sin(theta1); - gl.glBegin(GL.GL_QUAD_STRIP); - phi = 0.0f; - for (j = nsides; j >= 0; j--) { - float cosPhi, sinPhi, dist; - - phi += sideDelta; - cosPhi = (float) Math.cos(phi); - sinPhi = (float) Math.sin(phi); - dist = (float) (R + r * cosPhi); - - gl.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - gl.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, (float) r * sinPhi); - gl.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - gl.glVertex3f(cosTheta * dist, -sinTheta * dist, (float) r * sinPhi); - } - gl.glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } - } - - private static float[][] boxVertices; - private static final float[][] boxNormals = { - {-1.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f}, - {1.0f, 0.0f, 0.0f}, - {0.0f, -1.0f, 0.0f}, - {0.0f, 0.0f, 1.0f}, - {0.0f, 0.0f, -1.0f} - }; - private static final int[][] boxFaces = { - {0, 1, 2, 3}, - {3, 2, 6, 7}, - {7, 6, 5, 4}, - {4, 5, 1, 0}, - {5, 6, 2, 1}, - {7, 4, 0, 3} - }; - private void drawBox(GL gl, float size, int type) { - if (boxVertices == null) { - float[][] v = new float[8][]; - for (int i = 0; i < 8; i++) { - v[i] = new float[3]; - } - v[0][0] = v[1][0] = v[2][0] = v[3][0] = -0.5f; - v[4][0] = v[5][0] = v[6][0] = v[7][0] = 0.5f; - v[0][1] = v[1][1] = v[4][1] = v[5][1] = -0.5f; - v[2][1] = v[3][1] = v[6][1] = v[7][1] = 0.5f; - v[0][2] = v[3][2] = v[4][2] = v[7][2] = -0.5f; - v[1][2] = v[2][2] = v[5][2] = v[6][2] = 0.5f; - boxVertices = v; - } - float[][] v = boxVertices; - float[][] n = boxNormals; - int[][] faces = boxFaces; - for (int i = 5; i >= 0; i--) { - gl.glBegin(type); - gl.glNormal3fv(n[i]); - float[] vt = v[faces[i][0]]; - gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); - vt = v[faces[i][1]]; - gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); - vt = v[faces[i][2]]; - gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); - vt = v[faces[i][3]]; - gl.glVertex3f(vt[0] * size, vt[1] * size, vt[2] * size); - gl.glEnd(); - } - } - - private float[][] dodec; - - private void initDodecahedron() { - dodec = new float[20][]; - for (int i = 0; i < dodec.length; i++) { - dodec[i] = new float[3]; - } - - float alpha, beta; - - alpha = (float) Math.sqrt(2.0f / (3.0f + Math.sqrt(5.0))); - beta = 1.0f + (float) Math.sqrt(6.0 / (3.0 + Math.sqrt(5.0)) - - 2.0 + 2.0 * Math.sqrt(2.0 / (3.0 + Math.sqrt(5.0)))); - dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; - dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; - dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; - dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; - dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; - dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; - dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; - dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; - dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; - dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; - dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; - dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; - dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; - dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; - dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; - dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; - dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; - dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; - dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; - dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; - } - - private static void diff3(float[] a, float[] b, float[] c) { - c[0] = a[0] - b[0]; - c[1] = a[1] - b[1]; - c[2] = a[2] - b[2]; - } - - private static void crossprod(float[] v1, float[] v2, float[] prod) { - float[] p = new float[3]; /* in case prod == v1 or v2 */ - - p[0] = v1[1] * v2[2] - v2[1] * v1[2]; - p[1] = v1[2] * v2[0] - v2[2] * v1[0]; - p[2] = v1[0] * v2[1] - v2[0] * v1[1]; - prod[0] = p[0]; - prod[1] = p[1]; - prod[2] = p[2]; - } - - private static void normalize(float[] v) { - float d; - - d = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - if (d == 0.0) { - v[0] = d = 1.0f; - } - d = 1 / d; - v[0] *= d; - v[1] *= d; - v[2] *= d; - } - - private void pentagon(GL gl, int a, int b, int c, int d, int e, int shadeType) { - float[] n0 = new float[3]; - float[] d1 = new float[3]; - float[] d2 = new float[3]; - - diff3(dodec[a], dodec[b], d1); - diff3(dodec[b], dodec[c], d2); - crossprod(d1, d2, n0); - normalize(n0); - - gl.glBegin(shadeType); - gl.glNormal3fv(n0); - gl.glVertex3fv(dodec[a]); - gl.glVertex3fv(dodec[b]); - gl.glVertex3fv(dodec[c]); - gl.glVertex3fv(dodec[d]); - gl.glVertex3fv(dodec[e]); - gl.glEnd(); - } - - private void dodecahedron(GL gl, int type) { - if (dodec == null) { - initDodecahedron(); - } - pentagon(gl, 0, 1, 9, 16, 5, type); - pentagon(gl, 1, 0, 3, 18, 7, type); - pentagon(gl, 1, 7, 11, 10, 9, type); - pentagon(gl, 11, 7, 18, 19, 6, type); - pentagon(gl, 8, 17, 16, 9, 10, type); - pentagon(gl, 2, 14, 15, 6, 19, type); - pentagon(gl, 2, 13, 12, 4, 14, type); - pentagon(gl, 2, 19, 18, 3, 13, type); - pentagon(gl, 3, 0, 5, 12, 13, type); - pentagon(gl, 6, 15, 8, 10, 11, type); - pentagon(gl, 4, 17, 8, 15, 14, type); - pentagon(gl, 4, 12, 5, 16, 17, type); - } - - private static void recorditem(GL gl, float[] n1, float[] n2, float[] n3, int shadeType) { - float[] q0 = new float[3]; - float[] q1 = new float[3]; - - diff3(n1, n2, q0); - diff3(n2, n3, q1); - crossprod(q0, q1, q1); - normalize(q1); - - gl.glBegin(shadeType); - gl.glNormal3fv(q1); - gl.glVertex3fv(n1); - gl.glVertex3fv(n2); - gl.glVertex3fv(n3); - gl.glEnd(); - } - - private static void subdivide(GL gl, float[] v0, float[] v1, float[] v2, int shadeType) { - int depth; - float[] w0 = new float[3]; - float[] w1 = new float[3]; - float[] w2 = new float[3]; - float l; - int i, j, k, n; - - depth = 1; - for (i = 0; i < depth; i++) { - for (j = 0; i + j < depth; j++) { - k = depth - i - j; - for (n = 0; n < 3; n++) { - w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; - w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) - / depth; - w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) - / depth; - } - l = (float) Math.sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); - w0[0] /= l; - w0[1] /= l; - w0[2] /= l; - l = (float) Math.sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); - w1[0] /= l; - w1[1] /= l; - w1[2] /= l; - l = (float) Math.sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); - w2[0] /= l; - w2[1] /= l; - w2[2] /= l; - recorditem(gl, w1, w0, w2, shadeType); - } - } - } - - private static void drawtriangle(GL gl, int i, float[][] data, int[][] ndx, int shadeType) { - float[] x0 = data[ndx[i][0]]; - float[] x1 = data[ndx[i][1]]; - float[] x2 = data[ndx[i][2]]; - subdivide(gl, x0, x1, x2, shadeType); - } - - /* octahedron data: The octahedron produced is centered at the - origin and has radius 1.0 */ - private static final float[][] odata = - { - {1.0f, 0.0f, 0.0f}, - {-1.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f}, - {0.0f, -1.0f, 0.0f}, - {0.0f, 0.0f, 1.0f}, - {0.0f, 0.0f, -1.0f} - }; - - private static final int[][] ondex = - { - {0, 4, 2}, - {1, 2, 4}, - {0, 3, 4}, - {1, 4, 3}, - {0, 2, 5}, - {1, 5, 2}, - {0, 5, 3}, - {1, 3, 5} - }; - - private static void octahedron(GL gl, int shadeType) { - int i; - - for (i = 7; i >= 0; i--) { - drawtriangle(gl, i, odata, ondex, shadeType); - } - } - - /* icosahedron data: These numbers are rigged to make an - icosahedron of radius 1.0 */ - - private static final float X = .525731112119133606f; - private static final float Z = .850650808352039932f; - - private static final float[][] idata = - { - {-X, 0, Z}, - {X, 0, Z}, - {-X, 0, -Z}, - {X, 0, -Z}, - {0, Z, X}, - {0, Z, -X}, - {0, -Z, X}, - {0, -Z, -X}, - {Z, X, 0}, - {-Z, X, 0}, - {Z, -X, 0}, - {-Z, -X, 0} - }; - - private static final int[][] index = - { - {0, 4, 1}, - {0, 9, 4}, - {9, 5, 4}, - {4, 5, 8}, - {4, 8, 1}, - {8, 10, 1}, - {8, 3, 10}, - {5, 3, 8}, - {5, 2, 3}, - {2, 7, 3}, - {7, 10, 3}, - {7, 6, 10}, - {7, 11, 6}, - {11, 0, 6}, - {0, 1, 6}, - {6, 1, 10}, - {9, 0, 11}, - {9, 11, 2}, - {9, 2, 5}, - {7, 2, 11}, - }; - - private static void icosahedron(GL gl, int shadeType) { - int i; - - for (i = 19; i >= 0; i--) { - drawtriangle(gl, i, idata, index, shadeType); - } - } - - /* tetrahedron data: */ - - private static final float T = 1.73205080756887729f; - - private static final float[][] tdata = - { - {T, T, T}, - {T, -T, -T}, - {-T, T, -T}, - {-T, -T, T} - }; - - private static final int[][] tndex = - { - {0, 1, 3}, - {2, 1, 0}, - {3, 2, 0}, - {1, 2, 3} - }; - - private static final void tetrahedron(GL gl, int shadeType) { - for (int i = 3; i >= 0; i--) - drawtriangle(gl, i, tdata, tndex, shadeType); - } - - // Teapot implementation (a modified port of glut_teapot.c) - // - // Rim, body, lid, and bottom data must be reflected in x and - // y; handle and spout data across the y axis only. - private static final int[][] teapotPatchData = { - /* rim */ - {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, - /* body */ - {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, - {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}, - /* lid */ - {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, 101, 0, 1, 2, 3,}, - {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117}, - /* bottom */ - {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, 125, 120, 40, 39, 38, 37}, - /* handle */ - {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56}, - {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 65, 66, 67}, - /* spout */ - {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83}, - {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95} - }; - private static final float[][] teapotCPData = { - {0.2f, 0f, 2.7f}, - {0.2f, -0.112f, 2.7f}, - {0.112f, -0.2f, 2.7f}, - {0f, -0.2f, 2.7f}, - {1.3375f, 0f, 2.53125f}, - {1.3375f, -0.749f, 2.53125f}, - {0.749f, -1.3375f, 2.53125f}, - {0f, -1.3375f, 2.53125f}, - {1.4375f, 0f, 2.53125f}, - {1.4375f, -0.805f, 2.53125f}, - {0.805f, -1.4375f, 2.53125f}, - {0f, -1.4375f, 2.53125f}, - {1.5f, 0f, 2.4f}, - {1.5f, -0.84f, 2.4f}, - {0.84f, -1.5f, 2.4f}, - {0f, -1.5f, 2.4f}, - {1.75f, 0f, 1.875f}, - {1.75f, -0.98f, 1.875f}, - {0.98f, -1.75f, 1.875f}, - {0f, -1.75f, 1.875f}, - {2f, 0f, 1.35f}, - {2f, -1.12f, 1.35f}, - {1.12f, -2f, 1.35f}, - {0f, -2f, 1.35f}, - {2f, 0f, 0.9f}, - {2f, -1.12f, 0.9f}, - {1.12f, -2f, 0.9f}, - {0f, -2f, 0.9f}, - {-2f, 0f, 0.9f}, - {2f, 0f, 0.45f}, - {2f, -1.12f, 0.45f}, - {1.12f, -2f, 0.45f}, - {0f, -2f, 0.45f}, - {1.5f, 0f, 0.225f}, - {1.5f, -0.84f, 0.225f}, - {0.84f, -1.5f, 0.225f}, - {0f, -1.5f, 0.225f}, - {1.5f, 0f, 0.15f}, - {1.5f, -0.84f, 0.15f}, - {0.84f, -1.5f, 0.15f}, - {0f, -1.5f, 0.15f}, - {-1.6f, 0f, 2.025f}, - {-1.6f, -0.3f, 2.025f}, - {-1.5f, -0.3f, 2.25f}, - {-1.5f, 0f, 2.25f}, - {-2.3f, 0f, 2.025f}, - {-2.3f, -0.3f, 2.025f}, - {-2.5f, -0.3f, 2.25f}, - {-2.5f, 0f, 2.25f}, - {-2.7f, 0f, 2.025f}, - {-2.7f, -0.3f, 2.025f}, - {-3f, -0.3f, 2.25f}, - {-3f, 0f, 2.25f}, - {-2.7f, 0f, 1.8f}, - {-2.7f, -0.3f, 1.8f}, - {-3f, -0.3f, 1.8f}, - {-3f, 0f, 1.8f}, - {-2.7f, 0f, 1.575f}, - {-2.7f, -0.3f, 1.575f}, - {-3f, -0.3f, 1.35f}, - {-3f, 0f, 1.35f}, - {-2.5f, 0f, 1.125f}, - {-2.5f, -0.3f, 1.125f}, - {-2.65f, -0.3f, 0.9375f}, - {-2.65f, 0f, 0.9375f}, - {-2f, -0.3f, 0.9f}, - {-1.9f, -0.3f, 0.6f}, - {-1.9f, 0f, 0.6f}, - {1.7f, 0f, 1.425f}, - {1.7f, -0.66f, 1.425f}, - {1.7f, -0.66f, 0.6f}, - {1.7f, 0f, 0.6f}, - {2.6f, 0f, 1.425f}, - {2.6f, -0.66f, 1.425f}, - {3.1f, -0.66f, 0.825f}, - {3.1f, 0f, 0.825f}, - {2.3f, 0f, 2.1f}, - {2.3f, -0.25f, 2.1f}, - {2.4f, -0.25f, 2.025f}, - {2.4f, 0f, 2.025f}, - {2.7f, 0f, 2.4f}, - {2.7f, -0.25f, 2.4f}, - {3.3f, -0.25f, 2.4f}, - {3.3f, 0f, 2.4f}, - {2.8f, 0f, 2.475f}, - {2.8f, -0.25f, 2.475f}, - {3.525f, -0.25f, 2.49375f}, - {3.525f, 0f, 2.49375f}, - {2.9f, 0f, 2.475f}, - {2.9f, -0.15f, 2.475f}, - {3.45f, -0.15f, 2.5125f}, - {3.45f, 0f, 2.5125f}, - {2.8f, 0f, 2.4f}, - {2.8f, -0.15f, 2.4f}, - {3.2f, -0.15f, 2.4f}, - {3.2f, 0f, 2.4f}, - {0f, 0f, 3.15f}, - {0.8f, 0f, 3.15f}, - {0.8f, -0.45f, 3.15f}, - {0.45f, -0.8f, 3.15f}, - {0f, -0.8f, 3.15f}, - {0f, 0f, 2.85f}, - {1.4f, 0f, 2.4f}, - {1.4f, -0.784f, 2.4f}, - {0.784f, -1.4f, 2.4f}, - {0f, -1.4f, 2.4f}, - {0.4f, 0f, 2.55f}, - {0.4f, -0.224f, 2.55f}, - {0.224f, -0.4f, 2.55f}, - {0f, -0.4f, 2.55f}, - {1.3f, 0f, 2.55f}, - {1.3f, -0.728f, 2.55f}, - {0.728f, -1.3f, 2.55f}, - {0f, -1.3f, 2.55f}, - {1.3f, 0f, 2.4f}, - {1.3f, -0.728f, 2.4f}, - {0.728f, -1.3f, 2.4f}, - {0f, -1.3f, 2.4f}, - {0f, 0f, 0f}, - {1.425f, -0.798f, 0f}, - {1.5f, 0f, 0.075f}, - {1.425f, 0f, 0f}, - {0.798f, -1.425f, 0f}, - {0f, -1.5f, 0.075f}, - {0f, -1.425f, 0f}, - {1.5f, -0.84f, 0.075f}, - {0.84f, -1.5f, 0.075f} - }; - // Since GL.glMap2f expects a packed array of floats, we must convert - // from a 3-dimensional array to a 1-dimensional array - private static final float[] teapotTex = { - 0, 0, 1, 0, 0, 1, 1, 1 - }; - - private static void teapot(GL gl, - int grid, - double scale, - int type, - boolean backCompatible) - { - // As mentioned above, GL.glMap2f expects a packed array of floats - float[] p = new float[4*4*3]; - float[] q = new float[4*4*3]; - float[] r = new float[4*4*3]; - float[] s = new float[4*4*3]; - int i, j, k, l; - - gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_EVAL_BIT | GL.GL_POLYGON_BIT); - gl.glEnable(GL.GL_AUTO_NORMAL); - gl.glEnable(GL.GL_NORMALIZE); - gl.glEnable(GL.GL_MAP2_VERTEX_3); - gl.glEnable(GL.GL_MAP2_TEXTURE_COORD_2); - if (!backCompatible) { - // The time has come to have the teapot no longer be inside out - gl.glFrontFace(GL.GL_CW); - gl.glScaled(0.5*scale, 0.5*scale, 0.5*scale); - } else { - // We want the teapot in it's backward compatible position and - // orientation - gl.glPushMatrix(); - gl.glRotatef(270.0f, 1, 0, 0); - gl.glScalef((float)(0.5 * scale), - (float)(0.5 * scale), - (float)(0.5 * scale)); - gl.glTranslatef(0.0f, 0.0f, -1.5f); - } - for (i = 0; i < 10; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 4; k++) { - for (l = 0; l < 3; l++) { - p[(j*4+k)*3+l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l]; - q[(j*4+k)*3+l] = - teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l]; - if (l == 1) - q[(j*4+k)*3+l] *= -1.0; - if (i < 6) { - r[(j*4+k)*3+l] = - teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l]; - if (l == 0) - r[(j*4+k)*3+l] *= -1.0; - s[(j*4+k)*3+l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l]; - if (l == 0) - s[(j*4+k)*3+l] *= -1.0; - if (l == 1) - s[(j*4+k)*3+l] *= -1.0; - } - } - } - } - gl.glMap2f(GL.GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, teapotTex); - gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, p); - gl.glMapGrid2f(grid, 0.0f, 1.0f, grid, 0.0f, 1.0f); - evaluateTeapotMesh(gl, grid, type, i, !backCompatible); - gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, q); - evaluateTeapotMesh(gl, grid, type, i, !backCompatible); - if (i < 6) { - gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, r); - evaluateTeapotMesh(gl, grid, type, i, !backCompatible); - gl.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, s); - evaluateTeapotMesh(gl, grid, type, i, !backCompatible); - } - } - if (backCompatible) { - gl.glPopMatrix(); - } - gl.glPopAttrib(); - } - - private static void evaluateTeapotMesh(GL gl, - int grid, - int type, - int partNum, - boolean repairSingularities) - { - if (repairSingularities && (partNum == 5 || partNum == 3)) { - // Instead of using evaluators that give bad results at singularities, - // evaluate by hand - gl.glPolygonMode(GL.GL_FRONT_AND_BACK, type); - for (int nv = 0; nv < grid; nv++) { - if (nv == 0) { - // Draw a small triangle-fan to fill the hole - gl.glDisable(GL.GL_AUTO_NORMAL); - gl.glNormal3f(0, 0, partNum == 3 ? 1 : -1); - gl.glBegin(GL.GL_TRIANGLE_FAN); - { - gl.glEvalCoord2f(0, 0); - // Note that we draw in clock-wise order to match the evaluator - // method - for (int nu = 0; nu <= grid; nu++) - { - gl.glEvalCoord2f(nu / (float)grid, (1f / grid) / (float)grid); - } - } - gl.glEnd(); - gl.glEnable(GL.GL_AUTO_NORMAL); - } - // Draw the rest of the piece as an evaluated quad-strip - gl.glBegin(GL.GL_QUAD_STRIP); - { - // Note that we draw in clock-wise order to match the evaluator method - for (int nu = grid; nu >= 0; nu--) { - gl.glEvalCoord2f(nu / (float)grid, (nv + 1) / (float)grid); - gl.glEvalCoord2f(nu / (float)grid, Math.max(nv, 1f / grid) - / (float)grid); - } - } - gl.glEnd(); - } - } else { - gl.glEvalMesh2(type, 0, grid, 0, grid); - } - } - - //---------------------------------------------------------------------- - // Font implementation - // - - private static void bitmapCharacterImpl(GL gl, int font, char cin) { - BitmapFontRec fontinfo = getBitmapFont(font); - int c = cin & 0xFFFF; - if (c < fontinfo.first || - c >= fontinfo.first + fontinfo.num_chars) - return; - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; - if (ch != null) { - gl.glBitmap(ch.width, ch.height, ch.xorig, ch.yorig, - ch.advance, 0, ch.bitmap); - } - } - - private static final BitmapFontRec[] bitmapFonts = new BitmapFontRec[9]; - private static final StrokeFontRec[] strokeFonts = new StrokeFontRec[9]; - - private static BitmapFontRec getBitmapFont(int font) { - BitmapFontRec rec = bitmapFonts[font]; - if (rec == null) { - switch (font) { - case BITMAP_9_BY_15: - rec = GLUTBitmap9x15.glutBitmap9By15; - break; - case BITMAP_8_BY_13: - rec = GLUTBitmap8x13.glutBitmap8By13; - break; - case BITMAP_TIMES_ROMAN_10: - rec = GLUTBitmapTimesRoman10.glutBitmapTimesRoman10; - break; - case BITMAP_TIMES_ROMAN_24: - rec = GLUTBitmapTimesRoman24.glutBitmapTimesRoman24; - break; - case BITMAP_HELVETICA_10: - rec = GLUTBitmapHelvetica10.glutBitmapHelvetica10; - break; - case BITMAP_HELVETICA_12: - rec = GLUTBitmapHelvetica12.glutBitmapHelvetica12; - break; - case BITMAP_HELVETICA_18: - rec = GLUTBitmapHelvetica18.glutBitmapHelvetica18; - break; - default: - throw new GLException("Unknown bitmap font number " + font); - } - bitmapFonts[font] = rec; - } - return rec; - } - - private static StrokeFontRec getStrokeFont(int font) { - StrokeFontRec rec = strokeFonts[font]; - if (rec == null) { - switch (font) { - case STROKE_ROMAN: - rec = GLUTStrokeRoman.glutStrokeRoman; - break; - case STROKE_MONO_ROMAN: - rec = GLUTStrokeMonoRoman.glutStrokeMonoRoman; - break; - default: - throw new GLException("Unknown stroke font number " + font); - } - } - return rec; - } - - private static void beginBitmap(GL gl, - int[] swapbytes, - int[] lsbfirst, - int[] rowlength, - int[] skiprows, - int[] skippixels, - int[] alignment) { - gl.glGetIntegerv(GL.GL_UNPACK_SWAP_BYTES, swapbytes); - gl.glGetIntegerv(GL.GL_UNPACK_LSB_FIRST, lsbfirst); - gl.glGetIntegerv(GL.GL_UNPACK_ROW_LENGTH, rowlength); - gl.glGetIntegerv(GL.GL_UNPACK_SKIP_ROWS, skiprows); - gl.glGetIntegerv(GL.GL_UNPACK_SKIP_PIXELS, skippixels); - gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, alignment); - /* Little endian machines (DEC Alpha for example) could - benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE - instead of GL_FALSE, but this would require changing the - generated bitmaps too. */ - gl.glPixelStorei(GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE); - gl.glPixelStorei(GL.GL_UNPACK_LSB_FIRST, GL.GL_FALSE); - gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, 0); - gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, 0); - gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, 0); - gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); - } - - private static void endBitmap(GL gl, - int[] swapbytes, - int[] lsbfirst, - int[] rowlength, - int[] skiprows, - int[] skippixels, - int[] alignment) { - /* Restore saved modes. */ - gl.glPixelStorei(GL.GL_UNPACK_SWAP_BYTES, swapbytes[0]); - gl.glPixelStorei(GL.GL_UNPACK_LSB_FIRST, lsbfirst[0]); - gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, rowlength[0]); - gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, skiprows[0]); - gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, skippixels[0]); - gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, alignment[0]); - } -} diff --git a/src/net/java/games/jogl/util/GLUTBitmap8x13.java b/src/net/java/games/jogl/util/GLUTBitmap8x13.java deleted file mode 100644 index caa007726..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmap8x13.java +++ /dev/null @@ -1,2078 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmap8x13 { - -/* GENERATED FILE -- DO NOT MODIFY */ - - -static final BitmapCharRec ch0 = new BitmapCharRec(0,0,0,0,8,null); - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,8,null); - -static final BitmapCharRec ch127 = new BitmapCharRec(0,0,0,0,8,null); - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,8,null); - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(6,12,-1,2,8,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0x80,(byte) 0x80,(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(6,10,-1,2,8,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(6,12,-1,2,8,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(6,10,-1,0,8,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(6,10,-1,0,8,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(6,10,-1,0,8,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(6,10,-1,0,8,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0x80,(byte) 0x78,(byte) 0xc4,(byte) 0xa4,(byte) 0x94,(byte) 0x8c,(byte) 0x78,(byte) 0x4, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(6,8,-1,1,8,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(5,7,-1,-1,8,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(6,10,-1,0,8,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(6,10,-1,0,8,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(6,10,-1,0,8,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(6,10,-1,0,8,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(6,10,-1,0,8,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(6,10,-1,0,8,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x8,(byte) 0x50,(byte) 0x30,(byte) 0x48, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(6,10,-1,0,8,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x50, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(5,10,-1,0,8,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(5,10,-1,0,8,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(5,10,-1,0,8,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(5,10,-1,0,8,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(6,10,-1,0,8,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(6,10,-1,0,8,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(6,10,-1,0,8,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(6,10,-1,0,8,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0x20,(byte) 0x10,(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(6,8,-1,2,8,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0x6c,(byte) 0x92,(byte) 0x90,(byte) 0x7c,(byte) 0x12,(byte) 0x6c, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(7,6,0,0,8,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x30,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(6,10,-1,0,8,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(6,10,-1,0,8,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(6,10,-1,0,8,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(6,10,-1,0,8,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(6,10,-1,0,8,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(6,10,-1,0,8,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0x80,(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(6,9,-1,1,8,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x80, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(6,9,-1,0,8,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(5,10,-1,0,8,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(6,10,-1,0,8,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(6,10,-1,0,8,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(6,10,-1,0,8,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(6,10,-1,0,8,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0x80,(byte) 0x78,(byte) 0xc4,(byte) 0xa4,(byte) 0xa4,(byte) 0xa4,(byte) 0x94,(byte) 0x94,(byte) 0x8c,(byte) 0x78,(byte) 0x4, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(6,11,-1,1,8,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x84, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(6,6,-1,-1,8,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(7,10,0,0,8,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(7,10,0,0,8,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x24,(byte) 0x18, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(7,10,0,0,8,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(7,10,0,0,8,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x8,(byte) 0x10, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(7,10,0,0,8,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(7,10,0,0,8,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xe2,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(7,9,0,0,8,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x50, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(5,10,-1,0,8,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(5,10,-1,0,8,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(5,10,-1,0,8,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(5,10,-1,0,8,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(6,10,-1,0,8,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(6,10,-1,0,8,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(6,10,-1,0,8,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(6,10,-1,0,8,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x20,(byte) 0x10,(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(6,11,-1,2,8,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0x9e,(byte) 0x90,(byte) 0x90,(byte) 0xf0,(byte) 0x9c,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x6e, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(7,9,0,0,8,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(6,10,-1,0,8,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(6,10,-1,0,8,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(6,10,-1,0,8,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(6,10,-1,0,8,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(6,10,-1,0,8,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(6,10,-1,0,8,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(6,9,-1,0,8,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0x66,(byte) 0x92,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(7,10,0,0,8,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x1e,(byte) 0x10,(byte) 0xc,(byte) 0x2,(byte) 0xf2,(byte) 0x4c,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(7,10,0,0,8,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0xe6,(byte) 0x42,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(7,10,0,0,8,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(7,7,0,-1,8,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xf0,(byte) 0x0,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(4,6,-1,-3,8,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(3,6,-1,-4,8,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(2,2,-3,2,8,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0xc0, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(2,1,-3,-4,8,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x7c, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(6,9,-1,0,8,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0x80,(byte) 0xb4,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(6,7,-1,1,8,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(2,2,-3,-8,8,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(4,6,-1,-4,8,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x60,(byte) 0x10,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(4,6,-1,-4,8,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(5,7,-1,-1,8,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(4,4,-2,-5,8,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xfc, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(6,1,-1,-8,8,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0x38,(byte) 0x44,(byte) 0xaa,(byte) 0xb2,(byte) 0xaa,(byte) 0xaa,(byte) 0x92,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(7,9,0,-1,8,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xfc, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(6,1,-1,-4,8,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfc, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(6,4,-1,-1,8,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(7,7,0,-1,8,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x78,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x70, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(5,7,-1,-2,8,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0x38,(byte) 0x44,(byte) 0x92,(byte) 0xaa,(byte) 0xa2,(byte) 0xaa,(byte) 0x92,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(7,9,0,-1,8,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xd8, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(5,1,-1,-8,8,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x80,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(4,10,-2,0,8,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(1,9,-3,0,8,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0x10,(byte) 0x10,(byte) 0x7c,(byte) 0x10,(byte) 0x7c,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(7,9,0,0,8,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0x84,(byte) 0x78,(byte) 0x48,(byte) 0x48,(byte) 0x78,(byte) 0x84, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(6,6,-1,-1,8,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0xdc,(byte) 0x62,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x70,(byte) 0x20,(byte) 0x22,(byte) 0x1c, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(7,9,0,0,8,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x20,(byte) 0x70,(byte) 0xa8,(byte) 0xa0,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x20, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(5,8,-1,-1,8,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(1,9,-3,0,8,ch161data); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0x90,(byte) 0xa8,(byte) 0x48, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(5,3,-1,-6,8,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0xe0,(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x18,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0xe0, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(5,9,-1,0,8,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(1,9,-3,0,8,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0x38,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x38, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(5,9,-2,0,8,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xfc,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0xfc, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(6,6,-1,0,8,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(6,8,-1,2,8,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x84, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(6,6,-1,0,8,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(7,6,0,0,8,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(5,6,-1,0,8,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(6,6,-1,0,8,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x38,(byte) 0x44,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xf8,(byte) 0x40,(byte) 0x40, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(6,8,-1,0,8,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0x78,(byte) 0x84,(byte) 0x18,(byte) 0x60,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(6,6,-1,0,8,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x44,(byte) 0xb8, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(6,6,-1,0,8,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x8c,(byte) 0x74, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(6,8,-1,2,8,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0xc4,(byte) 0xb8, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(6,8,-1,2,8,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(6,6,-1,0,8,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(6,6,-1,0,8,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(7,6,0,0,8,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(5,9,-1,0,8,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xe0,(byte) 0x90,(byte) 0x88,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(6,9,-1,0,8,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x18,(byte) 0x0,(byte) 0x8, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(5,10,-1,2,8,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(5,8,-1,0,8,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(6,9,-1,0,8,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0x78,(byte) 0x84,(byte) 0x78,(byte) 0x80,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x74, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(6,8,-1,2,8,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xf8,(byte) 0x40,(byte) 0x40,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(6,9,-1,0,8,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0xfc,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(6,6,-1,0,8,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x8c,(byte) 0x74,(byte) 0x4,(byte) 0x4,(byte) 0x4, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(6,9,-1,0,8,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(6,6,-1,0,8,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0xb8,(byte) 0xc4,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(6,9,-1,0,8,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x7c,(byte) 0x4,(byte) 0x78, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(6,6,-1,0,8,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0x10,(byte) 0x60,(byte) 0xe0, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(4,3,-2,-6,8,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xfe, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(7,1,0,1,8,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0x88,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(5,3,-1,-6,8,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(4,9,-1,0,8,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x2,(byte) 0x2,(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(7,9,0,0,8,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(4,9,-2,0,8,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfc, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(6,9,-1,0,8,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(7,9,0,0,8,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(7,9,0,0,8,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(7,9,0,0,8,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(7,9,0,0,8,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(6,9,-1,0,8,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(7,9,0,0,8,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x78,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(6,9,-1,0,8,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(6,9,-1,0,8,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0x4,(byte) 0x78,(byte) 0x94,(byte) 0xa4,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(6,10,-1,1,8,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(6,9,-1,0,8,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(6,9,-1,0,8,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x8c,(byte) 0x94,(byte) 0xa4,(byte) 0xc4,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(6,9,-1,0,8,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0xaa,(byte) 0xc6,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(7,9,0,0,8,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(6,9,-1,0,8,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xc0,(byte) 0xa0,(byte) 0x90,(byte) 0x88,(byte) 0x84, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(6,9,-1,0,8,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3c, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(6,9,-1,0,8,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(5,9,-1,0,8,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(6,9,-1,0,8,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x9c,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(6,9,-1,0,8,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(6,9,-1,0,8,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(6,9,-1,0,8,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(7,9,0,0,8,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(6,9,-1,0,8,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x7c,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(7,9,0,0,8,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(6,9,-1,0,8,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x78,(byte) 0x80,(byte) 0x94,(byte) 0xac,(byte) 0xa4,(byte) 0x9c,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(6,9,-1,0,8,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(6,9,-1,0,8,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(5,9,-1,0,8,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xfc,(byte) 0x0,(byte) 0x0,(byte) 0xfc, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(6,4,-1,-2,8,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(5,9,-2,0,8,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0x80,(byte) 0x60,(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x70,(byte) 0x20, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(4,8,-1,1,8,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0xe0,(byte) 0x40, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(3,8,-2,1,8,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0x70,(byte) 0x8,(byte) 0x4,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(6,9,-1,0,8,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(6,9,-1,0,8,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfc, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(6,9,-1,0,8,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x38, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(6,9,-1,0,8,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0xc4,(byte) 0xb8,(byte) 0x80,(byte) 0x80,(byte) 0xfc, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(6,9,-1,0,8,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x8,(byte) 0x8,(byte) 0xfc,(byte) 0x88,(byte) 0x88,(byte) 0x48,(byte) 0x28,(byte) 0x18,(byte) 0x8, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(6,9,-1,0,8,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x38,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfc, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(6,9,-1,0,8,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x40,(byte) 0x30,(byte) 0x8,(byte) 0x4,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(6,9,-1,0,8,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x60,(byte) 0x20, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(5,9,-1,0,8,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x30,(byte) 0x48,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(6,9,-1,0,8,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x2, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(7,9,0,0,8,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0x40,(byte) 0xe0,(byte) 0x40, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(3,3,-2,1,8,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xfc, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(6,1,-1,-4,8,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0x80,(byte) 0x60,(byte) 0x70, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(4,3,-1,1,8,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(5,5,-1,-2,8,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0x48,(byte) 0x30,(byte) 0xfc,(byte) 0x30,(byte) 0x48, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(6,5,-1,-2,8,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(3,9,-2,0,8,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(3,9,-3,0,8,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0x80,(byte) 0x60,(byte) 0x70, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(4,3,-1,-6,8,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x74,(byte) 0x88,(byte) 0x94,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(6,7,-1,0,8,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x88,(byte) 0x54,(byte) 0x48,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x48,(byte) 0xa4,(byte) 0x44, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(6,9,-1,0,8,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x20,(byte) 0xf0,(byte) 0x28,(byte) 0x70,(byte) 0xa0,(byte) 0x78,(byte) 0x20, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(5,7,-1,-1,8,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x48,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(6,7,-1,-1,8,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0x90,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(4,3,-2,-6,8,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(1,9,-3,0,8,ch33data); - -/* char: 0x1f */ - -static final byte[] ch31data = { -(byte) 0x80, -}; - -static final BitmapCharRec ch31 = new BitmapCharRec(1,1,-3,-3,8,ch31data); - -/* char: 0x1e */ - -static final byte[] ch30data = { -(byte) 0xdc,(byte) 0x62,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x70,(byte) 0x20,(byte) 0x22,(byte) 0x1c, -}; - -static final BitmapCharRec ch30 = new BitmapCharRec(7,9,0,0,8,ch30data); - -/* char: 0x1d */ - -static final byte[] ch29data = { -(byte) 0x80,(byte) 0x40,(byte) 0xfe,(byte) 0x10,(byte) 0xfe,(byte) 0x4,(byte) 0x2, -}; - -static final BitmapCharRec ch29 = new BitmapCharRec(7,7,0,0,8,ch29data); - -/* char: 0x1c */ - -static final byte[] ch28data = { -(byte) 0x88,(byte) 0x48,(byte) 0x48,(byte) 0x48,(byte) 0x48,(byte) 0xfc, -}; - -static final BitmapCharRec ch28 = new BitmapCharRec(6,6,-1,0,8,ch28data); - -/* char: 0x1b */ - -static final byte[] ch27data = { -(byte) 0xfe,(byte) 0x80,(byte) 0x20,(byte) 0x8,(byte) 0x2,(byte) 0x8,(byte) 0x20,(byte) 0x80, -}; - -static final BitmapCharRec ch27 = new BitmapCharRec(7,8,0,0,8,ch27data); - -/* char: 0x1a */ - -static final byte[] ch26data = { -(byte) 0xfe,(byte) 0x2,(byte) 0x8,(byte) 0x20,(byte) 0x80,(byte) 0x20,(byte) 0x8,(byte) 0x2, -}; - -static final BitmapCharRec ch26 = new BitmapCharRec(7,8,0,0,8,ch26data); - -/* char: 0x19 */ - -static final byte[] ch25data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch25 = new BitmapCharRec(1,13,-3,2,8,ch25data); - -/* char: 0x18 */ - -static final byte[] ch24data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xff, -}; - -static final BitmapCharRec ch24 = new BitmapCharRec(8,6,0,2,8,ch24data); - -/* char: 0x17 */ - -static final byte[] ch23data = { -(byte) 0xff,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch23 = new BitmapCharRec(8,8,0,-3,8,ch23data); - -/* char: 0x16 */ - -static final byte[] ch22data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch22 = new BitmapCharRec(4,13,0,2,8,ch22data); - -/* char: 0x15 */ - -static final byte[] ch21data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch21 = new BitmapCharRec(5,13,-3,2,8,ch21data); - -/* char: 0x14 */ - -static final byte[] ch20data = { -(byte) 0xff, -}; - -static final BitmapCharRec ch20 = new BitmapCharRec(8,1,0,1,8,ch20data); - -/* char: 0x13 */ - -static final byte[] ch19data = { -(byte) 0xff, -}; - -static final BitmapCharRec ch19 = new BitmapCharRec(8,1,0,-1,8,ch19data); - -/* char: 0x12 */ - -static final byte[] ch18data = { -(byte) 0xff, -}; - -static final BitmapCharRec ch18 = new BitmapCharRec(8,1,0,-3,8,ch18data); - -/* char: 0x11 */ - -static final byte[] ch17data = { -(byte) 0xff, -}; - -static final BitmapCharRec ch17 = new BitmapCharRec(8,1,0,-5,8,ch17data); - -/* char: 0x10 */ - -static final byte[] ch16data = { -(byte) 0xff, -}; - -static final BitmapCharRec ch16 = new BitmapCharRec(8,1,0,-7,8,ch16data); - -/* char: 0xf */ - -static final byte[] ch15data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xff,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch15 = new BitmapCharRec(8,13,0,2,8,ch15data); - -/* char: 0xe */ - -static final byte[] ch14data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch14 = new BitmapCharRec(5,8,-3,-3,8,ch14data); - -/* char: 0xd */ - -static final byte[] ch13data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8, -}; - -static final BitmapCharRec ch13 = new BitmapCharRec(5,6,-3,2,8,ch13data); - -/* char: 0xc */ - -static final byte[] ch12data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0, -}; - -static final BitmapCharRec ch12 = new BitmapCharRec(4,6,0,2,8,ch12data); - -/* char: 0xb */ - -static final byte[] ch11data = { -(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch11 = new BitmapCharRec(4,8,0,-3,8,ch11data); - -/* char: 0xa */ - -static final byte[] ch10data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch10 = new BitmapCharRec(7,9,0,2,8,ch10data); - -/* char: 0x9 */ - -static final byte[] ch9data = { -(byte) 0x3e,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x88,(byte) 0x98,(byte) 0xa8,(byte) 0xc8,(byte) 0x88, -}; - -static final BitmapCharRec ch9 = new BitmapCharRec(7,9,0,2,8,ch9data); - -/* char: 0x8 */ - -static final byte[] ch8data = { -(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch8 = new BitmapCharRec(7,6,0,0,8,ch8data); - -/* char: 0x7 */ - -static final byte[] ch7data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch7 = new BitmapCharRec(5,4,-1,-5,8,ch7data); - -/* char: 0x6 */ - -static final byte[] ch6data = { -(byte) 0x20,(byte) 0x20,(byte) 0x3c,(byte) 0x20,(byte) 0x3e,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch6 = new BitmapCharRec(7,9,0,2,8,ch6data); - -/* char: 0x5 */ - -static final byte[] ch5data = { -(byte) 0x22,(byte) 0x22,(byte) 0x3c,(byte) 0x22,(byte) 0x3c,(byte) 0x78,(byte) 0x80,(byte) 0x80,(byte) 0x78, -}; - -static final BitmapCharRec ch5 = new BitmapCharRec(7,9,0,2,8,ch5data); - -/* char: 0x4 */ - -static final byte[] ch4data = { -(byte) 0x10,(byte) 0x10,(byte) 0x1c,(byte) 0x10,(byte) 0x9e,(byte) 0x80,(byte) 0xe0,(byte) 0x80,(byte) 0xf0, -}; - -static final BitmapCharRec ch4 = new BitmapCharRec(7,9,0,2,8,ch4data); - -/* char: 0x3 */ - -static final byte[] ch3data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x88,(byte) 0x88,(byte) 0xf8,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch3 = new BitmapCharRec(7,9,0,2,8,ch3data); - -/* char: 0x2 */ - -static final byte[] ch2data = { -(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa, -}; - -static final BitmapCharRec ch2 = new BitmapCharRec(8,12,0,2,8,ch2data); - -/* char: 0x1 */ - -static final byte[] ch1data = { -(byte) 0x10,(byte) 0x38,(byte) 0x7c,(byte) 0xfe,(byte) 0x7c,(byte) 0x38,(byte) 0x10, -}; - -static final BitmapCharRec ch1 = new BitmapCharRec(7,7,0,-1,8,ch1data); - -static final BitmapCharRec[] chars = { -ch0, -ch1, -ch2, -ch3, -ch4, -ch5, -ch6, -ch7, -ch8, -ch9, -ch10, -ch11, -ch12, -ch13, -ch14, -ch15, -ch16, -ch17, -ch18, -ch19, -ch20, -ch21, -ch22, -ch23, -ch24, -ch25, -ch26, -ch27, -ch28, -ch29, -ch30, -ch31, -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -ch127, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmap8By13 = new BitmapFontRec("-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1", - 256, - 0, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTBitmap9x15.java b/src/net/java/games/jogl/util/GLUTBitmap9x15.java deleted file mode 100644 index 05aa2635b..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmap9x15.java +++ /dev/null @@ -1,2079 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmap9x15 { - -/* GENERATED FILE -- DO NOT MODIFY */ - -static final BitmapCharRec ch0 = new BitmapCharRec(0,0,0,0,9,null); - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,9,null); - -static final BitmapCharRec ch127 = new BitmapCharRec(0,0,0,0,9,null); - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,9,null); - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(6,14,-1,3,9,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(7,12,-1,3,9,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(6,14,-1,3,9,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(7,11,-1,0,9,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(7,11,-1,0,9,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(7,11,-1,0,9,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(7,11,-1,0,9,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0x80,(byte) 0x7c,(byte) 0xa2,(byte) 0xa2,(byte) 0x92,(byte) 0x8a,(byte) 0x8a,(byte) 0x7c,(byte) 0x2, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(7,9,-1,1,9,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x10,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0xfe,(byte) 0x0,(byte) 0x10,(byte) 0x38,(byte) 0x10, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(7,9,-1,0,9,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(7,11,-1,0,9,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(7,11,-1,0,9,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(7,11,-1,0,9,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(7,11,-1,0,9,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(7,11,-1,0,9,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(7,11,-1,0,9,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x8,(byte) 0x50,(byte) 0x30,(byte) 0x48, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(7,11,-1,0,9,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x50, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(5,11,-2,0,9,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(5,11,-2,0,9,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x60,(byte) 0x10, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(5,11,-2,0,9,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x40, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(5,11,-2,0,9,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(7,11,-1,0,9,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(7,11,-1,0,9,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(7,11,-1,0,9,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(7,11,-1,0,9,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0x30,(byte) 0x48,(byte) 0x18,(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(7,10,-1,3,9,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0x6e,(byte) 0x92,(byte) 0x90,(byte) 0x7c,(byte) 0x12,(byte) 0x92,(byte) 0x6c, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(7,7,-1,0,9,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x18,(byte) 0x24,(byte) 0x18, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(7,11,-1,0,9,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(7,11,-1,0,9,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(7,11,-1,0,9,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(7,11,-1,0,9,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(7,11,-1,0,9,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(7,11,-1,0,9,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0x80,(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(7,9,-1,1,9,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfc,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(7,10,-1,0,9,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(7,11,-1,0,9,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(7,11,-1,0,9,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(7,11,-1,0,9,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(7,11,-1,0,9,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(7,11,-1,0,9,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0x80,(byte) 0x7c,(byte) 0xc2,(byte) 0xa2,(byte) 0xa2,(byte) 0x92,(byte) 0x92,(byte) 0x8a,(byte) 0x8a,(byte) 0x86,(byte) 0x7c,(byte) 0x2, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(7,12,-1,1,9,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(7,7,-1,-1,9,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(7,11,-1,0,9,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(7,11,-1,0,9,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(7,11,-1,0,9,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(7,11,-1,0,9,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(7,11,-1,0,9,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x92,(byte) 0x92,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(7,11,-1,0,9,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xf2,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(7,10,-1,0,9,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x50, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(5,11,-2,0,9,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(5,11,-2,0,9,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x60,(byte) 0x10, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(5,11,-2,0,9,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x0,(byte) 0x30,(byte) 0x40, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(5,11,-2,0,9,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(7,11,-1,0,9,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(7,11,-1,0,9,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(7,11,-1,0,9,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0xfe,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(7,11,-1,0,9,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x30,(byte) 0x48,(byte) 0x18,(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(7,13,-1,3,9,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0x9e,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xfc,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x6e, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(7,10,-1,0,9,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x10,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(7,11,-1,0,9,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(7,11,-1,0,9,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(7,11,-1,0,9,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(7,11,-1,0,9,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x30,(byte) 0x8, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(7,11,-1,0,9,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x0,(byte) 0x18,(byte) 0x20, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(7,11,-1,0,9,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(7,10,-1,0,9,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0x66,(byte) 0x92,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(7,10,-1,0,9,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x1e,(byte) 0x10,(byte) 0xc,(byte) 0x2,(byte) 0xf2,(byte) 0x4c,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(7,10,-1,0,9,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x6,(byte) 0x1a,(byte) 0x12,(byte) 0xa,(byte) 0xe6,(byte) 0x42,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(7,10,-1,0,9,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12,(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(7,8,-1,-1,9,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(5,6,-1,-5,9,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(3,6,-1,-4,9,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0x60,(byte) 0x90,(byte) 0x30, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(4,3,-2,3,9,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(2,2,-4,-4,9,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0xa,(byte) 0xa,(byte) 0xa,(byte) 0xa,(byte) 0xa,(byte) 0x7a,(byte) 0x8a,(byte) 0x8a,(byte) 0x8a,(byte) 0x7e, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(7,10,-1,0,9,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0x80,(byte) 0x80,(byte) 0xba,(byte) 0xc6,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(7,9,-1,2,9,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0xc0,(byte) 0x20, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(3,2,-3,-9,9,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x20,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(4,6,-1,-4,9,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x60,(byte) 0x10,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(4,6,-1,-4,9,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xfe,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(7,9,-1,-1,9,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(4,4,-3,-6,9,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xfc, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(6,1,-1,-9,9,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0x3c,(byte) 0x42,(byte) 0xa5,(byte) 0xa9,(byte) 0xbd,(byte) 0xa5,(byte) 0xb9,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(8,9,0,-1,9,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xfc, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(6,1,-1,-4,9,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfc, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(6,4,-1,-2,9,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x12,(byte) 0x24,(byte) 0x48,(byte) 0x90,(byte) 0x90,(byte) 0x48,(byte) 0x24,(byte) 0x12, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(7,8,-1,-1,9,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x78,(byte) 0x90,(byte) 0x70,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(5,7,-3,-3,9,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x99,(byte) 0xa5,(byte) 0xa1,(byte) 0xa5,(byte) 0x99,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(8,9,0,-1,9,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xa0,(byte) 0xa0, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(3,2,-3,-9,9,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(5,11,-2,1,9,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(1,11,-4,1,9,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x7c,(byte) 0x10,(byte) 0x7c,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(7,10,-1,0,9,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x7c,(byte) 0x82, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(7,6,-1,-3,9,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0x5c,(byte) 0xa2,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x22,(byte) 0x1c, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(7,10,-1,0,9,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x40,(byte) 0x78,(byte) 0xa4,(byte) 0xa0,(byte) 0x90,(byte) 0x94,(byte) 0x78,(byte) 0x8, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(6,8,-1,0,9,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(1,11,-4,0,9,ch161data); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0x8c,(byte) 0x92,(byte) 0x62, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(7,3,-1,-7,9,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0xe0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x18,(byte) 0x18,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xe0, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(5,12,-1,1,9,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(1,12,-4,1,9,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0x38,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0xc0,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x38, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(5,12,-3,1,9,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xfe,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0xfe, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(7,7,-1,0,9,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(6,10,-1,3,9,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(7,7,-1,0,9,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(7,7,-1,0,9,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(7,7,-1,0,9,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x7a,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(7,7,-1,0,9,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x1c,(byte) 0x22,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xfc,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(7,9,-1,0,9,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x2,(byte) 0x7c,(byte) 0x80,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(7,7,-1,0,9,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x42,(byte) 0x62,(byte) 0x9c, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(7,7,-1,0,9,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x2,(byte) 0x2,(byte) 0x2,(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x86,(byte) 0x7a, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(7,10,-1,3,9,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(7,10,-1,3,9,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(7,7,-1,0,9,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(7,7,-1,0,9,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(7,7,-1,0,9,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(5,10,-2,0,9,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0x82,(byte) 0x8c,(byte) 0xb0,(byte) 0xc0,(byte) 0xb0,(byte) 0x8c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(7,10,-1,0,9,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x1c,(byte) 0x0,(byte) 0x0,(byte) 0xc, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(6,13,-1,3,9,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x60, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(5,10,-2,0,9,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(7,10,-1,0,9,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x80,(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x7a, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(7,10,-1,3,9,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x22,(byte) 0x22,(byte) 0x1c, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(7,10,-1,0,9,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(7,7,-1,0,9,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x86,(byte) 0x7a,(byte) 0x2,(byte) 0x2,(byte) 0x2, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(7,10,-1,0,9,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(7,7,-1,0,9,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0xbc,(byte) 0xc2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(7,10,-1,0,9,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x7e,(byte) 0x2,(byte) 0x2,(byte) 0x7c, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(7,7,-1,0,9,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(4,4,-3,-6,9,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xff, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(8,1,0,1,9,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(7,4,-1,-6,9,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xf0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xf0, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(4,12,-2,1,9,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x2,(byte) 0x4,(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(7,10,-1,0,9,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(4,12,-3,1,9,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xfe,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0xfe, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(7,10,-1,0,9,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(7,10,-1,0,9,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(7,10,-1,0,9,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x44,(byte) 0xaa,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(7,10,-1,0,9,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(7,10,-1,0,9,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(7,10,-1,0,9,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(7,10,-1,0,9,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x2,(byte) 0xc,(byte) 0x70,(byte) 0x80,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(7,10,-1,0,9,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0x82,(byte) 0x82,(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfc, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(7,10,-1,0,9,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0x6,(byte) 0x8,(byte) 0x7c,(byte) 0x92,(byte) 0xa2,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(7,12,-1,2,9,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfc, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(7,10,-1,0,9,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(7,10,-1,0,9,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(7,10,-1,0,9,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x92,(byte) 0x92,(byte) 0xaa,(byte) 0xaa,(byte) 0xc6,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(7,10,-1,0,9,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xfe,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(7,10,-1,0,9,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0x82,(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xe0,(byte) 0x90,(byte) 0x88,(byte) 0x84,(byte) 0x82, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(7,10,-1,0,9,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0x78,(byte) 0x84,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0x1e, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(7,10,-1,0,9,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(5,10,-2,0,9,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(7,10,-1,0,9,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x8e,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(7,10,-1,0,9,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xfe, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(7,10,-1,0,9,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xfe,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x78,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xfe, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(7,10,-1,0,9,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(7,10,-1,0,9,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(7,10,-1,0,9,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xfc,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0x7c,(byte) 0x42,(byte) 0x42,(byte) 0x42,(byte) 0xfc, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(7,10,-1,0,9,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(7,10,-1,0,9,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x7c,(byte) 0x80,(byte) 0x80,(byte) 0x9a,(byte) 0xa6,(byte) 0xa2,(byte) 0x9e,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(7,10,-1,0,9,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(7,10,-1,0,9,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(5,10,-2,0,9,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xfe,(byte) 0x0,(byte) 0x0,(byte) 0xfe, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(7,4,-1,-2,9,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(5,10,-2,0,9,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(2,10,-4,3,9,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(2,7,-4,0,9,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0x78,(byte) 0x4,(byte) 0x2,(byte) 0x2,(byte) 0x7a,(byte) 0x86,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(7,10,-1,0,9,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(7,10,-1,0,9,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x2,(byte) 0xfe, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(7,10,-1,0,9,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x3c, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(7,10,-1,0,9,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x2,(byte) 0x2,(byte) 0x2,(byte) 0xc2,(byte) 0xbc,(byte) 0x80,(byte) 0x80,(byte) 0xfe, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(7,10,-1,0,9,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfe,(byte) 0x84,(byte) 0x44,(byte) 0x24,(byte) 0x14,(byte) 0xc,(byte) 0x4, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(7,10,-1,0,9,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0x7c,(byte) 0x82,(byte) 0x2,(byte) 0x2,(byte) 0x2,(byte) 0x1c,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0xfe, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(7,10,-1,0,9,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xfe,(byte) 0x80,(byte) 0x40,(byte) 0x30,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0x82,(byte) 0x82,(byte) 0x7c, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(7,10,-1,0,9,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x90,(byte) 0x50,(byte) 0x30,(byte) 0x10, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(7,10,-1,0,9,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(7,10,-1,0,9,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x4,(byte) 0x2, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(7,10,-1,0,9,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(2,2,-4,0,9,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xfe, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(7,1,-1,-4,9,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(2,5,-4,3,9,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(7,7,-1,-1,9,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0x10,(byte) 0x92,(byte) 0x54,(byte) 0x38,(byte) 0x54,(byte) 0x92,(byte) 0x10, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(7,7,-1,-1,9,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(3,12,-3,1,9,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(3,12,-3,1,9,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x30, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(4,4,-3,-6,9,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x62,(byte) 0x94,(byte) 0x88,(byte) 0x94,(byte) 0x62,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(7,10,-1,0,9,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x84,(byte) 0x4a,(byte) 0x4a,(byte) 0x24,(byte) 0x10,(byte) 0x10,(byte) 0x48,(byte) 0xa4,(byte) 0xa4,(byte) 0x42, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(7,10,-1,0,9,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x10,(byte) 0x7c,(byte) 0x92,(byte) 0x12,(byte) 0x12,(byte) 0x14,(byte) 0x38,(byte) 0x50,(byte) 0x90,(byte) 0x92,(byte) 0x7c,(byte) 0x10, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(7,12,-1,1,9,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x48,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0x48,(byte) 0xfc,(byte) 0x48,(byte) 0x48, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(6,8,-1,-1,9,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0x90,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(4,3,-3,-7,9,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(1,11,-4,0,9,ch33data); - -/* char: 0x1f */ - -static final byte[] ch31data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch31 = new BitmapCharRec(2,2,-4,-2,9,ch31data); - -/* char: 0x1e */ - -static final byte[] ch30data = { -(byte) 0x5c,(byte) 0xa2,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x22,(byte) 0x1c, -}; - -static final BitmapCharRec ch30 = new BitmapCharRec(7,10,-1,0,9,ch30data); - -/* char: 0x1d */ - -static final byte[] ch29data = { -(byte) 0x80,(byte) 0x40,(byte) 0xfe,(byte) 0x10,(byte) 0xfe,(byte) 0x4,(byte) 0x2, -}; - -static final BitmapCharRec ch29 = new BitmapCharRec(7,7,-1,0,9,ch29data); - -/* char: 0x1c */ - -static final byte[] ch28data = { -(byte) 0x44,(byte) 0x24,(byte) 0x24,(byte) 0x24,(byte) 0x24,(byte) 0x24,(byte) 0xfe, -}; - -static final BitmapCharRec ch28 = new BitmapCharRec(7,7,-1,0,9,ch28data); - -/* char: 0x1b */ - -static final byte[] ch27data = { -(byte) 0xfe,(byte) 0x0,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch27 = new BitmapCharRec(7,12,-1,2,9,ch27data); - -/* char: 0x1a */ - -static final byte[] ch26data = { -(byte) 0xfc,(byte) 0x0,(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4, -}; - -static final BitmapCharRec ch26 = new BitmapCharRec(6,12,-2,2,9,ch26data); - -/* char: 0x19 */ - -static final byte[] ch25data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch25 = new BitmapCharRec(1,15,-4,3,9,ch25data); - -/* char: 0x18 */ - -static final byte[] ch24data = { -(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch24 = new BitmapCharRec(9,7,0,3,9,ch24data); - -/* char: 0x17 */ - -static final byte[] ch23data = { -(byte) 0xff,(byte) 0x80,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0, -(byte) 0x8,(byte) 0x0, -}; - -static final BitmapCharRec ch23 = new BitmapCharRec(9,9,0,-3,9,ch23data); - -/* char: 0x16 */ - -static final byte[] ch22data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0xf8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8, -}; - -static final BitmapCharRec ch22 = new BitmapCharRec(5,15,0,3,9,ch22data); - -/* char: 0x15 */ - -static final byte[] ch21data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch21 = new BitmapCharRec(5,15,-4,3,9,ch21data); - -/* char: 0x14 */ - -static final byte[] ch20data = { -(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch20 = new BitmapCharRec(9,1,0,1,9,ch20data); - -/* char: 0x13 */ - -static final byte[] ch19data = { -(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch19 = new BitmapCharRec(9,1,0,-1,9,ch19data); - -/* char: 0x12 */ - -static final byte[] ch18data = { -(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch18 = new BitmapCharRec(9,1,0,-3,9,ch18data); - -/* char: 0x11 */ - -static final byte[] ch17data = { -(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch17 = new BitmapCharRec(9,1,0,-5,9,ch17data); - -/* char: 0x10 */ - -static final byte[] ch16data = { -(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch16 = new BitmapCharRec(9,1,0,-7,9,ch16data); - -/* char: 0xf */ - -static final byte[] ch15data = { -(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0x8,(byte) 0x0, -(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0, -}; - -static final BitmapCharRec ch15 = new BitmapCharRec(9,15,0,3,9,ch15data); - -/* char: 0xe */ - -static final byte[] ch14data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch14 = new BitmapCharRec(5,9,-4,-3,9,ch14data); - -/* char: 0xd */ - -static final byte[] ch13data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8, -}; - -static final BitmapCharRec ch13 = new BitmapCharRec(5,7,-4,3,9,ch13data); - -/* char: 0xc */ - -static final byte[] ch12data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0xf8, -}; - -static final BitmapCharRec ch12 = new BitmapCharRec(5,7,0,3,9,ch12data); - -/* char: 0xb */ - -static final byte[] ch11data = { -(byte) 0xf8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8, -}; - -static final BitmapCharRec ch11 = new BitmapCharRec(5,9,0,-3,9,ch11data); - -/* char: 0xa */ - -static final byte[] ch10data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x0,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch10 = new BitmapCharRec(7,10,-1,2,9,ch10data); - -/* char: 0x9 */ - -static final byte[] ch9data = { -(byte) 0x3e,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x88,(byte) 0x98,(byte) 0xa8,(byte) 0xc8,(byte) 0x88, -}; - -static final BitmapCharRec ch9 = new BitmapCharRec(7,10,-1,2,9,ch9data); - -/* char: 0x8 */ - -static final byte[] ch8data = { -(byte) 0xfe,(byte) 0x10,(byte) 0x10,(byte) 0xfe,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch8 = new BitmapCharRec(7,6,-1,0,9,ch8data); - -/* char: 0x7 */ - -static final byte[] ch7data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch7 = new BitmapCharRec(5,4,-2,-6,9,ch7data); - -/* char: 0x6 */ - -static final byte[] ch6data = { -(byte) 0x20,(byte) 0x20,(byte) 0x3c,(byte) 0x20,(byte) 0x3e,(byte) 0x0,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch6 = new BitmapCharRec(7,10,-1,2,9,ch6data); - -/* char: 0x5 */ - -static final byte[] ch5data = { -(byte) 0x22,(byte) 0x22,(byte) 0x3c,(byte) 0x22,(byte) 0x3c,(byte) 0x0,(byte) 0x78,(byte) 0x80,(byte) 0x80,(byte) 0x78, -}; - -static final BitmapCharRec ch5 = new BitmapCharRec(7,10,-1,2,9,ch5data); - -/* char: 0x4 */ - -static final byte[] ch4data = { -(byte) 0x10,(byte) 0x10,(byte) 0x1c,(byte) 0x10,(byte) 0x1e,(byte) 0x80,(byte) 0x80,(byte) 0xe0,(byte) 0x80,(byte) 0xf0, -}; - -static final BitmapCharRec ch4 = new BitmapCharRec(7,10,-1,2,9,ch4data); - -/* char: 0x3 */ - -static final byte[] ch3data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x3e,(byte) 0x0,(byte) 0x88,(byte) 0x88,(byte) 0xf8,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch3 = new BitmapCharRec(7,10,-1,2,9,ch3data); - -/* char: 0x2 */ - -static final byte[] ch2data = { -(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa,(byte) 0x55,(byte) 0xaa, -}; - -static final BitmapCharRec ch2 = new BitmapCharRec(8,14,0,3,9,ch2data); - -/* char: 0x1 */ - -static final byte[] ch1data = { -(byte) 0x10,(byte) 0x38,(byte) 0x7c,(byte) 0xfe,(byte) 0x7c,(byte) 0x38,(byte) 0x10, -}; - -static final BitmapCharRec ch1 = new BitmapCharRec(7,7,-1,0,9,ch1data); - -static final BitmapCharRec[] chars = { -ch0, -ch1, -ch2, -ch3, -ch4, -ch5, -ch6, -ch7, -ch8, -ch9, -ch10, -ch11, -ch12, -ch13, -ch14, -ch15, -ch16, -ch17, -ch18, -ch19, -ch20, -ch21, -ch22, -ch23, -ch24, -ch25, -ch26, -ch27, -ch28, -ch29, -ch30, -ch31, -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -ch127, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmap9By15 = new BitmapFontRec("-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1", - 256, - 0, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java b/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java deleted file mode 100644 index d238d7d16..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java +++ /dev/null @@ -1,1798 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmapHelvetica10 { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(4,10,0,2,5,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(5,10,0,2,6,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(4,11,0,2,5,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(4,8,0,0,5,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(4,9,0,0,5,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(4,9,0,0,5,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(4,9,0,0,5,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0x70,(byte) 0x88,(byte) 0xc8,(byte) 0xa8,(byte) 0x98,(byte) 0x74, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(6,6,0,0,6,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(5,5,0,-1,6,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(5,8,0,0,6,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(5,9,0,0,6,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(5,9,0,0,6,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(5,9,0,0,6,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(5,9,0,0,6,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(4,9,0,0,5,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x90,(byte) 0x60,(byte) 0x50, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(5,9,0,0,6,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(3,8,0,0,2,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(3,9,1,0,2,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(2,9,0,0,2,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(2,9,1,0,2,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(4,8,0,0,5,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(4,9,0,0,5,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(4,9,0,0,5,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(4,9,0,0,5,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0x60,(byte) 0x20,(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0x80,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(4,8,0,2,5,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0x6c,(byte) 0x92,(byte) 0x90,(byte) 0x7e,(byte) 0x12,(byte) 0xec, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(7,6,0,0,8,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x20,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(5,9,0,0,5,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(5,8,0,0,5,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(5,9,0,0,5,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(5,9,0,0,5,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(5,9,0,0,5,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(5,9,0,0,5,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xa0,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(4,8,0,0,5,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(5,8,-1,0,7,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(7,11,0,0,7,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(6,10,-1,0,8,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(6,11,-1,0,8,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(6,11,-1,0,8,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(6,11,-1,0,8,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0x80,(byte) 0x78,(byte) 0xc4,(byte) 0xa4,(byte) 0xa4,(byte) 0x94,(byte) 0x94,(byte) 0x8c,(byte) 0x78,(byte) 0x4, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(6,10,-1,1,8,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(5,5,0,-1,6,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x48, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(6,10,-1,0,8,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(6,11,-1,0,8,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(6,11,-1,0,8,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(6,11,-1,0,8,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(6,11,-1,0,8,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0x8c,(byte) 0x8c,(byte) 0x94,(byte) 0x94,(byte) 0xa4,(byte) 0xa4,(byte) 0xc4,(byte) 0xc4,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(6,11,-1,0,8,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0x78,(byte) 0x44,(byte) 0x42,(byte) 0x42,(byte) 0xf2,(byte) 0x42,(byte) 0x44,(byte) 0x78, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(7,8,0,0,8,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(3,10,0,0,3,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(3,11,0,0,3,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(2,11,-1,0,3,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(2,11,0,0,3,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(5,10,-1,0,7,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(5,11,-1,0,7,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(5,11,-1,0,7,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(5,11,-1,0,7,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x30,(byte) 0x10,(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(6,10,-1,2,8,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0x8f,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x48,(byte) 0x0,(byte) 0x2f,(byte) 0x80,(byte) 0x28,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x1f,(byte) 0x80, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(9,8,0,0,10,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(7,11,0,0,7,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(7,10,0,0,7,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(7,11,0,0,7,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(7,11,0,0,7,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(7,11,0,0,7,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(7,11,0,0,7,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(4,8,-1,2,6,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x21,(byte) 0x0,(byte) 0x17,(byte) 0x80,(byte) 0x13,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0xc8,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xe2,(byte) 0x0, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(9,8,0,0,9,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x27,(byte) 0x12,(byte) 0x15,(byte) 0xb,(byte) 0x48,(byte) 0x44,(byte) 0xc4,(byte) 0x42, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(8,8,0,0,9,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x21,(byte) 0x0,(byte) 0x17,(byte) 0x80,(byte) 0x13,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x48,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xc4,(byte) 0x0,(byte) 0x42,(byte) 0x0, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(9,8,0,0,9,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0xa0,(byte) 0x50,(byte) 0x28,(byte) 0x50,(byte) 0xa0, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(5,5,0,0,6,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xe0,(byte) 0xa0,(byte) 0xe0, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(3,5,0,-3,4,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(2,4,0,-3,3,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(2,2,0,2,3,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0xc0, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(2,1,0,-3,3,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x7c, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(6,10,0,2,6,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(4,8,0,2,5,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(2,2,0,-6,3,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0xe0, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(3,4,0,-3,3,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xe0,(byte) 0x40,(byte) 0xa0,(byte) 0x60, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(3,4,0,-3,3,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(5,7,0,0,6,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(4,4,0,-3,4,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xe0, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(3,1,0,-7,3,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0x38,(byte) 0x44,(byte) 0xaa,(byte) 0xb2,(byte) 0xba,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(7,7,-1,0,9,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xe0, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(3,1,0,-3,4,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x8,(byte) 0x8,(byte) 0xf8, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(5,3,-1,-2,7,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x28,(byte) 0x50,(byte) 0xa0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(5,5,0,0,6,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x20,(byte) 0xe0, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(3,5,0,-3,4,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0x38,(byte) 0x44,(byte) 0x9a,(byte) 0xa2,(byte) 0x9a,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(7,7,-1,0,9,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xa0, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(3,1,0,-7,3,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0x70,(byte) 0x88,(byte) 0x18,(byte) 0x70,(byte) 0xc8,(byte) 0x98,(byte) 0x70,(byte) 0xc0,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(5,10,0,2,6,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(1,10,-1,2,3,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0xf8,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(5,8,0,0,6,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0x90,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x90, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(4,6,0,-1,5,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0xb0,(byte) 0x48,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(5,8,0,0,6,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x40,(byte) 0x70,(byte) 0xa8,(byte) 0xa0,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x10, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(5,8,0,1,6,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(1,8,-1,2,3,ch161data); - -/* char: 0xa0 */ - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,3,null); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0x98,(byte) 0x64, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(6,2,0,-3,7,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(3,10,0,2,3,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(1,10,-1,2,3,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(3,10,0,2,3,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0xf0, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(4,6,0,0,5,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0xa0,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(4,8,0,2,5,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0x88,(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(5,6,0,0,6,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x28,(byte) 0x28,(byte) 0x54,(byte) 0x54,(byte) 0x92,(byte) 0x92, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(7,6,0,0,8,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(5,6,0,0,6,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(4,6,0,0,5,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x60,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x40, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(3,8,0,0,4,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(4,6,0,0,5,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0,(byte) 0xa0, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(3,6,0,0,4,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x8,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(5,8,0,2,6,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(5,8,0,2,6,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(5,6,0,0,6,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(5,6,0,0,6,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(7,6,0,0,8,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(1,8,0,0,2,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0x90,(byte) 0x90,(byte) 0xa0,(byte) 0xc0,(byte) 0xa0,(byte) 0x90,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(4,8,0,0,5,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(1,9,0,1,2,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(1,8,0,0,2,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(5,8,0,0,6,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0x70,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(5,8,0,2,6,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x30, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(4,8,0,0,4,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0xf0,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(4,6,0,0,5,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68,(byte) 0x8,(byte) 0x8, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(5,8,0,0,6,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x60,(byte) 0x90,(byte) 0x80,(byte) 0x80,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(4,6,0,0,5,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(5,8,0,0,6,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0xe0, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(5,6,0,0,5,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0x80,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(2,3,0,-5,3,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xfc, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(6,1,0,2,6,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0x88,(byte) 0x50,(byte) 0x50,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(5,5,0,-3,6,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(2,10,0,2,3,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(3,8,0,0,3,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(2,10,-1,2,3,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0xf8, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(5,8,-1,0,7,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(7,8,0,0,7,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0x88,(byte) 0x88,(byte) 0x50,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(5,8,-1,0,7,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(9,8,0,0,9,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(7,8,0,0,7,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(6,8,-1,0,8,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xf8, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(5,8,0,0,5,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x70,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(5,8,-1,0,7,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(5,8,-1,0,7,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0x2,(byte) 0x7c,(byte) 0x8c,(byte) 0x94,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(7,9,-1,1,8,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(5,8,-1,0,7,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(6,8,-1,0,8,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0x8c,(byte) 0x8c,(byte) 0x94,(byte) 0x94,(byte) 0xa4,(byte) 0xa4,(byte) 0xc4,(byte) 0xc4, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(6,8,-1,0,8,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xaa,(byte) 0xaa,(byte) 0xc6,(byte) 0xc6,(byte) 0x82, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(7,8,-1,0,9,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(4,8,-1,0,6,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0x88,(byte) 0x88,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0xa0,(byte) 0x90,(byte) 0x88, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(5,8,-1,0,7,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(4,8,0,0,5,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(1,8,-1,0,3,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xfc,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(6,8,-1,0,8,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0x74,(byte) 0x8c,(byte) 0x84,(byte) 0x8c,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(6,8,-1,0,8,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xf8, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(5,8,-1,0,6,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0xf8, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(5,8,-1,0,7,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xf0,(byte) 0x88,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x88,(byte) 0xf0, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(6,8,-1,0,8,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0x78,(byte) 0x84,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(6,8,-1,0,8,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xf0,(byte) 0x88,(byte) 0x88,(byte) 0xf0, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(5,8,-1,0,7,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(7,8,0,0,7,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x9b,(byte) 0x0,(byte) 0xa4,(byte) 0x80,(byte) 0xa4,(byte) 0x80,(byte) 0xa2,(byte) 0x40,(byte) 0x92,(byte) 0x40,(byte) 0x4d,(byte) 0x40, -(byte) 0x20,(byte) 0x80,(byte) 0x1f,(byte) 0x0, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(10,10,0,2,11,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(4,8,-1,0,6,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(3,5,-1,-1,6,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xf0,(byte) 0x0,(byte) 0xf0, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(4,3,0,-2,5,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(3,5,-1,-1,6,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(2,8,0,2,3,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(1,6,-1,0,3,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(5,8,0,0,6,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(5,8,0,0,6,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0xf8, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(5,8,0,0,6,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(5,8,0,0,6,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xf8, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(5,8,0,0,6,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x10,(byte) 0x10,(byte) 0xf8,(byte) 0x90,(byte) 0x50,(byte) 0x50,(byte) 0x30,(byte) 0x10, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(5,8,0,0,6,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(5,8,0,0,6,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x40,(byte) 0x30,(byte) 0x8,(byte) 0x8,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(5,8,0,0,6,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(2,8,-1,0,6,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(5,8,0,0,6,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(3,8,0,0,3,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0x80, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(1,1,-1,0,3,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xf8, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(5,1,-1,-3,7,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(2,3,0,2,3,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(5,5,0,-1,6,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0xa0,(byte) 0x40,(byte) 0xa0, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(3,3,0,-5,4,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(3,10,-1,2,4,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(3,10,0,2,4,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(2,3,-1,-5,3,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x64,(byte) 0x98,(byte) 0x98,(byte) 0xa4,(byte) 0x60,(byte) 0x50,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(6,8,-1,0,8,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x26,(byte) 0x29,(byte) 0x16,(byte) 0x10,(byte) 0x8,(byte) 0x68,(byte) 0x94,(byte) 0x64, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(8,8,0,0,9,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x20,(byte) 0x70,(byte) 0xa8,(byte) 0x28,(byte) 0x70,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x20, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(5,9,0,1,6,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x50,(byte) 0x50,(byte) 0xf8,(byte) 0x28,(byte) 0x7c,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(6,7,0,0,6,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0xa0,(byte) 0xa0, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(3,2,-1,-6,4,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(1,8,-1,0,3,ch33data); - -/* char: 0x20 ' ' */ - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,3,null); - -static final BitmapCharRec[] chars = { -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmapHelvetica10 = new BitmapFontRec("-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1", - 224, - 32, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java b/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java deleted file mode 100644 index fe29ab84f..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java +++ /dev/null @@ -1,1808 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmapHelvetica12 { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x30,(byte) 0x50,(byte) 0x50,(byte) 0x48,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(5,12,-1,3,7,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(5,12,-1,3,7,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x90,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(5,13,-1,3,7,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(5,9,-1,0,7,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(5,10,-1,0,7,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(5,10,-1,0,7,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(5,10,-1,0,7,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0xb8,(byte) 0x44,(byte) 0x64,(byte) 0x54,(byte) 0x4c,(byte) 0x44,(byte) 0x3a, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(7,7,0,0,7,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(5,5,-1,-1,7,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(5,9,-1,0,7,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(5,10,-1,0,7,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(5,10,-1,0,7,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(5,10,-1,0,7,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(5,10,-1,0,7,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(5,10,-1,0,7,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x50,(byte) 0x30,(byte) 0x68, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(5,10,-1,0,7,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(3,9,0,0,3,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(3,10,0,0,3,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(2,10,-1,0,3,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(2,10,0,0,3,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(5,9,-1,0,7,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(5,10,-1,0,7,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(5,10,-1,0,7,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(5,10,-1,0,7,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0x60,(byte) 0x10,(byte) 0x20,(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(5,10,-1,3,7,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0x77,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x7f,(byte) 0x80,(byte) 0x8,(byte) 0x80,(byte) 0x88,(byte) 0x80,(byte) 0x77,(byte) 0x0, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(9,7,-1,0,11,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x30,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(6,10,-1,0,7,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(6,9,-1,0,7,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(6,10,-1,0,7,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(6,10,-1,0,7,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(6,10,-1,0,7,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(6,10,-1,0,7,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0xb0,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xb0,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(5,9,-1,0,7,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(6,9,-1,0,8,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(7,12,-1,0,9,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x48, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(6,11,-1,0,8,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(6,12,-1,0,8,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(6,12,-1,0,8,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(6,12,-1,0,8,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0x80,(byte) 0x0,(byte) 0x5e,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x50,(byte) 0x80,(byte) 0x48,(byte) 0x80,(byte) 0x44,(byte) 0x80,(byte) 0x44,(byte) 0x80,(byte) 0x42,(byte) 0x80, -(byte) 0x21,(byte) 0x0,(byte) 0x1e,(byte) 0x80,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(10,11,0,1,10,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(5,5,-1,-1,7,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x24, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(8,11,-1,0,10,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(8,12,-1,0,10,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x14,(byte) 0x8, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(8,12,-1,0,10,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x8,(byte) 0x4, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(8,12,-1,0,10,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c,(byte) 0x0,(byte) 0x8,(byte) 0x10, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(8,12,-1,0,10,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xa2,(byte) 0xc2,(byte) 0x82,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(7,12,-1,0,9,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0x7c,(byte) 0x42,(byte) 0x41,(byte) 0x41,(byte) 0xf1,(byte) 0x41,(byte) 0x41,(byte) 0x42,(byte) 0x7c, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(8,9,0,0,9,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(3,11,0,0,3,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(3,12,0,0,3,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(2,12,-1,0,3,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(2,12,0,0,3,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x28, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(6,11,-1,0,8,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(6,12,-1,0,8,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(6,12,-1,0,8,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(6,12,-1,0,8,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x30,(byte) 0x8,(byte) 0x8,(byte) 0x3c,(byte) 0x42,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(7,12,-1,3,9,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0x8f,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x88,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x4f,(byte) 0x80,(byte) 0x48,(byte) 0x0,(byte) 0x28,(byte) 0x0,(byte) 0x28,(byte) 0x0, -(byte) 0x1f,(byte) 0x80, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(9,9,-1,0,11,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(7,12,-1,0,9,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(7,11,-1,0,9,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(7,12,-1,0,9,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(7,12,-1,0,9,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(7,12,-1,0,9,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(7,12,-1,0,9,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(5,9,-1,3,7,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x21,(byte) 0x0,(byte) 0x17,(byte) 0x80,(byte) 0x15,(byte) 0x0,(byte) 0xb,(byte) 0x0,(byte) 0xc9,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0x22,(byte) 0x0, -(byte) 0xe1,(byte) 0x0, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(9,9,0,0,10,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x47,(byte) 0x80,(byte) 0x22,(byte) 0x0,(byte) 0x11,(byte) 0x0,(byte) 0x14,(byte) 0x80,(byte) 0x4b,(byte) 0x0,(byte) 0x48,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xc2,(byte) 0x0, -(byte) 0x41,(byte) 0x0, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(9,9,0,0,10,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x41,(byte) 0x0,(byte) 0x27,(byte) 0x80,(byte) 0x15,(byte) 0x0,(byte) 0x13,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0x44,(byte) 0x0,(byte) 0xc2,(byte) 0x0, -(byte) 0x41,(byte) 0x0, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(9,9,0,0,10,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0xa0,(byte) 0x50,(byte) 0x28,(byte) 0x50,(byte) 0xa0, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(5,5,-1,-1,7,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xe0,(byte) 0xa0,(byte) 0xe0, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(3,5,-1,-4,5,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(2,5,-1,-3,4,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(3,4,0,3,3,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0x80, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(1,1,-1,-3,3,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x68,(byte) 0x3c, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(6,12,0,3,7,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xe8,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(5,10,-1,3,7,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(2,2,0,-8,2,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x20,(byte) 0xe0, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(3,5,0,-3,4,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xf0,(byte) 0x40,(byte) 0x20,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(4,5,0,-3,4,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(5,7,-1,0,7,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(4,4,0,-4,5,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xf0, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(4,1,0,-8,4,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x41,(byte) 0x0,(byte) 0x94,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0x98,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0x9c,(byte) 0x80,(byte) 0x41,(byte) 0x0, -(byte) 0x3e,(byte) 0x0, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(9,9,-1,0,11,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xf0, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(4,1,0,-3,5,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x4,(byte) 0x4,(byte) 0x4,(byte) 0xfc, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(6,4,-1,-2,8,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x28,(byte) 0x50,(byte) 0xa0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(5,5,-1,-1,7,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x20,(byte) 0xe0, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(3,5,-1,-4,5,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x41,(byte) 0x0,(byte) 0x9c,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0xa0,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0x9c,(byte) 0x80,(byte) 0x41,(byte) 0x0, -(byte) 0x3e,(byte) 0x0, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(9,9,-1,0,11,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xa0, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(3,1,0,-8,3,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x30,(byte) 0x48,(byte) 0x88,(byte) 0x88,(byte) 0x90,(byte) 0x60,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(5,12,0,3,6,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(1,11,-1,2,3,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x50,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(5,9,-1,0,7,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0x84,(byte) 0x78,(byte) 0x48,(byte) 0x48,(byte) 0x78,(byte) 0x84, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(6,6,0,-1,7,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0xb0,(byte) 0x48,(byte) 0x20,(byte) 0x20,(byte) 0xf0,(byte) 0x40,(byte) 0x40,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(5,9,-1,0,7,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x40,(byte) 0x70,(byte) 0xc8,(byte) 0xa0,(byte) 0xa0,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x10, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(5,9,-1,1,7,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(1,10,-1,3,3,ch161data); - -/* char: 0xa0 */ - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,4,null); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0x98,(byte) 0x64, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(6,2,0,-3,7,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xc0, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(4,12,0,3,4,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(1,12,-1,3,3,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0x30,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x30, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(4,12,0,3,4,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xf0,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0xf0, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(4,7,-1,0,6,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x90,(byte) 0x88,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(5,10,-1,3,7,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0x84,(byte) 0x84,(byte) 0x48,(byte) 0x30,(byte) 0x30,(byte) 0x48,(byte) 0x84, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(6,7,0,0,6,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(9,7,0,0,9,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x20,(byte) 0x20,(byte) 0x50,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(5,7,-1,0,7,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(5,7,-1,0,7,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x60,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x40, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(3,9,0,0,3,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0x60,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x80,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(4,7,-1,0,6,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0,(byte) 0xa0, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(3,7,-1,0,4,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(5,10,-1,3,7,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(5,10,-1,3,7,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(5,7,-1,0,7,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(5,7,-1,0,7,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xda,(byte) 0xa4, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(7,7,-1,0,9,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(1,9,-1,0,3,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0x88,(byte) 0x90,(byte) 0xa0,(byte) 0xc0,(byte) 0xc0,(byte) 0xa0,(byte) 0x90,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(5,9,-1,0,6,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(2,12,0,3,3,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(1,9,-1,0,3,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(5,9,-1,0,7,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(5,10,-1,3,7,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x30, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(4,9,0,0,3,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0xf8,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(5,7,-1,0,7,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x68,(byte) 0x98,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x98,(byte) 0x68,(byte) 0x8,(byte) 0x8, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(5,9,-1,0,7,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x70,(byte) 0x88,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(5,7,-1,0,7,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0xb0,(byte) 0xc8,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(5,9,-1,0,7,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0x74,(byte) 0x88,(byte) 0x88,(byte) 0x78,(byte) 0x8,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(6,7,-1,0,7,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0xc0,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(2,3,0,-6,3,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xfe, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(7,1,0,2,7,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0x88,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(5,3,0,-5,6,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(2,12,0,3,3,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x10,(byte) 0x10,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(4,9,0,0,4,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(2,12,-1,3,3,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xfe,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x4,(byte) 0x2,(byte) 0xfe, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(7,9,-1,0,9,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(7,9,-1,0,9,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0x82,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x82, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(7,9,-1,0,9,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x49,(byte) 0x0,(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80, -(byte) 0x88,(byte) 0x80, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(9,9,-1,0,11,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(7,9,-1,0,9,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x84, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(6,9,-1,0,8,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0xfe, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(7,9,0,0,7,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0x78,(byte) 0x84,(byte) 0x84,(byte) 0x4,(byte) 0x18,(byte) 0x60,(byte) 0x80,(byte) 0x84,(byte) 0x78, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(6,9,-1,0,8,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0x88,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(6,9,-1,0,8,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0x3d,(byte) 0x42,(byte) 0x85,(byte) 0x89,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(8,9,-1,0,10,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(6,9,-1,0,8,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x81,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(8,9,-1,0,10,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0x82,(byte) 0x86,(byte) 0x8a,(byte) 0x8a,(byte) 0x92,(byte) 0xa2,(byte) 0xa2,(byte) 0xc2,(byte) 0x82, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(7,9,-1,0,9,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0x88,(byte) 0x80,(byte) 0x88,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0x94,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0xa2,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80, -(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(9,9,-1,0,11,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(5,9,-1,0,7,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0x82,(byte) 0x84,(byte) 0x88,(byte) 0x90,(byte) 0xe0,(byte) 0xa0,(byte) 0x90,(byte) 0x88,(byte) 0x84, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(7,9,-1,0,8,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8,(byte) 0x8, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(5,9,-1,0,7,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(1,9,-1,0,3,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0xfe,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(7,9,-1,0,9,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0x3a,(byte) 0x46,(byte) 0x82,(byte) 0x82,(byte) 0x8e,(byte) 0x80,(byte) 0x80,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(7,9,-1,0,9,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(6,9,-1,0,8,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xfc, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(6,9,-1,0,8,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xf8,(byte) 0x84,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x84,(byte) 0xf8, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(7,9,-1,0,9,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0x3c,(byte) 0x42,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(7,9,-1,0,9,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xf8, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(6,9,-1,0,8,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0x28,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(7,9,-1,0,9,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x9b,(byte) 0x0,(byte) 0xa6,(byte) 0x80,(byte) 0xa2,(byte) 0x40,(byte) 0xa2,(byte) 0x40,(byte) 0x92,(byte) 0x40,(byte) 0x4d,(byte) 0x40, -(byte) 0x60,(byte) 0x80,(byte) 0x1f,(byte) 0x0, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(10,10,-1,1,12,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x20,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(5,9,-1,0,7,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc0, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(6,5,-1,-1,7,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xf8,(byte) 0x0,(byte) 0xf8, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(5,3,-1,-2,7,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0xc,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(6,5,0,-1,7,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(2,8,0,2,3,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(1,6,-1,0,3,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x78,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(5,9,-1,0,7,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(5,9,-1,0,7,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10,(byte) 0x8,(byte) 0xf8, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(5,9,-1,0,7,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0xc8,(byte) 0xb0,(byte) 0x80,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(5,9,-1,0,7,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0xf0,(byte) 0x80,(byte) 0x80,(byte) 0xf8, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(5,9,-1,0,7,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x8,(byte) 0x8,(byte) 0xfc,(byte) 0x88,(byte) 0x48,(byte) 0x28,(byte) 0x28,(byte) 0x18,(byte) 0x8, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(6,9,0,0,7,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x8,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(5,9,-1,0,7,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xf8,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x8,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(5,9,-1,0,7,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xe0,(byte) 0x20, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(3,9,-1,0,7,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x70,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x88,(byte) 0x70, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(5,9,-1,0,7,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x10, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(4,9,0,0,4,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0x80, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(1,1,-1,0,3,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xf8, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(5,1,-1,-3,8,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(2,3,-1,2,4,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(5,5,-1,-1,7,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0xa0,(byte) 0x40,(byte) 0xa0, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(3,3,-1,-6,5,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(3,12,0,3,4,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(3,12,-1,3,4,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0x80,(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(2,3,-1,-6,3,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x72,(byte) 0x8c,(byte) 0x84,(byte) 0x8a,(byte) 0x50,(byte) 0x30,(byte) 0x48,(byte) 0x48,(byte) 0x30, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(7,9,-1,0,9,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x23,(byte) 0x0,(byte) 0x14,(byte) 0x80,(byte) 0x14,(byte) 0x80,(byte) 0x13,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x68,(byte) 0x0,(byte) 0x94,(byte) 0x0,(byte) 0x94,(byte) 0x0, -(byte) 0x62,(byte) 0x0, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(9,9,-1,0,11,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x20,(byte) 0x70,(byte) 0xa8,(byte) 0xa8,(byte) 0x28,(byte) 0x70,(byte) 0xa0,(byte) 0xa8,(byte) 0x70,(byte) 0x20, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(5,10,-1,1,7,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x50,(byte) 0x50,(byte) 0x50,(byte) 0xfc,(byte) 0x28,(byte) 0xfc,(byte) 0x28,(byte) 0x28, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(6,8,0,0,7,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0xa0,(byte) 0xa0,(byte) 0xa0, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(3,3,-1,-6,5,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(1,9,-1,0,3,ch33data); - -/* char: 0x20 ' ' */ - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,4,null); - -static final BitmapCharRec[] chars = { -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmapHelvetica12 = new BitmapFontRec("-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", - 224, - 32, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java b/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java deleted file mode 100644 index 31fbda94c..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java +++ /dev/null @@ -1,1917 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmapHelvetica18 { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0x70,(byte) 0x70,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x66, -(byte) 0x66, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(8,17,-1,4,10,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xe3,(byte) 0x0,(byte) 0xc1,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xe3,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(9,18,-1,4,11,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0x70,(byte) 0x70,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x18, -(byte) 0xc,(byte) 0x6, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(8,18,-1,4,10,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x66,(byte) 0x66, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(8,13,-1,0,10,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x66,(byte) 0x3c,(byte) 0x18, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(8,14,-1,0,10,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x6, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(8,14,-1,0,10,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x30, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(8,14,-1,0,10,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0xce,(byte) 0x0,(byte) 0x7f,(byte) 0x80,(byte) 0x31,(byte) 0x80,(byte) 0x78,(byte) 0xc0,(byte) 0x6c,(byte) 0xc0,(byte) 0x66,(byte) 0xc0,(byte) 0x63,(byte) 0xc0,(byte) 0x31,(byte) 0x80, -(byte) 0x3f,(byte) 0xc0,(byte) 0xe,(byte) 0x60, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(11,10,0,0,11,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x18,(byte) 0x18,(byte) 0x0,(byte) 0xff,(byte) 0xff,(byte) 0x0,(byte) 0x18,(byte) 0x18, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(8,8,-1,-1,10,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x36,(byte) 0x0,(byte) 0x36,(byte) 0x0, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(9,13,-1,0,11,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x26,(byte) 0x0,(byte) 0x2d,(byte) 0x0,(byte) 0x19,(byte) 0x0, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(9,14,-1,0,11,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(9,14,-1,0,11,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(9,14,-1,0,11,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x30,(byte) 0x0, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(9,14,-1,0,11,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xe3,(byte) 0xdf,(byte) 0xce,(byte) 0x0,(byte) 0x4c,(byte) 0x5a,(byte) 0x32, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(8,14,-1,0,10,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x4c,(byte) 0x0,(byte) 0x38,(byte) 0x0,(byte) 0x36,(byte) 0x0,(byte) 0x60,(byte) 0x0, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(9,14,-1,0,11,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x0,(byte) 0xd8,(byte) 0xd8, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(5,13,0,0,4,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0xcc,(byte) 0x78,(byte) 0x30, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(6,14,1,0,4,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x0,(byte) 0xc0,(byte) 0x60,(byte) 0x30, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(4,14,0,0,4,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x0,(byte) 0x30,(byte) 0x60,(byte) 0xc0, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(4,14,0,0,4,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x36,(byte) 0x36, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(8,13,-1,0,10,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x66,(byte) 0x3c,(byte) 0x18, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(8,14,-1,0,10,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x6, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(8,14,-1,0,10,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c,(byte) 0x0,(byte) 0x18,(byte) 0x30,(byte) 0x60, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(8,14,-1,0,10,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0x78,(byte) 0x6c,(byte) 0xc,(byte) 0x38,(byte) 0x3e,(byte) 0x7f,(byte) 0x63,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0x7f,(byte) 0x3e, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(8,14,-1,4,10,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0x75,(byte) 0xe0,(byte) 0xef,(byte) 0xf8,(byte) 0xc7,(byte) 0x18,(byte) 0xc6,(byte) 0x0,(byte) 0xe6,(byte) 0x0,(byte) 0x7f,(byte) 0xf8,(byte) 0xe,(byte) 0x18,(byte) 0xc6,(byte) 0x18, -(byte) 0xef,(byte) 0xf0,(byte) 0x7d,(byte) 0xe0, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(13,10,-1,0,15,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x38,(byte) 0x6c,(byte) 0x6c,(byte) 0x38, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(7,14,-1,0,9,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x6c,(byte) 0x6c, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(7,13,-1,0,9,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x4c,(byte) 0x5a,(byte) 0x32, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(7,14,-1,0,9,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x66,(byte) 0x3c,(byte) 0x18, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(7,14,-1,0,9,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x30,(byte) 0x18,(byte) 0xc, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(7,14,-1,0,9,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c,(byte) 0x0,(byte) 0x18,(byte) 0x30,(byte) 0x60, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(7,14,-1,0,9,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0xdc,(byte) 0xde,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0xdc,(byte) 0xdc,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0xc6,(byte) 0x7c,(byte) 0x38, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(7,14,-1,0,9,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(10,14,-1,0,12,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(12,18,-1,0,14,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0x19,(byte) 0x80, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(11,17,-1,0,13,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(11,18,-1,0,13,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(11,18,-1,0,13,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(11,18,-1,0,13,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0xc7,(byte) 0xc0,(byte) 0xff,(byte) 0xf0,(byte) 0x78,(byte) 0x38,(byte) 0x38,(byte) 0x18,(byte) 0x6c,(byte) 0x1c,(byte) 0x6e,(byte) 0xc,(byte) 0x67,(byte) 0xc,(byte) 0x63,(byte) 0x8c, -(byte) 0x61,(byte) 0xcc,(byte) 0x70,(byte) 0xdc,(byte) 0x30,(byte) 0x78,(byte) 0x38,(byte) 0x38,(byte) 0x1f,(byte) 0xfc,(byte) 0x7,(byte) 0xcc, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(14,14,0,0,15,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80, -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(10,9,0,0,10,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xd,(byte) 0x80, -(byte) 0xd,(byte) 0x80, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(13,17,-1,0,15,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x9,(byte) 0x80, -(byte) 0xb,(byte) 0x40,(byte) 0x6,(byte) 0x40, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(13,18,-1,0,15,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0xc0, -(byte) 0x7,(byte) 0x80,(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(13,18,-1,0,15,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x3,(byte) 0x0, -(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0xc0, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(13,18,-1,0,15,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x3,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(13,18,-1,0,15,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc3,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xcc,(byte) 0x60, -(byte) 0xcc,(byte) 0x60,(byte) 0xd8,(byte) 0x60,(byte) 0xd8,(byte) 0x60,(byte) 0xf0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0x0,(byte) 0x0,(byte) 0x13,(byte) 0x0, -(byte) 0x16,(byte) 0x80,(byte) 0xc,(byte) 0x80, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(11,18,-1,0,13,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0x7f,(byte) 0x80,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0xfc,(byte) 0x30,(byte) 0xfc,(byte) 0x30, -(byte) 0x60,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0x7f,(byte) 0xc0,(byte) 0x7f,(byte) 0x80, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(12,14,0,0,13,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0xcc, -(byte) 0xcc, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(6,17,0,0,6,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0xcc, -(byte) 0x78,(byte) 0x30, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(6,18,0,0,6,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0, -(byte) 0x60,(byte) 0x30, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(4,18,-2,0,6,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x30, -(byte) 0x60,(byte) 0xc0, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(4,18,0,0,6,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0, -(byte) 0x33,(byte) 0x0, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(9,17,-1,0,11,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0, -(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(9,18,-1,0,11,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(9,18,-1,0,11,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0xc,(byte) 0x0, -(byte) 0x18,(byte) 0x0,(byte) 0x30,(byte) 0x0, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(9,18,-1,0,11,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x1b,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30, -(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70, -(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(12,18,-1,4,14,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0xc1,(byte) 0xff,(byte) 0xc1,(byte) 0xff,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x3f,(byte) 0x80,(byte) 0x31,(byte) 0xfe,(byte) 0x31,(byte) 0xfe, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xd,(byte) 0x80,(byte) 0xd,(byte) 0x80,(byte) 0x7,(byte) 0xff,(byte) 0x7,(byte) 0xff, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(16,14,-1,0,18,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(12,18,0,0,12,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0x19,(byte) 0x80, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(12,17,0,0,12,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x13,(byte) 0x0, -(byte) 0x16,(byte) 0x80,(byte) 0xc,(byte) 0x80, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(12,18,0,0,12,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(12,18,0,0,12,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(12,18,0,0,12,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(12,18,0,0,12,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0x7c,(byte) 0xfe,(byte) 0xc6,(byte) 0xc6,(byte) 0xe0,(byte) 0x70,(byte) 0x38,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x0,(byte) 0x0,(byte) 0x18,(byte) 0x18, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(7,14,-1,4,10,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xfc,(byte) 0x6,(byte) 0xd8,(byte) 0x6,(byte) 0x78,(byte) 0x73,(byte) 0x38,(byte) 0xf9,(byte) 0x18,(byte) 0x99,(byte) 0x88, -(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x98,(byte) 0x60,(byte) 0xf8,(byte) 0x30,(byte) 0x70,(byte) 0x30, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(14,13,0,0,15,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x30,(byte) 0xf8,(byte) 0x30,(byte) 0xf8,(byte) 0x18,(byte) 0x60,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x18,(byte) 0x66,(byte) 0x98,(byte) 0x62,(byte) 0xf8,(byte) 0x63,(byte) 0x70, -(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0xe0,(byte) 0x60,(byte) 0x60,(byte) 0x60, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(13,13,-1,0,15,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x19,(byte) 0xf8,(byte) 0xd,(byte) 0xb0,(byte) 0xc,(byte) 0xf0,(byte) 0x66,(byte) 0x70,(byte) 0x62,(byte) 0x30,(byte) 0x63,(byte) 0x10, -(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0xe0,(byte) 0x60,(byte) 0x60,(byte) 0x60, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(13,13,-1,0,15,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0x90,(byte) 0xd8,(byte) 0x6c,(byte) 0x36,(byte) 0x36,(byte) 0x6c,(byte) 0xd8,(byte) 0x90, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(7,8,-1,-1,9,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x70,(byte) 0xd8,(byte) 0x88,(byte) 0x88,(byte) 0xd8,(byte) 0x70, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(5,8,-1,-6,7,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0xe0,(byte) 0x60, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(3,8,-1,-5,6,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0xf0,(byte) 0xd8,(byte) 0x18,(byte) 0x70,(byte) 0x60, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(5,5,0,4,5,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(2,2,-1,-4,4,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x12,(byte) 0x32,(byte) 0x72,(byte) 0xf2,(byte) 0xf2,(byte) 0xf2,(byte) 0xf2, -(byte) 0x72,(byte) 0x3f, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(8,18,-1,4,10,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xdb,(byte) 0xff,(byte) 0xe7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(8,14,-1,4,10,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0xc0,(byte) 0x60,(byte) 0x30, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(4,3,0,-11,4,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0x70,(byte) 0xf8,(byte) 0x98,(byte) 0x30,(byte) 0x30,(byte) 0x98,(byte) 0xf8,(byte) 0x70, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(5,8,0,-5,6,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xf8,(byte) 0xf8,(byte) 0x60,(byte) 0x30,(byte) 0x18,(byte) 0x98,(byte) 0xf8,(byte) 0x70, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(5,8,0,-5,6,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xff,(byte) 0xff,(byte) 0x0,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xff,(byte) 0xff,(byte) 0x18,(byte) 0x18,(byte) 0x18, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(8,11,-1,0,10,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x70,(byte) 0xd8,(byte) 0x88,(byte) 0xd8,(byte) 0x70, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(5,5,-1,-8,7,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xf8, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(5,1,0,-12,5,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0xf,(byte) 0x80,(byte) 0x30,(byte) 0x60,(byte) 0x40,(byte) 0x10,(byte) 0x48,(byte) 0x50,(byte) 0x88,(byte) 0x88,(byte) 0x89,(byte) 0x8,(byte) 0x8f,(byte) 0x88,(byte) 0x88,(byte) 0x48, -(byte) 0x88,(byte) 0x48,(byte) 0x4f,(byte) 0x90,(byte) 0x40,(byte) 0x10,(byte) 0x30,(byte) 0x60,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(13,13,-1,0,14,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xf8,(byte) 0xf8, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(5,2,-1,-4,7,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(9,5,-1,-3,11,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x12,(byte) 0x36,(byte) 0x6c,(byte) 0xd8,(byte) 0xd8,(byte) 0x6c,(byte) 0x36,(byte) 0x12, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(7,8,-1,-1,9,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x68,(byte) 0xd8,(byte) 0x48,(byte) 0x38,(byte) 0xc8,(byte) 0x70, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(5,8,-1,-6,7,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0xf,(byte) 0x80,(byte) 0x30,(byte) 0x60,(byte) 0x40,(byte) 0x10,(byte) 0x47,(byte) 0x10,(byte) 0x88,(byte) 0x88,(byte) 0x90,(byte) 0x8,(byte) 0x90,(byte) 0x8,(byte) 0x90,(byte) 0x8, -(byte) 0x88,(byte) 0x88,(byte) 0x47,(byte) 0x10,(byte) 0x40,(byte) 0x10,(byte) 0x30,(byte) 0x60,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(13,13,-1,0,15,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xd8,(byte) 0xd8, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(5,2,0,-11,6,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0x3c,(byte) 0x7e,(byte) 0xc3,(byte) 0xc3,(byte) 0x7,(byte) 0xe,(byte) 0x3e,(byte) 0x73,(byte) 0xe3,(byte) 0xc3,(byte) 0xc7,(byte) 0x6e,(byte) 0x7c,(byte) 0xf0,(byte) 0xc3,(byte) 0xc3, -(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(8,18,-1,4,10,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(2,17,-1,3,4,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xff,(byte) 0x18,(byte) 0xff,(byte) 0x3c,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(8,13,-1,0,10,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0xc3,(byte) 0xff,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xff,(byte) 0xc3, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(8,7,-1,-3,10,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0xdf,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x7e,(byte) 0x0,(byte) 0x30,(byte) 0x0, -(byte) 0x60,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x3f,(byte) 0x0,(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(9,13,0,0,10,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x10,(byte) 0x10,(byte) 0x3e,(byte) 0x7f,(byte) 0x6b,(byte) 0xc8,(byte) 0xc8,(byte) 0xc8,(byte) 0xc8,(byte) 0x6b,(byte) 0x7f,(byte) 0x3e,(byte) 0x4,(byte) 0x4, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(8,14,-1,2,10,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(2,14,-2,4,6,ch161data); - -/* char: 0xa0 */ - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,5,null); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0xcc,(byte) 0x7e,(byte) 0x33, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(8,3,-1,-4,10,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0xc0,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0xc,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0x60,(byte) 0xc0, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(6,18,0,4,6,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(2,18,-1,4,4,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0xc,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0x18,(byte) 0xc, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(6,18,0,4,6,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xfe,(byte) 0xfe,(byte) 0xc0,(byte) 0x60,(byte) 0x30,(byte) 0x18,(byte) 0xc,(byte) 0x6,(byte) 0xfe,(byte) 0xfe, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(7,10,-1,0,9,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0x70,(byte) 0x70,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(8,14,-1,4,10,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0xc3,(byte) 0xe7,(byte) 0x66,(byte) 0x3c,(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x66,(byte) 0xe7,(byte) 0xc3, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(8,10,-1,0,10,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x39,(byte) 0xc0,(byte) 0x29,(byte) 0x40,(byte) 0x69,(byte) 0x60,(byte) 0x66,(byte) 0x60,(byte) 0x66,(byte) 0x60,(byte) 0xc6,(byte) 0x30, -(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(12,10,-1,0,14,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x18,(byte) 0x18,(byte) 0x3c,(byte) 0x24,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(8,10,-1,0,10,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x73,(byte) 0xfb,(byte) 0xc7,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(8,10,-1,0,10,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x18,(byte) 0x38,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfc,(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(6,13,0,0,6,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0x78,(byte) 0xfc,(byte) 0xc6,(byte) 0x6,(byte) 0x3e,(byte) 0xfc,(byte) 0xc0,(byte) 0xc6,(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(7,10,-1,0,9,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xe0,(byte) 0xd8,(byte) 0xd8, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(5,10,-1,0,6,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3d,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0xc1,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x3d,(byte) 0x80, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(9,14,-1,4,11,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xe3,(byte) 0x0,(byte) 0xc1,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xe3,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xde,(byte) 0x0, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(9,14,-1,4,11,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x0, -(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(9,10,-1,0,11,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xe3,(byte) 0xdf,(byte) 0xce, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(8,10,-1,0,10,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xc6,(byte) 0x30,(byte) 0xe7,(byte) 0x30, -(byte) 0xde,(byte) 0xf0,(byte) 0xcc,(byte) 0x60, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(12,10,-1,0,14,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(2,14,-1,0,4,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0xc7,(byte) 0xc6,(byte) 0xce,(byte) 0xcc,(byte) 0xd8,(byte) 0xf8,(byte) 0xf0,(byte) 0xd8,(byte) 0xcc,(byte) 0xc6,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(8,14,-1,0,9,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0xe0,(byte) 0xf0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x0, -(byte) 0x30,(byte) 0x30, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(4,18,1,4,4,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(2,14,-1,0,4,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xe3,(byte) 0xdf,(byte) 0xce,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(8,14,-1,0,10,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0x1c,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x3d,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0xc1,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x3d,(byte) 0x80, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(9,14,-1,4,11,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfc,(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x3c,(byte) 0x1c, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(6,14,0,0,6,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x3c,(byte) 0x7f,(byte) 0xe3,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(8,10,-1,0,10,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x3d,(byte) 0x80,(byte) 0x7f,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x63,(byte) 0x80, -(byte) 0x7f,(byte) 0x80,(byte) 0x3d,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(9,14,-1,0,11,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x3e,(byte) 0x7f,(byte) 0x63,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0x7f,(byte) 0x3e, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(8,10,-1,0,10,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0xde,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xe3,(byte) 0x0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xe3,(byte) 0x0, -(byte) 0xff,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(9,14,-1,0,11,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0x76,(byte) 0xee,(byte) 0xc6,(byte) 0xc6,(byte) 0xe6,(byte) 0x7e,(byte) 0xe,(byte) 0xc6,(byte) 0xee,(byte) 0x7c, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(7,10,-1,0,9,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(2,5,-1,-9,4,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(10,2,0,4,10,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0x82,(byte) 0xc6,(byte) 0x6c,(byte) 0x38,(byte) 0x10, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(7,5,-1,-8,9,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xf0,(byte) 0xf0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0xf0,(byte) 0xf0, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(4,18,0,4,5,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x10,(byte) 0x30,(byte) 0x30,(byte) 0x20,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(5,14,0,0,5,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xf0,(byte) 0xf0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xf0,(byte) 0xf0, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(4,18,-1,4,5,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0xc,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(10,14,-1,0,12,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80, -(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(12,14,-1,0,14,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0xc0,(byte) 0x60,(byte) 0xe0,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x31,(byte) 0x80,(byte) 0x1b,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, -(byte) 0x1b,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xe0,(byte) 0xc0,(byte) 0x60, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(11,14,-1,0,13,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x1c,(byte) 0x38,(byte) 0x34,(byte) 0x2c,(byte) 0x36,(byte) 0x6c,(byte) 0x36,(byte) 0x6c,(byte) 0x66,(byte) 0x66,(byte) 0x66,(byte) 0x66, -(byte) 0x62,(byte) 0x46,(byte) 0x63,(byte) 0xc6,(byte) 0xc3,(byte) 0xc3,(byte) 0xc1,(byte) 0x83,(byte) 0xc1,(byte) 0x83,(byte) 0xc1,(byte) 0x83, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(16,14,-1,0,18,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x6,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x30,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(12,14,-1,0,14,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x1f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(11,14,-1,0,13,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0, -(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(10,14,-1,0,12,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0x3f,(byte) 0x0,(byte) 0x7f,(byte) 0xc0,(byte) 0xe0,(byte) 0xe0,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0xe0,(byte) 0x3,(byte) 0xc0,(byte) 0x1f,(byte) 0x0, -(byte) 0x7c,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x60,(byte) 0xe0,(byte) 0xe0,(byte) 0x7f,(byte) 0xc0,(byte) 0x1f,(byte) 0x0, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(11,14,-1,0,13,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(10,14,-1,0,12,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0x0,(byte) 0x30,(byte) 0xf,(byte) 0xb0,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0xf0,(byte) 0x61,(byte) 0xb0,(byte) 0xe1,(byte) 0xb8,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(13,15,-1,1,15,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(10,14,-1,0,12,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x38,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0xc0,(byte) 0x18, -(byte) 0xc0,(byte) 0x18,(byte) 0xe0,(byte) 0x38,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(13,14,-1,0,15,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc1,(byte) 0xe0,(byte) 0xc3,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xc6,(byte) 0x60,(byte) 0xcc,(byte) 0x60, -(byte) 0xcc,(byte) 0x60,(byte) 0xd8,(byte) 0x60,(byte) 0xf0,(byte) 0x60,(byte) 0xf0,(byte) 0x60,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(11,14,-1,0,13,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0xc3,(byte) 0xc,(byte) 0xc3,(byte) 0xc,(byte) 0xc7,(byte) 0x8c,(byte) 0xc4,(byte) 0x8c,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xd8,(byte) 0x6c,(byte) 0xd8,(byte) 0x6c, -(byte) 0xf0,(byte) 0x3c,(byte) 0xf0,(byte) 0x3c,(byte) 0xe0,(byte) 0x1c,(byte) 0xe0,(byte) 0x1c,(byte) 0xc0,(byte) 0xc,(byte) 0xc0,(byte) 0xc, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(14,14,-1,0,16,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xff,(byte) 0xff,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(8,14,-1,0,10,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0xc0,(byte) 0x70,(byte) 0xc0,(byte) 0xe0,(byte) 0xc1,(byte) 0xc0,(byte) 0xc3,(byte) 0x80,(byte) 0xc7,(byte) 0x0,(byte) 0xce,(byte) 0x0,(byte) 0xfc,(byte) 0x0,(byte) 0xf8,(byte) 0x0, -(byte) 0xdc,(byte) 0x0,(byte) 0xce,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x80,(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xe0, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(12,14,-1,0,13,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0x3c,(byte) 0x7e,(byte) 0xe7,(byte) 0xc3,(byte) 0xc3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3,(byte) 0x3, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(8,14,-1,0,10,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(2,14,-2,0,6,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xff,(byte) 0xe0,(byte) 0xff,(byte) 0xe0, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(11,14,-1,0,13,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0xf,(byte) 0xb0,(byte) 0x3f,(byte) 0xf0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x30,(byte) 0xc1,(byte) 0xf0,(byte) 0xc1,(byte) 0xf0,(byte) 0xc0,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xe0,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(12,14,-1,0,14,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(9,14,-1,0,11,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(9,14,-1,0,11,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xff,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xc1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60, -(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(11,14,-1,0,13,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0xf,(byte) 0x80,(byte) 0x3f,(byte) 0xe0,(byte) 0x70,(byte) 0x70,(byte) 0x60,(byte) 0x30,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0x60,(byte) 0x30,(byte) 0x70,(byte) 0x70,(byte) 0x3f,(byte) 0xe0,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(12,14,-1,0,14,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0xc0,(byte) 0xc0,(byte) 0xe0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x0, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(11,14,-1,0,13,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x7f,(byte) 0xe0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0xc0, -(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0xf,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(12,14,0,0,12,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1f,(byte) 0xf0,(byte) 0x38,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x67,(byte) 0x70,(byte) 0xcf,(byte) 0xf8,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0x66, -(byte) 0xcc,(byte) 0x66,(byte) 0xcc,(byte) 0x63,(byte) 0xc6,(byte) 0x33,(byte) 0x67,(byte) 0x73,(byte) 0x63,(byte) 0xb3,(byte) 0x30,(byte) 0x6,(byte) 0x1c,(byte) 0xe,(byte) 0xf,(byte) 0xfc, -(byte) 0x3,(byte) 0xf0, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(16,17,-1,3,18,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x38,(byte) 0x1c,(byte) 0xe,(byte) 0xc6,(byte) 0xc6,(byte) 0xfe,(byte) 0x7c, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(7,14,-1,0,10,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0xc0,(byte) 0xf0,(byte) 0x3c,(byte) 0xe,(byte) 0x3,(byte) 0xe,(byte) 0x3c,(byte) 0xf0,(byte) 0xc0, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(8,9,-1,0,10,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xfe,(byte) 0xfe,(byte) 0x0,(byte) 0x0,(byte) 0xfe,(byte) 0xfe, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(7,6,-2,-2,11,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0x3,(byte) 0xf,(byte) 0x3c,(byte) 0x70,(byte) 0xc0,(byte) 0x70,(byte) 0x3c,(byte) 0xf,(byte) 0x3, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(8,9,-1,0,10,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(2,13,-1,3,5,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(2,10,-1,0,5,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0x7c,(byte) 0xfe,(byte) 0xc6,(byte) 0x3,(byte) 0x3,(byte) 0x3b,(byte) 0x7f,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc7,(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(8,13,-1,0,10,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x3c,(byte) 0x7e,(byte) 0xe7,(byte) 0xc3,(byte) 0xc3,(byte) 0x66,(byte) 0x7e,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xe7,(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(8,13,-1,0,10,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x60,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xc,(byte) 0x6,(byte) 0x3,(byte) 0xff,(byte) 0xff, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(8,13,-1,0,10,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x3c,(byte) 0x7e,(byte) 0xe3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xfe,(byte) 0xdc,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0x7f,(byte) 0x3c, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(8,13,-1,0,10,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0x7c,(byte) 0xfe,(byte) 0xc7,(byte) 0xc3,(byte) 0x3,(byte) 0x3,(byte) 0xc7,(byte) 0xfe,(byte) 0xfc,(byte) 0xc0,(byte) 0xc0,(byte) 0xfe,(byte) 0xfe, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(8,13,-1,0,10,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x33,(byte) 0x0, -(byte) 0x33,(byte) 0x0,(byte) 0x1b,(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(9,13,-1,0,10,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0x3c,(byte) 0x7e,(byte) 0xc7,(byte) 0xc3,(byte) 0x3,(byte) 0x7,(byte) 0x1e,(byte) 0x1c,(byte) 0x6,(byte) 0xc3,(byte) 0xc3,(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(8,13,-1,0,10,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xff,(byte) 0xff,(byte) 0xc0,(byte) 0xe0,(byte) 0x70,(byte) 0x38,(byte) 0x1c,(byte) 0xe,(byte) 0x7,(byte) 0x3,(byte) 0xc3,(byte) 0xfe,(byte) 0x3c, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(8,13,-1,0,10,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xf8,(byte) 0xf8,(byte) 0x18, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(5,13,-2,0,10,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x3c,(byte) 0x7e,(byte) 0x66,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0xc3,(byte) 0x66,(byte) 0x7e,(byte) 0x3c, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(8,13,-1,0,10,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0x30,(byte) 0x30,(byte) 0x10,(byte) 0x10,(byte) 0x18,(byte) 0x18, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(5,14,0,0,5,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(2,2,-1,0,5,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xff,(byte) 0xff, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(8,2,-1,-4,11,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(2,5,-1,3,5,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xff,(byte) 0xff,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(8,10,-1,0,10,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0x88,(byte) 0x70,(byte) 0x70,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(5,6,-1,-8,7,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x60,(byte) 0x60, -(byte) 0xc0,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(4,18,-1,4,6,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x10,(byte) 0x30,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0x60, -(byte) 0x30,(byte) 0x10, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(4,18,-1,4,6,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(2,5,-1,-9,4,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x3c,(byte) 0x70,(byte) 0x7e,(byte) 0xe0,(byte) 0xe7,(byte) 0xc0,(byte) 0xc3,(byte) 0x80,(byte) 0xc3,(byte) 0xc0,(byte) 0xc6,(byte) 0xc0,(byte) 0xee,(byte) 0xc0,(byte) 0x7c,(byte) 0x0, -(byte) 0x3c,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x7e,(byte) 0x0,(byte) 0x3c,(byte) 0x0, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(12,13,-1,0,13,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x18,(byte) 0x78,(byte) 0x18,(byte) 0xfc,(byte) 0xc,(byte) 0xcc,(byte) 0xc,(byte) 0xcc,(byte) 0x6,(byte) 0xfc,(byte) 0x6,(byte) 0x78,(byte) 0x3,(byte) 0x0,(byte) 0x7b,(byte) 0x0, -(byte) 0xfd,(byte) 0x80,(byte) 0xcd,(byte) 0x80,(byte) 0xcc,(byte) 0xc0,(byte) 0xfc,(byte) 0xc0,(byte) 0x78,(byte) 0x60, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(14,13,-1,0,16,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x8,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0xeb,(byte) 0x80,(byte) 0xc9,(byte) 0x80,(byte) 0x9,(byte) 0x80,(byte) 0xf,(byte) 0x0, -(byte) 0x3e,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0xe8,(byte) 0x0,(byte) 0xc8,(byte) 0x0,(byte) 0xcb,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x8,(byte) 0x0, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(9,16,-1,2,10,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x24,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0x80,(byte) 0x12,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x12,(byte) 0x0, -(byte) 0x7f,(byte) 0xc0,(byte) 0x7f,(byte) 0xc0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(10,13,0,0,10,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0x90,(byte) 0x90,(byte) 0xd8,(byte) 0xd8,(byte) 0xd8, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(5,5,0,-9,5,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(2,14,-2,0,6,ch33data); - -/* char: 0x20 ' ' */ - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,5,null); - -static final BitmapCharRec[] chars = { -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmapHelvetica18 = new BitmapFontRec("-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1", - 224, - 32, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java b/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java deleted file mode 100644 index 175b857e0..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java +++ /dev/null @@ -1,1797 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmapTimesRoman10 { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0x80,(byte) 0xc0,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0x90,(byte) 0xb8,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(5,9,0,2,5,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0xc0,(byte) 0x80,(byte) 0xe0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(4,9,0,2,5,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0x80,(byte) 0xc0,(byte) 0x40,(byte) 0x60,(byte) 0xa0,(byte) 0x90,(byte) 0xb8,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(5,10,0,2,5,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(5,7,0,0,5,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(5,8,0,0,5,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(5,8,0,0,5,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(5,8,0,0,5,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0x80,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0x48,(byte) 0x38,(byte) 0x4, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(6,7,1,1,5,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x20,(byte) 0x0,(byte) 0xf8,(byte) 0x0,(byte) 0x20, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(5,5,0,0,6,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(4,7,0,0,5,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0xa0,(byte) 0x50, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(4,8,0,0,5,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(4,8,0,0,5,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(4,8,0,0,5,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(4,8,0,0,5,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0xd8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(5,8,0,0,5,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0xa0,(byte) 0x70,(byte) 0x40, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(4,8,0,0,5,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(3,7,0,0,4,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(3,8,0,0,4,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(3,8,0,0,4,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(3,8,0,0,4,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(3,7,0,0,4,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(3,8,0,0,4,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(3,8,0,0,4,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(3,8,0,0,4,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x60,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x60, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(3,8,0,3,4,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0xd8,(byte) 0xa0,(byte) 0x70,(byte) 0x28,(byte) 0xd8, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(5,5,0,0,6,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x40,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(3,8,0,0,4,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(3,7,0,0,4,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0xa0,(byte) 0x50, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(4,8,0,0,4,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(3,8,0,0,4,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(3,8,0,0,4,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(3,8,0,0,4,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0xe0,(byte) 0x50,(byte) 0x50,(byte) 0x60,(byte) 0x50,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(4,7,0,0,5,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x70,(byte) 0x48,(byte) 0x70,(byte) 0x40,(byte) 0xe0, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(5,7,0,0,6,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x38,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(7,10,0,0,8,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x28, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(7,9,0,0,8,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(7,10,0,0,8,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(7,10,0,0,8,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(7,10,0,0,8,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0x80,(byte) 0x7c,(byte) 0x66,(byte) 0x52,(byte) 0x52,(byte) 0x4a,(byte) 0x66,(byte) 0x3e,(byte) 0x1, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(8,9,0,1,8,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0x88,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0x88, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(5,5,0,0,6,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(6,9,0,0,7,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(6,10,0,0,7,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(6,10,0,0,7,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(6,10,0,0,7,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(6,10,0,0,7,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0xe4,(byte) 0x4c,(byte) 0x4c,(byte) 0x54,(byte) 0x54,(byte) 0x64,(byte) 0xee,(byte) 0x0,(byte) 0x50,(byte) 0x28, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(7,10,0,0,8,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0xf8,(byte) 0x4c,(byte) 0x44,(byte) 0xe4,(byte) 0x44,(byte) 0x4c,(byte) 0xf8, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(6,7,0,0,7,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0xa0, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(3,9,0,0,4,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(3,10,0,0,4,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(3,10,0,0,4,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x0,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(3,10,0,0,4,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x50, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(5,9,0,0,6,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x50,(byte) 0x20, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(5,10,0,0,6,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x10, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(5,10,0,0,6,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(5,10,0,0,6,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x60,(byte) 0x10,(byte) 0x20,(byte) 0x78,(byte) 0xc4,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc4,(byte) 0x7c, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(6,10,0,3,7,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0xef,(byte) 0x49,(byte) 0x78,(byte) 0x2e,(byte) 0x28,(byte) 0x39,(byte) 0x1f, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(8,7,0,0,9,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(7,10,0,0,8,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x28, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(7,9,0,0,8,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x14, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(7,10,0,0,8,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x28,(byte) 0x10, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(7,10,0,0,8,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x8, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(7,10,0,0,8,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10,(byte) 0x0,(byte) 0x10,(byte) 0x20, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(7,10,0,0,8,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(3,7,0,2,4,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x44,(byte) 0x3e,(byte) 0x2c,(byte) 0xd4,(byte) 0x28,(byte) 0x48,(byte) 0xe4, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(7,7,0,0,8,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x4e,(byte) 0x24,(byte) 0x2a,(byte) 0xf6,(byte) 0x48,(byte) 0xc8,(byte) 0x44, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(7,7,0,0,8,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x44,(byte) 0x3e,(byte) 0x2c,(byte) 0xf4,(byte) 0x48,(byte) 0xc8,(byte) 0x44, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(7,7,0,0,8,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0xa0,(byte) 0x50,(byte) 0x50,(byte) 0xa0, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(4,4,0,-1,5,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xe0,(byte) 0x0,(byte) 0x40,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(3,5,0,-2,4,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0xe0,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(3,4,0,-3,3,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x40, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(3,3,0,3,4,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0x80, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(1,1,0,-2,2,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x28,(byte) 0x68,(byte) 0xe8,(byte) 0xe8,(byte) 0xe8,(byte) 0x7c, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(6,9,0,2,6,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0x80,(byte) 0x80,(byte) 0xe8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(5,7,0,2,5,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(2,2,0,-5,3,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0xe0, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(3,4,0,-3,3,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xe0,(byte) 0x40,(byte) 0xa0,(byte) 0x60, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(3,4,0,-3,3,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xf8,(byte) 0x0,(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(5,7,0,0,6,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(4,4,0,-3,4,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xe0, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(3,1,0,-6,4,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0x38,(byte) 0x44,(byte) 0xaa,(byte) 0xb2,(byte) 0xba,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(7,7,-1,0,9,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xe0, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(3,1,0,-2,4,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x8,(byte) 0x8,(byte) 0xf8, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(5,3,-1,-1,7,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x50,(byte) 0xa0,(byte) 0xa0,(byte) 0x50, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(4,4,0,-1,5,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xa0,(byte) 0x20,(byte) 0xc0, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(3,5,0,-2,4,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0x38,(byte) 0x44,(byte) 0x9a,(byte) 0xa2,(byte) 0x9a,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(7,7,-1,0,9,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xa0, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(3,1,-1,-6,5,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0xe0,(byte) 0x90,(byte) 0x20,(byte) 0x50,(byte) 0x90,(byte) 0xa0,(byte) 0x40,(byte) 0x90,(byte) 0x70, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(4,9,0,1,5,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(1,7,0,0,2,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0x70,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0xd8,(byte) 0x50,(byte) 0x88, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(5,7,0,0,5,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0x88,(byte) 0x70,(byte) 0x50,(byte) 0x50,(byte) 0x70,(byte) 0x88, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(5,6,0,-1,5,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0xf0,(byte) 0xc8,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x50,(byte) 0x30, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(5,7,0,0,5,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x80,(byte) 0xe0,(byte) 0x90,(byte) 0x80,(byte) 0x90,(byte) 0x70,(byte) 0x10, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(4,7,0,1,5,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(1,7,-1,2,3,ch161data); - -/* char: 0xa0 */ - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,2,null); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0x98,(byte) 0x64, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(6,2,0,-2,7,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(3,9,0,2,4,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(1,9,0,2,2,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(3,9,0,2,4,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xf0,(byte) 0x90,(byte) 0x40,(byte) 0x20,(byte) 0xf0, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(4,5,0,0,5,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x30,(byte) 0x50,(byte) 0x48,(byte) 0xdc, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(6,7,1,2,5,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0xd8,(byte) 0x50,(byte) 0x20,(byte) 0x50,(byte) 0xd8, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(5,5,0,0,6,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x28,(byte) 0x6c,(byte) 0x54,(byte) 0x92,(byte) 0xdb, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(8,5,0,0,8,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x20,(byte) 0x60,(byte) 0x50,(byte) 0x90,(byte) 0xd8, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(5,5,0,0,5,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(5,5,0,0,5,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x30,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(4,6,0,0,4,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0xe0,(byte) 0x20,(byte) 0x60,(byte) 0x80,(byte) 0xe0, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(3,5,0,0,4,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x60,(byte) 0xa0, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(3,5,0,0,4,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x38,(byte) 0x10,(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x70, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(5,7,0,2,5,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0xc0,(byte) 0x80,(byte) 0xe0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(4,7,0,2,5,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(4,5,0,0,5,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0xd8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(5,5,0,0,5,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0xdb,(byte) 0x92,(byte) 0x92,(byte) 0x92,(byte) 0xec, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(8,5,0,0,8,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(3,7,0,0,4,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0x98,(byte) 0x90,(byte) 0xe0,(byte) 0xa0,(byte) 0x90,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(5,7,0,0,5,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(2,9,0,2,3,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x0,(byte) 0x40, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(2,7,0,0,3,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0xd8,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(5,7,0,0,5,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0xe0,(byte) 0x90,(byte) 0x60,(byte) 0x40,(byte) 0xa0,(byte) 0xa0,(byte) 0x70, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(4,7,0,2,5,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0,(byte) 0x40,(byte) 0x30, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(4,7,0,0,4,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x60,(byte) 0x80,(byte) 0xc0,(byte) 0xa0,(byte) 0x60, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(3,5,0,0,4,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x68,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x70,(byte) 0x10,(byte) 0x30, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(5,7,0,0,5,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x60,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x60, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(3,5,0,0,4,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0xe0,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(4,7,0,0,5,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0xe0,(byte) 0xa0,(byte) 0x60,(byte) 0x20,(byte) 0xc0, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(3,5,0,0,4,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0xc0,(byte) 0x80, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(2,2,0,-5,3,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xf8, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(5,1,0,3,5,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0xa0,(byte) 0xa0,(byte) 0x40, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(3,3,-1,-4,5,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xc0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(2,9,0,2,3,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(3,7,0,0,3,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xc0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc0, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(2,9,0,2,3,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xf8,(byte) 0x88,(byte) 0x40,(byte) 0x20,(byte) 0x10,(byte) 0x88,(byte) 0xf8, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(5,7,0,0,6,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x38,(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x44,(byte) 0xee, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(7,7,0,0,8,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0xee,(byte) 0x44,(byte) 0x28,(byte) 0x10,(byte) 0x28,(byte) 0x44,(byte) 0xee, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(7,7,0,0,8,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0xc9,(byte) 0x80,(byte) 0x88,(byte) 0x80,(byte) 0xdd,(byte) 0xc0, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(10,7,0,0,10,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x10,(byte) 0x10,(byte) 0x28,(byte) 0x28,(byte) 0x6c,(byte) 0x44,(byte) 0xee, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(7,7,0,0,8,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x38,(byte) 0x6c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0xee, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(7,7,0,0,8,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0x70,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xa8,(byte) 0xf8, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(5,7,0,0,6,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0xe0,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0xc0,(byte) 0x90,(byte) 0x70, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(4,7,0,0,5,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0xec,(byte) 0x48,(byte) 0x50,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0xf0, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(6,7,0,0,7,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0xc,(byte) 0x18,(byte) 0x70,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(6,9,0,2,7,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0xf0, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(5,7,0,0,6,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0x78,(byte) 0xcc,(byte) 0x84,(byte) 0x84,(byte) 0x84,(byte) 0xcc,(byte) 0x78, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(6,7,0,0,7,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0xe4,(byte) 0x4c,(byte) 0x4c,(byte) 0x54,(byte) 0x54,(byte) 0x64,(byte) 0xee, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(7,7,0,0,8,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0xeb,(byte) 0x80,(byte) 0x49,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x55,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0xe3,(byte) 0x80, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(9,7,0,0,10,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(5,7,0,0,6,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0xec,(byte) 0x48,(byte) 0x50,(byte) 0x60,(byte) 0x50,(byte) 0x48,(byte) 0xec, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(6,7,0,0,7,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0xc0,(byte) 0xa0,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x70, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(4,7,0,0,4,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xe0, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(3,7,0,0,4,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0xee,(byte) 0x44,(byte) 0x44,(byte) 0x7c,(byte) 0x44,(byte) 0x44,(byte) 0xee, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(7,7,0,0,8,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0x78,(byte) 0xc4,(byte) 0x84,(byte) 0x9c,(byte) 0x80,(byte) 0xc4,(byte) 0x7c, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(6,7,0,0,7,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(5,7,0,0,6,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xf8,(byte) 0x48,(byte) 0x40,(byte) 0x70,(byte) 0x40,(byte) 0x48,(byte) 0xf8, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(5,7,0,0,6,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xf8,(byte) 0x4c,(byte) 0x44,(byte) 0x44,(byte) 0x44,(byte) 0x4c,(byte) 0xf8, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(6,7,0,0,7,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0x78,(byte) 0xc4,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0xc4,(byte) 0x7c, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(6,7,0,0,7,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xf0,(byte) 0x48,(byte) 0x48,(byte) 0x70,(byte) 0x48,(byte) 0x48,(byte) 0xf0, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(5,7,0,0,6,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0xee,(byte) 0x44,(byte) 0x7c,(byte) 0x28,(byte) 0x28,(byte) 0x38,(byte) 0x10, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(7,7,0,0,8,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x3e,(byte) 0x40,(byte) 0x92,(byte) 0xad,(byte) 0xa5,(byte) 0xa5,(byte) 0x9d,(byte) 0x42,(byte) 0x3c, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(8,9,0,2,9,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0xa0,(byte) 0xe0, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(3,7,0,0,4,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(3,5,0,0,5,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xf8,(byte) 0x0,(byte) 0xf8, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(5,3,0,-1,6,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0x20,(byte) 0x40,(byte) 0x80,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(3,5,-1,0,5,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(1,7,-1,2,3,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x80, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(1,5,-1,0,3,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0xc0,(byte) 0x20,(byte) 0x70,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(4,7,0,0,5,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(4,7,0,0,5,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x90,(byte) 0xf0, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(4,7,0,0,5,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0xe0,(byte) 0x40,(byte) 0x30, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(4,7,0,0,5,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0xe0,(byte) 0x90,(byte) 0x10,(byte) 0x10,(byte) 0xe0,(byte) 0x40,(byte) 0x70, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(4,7,0,0,5,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x10,(byte) 0x10,(byte) 0xf8,(byte) 0x90,(byte) 0x50,(byte) 0x30,(byte) 0x10, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(5,7,0,0,5,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0xe0,(byte) 0x10,(byte) 0x10,(byte) 0x60,(byte) 0x10,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(4,7,0,0,5,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xf0,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x10,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(4,7,0,0,5,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0xe0,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0xc0,(byte) 0x40, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(3,7,-1,0,5,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x60,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x90,(byte) 0x60, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(4,7,0,0,5,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(3,7,0,0,3,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0x80, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(1,1,-1,0,3,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xf0, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(4,1,-1,-2,7,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(1,3,-1,2,3,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x20,(byte) 0x20,(byte) 0xf8,(byte) 0x20,(byte) 0x20, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(5,5,0,0,6,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0xa0,(byte) 0x40,(byte) 0xa0, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(3,3,0,-4,5,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(3,9,0,2,4,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x20,(byte) 0x40,(byte) 0x40,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x40,(byte) 0x40,(byte) 0x20, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(3,9,0,2,4,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0x40,(byte) 0xc0, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(2,2,0,-5,3,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x76,(byte) 0x8d,(byte) 0x98,(byte) 0x74,(byte) 0x6e,(byte) 0x50,(byte) 0x30, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(8,7,0,0,8,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x44,(byte) 0x2a,(byte) 0x2a,(byte) 0x56,(byte) 0xa8,(byte) 0xa4,(byte) 0x7e, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(7,7,0,0,8,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x20,(byte) 0xe0,(byte) 0x90,(byte) 0x10,(byte) 0x60,(byte) 0x80,(byte) 0x90,(byte) 0x70,(byte) 0x20, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(4,9,0,1,5,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x50,(byte) 0x50,(byte) 0xf8,(byte) 0x50,(byte) 0xf8,(byte) 0x50,(byte) 0x50, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(5,7,0,0,5,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0xa0,(byte) 0xa0, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(3,2,0,-5,4,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0x80,(byte) 0x0,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80,(byte) 0x80, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(1,7,-1,0,3,ch33data); - -/* char: 0x20 ' ' */ - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,2,null); - -static final BitmapCharRec[] chars = { -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmapTimesRoman10 = new BitmapFontRec("-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", - 224, - 32, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java b/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java deleted file mode 100644 index 25684ceff..000000000 --- a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java +++ /dev/null @@ -1,2080 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTBitmapTimesRoman24 { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 0xff */ - -static final byte[] ch255data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xf0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, -(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80,(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0, -(byte) 0xf1,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, -}; - -static final BitmapCharRec ch255 = new BitmapCharRec(11,21,0,5,11,ch255data); - -/* char: 0xfe */ - -static final byte[] ch254data = { -(byte) 0xf0,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x6e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80, -(byte) 0x6e,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0xe0,(byte) 0x0, -}; - -static final BitmapCharRec ch254 = new BitmapCharRec(10,22,-1,5,12,ch254data); - -/* char: 0xfd */ - -static final byte[] ch253data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xf0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, -(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80,(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0, -(byte) 0xf1,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch253 = new BitmapCharRec(11,22,0,5,11,ch253data); - -/* char: 0xfc */ - -static final byte[] ch252data = { -(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, -}; - -static final BitmapCharRec ch252 = new BitmapCharRec(11,16,-1,0,13,ch252data); - -/* char: 0xfb */ - -static final byte[] ch251data = { -(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x1e,(byte) 0x0, -(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch251 = new BitmapCharRec(11,17,-1,0,13,ch251data); - -/* char: 0xfa */ - -static final byte[] ch250data = { -(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x80, -(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch250 = new BitmapCharRec(11,17,-1,0,13,ch250data); - -/* char: 0xf9 */ - -static final byte[] ch249data = { -(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x2,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x38,(byte) 0x0, -(byte) 0x30,(byte) 0x0, -}; - -static final BitmapCharRec ch249 = new BitmapCharRec(11,17,-1,0,13,ch249data); - -/* char: 0xf8 */ - -static final byte[] ch248data = { -(byte) 0xc0,(byte) 0x0,(byte) 0xde,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x71,(byte) 0x80,(byte) 0xd0,(byte) 0xc0,(byte) 0xd8,(byte) 0xc0,(byte) 0xc8,(byte) 0xc0,(byte) 0xcc,(byte) 0xc0, -(byte) 0xc4,(byte) 0xc0,(byte) 0xc6,(byte) 0xc0,(byte) 0x63,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0xc0,(byte) 0x0,(byte) 0xc0, -}; - -static final BitmapCharRec ch248 = new BitmapCharRec(10,14,-1,1,12,ch248data); - -/* char: 0xf7 */ - -static final byte[] ch247data = { -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch247 = new BitmapCharRec(12,10,-1,-2,14,ch247data); - -/* char: 0xf6 */ - -static final byte[] ch246data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, -}; - -static final BitmapCharRec ch246 = new BitmapCharRec(10,16,-1,0,12,ch246data); - -/* char: 0xf5 */ - -static final byte[] ch245data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x27,(byte) 0x0,(byte) 0x1c,(byte) 0x80, -}; - -static final BitmapCharRec ch245 = new BitmapCharRec(10,16,-1,0,12,ch245data); - -/* char: 0xf4 */ - -static final byte[] ch244data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x1e,(byte) 0x0, -(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch244 = new BitmapCharRec(10,17,-1,0,12,ch244data); - -/* char: 0xf3 */ - -static final byte[] ch243data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x80, -(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch243 = new BitmapCharRec(10,17,-1,0,12,ch243data); - -/* char: 0xf2 */ - -static final byte[] ch242data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x2,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x38,(byte) 0x0, -(byte) 0x30,(byte) 0x0, -}; - -static final BitmapCharRec ch242 = new BitmapCharRec(10,17,-1,0,12,ch242data); - -/* char: 0xf1 */ - -static final byte[] ch241data = { -(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x6f,(byte) 0x80,(byte) 0xe7,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x27,(byte) 0x0,(byte) 0x1c,(byte) 0x80, -}; - -static final BitmapCharRec ch241 = new BitmapCharRec(11,16,-1,0,13,ch241data); - -/* char: 0xf0 */ - -static final byte[] ch240data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1f,(byte) 0x0,(byte) 0xc6,(byte) 0x0,(byte) 0x3c,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x71,(byte) 0x80, -(byte) 0xc0,(byte) 0x0, -}; - -static final BitmapCharRec ch240 = new BitmapCharRec(10,17,-1,0,12,ch240data); - -/* char: 0xef */ - -static final byte[] ch239data = { -(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0xcc,(byte) 0xcc, -}; - -static final BitmapCharRec ch239 = new BitmapCharRec(6,16,0,0,6,ch239data); - -/* char: 0xee */ - -static final byte[] ch238data = { -(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x0,(byte) 0x84,(byte) 0x48,(byte) 0x78, -(byte) 0x30, -}; - -static final BitmapCharRec ch238 = new BitmapCharRec(6,17,0,0,6,ch238data); - -/* char: 0xed */ - -static final byte[] ch237data = { -(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0x0,(byte) 0x80,(byte) 0x60,(byte) 0x38, -(byte) 0x18, -}; - -static final BitmapCharRec ch237 = new BitmapCharRec(5,17,-1,0,6,ch237data); - -/* char: 0xec */ - -static final byte[] ch236data = { -(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x0,(byte) 0x8,(byte) 0x30,(byte) 0xe0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch236 = new BitmapCharRec(5,17,0,0,6,ch236data); - -/* char: 0xeb */ - -static final byte[] ch235data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x33,(byte) 0x0, -}; - -static final BitmapCharRec ch235 = new BitmapCharRec(9,16,-1,0,11,ch235data); - -/* char: 0xea */ - -static final byte[] ch234data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x21,(byte) 0x0,(byte) 0x12,(byte) 0x0,(byte) 0x1e,(byte) 0x0, -(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch234 = new BitmapCharRec(9,17,-1,0,11,ch234data); - -/* char: 0xe9 */ - -static final byte[] ch233data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x7,(byte) 0x0, -(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch233 = new BitmapCharRec(9,17,-1,0,11,ch233data); - -/* char: 0xe8 */ - -static final byte[] ch232data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x70,(byte) 0x0, -(byte) 0x60,(byte) 0x0, -}; - -static final BitmapCharRec ch232 = new BitmapCharRec(9,17,-1,0,11,ch232data); - -/* char: 0xe7 */ - -static final byte[] ch231data = { -(byte) 0x3c,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0, -(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x41,(byte) 0x80, -(byte) 0x63,(byte) 0x80,(byte) 0x1f,(byte) 0x0, -}; - -static final BitmapCharRec ch231 = new BitmapCharRec(9,18,-1,6,11,ch231data); - -/* char: 0xe6 */ - -static final byte[] ch230data = { -(byte) 0x70,(byte) 0xf0,(byte) 0xfb,(byte) 0xf8,(byte) 0xc7,(byte) 0x84,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0xfc, -(byte) 0x3,(byte) 0xc,(byte) 0x63,(byte) 0xc,(byte) 0x67,(byte) 0x98,(byte) 0x3c,(byte) 0xf0, -}; - -static final BitmapCharRec ch230 = new BitmapCharRec(14,12,-1,0,16,ch230data); - -/* char: 0xe5 */ - -static final byte[] ch229data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0, -(byte) 0x1c,(byte) 0x0, -}; - -static final BitmapCharRec ch229 = new BitmapCharRec(9,17,-1,0,11,ch229data); - -/* char: 0xe4 */ - -static final byte[] ch228data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x66,(byte) 0x0, -}; - -static final BitmapCharRec ch228 = new BitmapCharRec(9,16,-1,0,11,ch228data); - -/* char: 0xe3 */ - -static final byte[] ch227data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x5c,(byte) 0x0,(byte) 0x3a,(byte) 0x0, -}; - -static final BitmapCharRec ch227 = new BitmapCharRec(9,16,-1,0,11,ch227data); - -/* char: 0xe2 */ - -static final byte[] ch226data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x42,(byte) 0x0,(byte) 0x24,(byte) 0x0,(byte) 0x3c,(byte) 0x0, -(byte) 0x18,(byte) 0x0, -}; - -static final BitmapCharRec ch226 = new BitmapCharRec(9,17,-1,0,11,ch226data); - -/* char: 0xe1 */ - -static final byte[] ch225data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x7,(byte) 0x0, -(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch225 = new BitmapCharRec(9,17,-1,0,11,ch225data); - -/* char: 0xe0 */ - -static final byte[] ch224data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x70,(byte) 0x0, -(byte) 0x60,(byte) 0x0, -}; - -static final BitmapCharRec ch224 = new BitmapCharRec(9,17,-1,0,11,ch224data); - -/* char: 0xdf */ - -static final byte[] ch223data = { -(byte) 0xe7,(byte) 0x0,(byte) 0x6c,(byte) 0x80,(byte) 0x6c,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x63,(byte) 0x80, -(byte) 0x67,(byte) 0x0,(byte) 0x6c,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, -(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch223 = new BitmapCharRec(10,17,-1,0,12,ch223data); - -/* char: 0xde */ - -static final byte[] ch222data = { -(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18, -(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70,(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, -(byte) 0xfc,(byte) 0x0, -}; - -static final BitmapCharRec ch222 = new BitmapCharRec(13,17,-1,0,15,ch222data); - -/* char: 0xdd */ - -static final byte[] ch221data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3,(byte) 0xc0, -(byte) 0x3,(byte) 0x40,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x20,(byte) 0xc,(byte) 0x30,(byte) 0x1c,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0x38,(byte) 0x8,(byte) 0x30,(byte) 0xc, -(byte) 0xfc,(byte) 0x3f,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30, -}; - -static final BitmapCharRec ch221 = new BitmapCharRec(16,22,0,0,16,ch221data); - -/* char: 0xdc */ - -static final byte[] ch220data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30, -}; - -static final BitmapCharRec ch220 = new BitmapCharRec(16,21,-1,0,18,ch220data); - -/* char: 0xdb */ - -static final byte[] ch219data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x6,(byte) 0x60,(byte) 0x3,(byte) 0xc0,(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch219 = new BitmapCharRec(16,22,-1,0,18,ch219data); - -/* char: 0xda */ - -static final byte[] ch218data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30, -}; - -static final BitmapCharRec ch218 = new BitmapCharRec(16,22,-1,0,18,ch218data); - -/* char: 0xd9 */ - -static final byte[] ch217data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xfc,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0x1,(byte) 0x80,(byte) 0x7,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch217 = new BitmapCharRec(16,22,-1,0,18,ch217data); - -/* char: 0xd8 */ - -static final byte[] ch216data = { -(byte) 0x20,(byte) 0x0,(byte) 0x27,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x68,(byte) 0x6,(byte) 0x64,(byte) 0x6,(byte) 0xc2,(byte) 0x3,(byte) 0xc2,(byte) 0x3, -(byte) 0xc1,(byte) 0x3,(byte) 0xc1,(byte) 0x3,(byte) 0xc0,(byte) 0x83,(byte) 0xc0,(byte) 0x83,(byte) 0xc0,(byte) 0x43,(byte) 0x60,(byte) 0x46,(byte) 0x60,(byte) 0x26,(byte) 0x38,(byte) 0x1c, -(byte) 0x1c,(byte) 0x38,(byte) 0x7,(byte) 0xe4,(byte) 0x0,(byte) 0x4, -}; - -static final BitmapCharRec ch216 = new BitmapCharRec(16,19,-1,1,18,ch216data); - -/* char: 0xd7 */ - -static final byte[] ch215data = { -(byte) 0x80,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0, -(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0x80,(byte) 0x40, -}; - -static final BitmapCharRec ch215 = new BitmapCharRec(10,11,-2,-1,14,ch215data); - -/* char: 0xd6 */ - -static final byte[] ch214data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, -(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x60, -}; - -static final BitmapCharRec ch214 = new BitmapCharRec(16,21,-1,0,18,ch214data); - -/* char: 0xd5 */ - -static final byte[] ch213data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, -(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0xe0,(byte) 0x3,(byte) 0x90, -}; - -static final BitmapCharRec ch213 = new BitmapCharRec(16,21,-1,0,18,ch213data); - -/* char: 0xd4 */ - -static final byte[] ch212data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, -(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x6,(byte) 0x60,(byte) 0x3,(byte) 0xc0,(byte) 0x1,(byte) 0x80, -}; - -static final BitmapCharRec ch212 = new BitmapCharRec(16,22,-1,0,18,ch212data); - -/* char: 0xd3 */ - -static final byte[] ch211data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, -(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30, -}; - -static final BitmapCharRec ch211 = new BitmapCharRec(16,22,-1,0,18,ch211data); - -/* char: 0xd2 */ - -static final byte[] ch210data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, -(byte) 0x7,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x40,(byte) 0x1,(byte) 0x80,(byte) 0x7,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch210 = new BitmapCharRec(16,22,-1,0,18,ch210data); - -/* char: 0xd1 */ - -static final byte[] ch209data = { -(byte) 0xf8,(byte) 0xc,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x34,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0xc4,(byte) 0x21,(byte) 0x84, -(byte) 0x21,(byte) 0x84,(byte) 0x23,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x2c,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xf0,(byte) 0x1f,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0xe0,(byte) 0x3,(byte) 0x90, -}; - -static final BitmapCharRec ch209 = new BitmapCharRec(16,21,-1,0,18,ch209data); - -/* char: 0xd0 */ - -static final byte[] ch208data = { -(byte) 0x7f,(byte) 0xe0,(byte) 0x18,(byte) 0x38,(byte) 0x18,(byte) 0x1c,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3, -(byte) 0xff,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x3,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x6,(byte) 0x18,(byte) 0x1c,(byte) 0x18,(byte) 0x38, -(byte) 0x7f,(byte) 0xe0, -}; - -static final BitmapCharRec ch208 = new BitmapCharRec(16,17,0,0,17,ch208data); - -/* char: 0xcf */ - -static final byte[] ch207data = { -(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0xfc,(byte) 0x0,(byte) 0x0,(byte) 0xcc,(byte) 0xcc, -}; - -static final BitmapCharRec ch207 = new BitmapCharRec(6,21,-1,0,8,ch207data); - -/* char: 0xce */ - -static final byte[] ch206data = { -(byte) 0x7e,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18, -(byte) 0x7e,(byte) 0x0,(byte) 0x81,(byte) 0x66,(byte) 0x3c,(byte) 0x18, -}; - -static final BitmapCharRec ch206 = new BitmapCharRec(8,22,-1,0,8,ch206data); - -/* char: 0xcd */ - -static final byte[] ch205data = { -(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0xfc,(byte) 0x0,(byte) 0x40,(byte) 0x30,(byte) 0x1c,(byte) 0xc, -}; - -static final BitmapCharRec ch205 = new BitmapCharRec(6,22,-1,0,8,ch205data); - -/* char: 0xcc */ - -static final byte[] ch204data = { -(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0xfc,(byte) 0x0,(byte) 0x8,(byte) 0x30,(byte) 0xe0,(byte) 0xc0, -}; - -static final BitmapCharRec ch204 = new BitmapCharRec(6,22,-1,0,8,ch204data); - -/* char: 0xcb */ - -static final byte[] ch203data = { -(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, -(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80, -}; - -static final BitmapCharRec ch203 = new BitmapCharRec(13,21,-1,0,15,ch203data); - -/* char: 0xca */ - -static final byte[] ch202data = { -(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, -(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x20,(byte) 0xc,(byte) 0xc0,(byte) 0x7,(byte) 0x80,(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch202 = new BitmapCharRec(13,22,-1,0,15,ch202data); - -/* char: 0xc9 */ - -static final byte[] ch201data = { -(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, -(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0xc0, -}; - -static final BitmapCharRec ch201 = new BitmapCharRec(13,22,-1,0,15,ch201data); - -/* char: 0xc8 */ - -static final byte[] ch200data = { -(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, -(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x18,(byte) 0x0, -}; - -static final BitmapCharRec ch200 = new BitmapCharRec(13,22,-1,0,15,ch200data); - -/* char: 0xc7 */ - -static final byte[] ch199data = { -(byte) 0x7,(byte) 0x80,(byte) 0xc,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x7,(byte) 0xe0,(byte) 0x1e,(byte) 0x38, -(byte) 0x38,(byte) 0x8,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x4,(byte) 0x38,(byte) 0xc,(byte) 0x1c,(byte) 0x3c,(byte) 0x7,(byte) 0xe4, -}; - -static final BitmapCharRec ch199 = new BitmapCharRec(14,23,-1,6,16,ch199data); - -/* char: 0xc6 */ - -static final byte[] ch198data = { -(byte) 0xf9,(byte) 0xff,(byte) 0xf0,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x10,(byte) 0x60,(byte) 0x10,(byte) 0x10,(byte) 0x60,(byte) 0x10,(byte) 0x18,(byte) 0x60,(byte) 0x0,(byte) 0x8, -(byte) 0x60,(byte) 0x0,(byte) 0xf,(byte) 0xe0,(byte) 0x80,(byte) 0xc,(byte) 0x60,(byte) 0x80,(byte) 0x4,(byte) 0x7f,(byte) 0x80,(byte) 0x4,(byte) 0x60,(byte) 0x80,(byte) 0x6,(byte) 0x60, -(byte) 0x80,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x20,(byte) 0x1,(byte) 0x60,(byte) 0x20,(byte) 0x1,(byte) 0xe0,(byte) 0x60, -(byte) 0x3,(byte) 0xff,(byte) 0xe0, -}; - -static final BitmapCharRec ch198 = new BitmapCharRec(20,17,0,0,21,ch198data); - -/* char: 0xc5 */ - -static final byte[] ch197data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x2,(byte) 0x20,(byte) 0x0,(byte) 0x2,(byte) 0x20,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -}; - -static final BitmapCharRec ch197 = new BitmapCharRec(17,21,0,0,17,ch197data); - -/* char: 0xc4 */ - -static final byte[] ch196data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x0, -}; - -static final BitmapCharRec ch196 = new BitmapCharRec(17,21,0,0,17,ch196data); - -/* char: 0xc3 */ - -static final byte[] ch195data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x7,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x4,(byte) 0xe0,(byte) 0x0,(byte) 0x3,(byte) 0x90,(byte) 0x0, -}; - -static final BitmapCharRec ch195 = new BitmapCharRec(17,21,0,0,17,ch195data); - -/* char: 0xc2 */ - -static final byte[] ch194data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x0,(byte) 0x6,(byte) 0x60,(byte) 0x0,(byte) 0x3,(byte) 0xc0,(byte) 0x0,(byte) 0x1, -(byte) 0x80,(byte) 0x0, -}; - -static final BitmapCharRec ch194 = new BitmapCharRec(17,22,0,0,17,ch194data); - -/* char: 0xc1 */ - -static final byte[] ch193data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x0, -(byte) 0x30,(byte) 0x0, -}; - -static final BitmapCharRec ch193 = new BitmapCharRec(17,22,0,0,17,ch193data); - -/* char: 0xc0 */ - -static final byte[] ch192data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x20,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x0,(byte) 0x3, -(byte) 0x0,(byte) 0x0, -}; - -static final BitmapCharRec ch192 = new BitmapCharRec(17,22,0,0,17,ch192data); - -/* char: 0xbf */ - -static final byte[] ch191data = { -(byte) 0x3e,(byte) 0x63,(byte) 0xc1,(byte) 0xc3,(byte) 0xc3,(byte) 0xe0,(byte) 0x70,(byte) 0x30,(byte) 0x38,(byte) 0x18,(byte) 0x18,(byte) 0x8,(byte) 0x8,(byte) 0x0,(byte) 0x0,(byte) 0xc, -(byte) 0xc, -}; - -static final BitmapCharRec ch191 = new BitmapCharRec(8,17,-1,5,11,ch191data); - -/* char: 0xbe */ - -static final byte[] ch190data = { -(byte) 0x18,(byte) 0x2,(byte) 0x0,(byte) 0x8,(byte) 0x2,(byte) 0x0,(byte) 0xc,(byte) 0x7f,(byte) 0x80,(byte) 0x4,(byte) 0x22,(byte) 0x0,(byte) 0x6,(byte) 0x32,(byte) 0x0,(byte) 0x3, -(byte) 0x12,(byte) 0x0,(byte) 0x1,(byte) 0xa,(byte) 0x0,(byte) 0x71,(byte) 0x8e,(byte) 0x0,(byte) 0x88,(byte) 0x86,(byte) 0x0,(byte) 0x8c,(byte) 0xc2,(byte) 0x0,(byte) 0xc,(byte) 0x60, -(byte) 0x0,(byte) 0x8,(byte) 0x20,(byte) 0x0,(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x8,(byte) 0x10,(byte) 0x0,(byte) 0x8c,(byte) 0x18,(byte) 0x0,(byte) 0x4c,(byte) 0xc,(byte) 0x0, -(byte) 0x38,(byte) 0x4,(byte) 0x0, -}; - -static final BitmapCharRec ch190 = new BitmapCharRec(17,17,0,0,18,ch190data); - -/* char: 0xbd */ - -static final byte[] ch189data = { -(byte) 0x30,(byte) 0x7e,(byte) 0x10,(byte) 0x22,(byte) 0x18,(byte) 0x10,(byte) 0x8,(byte) 0x18,(byte) 0xc,(byte) 0x8,(byte) 0x6,(byte) 0x4,(byte) 0x2,(byte) 0x6,(byte) 0xfb,(byte) 0x46, -(byte) 0x21,(byte) 0x26,(byte) 0x21,(byte) 0x9c,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x20,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x30,(byte) 0x60,(byte) 0x18, -(byte) 0x20,(byte) 0x8, -}; - -static final BitmapCharRec ch189 = new BitmapCharRec(15,17,-1,0,18,ch189data); - -/* char: 0xbc */ - -static final byte[] ch188data = { -(byte) 0x30,(byte) 0x4,(byte) 0x10,(byte) 0x4,(byte) 0x18,(byte) 0xff,(byte) 0x8,(byte) 0x44,(byte) 0xc,(byte) 0x64,(byte) 0x6,(byte) 0x24,(byte) 0x2,(byte) 0x14,(byte) 0xfb,(byte) 0x1c, -(byte) 0x21,(byte) 0xc,(byte) 0x21,(byte) 0x84,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x40,(byte) 0x20,(byte) 0x60,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x30,(byte) 0x60,(byte) 0x18, -(byte) 0x20,(byte) 0x8, -}; - -static final BitmapCharRec ch188 = new BitmapCharRec(16,17,-1,0,18,ch188data); - -/* char: 0xbb */ - -static final byte[] ch187data = { -(byte) 0x88,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x19,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x66,(byte) 0x0, -(byte) 0xcc,(byte) 0x0,(byte) 0x88,(byte) 0x0, -}; - -static final BitmapCharRec ch187 = new BitmapCharRec(9,10,-2,-1,12,ch187data); - -/* char: 0xba */ - -static final byte[] ch186data = { -(byte) 0xfc,(byte) 0x0,(byte) 0x78,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0x78, -}; - -static final BitmapCharRec ch186 = new BitmapCharRec(6,9,-1,-8,8,ch186data); - -/* char: 0xb9 */ - -static final byte[] ch185data = { -(byte) 0xf8,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0x20,(byte) 0xa0,(byte) 0x60,(byte) 0x20, -}; - -static final BitmapCharRec ch185 = new BitmapCharRec(5,10,-1,-7,7,ch185data); - -/* char: 0xb8 */ - -static final byte[] ch184data = { -(byte) 0x78,(byte) 0xcc,(byte) 0xc,(byte) 0x3c,(byte) 0x30,(byte) 0x10, -}; - -static final BitmapCharRec ch184 = new BitmapCharRec(6,6,-1,6,8,ch184data); - -/* char: 0xb7 */ - -static final byte[] ch183data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch183 = new BitmapCharRec(2,2,-2,-6,6,ch183data); - -/* char: 0xb6 */ - -static final byte[] ch182data = { -(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0, -(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x9,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x39,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0xf9,(byte) 0x0, -(byte) 0xf9,(byte) 0x0,(byte) 0xf9,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0x79,(byte) 0x0,(byte) 0x39,(byte) 0x0,(byte) 0x1f,(byte) 0x80, -}; - -static final BitmapCharRec ch182 = new BitmapCharRec(9,22,-1,5,11,ch182data); - -/* char: 0xb5 */ - -static final byte[] ch181data = { -(byte) 0x40,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x5c,(byte) 0xe0,(byte) 0x7e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0xe1,(byte) 0xc0, -}; - -static final BitmapCharRec ch181 = new BitmapCharRec(11,17,-1,5,13,ch181data); - -/* char: 0xb4 */ - -static final byte[] ch180data = { -(byte) 0x80,(byte) 0x60,(byte) 0x38,(byte) 0x18, -}; - -static final BitmapCharRec ch180 = new BitmapCharRec(5,4,-2,-13,8,ch180data); - -/* char: 0xb3 */ - -static final byte[] ch179data = { -(byte) 0x70,(byte) 0x88,(byte) 0x8c,(byte) 0xc,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x8c,(byte) 0x4c,(byte) 0x38, -}; - -static final BitmapCharRec ch179 = new BitmapCharRec(6,10,0,-7,7,ch179data); - -/* char: 0xb2 */ - -static final byte[] ch178data = { -(byte) 0xfc,(byte) 0x44,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x8,(byte) 0xc,(byte) 0x8c,(byte) 0x4c,(byte) 0x38, -}; - -static final BitmapCharRec ch178 = new BitmapCharRec(6,10,0,-7,7,ch178data); - -/* char: 0xb1 */ - -static final byte[] ch177data = { -(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch177 = new BitmapCharRec(12,15,-1,0,14,ch177data); - -/* char: 0xb0 */ - -static final byte[] ch176data = { -(byte) 0x38,(byte) 0x44,(byte) 0x82,(byte) 0x82,(byte) 0x82,(byte) 0x44,(byte) 0x38, -}; - -static final BitmapCharRec ch176 = new BitmapCharRec(7,7,-1,-10,9,ch176data); - -/* char: 0xaf */ - -static final byte[] ch175data = { -(byte) 0xfc,(byte) 0xfc, -}; - -static final BitmapCharRec ch175 = new BitmapCharRec(6,2,-1,-14,8,ch175data); - -/* char: 0xae */ - -static final byte[] ch174data = { -(byte) 0x7,(byte) 0xf0,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x60,(byte) 0x3,(byte) 0x0,(byte) 0x47,(byte) 0x19,(byte) 0x0,(byte) 0xc2, -(byte) 0x31,(byte) 0x80,(byte) 0x82,(byte) 0x20,(byte) 0x80,(byte) 0x82,(byte) 0x40,(byte) 0x80,(byte) 0x83,(byte) 0xe0,(byte) 0x80,(byte) 0x82,(byte) 0x30,(byte) 0x80,(byte) 0x82,(byte) 0x10, -(byte) 0x80,(byte) 0xc2,(byte) 0x11,(byte) 0x80,(byte) 0x42,(byte) 0x31,(byte) 0x0,(byte) 0x67,(byte) 0xe3,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0, -(byte) 0x7,(byte) 0xf0,(byte) 0x0, -}; - -static final BitmapCharRec ch174 = new BitmapCharRec(17,17,-1,0,19,ch174data); - -/* char: 0xad */ - -static final byte[] ch173data = { -(byte) 0xfe,(byte) 0xfe, -}; - -static final BitmapCharRec ch173 = new BitmapCharRec(7,2,-1,-5,9,ch173data); - -/* char: 0xac */ - -static final byte[] ch172data = { -(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0, -}; - -static final BitmapCharRec ch172 = new BitmapCharRec(12,7,-1,-3,14,ch172data); - -/* char: 0xab */ - -static final byte[] ch171data = { -(byte) 0x8,(byte) 0x80,(byte) 0x19,(byte) 0x80,(byte) 0x33,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x33,(byte) 0x0, -(byte) 0x19,(byte) 0x80,(byte) 0x8,(byte) 0x80, -}; - -static final BitmapCharRec ch171 = new BitmapCharRec(9,10,-2,-1,13,ch171data); - -/* char: 0xaa */ - -static final byte[] ch170data = { -(byte) 0x7e,(byte) 0x0,(byte) 0x76,(byte) 0xcc,(byte) 0xcc,(byte) 0x7c,(byte) 0xc,(byte) 0xcc,(byte) 0x78, -}; - -static final BitmapCharRec ch170 = new BitmapCharRec(7,9,0,-8,8,ch170data); - -/* char: 0xa9 */ - -static final byte[] ch169data = { -(byte) 0x7,(byte) 0xf0,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x61,(byte) 0xc3,(byte) 0x0,(byte) 0x47,(byte) 0x71,(byte) 0x0,(byte) 0xc4, -(byte) 0x19,(byte) 0x80,(byte) 0x8c,(byte) 0x0,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x80,(byte) 0x88,(byte) 0x0,(byte) 0x80,(byte) 0x8c,(byte) 0x0, -(byte) 0x80,(byte) 0xc4,(byte) 0x19,(byte) 0x80,(byte) 0x47,(byte) 0x31,(byte) 0x0,(byte) 0x61,(byte) 0xe3,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x1c,(byte) 0x1c,(byte) 0x0, -(byte) 0x7,(byte) 0xf0,(byte) 0x0, -}; - -static final BitmapCharRec ch169 = new BitmapCharRec(17,17,-1,0,19,ch169data); - -/* char: 0xa8 */ - -static final byte[] ch168data = { -(byte) 0xcc,(byte) 0xcc, -}; - -static final BitmapCharRec ch168 = new BitmapCharRec(6,2,-1,-14,8,ch168data); - -/* char: 0xa7 */ - -static final byte[] ch167data = { -(byte) 0x38,(byte) 0x64,(byte) 0x62,(byte) 0x6,(byte) 0xe,(byte) 0x1c,(byte) 0x38,(byte) 0x74,(byte) 0xe2,(byte) 0xc3,(byte) 0x83,(byte) 0x87,(byte) 0x4e,(byte) 0x3c,(byte) 0x38,(byte) 0x70, -(byte) 0x60,(byte) 0x46,(byte) 0x26,(byte) 0x1c, -}; - -static final BitmapCharRec ch167 = new BitmapCharRec(8,20,-2,2,12,ch167data); - -/* char: 0xa6 */ - -static final byte[] ch166data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch166 = new BitmapCharRec(2,17,-2,0,6,ch166data); - -/* char: 0xa5 */ - -static final byte[] ch165data = { -(byte) 0xf,(byte) 0xc0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1f,(byte) 0xe0,(byte) 0x3,(byte) 0x0,(byte) 0x1f,(byte) 0xe0, -(byte) 0x3,(byte) 0x0,(byte) 0x7,(byte) 0x80,(byte) 0xc,(byte) 0x80,(byte) 0xc,(byte) 0xc0,(byte) 0x18,(byte) 0x40,(byte) 0x18,(byte) 0x60,(byte) 0x30,(byte) 0x20,(byte) 0x70,(byte) 0x30, -(byte) 0xf8,(byte) 0x7c, -}; - -static final BitmapCharRec ch165 = new BitmapCharRec(14,17,0,0,14,ch165data); - -/* char: 0xa4 */ - -static final byte[] ch164data = { -(byte) 0xc0,(byte) 0x60,(byte) 0xee,(byte) 0xe0,(byte) 0x7f,(byte) 0xc0,(byte) 0x31,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x31,(byte) 0x80,(byte) 0x7f,(byte) 0xc0,(byte) 0xee,(byte) 0xe0,(byte) 0xc0,(byte) 0x60, -}; - -static final BitmapCharRec ch164 = new BitmapCharRec(11,12,-1,-3,13,ch164data); - -/* char: 0xa3 */ - -static final byte[] ch163data = { -(byte) 0xe7,(byte) 0x80,(byte) 0xbe,(byte) 0xc0,(byte) 0x78,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, -(byte) 0x30,(byte) 0x0,(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x19,(byte) 0x80, -(byte) 0xf,(byte) 0x0, -}; - -static final BitmapCharRec ch163 = new BitmapCharRec(10,17,-1,0,12,ch163data); - -/* char: 0xa2 */ - -static final byte[] ch162data = { -(byte) 0x40,(byte) 0x0,(byte) 0x40,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xd0,(byte) 0x0,(byte) 0xc8,(byte) 0x0,(byte) 0xc8,(byte) 0x0, -(byte) 0xc8,(byte) 0x0,(byte) 0xc4,(byte) 0x0,(byte) 0xc4,(byte) 0x0,(byte) 0x43,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0x1f,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x1,(byte) 0x0, -}; - -static final BitmapCharRec ch162 = new BitmapCharRec(9,16,-1,2,12,ch162data); - -/* char: 0xa1 */ - -static final byte[] ch161data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch161 = new BitmapCharRec(2,17,-4,5,8,ch161data); - -/* char: 0xa0 */ - -static final BitmapCharRec ch160 = new BitmapCharRec(0,0,0,0,6,null); - -/* char: 0x7e '~' */ - -static final byte[] ch126data = { -(byte) 0x83,(byte) 0x80,(byte) 0xc7,(byte) 0xc0,(byte) 0x7c,(byte) 0x60,(byte) 0x38,(byte) 0x20, -}; - -static final BitmapCharRec ch126 = new BitmapCharRec(11,4,-1,-5,13,ch126data); - -/* char: 0x7d '}' */ - -static final byte[] ch125data = { -(byte) 0xe0,(byte) 0x30,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x8,(byte) 0xc,(byte) 0x4,(byte) 0x3,(byte) 0x4,(byte) 0xc,(byte) 0x8,(byte) 0x18, -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x30,(byte) 0xe0, -}; - -static final BitmapCharRec ch125 = new BitmapCharRec(8,22,-1,5,10,ch125data); - -/* char: 0x7c '|' */ - -static final byte[] ch124data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch124 = new BitmapCharRec(2,17,-2,0,6,ch124data); - -/* char: 0x7b '{' */ - -static final byte[] ch123data = { -(byte) 0x7,(byte) 0xc,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x20,(byte) 0xc0,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x18, -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0x7, -}; - -static final BitmapCharRec ch123 = new BitmapCharRec(8,22,-1,5,10,ch123data); - -/* char: 0x7a 'z' */ - -static final byte[] ch122data = { -(byte) 0xff,(byte) 0xc3,(byte) 0x61,(byte) 0x70,(byte) 0x30,(byte) 0x38,(byte) 0x18,(byte) 0x1c,(byte) 0xe,(byte) 0x86,(byte) 0xc3,(byte) 0xff, -}; - -static final BitmapCharRec ch122 = new BitmapCharRec(8,12,-1,0,10,ch122data); - -/* char: 0x79 'y' */ - -static final byte[] ch121data = { -(byte) 0xe0,(byte) 0x0,(byte) 0xf0,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x8,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0, -(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80,(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0, -(byte) 0xf1,(byte) 0xe0, -}; - -static final BitmapCharRec ch121 = new BitmapCharRec(11,17,0,5,11,ch121data); - -/* char: 0x78 'x' */ - -static final byte[] ch120data = { -(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x21,(byte) 0x80,(byte) 0x33,(byte) 0x80,(byte) 0x1b,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x1a,(byte) 0x0, -(byte) 0x39,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0xf1,(byte) 0xe0, -}; - -static final BitmapCharRec ch120 = new BitmapCharRec(11,12,-1,0,13,ch120data); - -/* char: 0x77 'w' */ - -static final byte[] ch119data = { -(byte) 0x4,(byte) 0x10,(byte) 0x0,(byte) 0xe,(byte) 0x38,(byte) 0x0,(byte) 0xe,(byte) 0x38,(byte) 0x0,(byte) 0x1a,(byte) 0x28,(byte) 0x0,(byte) 0x1a,(byte) 0x64,(byte) 0x0,(byte) 0x19, -(byte) 0x64,(byte) 0x0,(byte) 0x31,(byte) 0x64,(byte) 0x0,(byte) 0x30,(byte) 0xc2,(byte) 0x0,(byte) 0x30,(byte) 0xc2,(byte) 0x0,(byte) 0x60,(byte) 0xc2,(byte) 0x0,(byte) 0x60,(byte) 0xc3, -(byte) 0x0,(byte) 0xf1,(byte) 0xe7,(byte) 0x80, -}; - -static final BitmapCharRec ch119 = new BitmapCharRec(17,12,0,0,17,ch119data); - -/* char: 0x76 'v' */ - -static final byte[] ch118data = { -(byte) 0x4,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0xe,(byte) 0x0,(byte) 0x1a,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x19,(byte) 0x0,(byte) 0x31,(byte) 0x0,(byte) 0x30,(byte) 0x80, -(byte) 0x30,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0xf1,(byte) 0xe0, -}; - -static final BitmapCharRec ch118 = new BitmapCharRec(11,12,0,0,11,ch118data); - -/* char: 0x75 'u' */ - -static final byte[] ch117data = { -(byte) 0x1c,(byte) 0xe0,(byte) 0x3e,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0xe1,(byte) 0xc0, -}; - -static final BitmapCharRec ch117 = new BitmapCharRec(11,12,-1,0,13,ch117data); - -/* char: 0x74 't' */ - -static final byte[] ch116data = { -(byte) 0x1c,(byte) 0x32,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfe,(byte) 0x70,(byte) 0x30,(byte) 0x10, -}; - -static final BitmapCharRec ch116 = new BitmapCharRec(7,15,0,0,7,ch116data); - -/* char: 0x73 's' */ - -static final byte[] ch115data = { -(byte) 0xf8,(byte) 0xc6,(byte) 0x83,(byte) 0x3,(byte) 0x7,(byte) 0x1e,(byte) 0x7c,(byte) 0x70,(byte) 0xe0,(byte) 0xc2,(byte) 0x66,(byte) 0x3e, -}; - -static final BitmapCharRec ch115 = new BitmapCharRec(8,12,-1,0,10,ch115data); - -/* char: 0x72 'r' */ - -static final byte[] ch114data = { -(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x76,(byte) 0x6e,(byte) 0xe6, -}; - -static final BitmapCharRec ch114 = new BitmapCharRec(7,12,-1,0,8,ch114data); - -/* char: 0x71 'q' */ - -static final byte[] ch113data = { -(byte) 0x3,(byte) 0xc0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1d,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80, -(byte) 0x1d,(byte) 0x80, -}; - -static final BitmapCharRec ch113 = new BitmapCharRec(10,17,-1,5,12,ch113data); - -/* char: 0x70 'p' */ - -static final byte[] ch112data = { -(byte) 0xf0,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x6e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80, -(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80, -(byte) 0xee,(byte) 0x0, -}; - -static final BitmapCharRec ch112 = new BitmapCharRec(10,17,-1,5,12,ch112data); - -/* char: 0x6f 'o' */ - -static final byte[] ch111data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch111 = new BitmapCharRec(10,12,-1,0,12,ch111data); - -/* char: 0x6e 'n' */ - -static final byte[] ch110data = { -(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x6f,(byte) 0x80,(byte) 0xe7,(byte) 0x0, -}; - -static final BitmapCharRec ch110 = new BitmapCharRec(11,12,-1,0,13,ch110data); - -/* char: 0x6d 'm' */ - -static final byte[] ch109data = { -(byte) 0xf1,(byte) 0xe3,(byte) 0xc0,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60, -(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x60,(byte) 0xc1,(byte) 0x80,(byte) 0x71,(byte) 0xe3,(byte) 0x80,(byte) 0x6f,(byte) 0x9f, -(byte) 0x0,(byte) 0xe7,(byte) 0xe,(byte) 0x0, -}; - -static final BitmapCharRec ch109 = new BitmapCharRec(18,12,-1,0,20,ch109data); - -/* char: 0x6c 'l' */ - -static final byte[] ch108data = { -(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60, -(byte) 0xe0, -}; - -static final BitmapCharRec ch108 = new BitmapCharRec(4,17,-1,0,6,ch108data); - -/* char: 0x6b 'k' */ - -static final byte[] ch107data = { -(byte) 0xf3,(byte) 0xe0,(byte) 0x61,(byte) 0xc0,(byte) 0x63,(byte) 0x80,(byte) 0x67,(byte) 0x0,(byte) 0x6e,(byte) 0x0,(byte) 0x6c,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x68,(byte) 0x0, -(byte) 0x64,(byte) 0x0,(byte) 0x66,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0xc0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0, -(byte) 0xe0,(byte) 0x0, -}; - -static final BitmapCharRec ch107 = new BitmapCharRec(11,17,-1,0,12,ch107data); - -/* char: 0x6a 'j' */ - -static final byte[] ch106data = { -(byte) 0xc0,(byte) 0xe0,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x30, -}; - -static final BitmapCharRec ch106 = new BitmapCharRec(4,22,0,5,6,ch106data); - -/* char: 0x69 'i' */ - -static final byte[] ch105data = { -(byte) 0xf0,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0x60,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x60, -(byte) 0x60, -}; - -static final BitmapCharRec ch105 = new BitmapCharRec(4,17,-1,0,6,ch105data); - -/* char: 0x68 'h' */ - -static final byte[] ch104data = { -(byte) 0xf1,(byte) 0xe0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x71,(byte) 0xc0,(byte) 0x6f,(byte) 0x80,(byte) 0x67,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0, -(byte) 0xe0,(byte) 0x0, -}; - -static final BitmapCharRec ch104 = new BitmapCharRec(11,17,-1,0,13,ch104data); - -/* char: 0x67 'g' */ - -static final byte[] ch103data = { -(byte) 0x3f,(byte) 0x0,(byte) 0xf1,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x3f,(byte) 0xc0,(byte) 0x7f,(byte) 0x0,(byte) 0x60,(byte) 0x0, -(byte) 0x30,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, -(byte) 0x1f,(byte) 0xc0, -}; - -static final BitmapCharRec ch103 = new BitmapCharRec(11,17,-1,5,12,ch103data); - -/* char: 0x66 'f' */ - -static final byte[] ch102data = { -(byte) 0x78,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0xfe,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x16, -(byte) 0xe, -}; - -static final BitmapCharRec ch102 = new BitmapCharRec(7,17,0,0,7,ch102data); - -/* char: 0x65 'e' */ - -static final byte[] ch101data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xff,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x0,(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch101 = new BitmapCharRec(9,12,-1,0,11,ch101data); - -/* char: 0x64 'd' */ - -static final byte[] ch100data = { -(byte) 0x1e,(byte) 0xc0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0xc1,(byte) 0x80, -(byte) 0xc1,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x1d,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80, -(byte) 0x3,(byte) 0x80, -}; - -static final BitmapCharRec ch100 = new BitmapCharRec(10,17,-1,0,12,ch100data); - -/* char: 0x63 'c' */ - -static final byte[] ch99data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7f,(byte) 0x0,(byte) 0x70,(byte) 0x80,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0x41,(byte) 0x80,(byte) 0x63,(byte) 0x80,(byte) 0x1f,(byte) 0x0, -}; - -static final BitmapCharRec ch99 = new BitmapCharRec(9,12,-1,0,11,ch99data); - -/* char: 0x62 'b' */ - -static final byte[] ch98data = { -(byte) 0x5e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0,(byte) 0x60,(byte) 0xc0, -(byte) 0x60,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x73,(byte) 0x80,(byte) 0x6e,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0, -(byte) 0xe0,(byte) 0x0, -}; - -static final BitmapCharRec ch98 = new BitmapCharRec(10,17,-1,0,12,ch98data); - -/* char: 0x61 'a' */ - -static final byte[] ch97data = { -(byte) 0x71,(byte) 0x80,(byte) 0xfb,(byte) 0x0,(byte) 0xc7,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x3b,(byte) 0x0,(byte) 0xf,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x67,(byte) 0x0,(byte) 0x3e,(byte) 0x0, -}; - -static final BitmapCharRec ch97 = new BitmapCharRec(9,12,-1,0,11,ch97data); - -/* char: 0x60 '`' */ - -static final byte[] ch96data = { -(byte) 0x60,(byte) 0xe0,(byte) 0x80,(byte) 0xc0,(byte) 0x60, -}; - -static final BitmapCharRec ch96 = new BitmapCharRec(3,5,-2,-12,7,ch96data); - -/* char: 0x5f '_' */ - -static final byte[] ch95data = { -(byte) 0xff,(byte) 0xf8,(byte) 0xff,(byte) 0xf8, -}; - -static final BitmapCharRec ch95 = new BitmapCharRec(13,2,0,5,13,ch95data); - -/* char: 0x5e '^' */ - -static final byte[] ch94data = { -(byte) 0x80,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x41,(byte) 0x0,(byte) 0x63,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x36,(byte) 0x0,(byte) 0x14,(byte) 0x0,(byte) 0x1c,(byte) 0x0, -(byte) 0x8,(byte) 0x0, -}; - -static final BitmapCharRec ch94 = new BitmapCharRec(9,9,-1,-8,11,ch94data); - -/* char: 0x5d ']' */ - -static final byte[] ch93data = { -(byte) 0xf8,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18, -(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0xf8, -}; - -static final BitmapCharRec ch93 = new BitmapCharRec(5,21,-1,4,8,ch93data); - -/* char: 0x5c '\' */ - -static final byte[] ch92data = { -(byte) 0x6,(byte) 0x6,(byte) 0x4,(byte) 0xc,(byte) 0xc,(byte) 0x8,(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x30,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x40,(byte) 0xc0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch92 = new BitmapCharRec(7,17,0,0,7,ch92data); - -/* char: 0x5b '[' */ - -static final byte[] ch91data = { -(byte) 0xf8,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xf8, -}; - -static final BitmapCharRec ch91 = new BitmapCharRec(5,21,-2,4,8,ch91data); - -/* char: 0x5a 'Z' */ - -static final byte[] ch90data = { -(byte) 0xff,(byte) 0xf8,(byte) 0xe0,(byte) 0x18,(byte) 0x70,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x38,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0xe,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x1,(byte) 0xc0,(byte) 0x80,(byte) 0xc0,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0x70, -(byte) 0xff,(byte) 0xf0, -}; - -static final BitmapCharRec ch90 = new BitmapCharRec(13,17,-1,0,15,ch90data); - -/* char: 0x59 'Y' */ - -static final byte[] ch89data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3,(byte) 0xc0, -(byte) 0x3,(byte) 0x40,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x20,(byte) 0xc,(byte) 0x30,(byte) 0x1c,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0x38,(byte) 0x8,(byte) 0x30,(byte) 0xc, -(byte) 0xfc,(byte) 0x3f, -}; - -static final BitmapCharRec ch89 = new BitmapCharRec(16,17,0,0,16,ch89data); - -/* char: 0x58 'X' */ - -static final byte[] ch88data = { -(byte) 0xfc,(byte) 0xf,(byte) 0xc0,(byte) 0x30,(byte) 0x3,(byte) 0x80,(byte) 0x18,(byte) 0x7,(byte) 0x0,(byte) 0x8,(byte) 0xe,(byte) 0x0,(byte) 0x4,(byte) 0xc,(byte) 0x0,(byte) 0x6, -(byte) 0x18,(byte) 0x0,(byte) 0x2,(byte) 0x38,(byte) 0x0,(byte) 0x1,(byte) 0x70,(byte) 0x0,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0, -(byte) 0x0,(byte) 0x3,(byte) 0xa0,(byte) 0x0,(byte) 0x3,(byte) 0x10,(byte) 0x0,(byte) 0x6,(byte) 0x8,(byte) 0x0,(byte) 0xe,(byte) 0xc,(byte) 0x0,(byte) 0x1c,(byte) 0x6,(byte) 0x0, -(byte) 0x7e,(byte) 0xf,(byte) 0x80, -}; - -static final BitmapCharRec ch88 = new BitmapCharRec(18,17,0,0,18,ch88data); - -/* char: 0x57 'W' */ - -static final byte[] ch87data = { -(byte) 0x1,(byte) 0x83,(byte) 0x0,(byte) 0x1,(byte) 0x83,(byte) 0x0,(byte) 0x1,(byte) 0x83,(byte) 0x80,(byte) 0x3,(byte) 0x87,(byte) 0x80,(byte) 0x3,(byte) 0x46,(byte) 0x80,(byte) 0x3, -(byte) 0x46,(byte) 0xc0,(byte) 0x6,(byte) 0x46,(byte) 0x40,(byte) 0x6,(byte) 0x4c,(byte) 0x40,(byte) 0x6,(byte) 0x4c,(byte) 0x60,(byte) 0xc,(byte) 0x2c,(byte) 0x60,(byte) 0xc,(byte) 0x2c, -(byte) 0x20,(byte) 0x18,(byte) 0x2c,(byte) 0x20,(byte) 0x18,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x18,(byte) 0x18, -(byte) 0xfc,(byte) 0x7e,(byte) 0x7e, -}; - -static final BitmapCharRec ch87 = new BitmapCharRec(23,17,0,0,23,ch87data); - -/* char: 0x56 'V' */ - -static final byte[] ch86data = { -(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x0,(byte) 0x3,(byte) 0xc0,(byte) 0x0,(byte) 0x3,(byte) 0x40,(byte) 0x0,(byte) 0x3, -(byte) 0x60,(byte) 0x0,(byte) 0x6,(byte) 0x20,(byte) 0x0,(byte) 0x6,(byte) 0x20,(byte) 0x0,(byte) 0x6,(byte) 0x30,(byte) 0x0,(byte) 0xc,(byte) 0x10,(byte) 0x0,(byte) 0xc,(byte) 0x18, -(byte) 0x0,(byte) 0x18,(byte) 0x8,(byte) 0x0,(byte) 0x18,(byte) 0x8,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x30,(byte) 0x4,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0, -(byte) 0xfc,(byte) 0x1f,(byte) 0x80, -}; - -static final BitmapCharRec ch86 = new BitmapCharRec(17,17,0,0,17,ch86data); - -/* char: 0x55 'U' */ - -static final byte[] ch85data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x30,(byte) 0x18,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xfc,(byte) 0x1f, -}; - -static final BitmapCharRec ch85 = new BitmapCharRec(16,17,-1,0,18,ch85data); - -/* char: 0x54 'T' */ - -static final byte[] ch84data = { -(byte) 0xf,(byte) 0xc0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x83,(byte) 0x4,(byte) 0x83,(byte) 0x4,(byte) 0xc3,(byte) 0xc, -(byte) 0xff,(byte) 0xfc, -}; - -static final BitmapCharRec ch84 = new BitmapCharRec(14,17,-1,0,16,ch84data); - -/* char: 0x53 'S' */ - -static final byte[] ch83data = { -(byte) 0x9e,(byte) 0x0,(byte) 0xf1,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0x80,(byte) 0x60,(byte) 0x80,(byte) 0x60,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0xe0,(byte) 0x3,(byte) 0xc0, -(byte) 0xf,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0xe0,(byte) 0x0,(byte) 0xc0,(byte) 0x40,(byte) 0xc0,(byte) 0x40,(byte) 0xc0,(byte) 0xc0,(byte) 0x63,(byte) 0xc0, -(byte) 0x1e,(byte) 0x40, -}; - -static final BitmapCharRec ch83 = new BitmapCharRec(11,17,-1,0,13,ch83data); - -/* char: 0x52 'R' */ - -static final byte[] ch82data = { -(byte) 0xfc,(byte) 0x1e,(byte) 0x30,(byte) 0x1c,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0xc0,(byte) 0x31,(byte) 0xc0,(byte) 0x33,(byte) 0x80, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70, -(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch82 = new BitmapCharRec(15,17,-1,0,16,ch82data); - -/* char: 0x51 'Q' */ - -static final byte[] ch81data = { -(byte) 0x0,(byte) 0xf,(byte) 0x0,(byte) 0x38,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0xe0,(byte) 0x1,(byte) 0xc0,(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c, -(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38,(byte) 0x7,(byte) 0xe0, -}; - -static final BitmapCharRec ch81 = new BitmapCharRec(16,22,-1,5,18,ch81data); - -/* char: 0x50 'P' */ - -static final byte[] ch80data = { -(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70, -(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch80 = new BitmapCharRec(13,17,-1,0,15,ch80data); - -/* char: 0x4f 'O' */ - -static final byte[] ch79data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1c,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3, -(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0xc0,(byte) 0x3,(byte) 0x60,(byte) 0x6,(byte) 0x60,(byte) 0x6,(byte) 0x38,(byte) 0x1c,(byte) 0x1c,(byte) 0x38, -(byte) 0x7,(byte) 0xe0, -}; - -static final BitmapCharRec ch79 = new BitmapCharRec(16,17,-1,0,18,ch79data); - -/* char: 0x4e 'N' */ - -static final byte[] ch78data = { -(byte) 0xf8,(byte) 0xc,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x1c,(byte) 0x20,(byte) 0x34,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0x64,(byte) 0x20,(byte) 0xc4,(byte) 0x21,(byte) 0x84, -(byte) 0x21,(byte) 0x84,(byte) 0x23,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x26,(byte) 0x4,(byte) 0x2c,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x38,(byte) 0x4,(byte) 0x30,(byte) 0x4, -(byte) 0xf0,(byte) 0x1f, -}; - -static final BitmapCharRec ch78 = new BitmapCharRec(16,17,-1,0,18,ch78data); - -/* char: 0x4d 'M' */ - -static final byte[] ch77data = { -(byte) 0xf8,(byte) 0x21,(byte) 0xf8,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0xd0,(byte) 0x60,(byte) 0x20,(byte) 0xd0,(byte) 0x60,(byte) 0x21, -(byte) 0x88,(byte) 0x60,(byte) 0x21,(byte) 0x88,(byte) 0x60,(byte) 0x23,(byte) 0x8,(byte) 0x60,(byte) 0x23,(byte) 0x4,(byte) 0x60,(byte) 0x26,(byte) 0x4,(byte) 0x60,(byte) 0x26,(byte) 0x2, -(byte) 0x60,(byte) 0x2c,(byte) 0x2,(byte) 0x60,(byte) 0x2c,(byte) 0x2,(byte) 0x60,(byte) 0x38,(byte) 0x1,(byte) 0x60,(byte) 0x38,(byte) 0x1,(byte) 0x60,(byte) 0x30,(byte) 0x0,(byte) 0xe0, -(byte) 0xf0,(byte) 0x0,(byte) 0xf8, -}; - -static final BitmapCharRec ch77 = new BitmapCharRec(21,17,-1,0,22,ch77data); - -/* char: 0x4c 'L' */ - -static final byte[] ch76data = { -(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, -(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0, -(byte) 0xfc,(byte) 0x0, -}; - -static final BitmapCharRec ch76 = new BitmapCharRec(13,17,-1,0,14,ch76data); - -/* char: 0x4b 'K' */ - -static final byte[] ch75data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x30,(byte) 0xe,(byte) 0x30,(byte) 0x1c,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0xe0,(byte) 0x31,(byte) 0xc0,(byte) 0x33,(byte) 0x80, -(byte) 0x3f,(byte) 0x0,(byte) 0x3e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x31,(byte) 0x80,(byte) 0x30,(byte) 0xc0,(byte) 0x30,(byte) 0x60,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18, -(byte) 0xfc,(byte) 0x7e, -}; - -static final BitmapCharRec ch75 = new BitmapCharRec(16,17,-1,0,17,ch75data); - -/* char: 0x4a 'J' */ - -static final byte[] ch74data = { -(byte) 0x78,(byte) 0x0,(byte) 0xcc,(byte) 0x0,(byte) 0xc6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0x1f,(byte) 0x80, -}; - -static final BitmapCharRec ch74 = new BitmapCharRec(9,17,-1,0,11,ch74data); - -/* char: 0x49 'I' */ - -static final byte[] ch73data = { -(byte) 0xfc,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30, -(byte) 0xfc, -}; - -static final BitmapCharRec ch73 = new BitmapCharRec(6,17,-1,0,8,ch73data); - -/* char: 0x48 'H' */ - -static final byte[] ch72data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30, -(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x3f,(byte) 0xfe,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6, -(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x30,(byte) 0x6,(byte) 0x0, -(byte) 0xfc,(byte) 0x1f,(byte) 0x80, -}; - -static final BitmapCharRec ch72 = new BitmapCharRec(17,17,-1,0,19,ch72data); - -/* char: 0x47 'G' */ - -static final byte[] ch71data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1e,(byte) 0x38,(byte) 0x38,(byte) 0x1c,(byte) 0x60,(byte) 0xc,(byte) 0x60,(byte) 0xc,(byte) 0xc0,(byte) 0xc,(byte) 0xc0,(byte) 0xc,(byte) 0xc0,(byte) 0x3f, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x4,(byte) 0x38,(byte) 0xc,(byte) 0x1c,(byte) 0x3c, -(byte) 0x7,(byte) 0xe4, -}; - -static final BitmapCharRec ch71 = new BitmapCharRec(16,17,-1,0,18,ch71data); - -/* char: 0x46 'F' */ - -static final byte[] ch70data = { -(byte) 0xfc,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x20,(byte) 0x30,(byte) 0x20, -(byte) 0x3f,(byte) 0xe0,(byte) 0x30,(byte) 0x20,(byte) 0x30,(byte) 0x20,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, -(byte) 0xff,(byte) 0xf0, -}; - -static final BitmapCharRec ch70 = new BitmapCharRec(12,17,-1,0,14,ch70data); - -/* char: 0x45 'E' */ - -static final byte[] ch69data = { -(byte) 0xff,(byte) 0xf8,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x8,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40, -(byte) 0x3f,(byte) 0xc0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x10,(byte) 0x30,(byte) 0x30, -(byte) 0xff,(byte) 0xf0, -}; - -static final BitmapCharRec ch69 = new BitmapCharRec(13,17,-1,0,15,ch69data); - -/* char: 0x44 'D' */ - -static final byte[] ch68data = { -(byte) 0xff,(byte) 0xc0,(byte) 0x30,(byte) 0x70,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6, -(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0x6,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0x38,(byte) 0x30,(byte) 0x70, -(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch68 = new BitmapCharRec(15,17,-1,0,17,ch68data); - -/* char: 0x43 'C' */ - -static final byte[] ch67data = { -(byte) 0x7,(byte) 0xe0,(byte) 0x1e,(byte) 0x38,(byte) 0x38,(byte) 0x8,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x4,(byte) 0x60,(byte) 0x4,(byte) 0x38,(byte) 0xc,(byte) 0x1c,(byte) 0x3c, -(byte) 0x7,(byte) 0xe4, -}; - -static final BitmapCharRec ch67 = new BitmapCharRec(14,17,-1,0,16,ch67data); - -/* char: 0x42 'B' */ - -static final byte[] ch66data = { -(byte) 0xff,(byte) 0xe0,(byte) 0x30,(byte) 0x78,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0xc,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x38, -(byte) 0x3f,(byte) 0xe0,(byte) 0x30,(byte) 0x40,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x18,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x70, -(byte) 0xff,(byte) 0xc0, -}; - -static final BitmapCharRec ch66 = new BitmapCharRec(14,17,-1,0,16,ch66data); - -/* char: 0x41 'A' */ - -static final byte[] ch65data = { -(byte) 0xfc,(byte) 0x1f,(byte) 0x80,(byte) 0x30,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0x6,(byte) 0x0,(byte) 0x10,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0xc,(byte) 0x0,(byte) 0x8, -(byte) 0xc,(byte) 0x0,(byte) 0xf,(byte) 0xf8,(byte) 0x0,(byte) 0xc,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x18,(byte) 0x0,(byte) 0x4,(byte) 0x30,(byte) 0x0,(byte) 0x6,(byte) 0x30, -(byte) 0x0,(byte) 0x2,(byte) 0x30,(byte) 0x0,(byte) 0x2,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0x60,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0, -(byte) 0x0,(byte) 0x80,(byte) 0x0, -}; - -static final BitmapCharRec ch65 = new BitmapCharRec(17,17,0,0,17,ch65data); - -/* char: 0x40 '@' */ - -static final byte[] ch64data = { -(byte) 0x3,(byte) 0xf0,(byte) 0x0,(byte) 0xe,(byte) 0xc,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x61,(byte) 0xde,(byte) 0x0,(byte) 0x63, -(byte) 0x7b,(byte) 0x0,(byte) 0xc6,(byte) 0x39,(byte) 0x80,(byte) 0xc6,(byte) 0x18,(byte) 0x80,(byte) 0xc6,(byte) 0x18,(byte) 0xc0,(byte) 0xc6,(byte) 0x18,(byte) 0x40,(byte) 0xc6,(byte) 0xc, -(byte) 0x40,(byte) 0xc3,(byte) 0xc,(byte) 0x40,(byte) 0xc3,(byte) 0x8c,(byte) 0x40,(byte) 0xe1,(byte) 0xfc,(byte) 0x40,(byte) 0x60,(byte) 0xec,(byte) 0xc0,(byte) 0x70,(byte) 0x0,(byte) 0x80, -(byte) 0x38,(byte) 0x1,(byte) 0x80,(byte) 0x1c,(byte) 0x3,(byte) 0x0,(byte) 0xf,(byte) 0xe,(byte) 0x0,(byte) 0x3,(byte) 0xf8,(byte) 0x0, -}; - -static final BitmapCharRec ch64 = new BitmapCharRec(18,20,-2,3,22,ch64data); - -/* char: 0x3f '?' */ - -static final byte[] ch63data = { -(byte) 0x30,(byte) 0x30,(byte) 0x0,(byte) 0x0,(byte) 0x10,(byte) 0x10,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xe,(byte) 0x7,(byte) 0xc3,(byte) 0xc3,(byte) 0x83,(byte) 0xc6, -(byte) 0x7c, -}; - -static final BitmapCharRec ch63 = new BitmapCharRec(8,17,-2,0,11,ch63data); - -/* char: 0x3e '>' */ - -static final byte[] ch62data = { -(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x60,(byte) 0x1,(byte) 0xc0,(byte) 0x7,(byte) 0x0, -(byte) 0x1c,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0xc0,(byte) 0x0, -}; - -static final BitmapCharRec ch62 = new BitmapCharRec(11,11,-1,-1,13,ch62data); - -/* char: 0x3d '=' */ - -static final byte[] ch61data = { -(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0, -}; - -static final BitmapCharRec ch61 = new BitmapCharRec(12,6,-1,-4,14,ch61data); - -/* char: 0x3c '<' */ - -static final byte[] ch60data = { -(byte) 0x0,(byte) 0x60,(byte) 0x1,(byte) 0xc0,(byte) 0x7,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x1c,(byte) 0x0, -(byte) 0x7,(byte) 0x0,(byte) 0x1,(byte) 0xc0,(byte) 0x0,(byte) 0x60, -}; - -static final BitmapCharRec ch60 = new BitmapCharRec(11,11,-1,-1,13,ch60data); - -/* char: 0x3b ';' */ - -static final byte[] ch59data = { -(byte) 0xc0,(byte) 0x60,(byte) 0x20,(byte) 0xe0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch59 = new BitmapCharRec(3,14,-2,3,7,ch59data); - -/* char: 0x3a ':' */ - -static final byte[] ch58data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch58 = new BitmapCharRec(2,11,-2,0,6,ch58data); - -/* char: 0x39 '9' */ - -static final byte[] ch57data = { -(byte) 0xf0,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1d,(byte) 0x80,(byte) 0x73,(byte) 0xc0, -(byte) 0x61,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x77,(byte) 0x80, -(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch57 = new BitmapCharRec(10,17,-1,0,12,ch57data); - -/* char: 0x38 '8' */ - -static final byte[] ch56data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x73,(byte) 0x80,(byte) 0xe1,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x41,(byte) 0xc0,(byte) 0x61,(byte) 0x80, -(byte) 0x37,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, -(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch56 = new BitmapCharRec(10,17,-1,0,12,ch56data); - -/* char: 0x37 '7' */ - -static final byte[] ch55data = { -(byte) 0x18,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0x2,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x81,(byte) 0x80,(byte) 0xc0,(byte) 0xc0,(byte) 0xff,(byte) 0xc0, -(byte) 0x7f,(byte) 0xc0, -}; - -static final BitmapCharRec ch55 = new BitmapCharRec(10,17,-1,0,12,ch55data); - -/* char: 0x36 '6' */ - -static final byte[] ch54data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x7b,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc1,(byte) 0x80,(byte) 0xf3,(byte) 0x80,(byte) 0xee,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x70,(byte) 0x0,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xe,(byte) 0x0, -(byte) 0x3,(byte) 0xc0, -}; - -static final BitmapCharRec ch54 = new BitmapCharRec(10,17,-1,0,12,ch54data); - -/* char: 0x35 '5' */ - -static final byte[] ch53data = { -(byte) 0x7e,(byte) 0x0,(byte) 0xe3,(byte) 0x80,(byte) 0xc1,(byte) 0x80,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x0,(byte) 0xc0,(byte) 0x1,(byte) 0xc0, -(byte) 0x3,(byte) 0x80,(byte) 0xf,(byte) 0x80,(byte) 0x7e,(byte) 0x0,(byte) 0x78,(byte) 0x0,(byte) 0x60,(byte) 0x0,(byte) 0x20,(byte) 0x0,(byte) 0x20,(byte) 0x0,(byte) 0x1f,(byte) 0x80, -(byte) 0x1f,(byte) 0xc0, -}; - -static final BitmapCharRec ch53 = new BitmapCharRec(10,17,-1,0,12,ch53data); - -/* char: 0x34 '4' */ - -static final byte[] ch52data = { -(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0xc3,(byte) 0x0,(byte) 0x43,(byte) 0x0, -(byte) 0x63,(byte) 0x0,(byte) 0x23,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x13,(byte) 0x0,(byte) 0x1b,(byte) 0x0,(byte) 0xb,(byte) 0x0,(byte) 0x7,(byte) 0x0,(byte) 0x7,(byte) 0x0, -(byte) 0x3,(byte) 0x0, -}; - -static final BitmapCharRec ch52 = new BitmapCharRec(10,17,-1,0,12,ch52data); - -/* char: 0x33 '3' */ - -static final byte[] ch51data = { -(byte) 0x78,(byte) 0x0,(byte) 0xe6,(byte) 0x0,(byte) 0xc3,(byte) 0x0,(byte) 0x1,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x3,(byte) 0x80, -(byte) 0x7,(byte) 0x0,(byte) 0x1e,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x83,(byte) 0x0,(byte) 0x83,(byte) 0x0,(byte) 0x47,(byte) 0x0,(byte) 0x7e,(byte) 0x0, -(byte) 0x1c,(byte) 0x0, -}; - -static final BitmapCharRec ch51 = new BitmapCharRec(9,17,-1,0,12,ch51data); - -/* char: 0x32 '2' */ - -static final byte[] ch50data = { -(byte) 0xff,(byte) 0x80,(byte) 0xff,(byte) 0xc0,(byte) 0x60,(byte) 0x40,(byte) 0x30,(byte) 0x0,(byte) 0x18,(byte) 0x0,(byte) 0xc,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x6,(byte) 0x0, -(byte) 0x3,(byte) 0x0,(byte) 0x3,(byte) 0x0,(byte) 0x1,(byte) 0x80,(byte) 0x1,(byte) 0x80,(byte) 0x81,(byte) 0x80,(byte) 0x81,(byte) 0x80,(byte) 0x43,(byte) 0x80,(byte) 0x7f,(byte) 0x0, -(byte) 0x1c,(byte) 0x0, -}; - -static final BitmapCharRec ch50 = new BitmapCharRec(10,17,-1,0,12,ch50data); - -/* char: 0x31 '1' */ - -static final byte[] ch49data = { -(byte) 0xff,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x18,(byte) 0x78,(byte) 0x18, -(byte) 0x8, -}; - -static final BitmapCharRec ch49 = new BitmapCharRec(8,17,-2,0,12,ch49data); - -/* char: 0x30 '0' */ - -static final byte[] ch48data = { -(byte) 0x1e,(byte) 0x0,(byte) 0x33,(byte) 0x0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0xe1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x61,(byte) 0x80,(byte) 0x61,(byte) 0x80,(byte) 0x33,(byte) 0x0, -(byte) 0x1e,(byte) 0x0, -}; - -static final BitmapCharRec ch48 = new BitmapCharRec(10,17,-1,0,12,ch48data); - -/* char: 0x2f '/' */ - -static final byte[] ch47data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60,(byte) 0x60,(byte) 0x20,(byte) 0x30,(byte) 0x30,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0x8,(byte) 0xc,(byte) 0xc,(byte) 0x4,(byte) 0x6, -(byte) 0x6,(byte) 0x3,(byte) 0x3,(byte) 0x3, -}; - -static final BitmapCharRec ch47 = new BitmapCharRec(8,20,1,3,7,ch47data); - -/* char: 0x2e '.' */ - -static final byte[] ch46data = { -(byte) 0xc0,(byte) 0xc0, -}; - -static final BitmapCharRec ch46 = new BitmapCharRec(2,2,-2,0,6,ch46data); - -/* char: 0x2d '-' */ - -static final byte[] ch45data = { -(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0, -}; - -static final BitmapCharRec ch45 = new BitmapCharRec(12,2,-1,-6,14,ch45data); - -/* char: 0x2c ',' */ - -static final byte[] ch44data = { -(byte) 0xc0,(byte) 0x60,(byte) 0x20,(byte) 0xe0,(byte) 0xc0, -}; - -static final BitmapCharRec ch44 = new BitmapCharRec(3,5,-2,3,7,ch44data); - -/* char: 0x2b '+' */ - -static final byte[] ch43data = { -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0xff,(byte) 0xf0,(byte) 0xff,(byte) 0xf0,(byte) 0x6,(byte) 0x0, -(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0,(byte) 0x6,(byte) 0x0, -}; - -static final BitmapCharRec ch43 = new BitmapCharRec(12,12,-1,-1,14,ch43data); - -/* char: 0x2a '*' */ - -static final byte[] ch42data = { -(byte) 0x8,(byte) 0x0,(byte) 0x1c,(byte) 0x0,(byte) 0xc9,(byte) 0x80,(byte) 0xeb,(byte) 0x80,(byte) 0x1c,(byte) 0x0,(byte) 0xeb,(byte) 0x80,(byte) 0xc9,(byte) 0x80,(byte) 0x1c,(byte) 0x0, -(byte) 0x8,(byte) 0x0, -}; - -static final BitmapCharRec ch42 = new BitmapCharRec(9,9,-2,-8,12,ch42data); - -/* char: 0x29 ')' */ - -static final byte[] ch41data = { -(byte) 0x80,(byte) 0x40,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x18,(byte) 0x18,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0xc,(byte) 0x18, -(byte) 0x18,(byte) 0x10,(byte) 0x30,(byte) 0x20,(byte) 0x40,(byte) 0x80, -}; - -static final BitmapCharRec ch41 = new BitmapCharRec(6,22,-1,5,8,ch41data); - -/* char: 0x28 '(' */ - -static final byte[] ch40data = { -(byte) 0x4,(byte) 0x8,(byte) 0x10,(byte) 0x30,(byte) 0x20,(byte) 0x60,(byte) 0x60,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0x60, -(byte) 0x60,(byte) 0x20,(byte) 0x30,(byte) 0x10,(byte) 0x8,(byte) 0x4, -}; - -static final BitmapCharRec ch40 = new BitmapCharRec(6,22,-1,5,8,ch40data); - -/* char: 0x27 ''' */ - -static final byte[] ch39data = { -(byte) 0xc0,(byte) 0x60,(byte) 0x20,(byte) 0xe0,(byte) 0xc0, -}; - -static final BitmapCharRec ch39 = new BitmapCharRec(3,5,-3,-12,8,ch39data); - -/* char: 0x26 '&' */ - -static final byte[] ch38data = { -(byte) 0x3c,(byte) 0x3c,(byte) 0x7f,(byte) 0x7e,(byte) 0xe1,(byte) 0xe1,(byte) 0xc0,(byte) 0xc0,(byte) 0xc1,(byte) 0xc0,(byte) 0xc1,(byte) 0xa0,(byte) 0x63,(byte) 0x20,(byte) 0x37,(byte) 0x10, -(byte) 0x1e,(byte) 0x18,(byte) 0xe,(byte) 0x3e,(byte) 0xf,(byte) 0x0,(byte) 0x1d,(byte) 0x80,(byte) 0x18,(byte) 0xc0,(byte) 0x18,(byte) 0x40,(byte) 0x18,(byte) 0x40,(byte) 0xc,(byte) 0xc0, -(byte) 0x7,(byte) 0x80, -}; - -static final BitmapCharRec ch38 = new BitmapCharRec(16,17,-1,0,18,ch38data); - -/* char: 0x25 '%' */ - -static final byte[] ch37data = { -(byte) 0x30,(byte) 0x3c,(byte) 0x0,(byte) 0x18,(byte) 0x72,(byte) 0x0,(byte) 0xc,(byte) 0x61,(byte) 0x0,(byte) 0x4,(byte) 0x60,(byte) 0x80,(byte) 0x6,(byte) 0x60,(byte) 0x80,(byte) 0x3, -(byte) 0x30,(byte) 0x80,(byte) 0x1,(byte) 0x19,(byte) 0x80,(byte) 0x1,(byte) 0x8f,(byte) 0x0,(byte) 0x78,(byte) 0xc0,(byte) 0x0,(byte) 0xe4,(byte) 0x40,(byte) 0x0,(byte) 0xc2,(byte) 0x60, -(byte) 0x0,(byte) 0xc1,(byte) 0x30,(byte) 0x0,(byte) 0xc1,(byte) 0x10,(byte) 0x0,(byte) 0x61,(byte) 0x18,(byte) 0x0,(byte) 0x33,(byte) 0xfc,(byte) 0x0,(byte) 0x1e,(byte) 0xc,(byte) 0x0, -}; - -static final BitmapCharRec ch37 = new BitmapCharRec(17,16,-1,0,19,ch37data); - -/* char: 0x24 '$' */ - -static final byte[] ch36data = { -(byte) 0x4,(byte) 0x0,(byte) 0x4,(byte) 0x0,(byte) 0x3f,(byte) 0x0,(byte) 0xe5,(byte) 0xc0,(byte) 0xc4,(byte) 0xc0,(byte) 0x84,(byte) 0x60,(byte) 0x84,(byte) 0x60,(byte) 0x4,(byte) 0x60, -(byte) 0x4,(byte) 0xe0,(byte) 0x7,(byte) 0xc0,(byte) 0x7,(byte) 0x80,(byte) 0x1e,(byte) 0x0,(byte) 0x3c,(byte) 0x0,(byte) 0x74,(byte) 0x0,(byte) 0x64,(byte) 0x0,(byte) 0x64,(byte) 0x20, -(byte) 0x64,(byte) 0x60,(byte) 0x34,(byte) 0xe0,(byte) 0x1f,(byte) 0x80,(byte) 0x4,(byte) 0x0,(byte) 0x4,(byte) 0x0, -}; - -static final BitmapCharRec ch36 = new BitmapCharRec(11,21,0,2,12,ch36data); - -/* char: 0x23 '#' */ - -static final byte[] ch35data = { -(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0x22,(byte) 0x0,(byte) 0xff,(byte) 0xc0,(byte) 0xff,(byte) 0xc0,(byte) 0x11,(byte) 0x0, -(byte) 0x11,(byte) 0x0,(byte) 0x11,(byte) 0x0,(byte) 0x7f,(byte) 0xe0,(byte) 0x7f,(byte) 0xe0,(byte) 0x8,(byte) 0x80,(byte) 0x8,(byte) 0x80,(byte) 0x8,(byte) 0x80,(byte) 0x8,(byte) 0x80, -(byte) 0x8,(byte) 0x80, -}; - -static final BitmapCharRec ch35 = new BitmapCharRec(11,17,-1,0,13,ch35data); - -/* char: 0x22 '"' */ - -static final byte[] ch34data = { -(byte) 0x88,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc,(byte) 0xcc, -}; - -static final BitmapCharRec ch34 = new BitmapCharRec(6,5,-1,-12,10,ch34data); - -/* char: 0x21 '!' */ - -static final byte[] ch33data = { -(byte) 0xc0,(byte) 0xc0,(byte) 0x0,(byte) 0x0,(byte) 0x0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0,(byte) 0xc0, -(byte) 0xc0, -}; - -static final BitmapCharRec ch33 = new BitmapCharRec(2,17,-3,0,8,ch33data); - -/* char: 0x20 ' ' */ - -static final BitmapCharRec ch32 = new BitmapCharRec(0,0,0,0,6,null); - -static final BitmapCharRec[] chars = { -ch32, -ch33, -ch34, -ch35, -ch36, -ch37, -ch38, -ch39, -ch40, -ch41, -ch42, -ch43, -ch44, -ch45, -ch46, -ch47, -ch48, -ch49, -ch50, -ch51, -ch52, -ch53, -ch54, -ch55, -ch56, -ch57, -ch58, -ch59, -ch60, -ch61, -ch62, -ch63, -ch64, -ch65, -ch66, -ch67, -ch68, -ch69, -ch70, -ch71, -ch72, -ch73, -ch74, -ch75, -ch76, -ch77, -ch78, -ch79, -ch80, -ch81, -ch82, -ch83, -ch84, -ch85, -ch86, -ch87, -ch88, -ch89, -ch90, -ch91, -ch92, -ch93, -ch94, -ch95, -ch96, -ch97, -ch98, -ch99, -ch100, -ch101, -ch102, -ch103, -ch104, -ch105, -ch106, -ch107, -ch108, -ch109, -ch110, -ch111, -ch112, -ch113, -ch114, -ch115, -ch116, -ch117, -ch118, -ch119, -ch120, -ch121, -ch122, -ch123, -ch124, -ch125, -ch126, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -null, -ch160, -ch161, -ch162, -ch163, -ch164, -ch165, -ch166, -ch167, -ch168, -ch169, -ch170, -ch171, -ch172, -ch173, -ch174, -ch175, -ch176, -ch177, -ch178, -ch179, -ch180, -ch181, -ch182, -ch183, -ch184, -ch185, -ch186, -ch187, -ch188, -ch189, -ch190, -ch191, -ch192, -ch193, -ch194, -ch195, -ch196, -ch197, -ch198, -ch199, -ch200, -ch201, -ch202, -ch203, -ch204, -ch205, -ch206, -ch207, -ch208, -ch209, -ch210, -ch211, -ch212, -ch213, -ch214, -ch215, -ch216, -ch217, -ch218, -ch219, -ch220, -ch221, -ch222, -ch223, -ch224, -ch225, -ch226, -ch227, -ch228, -ch229, -ch230, -ch231, -ch232, -ch233, -ch234, -ch235, -ch236, -ch237, -ch238, -ch239, -ch240, -ch241, -ch242, -ch243, -ch244, -ch245, -ch246, -ch247, -ch248, -ch249, -ch250, -ch251, -ch252, -ch253, -ch254, -ch255, -}; - - static final BitmapFontRec glutBitmapTimesRoman24 = new BitmapFontRec("-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", - 224, - 32, - chars); -} diff --git a/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java b/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java deleted file mode 100644 index f5d2ebcff..000000000 --- a/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java +++ /dev/null @@ -1,2491 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTStrokeMonoRoman { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 33 '!' */ - -static final CoordRec char33_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 33.3333 ), -}; - -static final CoordRec char33_stroke1[] = { - new CoordRec((float) 52.381, (float) 9.5238 ), - new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 9.5238 ), -}; - -static final StrokeRec char33[] = { - new StrokeRec( 2, char33_stroke0 ), - new StrokeRec( 5, char33_stroke1 ), -}; - -/* char: 34 '"' */ - -static final CoordRec char34_stroke0[] = { - new CoordRec((float) 33.3334, (float) 100 ), - new CoordRec((float) 33.3334, (float) 66.6667 ), -}; - -static final CoordRec char34_stroke1[] = { - new CoordRec((float) 71.4286, (float) 100 ), - new CoordRec((float) 71.4286, (float) 66.6667 ), -}; - -static final StrokeRec char34[] = { - new StrokeRec( 2, char34_stroke0 ), - new StrokeRec( 2, char34_stroke1 ), -}; - -/* char: 35 '#' */ - -static final CoordRec char35_stroke0[] = { - new CoordRec((float) 54.7619, (float) 119.048 ), - new CoordRec((float) 21.4286, (float) -33.3333 ), -}; - -static final CoordRec char35_stroke1[] = { - new CoordRec((float) 83.3334, (float) 119.048 ), - new CoordRec((float) 50, (float) -33.3333 ), -}; - -static final CoordRec char35_stroke2[] = { - new CoordRec((float) 21.4286, (float) 57.1429 ), - new CoordRec((float) 88.0952, (float) 57.1429 ), -}; - -static final CoordRec char35_stroke3[] = { - new CoordRec((float) 16.6667, (float) 28.5714 ), - new CoordRec((float) 83.3334, (float) 28.5714 ), -}; - -static final StrokeRec char35[] = { - new StrokeRec( 2, char35_stroke0 ), - new StrokeRec( 2, char35_stroke1 ), - new StrokeRec( 2, char35_stroke2 ), - new StrokeRec( 2, char35_stroke3 ), -}; - -/* char: 36 '$' */ - -static final CoordRec char36_stroke0[] = { - new CoordRec((float) 42.8571, (float) 119.048 ), - new CoordRec((float) 42.8571, (float) -19.0476 ), -}; - -static final CoordRec char36_stroke1[] = { - new CoordRec((float) 61.9047, (float) 119.048 ), - new CoordRec((float) 61.9047, (float) -19.0476 ), -}; - -static final CoordRec char36_stroke2[] = { - new CoordRec((float) 85.7143, (float) 85.7143 ), - new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 28.5714, (float) 95.2381 ), - new CoordRec((float) 19.0476, (float) 85.7143 ), - new CoordRec((float) 19.0476, (float) 76.1905 ), - new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 28.5714, (float) 61.9048 ), - new CoordRec((float) 38.0952, (float) 57.1429 ), - new CoordRec((float) 66.6666, (float) 47.619 ), - new CoordRec((float) 76.1905, (float) 42.8571 ), - new CoordRec((float) 80.9524, (float) 38.0952 ), - new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 85.7143, (float) 14.2857 ), - new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 28.5714, (float) 4.7619 ), - new CoordRec((float) 19.0476, (float) 14.2857 ), -}; - -static final StrokeRec char36[] = { - new StrokeRec( 2, char36_stroke0 ), - new StrokeRec( 2, char36_stroke1 ), - new StrokeRec( 20, char36_stroke2 ), -}; - -/* char: 37 '%' */ - -static final CoordRec char37_stroke0[] = { - new CoordRec((float) 95.2381, (float) 100 ), - new CoordRec((float) 9.5238, (float) 0 ), -}; - -static final CoordRec char37_stroke1[] = { - new CoordRec((float) 33.3333, (float) 100 ), - new CoordRec((float) 42.8571, (float) 90.4762 ), - new CoordRec((float) 42.8571, (float) 80.9524 ), - new CoordRec((float) 38.0952, (float) 71.4286 ), - new CoordRec((float) 28.5714, (float) 66.6667 ), - new CoordRec((float) 19.0476, (float) 66.6667 ), - new CoordRec((float) 9.5238, (float) 76.1905 ), - new CoordRec((float) 9.5238, (float) 85.7143 ), - new CoordRec((float) 14.2857, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 33.3333, (float) 100 ), - new CoordRec((float) 42.8571, (float) 95.2381 ), - new CoordRec((float) 57.1428, (float) 90.4762 ), - new CoordRec((float) 71.4286, (float) 90.4762 ), - new CoordRec((float) 85.7143, (float) 95.2381 ), - new CoordRec((float) 95.2381, (float) 100 ), -}; - -static final CoordRec char37_stroke2[] = { - new CoordRec((float) 76.1905, (float) 33.3333 ), - new CoordRec((float) 66.6667, (float) 28.5714 ), - new CoordRec((float) 61.9048, (float) 19.0476 ), - new CoordRec((float) 61.9048, (float) 9.5238 ), - new CoordRec((float) 71.4286, (float) 0 ), - new CoordRec((float) 80.9524, (float) 0 ), - new CoordRec((float) 90.4762, (float) 4.7619 ), - new CoordRec((float) 95.2381, (float) 14.2857 ), - new CoordRec((float) 95.2381, (float) 23.8095 ), - new CoordRec((float) 85.7143, (float) 33.3333 ), - new CoordRec((float) 76.1905, (float) 33.3333 ), -}; - -static final StrokeRec char37[] = { - new StrokeRec( 2, char37_stroke0 ), - new StrokeRec( 16, char37_stroke1 ), - new StrokeRec( 11, char37_stroke2 ), -}; - -/* char: 38 '&' */ - -static final CoordRec char38_stroke0[] = { - new CoordRec((float) 100, (float) 57.1429 ), - new CoordRec((float) 100, (float) 61.9048 ), - new CoordRec((float) 95.2381, (float) 66.6667 ), - new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 85.7143, (float) 61.9048 ), - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4286, (float) 28.5714 ), - new CoordRec((float) 61.9048, (float) 14.2857 ), - new CoordRec((float) 52.3809, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 23.8095, (float) 0 ), - new CoordRec((float) 14.2857, (float) 4.7619 ), - new CoordRec((float) 9.5238, (float) 9.5238 ), - new CoordRec((float) 4.7619, (float) 19.0476 ), - new CoordRec((float) 4.7619, (float) 28.5714 ), - new CoordRec((float) 9.5238, (float) 38.0952 ), - new CoordRec((float) 14.2857, (float) 42.8571 ), - new CoordRec((float) 47.619, (float) 61.9048 ), - new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 57.1429, (float) 76.1905 ), - new CoordRec((float) 57.1429, (float) 85.7143 ), - new CoordRec((float) 52.3809, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 28.5714, (float) 85.7143 ), - new CoordRec((float) 28.5714, (float) 76.1905 ), - new CoordRec((float) 33.3333, (float) 61.9048 ), - new CoordRec((float) 42.8571, (float) 47.619 ), - new CoordRec((float) 66.6667, (float) 14.2857 ), - new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 85.7143, (float) 0 ), - new CoordRec((float) 95.2381, (float) 0 ), - new CoordRec((float) 100, (float) 4.7619 ), - new CoordRec((float) 100, (float) 9.5238 ), -}; - -static final StrokeRec char38[] = { - new StrokeRec( 34, char38_stroke0 ), -}; - -/* char: 39 ''' */ - -static final CoordRec char39_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 66.6667 ), -}; - -static final StrokeRec char39[] = { - new StrokeRec( 2, char39_stroke0 ), -}; - -/* char: 40 '(' */ - -static final CoordRec char40_stroke0[] = { - new CoordRec((float) 69.0476, (float) 119.048 ), - new CoordRec((float) 59.5238, (float) 109.524 ), - new CoordRec((float) 50, (float) 95.2381 ), - new CoordRec((float) 40.4762, (float) 76.1905 ), - new CoordRec((float) 35.7143, (float) 52.381 ), - new CoordRec((float) 35.7143, (float) 33.3333 ), - new CoordRec((float) 40.4762, (float) 9.5238 ), - new CoordRec((float) 50, (float) -9.5238 ), - new CoordRec((float) 59.5238, (float) -23.8095 ), - new CoordRec((float) 69.0476, (float) -33.3333 ), -}; - -static final StrokeRec char40[] = { - new StrokeRec( 10, char40_stroke0 ), -}; - -/* char: 41 ')' */ - -static final CoordRec char41_stroke0[] = { - new CoordRec((float) 35.7143, (float) 119.048 ), - new CoordRec((float) 45.2381, (float) 109.524 ), - new CoordRec((float) 54.7619, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 76.1905 ), - new CoordRec((float) 69.0476, (float) 52.381 ), - new CoordRec((float) 69.0476, (float) 33.3333 ), - new CoordRec((float) 64.2857, (float) 9.5238 ), - new CoordRec((float) 54.7619, (float) -9.5238 ), - new CoordRec((float) 45.2381, (float) -23.8095 ), - new CoordRec((float) 35.7143, (float) -33.3333 ), -}; - -static final StrokeRec char41[] = { - new StrokeRec( 10, char41_stroke0 ), -}; - -/* char: 42 '*' */ - -static final CoordRec char42_stroke0[] = { - new CoordRec((float) 52.381, (float) 71.4286 ), - new CoordRec((float) 52.381, (float) 14.2857 ), -}; - -static final CoordRec char42_stroke1[] = { - new CoordRec((float) 28.5715, (float) 57.1429 ), - new CoordRec((float) 76.1905, (float) 28.5714 ), -}; - -static final CoordRec char42_stroke2[] = { - new CoordRec((float) 76.1905, (float) 57.1429 ), - new CoordRec((float) 28.5715, (float) 28.5714 ), -}; - -static final StrokeRec char42[] = { - new StrokeRec( 2, char42_stroke0 ), - new StrokeRec( 2, char42_stroke1 ), - new StrokeRec( 2, char42_stroke2 ), -}; - -/* char: 43 '+' */ - -static final CoordRec char43_stroke0[] = { - new CoordRec((float) 52.3809, (float) 85.7143 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char43_stroke1[] = { - new CoordRec((float) 9.5238, (float) 42.8571 ), - new CoordRec((float) 95.2381, (float) 42.8571 ), -}; - -static final StrokeRec char43[] = { - new StrokeRec( 2, char43_stroke0 ), - new StrokeRec( 2, char43_stroke1 ), -}; - -/* char: 44 ',' */ - -static final CoordRec char44_stroke0[] = { - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), - new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 9.5238 ), - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 57.1429, (float) -4.7619 ), - new CoordRec((float) 52.381, (float) -14.2857 ), - new CoordRec((float) 47.6191, (float) -19.0476 ), -}; - -static final StrokeRec char44[] = { - new StrokeRec( 8, char44_stroke0 ), -}; - -/* char: 45 '-' */ - -static final CoordRec char45_stroke0[] = { - new CoordRec((float) 9.5238, (float) 42.8571 ), - new CoordRec((float) 95.2381, (float) 42.8571 ), -}; - -static final StrokeRec char45[] = { - new StrokeRec( 2, char45_stroke0 ), -}; - -/* char: 46 '.' */ - -static final CoordRec char46_stroke0[] = { - new CoordRec((float) 52.381, (float) 9.5238 ), - new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 9.5238 ), -}; - -static final StrokeRec char46[] = { - new StrokeRec( 5, char46_stroke0 ), -}; - -/* char: 47 '/' */ - -static final CoordRec char47_stroke0[] = { - new CoordRec((float) 19.0476, (float) -14.2857 ), - new CoordRec((float) 85.7143, (float) 100 ), -}; - -static final StrokeRec char47[] = { - new StrokeRec( 2, char47_stroke0 ), -}; - -/* char: 48 '0' */ - -static final CoordRec char48_stroke0[] = { - new CoordRec((float) 47.619, (float) 100 ), - new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 80.9524 ), - new CoordRec((float) 19.0476, (float) 57.1429 ), - new CoordRec((float) 19.0476, (float) 42.8571 ), - new CoordRec((float) 23.8095, (float) 19.0476 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 19.0476 ), - new CoordRec((float) 85.7143, (float) 42.8571 ), - new CoordRec((float) 85.7143, (float) 57.1429 ), - new CoordRec((float) 80.9524, (float) 80.9524 ), - new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 57.1428, (float) 100 ), - new CoordRec((float) 47.619, (float) 100 ), -}; - -static final StrokeRec char48[] = { - new StrokeRec( 17, char48_stroke0 ), -}; - -/* char: 49 '1' */ - -static final CoordRec char49_stroke0[] = { - new CoordRec((float) 40.4762, (float) 80.9524 ), - new CoordRec((float) 50, (float) 85.7143 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 64.2857, (float) 0 ), -}; - -static final StrokeRec char49[] = { - new StrokeRec( 4, char49_stroke0 ), -}; - -/* char: 50 '2' */ - -static final CoordRec char50_stroke0[] = { - new CoordRec((float) 23.8095, (float) 76.1905 ), - new CoordRec((float) 23.8095, (float) 80.9524 ), - new CoordRec((float) 28.5714, (float) 90.4762 ), - new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 76.1905, (float) 90.4762 ), - new CoordRec((float) 80.9524, (float) 80.9524 ), - new CoordRec((float) 80.9524, (float) 71.4286 ), - new CoordRec((float) 76.1905, (float) 61.9048 ), - new CoordRec((float) 66.6666, (float) 47.619 ), - new CoordRec((float) 19.0476, (float) 0 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final StrokeRec char50[] = { - new StrokeRec( 14, char50_stroke0 ), -}; - -/* char: 51 '3' */ - -static final CoordRec char51_stroke0[] = { - new CoordRec((float) 28.5714, (float) 100 ), - new CoordRec((float) 80.9524, (float) 100 ), - new CoordRec((float) 52.3809, (float) 61.9048 ), - new CoordRec((float) 66.6666, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 57.1429 ), - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 85.7143, (float) 38.0952 ), - new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 28.5714, (float) 4.7619 ), - new CoordRec((float) 23.8095, (float) 9.5238 ), - new CoordRec((float) 19.0476, (float) 19.0476 ), -}; - -static final StrokeRec char51[] = { - new StrokeRec( 15, char51_stroke0 ), -}; - -/* char: 52 '4' */ - -static final CoordRec char52_stroke0[] = { - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 16.6667, (float) 33.3333 ), - new CoordRec((float) 88.0952, (float) 33.3333 ), -}; - -static final CoordRec char52_stroke1[] = { - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 64.2857, (float) 0 ), -}; - -static final StrokeRec char52[] = { - new StrokeRec( 3, char52_stroke0 ), - new StrokeRec( 2, char52_stroke1 ), -}; - -/* char: 53 '5' */ - -static final CoordRec char53_stroke0[] = { - new CoordRec((float) 76.1905, (float) 100 ), - new CoordRec((float) 28.5714, (float) 100 ), - new CoordRec((float) 23.8095, (float) 57.1429 ), - new CoordRec((float) 28.5714, (float) 61.9048 ), - new CoordRec((float) 42.8571, (float) 66.6667 ), - new CoordRec((float) 57.1428, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 61.9048 ), - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 85.7143, (float) 38.0952 ), - new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 28.5714, (float) 4.7619 ), - new CoordRec((float) 23.8095, (float) 9.5238 ), - new CoordRec((float) 19.0476, (float) 19.0476 ), -}; - -static final StrokeRec char53[] = { - new StrokeRec( 17, char53_stroke0 ), -}; - -/* char: 54 '6' */ - -static final CoordRec char54_stroke0[] = { - new CoordRec((float) 78.5714, (float) 85.7143 ), - new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 59.5238, (float) 100 ), - new CoordRec((float) 50, (float) 100 ), - new CoordRec((float) 35.7143, (float) 95.2381 ), - new CoordRec((float) 26.1905, (float) 80.9524 ), - new CoordRec((float) 21.4286, (float) 57.1429 ), - new CoordRec((float) 21.4286, (float) 33.3333 ), - new CoordRec((float) 26.1905, (float) 14.2857 ), - new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 50, (float) 0 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 69.0476, (float) 4.7619 ), - new CoordRec((float) 78.5714, (float) 14.2857 ), - new CoordRec((float) 83.3334, (float) 28.5714 ), - new CoordRec((float) 83.3334, (float) 33.3333 ), - new CoordRec((float) 78.5714, (float) 47.619 ), - new CoordRec((float) 69.0476, (float) 57.1429 ), - new CoordRec((float) 54.7619, (float) 61.9048 ), - new CoordRec((float) 50, (float) 61.9048 ), - new CoordRec((float) 35.7143, (float) 57.1429 ), - new CoordRec((float) 26.1905, (float) 47.619 ), - new CoordRec((float) 21.4286, (float) 33.3333 ), -}; - -static final StrokeRec char54[] = { - new StrokeRec( 23, char54_stroke0 ), -}; - -/* char: 55 '7' */ - -static final CoordRec char55_stroke0[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 38.0952, (float) 0 ), -}; - -static final CoordRec char55_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), -}; - -static final StrokeRec char55[] = { - new StrokeRec( 2, char55_stroke0 ), - new StrokeRec( 2, char55_stroke1 ), -}; - -/* char: 56 '8' */ - -static final CoordRec char56_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 28.5714, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 85.7143 ), - new CoordRec((float) 23.8095, (float) 76.1905 ), - new CoordRec((float) 28.5714, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 57.1428, (float) 57.1429 ), - new CoordRec((float) 71.4286, (float) 52.381 ), - new CoordRec((float) 80.9524, (float) 42.8571 ), - new CoordRec((float) 85.7143, (float) 33.3333 ), - new CoordRec((float) 85.7143, (float) 19.0476 ), - new CoordRec((float) 80.9524, (float) 9.5238 ), - new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 28.5714, (float) 4.7619 ), - new CoordRec((float) 23.8095, (float) 9.5238 ), - new CoordRec((float) 19.0476, (float) 19.0476 ), - new CoordRec((float) 19.0476, (float) 33.3333 ), - new CoordRec((float) 23.8095, (float) 42.8571 ), - new CoordRec((float) 33.3333, (float) 52.381 ), - new CoordRec((float) 47.619, (float) 57.1429 ), - new CoordRec((float) 66.6666, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) 76.1905 ), - new CoordRec((float) 80.9524, (float) 85.7143 ), - new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), -}; - -static final StrokeRec char56[] = { - new StrokeRec( 29, char56_stroke0 ), -}; - -/* char: 57 '9' */ - -static final CoordRec char57_stroke0[] = { - new CoordRec((float) 83.3334, (float) 66.6667 ), - new CoordRec((float) 78.5714, (float) 52.381 ), - new CoordRec((float) 69.0476, (float) 42.8571 ), - new CoordRec((float) 54.7619, (float) 38.0952 ), - new CoordRec((float) 50, (float) 38.0952 ), - new CoordRec((float) 35.7143, (float) 42.8571 ), - new CoordRec((float) 26.1905, (float) 52.381 ), - new CoordRec((float) 21.4286, (float) 66.6667 ), - new CoordRec((float) 21.4286, (float) 71.4286 ), - new CoordRec((float) 26.1905, (float) 85.7143 ), - new CoordRec((float) 35.7143, (float) 95.2381 ), - new CoordRec((float) 50, (float) 100 ), - new CoordRec((float) 54.7619, (float) 100 ), - new CoordRec((float) 69.0476, (float) 95.2381 ), - new CoordRec((float) 78.5714, (float) 85.7143 ), - new CoordRec((float) 83.3334, (float) 66.6667 ), - new CoordRec((float) 83.3334, (float) 42.8571 ), - new CoordRec((float) 78.5714, (float) 19.0476 ), - new CoordRec((float) 69.0476, (float) 4.7619 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 30.9524, (float) 4.7619 ), - new CoordRec((float) 26.1905, (float) 14.2857 ), -}; - -static final StrokeRec char57[] = { - new StrokeRec( 23, char57_stroke0 ), -}; - -/* char: 58 ':' */ - -static final CoordRec char58_stroke0[] = { - new CoordRec((float) 52.381, (float) 66.6667 ), - new CoordRec((float) 47.6191, (float) 61.9048 ), - new CoordRec((float) 52.381, (float) 57.1429 ), - new CoordRec((float) 57.1429, (float) 61.9048 ), - new CoordRec((float) 52.381, (float) 66.6667 ), -}; - -static final CoordRec char58_stroke1[] = { - new CoordRec((float) 52.381, (float) 9.5238 ), - new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 9.5238 ), -}; - -static final StrokeRec char58[] = { - new StrokeRec( 5, char58_stroke0 ), - new StrokeRec( 5, char58_stroke1 ), -}; - -/* char: 59 ';' */ - -static final CoordRec char59_stroke0[] = { - new CoordRec((float) 52.381, (float) 66.6667 ), - new CoordRec((float) 47.6191, (float) 61.9048 ), - new CoordRec((float) 52.381, (float) 57.1429 ), - new CoordRec((float) 57.1429, (float) 61.9048 ), - new CoordRec((float) 52.381, (float) 66.6667 ), -}; - -static final CoordRec char59_stroke1[] = { - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), - new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 9.5238 ), - new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 57.1429, (float) -4.7619 ), - new CoordRec((float) 52.381, (float) -14.2857 ), - new CoordRec((float) 47.6191, (float) -19.0476 ), -}; - -static final StrokeRec char59[] = { - new StrokeRec( 5, char59_stroke0 ), - new StrokeRec( 8, char59_stroke1 ), -}; - -/* char: 60 '<' */ - -static final CoordRec char60_stroke0[] = { - new CoordRec((float) 90.4762, (float) 85.7143 ), - new CoordRec((float) 14.2857, (float) 42.8571 ), - new CoordRec((float) 90.4762, (float) 0 ), -}; - -static final StrokeRec char60[] = { - new StrokeRec( 3, char60_stroke0 ), -}; - -/* char: 61 '=' */ - -static final CoordRec char61_stroke0[] = { - new CoordRec((float) 9.5238, (float) 57.1429 ), - new CoordRec((float) 95.2381, (float) 57.1429 ), -}; - -static final CoordRec char61_stroke1[] = { - new CoordRec((float) 9.5238, (float) 28.5714 ), - new CoordRec((float) 95.2381, (float) 28.5714 ), -}; - -static final StrokeRec char61[] = { - new StrokeRec( 2, char61_stroke0 ), - new StrokeRec( 2, char61_stroke1 ), -}; - -/* char: 62 '>' */ - -static final CoordRec char62_stroke0[] = { - new CoordRec((float) 14.2857, (float) 85.7143 ), - new CoordRec((float) 90.4762, (float) 42.8571 ), - new CoordRec((float) 14.2857, (float) 0 ), -}; - -static final StrokeRec char62[] = { - new StrokeRec( 3, char62_stroke0 ), -}; - -/* char: 63 '?' */ - -static final CoordRec char63_stroke0[] = { - new CoordRec((float) 23.8095, (float) 76.1905 ), - new CoordRec((float) 23.8095, (float) 80.9524 ), - new CoordRec((float) 28.5714, (float) 90.4762 ), - new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 71.4285, (float) 95.2381 ), - new CoordRec((float) 76.1905, (float) 90.4762 ), - new CoordRec((float) 80.9524, (float) 80.9524 ), - new CoordRec((float) 80.9524, (float) 71.4286 ), - new CoordRec((float) 76.1905, (float) 61.9048 ), - new CoordRec((float) 71.4285, (float) 57.1429 ), - new CoordRec((float) 52.3809, (float) 47.619 ), - new CoordRec((float) 52.3809, (float) 33.3333 ), -}; - -static final CoordRec char63_stroke1[] = { - new CoordRec((float) 52.3809, (float) 9.5238 ), - new CoordRec((float) 47.619, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 0 ), - new CoordRec((float) 57.1428, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 9.5238 ), -}; - -static final StrokeRec char63[] = { - new StrokeRec( 14, char63_stroke0 ), - new StrokeRec( 5, char63_stroke1 ), -}; - -/* char: 64 '@' */ - -static final CoordRec char64_stroke0[] = { - new CoordRec((float) 64.2857, (float) 52.381 ), - new CoordRec((float) 54.7619, (float) 57.1429 ), - new CoordRec((float) 45.2381, (float) 57.1429 ), - new CoordRec((float) 40.4762, (float) 47.619 ), - new CoordRec((float) 40.4762, (float) 42.8571 ), - new CoordRec((float) 45.2381, (float) 33.3333 ), - new CoordRec((float) 54.7619, (float) 33.3333 ), - new CoordRec((float) 64.2857, (float) 38.0952 ), -}; - -static final CoordRec char64_stroke1[] = { - new CoordRec((float) 64.2857, (float) 57.1429 ), - new CoordRec((float) 64.2857, (float) 38.0952 ), - new CoordRec((float) 69.0476, (float) 33.3333 ), - new CoordRec((float) 78.5714, (float) 33.3333 ), - new CoordRec((float) 83.3334, (float) 42.8571 ), - new CoordRec((float) 83.3334, (float) 47.619 ), - new CoordRec((float) 78.5714, (float) 61.9048 ), - new CoordRec((float) 69.0476, (float) 71.4286 ), - new CoordRec((float) 54.7619, (float) 76.1905 ), - new CoordRec((float) 50, (float) 76.1905 ), - new CoordRec((float) 35.7143, (float) 71.4286 ), - new CoordRec((float) 26.1905, (float) 61.9048 ), - new CoordRec((float) 21.4286, (float) 47.619 ), - new CoordRec((float) 21.4286, (float) 42.8571 ), - new CoordRec((float) 26.1905, (float) 28.5714 ), - new CoordRec((float) 35.7143, (float) 19.0476 ), - new CoordRec((float) 50, (float) 14.2857 ), - new CoordRec((float) 54.7619, (float) 14.2857 ), - new CoordRec((float) 69.0476, (float) 19.0476 ), -}; - -static final StrokeRec char64[] = { - new StrokeRec( 8, char64_stroke0 ), - new StrokeRec( 19, char64_stroke1 ), -}; - -/* char: 65 'A' */ - -static final CoordRec char65_stroke0[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 14.2857, (float) 0 ), -}; - -static final CoordRec char65_stroke1[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 90.4762, (float) 0 ), -}; - -static final CoordRec char65_stroke2[] = { - new CoordRec((float) 28.5714, (float) 33.3333 ), - new CoordRec((float) 76.1905, (float) 33.3333 ), -}; - -static final StrokeRec char65[] = { - new StrokeRec( 2, char65_stroke0 ), - new StrokeRec( 2, char65_stroke1 ), - new StrokeRec( 2, char65_stroke2 ), -}; - -/* char: 66 'B' */ - -static final CoordRec char66_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char66_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 80.9524, (float) 90.4762 ), - new CoordRec((float) 85.7143, (float) 80.9524 ), - new CoordRec((float) 85.7143, (float) 71.4286 ), - new CoordRec((float) 80.9524, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 57.1429 ), - new CoordRec((float) 61.9047, (float) 52.381 ), -}; - -static final CoordRec char66_stroke2[] = { - new CoordRec((float) 19.0476, (float) 52.381 ), - new CoordRec((float) 61.9047, (float) 52.381 ), - new CoordRec((float) 76.1905, (float) 47.619 ), - new CoordRec((float) 80.9524, (float) 42.8571 ), - new CoordRec((float) 85.7143, (float) 33.3333 ), - new CoordRec((float) 85.7143, (float) 19.0476 ), - new CoordRec((float) 80.9524, (float) 9.5238 ), - new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final StrokeRec char66[] = { - new StrokeRec( 2, char66_stroke0 ), - new StrokeRec( 9, char66_stroke1 ), - new StrokeRec( 10, char66_stroke2 ), -}; - -/* char: 67 'C' */ - -static final CoordRec char67_stroke0[] = { - new CoordRec((float) 88.0952, (float) 76.1905 ), - new CoordRec((float) 83.3334, (float) 85.7143 ), - new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 45.2381, (float) 100 ), - new CoordRec((float) 35.7143, (float) 95.2381 ), - new CoordRec((float) 26.1905, (float) 85.7143 ), - new CoordRec((float) 21.4286, (float) 76.1905 ), - new CoordRec((float) 16.6667, (float) 61.9048 ), - new CoordRec((float) 16.6667, (float) 38.0952 ), - new CoordRec((float) 21.4286, (float) 23.8095 ), - new CoordRec((float) 26.1905, (float) 14.2857 ), - new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 64.2857, (float) 0 ), - new CoordRec((float) 73.8096, (float) 4.7619 ), - new CoordRec((float) 83.3334, (float) 14.2857 ), - new CoordRec((float) 88.0952, (float) 23.8095 ), -}; - -static final StrokeRec char67[] = { - new StrokeRec( 18, char67_stroke0 ), -}; - -/* char: 68 'D' */ - -static final CoordRec char68_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char68_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 66.6666, (float) 95.2381 ), - new CoordRec((float) 76.1905, (float) 85.7143 ), - new CoordRec((float) 80.9524, (float) 76.1905 ), - new CoordRec((float) 85.7143, (float) 61.9048 ), - new CoordRec((float) 85.7143, (float) 38.0952 ), - new CoordRec((float) 80.9524, (float) 23.8095 ), - new CoordRec((float) 76.1905, (float) 14.2857 ), - new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 0 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final StrokeRec char68[] = { - new StrokeRec( 2, char68_stroke0 ), - new StrokeRec( 12, char68_stroke1 ), -}; - -/* char: 69 'E' */ - -static final CoordRec char69_stroke0[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 21.4286, (float) 0 ), -}; - -static final CoordRec char69_stroke1[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 83.3334, (float) 100 ), -}; - -static final CoordRec char69_stroke2[] = { - new CoordRec((float) 21.4286, (float) 52.381 ), - new CoordRec((float) 59.5238, (float) 52.381 ), -}; - -static final CoordRec char69_stroke3[] = { - new CoordRec((float) 21.4286, (float) 0 ), - new CoordRec((float) 83.3334, (float) 0 ), -}; - -static final StrokeRec char69[] = { - new StrokeRec( 2, char69_stroke0 ), - new StrokeRec( 2, char69_stroke1 ), - new StrokeRec( 2, char69_stroke2 ), - new StrokeRec( 2, char69_stroke3 ), -}; - -/* char: 70 'F' */ - -static final CoordRec char70_stroke0[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 21.4286, (float) 0 ), -}; - -static final CoordRec char70_stroke1[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 83.3334, (float) 100 ), -}; - -static final CoordRec char70_stroke2[] = { - new CoordRec((float) 21.4286, (float) 52.381 ), - new CoordRec((float) 59.5238, (float) 52.381 ), -}; - -static final StrokeRec char70[] = { - new StrokeRec( 2, char70_stroke0 ), - new StrokeRec( 2, char70_stroke1 ), - new StrokeRec( 2, char70_stroke2 ), -}; - -/* char: 71 'G' */ - -static final CoordRec char71_stroke0[] = { - new CoordRec((float) 88.0952, (float) 76.1905 ), - new CoordRec((float) 83.3334, (float) 85.7143 ), - new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 45.2381, (float) 100 ), - new CoordRec((float) 35.7143, (float) 95.2381 ), - new CoordRec((float) 26.1905, (float) 85.7143 ), - new CoordRec((float) 21.4286, (float) 76.1905 ), - new CoordRec((float) 16.6667, (float) 61.9048 ), - new CoordRec((float) 16.6667, (float) 38.0952 ), - new CoordRec((float) 21.4286, (float) 23.8095 ), - new CoordRec((float) 26.1905, (float) 14.2857 ), - new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 64.2857, (float) 0 ), - new CoordRec((float) 73.8096, (float) 4.7619 ), - new CoordRec((float) 83.3334, (float) 14.2857 ), - new CoordRec((float) 88.0952, (float) 23.8095 ), - new CoordRec((float) 88.0952, (float) 38.0952 ), -}; - -static final CoordRec char71_stroke1[] = { - new CoordRec((float) 64.2857, (float) 38.0952 ), - new CoordRec((float) 88.0952, (float) 38.0952 ), -}; - -static final StrokeRec char71[] = { - new StrokeRec( 19, char71_stroke0 ), - new StrokeRec( 2, char71_stroke1 ), -}; - -/* char: 72 'H' */ - -static final CoordRec char72_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char72_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final CoordRec char72_stroke2[] = { - new CoordRec((float) 19.0476, (float) 52.381 ), - new CoordRec((float) 85.7143, (float) 52.381 ), -}; - -static final StrokeRec char72[] = { - new StrokeRec( 2, char72_stroke0 ), - new StrokeRec( 2, char72_stroke1 ), - new StrokeRec( 2, char72_stroke2 ), -}; - -/* char: 73 'I' */ - -static final CoordRec char73_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 0 ), -}; - -static final StrokeRec char73[] = { - new StrokeRec( 2, char73_stroke0 ), -}; - -/* char: 74 'J' */ - -static final CoordRec char74_stroke0[] = { - new CoordRec((float) 76.1905, (float) 100 ), - new CoordRec((float) 76.1905, (float) 23.8095 ), - new CoordRec((float) 71.4286, (float) 9.5238 ), - new CoordRec((float) 66.6667, (float) 4.7619 ), - new CoordRec((float) 57.1429, (float) 0 ), - new CoordRec((float) 47.6191, (float) 0 ), - new CoordRec((float) 38.0953, (float) 4.7619 ), - new CoordRec((float) 33.3334, (float) 9.5238 ), - new CoordRec((float) 28.5715, (float) 23.8095 ), - new CoordRec((float) 28.5715, (float) 33.3333 ), -}; - -static final StrokeRec char74[] = { - new StrokeRec( 10, char74_stroke0 ), -}; - -/* char: 75 'K' */ - -static final CoordRec char75_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char75_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 33.3333 ), -}; - -static final CoordRec char75_stroke2[] = { - new CoordRec((float) 42.8571, (float) 57.1429 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final StrokeRec char75[] = { - new StrokeRec( 2, char75_stroke0 ), - new StrokeRec( 2, char75_stroke1 ), - new StrokeRec( 2, char75_stroke2 ), -}; - -/* char: 76 'L' */ - -static final CoordRec char76_stroke0[] = { - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 23.8095, (float) 0 ), -}; - -static final CoordRec char76_stroke1[] = { - new CoordRec((float) 23.8095, (float) 0 ), - new CoordRec((float) 80.9524, (float) 0 ), -}; - -static final StrokeRec char76[] = { - new StrokeRec( 2, char76_stroke0 ), - new StrokeRec( 2, char76_stroke1 ), -}; - -/* char: 77 'M' */ - -static final CoordRec char77_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 14.2857, (float) 0 ), -}; - -static final CoordRec char77_stroke1[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char77_stroke2[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char77_stroke3[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 90.4762, (float) 0 ), -}; - -static final StrokeRec char77[] = { - new StrokeRec( 2, char77_stroke0 ), - new StrokeRec( 2, char77_stroke1 ), - new StrokeRec( 2, char77_stroke2 ), - new StrokeRec( 2, char77_stroke3 ), -}; - -/* char: 78 'N' */ - -static final CoordRec char78_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char78_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final CoordRec char78_stroke2[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final StrokeRec char78[] = { - new StrokeRec( 2, char78_stroke0 ), - new StrokeRec( 2, char78_stroke1 ), - new StrokeRec( 2, char78_stroke2 ), -}; - -/* char: 79 'O' */ - -static final CoordRec char79_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 85.7143 ), - new CoordRec((float) 19.0476, (float) 76.1905 ), - new CoordRec((float) 14.2857, (float) 61.9048 ), - new CoordRec((float) 14.2857, (float) 38.0952 ), - new CoordRec((float) 19.0476, (float) 23.8095 ), - new CoordRec((float) 23.8095, (float) 14.2857 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), - new CoordRec((float) 85.7143, (float) 23.8095 ), - new CoordRec((float) 90.4762, (float) 38.0952 ), - new CoordRec((float) 90.4762, (float) 61.9048 ), - new CoordRec((float) 85.7143, (float) 76.1905 ), - new CoordRec((float) 80.9524, (float) 85.7143 ), - new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), -}; - -static final StrokeRec char79[] = { - new StrokeRec( 21, char79_stroke0 ), -}; - -/* char: 80 'P' */ - -static final CoordRec char80_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char80_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 80.9524, (float) 90.4762 ), - new CoordRec((float) 85.7143, (float) 80.9524 ), - new CoordRec((float) 85.7143, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) 57.1429 ), - new CoordRec((float) 76.1905, (float) 52.381 ), - new CoordRec((float) 61.9047, (float) 47.619 ), - new CoordRec((float) 19.0476, (float) 47.619 ), -}; - -static final StrokeRec char80[] = { - new StrokeRec( 2, char80_stroke0 ), - new StrokeRec( 10, char80_stroke1 ), -}; - -/* char: 81 'Q' */ - -static final CoordRec char81_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 85.7143 ), - new CoordRec((float) 19.0476, (float) 76.1905 ), - new CoordRec((float) 14.2857, (float) 61.9048 ), - new CoordRec((float) 14.2857, (float) 38.0952 ), - new CoordRec((float) 19.0476, (float) 23.8095 ), - new CoordRec((float) 23.8095, (float) 14.2857 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), - new CoordRec((float) 85.7143, (float) 23.8095 ), - new CoordRec((float) 90.4762, (float) 38.0952 ), - new CoordRec((float) 90.4762, (float) 61.9048 ), - new CoordRec((float) 85.7143, (float) 76.1905 ), - new CoordRec((float) 80.9524, (float) 85.7143 ), - new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), -}; - -static final CoordRec char81_stroke1[] = { - new CoordRec((float) 57.1428, (float) 19.0476 ), - new CoordRec((float) 85.7143, (float) -9.5238 ), -}; - -static final StrokeRec char81[] = { - new StrokeRec( 21, char81_stroke0 ), - new StrokeRec( 2, char81_stroke1 ), -}; - -/* char: 82 'R' */ - -static final CoordRec char82_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char82_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 80.9524, (float) 90.4762 ), - new CoordRec((float) 85.7143, (float) 80.9524 ), - new CoordRec((float) 85.7143, (float) 71.4286 ), - new CoordRec((float) 80.9524, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 57.1429 ), - new CoordRec((float) 61.9047, (float) 52.381 ), - new CoordRec((float) 19.0476, (float) 52.381 ), -}; - -static final CoordRec char82_stroke2[] = { - new CoordRec((float) 52.3809, (float) 52.381 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final StrokeRec char82[] = { - new StrokeRec( 2, char82_stroke0 ), - new StrokeRec( 10, char82_stroke1 ), - new StrokeRec( 2, char82_stroke2 ), -}; - -/* char: 83 'S' */ - -static final CoordRec char83_stroke0[] = { - new CoordRec((float) 85.7143, (float) 85.7143 ), - new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 28.5714, (float) 95.2381 ), - new CoordRec((float) 19.0476, (float) 85.7143 ), - new CoordRec((float) 19.0476, (float) 76.1905 ), - new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 28.5714, (float) 61.9048 ), - new CoordRec((float) 38.0952, (float) 57.1429 ), - new CoordRec((float) 66.6666, (float) 47.619 ), - new CoordRec((float) 76.1905, (float) 42.8571 ), - new CoordRec((float) 80.9524, (float) 38.0952 ), - new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 85.7143, (float) 14.2857 ), - new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 28.5714, (float) 4.7619 ), - new CoordRec((float) 19.0476, (float) 14.2857 ), -}; - -static final StrokeRec char83[] = { - new StrokeRec( 20, char83_stroke0 ), -}; - -/* char: 84 'T' */ - -static final CoordRec char84_stroke0[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char84_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), -}; - -static final StrokeRec char84[] = { - new StrokeRec( 2, char84_stroke0 ), - new StrokeRec( 2, char84_stroke1 ), -}; - -/* char: 85 'U' */ - -static final CoordRec char85_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 28.5714 ), - new CoordRec((float) 23.8095, (float) 14.2857 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), - new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 85.7143, (float) 100 ), -}; - -static final StrokeRec char85[] = { - new StrokeRec( 10, char85_stroke0 ), -}; - -/* char: 86 'V' */ - -static final CoordRec char86_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char86_stroke1[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final StrokeRec char86[] = { - new StrokeRec( 2, char86_stroke0 ), - new StrokeRec( 2, char86_stroke1 ), -}; - -/* char: 87 'W' */ - -static final CoordRec char87_stroke0[] = { - new CoordRec((float) 4.7619, (float) 100 ), - new CoordRec((float) 28.5714, (float) 0 ), -}; - -static final CoordRec char87_stroke1[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 28.5714, (float) 0 ), -}; - -static final CoordRec char87_stroke2[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 76.1905, (float) 0 ), -}; - -static final CoordRec char87_stroke3[] = { - new CoordRec((float) 100, (float) 100 ), - new CoordRec((float) 76.1905, (float) 0 ), -}; - -static final StrokeRec char87[] = { - new StrokeRec( 2, char87_stroke0 ), - new StrokeRec( 2, char87_stroke1 ), - new StrokeRec( 2, char87_stroke2 ), - new StrokeRec( 2, char87_stroke3 ), -}; - -/* char: 88 'X' */ - -static final CoordRec char88_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final CoordRec char88_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final StrokeRec char88[] = { - new StrokeRec( 2, char88_stroke0 ), - new StrokeRec( 2, char88_stroke1 ), -}; - -/* char: 89 'Y' */ - -static final CoordRec char89_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 52.381 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char89_stroke1[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 52.381 ), -}; - -static final StrokeRec char89[] = { - new StrokeRec( 3, char89_stroke0 ), - new StrokeRec( 2, char89_stroke1 ), -}; - -/* char: 90 'Z' */ - -static final CoordRec char90_stroke0[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), -}; - -static final CoordRec char90_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), -}; - -static final CoordRec char90_stroke2[] = { - new CoordRec((float) 19.0476, (float) 0 ), - new CoordRec((float) 85.7143, (float) 0 ), -}; - -static final StrokeRec char90[] = { - new StrokeRec( 2, char90_stroke0 ), - new StrokeRec( 2, char90_stroke1 ), - new StrokeRec( 2, char90_stroke2 ), -}; - -/* char: 91 '[' */ - -static final CoordRec char91_stroke0[] = { - new CoordRec((float) 35.7143, (float) 119.048 ), - new CoordRec((float) 35.7143, (float) -33.3333 ), -}; - -static final CoordRec char91_stroke1[] = { - new CoordRec((float) 40.4762, (float) 119.048 ), - new CoordRec((float) 40.4762, (float) -33.3333 ), -}; - -static final CoordRec char91_stroke2[] = { - new CoordRec((float) 35.7143, (float) 119.048 ), - new CoordRec((float) 69.0476, (float) 119.048 ), -}; - -static final CoordRec char91_stroke3[] = { - new CoordRec((float) 35.7143, (float) -33.3333 ), - new CoordRec((float) 69.0476, (float) -33.3333 ), -}; - -static final StrokeRec char91[] = { - new StrokeRec( 2, char91_stroke0 ), - new StrokeRec( 2, char91_stroke1 ), - new StrokeRec( 2, char91_stroke2 ), - new StrokeRec( 2, char91_stroke3 ), -}; - -/* char: 92 '\' */ - -static final CoordRec char92_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) -14.2857 ), -}; - -static final StrokeRec char92[] = { - new StrokeRec( 2, char92_stroke0 ), -}; - -/* char: 93 ']' */ - -static final CoordRec char93_stroke0[] = { - new CoordRec((float) 64.2857, (float) 119.048 ), - new CoordRec((float) 64.2857, (float) -33.3333 ), -}; - -static final CoordRec char93_stroke1[] = { - new CoordRec((float) 69.0476, (float) 119.048 ), - new CoordRec((float) 69.0476, (float) -33.3333 ), -}; - -static final CoordRec char93_stroke2[] = { - new CoordRec((float) 35.7143, (float) 119.048 ), - new CoordRec((float) 69.0476, (float) 119.048 ), -}; - -static final CoordRec char93_stroke3[] = { - new CoordRec((float) 35.7143, (float) -33.3333 ), - new CoordRec((float) 69.0476, (float) -33.3333 ), -}; - -static final StrokeRec char93[] = { - new StrokeRec( 2, char93_stroke0 ), - new StrokeRec( 2, char93_stroke1 ), - new StrokeRec( 2, char93_stroke2 ), - new StrokeRec( 2, char93_stroke3 ), -}; - -/* char: 94 '^' */ - -static final CoordRec char94_stroke0[] = { - new CoordRec((float) 52.3809, (float) 109.524 ), - new CoordRec((float) 14.2857, (float) 42.8571 ), -}; - -static final CoordRec char94_stroke1[] = { - new CoordRec((float) 52.3809, (float) 109.524 ), - new CoordRec((float) 90.4762, (float) 42.8571 ), -}; - -static final StrokeRec char94[] = { - new StrokeRec( 2, char94_stroke0 ), - new StrokeRec( 2, char94_stroke1 ), -}; - -/* char: 95 '_' */ - -static final CoordRec char95_stroke0[] = { - new CoordRec((float) 0, (float) -33.3333 ), - new CoordRec((float) 104.762, (float) -33.3333 ), - new CoordRec((float) 104.762, (float) -28.5714 ), - new CoordRec((float) 0, (float) -28.5714 ), - new CoordRec((float) 0, (float) -33.3333 ), -}; - -static final StrokeRec char95[] = { - new StrokeRec( 5, char95_stroke0 ), -}; - -/* char: 96 '`' */ - -static final CoordRec char96_stroke0[] = { - new CoordRec((float) 42.8572, (float) 100 ), - new CoordRec((float) 66.6667, (float) 71.4286 ), -}; - -static final CoordRec char96_stroke1[] = { - new CoordRec((float) 42.8572, (float) 100 ), - new CoordRec((float) 38.0953, (float) 95.2381 ), - new CoordRec((float) 66.6667, (float) 71.4286 ), -}; - -static final StrokeRec char96[] = { - new StrokeRec( 2, char96_stroke0 ), - new StrokeRec( 3, char96_stroke1 ), -}; - -/* char: 97 'a' */ - -static final CoordRec char97_stroke0[] = { - new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) 0 ), -}; - -static final CoordRec char97_stroke1[] = { - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4285, (float) 61.9048 ), - new CoordRec((float) 61.9047, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 28.5714, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 23.8095, (float) 28.5714 ), - new CoordRec((float) 28.5714, (float) 14.2857 ), - new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4285, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), -}; - -static final StrokeRec char97[] = { - new StrokeRec( 2, char97_stroke0 ), - new StrokeRec( 14, char97_stroke1 ), -}; - -/* char: 98 'b' */ - -static final CoordRec char98_stroke0[] = { - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 23.8095, (float) 0 ), -}; - -static final CoordRec char98_stroke1[] = { - new CoordRec((float) 23.8095, (float) 52.381 ), - new CoordRec((float) 33.3333, (float) 61.9048 ), - new CoordRec((float) 42.8571, (float) 66.6667 ), - new CoordRec((float) 57.1428, (float) 66.6667 ), - new CoordRec((float) 66.6666, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 52.381 ), - new CoordRec((float) 80.9524, (float) 38.0952 ), - new CoordRec((float) 80.9524, (float) 28.5714 ), - new CoordRec((float) 76.1905, (float) 14.2857 ), - new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 23.8095, (float) 14.2857 ), -}; - -static final StrokeRec char98[] = { - new StrokeRec( 2, char98_stroke0 ), - new StrokeRec( 14, char98_stroke1 ), -}; - -/* char: 99 'c' */ - -static final CoordRec char99_stroke0[] = { - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4285, (float) 61.9048 ), - new CoordRec((float) 61.9047, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 28.5714, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 23.8095, (float) 28.5714 ), - new CoordRec((float) 28.5714, (float) 14.2857 ), - new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4285, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), -}; - -static final StrokeRec char99[] = { - new StrokeRec( 14, char99_stroke0 ), -}; - -/* char: 100 'd' */ - -static final CoordRec char100_stroke0[] = { - new CoordRec((float) 80.9524, (float) 100 ), - new CoordRec((float) 80.9524, (float) 0 ), -}; - -static final CoordRec char100_stroke1[] = { - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4285, (float) 61.9048 ), - new CoordRec((float) 61.9047, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 28.5714, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 23.8095, (float) 28.5714 ), - new CoordRec((float) 28.5714, (float) 14.2857 ), - new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4285, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), -}; - -static final StrokeRec char100[] = { - new StrokeRec( 2, char100_stroke0 ), - new StrokeRec( 14, char100_stroke1 ), -}; - -/* char: 101 'e' */ - -static final CoordRec char101_stroke0[] = { - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 80.9524, (float) 38.0952 ), - new CoordRec((float) 80.9524, (float) 47.619 ), - new CoordRec((float) 76.1905, (float) 57.1429 ), - new CoordRec((float) 71.4285, (float) 61.9048 ), - new CoordRec((float) 61.9047, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 28.5714, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 23.8095, (float) 28.5714 ), - new CoordRec((float) 28.5714, (float) 14.2857 ), - new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4285, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), -}; - -static final StrokeRec char101[] = { - new StrokeRec( 17, char101_stroke0 ), -}; - -/* char: 102 'f' */ - -static final CoordRec char102_stroke0[] = { - new CoordRec((float) 71.4286, (float) 100 ), - new CoordRec((float) 61.9048, (float) 100 ), - new CoordRec((float) 52.381, (float) 95.2381 ), - new CoordRec((float) 47.6191, (float) 80.9524 ), - new CoordRec((float) 47.6191, (float) 0 ), -}; - -static final CoordRec char102_stroke1[] = { - new CoordRec((float) 33.3334, (float) 66.6667 ), - new CoordRec((float) 66.6667, (float) 66.6667 ), -}; - -static final StrokeRec char102[] = { - new StrokeRec( 5, char102_stroke0 ), - new StrokeRec( 2, char102_stroke1 ), -}; - -/* char: 103 'g' */ - -static final CoordRec char103_stroke0[] = { - new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) -9.5238 ), - new CoordRec((float) 76.1905, (float) -23.8095 ), - new CoordRec((float) 71.4285, (float) -28.5714 ), - new CoordRec((float) 61.9047, (float) -33.3333 ), - new CoordRec((float) 47.619, (float) -33.3333 ), - new CoordRec((float) 38.0952, (float) -28.5714 ), -}; - -static final CoordRec char103_stroke1[] = { - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4285, (float) 61.9048 ), - new CoordRec((float) 61.9047, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 28.5714, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 23.8095, (float) 28.5714 ), - new CoordRec((float) 28.5714, (float) 14.2857 ), - new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4285, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), -}; - -static final StrokeRec char103[] = { - new StrokeRec( 7, char103_stroke0 ), - new StrokeRec( 14, char103_stroke1 ), -}; - -/* char: 104 'h' */ - -static final CoordRec char104_stroke0[] = { - new CoordRec((float) 26.1905, (float) 100 ), - new CoordRec((float) 26.1905, (float) 0 ), -}; - -static final CoordRec char104_stroke1[] = { - new CoordRec((float) 26.1905, (float) 47.619 ), - new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 50, (float) 66.6667 ), - new CoordRec((float) 64.2857, (float) 66.6667 ), - new CoordRec((float) 73.8095, (float) 61.9048 ), - new CoordRec((float) 78.5715, (float) 47.619 ), - new CoordRec((float) 78.5715, (float) 0 ), -}; - -static final StrokeRec char104[] = { - new StrokeRec( 2, char104_stroke0 ), - new StrokeRec( 7, char104_stroke1 ), -}; - -/* char: 105 'i' */ - -static final CoordRec char105_stroke0[] = { - new CoordRec((float) 47.6191, (float) 100 ), - new CoordRec((float) 52.381, (float) 95.2381 ), - new CoordRec((float) 57.1429, (float) 100 ), - new CoordRec((float) 52.381, (float) 104.762 ), - new CoordRec((float) 47.6191, (float) 100 ), -}; - -static final CoordRec char105_stroke1[] = { - new CoordRec((float) 52.381, (float) 66.6667 ), - new CoordRec((float) 52.381, (float) 0 ), -}; - -static final StrokeRec char105[] = { - new StrokeRec( 5, char105_stroke0 ), - new StrokeRec( 2, char105_stroke1 ), -}; - -/* char: 106 'j' */ - -static final CoordRec char106_stroke0[] = { - new CoordRec((float) 57.1429, (float) 100 ), - new CoordRec((float) 61.9048, (float) 95.2381 ), - new CoordRec((float) 66.6667, (float) 100 ), - new CoordRec((float) 61.9048, (float) 104.762 ), - new CoordRec((float) 57.1429, (float) 100 ), -}; - -static final CoordRec char106_stroke1[] = { - new CoordRec((float) 61.9048, (float) 66.6667 ), - new CoordRec((float) 61.9048, (float) -14.2857 ), - new CoordRec((float) 57.1429, (float) -28.5714 ), - new CoordRec((float) 47.6191, (float) -33.3333 ), - new CoordRec((float) 38.0953, (float) -33.3333 ), -}; - -static final StrokeRec char106[] = { - new StrokeRec( 5, char106_stroke0 ), - new StrokeRec( 5, char106_stroke1 ), -}; - -/* char: 107 'k' */ - -static final CoordRec char107_stroke0[] = { - new CoordRec((float) 26.1905, (float) 100 ), - new CoordRec((float) 26.1905, (float) 0 ), -}; - -static final CoordRec char107_stroke1[] = { - new CoordRec((float) 73.8095, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 19.0476 ), -}; - -static final CoordRec char107_stroke2[] = { - new CoordRec((float) 45.2381, (float) 38.0952 ), - new CoordRec((float) 78.5715, (float) 0 ), -}; - -static final StrokeRec char107[] = { - new StrokeRec( 2, char107_stroke0 ), - new StrokeRec( 2, char107_stroke1 ), - new StrokeRec( 2, char107_stroke2 ), -}; - -/* char: 108 'l' */ - -static final CoordRec char108_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 0 ), -}; - -static final StrokeRec char108[] = { - new StrokeRec( 2, char108_stroke0 ), -}; - -/* char: 109 'm' */ - -static final CoordRec char109_stroke0[] = { - new CoordRec((float) 0, (float) 66.6667 ), - new CoordRec((float) 0, (float) 0 ), -}; - -static final CoordRec char109_stroke1[] = { - new CoordRec((float) 0, (float) 47.619 ), - new CoordRec((float) 14.2857, (float) 61.9048 ), - new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 61.9048 ), - new CoordRec((float) 52.381, (float) 47.619 ), - new CoordRec((float) 52.381, (float) 0 ), -}; - -static final CoordRec char109_stroke2[] = { - new CoordRec((float) 52.381, (float) 47.619 ), - new CoordRec((float) 66.6667, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 66.6667 ), - new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 100, (float) 61.9048 ), - new CoordRec((float) 104.762, (float) 47.619 ), - new CoordRec((float) 104.762, (float) 0 ), -}; - -static final StrokeRec char109[] = { - new StrokeRec( 2, char109_stroke0 ), - new StrokeRec( 7, char109_stroke1 ), - new StrokeRec( 7, char109_stroke2 ), -}; - -/* char: 110 'n' */ - -static final CoordRec char110_stroke0[] = { - new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), -}; - -static final CoordRec char110_stroke1[] = { - new CoordRec((float) 26.1905, (float) 47.619 ), - new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 50, (float) 66.6667 ), - new CoordRec((float) 64.2857, (float) 66.6667 ), - new CoordRec((float) 73.8095, (float) 61.9048 ), - new CoordRec((float) 78.5715, (float) 47.619 ), - new CoordRec((float) 78.5715, (float) 0 ), -}; - -static final StrokeRec char110[] = { - new StrokeRec( 2, char110_stroke0 ), - new StrokeRec( 7, char110_stroke1 ), -}; - -/* char: 111 'o' */ - -static final CoordRec char111_stroke0[] = { - new CoordRec((float) 45.2381, (float) 66.6667 ), - new CoordRec((float) 35.7143, (float) 61.9048 ), - new CoordRec((float) 26.1905, (float) 52.381 ), - new CoordRec((float) 21.4286, (float) 38.0952 ), - new CoordRec((float) 21.4286, (float) 28.5714 ), - new CoordRec((float) 26.1905, (float) 14.2857 ), - new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 59.5238, (float) 0 ), - new CoordRec((float) 69.0476, (float) 4.7619 ), - new CoordRec((float) 78.5714, (float) 14.2857 ), - new CoordRec((float) 83.3334, (float) 28.5714 ), - new CoordRec((float) 83.3334, (float) 38.0952 ), - new CoordRec((float) 78.5714, (float) 52.381 ), - new CoordRec((float) 69.0476, (float) 61.9048 ), - new CoordRec((float) 59.5238, (float) 66.6667 ), - new CoordRec((float) 45.2381, (float) 66.6667 ), -}; - -static final StrokeRec char111[] = { - new StrokeRec( 17, char111_stroke0 ), -}; - -/* char: 112 'p' */ - -static final CoordRec char112_stroke0[] = { - new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 23.8095, (float) -33.3333 ), -}; - -static final CoordRec char112_stroke1[] = { - new CoordRec((float) 23.8095, (float) 52.381 ), - new CoordRec((float) 33.3333, (float) 61.9048 ), - new CoordRec((float) 42.8571, (float) 66.6667 ), - new CoordRec((float) 57.1428, (float) 66.6667 ), - new CoordRec((float) 66.6666, (float) 61.9048 ), - new CoordRec((float) 76.1905, (float) 52.381 ), - new CoordRec((float) 80.9524, (float) 38.0952 ), - new CoordRec((float) 80.9524, (float) 28.5714 ), - new CoordRec((float) 76.1905, (float) 14.2857 ), - new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 23.8095, (float) 14.2857 ), -}; - -static final StrokeRec char112[] = { - new StrokeRec( 2, char112_stroke0 ), - new StrokeRec( 14, char112_stroke1 ), -}; - -/* char: 113 'q' */ - -static final CoordRec char113_stroke0[] = { - new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) -33.3333 ), -}; - -static final CoordRec char113_stroke1[] = { - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4285, (float) 61.9048 ), - new CoordRec((float) 61.9047, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 38.0952, (float) 61.9048 ), - new CoordRec((float) 28.5714, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 38.0952 ), - new CoordRec((float) 23.8095, (float) 28.5714 ), - new CoordRec((float) 28.5714, (float) 14.2857 ), - new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 71.4285, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), -}; - -static final StrokeRec char113[] = { - new StrokeRec( 2, char113_stroke0 ), - new StrokeRec( 14, char113_stroke1 ), -}; - -/* char: 114 'r' */ - -static final CoordRec char114_stroke0[] = { - new CoordRec((float) 33.3334, (float) 66.6667 ), - new CoordRec((float) 33.3334, (float) 0 ), -}; - -static final CoordRec char114_stroke1[] = { - new CoordRec((float) 33.3334, (float) 38.0952 ), - new CoordRec((float) 38.0953, (float) 52.381 ), - new CoordRec((float) 47.6191, (float) 61.9048 ), - new CoordRec((float) 57.1429, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 66.6667 ), -}; - -static final StrokeRec char114[] = { - new StrokeRec( 2, char114_stroke0 ), - new StrokeRec( 5, char114_stroke1 ), -}; - -/* char: 115 's' */ - -static final CoordRec char115_stroke0[] = { - new CoordRec((float) 78.5715, (float) 52.381 ), - new CoordRec((float) 73.8095, (float) 61.9048 ), - new CoordRec((float) 59.5238, (float) 66.6667 ), - new CoordRec((float) 45.2381, (float) 66.6667 ), - new CoordRec((float) 30.9524, (float) 61.9048 ), - new CoordRec((float) 26.1905, (float) 52.381 ), - new CoordRec((float) 30.9524, (float) 42.8571 ), - new CoordRec((float) 40.4762, (float) 38.0952 ), - new CoordRec((float) 64.2857, (float) 33.3333 ), - new CoordRec((float) 73.8095, (float) 28.5714 ), - new CoordRec((float) 78.5715, (float) 19.0476 ), - new CoordRec((float) 78.5715, (float) 14.2857 ), - new CoordRec((float) 73.8095, (float) 4.7619 ), - new CoordRec((float) 59.5238, (float) 0 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 30.9524, (float) 4.7619 ), - new CoordRec((float) 26.1905, (float) 14.2857 ), -}; - -static final StrokeRec char115[] = { - new StrokeRec( 17, char115_stroke0 ), -}; - -/* char: 116 't' */ - -static final CoordRec char116_stroke0[] = { - new CoordRec((float) 47.6191, (float) 100 ), - new CoordRec((float) 47.6191, (float) 19.0476 ), - new CoordRec((float) 52.381, (float) 4.7619 ), - new CoordRec((float) 61.9048, (float) 0 ), - new CoordRec((float) 71.4286, (float) 0 ), -}; - -static final CoordRec char116_stroke1[] = { - new CoordRec((float) 33.3334, (float) 66.6667 ), - new CoordRec((float) 66.6667, (float) 66.6667 ), -}; - -static final StrokeRec char116[] = { - new StrokeRec( 5, char116_stroke0 ), - new StrokeRec( 2, char116_stroke1 ), -}; - -/* char: 117 'u' */ - -static final CoordRec char117_stroke0[] = { - new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 19.0476 ), - new CoordRec((float) 30.9524, (float) 4.7619 ), - new CoordRec((float) 40.4762, (float) 0 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 64.2857, (float) 4.7619 ), - new CoordRec((float) 78.5715, (float) 19.0476 ), -}; - -static final CoordRec char117_stroke1[] = { - new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 0 ), -}; - -static final StrokeRec char117[] = { - new StrokeRec( 7, char117_stroke0 ), - new StrokeRec( 2, char117_stroke1 ), -}; - -/* char: 118 'v' */ - -static final CoordRec char118_stroke0[] = { - new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final CoordRec char118_stroke1[] = { - new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 52.3809, (float) 0 ), -}; - -static final StrokeRec char118[] = { - new StrokeRec( 2, char118_stroke0 ), - new StrokeRec( 2, char118_stroke1 ), -}; - -/* char: 119 'w' */ - -static final CoordRec char119_stroke0[] = { - new CoordRec((float) 14.2857, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 0 ), -}; - -static final CoordRec char119_stroke1[] = { - new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 0 ), -}; - -static final CoordRec char119_stroke2[] = { - new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 0 ), -}; - -static final CoordRec char119_stroke3[] = { - new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 0 ), -}; - -static final StrokeRec char119[] = { - new StrokeRec( 2, char119_stroke0 ), - new StrokeRec( 2, char119_stroke1 ), - new StrokeRec( 2, char119_stroke2 ), - new StrokeRec( 2, char119_stroke3 ), -}; - -/* char: 120 'x' */ - -static final CoordRec char120_stroke0[] = { - new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 0 ), -}; - -static final CoordRec char120_stroke1[] = { - new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), -}; - -static final StrokeRec char120[] = { - new StrokeRec( 2, char120_stroke0 ), - new StrokeRec( 2, char120_stroke1 ), -}; - -/* char: 121 'y' */ - -static final CoordRec char121_stroke0[] = { - new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 54.7619, (float) 0 ), -}; - -static final CoordRec char121_stroke1[] = { - new CoordRec((float) 83.3334, (float) 66.6667 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 45.2381, (float) -19.0476 ), - new CoordRec((float) 35.7143, (float) -28.5714 ), - new CoordRec((float) 26.1905, (float) -33.3333 ), - new CoordRec((float) 21.4286, (float) -33.3333 ), -}; - -static final StrokeRec char121[] = { - new StrokeRec( 2, char121_stroke0 ), - new StrokeRec( 6, char121_stroke1 ), -}; - -/* char: 122 'z' */ - -static final CoordRec char122_stroke0[] = { - new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), -}; - -static final CoordRec char122_stroke1[] = { - new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 66.6667 ), -}; - -static final CoordRec char122_stroke2[] = { - new CoordRec((float) 26.1905, (float) 0 ), - new CoordRec((float) 78.5715, (float) 0 ), -}; - -static final StrokeRec char122[] = { - new StrokeRec( 2, char122_stroke0 ), - new StrokeRec( 2, char122_stroke1 ), - new StrokeRec( 2, char122_stroke2 ), -}; - -/* char: 123 '{' */ - -static final CoordRec char123_stroke0[] = { - new CoordRec((float) 64.2857, (float) 119.048 ), - new CoordRec((float) 54.7619, (float) 114.286 ), - new CoordRec((float) 50, (float) 109.524 ), - new CoordRec((float) 45.2381, (float) 100 ), - new CoordRec((float) 45.2381, (float) 90.4762 ), - new CoordRec((float) 50, (float) 80.9524 ), - new CoordRec((float) 54.7619, (float) 76.1905 ), - new CoordRec((float) 59.5238, (float) 66.6667 ), - new CoordRec((float) 59.5238, (float) 57.1429 ), - new CoordRec((float) 50, (float) 47.619 ), -}; - -static final CoordRec char123_stroke1[] = { - new CoordRec((float) 54.7619, (float) 114.286 ), - new CoordRec((float) 50, (float) 104.762 ), - new CoordRec((float) 50, (float) 95.2381 ), - new CoordRec((float) 54.7619, (float) 85.7143 ), - new CoordRec((float) 59.5238, (float) 80.9524 ), - new CoordRec((float) 64.2857, (float) 71.4286 ), - new CoordRec((float) 64.2857, (float) 61.9048 ), - new CoordRec((float) 59.5238, (float) 52.381 ), - new CoordRec((float) 40.4762, (float) 42.8571 ), - new CoordRec((float) 59.5238, (float) 33.3333 ), - new CoordRec((float) 64.2857, (float) 23.8095 ), - new CoordRec((float) 64.2857, (float) 14.2857 ), - new CoordRec((float) 59.5238, (float) 4.7619 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 50, (float) -9.5238 ), - new CoordRec((float) 50, (float) -19.0476 ), - new CoordRec((float) 54.7619, (float) -28.5714 ), -}; - -static final CoordRec char123_stroke2[] = { - new CoordRec((float) 50, (float) 38.0952 ), - new CoordRec((float) 59.5238, (float) 28.5714 ), - new CoordRec((float) 59.5238, (float) 19.0476 ), - new CoordRec((float) 54.7619, (float) 9.5238 ), - new CoordRec((float) 50, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) -4.7619 ), - new CoordRec((float) 45.2381, (float) -14.2857 ), - new CoordRec((float) 50, (float) -23.8095 ), - new CoordRec((float) 54.7619, (float) -28.5714 ), - new CoordRec((float) 64.2857, (float) -33.3333 ), -}; - -static final StrokeRec char123[] = { - new StrokeRec( 10, char123_stroke0 ), - new StrokeRec( 17, char123_stroke1 ), - new StrokeRec( 10, char123_stroke2 ), -}; - -/* char: 124 '|' */ - -static final CoordRec char124_stroke0[] = { - new CoordRec((float) 52.381, (float) 119.048 ), - new CoordRec((float) 52.381, (float) -33.3333 ), -}; - -static final StrokeRec char124[] = { - new StrokeRec( 2, char124_stroke0 ), -}; - -/* char: 125 '}' */ - -static final CoordRec char125_stroke0[] = { - new CoordRec((float) 40.4762, (float) 119.048 ), - new CoordRec((float) 50, (float) 114.286 ), - new CoordRec((float) 54.7619, (float) 109.524 ), - new CoordRec((float) 59.5238, (float) 100 ), - new CoordRec((float) 59.5238, (float) 90.4762 ), - new CoordRec((float) 54.7619, (float) 80.9524 ), - new CoordRec((float) 50, (float) 76.1905 ), - new CoordRec((float) 45.2381, (float) 66.6667 ), - new CoordRec((float) 45.2381, (float) 57.1429 ), - new CoordRec((float) 54.7619, (float) 47.619 ), -}; - -static final CoordRec char125_stroke1[] = { - new CoordRec((float) 50, (float) 114.286 ), - new CoordRec((float) 54.7619, (float) 104.762 ), - new CoordRec((float) 54.7619, (float) 95.2381 ), - new CoordRec((float) 50, (float) 85.7143 ), - new CoordRec((float) 45.2381, (float) 80.9524 ), - new CoordRec((float) 40.4762, (float) 71.4286 ), - new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 45.2381, (float) 52.381 ), - new CoordRec((float) 64.2857, (float) 42.8571 ), - new CoordRec((float) 45.2381, (float) 33.3333 ), - new CoordRec((float) 40.4762, (float) 23.8095 ), - new CoordRec((float) 40.4762, (float) 14.2857 ), - new CoordRec((float) 45.2381, (float) 4.7619 ), - new CoordRec((float) 50, (float) 0 ), - new CoordRec((float) 54.7619, (float) -9.5238 ), - new CoordRec((float) 54.7619, (float) -19.0476 ), - new CoordRec((float) 50, (float) -28.5714 ), -}; - -static final CoordRec char125_stroke2[] = { - new CoordRec((float) 54.7619, (float) 38.0952 ), - new CoordRec((float) 45.2381, (float) 28.5714 ), - new CoordRec((float) 45.2381, (float) 19.0476 ), - new CoordRec((float) 50, (float) 9.5238 ), - new CoordRec((float) 54.7619, (float) 4.7619 ), - new CoordRec((float) 59.5238, (float) -4.7619 ), - new CoordRec((float) 59.5238, (float) -14.2857 ), - new CoordRec((float) 54.7619, (float) -23.8095 ), - new CoordRec((float) 50, (float) -28.5714 ), - new CoordRec((float) 40.4762, (float) -33.3333 ), -}; - -static final StrokeRec char125[] = { - new StrokeRec( 10, char125_stroke0 ), - new StrokeRec( 17, char125_stroke1 ), - new StrokeRec( 10, char125_stroke2 ), -}; - -/* char: 126 '~' */ - -static final CoordRec char126_stroke0[] = { - new CoordRec((float) 9.5238, (float) 28.5714 ), - new CoordRec((float) 9.5238, (float) 38.0952 ), - new CoordRec((float) 14.2857, (float) 52.381 ), - new CoordRec((float) 23.8095, (float) 57.1429 ), - new CoordRec((float) 33.3333, (float) 57.1429 ), - new CoordRec((float) 42.8571, (float) 52.381 ), - new CoordRec((float) 61.9048, (float) 38.0952 ), - new CoordRec((float) 71.4286, (float) 33.3333 ), - new CoordRec((float) 80.9524, (float) 33.3333 ), - new CoordRec((float) 90.4762, (float) 38.0952 ), - new CoordRec((float) 95.2381, (float) 47.619 ), -}; - -static final CoordRec char126_stroke1[] = { - new CoordRec((float) 9.5238, (float) 38.0952 ), - new CoordRec((float) 14.2857, (float) 47.619 ), - new CoordRec((float) 23.8095, (float) 52.381 ), - new CoordRec((float) 33.3333, (float) 52.381 ), - new CoordRec((float) 42.8571, (float) 47.619 ), - new CoordRec((float) 61.9048, (float) 33.3333 ), - new CoordRec((float) 71.4286, (float) 28.5714 ), - new CoordRec((float) 80.9524, (float) 28.5714 ), - new CoordRec((float) 90.4762, (float) 33.3333 ), - new CoordRec((float) 95.2381, (float) 47.619 ), - new CoordRec((float) 95.2381, (float) 57.1429 ), -}; - -static final StrokeRec char126[] = { - new StrokeRec( 11, char126_stroke0 ), - new StrokeRec( 11, char126_stroke1 ), -}; - -/* char: 127 */ - -static final CoordRec char127_stroke0[] = { - new CoordRec((float) 71.4286, (float) 100 ), - new CoordRec((float) 33.3333, (float) -33.3333 ), -}; - -static final CoordRec char127_stroke1[] = { - new CoordRec((float) 47.619, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 61.9048 ), - new CoordRec((float) 23.8095, (float) 52.381 ), - new CoordRec((float) 19.0476, (float) 38.0952 ), - new CoordRec((float) 19.0476, (float) 23.8095 ), - new CoordRec((float) 23.8095, (float) 14.2857 ), - new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 80.9524, (float) 14.2857 ), - new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 85.7143, (float) 42.8571 ), - new CoordRec((float) 80.9524, (float) 52.381 ), - new CoordRec((float) 71.4286, (float) 61.9048 ), - new CoordRec((float) 57.1428, (float) 66.6667 ), - new CoordRec((float) 47.619, (float) 66.6667 ), -}; - -static final StrokeRec char127[] = { - new StrokeRec( 2, char127_stroke0 ), - new StrokeRec( 17, char127_stroke1 ), -}; - -static final StrokeCharRec chars[] = { - new StrokeCharRec(0, /* char0 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char1 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char2 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char3 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char4 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char5 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char6 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char7 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char8 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char9 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char10 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char11 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char12 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char13 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char14 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char15 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char16 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char17 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char18 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char19 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char20 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char21 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char22 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char23 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char24 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char25 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char26 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char27 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char28 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char29 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char30 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char31 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char32 */ null, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char33, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char34, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char35, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char36, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char37, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char38, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char39, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char40, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char41, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char42, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char43, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char44, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char45, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char46, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char47, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char48, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char49, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char50, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char51, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char52, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char53, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char54, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char55, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char56, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char57, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char58, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char59, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char60, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char61, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char62, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char63, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char64, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char65, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char66, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char67, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char68, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char69, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char70, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char71, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char72, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char73, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char74, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char75, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char76, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char77, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char78, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char79, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char80, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char81, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char82, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char83, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char84, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char85, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char86, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char87, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char88, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char89, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char90, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char91, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char92, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char93, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char94, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char95, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char96, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char97, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char98, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char99, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char100, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char101, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char102, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char103, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char104, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char105, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char106, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char107, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char108, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char109, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char110, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char111, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char112, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char113, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char114, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char115, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char116, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char117, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char118, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(4, char119, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char120, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char121, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char122, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char123, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(1, char124, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(3, char125, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char126, (float) 52.381, (float) 104.762 ), - new StrokeCharRec(2, char127, (float) 52.381, (float) 104.762 ), -}; - -static final StrokeFontRec glutStrokeMonoRoman = new StrokeFontRec( "Roman", 128, chars, (float) 119.048, (float) -33.3333 ); -} diff --git a/src/net/java/games/jogl/util/GLUTStrokeRoman.java b/src/net/java/games/jogl/util/GLUTStrokeRoman.java deleted file mode 100644 index 2755b8dfc..000000000 --- a/src/net/java/games/jogl/util/GLUTStrokeRoman.java +++ /dev/null @@ -1,2491 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -class GLUTStrokeRoman { - -/* GENERATED FILE -- DO NOT MODIFY */ - -/* char: 33 '!' */ - -static final CoordRec char33_stroke0[] = { - new CoordRec((float) 13.3819, (float) 100), - new CoordRec((float) 13.3819, (float) 33.3333), -}; - -static final CoordRec char33_stroke1[] = { - new CoordRec((float) 13.3819, (float) 9.5238), - new CoordRec((float) 8.62, (float) 4.7619), - new CoordRec((float) 13.3819, (float) 0), - new CoordRec((float) 18.1438, (float) 4.7619), - new CoordRec((float) 13.3819, (float) 9.5238), -}; - -static final StrokeRec char33[] = { - new StrokeRec(2, char33_stroke0), - new StrokeRec(5, char33_stroke1), -}; - -/* char: 34 '"' */ - -static final CoordRec char34_stroke0[] = { - new CoordRec((float) 4.02, (float) 100), - new CoordRec((float) 4.02, (float) 66.6667), -}; - -static final CoordRec char34_stroke1[] = { - new CoordRec((float) 42.1152, (float) 100), - new CoordRec((float) 42.1152, (float) 66.6667), -}; - -static final StrokeRec char34[] = { - new StrokeRec(2, char34_stroke0), - new StrokeRec(2, char34_stroke1), -}; - -/* char: 35 '#' */ - -static final CoordRec char35_stroke0[] = { - new CoordRec((float) 41.2952, (float) 119.048), - new CoordRec((float) 7.9619, (float) -33.3333), -}; - -static final CoordRec char35_stroke1[] = { - new CoordRec((float) 69.8667, (float) 119.048), - new CoordRec((float) 36.5333, (float) -33.3333), -}; - -static final CoordRec char35_stroke2[] = { - new CoordRec((float) 7.9619, (float) 57.1429), - new CoordRec((float) 74.6286, (float) 57.1429), -}; - -static final CoordRec char35_stroke3[] = { - new CoordRec((float) 3.2, (float) 28.5714), - new CoordRec((float) 69.8667, (float) 28.5714), -}; - -static final StrokeRec char35[] = { - new StrokeRec(2, char35_stroke0), - new StrokeRec(2, char35_stroke1), - new StrokeRec(2, char35_stroke2), - new StrokeRec(2, char35_stroke3), -}; - -/* char: 36 '$' */ - -static final CoordRec char36_stroke0[] = { - new CoordRec((float) 28.6295, (float) 119.048), - new CoordRec((float) 28.6295, (float) -19.0476), -}; - -static final CoordRec char36_stroke1[] = { - new CoordRec((float) 47.6771, (float) 119.048), - new CoordRec((float) 47.6771, (float) -19.0476), -}; - -static final CoordRec char36_stroke2[] = { - new CoordRec((float) 71.4867, (float) 85.7143), - new CoordRec((float) 61.9629, (float) 95.2381), - new CoordRec((float) 47.6771, (float) 100), - new CoordRec((float) 28.6295, (float) 100), - new CoordRec((float) 14.3438, (float) 95.2381), - new CoordRec((float) 4.82, (float) 85.7143), - new CoordRec((float) 4.82, (float) 76.1905), - new CoordRec((float) 9.5819, (float) 66.6667), - new CoordRec((float) 14.3438, (float) 61.9048), - new CoordRec((float) 23.8676, (float) 57.1429), - new CoordRec((float) 52.439, (float) 47.619), - new CoordRec((float) 61.9629, (float) 42.8571), - new CoordRec((float) 66.7248, (float) 38.0952), - new CoordRec((float) 71.4867, (float) 28.5714), - new CoordRec((float) 71.4867, (float) 14.2857), - new CoordRec((float) 61.9629, (float) 4.7619), - new CoordRec((float) 47.6771, (float) 0), - new CoordRec((float) 28.6295, (float) 0), - new CoordRec((float) 14.3438, (float) 4.7619), - new CoordRec((float) 4.82, (float) 14.2857), -}; - -static final StrokeRec char36[] = { - new StrokeRec(2, char36_stroke0), - new StrokeRec(2, char36_stroke1), - new StrokeRec(20, char36_stroke2), -}; - -/* char: 37 '%' */ - -static final CoordRec char37_stroke0[] = { - new CoordRec((float) 92.0743, (float) 100), - new CoordRec((float) 6.36, (float) 0), -}; - -static final CoordRec char37_stroke1[] = { - new CoordRec((float) 30.1695, (float) 100), - new CoordRec((float) 39.6933, (float) 90.4762), - new CoordRec((float) 39.6933, (float) 80.9524), - new CoordRec((float) 34.9314, (float) 71.4286), - new CoordRec((float) 25.4076, (float) 66.6667), - new CoordRec((float) 15.8838, (float) 66.6667), - new CoordRec((float) 6.36, (float) 76.1905), - new CoordRec((float) 6.36, (float) 85.7143), - new CoordRec((float) 11.1219, (float) 95.2381), - new CoordRec((float) 20.6457, (float) 100), - new CoordRec((float) 30.1695, (float) 100), - new CoordRec((float) 39.6933, (float) 95.2381), - new CoordRec((float) 53.979, (float) 90.4762), - new CoordRec((float) 68.2648, (float) 90.4762), - new CoordRec((float) 82.5505, (float) 95.2381), - new CoordRec((float) 92.0743, (float) 100), -}; - -static final CoordRec char37_stroke2[] = { - new CoordRec((float) 73.0267, (float) 33.3333), - new CoordRec((float) 63.5029, (float) 28.5714), - new CoordRec((float) 58.741, (float) 19.0476), - new CoordRec((float) 58.741, (float) 9.5238), - new CoordRec((float) 68.2648, (float) 0), - new CoordRec((float) 77.7886, (float) 0), - new CoordRec((float) 87.3124, (float) 4.7619), - new CoordRec((float) 92.0743, (float) 14.2857), - new CoordRec((float) 92.0743, (float) 23.8095), - new CoordRec((float) 82.5505, (float) 33.3333), - new CoordRec((float) 73.0267, (float) 33.3333), -}; - -static final StrokeRec char37[] = { - new StrokeRec(2, char37_stroke0), - new StrokeRec(16, char37_stroke1), - new StrokeRec(11, char37_stroke2), -}; - -/* char: 38 '&' */ - -static final CoordRec char38_stroke0[] = { - new CoordRec((float) 101.218, (float) 57.1429), - new CoordRec((float) 101.218, (float) 61.9048), - new CoordRec((float) 96.4562, (float) 66.6667), - new CoordRec((float) 91.6943, (float) 66.6667), - new CoordRec((float) 86.9324, (float) 61.9048), - new CoordRec((float) 82.1705, (float) 52.381), - new CoordRec((float) 72.6467, (float) 28.5714), - new CoordRec((float) 63.1229, (float) 14.2857), - new CoordRec((float) 53.599, (float) 4.7619), - new CoordRec((float) 44.0752, (float) 0), - new CoordRec((float) 25.0276, (float) 0), - new CoordRec((float) 15.5038, (float) 4.7619), - new CoordRec((float) 10.7419, (float) 9.5238), - new CoordRec((float) 5.98, (float) 19.0476), - new CoordRec((float) 5.98, (float) 28.5714), - new CoordRec((float) 10.7419, (float) 38.0952), - new CoordRec((float) 15.5038, (float) 42.8571), - new CoordRec((float) 48.8371, (float) 61.9048), - new CoordRec((float) 53.599, (float) 66.6667), - new CoordRec((float) 58.361, (float) 76.1905), - new CoordRec((float) 58.361, (float) 85.7143), - new CoordRec((float) 53.599, (float) 95.2381), - new CoordRec((float) 44.0752, (float) 100), - new CoordRec((float) 34.5514, (float) 95.2381), - new CoordRec((float) 29.7895, (float) 85.7143), - new CoordRec((float) 29.7895, (float) 76.1905), - new CoordRec((float) 34.5514, (float) 61.9048), - new CoordRec((float) 44.0752, (float) 47.619), - new CoordRec((float) 67.8848, (float) 14.2857), - new CoordRec((float) 77.4086, (float) 4.7619), - new CoordRec((float) 86.9324, (float) 0), - new CoordRec((float) 96.4562, (float) 0), - new CoordRec((float) 101.218, (float) 4.7619), - new CoordRec((float) 101.218, (float) 9.5238), -}; - -static final StrokeRec char38[] = { - new StrokeRec(34, char38_stroke0), -}; - -/* char: 39 ''' */ - -static final CoordRec char39_stroke0[] = { - new CoordRec((float) 4.44, (float) 100), - new CoordRec((float) 4.44, (float) 66.6667), -}; - -static final StrokeRec char39[] = { - new StrokeRec(2, char39_stroke0), -}; - -/* char: 40 '(' */ - -static final CoordRec char40_stroke0[] = { - new CoordRec((float) 40.9133, (float) 119.048), - new CoordRec((float) 31.3895, (float) 109.524), - new CoordRec((float) 21.8657, (float) 95.2381), - new CoordRec((float) 12.3419, (float) 76.1905), - new CoordRec((float) 7.58, (float) 52.381), - new CoordRec((float) 7.58, (float) 33.3333), - new CoordRec((float) 12.3419, (float) 9.5238), - new CoordRec((float) 21.8657, (float) -9.5238), - new CoordRec((float) 31.3895, (float) -23.8095), - new CoordRec((float) 40.9133, (float) -33.3333), -}; - -static final StrokeRec char40[] = { - new StrokeRec(10, char40_stroke0), -}; - -/* char: 41 ')' */ - -static final CoordRec char41_stroke0[] = { - new CoordRec((float) 5.28, (float) 119.048), - new CoordRec((float) 14.8038, (float) 109.524), - new CoordRec((float) 24.3276, (float) 95.2381), - new CoordRec((float) 33.8514, (float) 76.1905), - new CoordRec((float) 38.6133, (float) 52.381), - new CoordRec((float) 38.6133, (float) 33.3333), - new CoordRec((float) 33.8514, (float) 9.5238), - new CoordRec((float) 24.3276, (float) -9.5238), - new CoordRec((float) 14.8038, (float) -23.8095), - new CoordRec((float) 5.28, (float) -33.3333), -}; - -static final StrokeRec char41[] = { - new StrokeRec(10, char41_stroke0), -}; - -/* char: 42 '*' */ - -static final CoordRec char42_stroke0[] = { - new CoordRec((float) 30.7695, (float) 71.4286), - new CoordRec((float) 30.7695, (float) 14.2857), -}; - -static final CoordRec char42_stroke1[] = { - new CoordRec((float) 6.96, (float) 57.1429), - new CoordRec((float) 54.579, (float) 28.5714), -}; - -static final CoordRec char42_stroke2[] = { - new CoordRec((float) 54.579, (float) 57.1429), - new CoordRec((float) 6.96, (float) 28.5714), -}; - -static final StrokeRec char42[] = { - new StrokeRec(2, char42_stroke0), - new StrokeRec(2, char42_stroke1), - new StrokeRec(2, char42_stroke2), -}; - -/* char: 43 '+' */ - -static final CoordRec char43_stroke0[] = { - new CoordRec((float) 48.8371, (float) 85.7143), - new CoordRec((float) 48.8371, (float) 0), -}; - -static final CoordRec char43_stroke1[] = { - new CoordRec((float) 5.98, (float) 42.8571), - new CoordRec((float) 91.6943, (float) 42.8571), -}; - -static final StrokeRec char43[] = { - new StrokeRec(2, char43_stroke0), - new StrokeRec(2, char43_stroke1), -}; - -/* char: 44 ',' */ - -static final CoordRec char44_stroke0[] = { - new CoordRec((float) 18.2838, (float) 4.7619), - new CoordRec((float) 13.5219, (float) 0), - new CoordRec((float) 8.76, (float) 4.7619), - new CoordRec((float) 13.5219, (float) 9.5238), - new CoordRec((float) 18.2838, (float) 4.7619), - new CoordRec((float) 18.2838, (float) -4.7619), - new CoordRec((float) 13.5219, (float) -14.2857), - new CoordRec((float) 8.76, (float) -19.0476), -}; - -static final StrokeRec char44[] = { - new StrokeRec(8, char44_stroke0), -}; - -/* char: 45 '-' */ - -static final CoordRec char45_stroke0[] = { - new CoordRec((float) 7.38, (float) 42.8571), - new CoordRec((float) 93.0943, (float) 42.8571), -}; - -static final StrokeRec char45[] = { - new StrokeRec(2, char45_stroke0), -}; - -/* char: 46 '.' */ - -static final CoordRec char46_stroke0[] = { - new CoordRec((float) 13.1019, (float) 9.5238), - new CoordRec((float) 8.34, (float) 4.7619), - new CoordRec((float) 13.1019, (float) 0), - new CoordRec((float) 17.8638, (float) 4.7619), - new CoordRec((float) 13.1019, (float) 9.5238), -}; - -static final StrokeRec char46[] = { - new StrokeRec(5, char46_stroke0), -}; - -/* char: 47 '/' */ - -static final CoordRec char47_stroke0[] = { - new CoordRec((float) 7.24, (float) -14.2857), - new CoordRec((float) 73.9067, (float) 100), -}; - -static final StrokeRec char47[] = { - new StrokeRec(2, char47_stroke0), -}; - -/* char: 48 '0' */ - -static final CoordRec char48_stroke0[] = { - new CoordRec((float) 33.5514, (float) 100), - new CoordRec((float) 19.2657, (float) 95.2381), - new CoordRec((float) 9.7419, (float) 80.9524), - new CoordRec((float) 4.98, (float) 57.1429), - new CoordRec((float) 4.98, (float) 42.8571), - new CoordRec((float) 9.7419, (float) 19.0476), - new CoordRec((float) 19.2657, (float) 4.7619), - new CoordRec((float) 33.5514, (float) 0), - new CoordRec((float) 43.0752, (float) 0), - new CoordRec((float) 57.361, (float) 4.7619), - new CoordRec((float) 66.8848, (float) 19.0476), - new CoordRec((float) 71.6467, (float) 42.8571), - new CoordRec((float) 71.6467, (float) 57.1429), - new CoordRec((float) 66.8848, (float) 80.9524), - new CoordRec((float) 57.361, (float) 95.2381), - new CoordRec((float) 43.0752, (float) 100), - new CoordRec((float) 33.5514, (float) 100), -}; - -static final StrokeRec char48[] = { - new StrokeRec(17, char48_stroke0), -}; - -/* char: 49 '1' */ - -static final CoordRec char49_stroke0[] = { - new CoordRec((float) 11.82, (float) 80.9524), - new CoordRec((float) 21.3438, (float) 85.7143), - new CoordRec((float) 35.6295, (float) 100), - new CoordRec((float) 35.6295, (float) 0), -}; - -static final StrokeRec char49[] = { - new StrokeRec(4, char49_stroke0), -}; - -/* char: 50 '2' */ - -static final CoordRec char50_stroke0[] = { - new CoordRec((float) 10.1819, (float) 76.1905), - new CoordRec((float) 10.1819, (float) 80.9524), - new CoordRec((float) 14.9438, (float) 90.4762), - new CoordRec((float) 19.7057, (float) 95.2381), - new CoordRec((float) 29.2295, (float) 100), - new CoordRec((float) 48.2771, (float) 100), - new CoordRec((float) 57.801, (float) 95.2381), - new CoordRec((float) 62.5629, (float) 90.4762), - new CoordRec((float) 67.3248, (float) 80.9524), - new CoordRec((float) 67.3248, (float) 71.4286), - new CoordRec((float) 62.5629, (float) 61.9048), - new CoordRec((float) 53.039, (float) 47.619), - new CoordRec((float) 5.42, (float) 0), - new CoordRec((float) 72.0867, (float) 0), -}; - -static final StrokeRec char50[] = { - new StrokeRec(14, char50_stroke0), -}; - -/* char: 51 '3' */ - -static final CoordRec char51_stroke0[] = { - new CoordRec((float) 14.5238, (float) 100), - new CoordRec((float) 66.9048, (float) 100), - new CoordRec((float) 38.3333, (float) 61.9048), - new CoordRec((float) 52.619, (float) 61.9048), - new CoordRec((float) 62.1429, (float) 57.1429), - new CoordRec((float) 66.9048, (float) 52.381), - new CoordRec((float) 71.6667, (float) 38.0952), - new CoordRec((float) 71.6667, (float) 28.5714), - new CoordRec((float) 66.9048, (float) 14.2857), - new CoordRec((float) 57.381, (float) 4.7619), - new CoordRec((float) 43.0952, (float) 0), - new CoordRec((float) 28.8095, (float) 0), - new CoordRec((float) 14.5238, (float) 4.7619), - new CoordRec((float) 9.7619, (float) 9.5238), - new CoordRec((float) 5, (float) 19.0476), -}; - -static final StrokeRec char51[] = { - new StrokeRec(15, char51_stroke0), -}; - -/* char: 52 '4' */ - -static final CoordRec char52_stroke0[] = { - new CoordRec((float) 51.499, (float) 100), - new CoordRec((float) 3.88, (float) 33.3333), - new CoordRec((float) 75.3086, (float) 33.3333), -}; - -static final CoordRec char52_stroke1[] = { - new CoordRec((float) 51.499, (float) 100), - new CoordRec((float) 51.499, (float) 0), -}; - -static final StrokeRec char52[] = { - new StrokeRec(3, char52_stroke0), - new StrokeRec(2, char52_stroke1), -}; - -/* char: 53 '5' */ - -static final CoordRec char53_stroke0[] = { - new CoordRec((float) 62.0029, (float) 100), - new CoordRec((float) 14.3838, (float) 100), - new CoordRec((float) 9.6219, (float) 57.1429), - new CoordRec((float) 14.3838, (float) 61.9048), - new CoordRec((float) 28.6695, (float) 66.6667), - new CoordRec((float) 42.9552, (float) 66.6667), - new CoordRec((float) 57.241, (float) 61.9048), - new CoordRec((float) 66.7648, (float) 52.381), - new CoordRec((float) 71.5267, (float) 38.0952), - new CoordRec((float) 71.5267, (float) 28.5714), - new CoordRec((float) 66.7648, (float) 14.2857), - new CoordRec((float) 57.241, (float) 4.7619), - new CoordRec((float) 42.9552, (float) 0), - new CoordRec((float) 28.6695, (float) 0), - new CoordRec((float) 14.3838, (float) 4.7619), - new CoordRec((float) 9.6219, (float) 9.5238), - new CoordRec((float) 4.86, (float) 19.0476), -}; - -static final StrokeRec char53[] = { - new StrokeRec(17, char53_stroke0), -}; - -/* char: 54 '6' */ - -static final CoordRec char54_stroke0[] = { - new CoordRec((float) 62.7229, (float) 85.7143), - new CoordRec((float) 57.961, (float) 95.2381), - new CoordRec((float) 43.6752, (float) 100), - new CoordRec((float) 34.1514, (float) 100), - new CoordRec((float) 19.8657, (float) 95.2381), - new CoordRec((float) 10.3419, (float) 80.9524), - new CoordRec((float) 5.58, (float) 57.1429), - new CoordRec((float) 5.58, (float) 33.3333), - new CoordRec((float) 10.3419, (float) 14.2857), - new CoordRec((float) 19.8657, (float) 4.7619), - new CoordRec((float) 34.1514, (float) 0), - new CoordRec((float) 38.9133, (float) 0), - new CoordRec((float) 53.199, (float) 4.7619), - new CoordRec((float) 62.7229, (float) 14.2857), - new CoordRec((float) 67.4848, (float) 28.5714), - new CoordRec((float) 67.4848, (float) 33.3333), - new CoordRec((float) 62.7229, (float) 47.619), - new CoordRec((float) 53.199, (float) 57.1429), - new CoordRec((float) 38.9133, (float) 61.9048), - new CoordRec((float) 34.1514, (float) 61.9048), - new CoordRec((float) 19.8657, (float) 57.1429), - new CoordRec((float) 10.3419, (float) 47.619), - new CoordRec((float) 5.58, (float) 33.3333), -}; - -static final StrokeRec char54[] = { - new StrokeRec(23, char54_stroke0), -}; - -/* char: 55 '7' */ - -static final CoordRec char55_stroke0[] = { - new CoordRec((float) 72.2267, (float) 100), - new CoordRec((float) 24.6076, (float) 0), -}; - -static final CoordRec char55_stroke1[] = { - new CoordRec((float) 5.56, (float) 100), - new CoordRec((float) 72.2267, (float) 100), -}; - -static final StrokeRec char55[] = { - new StrokeRec(2, char55_stroke0), - new StrokeRec(2, char55_stroke1), -}; - -/* char: 56 '8' */ - -static final CoordRec char56_stroke0[] = { - new CoordRec((float) 29.4095, (float) 100), - new CoordRec((float) 15.1238, (float) 95.2381), - new CoordRec((float) 10.3619, (float) 85.7143), - new CoordRec((float) 10.3619, (float) 76.1905), - new CoordRec((float) 15.1238, (float) 66.6667), - new CoordRec((float) 24.6476, (float) 61.9048), - new CoordRec((float) 43.6952, (float) 57.1429), - new CoordRec((float) 57.981, (float) 52.381), - new CoordRec((float) 67.5048, (float) 42.8571), - new CoordRec((float) 72.2667, (float) 33.3333), - new CoordRec((float) 72.2667, (float) 19.0476), - new CoordRec((float) 67.5048, (float) 9.5238), - new CoordRec((float) 62.7429, (float) 4.7619), - new CoordRec((float) 48.4571, (float) 0), - new CoordRec((float) 29.4095, (float) 0), - new CoordRec((float) 15.1238, (float) 4.7619), - new CoordRec((float) 10.3619, (float) 9.5238), - new CoordRec((float) 5.6, (float) 19.0476), - new CoordRec((float) 5.6, (float) 33.3333), - new CoordRec((float) 10.3619, (float) 42.8571), - new CoordRec((float) 19.8857, (float) 52.381), - new CoordRec((float) 34.1714, (float) 57.1429), - new CoordRec((float) 53.219, (float) 61.9048), - new CoordRec((float) 62.7429, (float) 66.6667), - new CoordRec((float) 67.5048, (float) 76.1905), - new CoordRec((float) 67.5048, (float) 85.7143), - new CoordRec((float) 62.7429, (float) 95.2381), - new CoordRec((float) 48.4571, (float) 100), - new CoordRec((float) 29.4095, (float) 100), -}; - -static final StrokeRec char56[] = { - new StrokeRec(29, char56_stroke0), -}; - -/* char: 57 '9' */ - -static final CoordRec char57_stroke0[] = { - new CoordRec((float) 68.5048, (float) 66.6667), - new CoordRec((float) 63.7429, (float) 52.381), - new CoordRec((float) 54.219, (float) 42.8571), - new CoordRec((float) 39.9333, (float) 38.0952), - new CoordRec((float) 35.1714, (float) 38.0952), - new CoordRec((float) 20.8857, (float) 42.8571), - new CoordRec((float) 11.3619, (float) 52.381), - new CoordRec((float) 6.6, (float) 66.6667), - new CoordRec((float) 6.6, (float) 71.4286), - new CoordRec((float) 11.3619, (float) 85.7143), - new CoordRec((float) 20.8857, (float) 95.2381), - new CoordRec((float) 35.1714, (float) 100), - new CoordRec((float) 39.9333, (float) 100), - new CoordRec((float) 54.219, (float) 95.2381), - new CoordRec((float) 63.7429, (float) 85.7143), - new CoordRec((float) 68.5048, (float) 66.6667), - new CoordRec((float) 68.5048, (float) 42.8571), - new CoordRec((float) 63.7429, (float) 19.0476), - new CoordRec((float) 54.219, (float) 4.7619), - new CoordRec((float) 39.9333, (float) 0), - new CoordRec((float) 30.4095, (float) 0), - new CoordRec((float) 16.1238, (float) 4.7619), - new CoordRec((float) 11.3619, (float) 14.2857), -}; - -static final StrokeRec char57[] = { - new StrokeRec(23, char57_stroke0), -}; - -/* char: 58 ':' */ - -static final CoordRec char58_stroke0[] = { - new CoordRec((float) 14.0819, (float) 66.6667), - new CoordRec((float) 9.32, (float) 61.9048), - new CoordRec((float) 14.0819, (float) 57.1429), - new CoordRec((float) 18.8438, (float) 61.9048), - new CoordRec((float) 14.0819, (float) 66.6667), -}; - -static final CoordRec char58_stroke1[] = { - new CoordRec((float) 14.0819, (float) 9.5238), - new CoordRec((float) 9.32, (float) 4.7619), - new CoordRec((float) 14.0819, (float) 0), - new CoordRec((float) 18.8438, (float) 4.7619), - new CoordRec((float) 14.0819, (float) 9.5238), -}; - -static final StrokeRec char58[] = { - new StrokeRec(5, char58_stroke0), - new StrokeRec(5, char58_stroke1), -}; - -/* char: 59 ';' */ - -static final CoordRec char59_stroke0[] = { - new CoordRec((float) 12.9619, (float) 66.6667), - new CoordRec((float) 8.2, (float) 61.9048), - new CoordRec((float) 12.9619, (float) 57.1429), - new CoordRec((float) 17.7238, (float) 61.9048), - new CoordRec((float) 12.9619, (float) 66.6667), -}; - -static final CoordRec char59_stroke1[] = { - new CoordRec((float) 17.7238, (float) 4.7619), - new CoordRec((float) 12.9619, (float) 0), - new CoordRec((float) 8.2, (float) 4.7619), - new CoordRec((float) 12.9619, (float) 9.5238), - new CoordRec((float) 17.7238, (float) 4.7619), - new CoordRec((float) 17.7238, (float) -4.7619), - new CoordRec((float) 12.9619, (float) -14.2857), - new CoordRec((float) 8.2, (float) -19.0476), -}; - -static final StrokeRec char59[] = { - new StrokeRec(5, char59_stroke0), - new StrokeRec(8, char59_stroke1), -}; - -/* char: 60 '<' */ - -static final CoordRec char60_stroke0[] = { - new CoordRec((float) 79.2505, (float) 85.7143), - new CoordRec((float) 3.06, (float) 42.8571), - new CoordRec((float) 79.2505, (float) 0), -}; - -static final StrokeRec char60[] = { - new StrokeRec(3, char60_stroke0), -}; - -/* char: 61 '=' */ - -static final CoordRec char61_stroke0[] = { - new CoordRec((float) 5.7, (float) 57.1429), - new CoordRec((float) 91.4143, (float) 57.1429), -}; - -static final CoordRec char61_stroke1[] = { - new CoordRec((float) 5.7, (float) 28.5714), - new CoordRec((float) 91.4143, (float) 28.5714), -}; - -static final StrokeRec char61[] = { - new StrokeRec(2, char61_stroke0), - new StrokeRec(2, char61_stroke1), -}; - -/* char: 62 '>' */ - -static final CoordRec char62_stroke0[] = { - new CoordRec((float) 2.78, (float) 85.7143), - new CoordRec((float) 78.9705, (float) 42.8571), - new CoordRec((float) 2.78, (float) 0), -}; - -static final StrokeRec char62[] = { - new StrokeRec(3, char62_stroke0), -}; - -/* char: 63 '?' */ - -static final CoordRec char63_stroke0[] = { - new CoordRec((float) 8.42, (float) 76.1905), - new CoordRec((float) 8.42, (float) 80.9524), - new CoordRec((float) 13.1819, (float) 90.4762), - new CoordRec((float) 17.9438, (float) 95.2381), - new CoordRec((float) 27.4676, (float) 100), - new CoordRec((float) 46.5152, (float) 100), - new CoordRec((float) 56.039, (float) 95.2381), - new CoordRec((float) 60.801, (float) 90.4762), - new CoordRec((float) 65.5629, (float) 80.9524), - new CoordRec((float) 65.5629, (float) 71.4286), - new CoordRec((float) 60.801, (float) 61.9048), - new CoordRec((float) 56.039, (float) 57.1429), - new CoordRec((float) 36.9914, (float) 47.619), - new CoordRec((float) 36.9914, (float) 33.3333), -}; - -static final CoordRec char63_stroke1[] = { - new CoordRec((float) 36.9914, (float) 9.5238), - new CoordRec((float) 32.2295, (float) 4.7619), - new CoordRec((float) 36.9914, (float) 0), - new CoordRec((float) 41.7533, (float) 4.7619), - new CoordRec((float) 36.9914, (float) 9.5238), -}; - -static final StrokeRec char63[] = { - new StrokeRec(14, char63_stroke0), - new StrokeRec(5, char63_stroke1), -}; - -/* char: 64 '@' */ - -static final CoordRec char64_stroke0[] = { - new CoordRec((float) 49.2171, (float) 52.381), - new CoordRec((float) 39.6933, (float) 57.1429), - new CoordRec((float) 30.1695, (float) 57.1429), - new CoordRec((float) 25.4076, (float) 47.619), - new CoordRec((float) 25.4076, (float) 42.8571), - new CoordRec((float) 30.1695, (float) 33.3333), - new CoordRec((float) 39.6933, (float) 33.3333), - new CoordRec((float) 49.2171, (float) 38.0952), -}; - -static final CoordRec char64_stroke1[] = { - new CoordRec((float) 49.2171, (float) 57.1429), - new CoordRec((float) 49.2171, (float) 38.0952), - new CoordRec((float) 53.979, (float) 33.3333), - new CoordRec((float) 63.5029, (float) 33.3333), - new CoordRec((float) 68.2648, (float) 42.8571), - new CoordRec((float) 68.2648, (float) 47.619), - new CoordRec((float) 63.5029, (float) 61.9048), - new CoordRec((float) 53.979, (float) 71.4286), - new CoordRec((float) 39.6933, (float) 76.1905), - new CoordRec((float) 34.9314, (float) 76.1905), - new CoordRec((float) 20.6457, (float) 71.4286), - new CoordRec((float) 11.1219, (float) 61.9048), - new CoordRec((float) 6.36, (float) 47.619), - new CoordRec((float) 6.36, (float) 42.8571), - new CoordRec((float) 11.1219, (float) 28.5714), - new CoordRec((float) 20.6457, (float) 19.0476), - new CoordRec((float) 34.9314, (float) 14.2857), - new CoordRec((float) 39.6933, (float) 14.2857), - new CoordRec((float) 53.979, (float) 19.0476), -}; - -static final StrokeRec char64[] = { - new StrokeRec(8, char64_stroke0), - new StrokeRec(19, char64_stroke1), -}; - -/* char: 65 'A' */ - -static final CoordRec char65_stroke0[] = { - new CoordRec((float) 40.5952, (float) 100), - new CoordRec((float) 2.5, (float) 0), -}; - -static final CoordRec char65_stroke1[] = { - new CoordRec((float) 40.5952, (float) 100), - new CoordRec((float) 78.6905, (float) 0), -}; - -static final CoordRec char65_stroke2[] = { - new CoordRec((float) 16.7857, (float) 33.3333), - new CoordRec((float) 64.4048, (float) 33.3333), -}; - -static final StrokeRec char65[] = { - new StrokeRec(2, char65_stroke0), - new StrokeRec(2, char65_stroke1), - new StrokeRec(2, char65_stroke2), -}; - -/* char: 66 'B' */ - -static final CoordRec char66_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), -}; - -static final CoordRec char66_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 54.2771, (float) 100), - new CoordRec((float) 68.5629, (float) 95.2381), - new CoordRec((float) 73.3248, (float) 90.4762), - new CoordRec((float) 78.0867, (float) 80.9524), - new CoordRec((float) 78.0867, (float) 71.4286), - new CoordRec((float) 73.3248, (float) 61.9048), - new CoordRec((float) 68.5629, (float) 57.1429), - new CoordRec((float) 54.2771, (float) 52.381), -}; - -static final CoordRec char66_stroke2[] = { - new CoordRec((float) 11.42, (float) 52.381), - new CoordRec((float) 54.2771, (float) 52.381), - new CoordRec((float) 68.5629, (float) 47.619), - new CoordRec((float) 73.3248, (float) 42.8571), - new CoordRec((float) 78.0867, (float) 33.3333), - new CoordRec((float) 78.0867, (float) 19.0476), - new CoordRec((float) 73.3248, (float) 9.5238), - new CoordRec((float) 68.5629, (float) 4.7619), - new CoordRec((float) 54.2771, (float) 0), - new CoordRec((float) 11.42, (float) 0), -}; - -static final StrokeRec char66[] = { - new StrokeRec(2, char66_stroke0), - new StrokeRec(9, char66_stroke1), - new StrokeRec(10, char66_stroke2), -}; - -/* char: 67 'C' */ - -static final CoordRec char67_stroke0[] = { - new CoordRec((float) 78.0886, (float) 76.1905), - new CoordRec((float) 73.3267, (float) 85.7143), - new CoordRec((float) 63.8029, (float) 95.2381), - new CoordRec((float) 54.279, (float) 100), - new CoordRec((float) 35.2314, (float) 100), - new CoordRec((float) 25.7076, (float) 95.2381), - new CoordRec((float) 16.1838, (float) 85.7143), - new CoordRec((float) 11.4219, (float) 76.1905), - new CoordRec((float) 6.66, (float) 61.9048), - new CoordRec((float) 6.66, (float) 38.0952), - new CoordRec((float) 11.4219, (float) 23.8095), - new CoordRec((float) 16.1838, (float) 14.2857), - new CoordRec((float) 25.7076, (float) 4.7619), - new CoordRec((float) 35.2314, (float) 0), - new CoordRec((float) 54.279, (float) 0), - new CoordRec((float) 63.8029, (float) 4.7619), - new CoordRec((float) 73.3267, (float) 14.2857), - new CoordRec((float) 78.0886, (float) 23.8095), -}; - -static final StrokeRec char67[] = { - new StrokeRec(18, char67_stroke0), -}; - -/* char: 68 'D' */ - -static final CoordRec char68_stroke0[] = { - new CoordRec((float) 11.96, (float) 100), - new CoordRec((float) 11.96, (float) 0), -}; - -static final CoordRec char68_stroke1[] = { - new CoordRec((float) 11.96, (float) 100), - new CoordRec((float) 45.2933, (float) 100), - new CoordRec((float) 59.579, (float) 95.2381), - new CoordRec((float) 69.1029, (float) 85.7143), - new CoordRec((float) 73.8648, (float) 76.1905), - new CoordRec((float) 78.6267, (float) 61.9048), - new CoordRec((float) 78.6267, (float) 38.0952), - new CoordRec((float) 73.8648, (float) 23.8095), - new CoordRec((float) 69.1029, (float) 14.2857), - new CoordRec((float) 59.579, (float) 4.7619), - new CoordRec((float) 45.2933, (float) 0), - new CoordRec((float) 11.96, (float) 0), -}; - -static final StrokeRec char68[] = { - new StrokeRec(2, char68_stroke0), - new StrokeRec(12, char68_stroke1), -}; - -/* char: 69 'E' */ - -static final CoordRec char69_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), -}; - -static final CoordRec char69_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 73.3248, (float) 100), -}; - -static final CoordRec char69_stroke2[] = { - new CoordRec((float) 11.42, (float) 52.381), - new CoordRec((float) 49.5152, (float) 52.381), -}; - -static final CoordRec char69_stroke3[] = { - new CoordRec((float) 11.42, (float) 0), - new CoordRec((float) 73.3248, (float) 0), -}; - -static final StrokeRec char69[] = { - new StrokeRec(2, char69_stroke0), - new StrokeRec(2, char69_stroke1), - new StrokeRec(2, char69_stroke2), - new StrokeRec(2, char69_stroke3), -}; - -/* char: 70 'F' */ - -static final CoordRec char70_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), -}; - -static final CoordRec char70_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 73.3248, (float) 100), -}; - -static final CoordRec char70_stroke2[] = { - new CoordRec((float) 11.42, (float) 52.381), - new CoordRec((float) 49.5152, (float) 52.381), -}; - -static final StrokeRec char70[] = { - new StrokeRec(2, char70_stroke0), - new StrokeRec(2, char70_stroke1), - new StrokeRec(2, char70_stroke2), -}; - -/* char: 71 'G' */ - -static final CoordRec char71_stroke0[] = { - new CoordRec((float) 78.4886, (float) 76.1905), - new CoordRec((float) 73.7267, (float) 85.7143), - new CoordRec((float) 64.2029, (float) 95.2381), - new CoordRec((float) 54.679, (float) 100), - new CoordRec((float) 35.6314, (float) 100), - new CoordRec((float) 26.1076, (float) 95.2381), - new CoordRec((float) 16.5838, (float) 85.7143), - new CoordRec((float) 11.8219, (float) 76.1905), - new CoordRec((float) 7.06, (float) 61.9048), - new CoordRec((float) 7.06, (float) 38.0952), - new CoordRec((float) 11.8219, (float) 23.8095), - new CoordRec((float) 16.5838, (float) 14.2857), - new CoordRec((float) 26.1076, (float) 4.7619), - new CoordRec((float) 35.6314, (float) 0), - new CoordRec((float) 54.679, (float) 0), - new CoordRec((float) 64.2029, (float) 4.7619), - new CoordRec((float) 73.7267, (float) 14.2857), - new CoordRec((float) 78.4886, (float) 23.8095), - new CoordRec((float) 78.4886, (float) 38.0952), -}; - -static final CoordRec char71_stroke1[] = { - new CoordRec((float) 54.679, (float) 38.0952), - new CoordRec((float) 78.4886, (float) 38.0952), -}; - -static final StrokeRec char71[] = { - new StrokeRec(19, char71_stroke0), - new StrokeRec(2, char71_stroke1), -}; - -/* char: 72 'H' */ - -static final CoordRec char72_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), -}; - -static final CoordRec char72_stroke1[] = { - new CoordRec((float) 78.0867, (float) 100), - new CoordRec((float) 78.0867, (float) 0), -}; - -static final CoordRec char72_stroke2[] = { - new CoordRec((float) 11.42, (float) 52.381), - new CoordRec((float) 78.0867, (float) 52.381), -}; - -static final StrokeRec char72[] = { - new StrokeRec(2, char72_stroke0), - new StrokeRec(2, char72_stroke1), - new StrokeRec(2, char72_stroke2), -}; - -/* char: 73 'I' */ - -static final CoordRec char73_stroke0[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 10.86, (float) 0), -}; - -static final StrokeRec char73[] = { - new StrokeRec(2, char73_stroke0), -}; - -/* char: 74 'J' */ - -static final CoordRec char74_stroke0[] = { - new CoordRec((float) 50.119, (float) 100), - new CoordRec((float) 50.119, (float) 23.8095), - new CoordRec((float) 45.3571, (float) 9.5238), - new CoordRec((float) 40.5952, (float) 4.7619), - new CoordRec((float) 31.0714, (float) 0), - new CoordRec((float) 21.5476, (float) 0), - new CoordRec((float) 12.0238, (float) 4.7619), - new CoordRec((float) 7.2619, (float) 9.5238), - new CoordRec((float) 2.5, (float) 23.8095), - new CoordRec((float) 2.5, (float) 33.3333), -}; - -static final StrokeRec char74[] = { - new StrokeRec(10, char74_stroke0), -}; - -/* char: 75 'K' */ - -static final CoordRec char75_stroke0[] = { - new CoordRec((float) 11.28, (float) 100), - new CoordRec((float) 11.28, (float) 0), -}; - -static final CoordRec char75_stroke1[] = { - new CoordRec((float) 77.9467, (float) 100), - new CoordRec((float) 11.28, (float) 33.3333), -}; - -static final CoordRec char75_stroke2[] = { - new CoordRec((float) 35.0895, (float) 57.1429), - new CoordRec((float) 77.9467, (float) 0), -}; - -static final StrokeRec char75[] = { - new StrokeRec(2, char75_stroke0), - new StrokeRec(2, char75_stroke1), - new StrokeRec(2, char75_stroke2), -}; - -/* char: 76 'L' */ - -static final CoordRec char76_stroke0[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 11.68, (float) 0), -}; - -static final CoordRec char76_stroke1[] = { - new CoordRec((float) 11.68, (float) 0), - new CoordRec((float) 68.8229, (float) 0), -}; - -static final StrokeRec char76[] = { - new StrokeRec(2, char76_stroke0), - new StrokeRec(2, char76_stroke1), -}; - -/* char: 77 'M' */ - -static final CoordRec char77_stroke0[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 10.86, (float) 0), -}; - -static final CoordRec char77_stroke1[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 48.9552, (float) 0), -}; - -static final CoordRec char77_stroke2[] = { - new CoordRec((float) 87.0505, (float) 100), - new CoordRec((float) 48.9552, (float) 0), -}; - -static final CoordRec char77_stroke3[] = { - new CoordRec((float) 87.0505, (float) 100), - new CoordRec((float) 87.0505, (float) 0), -}; - -static final StrokeRec char77[] = { - new StrokeRec(2, char77_stroke0), - new StrokeRec(2, char77_stroke1), - new StrokeRec(2, char77_stroke2), - new StrokeRec(2, char77_stroke3), -}; - -/* char: 78 'N' */ - -static final CoordRec char78_stroke0[] = { - new CoordRec((float) 11.14, (float) 100), - new CoordRec((float) 11.14, (float) 0), -}; - -static final CoordRec char78_stroke1[] = { - new CoordRec((float) 11.14, (float) 100), - new CoordRec((float) 77.8067, (float) 0), -}; - -static final CoordRec char78_stroke2[] = { - new CoordRec((float) 77.8067, (float) 100), - new CoordRec((float) 77.8067, (float) 0), -}; - -static final StrokeRec char78[] = { - new StrokeRec(2, char78_stroke0), - new StrokeRec(2, char78_stroke1), - new StrokeRec(2, char78_stroke2), -}; - -/* char: 79 'O' */ - -static final CoordRec char79_stroke0[] = { - new CoordRec((float) 34.8114, (float) 100), - new CoordRec((float) 25.2876, (float) 95.2381), - new CoordRec((float) 15.7638, (float) 85.7143), - new CoordRec((float) 11.0019, (float) 76.1905), - new CoordRec((float) 6.24, (float) 61.9048), - new CoordRec((float) 6.24, (float) 38.0952), - new CoordRec((float) 11.0019, (float) 23.8095), - new CoordRec((float) 15.7638, (float) 14.2857), - new CoordRec((float) 25.2876, (float) 4.7619), - new CoordRec((float) 34.8114, (float) 0), - new CoordRec((float) 53.859, (float) 0), - new CoordRec((float) 63.3829, (float) 4.7619), - new CoordRec((float) 72.9067, (float) 14.2857), - new CoordRec((float) 77.6686, (float) 23.8095), - new CoordRec((float) 82.4305, (float) 38.0952), - new CoordRec((float) 82.4305, (float) 61.9048), - new CoordRec((float) 77.6686, (float) 76.1905), - new CoordRec((float) 72.9067, (float) 85.7143), - new CoordRec((float) 63.3829, (float) 95.2381), - new CoordRec((float) 53.859, (float) 100), - new CoordRec((float) 34.8114, (float) 100), -}; - -static final StrokeRec char79[] = { - new StrokeRec(21, char79_stroke0), -}; - -/* char: 80 'P' */ - -static final CoordRec char80_stroke0[] = { - new CoordRec((float) 12.1, (float) 100), - new CoordRec((float) 12.1, (float) 0), -}; - -static final CoordRec char80_stroke1[] = { - new CoordRec((float) 12.1, (float) 100), - new CoordRec((float) 54.9571, (float) 100), - new CoordRec((float) 69.2429, (float) 95.2381), - new CoordRec((float) 74.0048, (float) 90.4762), - new CoordRec((float) 78.7667, (float) 80.9524), - new CoordRec((float) 78.7667, (float) 66.6667), - new CoordRec((float) 74.0048, (float) 57.1429), - new CoordRec((float) 69.2429, (float) 52.381), - new CoordRec((float) 54.9571, (float) 47.619), - new CoordRec((float) 12.1, (float) 47.619), -}; - -static final StrokeRec char80[] = { - new StrokeRec(2, char80_stroke0), - new StrokeRec(10, char80_stroke1), -}; - -/* char: 81 'Q' */ - -static final CoordRec char81_stroke0[] = { - new CoordRec((float) 33.8714, (float) 100), - new CoordRec((float) 24.3476, (float) 95.2381), - new CoordRec((float) 14.8238, (float) 85.7143), - new CoordRec((float) 10.0619, (float) 76.1905), - new CoordRec((float) 5.3, (float) 61.9048), - new CoordRec((float) 5.3, (float) 38.0952), - new CoordRec((float) 10.0619, (float) 23.8095), - new CoordRec((float) 14.8238, (float) 14.2857), - new CoordRec((float) 24.3476, (float) 4.7619), - new CoordRec((float) 33.8714, (float) 0), - new CoordRec((float) 52.919, (float) 0), - new CoordRec((float) 62.4429, (float) 4.7619), - new CoordRec((float) 71.9667, (float) 14.2857), - new CoordRec((float) 76.7286, (float) 23.8095), - new CoordRec((float) 81.4905, (float) 38.0952), - new CoordRec((float) 81.4905, (float) 61.9048), - new CoordRec((float) 76.7286, (float) 76.1905), - new CoordRec((float) 71.9667, (float) 85.7143), - new CoordRec((float) 62.4429, (float) 95.2381), - new CoordRec((float) 52.919, (float) 100), - new CoordRec((float) 33.8714, (float) 100), -}; - -static final CoordRec char81_stroke1[] = { - new CoordRec((float) 48.1571, (float) 19.0476), - new CoordRec((float) 76.7286, (float) -9.5238), -}; - -static final StrokeRec char81[] = { - new StrokeRec(21, char81_stroke0), - new StrokeRec(2, char81_stroke1), -}; - -/* char: 82 'R' */ - -static final CoordRec char82_stroke0[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 11.68, (float) 0), -}; - -static final CoordRec char82_stroke1[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 54.5371, (float) 100), - new CoordRec((float) 68.8229, (float) 95.2381), - new CoordRec((float) 73.5848, (float) 90.4762), - new CoordRec((float) 78.3467, (float) 80.9524), - new CoordRec((float) 78.3467, (float) 71.4286), - new CoordRec((float) 73.5848, (float) 61.9048), - new CoordRec((float) 68.8229, (float) 57.1429), - new CoordRec((float) 54.5371, (float) 52.381), - new CoordRec((float) 11.68, (float) 52.381), -}; - -static final CoordRec char82_stroke2[] = { - new CoordRec((float) 45.0133, (float) 52.381), - new CoordRec((float) 78.3467, (float) 0), -}; - -static final StrokeRec char82[] = { - new StrokeRec(2, char82_stroke0), - new StrokeRec(10, char82_stroke1), - new StrokeRec(2, char82_stroke2), -}; - -/* char: 83 'S' */ - -static final CoordRec char83_stroke0[] = { - new CoordRec((float) 74.6667, (float) 85.7143), - new CoordRec((float) 65.1429, (float) 95.2381), - new CoordRec((float) 50.8571, (float) 100), - new CoordRec((float) 31.8095, (float) 100), - new CoordRec((float) 17.5238, (float) 95.2381), - new CoordRec((float) 8, (float) 85.7143), - new CoordRec((float) 8, (float) 76.1905), - new CoordRec((float) 12.7619, (float) 66.6667), - new CoordRec((float) 17.5238, (float) 61.9048), - new CoordRec((float) 27.0476, (float) 57.1429), - new CoordRec((float) 55.619, (float) 47.619), - new CoordRec((float) 65.1429, (float) 42.8571), - new CoordRec((float) 69.9048, (float) 38.0952), - new CoordRec((float) 74.6667, (float) 28.5714), - new CoordRec((float) 74.6667, (float) 14.2857), - new CoordRec((float) 65.1429, (float) 4.7619), - new CoordRec((float) 50.8571, (float) 0), - new CoordRec((float) 31.8095, (float) 0), - new CoordRec((float) 17.5238, (float) 4.7619), - new CoordRec((float) 8, (float) 14.2857), -}; - -static final StrokeRec char83[] = { - new StrokeRec(20, char83_stroke0), -}; - -/* char: 84 'T' */ - -static final CoordRec char84_stroke0[] = { - new CoordRec((float) 35.6933, (float) 100), - new CoordRec((float) 35.6933, (float) 0), -}; - -static final CoordRec char84_stroke1[] = { - new CoordRec((float) 2.36, (float) 100), - new CoordRec((float) 69.0267, (float) 100), -}; - -static final StrokeRec char84[] = { - new StrokeRec(2, char84_stroke0), - new StrokeRec(2, char84_stroke1), -}; - -/* char: 85 'U' */ - -static final CoordRec char85_stroke0[] = { - new CoordRec((float) 11.54, (float) 100), - new CoordRec((float) 11.54, (float) 28.5714), - new CoordRec((float) 16.3019, (float) 14.2857), - new CoordRec((float) 25.8257, (float) 4.7619), - new CoordRec((float) 40.1114, (float) 0), - new CoordRec((float) 49.6352, (float) 0), - new CoordRec((float) 63.921, (float) 4.7619), - new CoordRec((float) 73.4448, (float) 14.2857), - new CoordRec((float) 78.2067, (float) 28.5714), - new CoordRec((float) 78.2067, (float) 100), -}; - -static final StrokeRec char85[] = { - new StrokeRec(10, char85_stroke0), -}; - -/* char: 86 'V' */ - -static final CoordRec char86_stroke0[] = { - new CoordRec((float) 2.36, (float) 100), - new CoordRec((float) 40.4552, (float) 0), -}; - -static final CoordRec char86_stroke1[] = { - new CoordRec((float) 78.5505, (float) 100), - new CoordRec((float) 40.4552, (float) 0), -}; - -static final StrokeRec char86[] = { - new StrokeRec(2, char86_stroke0), - new StrokeRec(2, char86_stroke1), -}; - -/* char: 87 'W' */ - -static final CoordRec char87_stroke0[] = { - new CoordRec((float) 2.22, (float) 100), - new CoordRec((float) 26.0295, (float) 0), -}; - -static final CoordRec char87_stroke1[] = { - new CoordRec((float) 49.839, (float) 100), - new CoordRec((float) 26.0295, (float) 0), -}; - -static final CoordRec char87_stroke2[] = { - new CoordRec((float) 49.839, (float) 100), - new CoordRec((float) 73.6486, (float) 0), -}; - -static final CoordRec char87_stroke3[] = { - new CoordRec((float) 97.4581, (float) 100), - new CoordRec((float) 73.6486, (float) 0), -}; - -static final StrokeRec char87[] = { - new StrokeRec(2, char87_stroke0), - new StrokeRec(2, char87_stroke1), - new StrokeRec(2, char87_stroke2), - new StrokeRec(2, char87_stroke3), -}; - -/* char: 88 'X' */ - -static final CoordRec char88_stroke0[] = { - new CoordRec((float) 2.5, (float) 100), - new CoordRec((float) 69.1667, (float) 0), -}; - -static final CoordRec char88_stroke1[] = { - new CoordRec((float) 69.1667, (float) 100), - new CoordRec((float) 2.5, (float) 0), -}; - -static final StrokeRec char88[] = { - new StrokeRec(2, char88_stroke0), - new StrokeRec(2, char88_stroke1), -}; - -/* char: 89 'Y' */ - -static final CoordRec char89_stroke0[] = { - new CoordRec((float) 1.52, (float) 100), - new CoordRec((float) 39.6152, (float) 52.381), - new CoordRec((float) 39.6152, (float) 0), -}; - -static final CoordRec char89_stroke1[] = { - new CoordRec((float) 77.7105, (float) 100), - new CoordRec((float) 39.6152, (float) 52.381), -}; - -static final StrokeRec char89[] = { - new StrokeRec(3, char89_stroke0), - new StrokeRec(2, char89_stroke1), -}; - -/* char: 90 'Z' */ - -static final CoordRec char90_stroke0[] = { - new CoordRec((float) 69.1667, (float) 100), - new CoordRec((float) 2.5, (float) 0), -}; - -static final CoordRec char90_stroke1[] = { - new CoordRec((float) 2.5, (float) 100), - new CoordRec((float) 69.1667, (float) 100), -}; - -static final CoordRec char90_stroke2[] = { - new CoordRec((float) 2.5, (float) 0), - new CoordRec((float) 69.1667, (float) 0), -}; - -static final StrokeRec char90[] = { - new StrokeRec(2, char90_stroke0), - new StrokeRec(2, char90_stroke1), - new StrokeRec(2, char90_stroke2), -}; - -/* char: 91 '[' */ - -static final CoordRec char91_stroke0[] = { - new CoordRec((float) 7.78, (float) 119.048), - new CoordRec((float) 7.78, (float) -33.3333), -}; - -static final CoordRec char91_stroke1[] = { - new CoordRec((float) 12.5419, (float) 119.048), - new CoordRec((float) 12.5419, (float) -33.3333), -}; - -static final CoordRec char91_stroke2[] = { - new CoordRec((float) 7.78, (float) 119.048), - new CoordRec((float) 41.1133, (float) 119.048), -}; - -static final CoordRec char91_stroke3[] = { - new CoordRec((float) 7.78, (float) -33.3333), - new CoordRec((float) 41.1133, (float) -33.3333), -}; - -static final StrokeRec char91[] = { - new StrokeRec(2, char91_stroke0), - new StrokeRec(2, char91_stroke1), - new StrokeRec(2, char91_stroke2), - new StrokeRec(2, char91_stroke3), -}; - -/* char: 92 '\' */ - -static final CoordRec char92_stroke0[] = { - new CoordRec((float) 5.84, (float) 100), - new CoordRec((float) 72.5067, (float) -14.2857), -}; - -static final StrokeRec char92[] = { - new StrokeRec(2, char92_stroke0), -}; - -/* char: 93 ']' */ - -static final CoordRec char93_stroke0[] = { - new CoordRec((float) 33.0114, (float) 119.048), - new CoordRec((float) 33.0114, (float) -33.3333), -}; - -static final CoordRec char93_stroke1[] = { - new CoordRec((float) 37.7733, (float) 119.048), - new CoordRec((float) 37.7733, (float) -33.3333), -}; - -static final CoordRec char93_stroke2[] = { - new CoordRec((float) 4.44, (float) 119.048), - new CoordRec((float) 37.7733, (float) 119.048), -}; - -static final CoordRec char93_stroke3[] = { - new CoordRec((float) 4.44, (float) -33.3333), - new CoordRec((float) 37.7733, (float) -33.3333), -}; - -static final StrokeRec char93[] = { - new StrokeRec(2, char93_stroke0), - new StrokeRec(2, char93_stroke1), - new StrokeRec(2, char93_stroke2), - new StrokeRec(2, char93_stroke3), -}; - -/* char: 94 '^' */ - -static final CoordRec char94_stroke0[] = { - new CoordRec((float) 44.0752, (float) 109.524), - new CoordRec((float) 5.98, (float) 42.8571), -}; - -static final CoordRec char94_stroke1[] = { - new CoordRec((float) 44.0752, (float) 109.524), - new CoordRec((float) 82.1705, (float) 42.8571), -}; - -static final StrokeRec char94[] = { - new StrokeRec(2, char94_stroke0), - new StrokeRec(2, char94_stroke1), -}; - -/* char: 95 '_' */ - -static final CoordRec char95_stroke0[] = { - new CoordRec((float)-1.1, (float) -33.3333), - new CoordRec((float) 103.662, (float) -33.3333), - new CoordRec((float) 103.662, (float) -28.5714), - new CoordRec((float)-1.1, (float) -28.5714), - new CoordRec((float)-1.1, (float) -33.3333), -}; - -static final StrokeRec char95[] = { - new StrokeRec(5, char95_stroke0), -}; - -/* char: 96 '`' */ - -static final CoordRec char96_stroke0[] = { - new CoordRec((float) 33.0219, (float) 100), - new CoordRec((float) 56.8314, (float) 71.4286), -}; - -static final CoordRec char96_stroke1[] = { - new CoordRec((float) 33.0219, (float) 100), - new CoordRec((float) 28.26, (float) 95.2381), - new CoordRec((float) 56.8314, (float) 71.4286), -}; - -static final StrokeRec char96[] = { - new StrokeRec(2, char96_stroke0), - new StrokeRec(3, char96_stroke1), -}; - -/* char: 97 'a' */ - -static final CoordRec char97_stroke0[] = { - new CoordRec((float) 63.8229, (float) 66.6667), - new CoordRec((float) 63.8229, (float) 0), -}; - -static final CoordRec char97_stroke1[] = { - new CoordRec((float) 63.8229, (float) 52.381), - new CoordRec((float) 54.299, (float) 61.9048), - new CoordRec((float) 44.7752, (float) 66.6667), - new CoordRec((float) 30.4895, (float) 66.6667), - new CoordRec((float) 20.9657, (float) 61.9048), - new CoordRec((float) 11.4419, (float) 52.381), - new CoordRec((float) 6.68, (float) 38.0952), - new CoordRec((float) 6.68, (float) 28.5714), - new CoordRec((float) 11.4419, (float) 14.2857), - new CoordRec((float) 20.9657, (float) 4.7619), - new CoordRec((float) 30.4895, (float) 0), - new CoordRec((float) 44.7752, (float) 0), - new CoordRec((float) 54.299, (float) 4.7619), - new CoordRec((float) 63.8229, (float) 14.2857), -}; - -static final StrokeRec char97[] = { - new StrokeRec(2, char97_stroke0), - new StrokeRec(14, char97_stroke1), -}; - -/* char: 98 'b' */ - -static final CoordRec char98_stroke0[] = { - new CoordRec((float) 8.76, (float) 100), - new CoordRec((float) 8.76, (float) 0), -}; - -static final CoordRec char98_stroke1[] = { - new CoordRec((float) 8.76, (float) 52.381), - new CoordRec((float) 18.2838, (float) 61.9048), - new CoordRec((float) 27.8076, (float) 66.6667), - new CoordRec((float) 42.0933, (float) 66.6667), - new CoordRec((float) 51.6171, (float) 61.9048), - new CoordRec((float) 61.141, (float) 52.381), - new CoordRec((float) 65.9029, (float) 38.0952), - new CoordRec((float) 65.9029, (float) 28.5714), - new CoordRec((float) 61.141, (float) 14.2857), - new CoordRec((float) 51.6171, (float) 4.7619), - new CoordRec((float) 42.0933, (float) 0), - new CoordRec((float) 27.8076, (float) 0), - new CoordRec((float) 18.2838, (float) 4.7619), - new CoordRec((float) 8.76, (float) 14.2857), -}; - -static final StrokeRec char98[] = { - new StrokeRec(2, char98_stroke0), - new StrokeRec(14, char98_stroke1), -}; - -/* char: 99 'c' */ - -static final CoordRec char99_stroke0[] = { - new CoordRec((float) 62.6629, (float) 52.381), - new CoordRec((float) 53.139, (float) 61.9048), - new CoordRec((float) 43.6152, (float) 66.6667), - new CoordRec((float) 29.3295, (float) 66.6667), - new CoordRec((float) 19.8057, (float) 61.9048), - new CoordRec((float) 10.2819, (float) 52.381), - new CoordRec((float) 5.52, (float) 38.0952), - new CoordRec((float) 5.52, (float) 28.5714), - new CoordRec((float) 10.2819, (float) 14.2857), - new CoordRec((float) 19.8057, (float) 4.7619), - new CoordRec((float) 29.3295, (float) 0), - new CoordRec((float) 43.6152, (float) 0), - new CoordRec((float) 53.139, (float) 4.7619), - new CoordRec((float) 62.6629, (float) 14.2857), -}; - -static final StrokeRec char99[] = { - new StrokeRec(14, char99_stroke0), -}; - -/* char: 100 'd' */ - -static final CoordRec char100_stroke0[] = { - new CoordRec((float) 61.7829, (float) 100), - new CoordRec((float) 61.7829, (float) 0), -}; - -static final CoordRec char100_stroke1[] = { - new CoordRec((float) 61.7829, (float) 52.381), - new CoordRec((float) 52.259, (float) 61.9048), - new CoordRec((float) 42.7352, (float) 66.6667), - new CoordRec((float) 28.4495, (float) 66.6667), - new CoordRec((float) 18.9257, (float) 61.9048), - new CoordRec((float) 9.4019, (float) 52.381), - new CoordRec((float) 4.64, (float) 38.0952), - new CoordRec((float) 4.64, (float) 28.5714), - new CoordRec((float) 9.4019, (float) 14.2857), - new CoordRec((float) 18.9257, (float) 4.7619), - new CoordRec((float) 28.4495, (float) 0), - new CoordRec((float) 42.7352, (float) 0), - new CoordRec((float) 52.259, (float) 4.7619), - new CoordRec((float) 61.7829, (float) 14.2857), -}; - -static final StrokeRec char100[] = { - new StrokeRec(2, char100_stroke0), - new StrokeRec(14, char100_stroke1), -}; - -/* char: 101 'e' */ - -static final CoordRec char101_stroke0[] = { - new CoordRec((float) 5.72, (float) 38.0952), - new CoordRec((float) 62.8629, (float) 38.0952), - new CoordRec((float) 62.8629, (float) 47.619), - new CoordRec((float) 58.101, (float) 57.1429), - new CoordRec((float) 53.339, (float) 61.9048), - new CoordRec((float) 43.8152, (float) 66.6667), - new CoordRec((float) 29.5295, (float) 66.6667), - new CoordRec((float) 20.0057, (float) 61.9048), - new CoordRec((float) 10.4819, (float) 52.381), - new CoordRec((float) 5.72, (float) 38.0952), - new CoordRec((float) 5.72, (float) 28.5714), - new CoordRec((float) 10.4819, (float) 14.2857), - new CoordRec((float) 20.0057, (float) 4.7619), - new CoordRec((float) 29.5295, (float) 0), - new CoordRec((float) 43.8152, (float) 0), - new CoordRec((float) 53.339, (float) 4.7619), - new CoordRec((float) 62.8629, (float) 14.2857), -}; - -static final StrokeRec char101[] = { - new StrokeRec(17, char101_stroke0), -}; - -/* char: 102 'f' */ - -static final CoordRec char102_stroke0[] = { - new CoordRec((float) 38.7752, (float) 100), - new CoordRec((float) 29.2514, (float) 100), - new CoordRec((float) 19.7276, (float) 95.2381), - new CoordRec((float) 14.9657, (float) 80.9524), - new CoordRec((float) 14.9657, (float) 0), -}; - -static final CoordRec char102_stroke1[] = { - new CoordRec((float) 0.68, (float) 66.6667), - new CoordRec((float) 34.0133, (float) 66.6667), -}; - -static final StrokeRec char102[] = { - new StrokeRec(5, char102_stroke0), - new StrokeRec(2, char102_stroke1), -}; - -/* char: 103 'g' */ - -static final CoordRec char103_stroke0[] = { - new CoordRec((float) 62.5029, (float) 66.6667), - new CoordRec((float) 62.5029, (float) -9.5238), - new CoordRec((float) 57.741, (float) -23.8095), - new CoordRec((float) 52.979, (float) -28.5714), - new CoordRec((float) 43.4552, (float) -33.3333), - new CoordRec((float) 29.1695, (float) -33.3333), - new CoordRec((float) 19.6457, (float) -28.5714), -}; - -static final CoordRec char103_stroke1[] = { - new CoordRec((float) 62.5029, (float) 52.381), - new CoordRec((float) 52.979, (float) 61.9048), - new CoordRec((float) 43.4552, (float) 66.6667), - new CoordRec((float) 29.1695, (float) 66.6667), - new CoordRec((float) 19.6457, (float) 61.9048), - new CoordRec((float) 10.1219, (float) 52.381), - new CoordRec((float) 5.36, (float) 38.0952), - new CoordRec((float) 5.36, (float) 28.5714), - new CoordRec((float) 10.1219, (float) 14.2857), - new CoordRec((float) 19.6457, (float) 4.7619), - new CoordRec((float) 29.1695, (float) 0), - new CoordRec((float) 43.4552, (float) 0), - new CoordRec((float) 52.979, (float) 4.7619), - new CoordRec((float) 62.5029, (float) 14.2857), -}; - -static final StrokeRec char103[] = { - new StrokeRec(7, char103_stroke0), - new StrokeRec(14, char103_stroke1), -}; - -/* char: 104 'h' */ - -static final CoordRec char104_stroke0[] = { - new CoordRec((float) 9.6, (float) 100), - new CoordRec((float) 9.6, (float) 0), -}; - -static final CoordRec char104_stroke1[] = { - new CoordRec((float) 9.6, (float) 47.619), - new CoordRec((float) 23.8857, (float) 61.9048), - new CoordRec((float) 33.4095, (float) 66.6667), - new CoordRec((float) 47.6952, (float) 66.6667), - new CoordRec((float) 57.219, (float) 61.9048), - new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 61.981, (float) 0), -}; - -static final StrokeRec char104[] = { - new StrokeRec(2, char104_stroke0), - new StrokeRec(7, char104_stroke1), -}; - -/* char: 105 'i' */ - -static final CoordRec char105_stroke0[] = { - new CoordRec((float) 10.02, (float) 100), - new CoordRec((float) 14.7819, (float) 95.2381), - new CoordRec((float) 19.5438, (float) 100), - new CoordRec((float) 14.7819, (float) 104.762), - new CoordRec((float) 10.02, (float) 100), -}; - -static final CoordRec char105_stroke1[] = { - new CoordRec((float) 14.7819, (float) 66.6667), - new CoordRec((float) 14.7819, (float) 0), -}; - -static final StrokeRec char105[] = { - new StrokeRec(5, char105_stroke0), - new StrokeRec(2, char105_stroke1), -}; - -/* char: 106 'j' */ - -static final CoordRec char106_stroke0[] = { - new CoordRec((float) 17.3876, (float) 100), - new CoordRec((float) 22.1495, (float) 95.2381), - new CoordRec((float) 26.9114, (float) 100), - new CoordRec((float) 22.1495, (float) 104.762), - new CoordRec((float) 17.3876, (float) 100), -}; - -static final CoordRec char106_stroke1[] = { - new CoordRec((float) 22.1495, (float) 66.6667), - new CoordRec((float) 22.1495, (float) -14.2857), - new CoordRec((float) 17.3876, (float) -28.5714), - new CoordRec((float) 7.8638, (float) -33.3333), - new CoordRec((float)-1.66, (float) -33.3333), -}; - -static final StrokeRec char106[] = { - new StrokeRec(5, char106_stroke0), - new StrokeRec(5, char106_stroke1), -}; - -/* char: 107 'k' */ - -static final CoordRec char107_stroke0[] = { - new CoordRec((float) 9.6, (float) 100), - new CoordRec((float) 9.6, (float) 0), -}; - -static final CoordRec char107_stroke1[] = { - new CoordRec((float) 57.219, (float) 66.6667), - new CoordRec((float) 9.6, (float) 19.0476), -}; - -static final CoordRec char107_stroke2[] = { - new CoordRec((float) 28.6476, (float) 38.0952), - new CoordRec((float) 61.981, (float) 0), -}; - -static final StrokeRec char107[] = { - new StrokeRec(2, char107_stroke0), - new StrokeRec(2, char107_stroke1), - new StrokeRec(2, char107_stroke2), -}; - -/* char: 108 'l' */ - -static final CoordRec char108_stroke0[] = { - new CoordRec((float) 10.02, (float) 100), - new CoordRec((float) 10.02, (float) 0), -}; - -static final StrokeRec char108[] = { - new StrokeRec(2, char108_stroke0), -}; - -/* char: 109 'm' */ - -static final CoordRec char109_stroke0[] = { - new CoordRec((float) 9.6, (float) 66.6667), - new CoordRec((float) 9.6, (float) 0), -}; - -static final CoordRec char109_stroke1[] = { - new CoordRec((float) 9.6, (float) 47.619), - new CoordRec((float) 23.8857, (float) 61.9048), - new CoordRec((float) 33.4095, (float) 66.6667), - new CoordRec((float) 47.6952, (float) 66.6667), - new CoordRec((float) 57.219, (float) 61.9048), - new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 61.981, (float) 0), -}; - -static final CoordRec char109_stroke2[] = { - new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 76.2667, (float) 61.9048), - new CoordRec((float) 85.7905, (float) 66.6667), - new CoordRec((float) 100.076, (float) 66.6667), - new CoordRec((float) 109.6, (float) 61.9048), - new CoordRec((float) 114.362, (float) 47.619), - new CoordRec((float) 114.362, (float) 0), -}; - -static final StrokeRec char109[] = { - new StrokeRec(2, char109_stroke0), - new StrokeRec(7, char109_stroke1), - new StrokeRec(7, char109_stroke2), -}; - -/* char: 110 'n' */ - -static final CoordRec char110_stroke0[] = { - new CoordRec((float) 9.18, (float) 66.6667), - new CoordRec((float) 9.18, (float) 0), -}; - -static final CoordRec char110_stroke1[] = { - new CoordRec((float) 9.18, (float) 47.619), - new CoordRec((float) 23.4657, (float) 61.9048), - new CoordRec((float) 32.9895, (float) 66.6667), - new CoordRec((float) 47.2752, (float) 66.6667), - new CoordRec((float) 56.799, (float) 61.9048), - new CoordRec((float) 61.561, (float) 47.619), - new CoordRec((float) 61.561, (float) 0), -}; - -static final StrokeRec char110[] = { - new StrokeRec(2, char110_stroke0), - new StrokeRec(7, char110_stroke1), -}; - -/* char: 111 'o' */ - -static final CoordRec char111_stroke0[] = { - new CoordRec((float) 28.7895, (float) 66.6667), - new CoordRec((float) 19.2657, (float) 61.9048), - new CoordRec((float) 9.7419, (float) 52.381), - new CoordRec((float) 4.98, (float) 38.0952), - new CoordRec((float) 4.98, (float) 28.5714), - new CoordRec((float) 9.7419, (float) 14.2857), - new CoordRec((float) 19.2657, (float) 4.7619), - new CoordRec((float) 28.7895, (float) 0), - new CoordRec((float) 43.0752, (float) 0), - new CoordRec((float) 52.599, (float) 4.7619), - new CoordRec((float) 62.1229, (float) 14.2857), - new CoordRec((float) 66.8848, (float) 28.5714), - new CoordRec((float) 66.8848, (float) 38.0952), - new CoordRec((float) 62.1229, (float) 52.381), - new CoordRec((float) 52.599, (float) 61.9048), - new CoordRec((float) 43.0752, (float) 66.6667), - new CoordRec((float) 28.7895, (float) 66.6667), -}; - -static final StrokeRec char111[] = { - new StrokeRec(17, char111_stroke0), -}; - -/* char: 112 'p' */ - -static final CoordRec char112_stroke0[] = { - new CoordRec((float) 9.46, (float) 66.6667), - new CoordRec((float) 9.46, (float) -33.3333), -}; - -static final CoordRec char112_stroke1[] = { - new CoordRec((float) 9.46, (float) 52.381), - new CoordRec((float) 18.9838, (float) 61.9048), - new CoordRec((float) 28.5076, (float) 66.6667), - new CoordRec((float) 42.7933, (float) 66.6667), - new CoordRec((float) 52.3171, (float) 61.9048), - new CoordRec((float) 61.841, (float) 52.381), - new CoordRec((float) 66.6029, (float) 38.0952), - new CoordRec((float) 66.6029, (float) 28.5714), - new CoordRec((float) 61.841, (float) 14.2857), - new CoordRec((float) 52.3171, (float) 4.7619), - new CoordRec((float) 42.7933, (float) 0), - new CoordRec((float) 28.5076, (float) 0), - new CoordRec((float) 18.9838, (float) 4.7619), - new CoordRec((float) 9.46, (float) 14.2857), -}; - -static final StrokeRec char112[] = { - new StrokeRec(2, char112_stroke0), - new StrokeRec(14, char112_stroke1), -}; - -/* char: 113 'q' */ - -static final CoordRec char113_stroke0[] = { - new CoordRec((float) 61.9829, (float) 66.6667), - new CoordRec((float) 61.9829, (float) -33.3333), -}; - -static final CoordRec char113_stroke1[] = { - new CoordRec((float) 61.9829, (float) 52.381), - new CoordRec((float) 52.459, (float) 61.9048), - new CoordRec((float) 42.9352, (float) 66.6667), - new CoordRec((float) 28.6495, (float) 66.6667), - new CoordRec((float) 19.1257, (float) 61.9048), - new CoordRec((float) 9.6019, (float) 52.381), - new CoordRec((float) 4.84, (float) 38.0952), - new CoordRec((float) 4.84, (float) 28.5714), - new CoordRec((float) 9.6019, (float) 14.2857), - new CoordRec((float) 19.1257, (float) 4.7619), - new CoordRec((float) 28.6495, (float) 0), - new CoordRec((float) 42.9352, (float) 0), - new CoordRec((float) 52.459, (float) 4.7619), - new CoordRec((float) 61.9829, (float) 14.2857), -}; - -static final StrokeRec char113[] = { - new StrokeRec(2, char113_stroke0), - new StrokeRec(14, char113_stroke1), -}; - -/* char: 114 'r' */ - -static final CoordRec char114_stroke0[] = { - new CoordRec((float) 9.46, (float) 66.6667), - new CoordRec((float) 9.46, (float) 0), -}; - -static final CoordRec char114_stroke1[] = { - new CoordRec((float) 9.46, (float) 38.0952), - new CoordRec((float) 14.2219, (float) 52.381), - new CoordRec((float) 23.7457, (float) 61.9048), - new CoordRec((float) 33.2695, (float) 66.6667), - new CoordRec((float) 47.5552, (float) 66.6667), -}; - -static final StrokeRec char114[] = { - new StrokeRec(2, char114_stroke0), - new StrokeRec(5, char114_stroke1), -}; - -/* char: 115 's' */ - -static final CoordRec char115_stroke0[] = { - new CoordRec((float) 57.081, (float) 52.381), - new CoordRec((float) 52.319, (float) 61.9048), - new CoordRec((float) 38.0333, (float) 66.6667), - new CoordRec((float) 23.7476, (float) 66.6667), - new CoordRec((float) 9.4619, (float) 61.9048), - new CoordRec((float) 4.7, (float) 52.381), - new CoordRec((float) 9.4619, (float) 42.8571), - new CoordRec((float) 18.9857, (float) 38.0952), - new CoordRec((float) 42.7952, (float) 33.3333), - new CoordRec((float) 52.319, (float) 28.5714), - new CoordRec((float) 57.081, (float) 19.0476), - new CoordRec((float) 57.081, (float) 14.2857), - new CoordRec((float) 52.319, (float) 4.7619), - new CoordRec((float) 38.0333, (float) 0), - new CoordRec((float) 23.7476, (float) 0), - new CoordRec((float) 9.4619, (float) 4.7619), - new CoordRec((float) 4.7, (float) 14.2857), -}; - -static final StrokeRec char115[] = { - new StrokeRec(17, char115_stroke0), -}; - -/* char: 116 't' */ - -static final CoordRec char116_stroke0[] = { - new CoordRec((float) 14.8257, (float) 100), - new CoordRec((float) 14.8257, (float) 19.0476), - new CoordRec((float) 19.5876, (float) 4.7619), - new CoordRec((float) 29.1114, (float) 0), - new CoordRec((float) 38.6352, (float) 0), -}; - -static final CoordRec char116_stroke1[] = { - new CoordRec((float) 0.54, (float) 66.6667), - new CoordRec((float) 33.8733, (float) 66.6667), -}; - -static final StrokeRec char116[] = { - new StrokeRec(5, char116_stroke0), - new StrokeRec(2, char116_stroke1), -}; - -/* char: 117 'u' */ - -static final CoordRec char117_stroke0[] = { - new CoordRec((float) 9.46, (float) 66.6667), - new CoordRec((float) 9.46, (float) 19.0476), - new CoordRec((float) 14.2219, (float) 4.7619), - new CoordRec((float) 23.7457, (float) 0), - new CoordRec((float) 38.0314, (float) 0), - new CoordRec((float) 47.5552, (float) 4.7619), - new CoordRec((float) 61.841, (float) 19.0476), -}; - -static final CoordRec char117_stroke1[] = { - new CoordRec((float) 61.841, (float) 66.6667), - new CoordRec((float) 61.841, (float) 0), -}; - -static final StrokeRec char117[] = { - new StrokeRec(7, char117_stroke0), - new StrokeRec(2, char117_stroke1), -}; - -/* char: 118 'v' */ - -static final CoordRec char118_stroke0[] = { - new CoordRec((float) 1.8, (float) 66.6667), - new CoordRec((float) 30.3714, (float) 0), -}; - -static final CoordRec char118_stroke1[] = { - new CoordRec((float) 58.9429, (float) 66.6667), - new CoordRec((float) 30.3714, (float) 0), -}; - -static final StrokeRec char118[] = { - new StrokeRec(2, char118_stroke0), - new StrokeRec(2, char118_stroke1), -}; - -/* char: 119 'w' */ - -static final CoordRec char119_stroke0[] = { - new CoordRec((float) 2.5, (float) 66.6667), - new CoordRec((float) 21.5476, (float) 0), -}; - -static final CoordRec char119_stroke1[] = { - new CoordRec((float) 40.5952, (float) 66.6667), - new CoordRec((float) 21.5476, (float) 0), -}; - -static final CoordRec char119_stroke2[] = { - new CoordRec((float) 40.5952, (float) 66.6667), - new CoordRec((float) 59.6429, (float) 0), -}; - -static final CoordRec char119_stroke3[] = { - new CoordRec((float) 78.6905, (float) 66.6667), - new CoordRec((float) 59.6429, (float) 0), -}; - -static final StrokeRec char119[] = { - new StrokeRec(2, char119_stroke0), - new StrokeRec(2, char119_stroke1), - new StrokeRec(2, char119_stroke2), - new StrokeRec(2, char119_stroke3), -}; - -/* char: 120 'x' */ - -static final CoordRec char120_stroke0[] = { - new CoordRec((float) 1.66, (float) 66.6667), - new CoordRec((float) 54.041, (float) 0), -}; - -static final CoordRec char120_stroke1[] = { - new CoordRec((float) 54.041, (float) 66.6667), - new CoordRec((float) 1.66, (float) 0), -}; - -static final StrokeRec char120[] = { - new StrokeRec(2, char120_stroke0), - new StrokeRec(2, char120_stroke1), -}; - -/* char: 121 'y' */ - -static final CoordRec char121_stroke0[] = { - new CoordRec((float) 6.5619, (float) 66.6667), - new CoordRec((float) 35.1333, (float) 0), -}; - -static final CoordRec char121_stroke1[] = { - new CoordRec((float) 63.7048, (float) 66.6667), - new CoordRec((float) 35.1333, (float) 0), - new CoordRec((float) 25.6095, (float) -19.0476), - new CoordRec((float) 16.0857, (float) -28.5714), - new CoordRec((float) 6.5619, (float) -33.3333), - new CoordRec((float) 1.8, (float) -33.3333), -}; - -static final StrokeRec char121[] = { - new StrokeRec(2, char121_stroke0), - new StrokeRec(6, char121_stroke1), -}; - -/* char: 122 'z' */ - -static final CoordRec char122_stroke0[] = { - new CoordRec((float) 56.821, (float) 66.6667), - new CoordRec((float) 4.44, (float) 0), -}; - -static final CoordRec char122_stroke1[] = { - new CoordRec((float) 4.44, (float) 66.6667), - new CoordRec((float) 56.821, (float) 66.6667), -}; - -static final CoordRec char122_stroke2[] = { - new CoordRec((float) 4.44, (float) 0), - new CoordRec((float) 56.821, (float) 0), -}; - -static final StrokeRec char122[] = { - new StrokeRec(2, char122_stroke0), - new StrokeRec(2, char122_stroke1), - new StrokeRec(2, char122_stroke2), -}; - -/* char: 123 '{' */ - -static final CoordRec char123_stroke0[] = { - new CoordRec((float) 31.1895, (float) 119.048), - new CoordRec((float) 21.6657, (float) 114.286), - new CoordRec((float) 16.9038, (float) 109.524), - new CoordRec((float) 12.1419, (float) 100), - new CoordRec((float) 12.1419, (float) 90.4762), - new CoordRec((float) 16.9038, (float) 80.9524), - new CoordRec((float) 21.6657, (float) 76.1905), - new CoordRec((float) 26.4276, (float) 66.6667), - new CoordRec((float) 26.4276, (float) 57.1429), - new CoordRec((float) 16.9038, (float) 47.619), -}; - -static final CoordRec char123_stroke1[] = { - new CoordRec((float) 21.6657, (float) 114.286), - new CoordRec((float) 16.9038, (float) 104.762), - new CoordRec((float) 16.9038, (float) 95.2381), - new CoordRec((float) 21.6657, (float) 85.7143), - new CoordRec((float) 26.4276, (float) 80.9524), - new CoordRec((float) 31.1895, (float) 71.4286), - new CoordRec((float) 31.1895, (float) 61.9048), - new CoordRec((float) 26.4276, (float) 52.381), - new CoordRec((float) 7.38, (float) 42.8571), - new CoordRec((float) 26.4276, (float) 33.3333), - new CoordRec((float) 31.1895, (float) 23.8095), - new CoordRec((float) 31.1895, (float) 14.2857), - new CoordRec((float) 26.4276, (float) 4.7619), - new CoordRec((float) 21.6657, (float) 0), - new CoordRec((float) 16.9038, (float) -9.5238), - new CoordRec((float) 16.9038, (float) -19.0476), - new CoordRec((float) 21.6657, (float) -28.5714), -}; - -static final CoordRec char123_stroke2[] = { - new CoordRec((float) 16.9038, (float) 38.0952), - new CoordRec((float) 26.4276, (float) 28.5714), - new CoordRec((float) 26.4276, (float) 19.0476), - new CoordRec((float) 21.6657, (float) 9.5238), - new CoordRec((float) 16.9038, (float) 4.7619), - new CoordRec((float) 12.1419, (float) -4.7619), - new CoordRec((float) 12.1419, (float) -14.2857), - new CoordRec((float) 16.9038, (float) -23.8095), - new CoordRec((float) 21.6657, (float) -28.5714), - new CoordRec((float) 31.1895, (float) -33.3333), -}; - -static final StrokeRec char123[] = { - new StrokeRec(10, char123_stroke0), - new StrokeRec(17, char123_stroke1), - new StrokeRec(10, char123_stroke2), -}; - -/* char: 124 '|' */ - -static final CoordRec char124_stroke0[] = { - new CoordRec((float) 11.54, (float) 119.048), - new CoordRec((float) 11.54, (float) -33.3333), -}; - -static final StrokeRec char124[] = { - new StrokeRec(2, char124_stroke0), -}; - -/* char: 125 '}' */ - -static final CoordRec char125_stroke0[] = { - new CoordRec((float) 9.18, (float) 119.048), - new CoordRec((float) 18.7038, (float) 114.286), - new CoordRec((float) 23.4657, (float) 109.524), - new CoordRec((float) 28.2276, (float) 100), - new CoordRec((float) 28.2276, (float) 90.4762), - new CoordRec((float) 23.4657, (float) 80.9524), - new CoordRec((float) 18.7038, (float) 76.1905), - new CoordRec((float) 13.9419, (float) 66.6667), - new CoordRec((float) 13.9419, (float) 57.1429), - new CoordRec((float) 23.4657, (float) 47.619), -}; - -static final CoordRec char125_stroke1[] = { - new CoordRec((float) 18.7038, (float) 114.286), - new CoordRec((float) 23.4657, (float) 104.762), - new CoordRec((float) 23.4657, (float) 95.2381), - new CoordRec((float) 18.7038, (float) 85.7143), - new CoordRec((float) 13.9419, (float) 80.9524), - new CoordRec((float) 9.18, (float) 71.4286), - new CoordRec((float) 9.18, (float) 61.9048), - new CoordRec((float) 13.9419, (float) 52.381), - new CoordRec((float) 32.9895, (float) 42.8571), - new CoordRec((float) 13.9419, (float) 33.3333), - new CoordRec((float) 9.18, (float) 23.8095), - new CoordRec((float) 9.18, (float) 14.2857), - new CoordRec((float) 13.9419, (float) 4.7619), - new CoordRec((float) 18.7038, (float) 0), - new CoordRec((float) 23.4657, (float) -9.5238), - new CoordRec((float) 23.4657, (float) -19.0476), - new CoordRec((float) 18.7038, (float) -28.5714), -}; - -static final CoordRec char125_stroke2[] = { - new CoordRec((float) 23.4657, (float) 38.0952), - new CoordRec((float) 13.9419, (float) 28.5714), - new CoordRec((float) 13.9419, (float) 19.0476), - new CoordRec((float) 18.7038, (float) 9.5238), - new CoordRec((float) 23.4657, (float) 4.7619), - new CoordRec((float) 28.2276, (float) -4.7619), - new CoordRec((float) 28.2276, (float) -14.2857), - new CoordRec((float) 23.4657, (float) -23.8095), - new CoordRec((float) 18.7038, (float) -28.5714), - new CoordRec((float) 9.18, (float) -33.3333), -}; - -static final StrokeRec char125[] = { - new StrokeRec(10, char125_stroke0), - new StrokeRec(17, char125_stroke1), - new StrokeRec(10, char125_stroke2), -}; - -/* char: 126 '~' */ - -static final CoordRec char126_stroke0[] = { - new CoordRec((float) 2.92, (float) 28.5714), - new CoordRec((float) 2.92, (float) 38.0952), - new CoordRec((float) 7.6819, (float) 52.381), - new CoordRec((float) 17.2057, (float) 57.1429), - new CoordRec((float) 26.7295, (float) 57.1429), - new CoordRec((float) 36.2533, (float) 52.381), - new CoordRec((float) 55.301, (float) 38.0952), - new CoordRec((float) 64.8248, (float) 33.3333), - new CoordRec((float) 74.3486, (float) 33.3333), - new CoordRec((float) 83.8724, (float) 38.0952), - new CoordRec((float) 88.6343, (float) 47.619), -}; - -static final CoordRec char126_stroke1[] = { - new CoordRec((float) 2.92, (float) 38.0952), - new CoordRec((float) 7.6819, (float) 47.619), - new CoordRec((float) 17.2057, (float) 52.381), - new CoordRec((float) 26.7295, (float) 52.381), - new CoordRec((float) 36.2533, (float) 47.619), - new CoordRec((float) 55.301, (float) 33.3333), - new CoordRec((float) 64.8248, (float) 28.5714), - new CoordRec((float) 74.3486, (float) 28.5714), - new CoordRec((float) 83.8724, (float) 33.3333), - new CoordRec((float) 88.6343, (float) 47.619), - new CoordRec((float) 88.6343, (float) 57.1429), -}; - -static final StrokeRec char126[] = { - new StrokeRec(11, char126_stroke0), - new StrokeRec(11, char126_stroke1), -}; - -/* char: 127 */ - -static final CoordRec char127_stroke0[] = { - new CoordRec((float) 52.381, (float) 100), - new CoordRec((float) 14.2857, (float) -33.3333), -}; - -static final CoordRec char127_stroke1[] = { - new CoordRec((float) 28.5714, (float) 66.6667), - new CoordRec((float) 14.2857, (float) 61.9048), - new CoordRec((float) 4.7619, (float) 52.381), - new CoordRec((float) 0, (float) 38.0952), - new CoordRec((float) 0, (float) 23.8095), - new CoordRec((float) 4.7619, (float) 14.2857), - new CoordRec((float) 14.2857, (float) 4.7619), - new CoordRec((float) 28.5714, (float) 0), - new CoordRec((float) 38.0952, (float) 0), - new CoordRec((float) 52.381, (float) 4.7619), - new CoordRec((float) 61.9048, (float) 14.2857), - new CoordRec((float) 66.6667, (float) 28.5714), - new CoordRec((float) 66.6667, (float) 42.8571), - new CoordRec((float) 61.9048, (float) 52.381), - new CoordRec((float) 52.381, (float) 61.9048), - new CoordRec((float) 38.0952, (float) 66.6667), - new CoordRec((float) 28.5714, (float) 66.6667), -}; - -static final StrokeRec char127[] = { - new StrokeRec(2, char127_stroke0), - new StrokeRec(17, char127_stroke1), -}; - -static final StrokeCharRec chars[] = { - new StrokeCharRec( 0, /* char0 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char1 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char2 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char3 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char4 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char5 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char6 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char7 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char8 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char9 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char10 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char11 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char12 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char13 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char14 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char15 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char16 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char17 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char18 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char19 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char20 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char21 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char22 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char23 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char24 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char25 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char26 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char27 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char28 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char29 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char30 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char31 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char32 */ null, (float) 52.381, (float) 104.762 ), - new StrokeCharRec( 2, char33, (float) 13.3819, (float) 26.6238 ), - new StrokeCharRec( 2, char34, (float) 23.0676, (float) 51.4352 ), - new StrokeCharRec( 4, char35, (float) 36.5333, (float) 79.4886 ), - new StrokeCharRec( 3, char36, (float) 38.1533, (float) 76.2067 ), - new StrokeCharRec( 3, char37, (float) 49.2171, (float) 96.5743 ), - new StrokeCharRec( 1, char38, (float) 53.599, (float) 101.758 ), - new StrokeCharRec( 1, char39, (float) 4.44, (float) 13.62 ), - new StrokeCharRec( 1, char40, (float) 21.8657, (float) 47.1733 ), - new StrokeCharRec( 1, char41, (float) 24.3276, (float) 47.5333 ), - new StrokeCharRec( 3, char42, (float) 30.7695, (float) 59.439 ), - new StrokeCharRec( 2, char43, (float) 48.8371, (float) 97.2543 ), - new StrokeCharRec( 1, char44, (float) 13.5219, (float) 26.0638 ), - new StrokeCharRec( 1, char45, (float) 50.2371, (float) 100.754 ), - new StrokeCharRec( 1, char46, (float) 13.1019, (float) 26.4838 ), - new StrokeCharRec( 1, char47, (float) 40.5733, (float) 82.1067 ), - new StrokeCharRec( 1, char48, (float) 38.3133, (float) 77.0667 ), - new StrokeCharRec( 1, char49, (float) 30.8676, (float) 66.5295 ), - new StrokeCharRec( 1, char50, (float) 38.7533, (float) 77.6467 ), - new StrokeCharRec( 1, char51, (float) 38.3333, (float) 77.0467 ), - new StrokeCharRec( 2, char52, (float) 37.2133, (float) 80.1686 ), - new StrokeCharRec( 1, char53, (float) 38.1933, (float) 77.6867 ), - new StrokeCharRec( 1, char54, (float) 34.1514, (float) 73.8048 ), - new StrokeCharRec( 2, char55, (float) 38.8933, (float) 77.2267 ), - new StrokeCharRec( 1, char56, (float) 38.9333, (float) 77.6667 ), - new StrokeCharRec( 1, char57, (float) 39.9333, (float) 74.0648 ), - new StrokeCharRec( 2, char58, (float) 14.0819, (float) 26.2238 ), - new StrokeCharRec( 2, char59, (float) 12.9619, (float) 26.3038 ), - new StrokeCharRec( 1, char60, (float) 41.1552, (float) 81.6105 ), - new StrokeCharRec( 2, char61, (float) 48.5571, (float) 97.2543 ), - new StrokeCharRec( 1, char62, (float) 40.8752, (float) 81.6105 ), - new StrokeCharRec( 2, char63, (float) 36.9914, (float) 73.9029 ), - new StrokeCharRec( 2, char64, (float) 34.9314, (float) 74.3648 ), - new StrokeCharRec( 3, char65, (float) 40.5952, (float) 80.4905 ), - new StrokeCharRec( 3, char66, (float) 44.7533, (float) 83.6267 ), - new StrokeCharRec( 1, char67, (float) 39.9933, (float) 84.4886 ), - new StrokeCharRec( 2, char68, (float) 45.2933, (float) 85.2867 ), - new StrokeCharRec( 4, char69, (float) 39.9914, (float) 78.1848 ), - new StrokeCharRec( 3, char70, (float) 39.9914, (float) 78.7448 ), - new StrokeCharRec( 2, char71, (float) 40.3933, (float) 89.7686 ), - new StrokeCharRec( 3, char72, (float) 44.7533, (float) 89.0867 ), - new StrokeCharRec( 1, char73, (float) 10.86, (float) 21.3 ), - new StrokeCharRec( 1, char74, (float) 31.0714, (float) 59.999 ), - new StrokeCharRec( 3, char75, (float) 44.6133, (float) 79.3267 ), - new StrokeCharRec( 2, char76, (float) 40.2514, (float) 71.3229 ), - new StrokeCharRec( 4, char77, (float) 48.9552, (float) 97.2105 ), - new StrokeCharRec( 3, char78, (float) 44.4733, (float) 88.8067 ), - new StrokeCharRec( 1, char79, (float) 44.3352, (float) 88.8305 ), - new StrokeCharRec( 2, char80, (float) 45.4333, (float) 85.6667 ), - new StrokeCharRec( 2, char81, (float) 43.3952, (float) 88.0905 ), - new StrokeCharRec( 3, char82, (float) 45.0133, (float) 82.3667 ), - new StrokeCharRec( 1, char83, (float) 41.3333, (float) 80.8267 ), - new StrokeCharRec( 2, char84, (float) 35.6933, (float) 71.9467 ), - new StrokeCharRec( 1, char85, (float) 44.8733, (float) 89.4867 ), - new StrokeCharRec( 2, char86, (float) 40.4552, (float) 81.6105 ), - new StrokeCharRec( 4, char87, (float) 49.839, (float) 100.518 ), - new StrokeCharRec( 2, char88, (float) 35.8333, (float) 72.3667 ), - new StrokeCharRec( 2, char89, (float) 39.6152, (float) 79.6505 ), - new StrokeCharRec( 3, char90, (float) 35.8333, (float) 73.7467 ), - new StrokeCharRec( 4, char91, (float) 22.0657, (float) 46.1133 ), - new StrokeCharRec( 1, char92, (float) 39.1733, (float) 78.2067 ), - new StrokeCharRec( 4, char93, (float) 23.4876, (float) 46.3933 ), - new StrokeCharRec( 2, char94, (float) 44.0752, (float) 90.2305 ), - new StrokeCharRec( 1, char95, (float) 51.281, (float) 104.062 ), - new StrokeCharRec( 2, char96, (float) 42.5457, (float) 83.5714 ), - new StrokeCharRec( 2, char97, (float) 35.2514, (float) 66.6029 ), - new StrokeCharRec( 2, char98, (float) 37.3314, (float) 70.4629 ), - new StrokeCharRec( 1, char99, (float) 34.0914, (float) 68.9229 ), - new StrokeCharRec( 2, char100, (float) 33.2114, (float) 70.2629 ), - new StrokeCharRec( 1, char101, (float) 34.2914, (float) 68.5229 ), - new StrokeCharRec( 2, char102, (float) 14.9657, (float) 38.6552 ), - new StrokeCharRec( 2, char103, (float) 33.9314, (float) 70.9829 ), - new StrokeCharRec( 2, char104, (float) 33.4095, (float) 71.021 ), - new StrokeCharRec( 2, char105, (float) 14.7819, (float) 28.8638 ), - new StrokeCharRec( 2, char106, (float) 17.3876, (float) 36.2314 ), - new StrokeCharRec( 3, char107, (float) 33.4095, (float) 62.521 ), - new StrokeCharRec( 1, char108, (float) 10.02, (float) 19.34 ), - new StrokeCharRec( 3, char109, (float) 61.981, (float) 123.962 ), - new StrokeCharRec( 2, char110, (float) 32.9895, (float) 70.881 ), - new StrokeCharRec( 1, char111, (float) 33.5514, (float) 71.7448 ), - new StrokeCharRec( 2, char112, (float) 38.0314, (float) 70.8029 ), - new StrokeCharRec( 2, char113, (float) 33.4114, (float) 70.7429 ), - new StrokeCharRec( 2, char114, (float) 23.7457, (float) 49.4952 ), - new StrokeCharRec( 1, char115, (float) 28.5095, (float) 62.321 ), - new StrokeCharRec( 2, char116, (float) 14.8257, (float) 39.3152 ), - new StrokeCharRec( 2, char117, (float) 33.2695, (float) 71.161 ), - new StrokeCharRec( 2, char118, (float) 30.3714, (float) 60.6029 ), - new StrokeCharRec( 4, char119, (float) 40.5952, (float) 80.4905 ), - new StrokeCharRec( 2, char120, (float) 25.4695, (float) 56.401 ), - new StrokeCharRec( 2, char121, (float) 35.1333, (float) 66.0648 ), - new StrokeCharRec( 3, char122, (float) 28.2495, (float) 61.821 ), - new StrokeCharRec( 3, char123, (float) 21.6657, (float) 41.6295 ), - new StrokeCharRec( 1, char124, (float) 11.54, (float) 23.78 ), - new StrokeCharRec( 3, char125, (float) 18.7038, (float) 41.4695 ), - new StrokeCharRec( 2, char126, (float) 45.7771, (float) 91.2743 ), - new StrokeCharRec( 2, char127, (float) 33.3333, (float) 66.6667 ), -}; - -static final StrokeFontRec glutStrokeRoman = new StrokeFontRec( "Roman", 128, chars, (float) 119.048, (float) -33.3333 ); -} diff --git a/src/net/java/games/jogl/util/StrokeCharRec.java b/src/net/java/games/jogl/util/StrokeCharRec.java deleted file mode 100644 index 7c961fb4d..000000000 --- a/src/net/java/games/jogl/util/StrokeCharRec.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -class StrokeCharRec { - int num_strokes; - StrokeRec[] stroke; - float center; - float right; - - StrokeCharRec(int num_strokes, - StrokeRec[] stroke, - float center, - float right) { - this.num_strokes = num_strokes; - this.stroke = stroke; - this.center = center; - this.right = right; - } -} diff --git a/src/net/java/games/jogl/util/StrokeFontRec.java b/src/net/java/games/jogl/util/StrokeFontRec.java deleted file mode 100644 index 133380a77..000000000 --- a/src/net/java/games/jogl/util/StrokeFontRec.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -class StrokeFontRec { - String name; - int num_chars; - StrokeCharRec[] ch; - float top; - float bottom; - - StrokeFontRec(String name, - int num_chars, - StrokeCharRec[] ch, - float top, - float bottom) { - this.name = name; - this.num_chars = num_chars; - this.ch = ch; - this.top = top; - this.bottom = bottom; - } -} diff --git a/src/net/java/games/jogl/util/StrokeRec.java b/src/net/java/games/jogl/util/StrokeRec.java deleted file mode 100644 index cc4571465..000000000 --- a/src/net/java/games/jogl/util/StrokeRec.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package net.java.games.jogl.util; - -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -class StrokeRec { - int num_coords; - CoordRec[] coord; - - StrokeRec(int num_coords, - CoordRec[] coord) { - this.num_coords = num_coords; - this.coord = coord; - } -} -- cgit v1.2.3