Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Drawing.Direct.TextBlock Class Reference

A retained-mode text drawable with wrapping, multi-line (
) support, horizontal/vertical alignment, padding, optional shadow/outline effects, and auto-shrink to fit. More...

Inheritance diagram for Gondwana.Drawing.Direct.TextBlock:
Gondwana.Drawing.Direct.DirectDrawingMovableBase Gondwana.Drawing.Direct.DirectDrawingBase Gondwana.Drawing.Direct.IDirectCompositeChild Gondwana.Drawing.Direct.IDirectDrawable Gondwana.Drawing.Direct.IDirectDrawable Gondwana.Physics.Movement.IMovable Gondwana.Drawing.IDrawable Gondwana.Drawing.IDrawable

Public Types

enum  VerticalAlign { Top , Center , Bottom }
 Vertical alignment options for multi-line text within the control's bounds. More...
enum  PulseWave { Sine , Triangle }
 Selects the waveform used by PulseColor(Color, Color, float, bool, bool). More...
enum  TextRevealMode { None , CharactersPerSecond , WordsPerSecond , ManualCount }
 Describes the mode used for revealing text over time. More...
Public Types inherited from Gondwana.Drawing.Direct.DirectDrawingBase
enum  RevealDirection { LeftToRight , RightToLeft , TopToBottom , BottomToTop }
 Defines the direction from which a reveal animation progressively displays the direct drawing. More...

Public Member Functions

 TextBlock (RenderSurfaceHostBase renderSurfaceHost, SceneLayer sceneLayer, View? view, Rectangle worldBounds, string? nickname=null)
 Creates a new TextBlock that draws in world space on the specified scene layer.
 TextBlock (RenderSurfaceHostBase renderSurfaceHost, View view, Rectangle screenBounds, string? nickname=null)
 Creates a new TextBlock that draws in screen space relative to a view.
float MeasureMaximumVerticalScrollOffsetPx ()
 Measures the maximum vertical scroll offset required to expose all currently laid-out text.
TextBlock SetPadding (float horizontal, float vertical)
 Sets symmetric horizontal and vertical padding and invalidates cached layout.
TextBlock SetSize (Size size)
 Sets the text-block size while preserving its current position and invalidates cached layout.
TextBlock SetText (string text)
 Sets the current text content and rebuilds layout as needed. If no reveal animation is active, the text is shown fully. If a reveal animation is active, the target length is synced to the new text.
TextBlock SetFont (SKTypeface typeface, float size, float? minSize=null)
 Sets the font face and size (and optional minimum size for auto-shrink).
TextBlock SetColors (SKColor fg, SKColor bg)
 Sets the foreground (text) and background colors using Skia colors.
TextBlock SetColors (Color fg, Color bg)
 Sets the foreground (text) and background colors using System.Drawing colors.
TextBlock SetAlignment (SKTextAlign h, VerticalAlign v)
 Sets the horizontal and vertical alignment used when drawing the laid-out lines within the bounds.
TextBlock UseShadow (bool enable=true)
 Enables or disables drawing a drop shadow behind the text (parameters are configured via SetShadow(float, float, byte, float)).
TextBlock SetShadow (float dx, float dy, byte alpha=128, float blurSigma=1.5f)
 Configures the drop shadow effect for text rendering.
TextBlock UseOutline (bool enable=true)
 Enables or disables a 1-pixel outline stroke around the text glyphs.
TextBlock EnableWrapping (bool enable=true)
 Enables or disables word wrapping when laying out paragraphs.
TextBlock SetMaxLines (int? maxLines)
 Sets a maximum number of lines to draw. If null, all laid-out lines are drawn.
TextBlock PulseColor (Color from, Color to, float periodSec, bool enabled=true, bool triangle=false)
 Animates the text color between from and to over periodSec seconds.
TextBlock StopColorPulse ()
 Stops text color pulsing and restores the base foreground color.
TextBlock StartTypewriter (float charsPerSecond, int? maxChars=null, bool enablePauses=true, float longPauseSec=0.25f, float shortPauseSec=0.10f)
 Begins a character-by-character reveal (typewriter effect).
TextBlock StartWordReveal (float wordsPerSecond, bool enablePauses=true, float longPauseSec=0.25f, float shortPauseSec=0.10f)
 Begins a word-by-word reveal. Words are detected by \S+\s* and include their trailing whitespace/punctuation.
TextBlock SetPunctuationPauses (bool enabled, float longPauseSec=0.25f, float shortPauseSec=0.10f)
 Configures punctuation pause behavior used by the current or next reveal animation.
TextBlock RevealSetCount (int charCount)
 Sets the currently revealed character count directly (manual mode).
