Struct MFPTextLogo
- Assembly
- VisioForge.Core.dll
Text logo.
public struct MFPTextLogoInherited Members
Examples
// Example 1: Simple watermark in bottom-right corner
var watermark = new MFPTextLogo
{
Text = "© 2024 MyCompany",
FontName = "Arial",
FontSize = 24,
FontColor = 0xFFFFFF, // White
TransparentBg = true,
X = 1920 - 300, // Right-aligned
Y = 1080 - 50, // Bottom-aligned
Transp = 128 // 50% transparency
};
// Example 2: Title with gradient background
var title = new MFPTextLogo
{
Text = "Breaking News",
FontName = "Impact",
FontSize = 48,
FontBold = true,
X = 50,
Y = 50,
TransparentBg = false,
Gradient = true,
GradientMode = 1, // Horizontal gradient
GradientColor1 = 0xFF0000, // Red
GradientColor2 = 0xFFFF00, // Yellow
RectWidth = 400,
RectHeight = 80
};
// Example 3: Timestamp with background shape
var timestamp = new MFPTextLogo
{
DateMode = true,
DateMask = "yyyy-MM-dd HH:mm:ss",
FontName = "Consolas",
FontSize = 18,
FontColor = 0xFFFFFF,
BGShape = true,
BGShapeType = 1, // Rounded rectangle
BGShapeColor = 0x000000, // Black background
BGShapeX = 10,
BGShapeY = 10,
BGShapeWidth = 250,
BGShapeHeight = 40,
X = 20,
Y = 20
};
Remarks
The MFPTextLogo structure provides comprehensive parameters for rendering text overlays on video frames. This can be used for adding titles, subtitles, watermarks, timestamps, or any other text-based information to video content. The structure supports advanced text formatting, positioning, and visual effects.
Key features include: - Full font customization (size, style, color) - Transparent or colored backgrounds - Gradient fills for professional appearance - Border effects for better readability - Rotation and flipping capabilities - Background shapes for emphasis - Date/time stamping with custom formats
The text can be positioned anywhere on the frame and includes support for right-to-left languages and vertical text orientation for Asian languages.
Fields
Align
Align.
public int AlignField Value
Remarks
Text alignment within the bounding rectangle. Values typically:
- 0: Left aligned (default)
- 1: Center aligned
- 2: Right aligned
- 3: Justified (full width)
Antialiasing
Antialiasing.
public int AntialiasingField Value
Remarks
Controls text edge smoothing. Values:
- 0: No antialiasing (sharp but may appear jagged)
- 1: Standard antialiasing (good balance)
- 2: ClearType/SubPixel antialiasing (best for LCD displays) Antialiasing improves text appearance, especially at smaller sizes.
BGColor
Background color.
public int BGColorField Value
Remarks
The color of the text background in RGB format (0xRRGGBB). Only used when TransparentBg is false. Common combinations:
- Black background (0x000000) with white text for maximum contrast
- White background (0xFFFFFF) with black text for clean appearance
- Semi-transparent dark backgrounds for subtitle-style overlays
BGShape
Use background shape.
public bool BGShapeField Value
Remarks
When true, renders a geometric shape behind the text for emphasis. Useful for creating professional lower-thirds, title cards, or improving text readability against varying backgrounds.
BGShapeColor
Background shape color.
public int BGShapeColorField Value
Remarks
Fill color of the background shape in RGB format (0xRRGGBB). Common choices:
- 0x000000: Black (with white text)
- 0xFFFFFF: White (with black text)
- Brand colors for consistent visual identity Consider using semi-transparency with the Transp property.
BGShapeHeight
Background shape height.
public int BGShapeHeightField Value
Remarks
Height of the background shape in pixels. Should be taller than text height to provide adequate padding. For dynamic text, calculate as text_height + (padding * 2).
BGShapeType
Background shape type.
public int BGShapeTypeField Value
Remarks
Specifies the geometric shape to render:
- 0: Rectangle
- 1: Rounded rectangle
- 2: Ellipse/Circle
- 3: Diamond
- 4: Triangle
BGShapeWidth
Background shape width.
public int BGShapeWidthField Value
Remarks
Width of the background shape in pixels. Should be wider than text width to provide adequate padding. For dynamic text, calculate as text_width + (padding * 2).
BGShapeX
Background shape X.
public int BGShapeXField Value
Remarks
Horizontal position of the background shape in pixels. Can be offset from text X position to create padding or special effects.
BGShapeY
Background shape Y.
public int BGShapeYField Value
Remarks
Vertical position of the background shape in pixels. Typically set slightly above text Y position to center text within shape.
BorderMode
Border mode.
public int BorderModeField Value
Remarks
Controls the border/outline rendering around text:
- 0: No border
- 1: Simple border (single color)
- 2: Double border (inner and outer colors)
- 3: Shadow effect Borders improve text readability against complex backgrounds.
DateMask
Date mask.
public string DateMaskField Value
Remarks
Format string for displaying date/time when DateMode is true. Uses standard .NET date format strings:
Common patterns: - "yyyy-MM-dd": 2024-03-15 - "HH:mm:ss": 14:30:45 (24-hour) - "yyyy-MM-dd HH:mm:ss": 2024-03-15 14:30:45 - "MMM dd, yyyy h:mm tt": Mar 15, 2024 2:30 PM - "dd/MM/yyyy": 15/03/2024 (European format) - "MM/dd/yyyy": 03/15/2024 (US format)
Special tokens: - yyyy: 4-digit year - MM: 2-digit month - dd: 2-digit day - HH: 2-digit hour (24-hour) - mm: 2-digit minute - ss: 2-digit second - fff: Milliseconds
DateMode
Use Date mode.
public bool DateModeField Value
Remarks
When true, the Text property is ignored and the current date/time is displayed instead, formatted according to DateMask. Useful for adding timestamps to recordings, security footage, or time-sensitive content.
DrawQuality
Draw quality.
public int DrawQualityField Value
Remarks
Controls the rendering quality of the text. Higher values provide better quality at the cost of performance. Typical values:
- 0: Draft quality (fastest)
- 1: Normal quality (balanced)
- 2: High quality (best appearance)
FlipMode
Flip mode.
public int FlipModeField Value
Remarks
Specifies text flipping/mirroring. Values:
- 0: No flip
- 1: Horizontal flip (mirror)
- 2: Vertical flip
- 3: Both horizontal and vertical flip Can be used for reflection effects or special layouts.
FontBold
Use bold font.
public bool FontBoldField Value
Remarks
When true, renders the text in bold weight. Commonly used for titles, headers, or to improve readability against complex backgrounds.
FontColor
Font color.
public int FontColorField Value
Remarks
The color of the text in RGB format (0xRRGGBB). Common values:
- 0xFFFFFF: White (good for dark backgrounds)
- 0x000000: Black (good for light backgrounds)
- 0xFF0000: Red
- 0x00FF00: Green
- 0x0000FF: Blue
- 0xFFFF00: Yellow (good contrast on dark backgrounds)
FontItalic
Use italic font.
public bool FontItalicField Value
Remarks
When true, renders the text in italic style. Useful for emphasis, quotes, or stylistic purposes. Not all fonts support italic style.
FontName
Font name.
public string FontNameField Value
FontSize
Font size.
public int FontSizeField Value
Remarks
The size of the font in points. Common sizes:
- 8-12: Small text, suitable for timestamps or small watermarks
- 14-18: Normal text, good for subtitles
- 24-36: Large text, suitable for titles
- 48+: Extra large text for emphasis or headlines
FontStrikeout
Use strikeout font.
public bool FontStrikeoutField Value
Remarks
When true, adds a strikethrough decoration to the text. Typically used to indicate deleted or deprecated content.
FontUnderline
Use underline font.
public bool FontUnderlineField Value
Remarks
When true, adds an underline decoration to the text. Often used for hyperlinks, emphasis, or stylistic purposes.
Gradient
Use gradient.
public bool GradientField Value
Remarks
When true, applies a gradient fill to the text instead of a solid color. Gradients can create professional-looking titles and emphasize important text.
GradientColor1
Gradient color 1.
public int GradientColor1Field Value
Remarks
The starting color of the gradient in RGB format (0xRRGGBB). This is typically the color at the left/top/center depending on gradient mode.
GradientColor2
Gradient color 2.
public int GradientColor2Field Value
Remarks
The ending color of the gradient in RGB format (0xRRGGBB). This is typically the color at the right/bottom/edges depending on gradient mode.
GradientMode
Gradient mode.
public int GradientModeField Value
Remarks
Specifies the gradient direction/type:
- 0: Horizontal (left to right)
- 1: Vertical (top to bottom)
- 2: Diagonal (top-left to bottom-right)
- 3: Diagonal (top-right to bottom-left)
- 4: Radial (center to edges)
InnerBorderColor
Inner border color.
public int InnerBorderColorField Value
Remarks
Color of the inner border in RGB format (0xRRGGBB). Typically contrasts with the font color. For white text, use black border. Only used when BorderMode includes inner border.
InnerBorderSize
Inner border size.
public int InnerBorderSizeField Value
Remarks
Thickness of the inner border in pixels. Typical values:
- 1-2: Subtle outline
- 3-5: Standard border
- 6+: Thick border for emphasis
OuterBorderColor
Outer border color.
public int OuterBorderColorField Value
Remarks
Color of the outer border in RGB format (0xRRGGBB). Creates a double-border effect when used with inner border. Common for professional subtitles (e.g., white text, black inner, white outer).
OuterBorderSize
Outer border size.
public int OuterBorderSizeField Value
Remarks
Thickness of the outer border in pixels. Usually 1-2 pixels larger than inner border for proper visual separation. Total border thickness is inner + outer size.
RectHeight
Rectangle height.
public int RectHeightField Value
RectWidth
Rectangle width.
public int RectWidthField Value
RightToLeft
Text is right-to-left.
public bool RightToLeftField Value
RotationMode
Rotation mode.
public int RotationModeField Value
Remarks
Specifies text rotation. Common values:
- 0: No rotation
- 1: 90 degrees clockwise
- 2: 180 degrees
- 3: 270 degrees clockwise (-90 degrees) Useful for vertical text or creative layouts.
Text
Text.
public string TextField Value
Transp
Transparency level.
public int TranspField Value
Remarks
Controls the overall opacity of the text overlay. Range: 0-255
- 0: Fully transparent (invisible)
- 128: 50% transparent (semi-transparent watermark)
- 255: Fully opaque (no transparency) Lower values are ideal for watermarks that shouldn't distract from content.
TransparentBg
Transparent background.
public bool TransparentBgField Value
Vertical
Text located vertically.
public bool VerticalField Value
X
X.
public int XField Value
Remarks
The horizontal position of the text in pixels from the left edge of the frame. This represents the left edge of the text bounding box. For right-aligned text, calculate as (frame_width - text_width - desired_margin).
Y
Y.
public int YField Value
Remarks
The vertical position of the text in pixels from the top edge of the frame. This represents the top edge of the text bounding box. For bottom-aligned text, calculate as (frame_height - text_height - desired_margin).