当前位置: 首页>>代码示例>>Java>>正文


Java TextRenderer类代码示例

本文整理汇总了Java中com.jogamp.opengl.util.awt.TextRenderer的典型用法代码示例。如果您正苦于以下问题:Java TextRenderer类的具体用法?Java TextRenderer怎么用?Java TextRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextRenderer类属于com.jogamp.opengl.util.awt包,在下文中一共展示了TextRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotate

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {         //shows the class in the jAER window
    if ((drawable == null) || (chip.getCanvas() == null) || !classifyEvents || model == null) {
        return;
    }
    titleRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 40));
    Rectangle2D bounds = titleRenderer.getBounds("Unkown");
    titleArea = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());
    GL2 gl = drawable.getGL().getGL2();
    gl.glColor3f(1, 1, 1);
    gl.glRasterPos3f(10, 10, 0);
    titleRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
    titleRenderer.setColor(Color.WHITE);
    titleRenderer.draw(String.format("Class: %d", labeledClass), titleArea.x, titleArea.y);
    titleRenderer.endRendering();
    gl.glPushMatrix();
    gl.glLoadIdentity();
    gl.glTranslatef(drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() / 2, 0);
    gl.glColor3f(1, 1, 1);
    float w = drawable.getSurfaceWidth() * lastdot * 5;
    gl.glRectf(0, -10, w, 10);
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:24,代码来源:CochleaSVMTwoEars.java

示例2: annotate

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
@Override
    public void annotate(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();
//             if (textRenderer == null) {
        textRenderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 24), true, true);
        textRenderer.setColor(Color.blue);

//            }
        gl.glColor3f(0, 0, 1);
        gl.glLineWidth(2);
        final float x = chip.getSizeX() * .4f, y = (chip.getSizeY()) * .9f;
        textRenderer.begin3DRendering();
        String s = String.format("TimestampCalibrator: ts-wall: %6dms, ppmTsTooFast: %6.0f", driftTsMinusClockMs, ppmTimestampTooFastError);
        Rectangle2D r = textRenderer.getBounds(s); // width and height in pixels with scale=1
        // set scale so that width fills fraction of 
        final float scale = (float) (0.7f * (float) chip.getSizeX() / r.getWidth());
        textRenderer.draw3D(s, (float) (x - scale * r.getWidth() / 2), (float) (y - scale * r.getHeight() / 2), 0, scale);
        textRenderer.end3DRendering();
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:TimestampCalibrator.java

示例3: ApsNoiseStatistics

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public ApsNoiseStatistics(AEChip chip) {
    super(chip);
    if ((chip.getCanvas() != null) && (chip.getCanvas().getCanvas() != null)) {
        canvas = chip.getCanvas();
        glCanvas = (GLCanvas) chip.getCanvas().getCanvas();
        renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 24), true, true);
    }
    currentAddress = new int[chip.getNumCellTypes()];
    Arrays.fill(currentAddress, -1);
    frameExtractor = new ApsFrameExtractor(chip);
    FilterChain chain = new FilterChain(chip);
    chain.add(frameExtractor);
    setEnclosedFilterChain(chain);
    chip.addObserver(this);
    setPropertyTooltip("scaleHistogramsIncludingOverflow", "Scales histograms to include overflows for ISIs that are outside of range");
    setPropertyTooltip("histNumBins", "number of bins in the spatial (FPN) histogram");
    setPropertyTooltip("spatialHistogramEnabled", "shows the spatial (FPN) histogram for mouse-selected region");
    setPropertyTooltip("temporalNoiseEnabled", "<html>shows the temporal noise (AC RMS) of pixels in mouse-selected region. <br>The AC RMS is computed for each pixel separately and the grand average AC RMS is displayed.<\br>Use left-mouse to drag select a range of pixels.<\br>Use right-mouse to drag a line along temporal noise measurements to estimate conversion gain.");
    setPropertyTooltip("resetOnBiasChange", "Resets filter on any PropertyChangeEvent from the chip's configuration");
    setPropertyTooltip("adcVref", "Input voltage range of ADC; on DAVIS240 the range is 1.5V with AdcLow=.21, AdcHigh=1.81");
    setPropertyTooltip("adcResolutionCounts", "Resolution of ADC in DN (digital number) counts");
    setPropertyTooltip("useZeroOriginForTemporalNoise", "Sets origin for temporal noise plot to 0,0 to help see structure more easily");

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:25,代码来源:ApsNoiseStatistics.java