TextBlock RevealStop ()
 Stops any active reveal animation and shows the full text immediately.
override void Update (long tick)
 Advances internal animations (pulse, typewriter/word reveal) based on the current tick, and then allows the base class to progress fade and bookkeeping. Called once per frame.
Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingMovableBase
Vector2 GetPosition ()
 Gets the current position of this direct drawing in pixel coordinates.
void SetPosition (Vector2 p)
 Sets the position of this direct drawing to the specified pixel coordinates.
Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase
RectangleF GetDrawLocationScreen (View view)
 Gets the screen-space drawing location for this direct drawing as seen from the specified view.
void Draw (BackbufferBase backbuffer, RectangleF destRectScreen)
 Renders this direct drawing to the backbuffer at the specified screen location.
DirectDrawingBase SetOpacity (float opacity)
 Instantly sets the opacity to the specified value without animation.
DirectDrawingBase FadeTo (float targetOpacity, float durationSec)
 Initiates a smooth fade transition to the specified target opacity over the given duration.
DirectDrawingBase FadeIn (float durationSec)
 Fades this direct drawing from its current opacity to fully opaque over the specified duration.
DirectDrawingBase FadeOut (float durationSec)
 Fades this direct drawing from its current opacity to fully transparent over the specified duration.
DirectDrawingBase CancelFade ()
 Cancels any active fade transition, leaving the opacity at its current value.
DirectDrawingBase SetReveal (float t01)
 Instantly sets the reveal progress to the specified value without animation.
DirectDrawingBase SetRevealDirection (RevealDirection dir)
 Sets the direction from which the reveal animation progresses.
DirectDrawingBase RevealTo (float t01, float durationSec, Func< float, float >? easing=null)
 Initiates a smooth reveal animation to the specified target progress over the given duration, optionally using a custom easing function.
DirectDrawingBase CancelReveal ()
 Stops an active reveal animation at its current progress.
int CompareTo (DirectDrawingBase? other)
 Compares this direct drawing to another for sorting by ZOrder.
void Dispose ()
 Releases all resources used by this DirectDrawingBase instance.
override bool Equals (object? obj)
 Determines whether the specified object is equal to the current direct drawing.
override int GetHashCode ()
 Returns a hash code for this direct drawing.

Protected Member Functions

override void OnDraw (BackbufferBase backbuffer, RectangleF destRectScreen)
 Draws the laid-out text block contents into the destination rectangle.
override void Dispose (bool disposing)
 Releases managed resources used by the text block.
Protected Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingMovableBase
 DirectDrawingMovableBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, SceneLayer? sceneLayer, View? view, Rectangle? screenBounds, Rectangle? worldBounds, string? name=null)
 Initializes a new instance of the DirectDrawingMovableBase class with integrated movement capabilities.
Protected Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase
void OnDraw (BackbufferBase backbuffer, RectangleF destRectScreen)
 Performs the concrete drawing for this direct drawing to the backbuffer.
 DirectDrawingBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, SceneLayer? sceneLayer, View? view, Rectangle? screenBounds, Rectangle? worldBounds, string? nickname=null)
 Initializes a new instance of the DirectDrawingBase class.

Properties

float LineSpacingMultiplier = 1.0f [get, set]
 Gets or sets a scale factor applied to the computed line height (1.0 = natural spacing).
float HorizontalPadding = 0f [get, set]
 Gets or sets the horizontal padding (in pixels) on both left and right sides of the text.
float VerticalPadding = 0f [get, set]
 Gets or sets the vertical padding (in pixels) on both top and bottom sides of the text.
float VerticalScrollOffsetPx [get, set]
 Gets or sets the vertical text-content scroll offset in native pixels.
float VerticalScrollEndPaddingPx [get, set]
 Gets or sets extra scrollable space after the final laid-out line.
string Text [get]
 Gets the current raw text content.
List< string > Lines [get]
 Gets the laid-out lines (after wrapping and paragraph processing).
float LineHeight [get]
 Gets the measured line height (in pixels) used for drawing.
SKColor ForeColor [get]
 Gets the configured foreground (text) color.
SKColor BackColor [get]
 Gets the configured background color.
float FontSize [get]
 Gets the requested font size (before any auto-shrink adjustments).
float? MinFontSize [get]
 Gets the optional minimum font size used by auto-shrink (or null if disabled).
SKTypeface? TypeFace [get]
 Gets the configured typeface (or null to use SKTypeface.Default).
bool OutlineEnabled [get]
 Gets a value indicating whether an outline stroke is enabled.
bool WrapText [get]
 Gets a value indicating whether word wrapping is enabled.
int? MaxLines [get]
 Gets the optional maximum number of lines to draw (or null for no limit).
