Interface ExpansionSymbolTemplate
-
- All Known Implementing Classes:
AbstractExpansionSymbolTemplate
public interface ExpansionSymbolTemplate
Describes the various expansion symbols needed to decorate components. For example, a particular game's components might make use of "Light", "Dark", and "Golden" versions of an expansion's symbol, depending on the component type. Templates are used by SE to help the user construct custom expansions for personal use.Visual Variants versus Logical Variants
The template allows games to distinguish between visual variants (different expansion symbol styles) and logical variants (different semantic variants). For example, a game might use icons that are different colours for different types of components (visual variants), and draw the icon in different places depending on whether the icon is indicating that the component belongs to an expansion or requires that expansion (logical variants). The default expansion symbol painting mechanism assumes that these two classes are identical (that is, that each visual variant is also a logical variant); selecting a logical variant will result in the corresponding visual variant being painted.In Strange Eons, the Variant menu will be populated from the logical variant list, and the expansion setting on the component will be set with the index of the logical variant. When creating a new expansion using Expansion|New, the visual variant list will be used so that the user can supply appropriate graphics for the different visual variants.
- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canGenerateVariantsAutomatically()
Returnstrue
if this template can automatically generate a family of variants given an example image.java.awt.image.BufferedImage
generateVariant(java.awt.image.BufferedImage baseSymbol, int variant)
Given an example image, generates a variant automatically.java.awt.image.BufferedImage
getDefaultSymbol(int variant)
Returns a variant of the default symbol.java.awt.Paint
getDesignBackdropForVariant(int variant)
Returns a suggested paint to use as a backdrop for this variant.int
getLogicalVariantCount()
Returns the number of logical variants for games that distinguish between visual variants and logical variants.javax.swing.Icon
getLogicalVariantIcon(int variant)
Returns an icon that can accompany the logical variant name to visually distinguish the the variant.java.lang.String
getLogicalVariantName(int variant)
Returns the name of then
th logical variant for games that distinguish between visual variants and logical variants.int
getVariantCount()
Returns the number of variant symbols needed for components of the game this template describes.javax.swing.Icon
getVariantIcon(int variant)
Returns an icon that can accompany the variant name to visually distinguish the style of the variant.java.lang.String
getVariantName(int variant)
Returns the name of then
th symbol variant; this is a simple description in the UI language; e.g., "Regular", "Inversed".boolean
isCustomDrawn()
Returnstrue
if the components for this game will draw the expansion symbols themselves instead of relying on the default mechanism.
-
-
-
Method Detail
-
getVariantCount
int getVariantCount()
Returns the number of variant symbols needed for components of the game this template describes. This is not the number of expansion symbols, but the number of variant styles required for each symbol. For example, for one game all of the symbols might be black. That is one symbol variant. Another game might use black symbols on light cards, and white symbols on dark cards. That is two symbol variants.- Returns:
- the number of symbol variants
-
getVariantName
java.lang.String getVariantName(int variant)
Returns the name of then
th symbol variant; this is a simple description in the UI language; e.g., "Regular", "Inversed".- Parameters:
variant
- the variant number of the symbol- Returns:
- a description of the symbol
-
getVariantIcon
javax.swing.Icon getVariantIcon(int variant)
Returns an icon that can accompany the variant name to visually distinguish the style of the variant. A typical icon is a disc filled with a characteristic colour taken from the variant's design.- Parameters:
variant
- the variant number- Returns:
- a simple icon that helps distinguish the variant
-
getLogicalVariantCount
int getLogicalVariantCount()
Returns the number of logical variants for games that distinguish between visual variants and logical variants.- Returns:
- the number of logical variants
-
getLogicalVariantName
java.lang.String getLogicalVariantName(int variant)
Returns the name of then
th logical variant for games that distinguish between visual variants and logical variants.- Parameters:
variant
- the logical variant number- Returns:
- a description of the logical variant
-
getLogicalVariantIcon
javax.swing.Icon getLogicalVariantIcon(int variant)
Returns an icon that can accompany the logical variant name to visually distinguish the the variant.- Parameters:
variant
- the logical variant number- Returns:
- a simple icon that helps distinguish the logical variant
-
getDefaultSymbol
java.awt.image.BufferedImage getDefaultSymbol(int variant)
Returns a variant of the default symbol. This is a sample image that can be used if the user elects not to provide one. For example, the standard expansion template uses asterisk graphics for this purpose.- Parameters:
variant
- the number of the symbol- Returns:
- a description of the symbol
-
getDesignBackdropForVariant
java.awt.Paint getDesignBackdropForVariant(int variant)
Returns a suggested paint to use as a backdrop for this variant. This can be used when selecting or editing a symbol with this variant. For example, the end user expansion dialog (Expansion|New) will use this for the drop boxes that the user drops symbol images on. If this method returnsnull
, a default paint will be used.- Parameters:
variant
- the index of the variant to obtain a backdrop for- Returns:
- a paint to use as the backdrop, or
null
to use the default
-
isCustomDrawn
boolean isCustomDrawn()
Returnstrue
if the components for this game will draw the expansion symbols themselves instead of relying on the default mechanism.- Returns:
true
if expansion symbols are drawn by the component;false
if expansion symbols are drawn by Strange Eons
-
canGenerateVariantsAutomatically
boolean canGenerateVariantsAutomatically()
Returnstrue
if this template can automatically generate a family of variants given an example image.- Returns:
true
ifgenerateVariant(java.awt.image.BufferedImage, int)
is supported
-
generateVariant
java.awt.image.BufferedImage generateVariant(java.awt.image.BufferedImage baseSymbol, int variant)
Given an example image, generates a variant automatically.- Parameters:
baseSymbol
- the example symbol to base the new design on; usually it has the same style as the symbol at position 0variant
- the number of the symbol design to generate- Returns:
- the generated symbol for position
n
- Throws:
java.lang.UnsupportedOperationException
- if this template cannot generate symbols
-
-