org.cosplay.CPStyledString
See theCPStyledString companion object
Builder for a styled string rendered using system font.
This utility class provides a builder pattern to built styled (colored) strings that are rendered using a system font . Once styled string is built it can be rendered via CPCanvas.drawStyledString method.
Here's an example of using styled string together with array image to quickly create an image with a styled textual content:
import CPStyledString.styleStr
val lblImg = new CPArrayImage(
styleStr("[SPACE]", C_WHITE) ++ styleStr("Play|Pause ", C_GREEN) ++
styleStr("[R]", C_WHITE) ++ styleStr("Rewind ", C_GREEN) ++
styleStr("[Q]", C_WHITE) ++ styleStr("Quit ", C_GREEN) ++
styleStr("[CTRL-L]", C_WHITE) ++ styleStr("Log ", C_GREEN) ++
styleStr("[CTRL-Q]", C_WHITE) ++ styleStr("FPS Overlay", C_GREEN)
).trimBg()
Attributes
See also
Example
See CPFontsExample source code for an example of font functionality.
Companion
object
Source
CPStyledString.scala
Graph
Reset zoom Hide graph Show graph
Supertypes
class Object
trait Matchable
class Any
Members list
Value parameters
bgColor
Background color.
fgColor
Foreground color.
s
String.
Attributes
Source
CPStyledString.scala
Creates styled string with no background.
Creates styled string with no background.
Value parameters
fgColor
Foreground color.
s
String.
Attributes
Source
CPStyledString.scala
Sets current background color.
Sets current background color.
Value parameters
bg
Background color to set. Use None
to remove background color.
Attributes
Source
CPStyledString.scala
Sets current background color.
Sets current background color.
Value parameters
bg
Background color to set.
Attributes
Source
CPStyledString.scala
Finalizes this styled string and renders it into sequence of pixels .
Clears this styled string.
Sets current foreground color.
Sets current foreground color.
Value parameters
fg
Foreground color to set.
Attributes
Source
CPStyledString.scala
Sets current foreground and background colors.
Sets current foreground and background colors.
Value parameters
bg
Background color to set. Use None
to remove background color.
fg
Foreground color to set.
Attributes
Source
CPStyledString.scala
Sets current foreground and background colors.
Sets current foreground and background colors.
Value parameters
bg
Background color to set.
fg
Foreground color to set.
Attributes
Source
CPStyledString.scala
Adds given object string representation to this style string using current foreground and background colors.
Adds given object string representation to this style string using current foreground and background colors.
Value parameters
obj
Object to add.
Attributes
Source
CPStyledString.scala