bool ShadowEnabled [get]
 Gets a value indicating whether a drop shadow is enabled.
float ShadowDx [get]
 Gets the horizontal shadow offset (in pixels).
float ShadowDy [get]
 Gets the vertical shadow offset (in pixels).
byte ShadowAlpha [get]
 Gets the shadow opacity (0-255).
float ShadowBlurSigma [get]
 Gets the blur radius for the shadow (sigma, in pixels).
SKTextAlign AlignHoriz [get]
 Gets the horizontal alignment used when drawing lines.
VerticalAlign AlignVert [get]
 Gets the vertical alignment used when drawing lines.
bool PulseTextEnabled [get]
 Gets a value indicating whether color pulsing is enabled.
SKColor PulseFrom [get]
 Gets the starting color for the pulse effect.
SKColor PulseTo [get]
 Gets the ending color for the pulse effect.
float PulsePeriodSec [get]
 Gets the pulse period in seconds.
PulseWave PulseWaveValue [get]
 Gets the pulse waveform currently in use.
TextRevealMode TextRevealModeValue [get]
 Gets the active text reveal mode.
float TextRevealRate [get]
 Gets the configured reveal rate (characters/sec or words/sec depending on mode).
bool PuctuationPauseEnabled [get]
 Gets a value indicating whether punctuation pauses are enabled.
float PunctuationPauseLongSec [get]
 Gets the long punctuation pause duration (seconds) used for '.', '!', '?'.
float PunctuationPauseShortSec [get]
 Gets the short punctuation pause duration (seconds) used for ',', ';', ':'.
SKColor ResolvedForeColor [get]
 Gets the currently resolved (effective) foreground color used for drawing.
Properties inherited from Gondwana.Drawing.Direct.DirectDrawingMovableBase
MovementController Movement [get]
 Gets the movement controller responsible for changing this direct drawing's position over time.
MovementSpace PositionSpace [get]
 Gets the coordinate space in which this movable object's position is expressed.
Properties inherited from Gondwana.Drawing.Direct.DirectDrawingBase
bool HideWhenFullyTransparent = true [get, set]
 Gets or sets a value indicating whether this direct drawing should be automatically hidden when its opacity reaches zero during fade transitions.
RenderSurfaceHostBase RenderSurfaceHost [get]
 Gets the render surface host that manages this direct drawing's rendering pipeline.
DirectDrawingMode Mode [get]
 Gets the drawing mode that determines how this direct drawing is positioned and transformed.
SceneLayer? SceneLayer [get]
 Gets the scene layer to which this direct drawing is attached, or null if the drawing is in view mode.
View? View [get]
 Gets the view to which this direct drawing is attached, or null if the drawing is in scene-layer mode.
Rectangle ScreenBounds [get, set]
 Gets or sets the screen-space bounds of this direct drawing in pixels.
Rectangle WorldBounds [get, set]
 Gets or sets the world-space bounds of this direct drawing in pixels.
TypedValueBag ValueBag = new() [get]
 Gets the extensible value bag for storing arbitrary key-value data associated with this direct drawing.
Guid Id = Guid.NewGuid() [get]
 Gets the unique identifier for this direct drawing.
string? Nickname [get]
 Gets the optional human-readable name for this direct drawing.
int ZOrder [get, set]
 Gets or sets the Z-order (depth) used for sorting this direct drawing relative to other drawables.
bool Visible [get, set]
 Gets or sets a value indicating whether this direct drawing is visible and should be rendered.
float Opacity [get, set]
 Gets or sets the current opacity of this direct drawing.
Properties inherited from Gondwana.Drawing.Direct.IDirectCompositeChild
SceneLayer? SceneLayer [get]
 Gets the scene layer used by a scene-layer child, or null for a view child.
View? View [get]
 Gets the view used by a view child, or null for a scene-layer child.

Events

Action< string >? TextRevealed
 Raised whenever the revealed text portion advances. The argument is the cumulative text currently revealed (substring from start to visible character count).
Action< string >? TextRevealComplete
 Raised once when the reveal completes. Argument is the full text content. Note: when the final chunk is revealed this class will raise TextRevealed first, then TextRevealComplete.
Events inherited from Gondwana.Drawing.Direct.DirectDrawingBase
EventHandler< IDirectDrawable >? Disposing
 Occurs when this direct drawing is being disposed.
EventHandler< DirectDrawingBase >? FadeToCompleted
 Occurs when a fade transition initiated by FadeTo, FadeIn, or FadeOut completes.
Events inherited from Gondwana.Drawing.Direct.IDirectDrawable
EventHandler< IDirectDrawable >? Disposing
 Occurs when the object is being disposed.

Additional Inherited Members

