public final class JHelpRichText
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
JHelpRichText.CacheImageElement
Cache element of image.
|
private static class |
JHelpRichText.Symbol
Represents an association between a symbol (For example :) ) and an image
|
Modifier and Type | Field and Description |
---|---|
private Cache<JHelpImage> |
CACHE_IMAGES
Images cache
|
private Resources |
resources
Resources set
|
private SortedArray<JHelpRichText.Symbol> |
symbols
Registered associations
|
Constructor and Description |
---|
JHelpRichText(Resources resources)
Create a new instance of JHelpRichText
|
Modifier and Type | Method and Description |
---|---|
void |
associate(java.lang.String symbol,
java.lang.String resource)
Add/modify an association for a symbol to an image
|
JHelpImage |
createImage(java.lang.String text,
JHelpFont font,
int colorText)
Create an image for draw the text with symbols replaced by corresponding image
|
private JHelpImage |
createImage(java.lang.String text,
JHelpFont font,
int colorText,
JHelpPaint paintText,
JHelpImage textureText)
Compute image that draw the text with symbols replaced by corresponding images
|
JHelpImage |
createImage(java.lang.String text,
JHelpFont font,
JHelpImage textureText)
Create an image for draw the text with symbols replaced by corresponding image
|
JHelpImage |
createImage(java.lang.String text,
JHelpFont font,
JHelpPaint paintText)
Create an image for draw the text with symbols replaced by corresponding image
|
java.lang.String |
obtainAssociation(java.lang.String symbol)
Obtain the image resource name for a symbol
|
private JHelpImage |
obtainImage(java.lang.String resource,
int size)
Obtain an image from cache
|
private final Cache<JHelpImage> CACHE_IMAGES
private final Resources resources
private final SortedArray<JHelpRichText.Symbol> symbols
public JHelpRichText(Resources resources)
resources
- Resources set where find imagesprivate JHelpImage createImage(java.lang.String text, JHelpFont font, int colorText, JHelpPaint paintText, JHelpImage textureText)
text
- Text to drawfont
- Font to use for textcolorText
- Color for text (Used if paintText and texturePaint are null
)paintText
- Paint for text (Used if not null
and texturePaint is null
)textureText
- Texture for text (Used if not null
)private JHelpImage obtainImage(java.lang.String resource, int size)
resource
- Image resource namesize
- Image sizepublic void associate(java.lang.String symbol, java.lang.String resource)
symbol
- Symbol to associateresource
- Image resource namepublic JHelpImage createImage(java.lang.String text, JHelpFont font, int colorText)
text
- Text to convertfont
- Font to use for textcolorText
- Text colorpublic JHelpImage createImage(java.lang.String text, JHelpFont font, JHelpImage textureText)
text
- Text to convertfont
- Font to use for texttextureText
- Text texturepublic JHelpImage createImage(java.lang.String text, JHelpFont font, JHelpPaint paintText)
text
- Text to convertfont
- Font to use for textpaintText
- Text paintpublic java.lang.String obtainAssociation(java.lang.String symbol)
symbol
- Symbol searchnull
if symbol not registered