Java 类org.newdawn.slick.font.effects.Effect 实例源码

项目:trashjam2017    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:Progetto-C    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:BaseClient    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:Generic-Zombie-Shooter-Redux    文件:AssetManager.java   
@SuppressWarnings("unchecked")
public void addFont(String key, String file, int size, boolean bold, boolean italic, Effect [] effects) throws SlickException {
    try {
        AssetManager.ASSETS_TO_LOAD++;

        UnicodeFont uni = new UnicodeFont(file, size, bold, italic);
        uni.addAsciiGlyphs();
        uni.addGlyphs(400, 600);
        uni.getEffects().add(new ColorEffect(Color.WHITE));
        uni.getEffects().addAll(Arrays.asList(effects));
        uni.loadGlyphs();
        if((fonts != null) && (uni != null)) {
            fonts.put(key, uni);

            AssetManager.ASSETS_LOADED++;
            System.out.println(String.format("Font Loaded: %s", key));
        }
    } catch(Exception ex) {
        ex.printStackTrace();
        System.out.printf("ERROR: Font \"%s\" could not be loaded!\n", file);
    }
}
项目:code404    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, pageX, pageY, width, height, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:fuzzy-octo-shame    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 *
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(@Nonnull Glyph glyph, int width, int height) {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Effect effect : unicodeFont.getEffects()) (effect).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:GPVM    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:GPVM    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:SpaceStationAlpha    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:cretion    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:slick2d-maven    文件:GlyphPage.java   
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
    // Draw the glyph to the scratch image using Java2D.
    scratchGraphics.setComposite(AlphaComposite.Clear);
    scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
    scratchGraphics.setComposite(AlphaComposite.SrcOver);
    scratchGraphics.setColor(java.awt.Color.white);
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
        ((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
    glyph.setShape(null); // The shape will never be needed again.

    WritableRaster raster = scratchImage.getRaster();
    int[] row = new int[width];
    for (int y = 0; y < height; y++) {
        raster.getDataElements(0, y, width, 1, row);
        scratchIntBuffer.put(row);
    }
    GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
        scratchByteBuffer);
    scratchIntBuffer.clear();

    glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
项目:opsu-dance    文件:Fonts.java   
/**
 * Loads a Unicode font and its ASCII glyphs.
 * @param font the font to load
 * @param effect the font effect
 * @throws SlickException if the glyphs could not be loaded
 */
@SuppressWarnings("unchecked")
private static void loadFont(UnicodeFont font, Effect effect) throws SlickException {
    font.addAsciiGlyphs();
    font.getEffects().add(effect);
    font.loadGlyphs();
}
项目:fuzzy-octo-shame    文件:HieroSettings.java   
/**
 * Saves the settings to a file.
 *
 * @param file The file we're saving to
 * @throws IOException if the file could not be saved.
 * @throws SlickException if effect from effects is not ConfigurableEffect
 */
public void save(@Nonnull File file) throws SlickException, IOException {
    try(
        final FileOutputStream fileOutputStream = new FileOutputStream(file);
        final PrintStream out = new PrintStream(fileOutputStream)
    ) {
        out.println("font.size=" + fontSize);
        out.println("font.bold=" + bold);
        out.println("font.italic=" + italic);
        out.println();
        out.println("pad.top=" + paddingTop);
        out.println("pad.right=" + paddingRight);
        out.println("pad.bottom=" + paddingBottom);
        out.println("pad.left=" + paddingLeft);
        out.println("pad.advance.x=" + paddingAdvanceX);
        out.println("pad.advance.y=" + paddingAdvanceY);
        out.println();
        out.println("glyph.page.width=" + glyphPageWidth);
        out.println("glyph.page.height=" + glyphPageHeight);
        out.println();
        for (Iterator<Effect> iter = effects.iterator(); iter.hasNext();) {
            if(!(iter.next() instanceof ConfigurableEffect)) {
                throw new SlickException("Effect is not org.newdawn.slick.font.effects.ConfigurableEffect");
            }
            ConfigurableEffect effect = (ConfigurableEffect) iter.next();            
            out.println("effect.class=" + effect.getClass().getName());
            for (Value value : effect.getValues()) {
                out.println("effect." + value.getName() + "=" + value.getString());
            }
            out.println();
        }
    }
}
项目:opsu    文件:Fonts.java   
/**
 * Loads a Unicode font and its ASCII glyphs.
 * @param font the font to load
 * @param effect the font effect
 * @param backup the backup font
 * @throws SlickException if the glyphs could not be loaded
 */
@SuppressWarnings("unchecked")
private static void loadFont(UnicodeFont font, Effect effect, UnicodeFont backup) throws SlickException {
    font.addBackupFont(backup);
    font.addAsciiGlyphs();
    font.getEffects().add(effect);
    font.loadGlyphs();
}
项目:Generic-Zombie-Shooter-Redux    文件:AssetManager.java   
public void addFont(String key, String file, int size, boolean bold, boolean italic) throws SlickException {
    addFont(key, file, size, bold, italic, new Effect[] { new ColorEffect(Color.WHITE) });
}
项目:fuzzy-octo-shame    文件:UnicodeFont.java   
/**
 * Returns a list of {@link org.newdawn.slick.font.effects.Effect}s that will be applied
 * to the glyphs.
 *
 * @return The list of effects to be applied to the font
 */
@Nonnull
public List<Effect> getEffects () {
    return effects;
}
项目:fuzzy-octo-shame    文件:HieroSettings.java   
/**
 * @see UnicodeFont#getEffects()
 *
 * @return The list of effects applied to the text
 */
@Nonnull
public List<Effect> getEffects() {
    return effects;
}