Static Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase
static bool operator== (DirectDrawingBase? left, DirectDrawingBase? right)
 Determines whether two direct drawing instances are equal using reference equality.
static bool operator!= (DirectDrawingBase? left, DirectDrawingBase? right)
 Determines whether two direct drawing instances are not equal using reference equality.
static bool operator< (DirectDrawingBase? left, DirectDrawingBase? right)
 Determines whether the Z-order of the left direct drawing is less than the right.
static bool operator<= (DirectDrawingBase? left, DirectDrawingBase? right)
 Determines whether the Z-order of the left direct drawing is less than or equal to the right.
static bool operator> (DirectDrawingBase? left, DirectDrawingBase? right)
 Determines whether the Z-order of the left direct drawing is greater than the right.
static bool operator>= (DirectDrawingBase? left, DirectDrawingBase? right)
 Determines whether the Z-order of the left direct drawing is greater than or equal to the right.
Protected Attributes inherited from Gondwana.Drawing.Direct.DirectDrawingBase
readonly RenderSurfaceHostBase _renderSurfaceHost
 The render surface host that manages this direct drawing's rendering pipeline.
Rectangle _screenBounds
 The current screen-space bounds for view-mode direct drawings, in pixels.
Rectangle _worldBounds
 The current world-space bounds for scene-layer-mode direct drawings, in pixels.
int _zOrder
 The Z-order used for draw sorting. Higher values draw later (on top).
bool _visible
 Indicates whether this direct drawing is currently visible and should be rendered.
long _lastTick = HighResTimer.GetCurrentTick()
 The last engine tick value used for delta-time calculations in Update.

Detailed Description

A retained-mode text drawable with wrapping, multi-line (
) support, horizontal/vertical alignment, padding, optional shadow/outline effects, and auto-shrink to fit.

TextBlock caches a line layout derived from the current text, font, bounds, and wrapping settings, and only rebuilds when any of those change. Newlines (
) are respected as hard breaks; long lines wrap to the available width when wrapping is enabled.

Horizontal alignment (left/center/right) and vertical alignment (top/center/bottom) are applied per frame. Optional background fill, shadow, and outline can be enabled for readability. When a minimum font size is specified, the control will step down from the requested size until the text fits within the height or the minimum is reached.

// Centered, wrapped headline with shadow and outline var headline = new TextBlock(surface, new Rectangle(0, 0, 640, 140)) .SetText("Gondwana welcomes you\n- render boldly.") .SetFont(SKTypeface.Default, 28f, minSize: 16f) .SetColors(SKColors.White, SKColors.Transparent) .SetAlignment(SKTextAlign.Center, TextBlock.VerticalAlign.Center) .EnableWrapping(true) .SetMaxLines(3) .UseShadow(true) .UseOutline(true);

Definition at line 43 of file TextBlock.cs.

Member Enumeration Documentation

◆ PulseWave

Selects the waveform used by PulseColor(Color, Color, float, bool, bool).

Enumerator
Sine 

Sine wave: smooth continuous pulse between colors.

Triangle 

Triangle wave: linear fade-in/out between colors.

Definition at line 1244 of file TextBlock.cs.

◆ TextRevealMode

Describes the mode used for revealing text over time.

Enumerator
None 

No reveal is active; all text is shown.

CharactersPerSecond 

Reveal advances by characters per second.

WordsPerSecond 

Reveal advances by words per second.

ManualCount 

Reveal amount is controlled directly via RevealSetCount(int).

Definition at line 1255 of file TextBlock.cs.

◆ VerticalAlign

Vertical alignment options for multi-line text within the control's bounds.

Enumerator
Top 

Align text to the top of the inner content area.

Center 

Center text vertically within the inner content area.

Bottom 

Align text to the bottom of the inner content area.

Definition at line 48 of file TextBlock.cs.

Constructor & Destructor Documentation

◆ TextBlock() [1/2]

Gondwana.Drawing.Direct.TextBlock.TextBlock ( RenderSurfaceHostBase renderSurfaceHost,
SceneLayer sceneLayer,
View? view,
Rectangle worldBounds,
string? nickname = null )

Creates a new TextBlock that draws in world space on the specified scene layer.

Parameters
renderSurfaceHostThe render surface host that owns this direct drawing.
sceneLayerThe scene layer used for world-space positioning and refresh.
viewThe optional view associated with the text block.
worldBoundsThe text block bounds in world coordinates.
nicknameAn optional nickname used to identify the text block.

Definition at line 161 of file TextBlock.cs.

◆ TextBlock() [2/2]

Gondwana.Drawing.Direct.TextBlock.TextBlock ( RenderSurfaceHostBase renderSurfaceHost,
View view,
Rectangle screenBounds,
string? nickname = null )

