APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.tools.hiero.unicodefont.effects

public Class DistanceFieldEffect

extends Object
implements ConfigurableEffect
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect, com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect
Imports
java.awt.Color, .Graphics2D, .RenderingHints, java.awt.geom.AffineTransform, java.awt.image.BufferedImage, java.util.ArrayList, .Iterator, .List, com.badlogic.gdx.tools.distancefield.DistanceFieldGenerator, com.badlogic.gdx.tools.hiero.unicodefont.Glyph, .UnicodeFont

A filter to create a distance field. The resulting font can be rendered with a simple custom shader to draw bitmap fonts that remain crisp even under high magnification.

An example of the use of such a font is included in the libgdx test suite under the name BitmapFontDistanceFieldTest.

Author
Thomas ten Cate
See Also
DistanceFieldGenerator

Field Summary

Modifier and TypeField and Description
private Color
private int
private float

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph)

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect.draw.

Called to draw the effect.

private void
drawGlyph(BufferedImage
the image to draw to
image
,
Glyph
the glyph to draw
glyph
)

Draws the glyph to the given image, upscaled by a factor of scale.

public List<E>
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

colorback to summary
private Color color
scaleback to summary
private int scale
spreadback to summary
private float spread

Constructor Detail

DistanceFieldEffectback to summary
public DistanceFieldEffect()

Method Detail

drawback to summary
public void draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph)

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect.draw.

Doc from com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect.draw.

Called to draw the effect.

Annotations
@Override
drawGlyphback to summary
private void drawGlyph(BufferedImage image, Glyph glyph)

Draws the glyph to the given image, upscaled by a factor of scale.

Parameters
image:BufferedImage

the image to draw to

glyph:Glyph

the glyph to draw

getValuesback to summary
public List<E> getValues()

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.getValues.

Doc from com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.getValues.

Returns the list of Values for this effect. This list is not typically backed by the effect, so changes to the values will not take affect until setValues(List) is called.

Annotations
@Override
setValuesback to summary
public void setValues(List<E> values)

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.setValues.

Doc from com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.setValues.

Sets the list of Values for this effect.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override