示例4: createComponents

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
/**
 * Create the components.
 */
@Override
protected void createComponents(GL2 gl) {
	axisLabelRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 12));
	textRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 10));

	axesLabels = new String[2];
	axisLabelAreas = new Rectangle[axesLabels.length];
	for (int i = 0; i < axesLabels.length; i++) {
		StringBuilder buf = new StringBuilder();
		//            for(Category s : categories) {
		Category s = categories[0];
		buf.append(s.axes[i].title);
		if (s.axes[i].unit != null) {
			buf.append(" [" + s.axes[i].unit + "]");
		}
		buf.append('\n');
		//            }
		String str = buf.toString();
		axesLabels[i] = str.substring(0, str.length() - 1);
		Rectangle2D bounds = axisLabelRenderer.getBounds(axesLabels[i]);
		axisLabelAreas[i] = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:XYChart.java

示例5: init

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
/**
 * Initialize the view for OpenGL drawing.
 */
@Override
public void init(GLAutoDrawable drawable) {
	running = true;
	GL2 gl = drawable.getGL().getGL2();

	// background color
	float[] bg = new float[4];
	getBackground().getColorComponents(bg);
	gl.glClearColor(bg[0], bg[1], bg[2], bg[3]);

	// title
	titleRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 16));
	Rectangle2D bounds = titleRenderer.getBounds(title);
	titleArea = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());

	/* create grid drawing routine */
	gridId = gl.glGenLists(1);
	gl.glNewList(gridId, GL2.GL_COMPILE);
	drawStaticBackground(gl);
	gl.glEndList();

	createComponents(drawable.getGL().getGL2());
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:Chart.java

示例6: drawRadialGridText

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
private static void drawRadialGridText(GL2 gl, ArrayList<GridLabel> labels, double size, float[] labelPos) {
    gl.glDisable(GL2.GL_CULL_FACE);

    float fuzz = 0.75f;
    for (float rsize : labelPos) {
        TextRenderer renderer = GLText.getRenderer((int) (fuzz * rsize * size));
        float textScaleFactor = textScale / renderer.getFont().getSize2D();
        renderer.begin3DRendering();
        for (GridLabel label : labels) {
            renderer.draw3D(label.txt, rsize * label.x, rsize * label.y, 0, fuzz * rsize * textScaleFactor);
        }
        renderer.end3DRendering();
    }

    gl.glEnable(GL2.GL_CULL_FACE);
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:17,代码来源:GridLayer.java

示例7: getRenderer

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public static TextRenderer getRenderer(int size) {
    size *= GLInfo.pixelScale[1];

    int idx = (size - MIN) / STEP;
    if (idx < 0)
        idx = 0;
    else if (idx >= SIZE)
        idx = SIZE - 1;

    if (renderer[idx] == null) {
        Font font = UIGlobals.UIFontRoboto.deriveFont((float) (idx * STEP + MIN));
        renderer[idx] = new TextRenderer(font, true, true, null, true);
        renderer[idx].setUseVertexArrays(true);
        // renderer[idx].setSmoothing(false);
        renderer[idx].setColor(Color.WHITE);
        // precache for grid text
        renderer[idx].draw3D("-0123456789.", 0, 0, 0, 0);
    }
    return renderer[idx];
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:21,代码来源:GLText.java

示例8: renderStarInfo

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public void renderStarInfo(Star selectedStar, Observer obs, Rectangle2D window, GL2 gl){
    TextRenderer titleRenderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 26));
    titleRenderer.setColor(0.051f, 0.596f, 0.729f, 1f);
    titleRenderer.beginRendering((int)window.getWidth(), (int)window.getHeight());
    titleRenderer.draw("HIP " + selectedStar.getHipparcos(), 0, (int)window.getHeight() - 30);
    titleRenderer.endRendering();

    TextRenderer infoRenderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 15));
    infoRenderer.setColor(0.141f, 0.784f, 0.941f, 1f);
    infoRenderer.beginRendering((int)window.getWidth(), (int)window.getHeight());
    infoRenderer.draw("Magnitude: " + selectedStar.getMagnitude(), 0, (int)window.getHeight() - 55);

    String bvString = String.format("B-V Color Index %.2f", selectedStar.getBVMagnitude());
    infoRenderer.draw(bvString, 0, (int) (window.getHeight() - 75));

    EquatorialCoordinates eq = selectedStar.getEquatorialCoordinates();
    String raString = Utils.rad2String(eq.getRightAscension(), false, true);
    String decString = Utils.rad2String(eq.getDeclination(), false, false);
    infoRenderer.draw("RA/Dec(J2000): "  + raString + "/" + decString, 0, (int)window.getHeight() - 95);

    HorizontalCoordinates az = eq.toHorizontal(obs.getLongitude(), obs.getLatitude(), obs.getSideralTime());
    String azString = Utils.rad2String(az.getAzimuth() - Math.PI, true, false);
    String altString = Utils.rad2String(az.getAltitude(), false, false);
    infoRenderer.draw("Az/Alt: " + azString + " / " + altString, 0, (int)window.getHeight() - 115);
    infoRenderer.endRendering();
}
 