Creates a new TextBlock that draws in screen space relative to a view.

Parameters
renderSurfaceHostThe render surface host that owns this direct drawing.
viewThe view the text block is associated with.
screenBoundsThe text block bounds in screen coordinates.
nicknameAn optional nickname used to identify the text block.

Definition at line 182 of file TextBlock.cs.

Member Function Documentation

◆ Dispose()

override void Gondwana.Drawing.Direct.TextBlock.Dispose ( bool disposing)
protectedvirtual

Releases managed resources used by the text block.

Parameters
disposingtrue when disposing managed resources; otherwise, false.

Reimplemented from Gondwana.Drawing.Direct.DirectDrawingBase.

Definition at line 1273 of file TextBlock.cs.

◆ EnableWrapping()

TextBlock Gondwana.Drawing.Direct.TextBlock.EnableWrapping ( bool enable = true)

Enables or disables word wrapping when laying out paragraphs.

Parameters
enableTrue to wrap text to the available width; false to keep each paragraph on one line.
Returns
The current TextBlock for chaining.

Definition at line 503 of file TextBlock.cs.

◆ MeasureMaximumVerticalScrollOffsetPx()

float Gondwana.Drawing.Direct.TextBlock.MeasureMaximumVerticalScrollOffsetPx ( )

Measures the maximum vertical scroll offset required to expose all currently laid-out text.

Returns
The maximum scroll offset in the text block's native coordinate units, or zero when the laid-out text fits within the available content height.

Definition at line 263 of file TextBlock.cs.

◆ OnDraw()

override void Gondwana.Drawing.Direct.TextBlock.OnDraw ( BackbufferBase backbuffer,
RectangleF destRectScreen )
protected

Draws the laid-out text block contents into the destination rectangle.

Parameters
backbufferThe backbuffer that provides the target drawing surface.
destRectScreenThe destination rectangle in screen space.

Definition at line 826 of file TextBlock.cs.

◆ PulseColor()

TextBlock Gondwana.Drawing.Direct.TextBlock.PulseColor ( Color from,
Color to,
float periodSec,
bool enabled = true,
bool triangle = false )

Animates the text color between from and to over periodSec seconds.

Parameters
fromStarting text color.
toEnding text color.
periodSecTime in seconds for one full pulse cycle.
enabledTrue to enable pulsing; false to disable.
triangleTrue to use a triangle waveform; otherwise a sine wave is used.
Returns
The current TextBlock for chaining.

Definition at line 532 of file TextBlock.cs.

◆ RevealSetCount()

TextBlock Gondwana.Drawing.Direct.TextBlock.RevealSetCount ( int charCount)

Sets the currently revealed character count directly (manual mode).

Parameters
charCountThe number of characters (from the start of the text) to show.
Returns
The current TextBlock for chaining.

Definition at line 647 of file TextBlock.cs.

◆ RevealStop()

TextBlock Gondwana.Drawing.Direct.TextBlock.RevealStop ( )

Stops any active reveal animation and shows the full text immediately.

Returns
The current TextBlock for chaining.

Definition at line 660 of file TextBlock.cs.

◆ SetAlignment()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetAlignment ( SKTextAlign h,
VerticalAlign v )

Sets the horizontal and vertical alignment used when drawing the laid-out lines within the bounds.

Parameters
hHorizontal alignment (Left, Center, Right).
vVertical alignment (Top, Center, Bottom).
Returns
The current TextBlock for chaining.

Definition at line 433 of file TextBlock.cs.

◆ SetColors() [1/2]

TextBlock Gondwana.Drawing.Direct.TextBlock.SetColors ( Color fg,
Color bg )

Sets the foreground (text) and background colors using System.Drawing colors.

Parameters
fgText color.
bgBackground color (drawn as a solid rect if alpha > 0).
Returns
The current TextBlock for chaining.

◆ SetColors() [2/2]

TextBlock Gondwana.Drawing.Direct.TextBlock.SetColors ( SKColor fg,
SKColor bg )

Sets the foreground (text) and background colors using Skia colors.

Parameters
fgText color.
bgBackground color (drawn as a solid rect if alpha > 0).
Returns
The current TextBlock for chaining.

Definition at line 410 of file TextBlock.cs.

◆ SetFont()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetFont ( SKTypeface typeface,
float size,
float? minSize = null )

Sets the font face and size (and optional minimum size for auto-shrink).

Parameters
typefaceTypeface to use; defaults to SKTypeface.Default if null.
sizeRequested font size in pixels.
minSizeOptional minimum size for auto-shrink; if set, layout will step down to fit height.
Returns
The current TextBlock for chaining.

Definition at line 394 of file TextBlock.cs.

◆ SetMaxLines()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetMaxLines ( int? maxLines)

