From dc48fb0f101dfefd3f4fb23f585d14de7fa9a6fe Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 23 Feb 2023 22:07:26 +0100 Subject: Graph UI: Update demos, move pure demo code from demos/ui -> demos, rename test-shapes --- .../jogamp/opengl/test/junit/graph/FontSet01.java | 16 +- .../junit/graph/demos/GPUUISceneGLListener0A.java | 127 ++-- .../graph/demos/GPUUISceneNewtCanvasAWTDemo.java | 28 +- .../test/junit/graph/demos/GPUUISceneNewtDemo.java | 21 +- .../test/junit/graph/demos/UIShapeDemo01.java | 568 +++++++++++++++ .../test/junit/graph/demos/UITypeDemo01.java | 616 ++++++++++++++++ .../test/junit/graph/demos/ui/LabelButton.java | 4 +- .../test/junit/graph/demos/ui/TestObject01.java | 314 -------- .../test/junit/graph/demos/ui/TestObject02.java | 650 ----------------- .../test/junit/graph/demos/ui/UIShapeDemo01.java | 566 --------------- .../test/junit/graph/demos/ui/UITypeDemo01.java | 595 --------------- .../graph/testshapes/Glyph01UbuntuLight_o.java | 316 ++++++++ .../graph/testshapes/Glyph02UbuntuLight_ae.java | 652 +++++++++++++++++ .../graph/testshapes/Glyph03FreeMonoRegular_M.java | 804 +++++++++++++++++++++ .../junit/graph/testshapes/Glyph04FreeSans_0.java | 150 ++++ .../testshapes/Glyph05FreeSerifBoldItalic_ae.java | 287 ++++++++ 16 files changed, 3508 insertions(+), 2206 deletions(-) create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/demos/UIShapeDemo01.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShapeDemo01.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java (limited to 'src/test/com') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java b/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java index a2dc8430d..c2f2de020 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java @@ -15,21 +15,21 @@ public class FontSet01 { fonts[i++] = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_NONE); fonts[i++] = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_ITALIC); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMono.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMonoBold.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSans.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSansBold.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerif.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifBold.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifBoldItalic.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifItalic.ttf", - TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true); + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); return fonts; } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index 790315354..22c9af424 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -17,6 +17,7 @@ import com.jogamp.opengl.GLPipelineFactory; import com.jogamp.opengl.GLRunnable; import com.jogamp.common.net.Uri; +import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -35,6 +36,7 @@ import com.jogamp.newt.event.MouseEvent.PointerClass; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.VectorUtil; +import com.jogamp.opengl.test.junit.graph.FontSet01; import com.jogamp.opengl.test.junit.graph.demos.ui.CrossHair; import com.jogamp.opengl.test.junit.graph.demos.ui.GLEventListenerButton; import com.jogamp.opengl.test.junit.graph.demos.ui.Label; @@ -65,24 +67,24 @@ public class GPUUISceneGLListener0A implements GLEventListener { private int renderModes; private RegionRenderer renderer; - private final int fontSet = FontFactory.UBUNTU; - private Font font; + private final Font font; + private final Font fontFPS; private final float sceneDist = 3000f; private final float zNear = 0.1f, zFar = 7000f; - private final float relTop = 5f/6f; - private final float relMiddle = 2f/6f; - private final float relLeft = 1f/6f; + private final float relTop = 80f/100f; + private final float relMiddle = 22f/100f; + private final float relLeft = 11f/100f; /** Proportional Button Size to Window Height, per-vertical-pixels [PVP] */ private final float buttonYSizePVP = 0.084f; - private final float buttonXSizePVP = 0.105f; + private final float buttonXSizePVP = 0.084f; // 0.105f; private final float fontSizePt = 10f; /** Proportional Font Size to Window Height for Main Text, per-vertical-pixels [PVP] */ private final float fontSizeFixedPVP = 0.04f; /** Proportional Font Size to Window Height for FPS Status Line, per-vertical-pixels [PVP] */ - private final float fontSizeFpsPVP = 0.04f; + private final float fontSizeFpsPVP = 0.03f; private float dpiH = 96; /** @@ -112,6 +114,20 @@ public class GPUUISceneGLListener0A implements GLEventListener { private final String jogamp = "JogAmp - Jogl Graph Module Demo"; private final String truePtSize = fontSizePt+" pt font size label - true scale!"; + private final String longText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec \n"+ + "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel\n"+ + "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices\n"+ + "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia\n"+ + "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat\n"+ + "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum\n"+ + "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin.\n"+ + "\n"+ + "Lyford’s in Texas & L’Anse-aux-Griffons in Québec;\n"+ + "Kwikpak on the Yukon delta, Kvæven in Norway, Kyulu in Kenya, not Rwanda.…\n"+ + "Ytterbium in the periodic table. Are Toussaint L’Ouverture, Wölfflin, Wolfe,\n"+ + "\n"+ + "The quick brown fox jumps over the lazy dog\n"; + public GPUUISceneGLListener0A() { this(0); } @@ -120,14 +136,14 @@ public class GPUUISceneGLListener0A implements GLEventListener { * @param noAADPIThreshold see {@link #DefaultNoAADPIThreshold} */ public GPUUISceneGLListener0A(final float noAADPIThreshold) { - this(noAADPIThreshold, false, false); + this(null, noAADPIThreshold, false, false); } /** * @param renderModes */ public GPUUISceneGLListener0A(final int renderModes) { - this(renderModes, false, false); + this(null, renderModes, false, false); } /** @@ -135,8 +151,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { * @param debug * @param trace */ - public GPUUISceneGLListener0A(final int renderModes, final boolean debug, final boolean trace) { - this(0f, renderModes, debug, trace); + public GPUUISceneGLListener0A(final String fontfilename, final int renderModes, final boolean debug, final boolean trace) { + this(fontfilename, 0f, renderModes, debug, trace); } /** @@ -144,11 +160,11 @@ public class GPUUISceneGLListener0A implements GLEventListener { * @param debug * @param trace */ - public GPUUISceneGLListener0A(final float noAADPIThreshold, final boolean debug, final boolean trace) { - this(noAADPIThreshold, 0, debug, trace); + public GPUUISceneGLListener0A(final String fontfilename, final float noAADPIThreshold, final boolean debug, final boolean trace) { + this(fontfilename, noAADPIThreshold, 0, debug, trace); } - private GPUUISceneGLListener0A(final float noAADPIThreshold, final int renderModes, final boolean debug, final boolean trace) { + private GPUUISceneGLListener0A(final String fontfilename, final float noAADPIThreshold, final int renderModes, final boolean debug, final boolean trace) { this.noAADPIThreshold = noAADPIThreshold; this.rs = RenderState.createRenderState(SVertex.factory()); this.debug = debug; @@ -157,7 +173,18 @@ public class GPUUISceneGLListener0A implements GLEventListener { this.renderModes = renderModes; try { - font = FontFactory.get(FontFactory.UBUNTU).getDefault(); + if( null == fontfilename ) { + font = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerif.ttf", + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); + } else { + font = FontFactory.get( new File( fontfilename ) ); + } + System.err.println("Font "+font.getFullFamilyName()); + + fontFPS = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMonoBold.ttf", + FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true); + System.err.println("Font FPS "+fontFPS.getFullFamilyName()); + } catch (final IOException ioe) { throw new RuntimeException(ioe); } @@ -254,7 +281,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "v-sync", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "V-Sync", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setToggleable(true); button.setToggle(gl.getSwapInterval()>0); @@ -277,7 +304,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "< tilt >", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "< Tilt >", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -299,7 +326,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); if( pass2Mode ) { // second column to the left - button = new LabelButton(SVertex.factory(), renderModes, font, "< samples >", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "< Samples >", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -321,7 +348,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "< quality >", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "< Quality >", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -376,7 +403,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { { final int j = 1; // column int k = 0; // row - button = new LabelButton(SVertex.factory(), renderModes, font, "y flip", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "Y Flip", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -387,7 +414,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "x flip", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "X Flip", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -425,7 +452,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "< space >", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "< Space >", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -449,7 +476,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "< corner >", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "< Corner >", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -474,7 +501,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "reset", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "Reset", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -485,7 +512,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "screenshot", buttonXSize, buttonYSize); + button = new LabelButton(SVertex.factory(), renderModes, font, "Snapshot", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override @@ -646,17 +673,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { "MNOPQRSTUVWXYZ\n"+ "0123456789.:,;(*!?/\\\")$%^&-+@~#<>{}[]"; - strings[i++] = "The quick brown fox\njumps over the lazy\ndog"; + strings[i++] = "The quick brown fox jumps over the lazy dog"; - strings[i++] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec \n"+ - "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel\n"+ - "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices\n"+ - "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia\n"+ - "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat\n"+ - "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum\n"+ - "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin.\n"; + strings[i++] = longText; labels = new Label[i]; + + currentText = strings.length - 1; } @@ -685,17 +708,20 @@ public class GPUUISceneGLListener0A implements GLEventListener { * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 */ final float pixelSizeFPS = fontSizeFpsPVP * drawable.getSurfaceHeight(); - fpsLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFPS, "Nothing there yet"); + fpsLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, fontFPS, pixelSizeFPS, "Nothing there yet"); fpsLabel.addMouseListener(dragZoomRotateListener); sceneUIController.addShape(fpsLabel); fpsLabel.setEnabled(enableOthers); - fpsLabel.setColor(0.3f, 0.3f, 0.3f, 1.0f); + fpsLabel.setColor(0.1f, 0.1f, 0.1f, 1.0f); + fpsLabel.translate(0f, pixelSizeFPS * (fontFPS.getMetrics().getLineGap() - fontFPS.getMetrics().getDescent()), 0f); - crossHairCtr = new CrossHair(renderer.getRenderState().getVertexFactory(), 0, 100f, 100f, 2f); - crossHairCtr.addMouseListener(dragZoomRotateListener); - sceneUIController.addShape(crossHairCtr); - crossHairCtr.setEnabled(true); - crossHairCtr.translate(0f, 0f, -1f); + if( false ) { + crossHairCtr = new CrossHair(renderer.getRenderState().getVertexFactory(), 0, 100f, 100f, 2f); + crossHairCtr.addMouseListener(dragZoomRotateListener); + sceneUIController.addShape(crossHairCtr); + crossHairCtr.setEnabled(true); + crossHairCtr.translate(0f, 0f, -1f); + } initButtons(drawable.getGL().getGL2ES2(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), renderer); for(int i=0; i obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord0[0], objCoord0[1], objCoord0[2]); + } + } + glWinX = drawable.getSurfaceWidth(); + glWinY = drawable.getSurfaceHeight(); + if( pmv.gluUnProject(glWinX, glWinY, winZ, renderer.getViewport(), 0, objCoord1, 0) ) { + if( once ) { + System.err.printf("winToObjCoord: win [%f, %f, %f] -> obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord1[0], objCoord1[1], objCoord1[2]); + } + } + full_width_o = objCoord1[0] - objCoord0[0]; + } + final AABBox txt_box_em = font.getGlyphBounds(text); + final float full_width_s = full_width_o / txt_box_em.getWidth(); + final float txt_scale = full_width_s/2f; + pmv.glPushMatrix(); + pmv.glScalef(txt_scale, txt_scale, 1f); + pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new float[] { 0, 0, 0, 1 }, sampleCount); + if( once ) { + final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); + System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); + System.err.println("XXX: txt_box_em "+txt_box_em); + System.err.println("XXX: txt_box_e2 "+txt_box_em2); + System.err.println("XXX: txt_box_rg "+txt_box_r); + once = false; + } + pmv.glPopMatrix(); + } + renderer.enable(gl, false); + } + static boolean once = true; + + @Override + public void dispose(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + button.destroy(gl, getRegionRenderer()); + crossHair.destroy(gl, getRegionRenderer()); + + autoDrawable = null; + screenshot.dispose(gl); + rRenderer.destroy(gl); + } + + /** Attach the input listener to the window */ + public void attachInputListenerTo(final GLWindow window) { + if ( null == keyAction ) { + keyAction = new KeyAction(); + window.addKeyListener(keyAction); + } + if ( null == mouseAction ) { + mouseAction = new MouseAction(); + window.addMouseListener(mouseAction); + } + } + + public void detachFrom(final GLWindow window) { + if ( null == keyAction ) { + return; + } + if ( null == mouseAction ) { + return; + } + window.removeGLEventListener(this); + window.removeKeyListener(keyAction); + window.removeMouseListener(mouseAction); + } + + public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName); + + final String filename = dir + tech + sw +".png"; + if(screenshot.readPixels(drawable.getGL(), false)) { + screenshot.write(new File(filename)); + } + } + + int screenshot_num = 0; + + public void setIgnoreInput(final boolean v) { + ignoreInput = v; + } + public boolean getIgnoreInput() { + return ignoreInput; + } + + public class MouseAction implements MouseListener{ + + @Override + public void mouseClicked(final MouseEvent e) { + + } + + @Override + public void mouseEntered(final MouseEvent e) { + } + + @Override + public void mouseExited(final MouseEvent e) { + } + + @Override + public void mousePressed(final MouseEvent e) { + autoDrawable.invoke(false, new GLRunnable() { // avoid data-race + @Override + public boolean run(final GLAutoDrawable drawable) { + System.err.println("\n\nMouse: "+e); + + final RegionRenderer renderer = getRegionRenderer(); + final PMVMatrix pmv = renderer.getMatrix(); + pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); + pmv.glLoadIdentity(); + pmv.glTranslatef(xTran, yTran, zTran); + + // flip to GL window coordinates, origin bottom-left + final int[] viewport = renderer.getViewport(new int[4]); + final int glWinX = e.getX(); + final int glWinY = viewport[3] - e.getY() - 1; + + { + pmv.glPushMatrix(); + button.setTransform(pmv); + + final float[] objPos = new float[3]; + System.err.println("\n\nButton: "+button); + button.winToObjCoord(renderer, glWinX, glWinY, objPos); + System.err.println("Button: Click: Win "+glWinX+"/"+glWinY+" -> Obj "+objPos[0]+"/"+objPos[1]+"/"+objPos[1]); + + final int[] surfaceSize = new int[2]; + button.getSurfaceSize(renderer, surfaceSize); + System.err.println("Button: Size: Pixel "+surfaceSize[0]+" x "+surfaceSize[1]); + + pmv.glPopMatrix(); + } + { + pmv.glPushMatrix(); + crossHair.setTransform(pmv); + + final float[] objPosC = crossHair.getBounds().getCenter(); + final int[] objWinPos = new int[2]; + System.err.println("\n\nCrossHair: "+crossHair); + if( crossHair.objToWinCoord(renderer, objPosC, objWinPos) ) { + System.err.println("CrossHair: Obj: Obj "+objPosC[0]+"/"+objPosC[1]+"/"+objPosC[1]+" -> Win "+objWinPos[0]+"/"+objWinPos[1]); + } + + final float[] objPos2 = new float[3]; + crossHair.winToObjCoord(renderer, objWinPos[0], objWinPos[1], objPos2); + System.err.println("CrossHair: Obj: Win "+objWinPos[0]+"/"+objWinPos[1]+" -> Obj "+objPos2[0]+"/"+objPos2[1]+"/"+objPos2[1]); + + final float[] winObjPos = new float[3]; + if( crossHair.winToObjCoord(renderer, glWinX, glWinY, winObjPos) ) { + // final float[] translate = crossHair.getTranslate(); + // final float[] objPosT = new float[] { objPosC[0]+translate[0], objPosC[1]+translate[1], objPosC[2]+translate[2] }; + final float dx = winObjPos[0] - objPosC[0]; + final float dy = winObjPos[1] - objPosC[1]; + // final float dz = winObjPos[2] - objPosT[2]; + if( !FloatUtil.isZero(dx, FloatUtil.EPSILON) || !FloatUtil.isZero(dy, FloatUtil.EPSILON) ) { + System.err.println("CrossHair: Move.1: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); + crossHair.translate(dx, dy, 0f); + } else { + System.err.println("CrossHair: Move.0: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); + } + } + + final int[] surfaceSize = new int[2]; + crossHair.getSurfaceSize(renderer, surfaceSize); + System.err.println("CrossHair: Size: Pixel "+surfaceSize[0]+" x "+surfaceSize[1]); + + pmv.glPopMatrix(); + } + return true; + } } ); + + } + + @Override + public void mouseReleased(final MouseEvent e) { + } + + @Override + public void mouseMoved(final MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDragged(final MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseWheelMoved(final MouseEvent e) { + // TODO Auto-generated method stub + + } + + } + + public class KeyAction implements KeyListener { + @Override + public void keyPressed(final KeyEvent arg0) { + if(ignoreInput) { + return; + } + + if(arg0.getKeyCode() == KeyEvent.VK_1){ + button.translate(0f, 0f, -zTran/10f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_2){ + button.translate(0f, 0f, zTran/10f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_UP){ + button.translate(0f, button.getHeight()/10f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_DOWN){ + button.translate(0f, -button.getHeight()/10f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_LEFT){ + button.translate(-button.getWidth()/10f, 0f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_RIGHT){ + button.translate(button.getWidth()/10f, 0f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_4){ + button.setSpacing(button.getSpacingX()-0.01f, button.getSpacingY()-0.005f); + System.err.println("Button Spacing: " + button.getSpacingX()); + } + else if(arg0.getKeyCode() == KeyEvent.VK_5){ + button.setSpacing(button.getSpacingX()+0.01f, button.getSpacingY()+0.005f); + System.err.println("Button Spacing: " + button.getSpacingX()); + } + else if(arg0.getKeyCode() == KeyEvent.VK_6){ + button.setCorner(button.getCorner()-0.01f); + System.err.println("Button Corner: " + button.getCorner()); + } + else if(arg0.getKeyCode() == KeyEvent.VK_7){ + button.setCorner(button.getCorner()+0.01f); + System.err.println("Button Corner: " + button.getCorner()); + } + else if(arg0.getKeyCode() == KeyEvent.VK_0){ + // rotate(1); + } + else if(arg0.getKeyCode() == KeyEvent.VK_9){ + // rotate(-1); + } + else if(arg0.getKeyCode() == KeyEvent.VK_V) { + if(null != autoDrawable) { + autoDrawable.invoke(false, new GLRunnable() { + @Override + public boolean run(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); + final int _i = gl.getSwapInterval(); + final int i; + switch(_i) { + case 0: i = 1; break; + case 1: i = -1; break; + case -1: i = 0; break; + default: i = 1; break; + } + gl.setSwapInterval(i); + + final GLAnimatorControl a = drawable.getAnimator(); + if( null != a ) { + a.resetFPSCounter(); + } + if(drawable instanceof FPSCounter) { + ((FPSCounter)drawable).resetFPSCounter(); + } + System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval()); + return true; + } + }); + } + } + else if(arg0.getKeyCode() == KeyEvent.VK_S){ + if(null != autoDrawable) { + autoDrawable.invoke(false, new GLRunnable() { + @Override + public boolean run(final GLAutoDrawable drawable) { + try { + final String type = Region.getRenderModeString(renderModes); + printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); + screenshot_num++; + } catch (final GLException e) { + e.printStackTrace(); + } catch (final IOException e) { + e.printStackTrace(); + } + return true; + } + }); + } + } + } + @Override + public void keyReleased(final KeyEvent arg0) {} + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java new file mode 100644 index 000000000..0b372054e --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java @@ -0,0 +1,616 @@ +/** + * Copyright 2010-2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.graph.demos; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.math.FloatUtil; +import com.jogamp.opengl.math.geom.AABBox; +import com.jogamp.opengl.test.junit.graph.demos.ui.CrossHair; +import com.jogamp.opengl.test.junit.graph.demos.ui.Rectangle; +import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.opengl.test.junit.graph.testshapes.Glyph03FreeMonoRegular_M; +import com.jogamp.opengl.test.junit.graph.testshapes.Glyph04FreeSans_0; +import com.jogamp.opengl.test.junit.graph.testshapes.Glyph05FreeSerifBoldItalic_ae; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.common.util.InterruptSource; +import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.GLRegion; +import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.curve.opengl.TextRegionUtil; +import com.jogamp.graph.font.Font; +import com.jogamp.graph.font.FontFactory; +import com.jogamp.graph.font.FontSet; +import com.jogamp.graph.font.Font.Glyph; +import com.jogamp.graph.geom.SVertex; +import com.jogamp.newt.Window; +import com.jogamp.newt.event.KeyAdapter; +import com.jogamp.newt.event.KeyEvent; +import com.jogamp.newt.event.KeyListener; +import com.jogamp.newt.event.MouseEvent; +import com.jogamp.newt.event.MouseListener; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.GLReadBufferUtil; +import com.jogamp.opengl.util.PMVMatrix; + +/** + * Basic UIShape and Type Rendering demo. + * + * Action Keys: + * - 1/2: zoom in/out + * - 4/5: increase/decrease shape/text spacing + * - 6/7: increase/decrease corner size + * - 0/9: rotate + * - v: toggle v-sync + * - s: screenshot + */ +public class UITypeDemo01 implements GLEventListener { + static final boolean DEBUG = false; + static final boolean TRACE = false; + + public static void main(final String[] args) throws IOException { + Font font = null; + String text = "Hello Origin."; + int glyph_id = Glyph.ID_UNKNOWN; + if( 0 != args.length ) { + for(int i=0; i obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord0[0], objCoord0[1], objCoord0[2]); + } + } + glWinX = drawable.getSurfaceWidth(); + glWinY = drawable.getSurfaceHeight(); + if( pmv.gluUnProject(glWinX, glWinY, winZ, renderer.getViewport(), 0, objCoord1, 0) ) { + if( once ) { + System.err.printf("winToObjCoord: win [%f, %f, %f] -> obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord1[0], objCoord1[1], objCoord1[2]); + } + } + full_width_o = objCoord1[0] - objCoord0[0]; + full_height_o = objCoord1[1] - objCoord0[1]; + } + pmv.glPushMatrix(); + + final Font.Glyph glyph; + if( Glyph.ID_UNKNOWN < glyph_id ) { + glyph = font.getGlyph(glyph_id); + if( once ) { + System.err.println("glyph_id "+glyph_id+": "+glyph); + } + } else { + glyph = null; + } + if( null != glyph && glyph.getID() != Glyph.ID_UNKNOWN ) { + final AABBox txt_box_em = glyph.getBBox(); + final float full_width_s = full_width_o / txt_box_em.getWidth(); + final float full_height_s = full_height_o / txt_box_em.getHeight(); + final float txt_scale = full_width_s < full_height_s ? full_width_s/2f : full_height_s/2f; + pmv.glScalef(txt_scale, txt_scale, 1f); + pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); + if( null != glyph.getShape() ) { + final GLRegion region = GLRegion.create(renderModes, null); + region.addOutlineShape(glyph.getShape(), null, region.hasColorChannel() ? fg_color : null); + region.draw(gl, renderer, sampleCount); + region.destroy(gl); + } + if( once ) { + final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); + System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); + System.err.println("XXX: full_height: "+full_height_o+" / "+txt_box_em.getHeight()+" -> "+full_height_s); + System.err.println("XXX: txt_scale: "+txt_scale); + System.err.println("XXX: txt_box_em "+txt_box_em); + System.err.println("XXX: txt_box_e2 "+txt_box_em2); + } + } else if( Glyph.ID_UNKNOWN == glyph_id ) { + final AABBox txt_box_em = font.getGlyphBounds(text); + final float full_width_s = full_width_o / txt_box_em.getWidth(); + final float full_height_s = full_height_o / txt_box_em.getHeight(); + final float txt_scale = full_width_s < full_height_s ? full_width_s/2f : full_height_s/2f; + pmv.glScalef(txt_scale, txt_scale, 1f); + pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, sampleCount); + if( once ) { + final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); + System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); + System.err.println("XXX: full_height: "+full_height_o+" / "+txt_box_em.getHeight()+" -> "+full_height_s); + System.err.println("XXX: txt_scale: "+txt_scale); + System.err.println("XXX: txt_box_em "+txt_box_em); + System.err.println("XXX: txt_box_e2 "+txt_box_em2); + System.err.println("XXX: txt_box_rg "+txt_box_r); + } + } + pmv.glPopMatrix(); + if( once ) { + try { + printScreen(drawable); + } catch (GLException | IOException e) { + e.printStackTrace(); + } + } + once = false; + } + renderer.enable(gl, false); + } + private boolean once = true; + + @Override + public void dispose(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + crossHair.destroy(gl, getRegionRenderer()); + testObj.destroy(gl, getRegionRenderer()); + + autoDrawable = null; + screenshot.dispose(gl); + rRenderer.destroy(gl); + } + + /** Attach the input listener to the window */ + public void attachInputListenerTo(final GLWindow window) { + if ( null == keyAction ) { + keyAction = new KeyAction(); + window.addKeyListener(keyAction); + } + if ( null == mouseAction ) { + mouseAction = new MouseAction(); + window.addMouseListener(mouseAction); + } + } + + public void detachFrom(final GLWindow window) { + if ( null == keyAction ) { + return; + } + if ( null == mouseAction ) { + return; + } + window.removeGLEventListener(this); + window.removeKeyListener(keyAction); + window.removeMouseListener(mouseAction); + } + + public void printScreen(final GLAutoDrawable drawable) throws GLException, IOException { + final String dir = "./"; + final String tech="demo-"+Region.getRenderModeString(renderModes); + final String objName = "snap"+screenshot_num; + { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName); + + final String filename = dir + tech + sw +".png"; + if(screenshot.readPixels(drawable.getGL(), false)) { + screenshot.write(new File(filename)); + } + } + screenshot_num++; + } + int screenshot_num = 0; + + public void setIgnoreInput(final boolean v) { + ignoreInput = v; + } + public boolean getIgnoreInput() { + return ignoreInput; + } + + public class MouseAction implements MouseListener{ + + @Override + public void mouseClicked(final MouseEvent e) { + + } + + @Override + public void mouseEntered(final MouseEvent e) { + } + + @Override + public void mouseExited(final MouseEvent e) { + } + + @Override + public void mousePressed(final MouseEvent e) { + autoDrawable.invoke(false, new GLRunnable() { // avoid data-race + @Override + public boolean run(final GLAutoDrawable drawable) { + System.err.println("\n\nMouse: "+e); + + final RegionRenderer renderer = getRegionRenderer(); + final PMVMatrix pmv = renderer.getMatrix(); + pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); + pmv.glLoadIdentity(); + pmv.glTranslatef(xTran, yTran, zTran); + + // flip to GL window coordinates, origin bottom-left + final int[] viewport = renderer.getViewport(new int[4]); + final int glWinX = e.getX(); + final int glWinY = viewport[3] - e.getY() - 1; + + { + pmv.glPushMatrix(); + crossHair.setTransform(pmv); + + final float[] objPosC = crossHair.getBounds().getCenter(); + final int[] objWinPos = new int[2]; + System.err.println("\n\nCrossHair: "+crossHair); + if( crossHair.objToWinCoord(renderer, objPosC, objWinPos) ) { + System.err.println("CrossHair: Obj: Obj "+objPosC[0]+"/"+objPosC[1]+"/"+objPosC[1]+" -> Win "+objWinPos[0]+"/"+objWinPos[1]); + } + + final float[] objPos2 = new float[3]; + crossHair.winToObjCoord(renderer, objWinPos[0], objWinPos[1], objPos2); + System.err.println("CrossHair: Obj: Win "+objWinPos[0]+"/"+objWinPos[1]+" -> Obj "+objPos2[0]+"/"+objPos2[1]+"/"+objPos2[1]); + + final float[] winObjPos = new float[3]; + if( crossHair.winToObjCoord(renderer, glWinX, glWinY, winObjPos) ) { + // final float[] translate = crossHair.getTranslate(); + // final float[] objPosT = new float[] { objPosC[0]+translate[0], objPosC[1]+translate[1], objPosC[2]+translate[2] }; + final float dx = winObjPos[0] - objPosC[0]; + final float dy = winObjPos[1] - objPosC[1]; + // final float dz = winObjPos[2] - objPosT[2]; + if( !FloatUtil.isZero(dx, FloatUtil.EPSILON) || !FloatUtil.isZero(dy, FloatUtil.EPSILON) ) { + System.err.println("CrossHair: Move.1: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); + crossHair.translate(dx, dy, 0f); + } else { + System.err.println("CrossHair: Move.0: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); + } + } + + final int[] surfaceSize = new int[2]; + crossHair.getSurfaceSize(renderer, surfaceSize); + System.err.println("CrossHair: Size: Pixel "+surfaceSize[0]+" x "+surfaceSize[1]); + + pmv.glPopMatrix(); + } + return true; + } } ); + + } + + @Override + public void mouseReleased(final MouseEvent e) { + } + + @Override + public void mouseMoved(final MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDragged(final MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseWheelMoved(final MouseEvent e) { + // TODO Auto-generated method stub + + } + + } + + public class KeyAction implements KeyListener { + @Override + public void keyPressed(final KeyEvent arg0) { + if(ignoreInput) { + return; + } + + if(arg0.getKeyCode() == KeyEvent.VK_1){ + crossHair.translate(0f, 0f, -zTran/10f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_2){ + crossHair.translate(0f, 0f, zTran/10f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_UP){ + crossHair.translate(0f, crossHair.getHeight()/10f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_DOWN){ + crossHair.translate(0f, -crossHair.getHeight()/10f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_LEFT){ + crossHair.translate(-crossHair.getWidth()/10f, 0f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_RIGHT){ + crossHair.translate(crossHair.getWidth()/10f, 0f, 0f); + } + else if(arg0.getKeyCode() == KeyEvent.VK_0){ + // rotate(1); + } + else if(arg0.getKeyCode() == KeyEvent.VK_9){ + // rotate(-1); + } + else if(arg0.getKeyCode() == KeyEvent.VK_V) { + if(null != autoDrawable) { + autoDrawable.invoke(false, new GLRunnable() { + @Override + public boolean run(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); + final int _i = gl.getSwapInterval(); + final int i; + switch(_i) { + case 0: i = 1; break; + case 1: i = -1; break; + case -1: i = 0; break; + default: i = 1; break; + } + gl.setSwapInterval(i); + + final GLAnimatorControl a = drawable.getAnimator(); + if( null != a ) { + a.resetFPSCounter(); + } + if(drawable instanceof FPSCounter) { + ((FPSCounter)drawable).resetFPSCounter(); + } + System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval()); + return true; + } + }); + } + } + else if(arg0.getKeyCode() == KeyEvent.VK_S){ + if(null != autoDrawable) { + autoDrawable.invoke(false, new GLRunnable() { + @Override + public boolean run(final GLAutoDrawable drawable) { + try { + printScreen(drawable); + } catch (final GLException e) { + e.printStackTrace(); + } catch (final IOException e) { + e.printStackTrace(); + } + return true; + } + }); + } + } + } + @Override + public void keyReleased(final KeyEvent arg0) {} + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java index 59514375c..4ea341fba 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java @@ -43,9 +43,9 @@ import com.jogamp.opengl.math.geom.AABBox; */ public class LabelButton extends RoundButton { /** {@value} */ - public static final float DEFAULT_SPACING_X = 0.08f; + public static final float DEFAULT_SPACING_X = 0.12f; /** {@value} */ - public static final float DEFAULT_SPACING_Y = 0.40f; + public static final float DEFAULT_SPACING_Y = 0.42f; private static final float DEFAULT_2PASS_LABEL_ZOFFSET = -0.005f; // -0.05f; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java deleted file mode 100644 index d2bff1fee..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject01.java +++ /dev/null @@ -1,314 +0,0 @@ -/** - * Copyright 2023 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.test.junit.graph.demos.ui; - -import com.jogamp.opengl.GL2ES2; - -import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; -import com.jogamp.graph.geom.plane.Winding; - -/** - * GPU based resolution independent test object - */ -public class TestObject01 extends UIShape { - - public TestObject01(final Factory factory, final int renderModes) { - super(factory, renderModes); - } - - @Override - protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { - } - - @Override - protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { - } - - @SuppressWarnings("unused") - @Override - protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { - final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); - - // lower case 'o' - // Start TTF Shape for Glyph 82 - if( false ) { - // Original Outer shape: Winding.CW - // Moved into OutlineShape reverse -> Winding.CCW -> OK - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0, 0.527000f, 0.258000f, true); - // 000: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.527000f, 0.197000f, false); - shape.addVertex(0, 0.510000f, 0.147000f, true); - // 002: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.492000f, 0.097000f, false); - shape.addVertex(0, 0.461000f, 0.062000f, true); - // 003: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.429000f, 0.027000f, false); - shape.addVertex(0, 0.386000f, 0.008000f, true); - // 004: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.343000f, -0.012000f, false); - shape.addVertex(0, 0.291000f, -0.012000f, true); - // 005: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.239000f, -0.012000f, false); - shape.addVertex(0, 0.196000f, 0.007000f, true); - // 007: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.153000f, 0.027000f, false); - shape.addVertex(0, 0.122000f, 0.062000f, true); - // 008: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.090000f, 0.097000f, false); - shape.addVertex(0, 0.073000f, 0.147000f, true); - // 009: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.055000f, 0.197000f, false); - shape.addVertex(0, 0.055000f, 0.258000f, true); - // 010: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.055000f, 0.319000f, false); - shape.addVertex(0, 0.072000f, 0.369000f, true); - // 012: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.090000f, 0.419000f, false); - shape.addVertex(0, 0.121000f, 0.454000f, true); - // 013: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.153000f, 0.490000f, false); - shape.addVertex(0, 0.196000f, 0.509000f, true); - // 014: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.239000f, 0.529000f, false); - shape.addVertex(0, 0.291000f, 0.529000f, true); - // 015: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.343000f, 0.529000f, false); - shape.addVertex(0, 0.386000f, 0.510000f, true); - // 017: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.429000f, 0.490000f, false); - shape.addVertex(0, 0.460000f, 0.455000f, true); - // 018: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.492000f, 0.419000f, false); - shape.addVertex(0, 0.509000f, 0.369000f, true); - // 019: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.527000f, 0.319000f, false); - shape.addVertex(0, 0.527000f, 0.258000f, true); - System.err.println("TestObject01.shape01a.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } else { - // Outer shape: Winding.CW - // Moved into OutlineShape same-order -> Winding.CW -> ERROR (so we fix it in the end, see below) - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0.527000f, 0.258000f, true); - // 000: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.527000f, 0.197000f, false); - shape.addVertex(0.510000f, 0.147000f, true); - // 002: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.492000f, 0.097000f, false); - shape.addVertex(0.461000f, 0.062000f, true); - // 003: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.429000f, 0.027000f, false); - shape.addVertex(0.386000f, 0.008000f, true); - // 004: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.343000f, -0.012000f, false); - shape.addVertex(0.291000f, -0.012000f, true); - // 005: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.239000f, -0.012000f, false); - shape.addVertex(0.196000f, 0.007000f, true); - // 007: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.153000f, 0.027000f, false); - shape.addVertex(0.122000f, 0.062000f, true); - // 008: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.090000f, 0.097000f, false); - shape.addVertex(0.073000f, 0.147000f, true); - // 009: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.055000f, 0.197000f, false); - shape.addVertex(0.055000f, 0.258000f, true); - // 010: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.055000f, 0.319000f, false); - shape.addVertex(0.072000f, 0.369000f, true); - // 012: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.090000f, 0.419000f, false); - shape.addVertex(0.121000f, 0.454000f, true); - // 013: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.153000f, 0.490000f, false); - shape.addVertex(0.196000f, 0.509000f, true); - // 014: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.239000f, 0.529000f, false); - shape.addVertex(0.291000f, 0.529000f, true); - // 015: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.343000f, 0.529000f, false); - shape.addVertex(0.386000f, 0.510000f, true); - // 017: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.429000f, 0.490000f, false); - shape.addVertex(0.460000f, 0.455000f, true); - // 018: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.492000f, 0.419000f, false); - shape.addVertex(0.509000f, 0.369000f, true); - // 019: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.527000f, 0.319000f, false); - shape.addVertex(0.527000f, 0.258000f, true); - System.err.println("TestObject01.shape01b.1.winding_area: "+shape.getWindingOfLastOutline()); - shape.setWindingOfLastOutline(Winding.CCW); - System.err.println("TestObject01.shape01b.2.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } - - if( true ) { - // Original Inner shape: Winding.CCW - // Moved into OutlineShape reverse -> Winding.CW -> OK - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0, 0.458000f, 0.258000f, true); - // 020: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.458000f, 0.355000f, false); - shape.addVertex(0, 0.413000f, 0.412000f, true); - // 022: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.368000f, 0.470000f, false); - shape.addVertex(0, 0.291000f, 0.470000f, true); - // 023: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.214000f, 0.470000f, false); - shape.addVertex(0, 0.169000f, 0.413000f, true); - // 025: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.124000f, 0.355000f, false); - shape.addVertex(0, 0.124000f, 0.258000f, true); - // 026: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.124000f, 0.161000f, false); - shape.addVertex(0, 0.169000f, 0.104000f, true); - // 028: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.214000f, 0.047000f, false); - shape.addVertex(0, 0.291000f, 0.047000f, true); - // 029: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.368000f, 0.047000f, false); - shape.addVertex(0, 0.413000f, 0.104000f, true); - // 031: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.458000f, 0.161000f, false); - shape.addVertex(0, 0.458000f, 0.258000f, true); - System.err.println("TestObject01.shape02a.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } else { - // Inner shape: Winding.CCW - // Moved into OutlineShape same-order -> Winding.CCW -> OK - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - - shape.addVertex(0.458000f, 0.258000f, true); - // 020: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.458000f, 0.355000f, false); - shape.addVertex(0.413000f, 0.412000f, true); - // 022: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.368000f, 0.470000f, false); - shape.addVertex(0.291000f, 0.470000f, true); - // 023: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.214000f, 0.470000f, false); - shape.addVertex(0.169000f, 0.413000f, true); - // 025: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.124000f, 0.355000f, false); - shape.addVertex(0.124000f, 0.258000f, true); - // 026: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.124000f, 0.161000f, false); - shape.addVertex(0.169000f, 0.104000f, true); - // 028: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.214000f, 0.047000f, false); - shape.addVertex(0.291000f, 0.047000f, true); - // 029: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.368000f, 0.047000f, false); - shape.addVertex(0.413000f, 0.104000f, true); - // 031: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.458000f, 0.161000f, false); - shape.addVertex(0.458000f, 0.258000f, true); - - System.err.println("TestObject01.shape02b.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } - // End Shape for Glyph 82 - - shape.setIsQuadraticNurbs(); - shape.setSharpness(shapesSharpness); - region.addOutlineShape(shape, null, rgbaColor); - - box.resize(shape.getBounds()); - } - - @Override - public String getSubString() { - return super.getSubString(); - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java deleted file mode 100644 index fe1d965ee..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TestObject02.java +++ /dev/null @@ -1,650 +0,0 @@ -/** - * Copyright 2023 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.test.junit.graph.demos.ui; - -import com.jogamp.opengl.GL2ES2; - -import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; - -/** - * GPU based resolution independent test object - */ -public class TestObject02 extends UIShape { - - public TestObject02(final Factory factory, final int renderModes) { - super(factory, renderModes); - } - - @Override - protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { - } - - @Override - protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { - } - - @SuppressWarnings("unused") - @Override - protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { - final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); - - // lower case 'æ' - - // Start TTF Shape for Glyph 193 - if( true ) { - // Original Inner e-shape: Winding.CCW - // Moved into OutlineShape reverse -> Winding.CW -> OK - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0, 0.728000f, 0.300000f, true); - // 000: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.726000f, 0.381000f, false); - shape.addVertex(0, 0.690000f, 0.426000f, true); - // 002: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.654000f, 0.471000f, false); - shape.addVertex(0, 0.588000f, 0.471000f, true); - // 003: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.553000f, 0.471000f, false); - shape.addVertex(0, 0.526000f, 0.457000f, true); - // 005: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.498000f, 0.443000f, false); - shape.addVertex(0, 0.478000f, 0.420000f, true); - // 006: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.457000f, 0.396000f, false); - shape.addVertex(0, 0.446000f, 0.365000f, true); - // 007: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.434000f, 0.334000f, false); - shape.addVertex(0, 0.432000f, 0.300000f, true); - // 008: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0, 0.728000f, 0.300000f, true); - System.err.println("TestObject02.shape01a.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } else { - // Inner e-shape: Winding.CCW - // Moved into OutlineShape same-order -> Winding.CCW -> ?? - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0.728000f, 0.300000f, true); - // 000: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.726000f, 0.381000f, false); - shape.addVertex(0.690000f, 0.426000f, true); - // 002: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.654000f, 0.471000f, false); - shape.addVertex(0.588000f, 0.471000f, true); - // 003: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.553000f, 0.471000f, false); - shape.addVertex(0.526000f, 0.457000f, true); - // 005: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.498000f, 0.443000f, false); - shape.addVertex(0.478000f, 0.420000f, true); - // 006: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.457000f, 0.396000f, false); - shape.addVertex(0.446000f, 0.365000f, true); - // 007: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.434000f, 0.334000f, false); - shape.addVertex(0.432000f, 0.300000f, true); - // 008: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0.728000f, 0.300000f, true); - System.err.println("TestObject02.shape01b.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } - - if( true ) { - // Original Outer shape: Winding.CW - // Moved into OutlineShape reverse -> Winding.CCW -> OK - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0, 0.252000f, -0.011000f, true); - // 009: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.208000f, -0.011000f, false); - shape.addVertex(0, 0.171000f, -0.002000f, true); - // 011: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.133000f, 0.007000f, false); - shape.addVertex(0, 0.106000f, 0.026000f, true); - // 012: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.079000f, 0.046000f, false); - shape.addVertex(0, 0.064000f, 0.076000f, true); - // 013: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.048000f, 0.107000f, false); - shape.addVertex(0, 0.048000f, 0.151000f, true); - // 014: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.048000f, 0.193000f, false); - shape.addVertex(0, 0.064000f, 0.223000f, true); - // 016: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.080000f, 0.253000f, false); - shape.addVertex(0, 0.109000f, 0.272000f, true); - // 017: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.138000f, 0.292000f, false); - shape.addVertex(0, 0.178000f, 0.301000f, true); - // 018: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.218000f, 0.310000f, false); - shape.addVertex(0, 0.265000f, 0.310000f, true); - // 019: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.279000f, 0.310000f, false); - shape.addVertex(0, 0.294000f, 0.309000f, true); - // 021: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.310000f, 0.307000f, false); - shape.addVertex(0, 0.324000f, 0.305000f, true); - // 022: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.339000f, 0.302000f, false); - shape.addVertex(0, 0.349000f, 0.300000f, true); - // 023: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.360000f, 0.297000f, false); - shape.addVertex(0, 0.364000f, 0.295000f, true); - // 024: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0, 0.364000f, 0.327000f, true); - // 025: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.364000f, 0.354000f, false); - shape.addVertex(0, 0.360000f, 0.379000f, true); - // 027: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.356000f, 0.405000f, false); - shape.addVertex(0, 0.343000f, 0.425000f, true); - // 028: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.329000f, 0.446000f, false); - shape.addVertex(0, 0.305000f, 0.458000f, true); - // 029: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.280000f, 0.471000f, false); - shape.addVertex(0, 0.240000f, 0.471000f, true); - // 030: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.186000f, 0.471000f, false); - shape.addVertex(0, 0.156000f, 0.464000f, true); - // 032: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.126000f, 0.456000f, false); - shape.addVertex(0, 0.113000f, 0.451000f, true); - // 033: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0, 0.105000f, 0.507000f, true); - // 034: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.122000f, 0.515000f, false); - shape.addVertex(0, 0.158000f, 0.522000f, true); - // 036: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.194000f, 0.529000f, false); - shape.addVertex(0, 0.243000f, 0.529000f, true); - // 037: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.314000f, 0.529000f, false); - shape.addVertex(0, 0.354000f, 0.503000f, true); - // 039: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.395000f, 0.476000f, false); - shape.addVertex(0, 0.412000f, 0.431000f, true); - // 040: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.445000f, 0.480000f, false); - shape.addVertex(0, 0.491000f, 0.504000f, true); - // 042: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.537000f, 0.529000f, false); - shape.addVertex(0, 0.587000f, 0.529000f, true); - // 043: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.682000f, 0.529000f, false); - shape.addVertex(0, 0.738000f, 0.467000f, true); - // 045: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.795000f, 0.405000f, false); - shape.addVertex(0, 0.795000f, 0.276000f, true); - // 046: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.795000f, 0.268000f, false); - shape.addVertex(0, 0.795000f, 0.260000f, true); - // 048: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.794000f, 0.252000f, false); - shape.addVertex(0, 0.793000f, 0.245000f, true); - // 049: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0, 0.430000f, 0.245000f, true); - // 050: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.433000f, 0.150000f, false); - shape.addVertex(0, 0.477000f, 0.099000f, true); - // 052: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.521000f, 0.048000f, false); - shape.addVertex(0, 0.617000f, 0.048000f, true); - // 053: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.670000f, 0.048000f, false); - shape.addVertex(0, 0.701000f, 0.058000f, true); - // 055: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.732000f, 0.068000f, false); - shape.addVertex(0, 0.746000f, 0.075000f, true); - // 056: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0, 0.758000f, 0.019000f, true); - // 057: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.744000f, 0.011000f, false); - shape.addVertex(0, 0.706000f, 0.000000f, true); - // 059: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.667000f, -0.011000f, false); - shape.addVertex(0, 0.615000f, -0.011000f, true); - // 060: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.558000f, -0.011000f, false); - shape.addVertex(0, 0.514000f, 0.003000f, true); - // 062: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.470000f, 0.017000f, false); - shape.addVertex(0, 0.437000f, 0.049000f, true); - // 063: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.426000f, 0.040000f, false); - shape.addVertex(0, 0.410000f, 0.030000f, true); - // 065: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.393000f, 0.019000f, false); - shape.addVertex(0, 0.370000f, 0.010000f, true); - // 066: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.347000f, 0.001000f, false); - shape.addVertex(0, 0.318000f, -0.005000f, true); - // 067: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.289000f, -0.011000f, false); - shape.addVertex(0, 0.252000f, -0.011000f, true); - System.err.println("TestObject02.shape02a.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } else { - // Outer shape: Winding.CW - // Moved into OutlineShape same-order -> Winding.CW -> OK now - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0.252000f, -0.011000f, true); - // 009: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.208000f, -0.011000f, false); - shape.addVertex(0.171000f, -0.002000f, true); - // 011: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.133000f, 0.007000f, false); - shape.addVertex(0.106000f, 0.026000f, true); - // 012: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.079000f, 0.046000f, false); - shape.addVertex(0.064000f, 0.076000f, true); - // 013: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.048000f, 0.107000f, false); - shape.addVertex(0.048000f, 0.151000f, true); - // 014: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.048000f, 0.193000f, false); - shape.addVertex(0.064000f, 0.223000f, true); - // 016: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.080000f, 0.253000f, false); - shape.addVertex(0.109000f, 0.272000f, true); - // 017: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.138000f, 0.292000f, false); - shape.addVertex(0.178000f, 0.301000f, true); - // 018: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.218000f, 0.310000f, false); - shape.addVertex(0.265000f, 0.310000f, true); - // 019: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.279000f, 0.310000f, false); - shape.addVertex(0.294000f, 0.309000f, true); - // 021: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.310000f, 0.307000f, false); - shape.addVertex(0.324000f, 0.305000f, true); - // 022: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.339000f, 0.302000f, false); - shape.addVertex(0.349000f, 0.300000f, true); - // 023: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.360000f, 0.297000f, false); - shape.addVertex(0.364000f, 0.295000f, true); - // 024: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0.364000f, 0.327000f, true); - // 025: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.364000f, 0.354000f, false); - shape.addVertex(0.360000f, 0.379000f, true); - // 027: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.356000f, 0.405000f, false); - shape.addVertex(0.343000f, 0.425000f, true); - // 028: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.329000f, 0.446000f, false); - shape.addVertex(0.305000f, 0.458000f, true); - // 029: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.280000f, 0.471000f, false); - shape.addVertex(0.240000f, 0.471000f, true); - // 030: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.186000f, 0.471000f, false); - shape.addVertex(0.156000f, 0.464000f, true); - // 032: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.126000f, 0.456000f, false); - shape.addVertex(0.113000f, 0.451000f, true); - // 033: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0.105000f, 0.507000f, true); - // 034: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.122000f, 0.515000f, false); - shape.addVertex(0.158000f, 0.522000f, true); - // 036: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.194000f, 0.529000f, false); - shape.addVertex(0.243000f, 0.529000f, true); - // 037: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.314000f, 0.529000f, false); - shape.addVertex(0.354000f, 0.503000f, true); - // 039: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.395000f, 0.476000f, false); - shape.addVertex(0.412000f, 0.431000f, true); - // 040: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.445000f, 0.480000f, false); - shape.addVertex(0.491000f, 0.504000f, true); - // 042: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.537000f, 0.529000f, false); - shape.addVertex(0.587000f, 0.529000f, true); - // 043: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.682000f, 0.529000f, false); - shape.addVertex(0.738000f, 0.467000f, true); - // 045: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.795000f, 0.405000f, false); - shape.addVertex(0.795000f, 0.276000f, true); - // 046: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.795000f, 0.268000f, false); - shape.addVertex(0.795000f, 0.260000f, true); - // 048: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.794000f, 0.252000f, false); - shape.addVertex(0.793000f, 0.245000f, true); - // 049: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0.430000f, 0.245000f, true); - // 050: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.433000f, 0.150000f, false); - shape.addVertex(0.477000f, 0.099000f, true); - // 052: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.521000f, 0.048000f, false); - shape.addVertex(0.617000f, 0.048000f, true); - // 053: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.670000f, 0.048000f, false); - shape.addVertex(0.701000f, 0.058000f, true); - // 055: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.732000f, 0.068000f, false); - shape.addVertex(0.746000f, 0.075000f, true); - // 056: B1: line-to p0-p1 - // Shape.LineTo: - shape.addVertex(0.758000f, 0.019000f, true); - // 057: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.744000f, 0.011000f, false); - shape.addVertex(0.706000f, 0.000000f, true); - // 059: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.667000f, -0.011000f, false); - shape.addVertex(0.615000f, -0.011000f, true); - // 060: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.558000f, -0.011000f, false); - shape.addVertex(0.514000f, 0.003000f, true); - // 062: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.470000f, 0.017000f, false); - shape.addVertex(0.437000f, 0.049000f, true); - // 063: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.426000f, 0.040000f, false); - shape.addVertex(0.410000f, 0.030000f, true); - // 065: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.393000f, 0.019000f, false); - shape.addVertex(0.370000f, 0.010000f, true); - // 066: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.347000f, 0.001000f, false); - shape.addVertex(0.318000f, -0.005000f, true); - // 067: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.289000f, -0.011000f, false); - shape.addVertex(0.252000f, -0.011000f, true); - System.err.println("TestObject02.shape02b.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } - - if( true ) { - // Original Inner a-shape: Winding.CCW - // Moved into OutlineShape reverse -> Winding.CW -> OK now - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0, 0.365000f, 0.238000f, true); - // 068: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.354000f, 0.243000f, false); - shape.addVertex(0, 0.330000f, 0.248000f, true); - // 070: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.305000f, 0.254000f, false); - shape.addVertex(0, 0.263000f, 0.254000f, true); - // 071: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.239000f, 0.254000f, false); - shape.addVertex(0, 0.213000f, 0.251000f, true); - // 073: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.187000f, 0.247000f, false); - shape.addVertex(0, 0.165000f, 0.236000f, true); - // 074: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.143000f, 0.224000f, false); - shape.addVertex(0, 0.129000f, 0.204000f, true); - // 075: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.115000f, 0.184000f, false); - shape.addVertex(0, 0.115000f, 0.151000f, true); - // 076: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.115000f, 0.122000f, false); - shape.addVertex(0, 0.125000f, 0.102000f, true); - // 078: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.135000f, 0.082000f, false); - shape.addVertex(0, 0.153000f, 0.070000f, true); - // 079: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0, 0.172000f, 0.058000f, false); - shape.addVertex(0, 0.197000f, 0.053000f, true); - // 080: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.222000f, 0.047000f, false); - shape.addVertex(0, 0.252000f, 0.047000f, true); - // 081: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.314000f, 0.047000f, false); - shape.addVertex(0, 0.350000f, 0.063000f, true); - // 083: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.386000f, 0.080000f, false); - shape.addVertex(0, 0.400000f, 0.093000f, true); - // 084: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0, 0.384000f, 0.119000f, false); - shape.addVertex(0, 0.375000f, 0.154000f, true); - // 086: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0, 0.366000f, 0.190000f, false); - shape.addVertex(0, 0.365000f, 0.238000f, true); - System.err.println("TestObject02.shape03a.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } else { - // Inner a-shape: Winding.CCW - // Moved into OutlineShape same-order -> Winding.CCW -> OK - // - // Shape.MoveTo: - shape.closeLastOutline(false); - shape.addEmptyOutline(); - shape.addVertex(0.365000f, 0.238000f, true); - // 068: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.354000f, 0.243000f, false); - shape.addVertex(0.330000f, 0.248000f, true); - // 070: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.305000f, 0.254000f, false); - shape.addVertex(0.263000f, 0.254000f, true); - // 071: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.239000f, 0.254000f, false); - shape.addVertex(0.213000f, 0.251000f, true); - // 073: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.187000f, 0.247000f, false); - shape.addVertex(0.165000f, 0.236000f, true); - // 074: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.143000f, 0.224000f, false); - shape.addVertex(0.129000f, 0.204000f, true); - // 075: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.115000f, 0.184000f, false); - shape.addVertex(0.115000f, 0.151000f, true); - // 076: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.115000f, 0.122000f, false); - shape.addVertex(0.125000f, 0.102000f, true); - // 078: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.135000f, 0.082000f, false); - shape.addVertex(0.153000f, 0.070000f, true); - // 079: B5: quad-to pMh-p0-p1h ***** MID - // Shape.QuadTo: - shape.addVertex(0.172000f, 0.058000f, false); - shape.addVertex(0.197000f, 0.053000f, true); - // 080: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.222000f, 0.047000f, false); - shape.addVertex(0.252000f, 0.047000f, true); - // 081: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.314000f, 0.047000f, false); - shape.addVertex(0.350000f, 0.063000f, true); - // 083: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.386000f, 0.080000f, false); - shape.addVertex(0.400000f, 0.093000f, true); - // 084: B4: quad-to p0-p1-p2h **** MID - // Shape.QuadTo: - shape.addVertex(0.384000f, 0.119000f, false); - shape.addVertex(0.375000f, 0.154000f, true); - // 086: B6: quad-to pMh-p0-p1 - // Shape.QuadTo: - shape.addVertex(0.366000f, 0.190000f, false); - shape.addVertex(0.365000f, 0.238000f, true); - System.err.println("TestObject02.shape03b.winding_area: "+shape.getWindingOfLastOutline()); - shape.closeLastOutline(false); - } - // End Shape for Glyph 193 - - shape.setIsQuadraticNurbs(); - shape.setSharpness(shapesSharpness); - region.addOutlineShape(shape, null, rgbaColor); - - box.resize(shape.getBounds()); - } - - @Override - public String getSubString() { - return super.getSubString(); - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShapeDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShapeDemo01.java deleted file mode 100644 index 66fca799e..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShapeDemo01.java +++ /dev/null @@ -1,566 +0,0 @@ -/** - * Copyright 2010-2023 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.test.junit.graph.demos.ui; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import com.jogamp.opengl.FPSCounter; -import com.jogamp.opengl.GL; -import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.GLAnimatorControl; -import com.jogamp.opengl.GLAutoDrawable; -import com.jogamp.opengl.GLCapabilities; -import com.jogamp.opengl.GLEventListener; -import com.jogamp.opengl.GLException; -import com.jogamp.opengl.GLPipelineFactory; -import com.jogamp.opengl.GLProfile; -import com.jogamp.opengl.GLRunnable; -import com.jogamp.opengl.fixedfunc.GLMatrixFunc; -import com.jogamp.opengl.math.FloatUtil; -import com.jogamp.opengl.math.geom.AABBox; -import com.jogamp.opengl.test.junit.graph.demos.MSAATool; -import com.jogamp.common.util.InterruptSource; -import com.jogamp.graph.curve.Region; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.curve.opengl.TextRegionUtil; -import com.jogamp.graph.font.Font; -import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.newt.Window; -import com.jogamp.newt.event.KeyAdapter; -import com.jogamp.newt.event.KeyEvent; -import com.jogamp.newt.event.KeyListener; -import com.jogamp.newt.event.MouseEvent; -import com.jogamp.newt.event.MouseListener; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.GLReadBufferUtil; -import com.jogamp.opengl.util.PMVMatrix; - -/** - * Basic UIShape and Type Rendering demo. - * - * Action Keys: - * - 1/2: zoom in/out - * - 4/5: increase/decrease shape/text spacing - * - 6/7: increase/decrease corner size - * - 0/9: rotate - * - v: toggle v-sync - * - s: screenshot - */ -public class UIShapeDemo01 implements GLEventListener { - static final boolean DEBUG = false; - static final boolean TRACE = false; - - public static void main(final String[] args) throws IOException { - Font font = null; - if( 0 != args.length ) { - for(int i=0; i obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord0[0], objCoord0[1], objCoord0[2]); - } - } - glWinX = drawable.getSurfaceWidth(); - glWinY = drawable.getSurfaceHeight(); - if( pmv.gluUnProject(glWinX, glWinY, winZ, renderer.getViewport(), 0, objCoord1, 0) ) { - if( once ) { - System.err.printf("winToObjCoord: win [%f, %f, %f] -> obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord1[0], objCoord1[1], objCoord1[2]); - } - } - full_width_o = objCoord1[0] - objCoord0[0]; - } - final AABBox txt_box_em = font.getGlyphBounds(text); - final float full_width_s = full_width_o / txt_box_em.getWidth(); - final float txt_scale = full_width_s/2f; - pmv.glPushMatrix(); - pmv.glScalef(txt_scale, txt_scale, 1f); - pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new float[] { 0, 0, 0, 1 }, sampleCount); - if( once ) { - final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); - System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); - System.err.println("XXX: txt_box_em "+txt_box_em); - System.err.println("XXX: txt_box_e2 "+txt_box_em2); - System.err.println("XXX: txt_box_rg "+txt_box_r); - once = false; - } - pmv.glPopMatrix(); - } - renderer.enable(gl, false); - } - static boolean once = true; - - @Override - public void dispose(final GLAutoDrawable drawable) { - final GL2ES2 gl = drawable.getGL().getGL2ES2(); - button.destroy(gl, getRegionRenderer()); - crossHair.destroy(gl, getRegionRenderer()); - - autoDrawable = null; - screenshot.dispose(gl); - rRenderer.destroy(gl); - } - - /** Attach the input listener to the window */ - public void attachInputListenerTo(final GLWindow window) { - if ( null == keyAction ) { - keyAction = new KeyAction(); - window.addKeyListener(keyAction); - } - if ( null == mouseAction ) { - mouseAction = new MouseAction(); - window.addMouseListener(mouseAction); - } - } - - public void detachFrom(final GLWindow window) { - if ( null == keyAction ) { - return; - } - if ( null == mouseAction ) { - return; - } - window.removeGLEventListener(this); - window.removeKeyListener(keyAction); - window.removeMouseListener(mouseAction); - } - - public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { - final StringWriter sw = new StringWriter(); - final PrintWriter pw = new PrintWriter(sw); - pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName); - - final String filename = dir + tech + sw +".png"; - if(screenshot.readPixels(drawable.getGL(), false)) { - screenshot.write(new File(filename)); - } - } - - int screenshot_num = 0; - - public void setIgnoreInput(final boolean v) { - ignoreInput = v; - } - public boolean getIgnoreInput() { - return ignoreInput; - } - - public class MouseAction implements MouseListener{ - - @Override - public void mouseClicked(final MouseEvent e) { - - } - - @Override - public void mouseEntered(final MouseEvent e) { - } - - @Override - public void mouseExited(final MouseEvent e) { - } - - @Override - public void mousePressed(final MouseEvent e) { - autoDrawable.invoke(false, new GLRunnable() { // avoid data-race - @Override - public boolean run(final GLAutoDrawable drawable) { - System.err.println("\n\nMouse: "+e); - - final RegionRenderer renderer = getRegionRenderer(); - final PMVMatrix pmv = renderer.getMatrix(); - pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); - pmv.glLoadIdentity(); - pmv.glTranslatef(xTran, yTran, zTran); - - // flip to GL window coordinates, origin bottom-left - final int[] viewport = renderer.getViewport(new int[4]); - final int glWinX = e.getX(); - final int glWinY = viewport[3] - e.getY() - 1; - - { - pmv.glPushMatrix(); - button.setTransform(pmv); - - final float[] objPos = new float[3]; - System.err.println("\n\nButton: "+button); - button.winToObjCoord(renderer, glWinX, glWinY, objPos); - System.err.println("Button: Click: Win "+glWinX+"/"+glWinY+" -> Obj "+objPos[0]+"/"+objPos[1]+"/"+objPos[1]); - - final int[] surfaceSize = new int[2]; - button.getSurfaceSize(renderer, surfaceSize); - System.err.println("Button: Size: Pixel "+surfaceSize[0]+" x "+surfaceSize[1]); - - pmv.glPopMatrix(); - } - { - pmv.glPushMatrix(); - crossHair.setTransform(pmv); - - final float[] objPosC = crossHair.getBounds().getCenter(); - final int[] objWinPos = new int[2]; - System.err.println("\n\nCrossHair: "+crossHair); - if( crossHair.objToWinCoord(renderer, objPosC, objWinPos) ) { - System.err.println("CrossHair: Obj: Obj "+objPosC[0]+"/"+objPosC[1]+"/"+objPosC[1]+" -> Win "+objWinPos[0]+"/"+objWinPos[1]); - } - - final float[] objPos2 = new float[3]; - crossHair.winToObjCoord(renderer, objWinPos[0], objWinPos[1], objPos2); - System.err.println("CrossHair: Obj: Win "+objWinPos[0]+"/"+objWinPos[1]+" -> Obj "+objPos2[0]+"/"+objPos2[1]+"/"+objPos2[1]); - - final float[] winObjPos = new float[3]; - if( crossHair.winToObjCoord(renderer, glWinX, glWinY, winObjPos) ) { - // final float[] translate = crossHair.getTranslate(); - // final float[] objPosT = new float[] { objPosC[0]+translate[0], objPosC[1]+translate[1], objPosC[2]+translate[2] }; - final float dx = winObjPos[0] - objPosC[0]; - final float dy = winObjPos[1] - objPosC[1]; - // final float dz = winObjPos[2] - objPosT[2]; - if( !FloatUtil.isZero(dx, FloatUtil.EPSILON) || !FloatUtil.isZero(dy, FloatUtil.EPSILON) ) { - System.err.println("CrossHair: Move.1: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); - crossHair.translate(dx, dy, 0f); - } else { - System.err.println("CrossHair: Move.0: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); - } - } - - final int[] surfaceSize = new int[2]; - crossHair.getSurfaceSize(renderer, surfaceSize); - System.err.println("CrossHair: Size: Pixel "+surfaceSize[0]+" x "+surfaceSize[1]); - - pmv.glPopMatrix(); - } - return true; - } } ); - - } - - @Override - public void mouseReleased(final MouseEvent e) { - } - - @Override - public void mouseMoved(final MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mouseDragged(final MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mouseWheelMoved(final MouseEvent e) { - // TODO Auto-generated method stub - - } - - } - - public class KeyAction implements KeyListener { - @Override - public void keyPressed(final KeyEvent arg0) { - if(ignoreInput) { - return; - } - - if(arg0.getKeyCode() == KeyEvent.VK_1){ - button.translate(0f, 0f, -zTran/10f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_2){ - button.translate(0f, 0f, zTran/10f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_UP){ - button.translate(0f, button.getHeight()/10f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_DOWN){ - button.translate(0f, -button.getHeight()/10f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_LEFT){ - button.translate(-button.getWidth()/10f, 0f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_RIGHT){ - button.translate(button.getWidth()/10f, 0f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_4){ - button.setSpacing(button.getSpacingX()-0.01f, button.getSpacingY()-0.005f); - System.err.println("Button Spacing: " + button.getSpacingX()); - } - else if(arg0.getKeyCode() == KeyEvent.VK_5){ - button.setSpacing(button.getSpacingX()+0.01f, button.getSpacingY()+0.005f); - System.err.println("Button Spacing: " + button.getSpacingX()); - } - else if(arg0.getKeyCode() == KeyEvent.VK_6){ - button.setCorner(button.getCorner()-0.01f); - System.err.println("Button Corner: " + button.getCorner()); - } - else if(arg0.getKeyCode() == KeyEvent.VK_7){ - button.setCorner(button.getCorner()+0.01f); - System.err.println("Button Corner: " + button.getCorner()); - } - else if(arg0.getKeyCode() == KeyEvent.VK_0){ - // rotate(1); - } - else if(arg0.getKeyCode() == KeyEvent.VK_9){ - // rotate(-1); - } - else if(arg0.getKeyCode() == KeyEvent.VK_V) { - if(null != autoDrawable) { - autoDrawable.invoke(false, new GLRunnable() { - @Override - public boolean run(final GLAutoDrawable drawable) { - final GL gl = drawable.getGL(); - final int _i = gl.getSwapInterval(); - final int i; - switch(_i) { - case 0: i = 1; break; - case 1: i = -1; break; - case -1: i = 0; break; - default: i = 1; break; - } - gl.setSwapInterval(i); - - final GLAnimatorControl a = drawable.getAnimator(); - if( null != a ) { - a.resetFPSCounter(); - } - if(drawable instanceof FPSCounter) { - ((FPSCounter)drawable).resetFPSCounter(); - } - System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval()); - return true; - } - }); - } - } - else if(arg0.getKeyCode() == KeyEvent.VK_S){ - if(null != autoDrawable) { - autoDrawable.invoke(false, new GLRunnable() { - @Override - public boolean run(final GLAutoDrawable drawable) { - try { - final String type = Region.getRenderModeString(renderModes); - printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); - screenshot_num++; - } catch (final GLException e) { - e.printStackTrace(); - } catch (final IOException e) { - e.printStackTrace(); - } - return true; - } - }); - } - } - } - @Override - public void keyReleased(final KeyEvent arg0) {} - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java deleted file mode 100644 index 183d81f27..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UITypeDemo01.java +++ /dev/null @@ -1,595 +0,0 @@ -/** - * Copyright 2010-2023 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.test.junit.graph.demos.ui; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import com.jogamp.opengl.FPSCounter; -import com.jogamp.opengl.GL; -import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.GLAnimatorControl; -import com.jogamp.opengl.GLAutoDrawable; -import com.jogamp.opengl.GLCapabilities; -import com.jogamp.opengl.GLEventListener; -import com.jogamp.opengl.GLException; -import com.jogamp.opengl.GLPipelineFactory; -import com.jogamp.opengl.GLProfile; -import com.jogamp.opengl.GLRunnable; -import com.jogamp.opengl.fixedfunc.GLMatrixFunc; -import com.jogamp.opengl.math.FloatUtil; -import com.jogamp.opengl.math.geom.AABBox; -import com.jogamp.opengl.test.junit.graph.demos.MSAATool; -import com.jogamp.opengl.test.junit.util.MiscUtils; -import com.jogamp.common.util.InterruptSource; -import com.jogamp.graph.curve.Region; -import com.jogamp.graph.curve.opengl.GLRegion; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.curve.opengl.TextRegionUtil; -import com.jogamp.graph.font.Font; -import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.font.Font.Glyph; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.newt.Window; -import com.jogamp.newt.event.KeyAdapter; -import com.jogamp.newt.event.KeyEvent; -import com.jogamp.newt.event.KeyListener; -import com.jogamp.newt.event.MouseEvent; -import com.jogamp.newt.event.MouseListener; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.GLReadBufferUtil; -import com.jogamp.opengl.util.PMVMatrix; - -/** - * Basic UIShape and Type Rendering demo. - * - * Action Keys: - * - 1/2: zoom in/out - * - 4/5: increase/decrease shape/text spacing - * - 6/7: increase/decrease corner size - * - 0/9: rotate - * - v: toggle v-sync - * - s: screenshot - */ -public class UITypeDemo01 implements GLEventListener { - static final boolean DEBUG = false; - static final boolean TRACE = false; - - public static void main(final String[] args) throws IOException { - Font font = null; - String text = "Hello Origin."; - int glyph_id = 0; - if( 0 != args.length ) { - for(int i=0; i obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord0[0], objCoord0[1], objCoord0[2]); - } - } - glWinX = drawable.getSurfaceWidth(); - glWinY = drawable.getSurfaceHeight(); - if( pmv.gluUnProject(glWinX, glWinY, winZ, renderer.getViewport(), 0, objCoord1, 0) ) { - if( once ) { - System.err.printf("winToObjCoord: win [%f, %f, %f] -> obj [%f, %f, %f]%n", glWinX, glWinY, winZ, objCoord1[0], objCoord1[1], objCoord1[2]); - } - } - full_width_o = objCoord1[0] - objCoord0[0]; - full_height_o = objCoord1[1] - objCoord0[1]; - } - final Font.Glyph glyph; - if( Glyph.ID_UNKNOWN != glyph_id ) { - glyph = font.getGlyph(glyph_id); - System.err.println("glyph_id "+glyph_id+": "+glyph); - } else { - glyph = null; - } - if( null != glyph && glyph.getID() != Glyph.ID_UNKNOWN ) { - final AABBox txt_box_em = glyph.getBBox(); - final float full_width_s = full_width_o / txt_box_em.getWidth(); - final float full_height_s = full_height_o / txt_box_em.getHeight(); - final float txt_scale = full_width_s < full_height_s ? full_width_s/2f : full_height_s/2f; - pmv.glPushMatrix(); - pmv.glScalef(txt_scale, txt_scale, 1f); - pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); - if( null != glyph.getShape() ) { - final GLRegion region = GLRegion.create(renderModes, null); - region.addOutlineShape(glyph.getShape(), null, region.hasColorChannel() ? fg_color : null); - region.draw(gl, renderer, sampleCount); - region.destroy(gl); - } - if( once ) { - final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); - System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); - System.err.println("XXX: full_height: "+full_height_o+" / "+txt_box_em.getHeight()+" -> "+full_height_s); - System.err.println("XXX: txt_scale: "+txt_scale); - System.err.println("XXX: txt_box_em "+txt_box_em); - System.err.println("XXX: txt_box_e2 "+txt_box_em2); - once = false; - } - } else { - final AABBox txt_box_em = font.getGlyphBounds(text); - final float full_width_s = full_width_o / txt_box_em.getWidth(); - final float full_height_s = full_height_o / txt_box_em.getHeight(); - final float txt_scale = full_width_s < full_height_s ? full_width_s/2f : full_height_s/2f; - pmv.glPushMatrix(); - pmv.glScalef(txt_scale, txt_scale, 1f); - pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, sampleCount); - if( once ) { - final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); - System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); - System.err.println("XXX: full_height: "+full_height_o+" / "+txt_box_em.getHeight()+" -> "+full_height_s); - System.err.println("XXX: txt_scale: "+txt_scale); - System.err.println("XXX: txt_box_em "+txt_box_em); - System.err.println("XXX: txt_box_e2 "+txt_box_em2); - System.err.println("XXX: txt_box_rg "+txt_box_r); - once = false; - } - } - pmv.glPopMatrix(); - } - renderer.enable(gl, false); - } - static boolean once = true; - - @Override - public void dispose(final GLAutoDrawable drawable) { - final GL2ES2 gl = drawable.getGL().getGL2ES2(); - crossHair.destroy(gl, getRegionRenderer()); - testObj.destroy(gl, getRegionRenderer()); - - autoDrawable = null; - screenshot.dispose(gl); - rRenderer.destroy(gl); - } - - /** Attach the input listener to the window */ - public void attachInputListenerTo(final GLWindow window) { - if ( null == keyAction ) { - keyAction = new KeyAction(); - window.addKeyListener(keyAction); - } - if ( null == mouseAction ) { - mouseAction = new MouseAction(); - window.addMouseListener(mouseAction); - } - } - - public void detachFrom(final GLWindow window) { - if ( null == keyAction ) { - return; - } - if ( null == mouseAction ) { - return; - } - window.removeGLEventListener(this); - window.removeKeyListener(keyAction); - window.removeMouseListener(mouseAction); - } - - public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { - final StringWriter sw = new StringWriter(); - final PrintWriter pw = new PrintWriter(sw); - pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName); - - final String filename = dir + tech + sw +".png"; - if(screenshot.readPixels(drawable.getGL(), false)) { - screenshot.write(new File(filename)); - } - } - - int screenshot_num = 0; - - public void setIgnoreInput(final boolean v) { - ignoreInput = v; - } - public boolean getIgnoreInput() { - return ignoreInput; - } - - public class MouseAction implements MouseListener{ - - @Override - public void mouseClicked(final MouseEvent e) { - - } - - @Override - public void mouseEntered(final MouseEvent e) { - } - - @Override - public void mouseExited(final MouseEvent e) { - } - - @Override - public void mousePressed(final MouseEvent e) { - autoDrawable.invoke(false, new GLRunnable() { // avoid data-race - @Override - public boolean run(final GLAutoDrawable drawable) { - System.err.println("\n\nMouse: "+e); - - final RegionRenderer renderer = getRegionRenderer(); - final PMVMatrix pmv = renderer.getMatrix(); - pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); - pmv.glLoadIdentity(); - pmv.glTranslatef(xTran, yTran, zTran); - - // flip to GL window coordinates, origin bottom-left - final int[] viewport = renderer.getViewport(new int[4]); - final int glWinX = e.getX(); - final int glWinY = viewport[3] - e.getY() - 1; - - { - pmv.glPushMatrix(); - crossHair.setTransform(pmv); - - final float[] objPosC = crossHair.getBounds().getCenter(); - final int[] objWinPos = new int[2]; - System.err.println("\n\nCrossHair: "+crossHair); - if( crossHair.objToWinCoord(renderer, objPosC, objWinPos) ) { - System.err.println("CrossHair: Obj: Obj "+objPosC[0]+"/"+objPosC[1]+"/"+objPosC[1]+" -> Win "+objWinPos[0]+"/"+objWinPos[1]); - } - - final float[] objPos2 = new float[3]; - crossHair.winToObjCoord(renderer, objWinPos[0], objWinPos[1], objPos2); - System.err.println("CrossHair: Obj: Win "+objWinPos[0]+"/"+objWinPos[1]+" -> Obj "+objPos2[0]+"/"+objPos2[1]+"/"+objPos2[1]); - - final float[] winObjPos = new float[3]; - if( crossHair.winToObjCoord(renderer, glWinX, glWinY, winObjPos) ) { - // final float[] translate = crossHair.getTranslate(); - // final float[] objPosT = new float[] { objPosC[0]+translate[0], objPosC[1]+translate[1], objPosC[2]+translate[2] }; - final float dx = winObjPos[0] - objPosC[0]; - final float dy = winObjPos[1] - objPosC[1]; - // final float dz = winObjPos[2] - objPosT[2]; - if( !FloatUtil.isZero(dx, FloatUtil.EPSILON) || !FloatUtil.isZero(dy, FloatUtil.EPSILON) ) { - System.err.println("CrossHair: Move.1: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); - crossHair.translate(dx, dy, 0f); - } else { - System.err.println("CrossHair: Move.0: Win "+glWinX+"/"+glWinY+" -> Obj "+winObjPos[0]+"/"+winObjPos[1]+"/"+winObjPos[1]+" -> diff "+dx+" / "+dy); - } - } - - final int[] surfaceSize = new int[2]; - crossHair.getSurfaceSize(renderer, surfaceSize); - System.err.println("CrossHair: Size: Pixel "+surfaceSize[0]+" x "+surfaceSize[1]); - - pmv.glPopMatrix(); - } - return true; - } } ); - - } - - @Override - public void mouseReleased(final MouseEvent e) { - } - - @Override - public void mouseMoved(final MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mouseDragged(final MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mouseWheelMoved(final MouseEvent e) { - // TODO Auto-generated method stub - - } - - } - - public class KeyAction implements KeyListener { - @Override - public void keyPressed(final KeyEvent arg0) { - if(ignoreInput) { - return; - } - - if(arg0.getKeyCode() == KeyEvent.VK_1){ - crossHair.translate(0f, 0f, -zTran/10f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_2){ - crossHair.translate(0f, 0f, zTran/10f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_UP){ - crossHair.translate(0f, crossHair.getHeight()/10f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_DOWN){ - crossHair.translate(0f, -crossHair.getHeight()/10f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_LEFT){ - crossHair.translate(-crossHair.getWidth()/10f, 0f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_RIGHT){ - crossHair.translate(crossHair.getWidth()/10f, 0f, 0f); - } - else if(arg0.getKeyCode() == KeyEvent.VK_0){ - // rotate(1); - } - else if(arg0.getKeyCode() == KeyEvent.VK_9){ - // rotate(-1); - } - else if(arg0.getKeyCode() == KeyEvent.VK_V) { - if(null != autoDrawable) { - autoDrawable.invoke(false, new GLRunnable() { - @Override - public boolean run(final GLAutoDrawable drawable) { - final GL gl = drawable.getGL(); - final int _i = gl.getSwapInterval(); - final int i; - switch(_i) { - case 0: i = 1; break; - case 1: i = -1; break; - case -1: i = 0; break; - default: i = 1; break; - } - gl.setSwapInterval(i); - - final GLAnimatorControl a = drawable.getAnimator(); - if( null != a ) { - a.resetFPSCounter(); - } - if(drawable instanceof FPSCounter) { - ((FPSCounter)drawable).resetFPSCounter(); - } - System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval()); - return true; - } - }); - } - } - else if(arg0.getKeyCode() == KeyEvent.VK_S){ - if(null != autoDrawable) { - autoDrawable.invoke(false, new GLRunnable() { - @Override - public boolean run(final GLAutoDrawable drawable) { - try { - final String type = Region.getRenderModeString(renderModes); - printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); - screenshot_num++; - } catch (final GLException e) { - e.printStackTrace(); - } catch (final IOException e) { - e.printStackTrace(); - } - return true; - } - }); - } - } - } - @Override - public void keyReleased(final KeyEvent arg0) {} - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java new file mode 100644 index 000000000..f1ef69800 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java @@ -0,0 +1,316 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.graph.testshapes; + +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.geom.plane.Winding; + +/** + * GPU based resolution independent test object + * - Ubuntu-Light, lower case 'o' + * - TTF Shape for Glyph 82 + */ +public class Glyph01UbuntuLight_o extends UIShape { + + public Glyph01UbuntuLight_o(final Factory factory, final int renderModes) { + super(factory, renderModes); + } + + @Override + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @SuppressWarnings("unused") + @Override + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { + final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); + + // Ubuntu-Light, lower case 'o' + // Start TTF Shape for Glyph 82 + if( false ) { + // Original Outer shape: Winding.CW + // Moved into OutlineShape reverse -> Winding.CCW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.527000f, 0.258000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.527000f, 0.197000f, false); + shape.addVertex(0, 0.510000f, 0.147000f, true); + // 002: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.492000f, 0.097000f, false); + shape.addVertex(0, 0.461000f, 0.062000f, true); + // 003: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.429000f, 0.027000f, false); + shape.addVertex(0, 0.386000f, 0.008000f, true); + // 004: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.343000f, -0.012000f, false); + shape.addVertex(0, 0.291000f, -0.012000f, true); + // 005: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.239000f, -0.012000f, false); + shape.addVertex(0, 0.196000f, 0.007000f, true); + // 007: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.153000f, 0.027000f, false); + shape.addVertex(0, 0.122000f, 0.062000f, true); + // 008: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.090000f, 0.097000f, false); + shape.addVertex(0, 0.073000f, 0.147000f, true); + // 009: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.055000f, 0.197000f, false); + shape.addVertex(0, 0.055000f, 0.258000f, true); + // 010: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.055000f, 0.319000f, false); + shape.addVertex(0, 0.072000f, 0.369000f, true); + // 012: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.090000f, 0.419000f, false); + shape.addVertex(0, 0.121000f, 0.454000f, true); + // 013: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.153000f, 0.490000f, false); + shape.addVertex(0, 0.196000f, 0.509000f, true); + // 014: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.239000f, 0.529000f, false); + shape.addVertex(0, 0.291000f, 0.529000f, true); + // 015: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.343000f, 0.529000f, false); + shape.addVertex(0, 0.386000f, 0.510000f, true); + // 017: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.429000f, 0.490000f, false); + shape.addVertex(0, 0.460000f, 0.455000f, true); + // 018: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.492000f, 0.419000f, false); + shape.addVertex(0, 0.509000f, 0.369000f, true); + // 019: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.527000f, 0.319000f, false); + shape.addVertex(0, 0.527000f, 0.258000f, true); + System.err.println("Glyph01UbuntuLight_o.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Outer shape: Winding.CW + // Moved into OutlineShape same-order -> Winding.CW -> ERROR (so we fix it in the end, see below) + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.527000f, 0.258000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.527000f, 0.197000f, false); + shape.addVertex(0.510000f, 0.147000f, true); + // 002: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.492000f, 0.097000f, false); + shape.addVertex(0.461000f, 0.062000f, true); + // 003: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.429000f, 0.027000f, false); + shape.addVertex(0.386000f, 0.008000f, true); + // 004: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.343000f, -0.012000f, false); + shape.addVertex(0.291000f, -0.012000f, true); + // 005: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.239000f, -0.012000f, false); + shape.addVertex(0.196000f, 0.007000f, true); + // 007: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.153000f, 0.027000f, false); + shape.addVertex(0.122000f, 0.062000f, true); + // 008: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.090000f, 0.097000f, false); + shape.addVertex(0.073000f, 0.147000f, true); + // 009: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.055000f, 0.197000f, false); + shape.addVertex(0.055000f, 0.258000f, true); + // 010: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.055000f, 0.319000f, false); + shape.addVertex(0.072000f, 0.369000f, true); + // 012: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.090000f, 0.419000f, false); + shape.addVertex(0.121000f, 0.454000f, true); + // 013: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.153000f, 0.490000f, false); + shape.addVertex(0.196000f, 0.509000f, true); + // 014: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.239000f, 0.529000f, false); + shape.addVertex(0.291000f, 0.529000f, true); + // 015: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.343000f, 0.529000f, false); + shape.addVertex(0.386000f, 0.510000f, true); + // 017: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.429000f, 0.490000f, false); + shape.addVertex(0.460000f, 0.455000f, true); + // 018: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.492000f, 0.419000f, false); + shape.addVertex(0.509000f, 0.369000f, true); + // 019: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.527000f, 0.319000f, false); + shape.addVertex(0.527000f, 0.258000f, true); + System.err.println("Glyph01UbuntuLight_o.shape01b.1.winding_area: "+shape.getWindingOfLastOutline()); + shape.setWindingOfLastOutline(Winding.CCW); + System.err.println("Glyph01UbuntuLight_o.shape01b.2.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + + if( true ) { + // Original Inner shape: Winding.CCW + // Moved into OutlineShape reverse -> Winding.CW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.458000f, 0.258000f, true); + // 020: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.458000f, 0.355000f, false); + shape.addVertex(0, 0.413000f, 0.412000f, true); + // 022: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.368000f, 0.470000f, false); + shape.addVertex(0, 0.291000f, 0.470000f, true); + // 023: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.214000f, 0.470000f, false); + shape.addVertex(0, 0.169000f, 0.413000f, true); + // 025: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.124000f, 0.355000f, false); + shape.addVertex(0, 0.124000f, 0.258000f, true); + // 026: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.124000f, 0.161000f, false); + shape.addVertex(0, 0.169000f, 0.104000f, true); + // 028: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.214000f, 0.047000f, false); + shape.addVertex(0, 0.291000f, 0.047000f, true); + // 029: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.368000f, 0.047000f, false); + shape.addVertex(0, 0.413000f, 0.104000f, true); + // 031: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.458000f, 0.161000f, false); + shape.addVertex(0, 0.458000f, 0.258000f, true); + System.err.println("Glyph01UbuntuLight_o.shape02a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Inner shape: Winding.CCW + // Moved into OutlineShape same-order -> Winding.CCW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + + shape.addVertex(0.458000f, 0.258000f, true); + // 020: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.458000f, 0.355000f, false); + shape.addVertex(0.413000f, 0.412000f, true); + // 022: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.368000f, 0.470000f, false); + shape.addVertex(0.291000f, 0.470000f, true); + // 023: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.214000f, 0.470000f, false); + shape.addVertex(0.169000f, 0.413000f, true); + // 025: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.124000f, 0.355000f, false); + shape.addVertex(0.124000f, 0.258000f, true); + // 026: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.124000f, 0.161000f, false); + shape.addVertex(0.169000f, 0.104000f, true); + // 028: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.214000f, 0.047000f, false); + shape.addVertex(0.291000f, 0.047000f, true); + // 029: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.368000f, 0.047000f, false); + shape.addVertex(0.413000f, 0.104000f, true); + // 031: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.458000f, 0.161000f, false); + shape.addVertex(0.458000f, 0.258000f, true); + + System.err.println("Glyph01UbuntuLight_o.shape02b.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + // End Shape for Glyph 82 + + shape.setIsQuadraticNurbs(); + shape.setSharpness(shapesSharpness); + region.addOutlineShape(shape, null, rgbaColor); + + box.resize(shape.getBounds()); + } + + @Override + public String getSubString() { + return super.getSubString(); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java new file mode 100644 index 000000000..0b024f970 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java @@ -0,0 +1,652 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.graph.testshapes; + +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; + +/** + * GPU based resolution independent test object + * - Ubuntu-Light, lower case 'æ' + * - TTF Shape for Glyph 193 + */ +public class Glyph02UbuntuLight_ae extends UIShape { + + public Glyph02UbuntuLight_ae(final Factory factory, final int renderModes) { + super(factory, renderModes); + } + + @Override + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @SuppressWarnings("unused") + @Override + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { + final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); + + // Ubuntu-Light, lower case 'æ' + + // Start TTF Shape for Glyph 193 + if( true ) { + // Original Inner e-shape: Winding.CCW + // Moved into OutlineShape reverse -> Winding.CW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.728000f, 0.300000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.726000f, 0.381000f, false); + shape.addVertex(0, 0.690000f, 0.426000f, true); + // 002: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.654000f, 0.471000f, false); + shape.addVertex(0, 0.588000f, 0.471000f, true); + // 003: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.553000f, 0.471000f, false); + shape.addVertex(0, 0.526000f, 0.457000f, true); + // 005: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.498000f, 0.443000f, false); + shape.addVertex(0, 0.478000f, 0.420000f, true); + // 006: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.457000f, 0.396000f, false); + shape.addVertex(0, 0.446000f, 0.365000f, true); + // 007: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.434000f, 0.334000f, false); + shape.addVertex(0, 0.432000f, 0.300000f, true); + // 008: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.728000f, 0.300000f, true); + System.err.println("Glyph02UbuntuLight_ae.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Inner e-shape: Winding.CCW + // Moved into OutlineShape same-order -> Winding.CCW -> ?? + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.728000f, 0.300000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.726000f, 0.381000f, false); + shape.addVertex(0.690000f, 0.426000f, true); + // 002: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.654000f, 0.471000f, false); + shape.addVertex(0.588000f, 0.471000f, true); + // 003: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.553000f, 0.471000f, false); + shape.addVertex(0.526000f, 0.457000f, true); + // 005: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.498000f, 0.443000f, false); + shape.addVertex(0.478000f, 0.420000f, true); + // 006: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.457000f, 0.396000f, false); + shape.addVertex(0.446000f, 0.365000f, true); + // 007: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.434000f, 0.334000f, false); + shape.addVertex(0.432000f, 0.300000f, true); + // 008: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.728000f, 0.300000f, true); + System.err.println("Glyph02UbuntuLight_ae.shape01b.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + + if( true ) { + // Original Outer shape: Winding.CW + // Moved into OutlineShape reverse -> Winding.CCW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.252000f, -0.011000f, true); + // 009: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.208000f, -0.011000f, false); + shape.addVertex(0, 0.171000f, -0.002000f, true); + // 011: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.133000f, 0.007000f, false); + shape.addVertex(0, 0.106000f, 0.026000f, true); + // 012: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.079000f, 0.046000f, false); + shape.addVertex(0, 0.064000f, 0.076000f, true); + // 013: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.048000f, 0.107000f, false); + shape.addVertex(0, 0.048000f, 0.151000f, true); + // 014: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.048000f, 0.193000f, false); + shape.addVertex(0, 0.064000f, 0.223000f, true); + // 016: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.080000f, 0.253000f, false); + shape.addVertex(0, 0.109000f, 0.272000f, true); + // 017: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.138000f, 0.292000f, false); + shape.addVertex(0, 0.178000f, 0.301000f, true); + // 018: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.218000f, 0.310000f, false); + shape.addVertex(0, 0.265000f, 0.310000f, true); + // 019: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.279000f, 0.310000f, false); + shape.addVertex(0, 0.294000f, 0.309000f, true); + // 021: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.310000f, 0.307000f, false); + shape.addVertex(0, 0.324000f, 0.305000f, true); + // 022: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.339000f, 0.302000f, false); + shape.addVertex(0, 0.349000f, 0.300000f, true); + // 023: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.360000f, 0.297000f, false); + shape.addVertex(0, 0.364000f, 0.295000f, true); + // 024: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.364000f, 0.327000f, true); + // 025: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.364000f, 0.354000f, false); + shape.addVertex(0, 0.360000f, 0.379000f, true); + // 027: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.356000f, 0.405000f, false); + shape.addVertex(0, 0.343000f, 0.425000f, true); + // 028: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.329000f, 0.446000f, false); + shape.addVertex(0, 0.305000f, 0.458000f, true); + // 029: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.280000f, 0.471000f, false); + shape.addVertex(0, 0.240000f, 0.471000f, true); + // 030: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.186000f, 0.471000f, false); + shape.addVertex(0, 0.156000f, 0.464000f, true); + // 032: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.126000f, 0.456000f, false); + shape.addVertex(0, 0.113000f, 0.451000f, true); + // 033: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.105000f, 0.507000f, true); + // 034: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.122000f, 0.515000f, false); + shape.addVertex(0, 0.158000f, 0.522000f, true); + // 036: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.194000f, 0.529000f, false); + shape.addVertex(0, 0.243000f, 0.529000f, true); + // 037: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.314000f, 0.529000f, false); + shape.addVertex(0, 0.354000f, 0.503000f, true); + // 039: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.395000f, 0.476000f, false); + shape.addVertex(0, 0.412000f, 0.431000f, true); + // 040: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.445000f, 0.480000f, false); + shape.addVertex(0, 0.491000f, 0.504000f, true); + // 042: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.537000f, 0.529000f, false); + shape.addVertex(0, 0.587000f, 0.529000f, true); + // 043: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.682000f, 0.529000f, false); + shape.addVertex(0, 0.738000f, 0.467000f, true); + // 045: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.795000f, 0.405000f, false); + shape.addVertex(0, 0.795000f, 0.276000f, true); + // 046: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.795000f, 0.268000f, false); + shape.addVertex(0, 0.795000f, 0.260000f, true); + // 048: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.794000f, 0.252000f, false); + shape.addVertex(0, 0.793000f, 0.245000f, true); + // 049: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.430000f, 0.245000f, true); + // 050: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.433000f, 0.150000f, false); + shape.addVertex(0, 0.477000f, 0.099000f, true); + // 052: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.521000f, 0.048000f, false); + shape.addVertex(0, 0.617000f, 0.048000f, true); + // 053: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.670000f, 0.048000f, false); + shape.addVertex(0, 0.701000f, 0.058000f, true); + // 055: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.732000f, 0.068000f, false); + shape.addVertex(0, 0.746000f, 0.075000f, true); + // 056: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.758000f, 0.019000f, true); + // 057: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.744000f, 0.011000f, false); + shape.addVertex(0, 0.706000f, 0.000000f, true); + // 059: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.667000f, -0.011000f, false); + shape.addVertex(0, 0.615000f, -0.011000f, true); + // 060: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.558000f, -0.011000f, false); + shape.addVertex(0, 0.514000f, 0.003000f, true); + // 062: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.470000f, 0.017000f, false); + shape.addVertex(0, 0.437000f, 0.049000f, true); + // 063: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.426000f, 0.040000f, false); + shape.addVertex(0, 0.410000f, 0.030000f, true); + // 065: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.393000f, 0.019000f, false); + shape.addVertex(0, 0.370000f, 0.010000f, true); + // 066: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.347000f, 0.001000f, false); + shape.addVertex(0, 0.318000f, -0.005000f, true); + // 067: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.289000f, -0.011000f, false); + shape.addVertex(0, 0.252000f, -0.011000f, true); + System.err.println("Glyph02UbuntuLight_ae.shape02a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Outer shape: Winding.CW + // Moved into OutlineShape same-order -> Winding.CW -> OK now + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.252000f, -0.011000f, true); + // 009: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.208000f, -0.011000f, false); + shape.addVertex(0.171000f, -0.002000f, true); + // 011: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.133000f, 0.007000f, false); + shape.addVertex(0.106000f, 0.026000f, true); + // 012: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.079000f, 0.046000f, false); + shape.addVertex(0.064000f, 0.076000f, true); + // 013: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.048000f, 0.107000f, false); + shape.addVertex(0.048000f, 0.151000f, true); + // 014: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.048000f, 0.193000f, false); + shape.addVertex(0.064000f, 0.223000f, true); + // 016: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.080000f, 0.253000f, false); + shape.addVertex(0.109000f, 0.272000f, true); + // 017: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.138000f, 0.292000f, false); + shape.addVertex(0.178000f, 0.301000f, true); + // 018: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.218000f, 0.310000f, false); + shape.addVertex(0.265000f, 0.310000f, true); + // 019: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.279000f, 0.310000f, false); + shape.addVertex(0.294000f, 0.309000f, true); + // 021: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.310000f, 0.307000f, false); + shape.addVertex(0.324000f, 0.305000f, true); + // 022: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.339000f, 0.302000f, false); + shape.addVertex(0.349000f, 0.300000f, true); + // 023: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.360000f, 0.297000f, false); + shape.addVertex(0.364000f, 0.295000f, true); + // 024: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.364000f, 0.327000f, true); + // 025: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.364000f, 0.354000f, false); + shape.addVertex(0.360000f, 0.379000f, true); + // 027: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.356000f, 0.405000f, false); + shape.addVertex(0.343000f, 0.425000f, true); + // 028: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.329000f, 0.446000f, false); + shape.addVertex(0.305000f, 0.458000f, true); + // 029: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.280000f, 0.471000f, false); + shape.addVertex(0.240000f, 0.471000f, true); + // 030: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.186000f, 0.471000f, false); + shape.addVertex(0.156000f, 0.464000f, true); + // 032: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.126000f, 0.456000f, false); + shape.addVertex(0.113000f, 0.451000f, true); + // 033: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.105000f, 0.507000f, true); + // 034: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.122000f, 0.515000f, false); + shape.addVertex(0.158000f, 0.522000f, true); + // 036: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.194000f, 0.529000f, false); + shape.addVertex(0.243000f, 0.529000f, true); + // 037: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.314000f, 0.529000f, false); + shape.addVertex(0.354000f, 0.503000f, true); + // 039: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.395000f, 0.476000f, false); + shape.addVertex(0.412000f, 0.431000f, true); + // 040: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.445000f, 0.480000f, false); + shape.addVertex(0.491000f, 0.504000f, true); + // 042: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.537000f, 0.529000f, false); + shape.addVertex(0.587000f, 0.529000f, true); + // 043: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.682000f, 0.529000f, false); + shape.addVertex(0.738000f, 0.467000f, true); + // 045: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.795000f, 0.405000f, false); + shape.addVertex(0.795000f, 0.276000f, true); + // 046: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.795000f, 0.268000f, false); + shape.addVertex(0.795000f, 0.260000f, true); + // 048: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.794000f, 0.252000f, false); + shape.addVertex(0.793000f, 0.245000f, true); + // 049: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.430000f, 0.245000f, true); + // 050: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.433000f, 0.150000f, false); + shape.addVertex(0.477000f, 0.099000f, true); + // 052: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.521000f, 0.048000f, false); + shape.addVertex(0.617000f, 0.048000f, true); + // 053: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.670000f, 0.048000f, false); + shape.addVertex(0.701000f, 0.058000f, true); + // 055: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.732000f, 0.068000f, false); + shape.addVertex(0.746000f, 0.075000f, true); + // 056: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0.758000f, 0.019000f, true); + // 057: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.744000f, 0.011000f, false); + shape.addVertex(0.706000f, 0.000000f, true); + // 059: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.667000f, -0.011000f, false); + shape.addVertex(0.615000f, -0.011000f, true); + // 060: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.558000f, -0.011000f, false); + shape.addVertex(0.514000f, 0.003000f, true); + // 062: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.470000f, 0.017000f, false); + shape.addVertex(0.437000f, 0.049000f, true); + // 063: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.426000f, 0.040000f, false); + shape.addVertex(0.410000f, 0.030000f, true); + // 065: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.393000f, 0.019000f, false); + shape.addVertex(0.370000f, 0.010000f, true); + // 066: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.347000f, 0.001000f, false); + shape.addVertex(0.318000f, -0.005000f, true); + // 067: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.289000f, -0.011000f, false); + shape.addVertex(0.252000f, -0.011000f, true); + System.err.println("Glyph02UbuntuLight_ae.shape02b.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + + if( true ) { + // Original Inner a-shape: Winding.CCW + // Moved into OutlineShape reverse -> Winding.CW -> OK now + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.365000f, 0.238000f, true); + // 068: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.354000f, 0.243000f, false); + shape.addVertex(0, 0.330000f, 0.248000f, true); + // 070: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.305000f, 0.254000f, false); + shape.addVertex(0, 0.263000f, 0.254000f, true); + // 071: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.239000f, 0.254000f, false); + shape.addVertex(0, 0.213000f, 0.251000f, true); + // 073: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.187000f, 0.247000f, false); + shape.addVertex(0, 0.165000f, 0.236000f, true); + // 074: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.143000f, 0.224000f, false); + shape.addVertex(0, 0.129000f, 0.204000f, true); + // 075: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.115000f, 0.184000f, false); + shape.addVertex(0, 0.115000f, 0.151000f, true); + // 076: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.115000f, 0.122000f, false); + shape.addVertex(0, 0.125000f, 0.102000f, true); + // 078: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.135000f, 0.082000f, false); + shape.addVertex(0, 0.153000f, 0.070000f, true); + // 079: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.172000f, 0.058000f, false); + shape.addVertex(0, 0.197000f, 0.053000f, true); + // 080: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.222000f, 0.047000f, false); + shape.addVertex(0, 0.252000f, 0.047000f, true); + // 081: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.314000f, 0.047000f, false); + shape.addVertex(0, 0.350000f, 0.063000f, true); + // 083: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.386000f, 0.080000f, false); + shape.addVertex(0, 0.400000f, 0.093000f, true); + // 084: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.384000f, 0.119000f, false); + shape.addVertex(0, 0.375000f, 0.154000f, true); + // 086: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.366000f, 0.190000f, false); + shape.addVertex(0, 0.365000f, 0.238000f, true); + System.err.println("Glyph02UbuntuLight_ae.shape03a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + // Inner a-shape: Winding.CCW + // Moved into OutlineShape same-order -> Winding.CCW -> OK + // + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0.365000f, 0.238000f, true); + // 068: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.354000f, 0.243000f, false); + shape.addVertex(0.330000f, 0.248000f, true); + // 070: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.305000f, 0.254000f, false); + shape.addVertex(0.263000f, 0.254000f, true); + // 071: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.239000f, 0.254000f, false); + shape.addVertex(0.213000f, 0.251000f, true); + // 073: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.187000f, 0.247000f, false); + shape.addVertex(0.165000f, 0.236000f, true); + // 074: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.143000f, 0.224000f, false); + shape.addVertex(0.129000f, 0.204000f, true); + // 075: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.115000f, 0.184000f, false); + shape.addVertex(0.115000f, 0.151000f, true); + // 076: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.115000f, 0.122000f, false); + shape.addVertex(0.125000f, 0.102000f, true); + // 078: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.135000f, 0.082000f, false); + shape.addVertex(0.153000f, 0.070000f, true); + // 079: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0.172000f, 0.058000f, false); + shape.addVertex(0.197000f, 0.053000f, true); + // 080: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.222000f, 0.047000f, false); + shape.addVertex(0.252000f, 0.047000f, true); + // 081: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.314000f, 0.047000f, false); + shape.addVertex(0.350000f, 0.063000f, true); + // 083: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.386000f, 0.080000f, false); + shape.addVertex(0.400000f, 0.093000f, true); + // 084: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0.384000f, 0.119000f, false); + shape.addVertex(0.375000f, 0.154000f, true); + // 086: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0.366000f, 0.190000f, false); + shape.addVertex(0.365000f, 0.238000f, true); + System.err.println("Glyph02UbuntuLight_ae.shape03b.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + // End Shape for Glyph 193 + + shape.setIsQuadraticNurbs(); + shape.setSharpness(shapesSharpness); + region.addOutlineShape(shape, null, rgbaColor); + + box.resize(shape.getBounds()); + } + + @Override + public String getSubString() { + return super.getSubString(); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java new file mode 100644 index 000000000..55fc7609e --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java @@ -0,0 +1,804 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.graph.testshapes; + +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; + +/** + * GPU based resolution independent test object + * - FreeMono-Regular, capital case 'M' + * - TTF Shape for Glyph 48 + */ +public class Glyph03FreeMonoRegular_M extends UIShape { + + public Glyph03FreeMonoRegular_M(final Factory factory, final int renderModes) { + super(factory, renderModes); + } + + @Override + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @SuppressWarnings("unused") + @Override + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { + final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); + + if( false ) { + // Start TTF Shape for Glyph 48 + // GlyphShape<48>: offset 0 of 45/45 points + // pM[044] P[483/522, on true, end true] + // p0[000] P[326/169, on true, end false] + // p1[001] P[280/169, on true, end false] + // p2[002] P[121/522, on true, end false] + // 000: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.326000f, 0.169000f, true); + // 000: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.280000f, 0.169000f, true); + // GlyphShape<48>: offset 1 of 45/45 points + // pM[000] P[326/169, on true, end false] + // p0[001] P[280/169, on true, end false] + // p1[002] P[121/522, on true, end false] + // p2[003] P[113/522, on true, end false] + // 001: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.121000f, 0.522000f, true); + // GlyphShape<48>: offset 2 of 45/45 points + // pM[001] P[280/169, on true, end false] + // p0[002] P[121/522, on true, end false] + // p1[003] P[113/522, on true, end false] + // p2[004] P[113/41, on true, end false] + // 002: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.113000f, 0.522000f, true); + // GlyphShape<48>: offset 3 of 45/45 points + // pM[002] P[121/522, on true, end false] + // p0[003] P[113/522, on true, end false] + // p1[004] P[113/41, on true, end false] + // p2[005] P[187/41, on true, end false] + // 003: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.113000f, 0.041000f, true); + // GlyphShape<48>: offset 4 of 45/45 points + // pM[003] P[113/522, on true, end false] + // p0[004] P[113/41, on true, end false] + // p1[005] P[187/41, on true, end false] + // p2[006] P[215/41, on false, end false] + // 004: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.187000f, 0.041000f, true); + // GlyphShape<48>: offset 5 of 45/45 points + // pM[004] P[113/41, on true, end false] + // p0[005] P[187/41, on true, end false] + // p1[006] P[215/41, on false, end false] + // p2[007] P[215/21, on true, end false] + // 005: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.215000f, 0.041000f, false); + shape.addVertex(0, 0.215000f, 0.021000f, true); + // GlyphShape<48>: offset 7 of 45/45 points + // pM[006] P[215/41, on false, end false] + // p0[007] P[215/21, on true, end false] + // p1[008] P[215/0, on false, end false] + // p2[009] P[187/0, on true, end false] + // 007: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.215000f, 0.000000f, false); + shape.addVertex(0, 0.187000f, 0.000000f, true); + // GlyphShape<48>: offset 9 of 45/45 points + // pM[008] P[215/0, on false, end false] + // p0[009] P[187/0, on true, end false] + // p1[010] P[38/0, on true, end false] + // p2[011] P[11/0, on false, end false] + // 009: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.038000f, 0.000000f, true); + // GlyphShape<48>: offset 10 of 45/45 points + // pM[009] P[187/0, on true, end false] + // p0[010] P[38/0, on true, end false] + // p1[011] P[11/0, on false, end false] + // p2[012] P[11/21, on true, end false] + // 010: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.011000f, 0.000000f, false); + shape.addVertex(0, 0.011000f, 0.021000f, true); + // GlyphShape<48>: offset 12 of 45/45 points + // pM[011] P[11/0, on false, end false] + // p0[012] P[11/21, on true, end false] + // p1[013] P[11/41, on false, end false] + // p2[014] P[38/41, on true, end false] + // 012: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.011000f, 0.041000f, false); + shape.addVertex(0, 0.038000f, 0.041000f, true); + // GlyphShape<48>: offset 14 of 45/45 points + // pM[013] P[11/41, on false, end false] + // p0[014] P[38/41, on true, end false] + // p1[015] P[72/41, on true, end false] + // p2[016] P[72/522, on true, end false] + // 014: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.072000f, 0.041000f, true); + // GlyphShape<48>: offset 15 of 45/45 points + // pM[014] P[38/41, on true, end false] + // p0[015] P[72/41, on true, end false] + // p1[016] P[72/522, on true, end false] + // p2[017] P[47/522, on true, end false] + // 015: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.072000f, 0.522000f, true); + // GlyphShape<48>: offset 16 of 45/45 points + // pM[015] P[72/41, on true, end false] + // p0[016] P[72/522, on true, end false] + // p1[017] P[47/522, on true, end false] + // p2[018] P[20/522, on false, end false] + // 016: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.047000f, 0.522000f, true); + // GlyphShape<48>: offset 17 of 45/45 points + // pM[016] P[72/522, on true, end false] + // p0[017] P[47/522, on true, end false] + // p1[018] P[20/522, on false, end false] + // p2[019] P[20/543, on true, end false] + // 017: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.020000f, 0.522000f, false); + shape.addVertex(0, 0.020000f, 0.543000f, true); + // GlyphShape<48>: offset 19 of 45/45 points + // pM[018] P[20/522, on false, end false] + // p0[019] P[20/543, on true, end false] + // p1[020] P[20/563, on false, end false] + // p2[021] P[47/563, on true, end false] + // 019: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.020000f, 0.563000f, false); + shape.addVertex(0, 0.047000f, 0.563000f, true); + // GlyphShape<48>: offset 21 of 45/45 points + // pM[020] P[20/563, on false, end false] + // p0[021] P[47/563, on true, end false] + // p1[022] P[146/563, on true, end false] + // p2[023] P[303/215, on true, end false] + // 021: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.146000f, 0.563000f, true); + // GlyphShape<48>: offset 22 of 45/45 points + // pM[021] P[47/563, on true, end false] + // p0[022] P[146/563, on true, end false] + // p1[023] P[303/215, on true, end false] + // p2[024] P[457/563, on true, end false] + // 022: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.303000f, 0.215000f, true); + // GlyphShape<48>: offset 23 of 45/45 points + // pM[022] P[146/563, on true, end false] + // p0[023] P[303/215, on true, end false] + // p1[024] P[457/563, on true, end false] + // p2[025] P[557/563, on true, end false] + // 023: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.457000f, 0.563000f, true); + // GlyphShape<48>: offset 24 of 45/45 points + // pM[023] P[303/215, on true, end false] + // p0[024] P[457/563, on true, end false] + // p1[025] P[557/563, on true, end false] + // p2[026] P[584/563, on false, end false] + // 024: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.557000f, 0.563000f, true); + // GlyphShape<48>: offset 25 of 45/45 points + // pM[024] P[457/563, on true, end false] + // p0[025] P[557/563, on true, end false] + // p1[026] P[584/563, on false, end false] + // p2[027] P[584/543, on true, end false] + // 025: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.584000f, 0.563000f, false); + shape.addVertex(0, 0.584000f, 0.543000f, true); + // GlyphShape<48>: offset 27 of 45/45 points + // pM[026] P[584/563, on false, end false] + // p0[027] P[584/543, on true, end false] + // p1[028] P[584/522, on false, end false] + // p2[029] P[557/522, on true, end false] + // 027: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.584000f, 0.522000f, false); + shape.addVertex(0, 0.557000f, 0.522000f, true); + // GlyphShape<48>: offset 29 of 45/45 points + // pM[028] P[584/522, on false, end false] + // p0[029] P[557/522, on true, end false] + // p1[030] P[532/522, on true, end false] + // p2[031] P[532/41, on true, end false] + // 029: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.532000f, 0.522000f, true); + // GlyphShape<48>: offset 30 of 45/45 points + // pM[029] P[557/522, on true, end false] + // p0[030] P[532/522, on true, end false] + // p1[031] P[532/41, on true, end false] + // p2[032] P[566/41, on true, end false] + // 030: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.532000f, 0.041000f, true); + // GlyphShape<48>: offset 31 of 45/45 points + // pM[030] P[532/522, on true, end false] + // p0[031] P[532/41, on true, end false] + // p1[032] P[566/41, on true, end false] + // p2[033] P[593/41, on false, end false] + // 031: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.566000f, 0.041000f, true); + // GlyphShape<48>: offset 32 of 45/45 points + // pM[031] P[532/41, on true, end false] + // p0[032] P[566/41, on true, end false] + // p1[033] P[593/41, on false, end false] + // p2[034] P[593/21, on true, end false] + // 032: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.593000f, 0.041000f, false); + shape.addVertex(0, 0.593000f, 0.021000f, true); + // GlyphShape<48>: offset 34 of 45/45 points + // pM[033] P[593/41, on false, end false] + // p0[034] P[593/21, on true, end false] + // p1[035] P[593/0, on false, end false] + // p2[036] P[566/0, on true, end false] + // 034: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.593000f, 0.000000f, false); + shape.addVertex(0, 0.566000f, 0.000000f, true); + // GlyphShape<48>: offset 36 of 45/45 points + // pM[035] P[593/0, on false, end false] + // p0[036] P[566/0, on true, end false] + // p1[037] P[417/0, on true, end false] + // p2[038] P[390/0, on false, end false] + // 036: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.417000f, 0.000000f, true); + // GlyphShape<48>: offset 37 of 45/45 points + // pM[036] P[566/0, on true, end false] + // p0[037] P[417/0, on true, end false] + // p1[038] P[390/0, on false, end false] + // p2[039] P[390/21, on true, end false] + // 037: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.390000f, 0.000000f, false); + shape.addVertex(0, 0.390000f, 0.021000f, true); + // GlyphShape<48>: offset 39 of 45/45 points + // pM[038] P[390/0, on false, end false] + // p0[039] P[390/21, on true, end false] + // p1[040] P[390/41, on false, end false] + // p2[041] P[417/41, on true, end false] + // 039: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.390000f, 0.041000f, false); + shape.addVertex(0, 0.417000f, 0.041000f, true); + // GlyphShape<48>: offset 41 of 45/45 points + // pM[040] P[390/41, on false, end false] + // p0[041] P[417/41, on true, end false] + // p1[042] P[491/41, on true, end false] + // p2[043] P[491/522, on true, end false] + // 041: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.491000f, 0.041000f, true); + // GlyphShape<48>: offset 42 of 45/45 points + // pM[041] P[417/41, on true, end false] + // p0[042] P[491/41, on true, end false] + // p1[043] P[491/522, on true, end false] + // p2[044] P[483/522, on true, end true] + // 042: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.491000f, 0.522000f, true); + // GlyphShape<48>: offset 43 of 45/45 points + // pM[042] P[491/41, on true, end false] + // p0[043] P[491/522, on true, end false] + // p1[044] P[483/522, on true, end true] + // p2[000] P[326/169, on true, end false] + // 043: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.483000f, 0.522000f, true); + // GlyphShape<48>: offset 44 of 45/45 points + // pM[043] P[491/522, on true, end false] + // p0[044] P[483/522, on true, end true] + // p1[000] P[326/169, on true, end false] + // p2[001] P[280/169, on true, end false] + // 044: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.326000f, 0.169000f, true); + System.err.println("Glyph03FreeMonoRegular_M.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + + // End Shape for Glyph 48 + } else if( false ) { + // Start TTF Shape for Glyph 48 + // GlyphShape<48>: offset 0 of 45/45 points + // pM[044] P[483/522, on true, end true] + // p0[000] P[326/169, on true, end false] + // p1[001] P[280/169, on true, end false] + // p2[002] P[121/522, on true, end false] + // 000: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.326000f, 0.169000f, true); + // 000: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.280000f, 0.169000f, true); + // GlyphShape<48>: offset 1 of 45/45 points + // pM[000] P[326/169, on true, end false] + // p0[001] P[280/169, on true, end false] + // p1[002] P[121/522, on true, end false] + // p2[003] P[113/522, on true, end false] + // 001: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.121000f, 0.522000f, true); + // GlyphShape<48>: offset 2 of 45/45 points + // pM[001] P[280/169, on true, end false] + // p0[002] P[121/522, on true, end false] + // p1[003] P[113/522, on true, end false] + // p2[004] P[113/41, on true, end false] + // 002: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.113000f, 0.522000f, true); + // GlyphShape<48>: offset 3 of 45/45 points + // pM[002] P[121/522, on true, end false] + // p0[003] P[113/522, on true, end false] + // p1[004] P[113/41, on true, end false] + // p2[005] P[187/41, on true, end false] + // 003: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.113000f, 0.041000f, true); + // GlyphShape<48>: offset 4 of 45/45 points + // pM[003] P[113/522, on true, end false] + // p0[004] P[113/41, on true, end false] + // p1[005] P[187/41, on true, end false] + // p2[006] P[215/41, on false, end false] + // 004: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.187000f, 0.041000f, true); + // GlyphShape<48>: offset 5 of 45/45 points + // pM[004] P[113/41, on true, end false] + // p0[005] P[187/41, on true, end false] + // p1[006] P[215/41, on false, end false] + // p2[007] P[215/21, on true, end false] + // 005: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.215000f, 0.041000f, true); // curve -> line + shape.addVertex(0, 0.215000f, 0.021000f, true); + // GlyphShape<48>: offset 7 of 45/45 points + // pM[006] P[215/41, on false, end false] + // p0[007] P[215/21, on true, end false] + // p1[008] P[215/0, on false, end false] + // p2[009] P[187/0, on true, end false] + // 007: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.215000f, 0.000000f, true); // curve -> line + shape.addVertex(0, 0.187000f, 0.000000f, true); + // GlyphShape<48>: offset 9 of 45/45 points + // pM[008] P[215/0, on false, end false] + // p0[009] P[187/0, on true, end false] + // p1[010] P[38/0, on true, end false] + // p2[011] P[11/0, on false, end false] + // 009: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.038000f, 0.000000f, true); + // GlyphShape<48>: offset 10 of 45/45 points + // pM[009] P[187/0, on true, end false] + // p0[010] P[38/0, on true, end false] + // p1[011] P[11/0, on false, end false] + // p2[012] P[11/21, on true, end false] + // 010: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.011000f, 0.000000f, true); // curve -> line + shape.addVertex(0, 0.011000f, 0.021000f, true); + // GlyphShape<48>: offset 12 of 45/45 points + // pM[011] P[11/0, on false, end false] + // p0[012] P[11/21, on true, end false] + // p1[013] P[11/41, on false, end false] + // p2[014] P[38/41, on true, end false] + // 012: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.011000f, 0.041000f, true); // curve -> line + shape.addVertex(0, 0.038000f, 0.041000f, true); + // GlyphShape<48>: offset 14 of 45/45 points + // pM[013] P[11/41, on false, end false] + // p0[014] P[38/41, on true, end false] + // p1[015] P[72/41, on true, end false] + // p2[016] P[72/522, on true, end false] + // 014: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.072000f, 0.041000f, true); + // GlyphShape<48>: offset 15 of 45/45 points + // pM[014] P[38/41, on true, end false] + // p0[015] P[72/41, on true, end false] + // p1[016] P[72/522, on true, end false] + // p2[017] P[47/522, on true, end false] + // 015: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.072000f, 0.522000f, true); + // GlyphShape<48>: offset 16 of 45/45 points + // pM[015] P[72/41, on true, end false] + // p0[016] P[72/522, on true, end false] + // p1[017] P[47/522, on true, end false] + // p2[018] P[20/522, on false, end false] + // 016: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.047000f, 0.522000f, true); + // GlyphShape<48>: offset 17 of 45/45 points + // pM[016] P[72/522, on true, end false] + // p0[017] P[47/522, on true, end false] + // p1[018] P[20/522, on false, end false] + // p2[019] P[20/543, on true, end false] + // 017: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.020000f, 0.522000f, true); // curve -> line + shape.addVertex(0, 0.020000f, 0.543000f, true); + // GlyphShape<48>: offset 19 of 45/45 points + // pM[018] P[20/522, on false, end false] + // p0[019] P[20/543, on true, end false] + // p1[020] P[20/563, on false, end false] + // p2[021] P[47/563, on true, end false] + // 019: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.020000f, 0.563000f, true); // curve -> line + shape.addVertex(0, 0.047000f, 0.563000f, true); + // GlyphShape<48>: offset 21 of 45/45 points + // pM[020] P[20/563, on false, end false] + // p0[021] P[47/563, on true, end false] + // p1[022] P[146/563, on true, end false] + // p2[023] P[303/215, on true, end false] + // 021: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.146000f, 0.563000f, true); + // GlyphShape<48>: offset 22 of 45/45 points + // pM[021] P[47/563, on true, end false] + // p0[022] P[146/563, on true, end false] + // p1[023] P[303/215, on true, end false] + // p2[024] P[457/563, on true, end false] + // 022: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.303000f, 0.215000f, true); + // GlyphShape<48>: offset 23 of 45/45 points + // pM[022] P[146/563, on true, end false] + // p0[023] P[303/215, on true, end false] + // p1[024] P[457/563, on true, end false] + // p2[025] P[557/563, on true, end false] + // 023: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.457000f, 0.563000f, true); + // GlyphShape<48>: offset 24 of 45/45 points + // pM[023] P[303/215, on true, end false] + // p0[024] P[457/563, on true, end false] + // p1[025] P[557/563, on true, end false] + // p2[026] P[584/563, on false, end false] + // 024: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.557000f, 0.563000f, true); + // GlyphShape<48>: offset 25 of 45/45 points + // pM[024] P[457/563, on true, end false] + // p0[025] P[557/563, on true, end false] + // p1[026] P[584/563, on false, end false] + // p2[027] P[584/543, on true, end false] + // 025: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.584000f, 0.563000f, true); // curve -> line + shape.addVertex(0, 0.584000f, 0.543000f, true); + // GlyphShape<48>: offset 27 of 45/45 points + // pM[026] P[584/563, on false, end false] + // p0[027] P[584/543, on true, end false] + // p1[028] P[584/522, on false, end false] + // p2[029] P[557/522, on true, end false] + // 027: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.584000f, 0.522000f, true); // curve -> line + shape.addVertex(0, 0.557000f, 0.522000f, true); + // GlyphShape<48>: offset 29 of 45/45 points + // pM[028] P[584/522, on false, end false] + // p0[029] P[557/522, on true, end false] + // p1[030] P[532/522, on true, end false] + // p2[031] P[532/41, on true, end false] + // 029: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.532000f, 0.522000f, true); + // GlyphShape<48>: offset 30 of 45/45 points + // pM[029] P[557/522, on true, end false] + // p0[030] P[532/522, on true, end false] + // p1[031] P[532/41, on true, end false] + // p2[032] P[566/41, on true, end false] + // 030: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.532000f, 0.041000f, true); + // GlyphShape<48>: offset 31 of 45/45 points + // pM[030] P[532/522, on true, end false] + // p0[031] P[532/41, on true, end false] + // p1[032] P[566/41, on true, end false] + // p2[033] P[593/41, on false, end false] + // 031: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.566000f, 0.041000f, true); + // GlyphShape<48>: offset 32 of 45/45 points + // pM[031] P[532/41, on true, end false] + // p0[032] P[566/41, on true, end false] + // p1[033] P[593/41, on false, end false] + // p2[034] P[593/21, on true, end false] + // 032: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.593000f, 0.041000f, true); // curve -> line + shape.addVertex(0, 0.593000f, 0.021000f, true); + // GlyphShape<48>: offset 34 of 45/45 points + // pM[033] P[593/41, on false, end false] + // p0[034] P[593/21, on true, end false] + // p1[035] P[593/0, on false, end false] + // p2[036] P[566/0, on true, end false] + // 034: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.593000f, 0.000000f, true); // curve -> line + shape.addVertex(0, 0.566000f, 0.000000f, true); + // GlyphShape<48>: offset 36 of 45/45 points + // pM[035] P[593/0, on false, end false] + // p0[036] P[566/0, on true, end false] + // p1[037] P[417/0, on true, end false] + // p2[038] P[390/0, on false, end false] + // 036: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.417000f, 0.000000f, true); + // GlyphShape<48>: offset 37 of 45/45 points + // pM[036] P[566/0, on true, end false] + // p0[037] P[417/0, on true, end false] + // p1[038] P[390/0, on false, end false] + // p2[039] P[390/21, on true, end false] + // 037: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.390000f, 0.000000f, true); // curve -> line + shape.addVertex(0, 0.390000f, 0.021000f, true); + // GlyphShape<48>: offset 39 of 45/45 points + // pM[038] P[390/0, on false, end false] + // p0[039] P[390/21, on true, end false] + // p1[040] P[390/41, on false, end false] + // p2[041] P[417/41, on true, end false] + // 039: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.390000f, 0.041000f, true); // curve -> line + shape.addVertex(0, 0.417000f, 0.041000f, true); + // GlyphShape<48>: offset 41 of 45/45 points + // pM[040] P[390/41, on false, end false] + // p0[041] P[417/41, on true, end false] + // p1[042] P[491/41, on true, end false] + // p2[043] P[491/522, on true, end false] + // 041: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.491000f, 0.041000f, true); + // GlyphShape<48>: offset 42 of 45/45 points + // pM[041] P[417/41, on true, end false] + // p0[042] P[491/41, on true, end false] + // p1[043] P[491/522, on true, end false] + // p2[044] P[483/522, on true, end true] + // 042: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.491000f, 0.522000f, true); + // GlyphShape<48>: offset 43 of 45/45 points + // pM[042] P[491/41, on true, end false] + // p0[043] P[491/522, on true, end false] + // p1[044] P[483/522, on true, end true] + // p2[000] P[326/169, on true, end false] + // 043: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.483000f, 0.522000f, true); + // GlyphShape<48>: offset 44 of 45/45 points + // pM[043] P[491/522, on true, end false] + // p0[044] P[483/522, on true, end true] + // p1[000] P[326/169, on true, end false] + // p2[001] P[280/169, on true, end false] + // 044: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.326000f, 0.169000f, true); + System.err.println("Glyph03FreeMonoRegular_M.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } else { + final boolean with_left_leg = true; // ERROR + final boolean with_right_leg = false; // OK + + // Start TTF Shape for Glyph 48 + // GlyphShape<48>: offset 0 of 45/45 points + // pM[044] P[483/522, on true, end true] + // p0[000] P[326/169, on true, end false] + // p1[001] P[280/169, on true, end false] + // p2[002] P[121/522, on true, end false] + // 000: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.326000f, 0.169000f, true); + // 000: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.280000f, 0.169000f, true); + // GlyphShape<48>: offset 1 of 45/45 points + // pM[000] P[326/169, on true, end false] + // p0[001] P[280/169, on true, end false] + // p1[002] P[121/522, on true, end false] + // p2[003] P[113/522, on true, end false] + // 001: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.121000f, 0.522000f, true); // ID 11 + + // GlyphShape<48>: offset 2 of 45/45 points + // pM[001] P[280/169, on true, end false] + // p0[002] P[121/522, on true, end false] + // p1[003] P[113/522, on true, end false] + // p2[004] P[113/41, on true, end false] + // 002: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.113000f, 0.522000f, true); + + if( with_left_leg ) { + // GlyphShape<48>: offset 3 of 45/45 points + // pM[002] P[121/522, on true, end false] + // p0[003] P[113/522, on true, end false] + // p1[004] P[113/41, on true, end false] + // p2[005] P[187/41, on true, end false] + // 003: B1: line-to p0-p1 + // Shape.LineTo: + // shape.addVertex(0, 0.113000f, 0.041000f, true); + + shape.addVertex(0, 0.113000f, 0.000000f, true); + shape.addVertex(0, 0.072000f, 0.000000f, true); + + // GlyphShape<48>: offset 14 of 45/45 points + // pM[013] P[11/41, on false, end false] + // p0[014] P[38/41, on true, end false] + // p1[015] P[72/41, on true, end false] + // p2[016] P[72/522, on true, end false] + // 014: B1: line-to p0-p1 + // Shape.LineTo: + // shape.addVertex(0, 0.072000f, 0.041000f, true); + + // GlyphShape<48>: offset 15 of 45/45 points + // pM[014] P[38/41, on true, end false] + // p0[015] P[72/41, on true, end false] + // p1[016] P[72/522, on true, end false] + // p2[017] P[47/522, on true, end false] + // 015: B1: line-to p0-p1 + // Shape.LineTo: + // shape.addVertex(0, 0.072000f, 0.522000f, true); + + shape.addVertex(0, 0.072000f, 0.563000f, true); // ID 7 + } else { + shape.addVertex(0, 0.113000f, 0.563000f, true); + } + + // GlyphShape<48>: offset 21 of 45/45 points + // pM[020] P[20/563, on false, end false] + // p0[021] P[47/563, on true, end false] + // p1[022] P[146/563, on true, end false] + // p2[023] P[303/215, on true, end false] + // 021: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.146000f, 0.563000f, true); + // GlyphShape<48>: offset 22 of 45/45 points + // pM[021] P[47/563, on true, end false] + // p0[022] P[146/563, on true, end false] + // p1[023] P[303/215, on true, end false] + // p2[024] P[457/563, on true, end false] + // 022: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.303000f, 0.215000f, true); + // GlyphShape<48>: offset 23 of 45/45 points + // pM[022] P[146/563, on true, end false] + // p0[023] P[303/215, on true, end false] + // p1[024] P[457/563, on true, end false] + // p2[025] P[557/563, on true, end false] + // 023: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.457000f, 0.563000f, true); // ID 4 + + if( with_right_leg ) { + shape.addVertex(0, 0.532000f, 0.563000f, true); + + // GlyphShape<48>: offset 29 of 45/45 points + // pM[028] P[584/522, on false, end false] + // p0[029] P[557/522, on true, end false] + // p1[030] P[532/522, on true, end false] + // p2[031] P[532/41, on true, end false] + // 029: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.532000f, 0.522000f, true); + // GlyphShape<48>: offset 30 of 45/45 points + // pM[029] P[557/522, on true, end false] + // p0[030] P[532/522, on true, end false] + // p1[031] P[532/41, on true, end false] + // p2[032] P[566/41, on true, end false] + // 030: B1: line-to p0-p1 + // Shape.LineTo: + // shape.addVertex(0, 0.532000f, 0.041000f, true); + + shape.addVertex(0, 0.532000f, 0.000000f, true); + shape.addVertex(0, 0.491000f, 0.000000f, true); + } else { + shape.addVertex(0, 0.491000f, 0.563000f, true); // ID 3 + } + + // GlyphShape<48>: offset 41 of 45/45 points + // pM[040] P[390/41, on false, end false] + // p0[041] P[417/41, on true, end false] + // p1[042] P[491/41, on true, end false] + // p2[043] P[491/522, on true, end false] + // 041: B1: line-to p0-p1 + // Shape.LineTo: + // shape.addVertex(0, 0.491000f, 0.041000f, true); + + // GlyphShape<48>: offset 42 of 45/45 points + // pM[041] P[417/41, on true, end false] + // p0[042] P[491/41, on true, end false] + // p1[043] P[491/522, on true, end false] + // p2[044] P[483/522, on true, end true] + // 042: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.491000f, 0.522000f, true); // ID 2 + // GlyphShape<48>: offset 43 of 45/45 points + // pM[042] P[491/41, on true, end false] + // p0[043] P[491/522, on true, end false] + // p1[044] P[483/522, on true, end true] + // p2[000] P[326/169, on true, end false] + // 043: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.483000f, 0.522000f, true); // ID 1 + // GlyphShape<48>: offset 44 of 45/45 points + // pM[043] P[491/522, on true, end false] + // p0[044] P[483/522, on true, end true] + // p1[000] P[326/169, on true, end false] + // p2[001] P[280/169, on true, end false] + // 044: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.326000f, 0.169000f, true); + System.err.println("Glyph03FreeMonoRegular_M.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + + shape.setIsQuadraticNurbs(); + shape.setSharpness(shapesSharpness); + region.addOutlineShape(shape, null, rgbaColor); + + box.resize(shape.getBounds()); + } + + @Override + public String getSubString() { + return super.getSubString(); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java new file mode 100644 index 000000000..5b677b622 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java @@ -0,0 +1,150 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.graph.testshapes; + +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; + +/** + * GPU based resolution independent test object + * - FreeSans, '0' + * - TTF Shape for Glyph 19 + */ +public class Glyph04FreeSans_0 extends UIShape { + + public Glyph04FreeSans_0(final Factory factory, final int renderModes) { + super(factory, renderModes); + } + + @Override + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { + final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); + + // Start TTF Shape for Glyph 19 + // 000: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.043000f, 0.343000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.043000f, 0.432000f, false); + shape.addVertex(0, 0.058000f, 0.500000f, true); + // 002: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.073000f, 0.568000f, false); + shape.addVertex(0, 0.096000f, 0.606000f, true); + // 003: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.119000f, 0.645000f, false); + shape.addVertex(0, 0.151000f, 0.669000f, true); + // 004: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.183000f, 0.693000f, false); + shape.addVertex(0, 0.212000f, 0.701000f, true); + // 005: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.242000f, 0.709000f, false); + shape.addVertex(0, 0.275000f, 0.709000f, true); + // 006: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.507000f, 0.709000f, false); + shape.addVertex(0, 0.507000f, 0.337000f, true); + // 008: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.507000f, 0.162000f, false); + shape.addVertex(0, 0.448000f, 0.070000f, true); + // 010: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.388000f, -0.023000f, false); + shape.addVertex(0, 0.275000f, -0.023000f, true); + // 011: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.161000f, -0.023000f, false); + shape.addVertex(0, 0.102000f, 0.070000f, true); + // 013: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.043000f, 0.164000f, false); + shape.addVertex(0, 0.043000f, 0.343000f, true); + System.err.println("Glyph04FreeSans_0.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + + // 021: B0b: move-to pM + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.417000f, 0.345000f, true); + // 021: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.417000f, 0.631000f, false); + shape.addVertex(0, 0.275000f, 0.631000f, true); + // 015: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.133000f, 0.631000f, false); + shape.addVertex(0, 0.133000f, 0.342000f, true); + // 016: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.133000f, 0.050000f, false); + shape.addVertex(0, 0.273000f, 0.050000f, true); + // 018: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.347000f, 0.050000f, false); + shape.addVertex(0, 0.382000f, 0.122000f, true); + // 020: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.417000f, 0.194000f, false); + shape.addVertex(0, 0.417000f, 0.345000f, true); + System.err.println("Glyph04FreeSans_0.shape02a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + + // End Shape for Glyph 19 + + shape.setIsQuadraticNurbs(); + shape.setSharpness(shapesSharpness); + region.addOutlineShape(shape, null, rgbaColor); + + box.resize(shape.getBounds()); + } + + @Override + public String getSubString() { + return super.getSubString(); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java new file mode 100644 index 000000000..e7f726b1f --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java @@ -0,0 +1,287 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.graph.testshapes; + +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; + +/** + * GPU based resolution independent test object + * - FreeSans, '0' + * - TTF Shape for Glyph 19 + */ +public class Glyph05FreeSerifBoldItalic_ae extends UIShape { + + public Glyph05FreeSerifBoldItalic_ae(final Factory factory, final int renderModes) { + super(factory, renderModes); + } + + @Override + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { + } + + @Override + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { + final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); + + // Start TTF Shape for Glyph 168 + // 000: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.450000f, -0.013000f, true); + // 000: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.386000f, -0.013000f, false); + shape.addVertex(0, 0.353000f, 0.018000f, true); + // 002: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.319000f, 0.049000f, false); + shape.addVertex(0, 0.307000f, 0.118000f, true); + // 003: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.265000f, 0.049000f, false); + shape.addVertex(0, 0.225000f, 0.019000f, true); + // 005: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.184000f, -0.012000f, false); + shape.addVertex(0, 0.134000f, -0.012000f, true); + // 006: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.085000f, -0.012000f, false); + shape.addVertex(0, 0.053000f, 0.021000f, true); + // 008: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.020000f, 0.055000f, false); + shape.addVertex(0, 0.020000f, 0.106000f, true); + // 009: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.020000f, 0.185000f, false); + shape.addVertex(0, 0.062000f, 0.269000f, true); + // 011: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.105000f, 0.353000f, false); + shape.addVertex(0, 0.170000f, 0.407000f, true); + // 012: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.235000f, 0.462000f, false); + shape.addVertex(0, 0.296000f, 0.462000f, true); + // 013: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.328000f, 0.462000f, false); + shape.addVertex(0, 0.346000f, 0.448000f, true); + // 015: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.364000f, 0.433000f, false); + shape.addVertex(0, 0.377000f, 0.396000f, true); + // 016: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.395000f, 0.454000f, true); + // 017: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.498000f, 0.459000f, true); + // 018: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.478000f, 0.394000f, true); + // 019: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.510000f, 0.431000f, false); + shape.addVertex(0, 0.535000f, 0.445000f, true); + // 021: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.561000f, 0.459000f, false); + shape.addVertex(0, 0.598000f, 0.459000f, true); + // 022: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.645000f, 0.459000f, false); + shape.addVertex(0, 0.671000f, 0.436000f, true); + // 024: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.698000f, 0.413000f, false); + shape.addVertex(0, 0.698000f, 0.372000f, true); + // 025: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.698000f, 0.310000f, false); + shape.addVertex(0, 0.639000f, 0.263000f, true); + // 027: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.579000f, 0.215000f, false); + shape.addVertex(0, 0.470000f, 0.190000f, true); + // 028: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.431000f, 0.181000f, true); + // 029: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.426000f, 0.156000f, false); + shape.addVertex(0, 0.426000f, 0.134000f, true); + // 031: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.426000f, 0.096000f, false); + shape.addVertex(0, 0.444000f, 0.073000f, true); + // 033: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.462000f, 0.050000f, false); + shape.addVertex(0, 0.493000f, 0.050000f, true); + // 034: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.565000f, 0.050000f, false); + shape.addVertex(0, 0.616000f, 0.139000f, true); + // 036: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.644000f, 0.122000f, true); + // 037: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.578000f, -0.013000f, false); + shape.addVertex(0, 0.450000f, -0.013000f, true); + System.err.println("Glyph05FreeSerifBoldItalic_ae.shape01a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + + // 039: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.194000f, 0.058000f, true); + // 039: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.238000f, 0.058000f, false); + shape.addVertex(0, 0.278000f, 0.122000f, true); + // 041: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.319000f, 0.187000f, false); + shape.addVertex(0, 0.338000f, 0.256000f, true); + // 042: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.358000f, 0.326000f, false); + shape.addVertex(0, 0.358000f, 0.363000f, true); + // 043: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.358000f, 0.387000f, false); + shape.addVertex(0, 0.345000f, 0.403000f, true); + // 045: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.331000f, 0.419000f, false); + shape.addVertex(0, 0.310000f, 0.419000f, true); + // 046: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.267000f, 0.419000f, false); + shape.addVertex(0, 0.227000f, 0.356000f, true); + // 048: B5: quad-to pMh-p0-p1h ***** MID + // Shape.QuadTo: + shape.addVertex(0, 0.187000f, 0.293000f, false); + shape.addVertex(0, 0.167000f, 0.225000f, true); + // 049: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.146000f, 0.156000f, false); + shape.addVertex(0, 0.146000f, 0.119000f, true); + // 050: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.146000f, 0.092000f, false); + shape.addVertex(0, 0.159000f, 0.075000f, true); + // 052: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.172000f, 0.058000f, false); + shape.addVertex(0, 0.194000f, 0.058000f, true); + System.err.println("Glyph05FreeSerifBoldItalic_ae.shape02a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + + if( true ) { + // GlyphShape<168>: offset 0 of 8/61 points + // pM[060] P[443/231, on true, end true] + // p0[053] P[438/214, on true, end false] + // p1[054] P[498/223, on false, end false] + // p2[055] P[608/320, on false, end false] + // 053: B0a: move-to p0 + // Shape.MoveTo: + shape.closeLastOutline(false); + shape.addEmptyOutline(); + shape.addVertex(0, 0.438000f, 0.214000f, true); + // 053: B4: quad-to p0-p1-p2h **** MID + // Shape.QuadTo: + shape.addVertex(0, 0.498000f, 0.223000f, false); + shape.addVertex(0, 0.553000f, 0.271000f, true); + // GlyphShape<168>: offset 2 of 8/61 points + // pM[054] P[498/223, on false, end false] + // p0[055] P[608/320, on false, end false] + // p1[056] P[608/388, on true, end false] + // p2[057] P[608/429, on false, end false] + // 055: B6: quad-to pMh-p0-p1 + // Shape.QuadTo: + shape.addVertex(0, 0.608000f, 0.320000f, false); + shape.addVertex(0, 0.608000f, 0.388000f, true); + // GlyphShape<168>: offset 3 of 8/61 points + // pM[055] P[608/320, on false, end false] + // p0[056] P[608/388, on true, end false] + // p1[057] P[608/429, on false, end false] + // p2[058] P[575/429, on true, end false] + // 056: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.608000f, 0.429000f, false); + shape.addVertex(0, 0.575000f, 0.429000f, true); + // GlyphShape<168>: offset 5 of 8/61 points + // pM[057] P[608/429, on false, end false] + // p0[058] P[575/429, on true, end false] + // p1[059] P[502/429, on false, end false] + // p2[060] P[443/231, on true, end true] + // 058: B2: quad-to p0-p1-p2 + // Shape.QuadTo: + shape.addVertex(0, 0.502000f, 0.429000f, false); + shape.addVertex(0, 0.443000f, 0.231000f, true); + // GlyphShape<168>: offset 7 of 8/61 points + // pM[059] P[502/429, on false, end false] + // p0[060] P[443/231, on true, end true] + // p1[053] P[438/214, on true, end false] + // p2[054] P[498/223, on false, end false] + // 060: B1: line-to p0-p1 + // Shape.LineTo: + shape.addVertex(0, 0.438000f, 0.214000f, true); + System.err.println("Glyph05FreeSerifBoldItalic_ae.shape03a.winding_area: "+shape.getWindingOfLastOutline()); + shape.closeLastOutline(false); + } + + // End Shape for Glyph 168 + + shape.setIsQuadraticNurbs(); + shape.setSharpness(shapesSharpness); + region.addOutlineShape(shape, null, rgbaColor); + + box.resize(shape.getBounds()); + } + + @Override + public String getSubString() { + return super.getSubString(); + } +} -- cgit v1.2.3