开发者ID:Haurentziu,项目名称:Java-Planetarium,代码行数:27,代码来源:TextInfo.java

示例9: AxisRenderer3D

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
/**
 *	Default constructor sets some default axis values
 */
public AxisRenderer3D()
{
	Float[] c = RGBColour.WHITE;
	this.config.getRenderingConfig().setColour( new float[]{ c[0], c[1], c[2] } );
	c = RGBColour.GRAY;
	this.config.getRenderingConfig().setMajorTickColour( new float[]{ c[0], c[1], c[2] } );
	this.config.getRenderingConfig().setMajorGridColour( new float[]{ c[0], c[1], c[2] } );
	this.config.getRenderingConfig().setMinorTickColour( new float[]{ c[0], c[1], c[2] } );
	c = new Float[] {0.3f,0.3f,0.3f};
	this.config.getRenderingConfig().setMinorGridColour( new float[]{ c[0], c[1], c[2] } );
	this.config.getRenderingConfig().setMajorTickLength( 0.04 );
	this.config.getRenderingConfig().setMinorTickLength( 0.01 );
	this.config.getRenderingConfig().setMajorTickSpacing( 1 );
	this.config.getRenderingConfig().setMinorTickSpacing( 0.5 );

	this.config.getRenderingConfig().setThickness( 3 );
	this.config.getRenderingConfig().setMajorTickThickness( 1 );
	this.config.getRenderingConfig().setMinorTickThickness( 0.5 );

	this.textRenderer = new TextRenderer( new Font( "SansSerif", Font.BOLD, 36 ) );
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:AxisRenderer3D.java

示例10: GLMapDrawer

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public GLMapDrawer(GLMapView parent)
{
    super(parent);

    // render with the operating systems default font at 12pt.
    text = new TextRenderer(new java.awt.Font(Display.getDefault().getSystemFont().getFontData()[0].getName(), java.awt.Font.PLAIN, 12), true, false);
    textureCache = new TextureCache(parent.getGlContext().getGL().getGL2());

    projectDrawJobs = new ArrayList<>();
    postAnimationJobs = new ArrayList<>();

    addProjectDrawJob(new MapTextureDrawJob());
    addProjectDrawJob(new LatLonDrawJob());
    addProjectDrawJob(new DayNightDrawJob());
    addProjectDrawJob(new ScenarioDrawJob());

    MaruMapPlugin.getDefault().addGLDrawJobRunner(this);
}
 
开发者ID:vobject,项目名称:maru,代码行数:19,代码来源:GLMapDrawer.java

示例11: drawText

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public static void drawText(TextRenderer renderer, int width, int height,
                            int posX, int posY, String text, boolean outline)
{
    renderer.beginRendering(width, height);

    if (outline)
    {
        // draw text outline in black
        renderer.setColor(0.0f, 0.0f, 0.0f, 1.0f);
        renderer.draw(text, posX - 1, posY - 1);
        renderer.draw(text, posX - 1, posY);
        renderer.draw(text, posX - 1, posY + 1);

        renderer.draw(text, posX + 1, posY - 1);
        renderer.draw(text, posX + 1, posY);
        renderer.draw(text, posX + 1, posY + 1);
    }

    // draw the actual text in white
    renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
    renderer.draw(text, posX, posY);
    renderer.endRendering();
}
 
开发者ID:vobject,项目名称:maru,代码行数:24,代码来源:GLUtils.java

示例12: LoadFont

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public static void LoadFont(String name, int size, URL resource) {

		Font font;

		try {
			font = Font.createFont(Font.TRUETYPE_FONT, resource.openStream());

			// Scale it up
			font = font.deriveFont((float) size);
		} catch (FontFormatException | IOException e) {

			// Failsafe font
			font = new Font("SansSerif", Font.BOLD, size);
		}

		TextRenderer renderer = new TextRenderer(font, true, true,
				new TextRenderer.DefaultRenderDelegate(), true);

		fonts.put(name, font);
		renderers.put(name, renderer);
	}
 
开发者ID:ryft,项目名称:NetVis,代码行数:22,代码来源:TextRendererPool.java

示例13: paint

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
@Override
public void paint(){
	// Compute maximum width of text we're going to draw
	TextRenderer textRenderer = new TextRenderer(new Font(Font.SERIF,0 , 18));
	
    int maxTextWidth = (int) textRenderer.getBounds(this.text).getWidth();
    maxTextWidth = Math.min(maxTextWidth+10,size.width);
	
	GL2 gl=glContext.getGL2();
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glPolygonMode (GL2.GL_FRONT, GL2.GL_LINE_STRIP);
    gl.glColor3f(0.5f, 0.5f, 0.5f);

    gl.glBegin(GL2.GL_LINE_STRIP);
    gl.glVertex2i( this.posx,this.posy);							//x1,y1
    gl.glVertex2i( this.posx+maxTextWidth,this.posy );				//x2,y1
    gl.glVertex2i( this.posx+maxTextWidth,this.posy +size.height); 	//x2,y2 
    gl.glVertex2i( this.posx,this.posy+size.height);				//x1,y2
    gl.glVertex2i( this.posx,this.posy);	
    gl.glEnd( );
    
    
    GLDrawable draw=gl.getGL().getContext().getGLDrawable();
	textRenderer.beginRendering(draw.getWidth(),draw.getHeight());
	textRenderer.setColor(Color.WHITE);
	textRenderer.setSmoothing(true);
	textRenderer.draw(this.text,(int)posx,(int)posy+5); //text and position
	textRenderer.flush();
	textRenderer.endRendering();
	
	gl.glFlush();
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:33,代码来源:GLButton.java

示例14: setFontSize

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
/**
 * Sets a new font size for the axes labels and title.
 *
 * @param fontSize the fontSize to set
 */
synchronized public void setFontSize(int fontSize) {
	if (this.fontSize != fontSize) {
		this.fontSize = fontSize;
		textRenderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, getFontSize()), true, true);
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:ImageDisplay.java

示例15: CochleaGenderClassifier

import com.jogamp.opengl.util.awt.TextRenderer; //导入依赖的package包/类
public CochleaGenderClassifier (AEChip chip){
    super(chip);
    setNBins(weights.length);
    setMaxIsiUs(9000);
    setMinIsiUs(3000);
    setDirection(Direction.XtimesYDirection);
    titleRenderer = new TextRenderer(new Font("Helvetica",Font.PLAIN,48));
    Rectangle2D bounds = titleRenderer.getBounds(Gender.Unknown.toString());
    titleArea = new Rectangle((int)bounds.getWidth(),(int)bounds.getHeight());
    setPropertyTooltip("Gender params","genderThreshold","threshold for abs(dot product) to classify as (female) speaker. If abs(dot)<genderThreshold then sex is Unknown.");
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:CochleaGenderClassifier.java


注:本文中的com.jogamp.opengl.util.awt.TextRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。