Sets a maximum number of lines to draw. If null, all laid-out lines are drawn.

Parameters
maxLinesMaximum visible lines, or null for no limit.
Returns
The current TextBlock for chaining.

Definition at line 516 of file TextBlock.cs.

◆ SetPadding()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetPadding ( float horizontal,
float vertical )

Sets symmetric horizontal and vertical padding and invalidates cached layout.

Parameters
horizontalHorizontal padding in pixels for both left and right sides.
verticalVertical padding in pixels for both top and bottom sides.
Returns
The current TextBlock for chaining.

Definition at line 317 of file TextBlock.cs.

◆ SetPunctuationPauses()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetPunctuationPauses ( bool enabled,
float longPauseSec = 0::25f,
float shortPauseSec = 0::10f )

Configures punctuation pause behavior used by the current or next reveal animation.

Parameters
enabledTrue to enable punctuation pauses; false to disable.
longPauseSecPause after '.', '!', or '?' (seconds).
shortPauseSecPause after ',', ';', or ':' (seconds).
Returns
The current TextBlock for chaining.

Definition at line 634 of file TextBlock.cs.

◆ SetShadow()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetShadow ( float dx,
float dy,
byte alpha = 128,
float blurSigma = 1::5f )

Configures the drop shadow effect for text rendering.

Parameters
dxHorizontal offset in pixels for the shadow. Positive values move the shadow right, negative left.
dyVertical offset in pixels for the shadow. Positive values move the shadow down, negative up.
alphaOpacity of the shadow (0-255). Higher values make the shadow darker and more opaque.
blurSigmaBlur radius in pixels for the shadow's softness. Set to 0 for a hard shadow. Typical range: 1.0-3.0.

Call this after UseShadow(bool) to fine-tune the offset, opacity, and blur strength of the text shadow. This method sets the internal paint values and marks the text block as dirty so it will be redrawn on the next render pass.

Returns
The current TextBlock instance for method chaining.

Definition at line 476 of file TextBlock.cs.

◆ SetSize()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetSize ( Size size)

Sets the text-block size while preserving its current position and invalidates cached layout.

Parameters
sizeThe new text-block size.
Returns
The current TextBlock for chaining.

Definition at line 336 of file TextBlock.cs.

◆ SetText()

TextBlock Gondwana.Drawing.Direct.TextBlock.SetText ( string text)

Sets the current text content and rebuilds layout as needed. If no reveal animation is active, the text is shown fully. If a reveal animation is active, the target length is synced to the new text.

Parameters
textThe new text to display (null is treated as an empty string).
Returns
The current TextBlock for chaining.

Definition at line 358 of file TextBlock.cs.

◆ StartTypewriter()

TextBlock Gondwana.Drawing.Direct.TextBlock.StartTypewriter ( float charsPerSecond,
int? maxChars = null,
bool enablePauses = true,
float longPauseSec = 0::25f,
float shortPauseSec = 0::10f )

Begins a character-by-character reveal (typewriter effect).

Parameters
charsPerSecondCharacters per second to reveal.
maxCharsOptional cap on total characters to reveal; defaults to the full text length.
enablePausesTrue to add punctuation pauses during reveal; false for uniform pacing.
longPauseSecPause added after '.', '!', or '?' characters (seconds).
shortPauseSecPause added after ',', ';', or ':' characters (seconds).
Returns
The current TextBlock for chaining.

Definition at line 567 of file TextBlock.cs.

◆ StartWordReveal()

TextBlock Gondwana.Drawing.Direct.TextBlock.StartWordReveal ( float wordsPerSecond,
bool enablePauses = true,
float longPauseSec = 0::25f,
float shortPauseSec = 0::10f )

Begins a word-by-word reveal. Words are detected by \S+\s* and include their trailing whitespace/punctuation.

Parameters
wordsPerSecondWords per second to reveal.
enablePausesTrue to add punctuation pauses during reveal; false for uniform pacing.
longPauseSecPause added after '.', '!', or '?' characters (seconds).
shortPauseSecPause added after ',', ';', or ':' characters (seconds).
Returns
The current TextBlock for chaining.

Definition at line 599 of file TextBlock.cs.

◆ StopColorPulse()

TextBlock Gondwana.Drawing.Direct.TextBlock.StopColorPulse ( )

Stops text color pulsing and restores the base foreground color.

Returns
The current TextBlock for chaining.

Definition at line 550 of file TextBlock.cs.

◆ Update()

override void Gondwana.Drawing.Direct.TextBlock.Update ( long tick)
virtual

Advances internal animations (pulse, typewriter/word reveal) based on the current tick, and then allows the base class to progress fade and bookkeeping. Called once per frame.

Parameters
tickHigh-resolution tick value for this frame.

Reimplemented from Gondwana.Drawing.Direct.DirectDrawingMovableBase.

Definition at line 690 of file TextBlock.cs.

◆ UseOutline()

TextBlock Gondwana.Drawing.Direct.TextBlock.UseOutline ( bool enable = true)

Enables or disables a 1-pixel outline stroke around the text glyphs.

Parameters
enableTrue to enable an outline; false to disable.
Returns
The current TextBlock for chaining.

Definition at line 491 of file TextBlock.cs.

◆ UseShadow()

TextBlock Gondwana.Drawing.Direct.TextBlock.UseShadow ( bool enable = true)

Enables or disables drawing a drop shadow behind the text (parameters are configured via SetShadow(float, float, byte, float)).

Parameters
enableTrue to enable the shadow; false to disable.
Returns
The current TextBlock for chaining.

Definition at line 446 of file TextBlock.cs.

Property Documentation

◆ AlignHoriz

SKTextAlign Gondwana.Drawing.Direct.TextBlock.AlignHoriz
get

Gets the horizontal alignment used when drawing lines.

Definition at line 1201 of file TextBlock.cs.

◆ AlignVert

VerticalAlign Gondwana.Drawing.Direct.TextBlock.AlignVert
get

Gets the vertical alignment used when drawing lines.

Definition at line 1204 of file TextBlock.cs.

◆ BackColor

SKColor Gondwana.Drawing.Direct.TextBlock.BackColor
get

Gets the configured background color.

Definition at line 1165 of file TextBlock.cs.

◆ FontSize

float Gondwana.Drawing.Direct.TextBlock.FontSize
get

Gets the requested font size (before any auto-shrink adjustments).

Definition at line 1168 of file TextBlock.cs.

◆ ForeColor

SKColor Gondwana.Drawing.Direct.TextBlock.ForeColor
get

Gets the configured foreground (text) color.

Definition at line 1162 of file TextBlock.cs.

◆ HorizontalPadding

float Gondwana.Drawing.Direct.TextBlock.HorizontalPadding = 0f
getset

Gets or sets the horizontal padding (in pixels) on both left and right sides of the text.

Definition at line 203 of file TextBlock.cs.

◆ LineHeight

float Gondwana.Drawing.Direct.TextBlock.LineHeight
get

Gets the measured line height (in pixels) used for drawing.

Definition at line 1159 of file TextBlock.cs.

◆ Lines

List<string> Gondwana.Drawing.Direct.TextBlock.Lines
get

Gets the laid-out lines (after wrapping and paragraph processing).

Definition at line 1156 of file TextBlock.cs.

◆ LineSpacingMultiplier

float Gondwana.Drawing.Direct.TextBlock.LineSpacingMultiplier = 1.0f
getset

Gets or sets a scale factor applied to the computed line height (1.0 = natural spacing).

Definition at line 198 of file TextBlock.cs.

◆ MaxLines

int? Gondwana.Drawing.Direct.TextBlock.MaxLines
get

Gets the optional maximum number of lines to draw (or null for no limit).

Definition at line 1183 of file TextBlock.cs.

◆ MinFontSize

float? Gondwana.Drawing.Direct.TextBlock.MinFontSize
get

Gets the optional minimum font size used by auto-shrink (or null if disabled).

Definition at line 1171 of file TextBlock.cs.

◆ OutlineEnabled

bool Gondwana.Drawing.Direct.TextBlock.OutlineEnabled
get

Gets a value indicating whether an outline stroke is enabled.

Definition at line 1177 of file TextBlock.cs.

◆ PuctuationPauseEnabled

bool Gondwana.Drawing.Direct.TextBlock.PuctuationPauseEnabled
get

Gets a value indicating whether punctuation pauses are enabled.

Definition at line 1228 of file TextBlock.cs.

◆ PulseFrom

SKColor Gondwana.Drawing.Direct.TextBlock.PulseFrom
get

Gets the starting color for the pulse effect.

Definition at line 1210 of file TextBlock.cs.

◆ PulsePeriodSec

float Gondwana.Drawing.Direct.TextBlock.PulsePeriodSec
get

Gets the pulse period in seconds.

Definition at line 1216 of file TextBlock.cs.

◆ PulseTextEnabled

bool Gondwana.Drawing.Direct.TextBlock.PulseTextEnabled
get

Gets a value indicating whether color pulsing is enabled.

Definition at line 1207 of file TextBlock.cs.

◆ PulseTo

SKColor Gondwana.Drawing.Direct.TextBlock.PulseTo
get

Gets the ending color for the pulse effect.

Definition at line 1213 of file TextBlock.cs.

◆ PulseWaveValue

PulseWave Gondwana.Drawing.Direct.TextBlock.PulseWaveValue
get

Gets the pulse waveform currently in use.

Definition at line 1219 of file TextBlock.cs.

◆ PunctuationPauseLongSec

float Gondwana.Drawing.Direct.TextBlock.PunctuationPauseLongSec
get

Gets the long punctuation pause duration (seconds) used for '.', '!', '?'.

Definition at line 1231 of file TextBlock.cs.

◆ PunctuationPauseShortSec

float Gondwana.Drawing.Direct.TextBlock.PunctuationPauseShortSec
get

Gets the short punctuation pause duration (seconds) used for ',', ';', ':'.

Definition at line 1234 of file TextBlock.cs.

◆ ResolvedForeColor

SKColor Gondwana.Drawing.Direct.TextBlock.ResolvedForeColor
get

Gets the currently resolved (effective) foreground color used for drawing.

Definition at line 1237 of file TextBlock.cs.

◆ ShadowAlpha

byte Gondwana.Drawing.Direct.TextBlock.ShadowAlpha
get

Gets the shadow opacity (0-255).

Definition at line 1195 of file TextBlock.cs.

◆ ShadowBlurSigma

float Gondwana.Drawing.Direct.TextBlock.ShadowBlurSigma
get

Gets the blur radius for the shadow (sigma, in pixels).

Definition at line 1198 of file TextBlock.cs.

◆ ShadowDx

float Gondwana.Drawing.Direct.TextBlock.ShadowDx
get

Gets the horizontal shadow offset (in pixels).

Definition at line 1189 of file TextBlock.cs.

◆ ShadowDy

float Gondwana.Drawing.Direct.TextBlock.ShadowDy
get

Gets the vertical shadow offset (in pixels).

Definition at line 1192 of file TextBlock.cs.

◆ ShadowEnabled

bool Gondwana.Drawing.Direct.TextBlock.ShadowEnabled
get

Gets a value indicating whether a drop shadow is enabled.

Definition at line 1186 of file TextBlock.cs.

◆ Text

string Gondwana.Drawing.Direct.TextBlock.Text
get

Gets the current raw text content.

Definition at line 1153 of file TextBlock.cs.

◆ TextRevealModeValue

TextRevealMode Gondwana.Drawing.Direct.TextBlock.TextRevealModeValue
get

Gets the active text reveal mode.

Definition at line 1222 of file TextBlock.cs.

◆ TextRevealRate

float Gondwana.Drawing.Direct.TextBlock.TextRevealRate
get

Gets the configured reveal rate (characters/sec or words/sec depending on mode).

Definition at line 1225 of file TextBlock.cs.

◆ TypeFace

SKTypeface? Gondwana.Drawing.Direct.TextBlock.TypeFace
get

Gets the configured typeface (or null to use SKTypeface.Default).

Definition at line 1174 of file TextBlock.cs.

◆ VerticalPadding

float Gondwana.Drawing.Direct.TextBlock.VerticalPadding = 0f
getset

Gets or sets the vertical padding (in pixels) on both top and bottom sides of the text.

Definition at line 208 of file TextBlock.cs.

◆ VerticalScrollEndPaddingPx

float Gondwana.Drawing.Direct.TextBlock.VerticalScrollEndPaddingPx
getsetadd

Gets or sets extra scrollable space after the final laid-out line.

Applied only when the text already exceeds the available height. This lets dense diagnostics and log views move the final glyph descent clear of the clip edge.

Definition at line 240 of file TextBlock.cs.

◆ VerticalScrollOffsetPx

float Gondwana.Drawing.Direct.TextBlock.VerticalScrollOffsetPx
getset

Gets or sets the vertical text-content scroll offset in native pixels.

The offset is applied after text layout and is clipped to this text block's bounds. Use MeasureMaximumVerticalScrollOffsetPx to determine the valid upper bound.

Definition at line 217 of file TextBlock.cs.

◆ WrapText

bool Gondwana.Drawing.Direct.TextBlock.WrapText
get

Gets a value indicating whether word wrapping is enabled.

Definition at line 1180 of file TextBlock.cs.

Event Documentation

◆ TextRevealComplete

Action<string>? Gondwana.Drawing.Direct.TextBlock.TextRevealComplete

Raised once when the reveal completes. Argument is the full text content. Note: when the final chunk is revealed this class will raise TextRevealed first, then TextRevealComplete.

Definition at line 71 of file TextBlock.cs.

◆ TextRevealed

Action<string>? Gondwana.Drawing.Direct.TextBlock.TextRevealed

Raised whenever the revealed text portion advances. The argument is the cumulative text currently revealed (substring from start to visible character count).

Definition at line 64 of file TextBlock.cs.