/// <summary> /// Erzeugt eine neue Instanz zum Zeichnen einer Videotext Zeile. /// </summary> /// <param name="page"></param> internal LineDrawingContext(PageDrawingContext page) { // Remember PageContext = page; // Create helper m_CurrentContext = new CharDrawingContext(this); }
/// <summary> /// Erzeugt eine Kopie dieser Arbeitsumgebung. /// </summary> /// <returns>Eine exakte Kopie der Arbeitsumgebung.</returns> public CharDrawingContext Clone() { // Create clone CharDrawingContext clone = new CharDrawingContext(Line); // Copy all data clone.Foreground = Foreground; clone.Background = Background; // Report return(clone); }
/// <summary> /// Erzeugt eine Kopie dieser Arbeitsumgebung. /// </summary> /// <returns>Eine exakte Kopie der Arbeitsumgebung.</returns> public CharDrawingContext Clone() { // Create clone CharDrawingContext clone = new CharDrawingContext(Line); // Copy all data clone.Foreground = Foreground; clone.Background = Background; // Report return clone; }
/// <summary> /// Stellt ein Zeichen aus dem Mosaik Zeichensatz dar. /// </summary> /// <param name="code">Code des Zeichens.</param> /// <param name="x">Horizontale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="y">Vertikale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="context">Informationen über das Darstellungsformat.</param> private void DrawG1(byte code, float x, float y, CharDrawingContext context) { // See if this is a mosaic character if ((code < '\x40') || (code > '\x5f')) { // Read mosaic bounds SizeF mosaic = PageContext.MosaicElementSize; // Test all bits if (0 != (0x01 & code)) { FillRectangle(context.Foreground, x, y, mosaic.Width, mosaic.Height); } if (0 != (0x02 & code)) { FillRectangle(context.Foreground, x + mosaic.Width, y, mosaic.Width, mosaic.Height); } if (0 != (0x04 & code)) { FillRectangle(context.Foreground, x, y + mosaic.Height, mosaic.Width, mosaic.Height); } if (0 != (0x08 & code)) { FillRectangle(context.Foreground, x + mosaic.Width, y + mosaic.Height, mosaic.Width, mosaic.Height); } if (0 != (0x10 & code)) { FillRectangle(context.Foreground, x, y + 2 * mosaic.Height, mosaic.Width, mosaic.Height); } if (0 != (0x40 & code)) { FillRectangle(context.Foreground, x + mosaic.Width, y + 2 * mosaic.Height, mosaic.Width, mosaic.Height); } // May want to remember as hold character m_HoldContext = m_CurrentContext.Clone(); m_HoldCode = code; } else { // Normal character DrawG0(code, x, y, context); } }
/// <summary> /// Stellt ein Zeichen aus dem primären Zeichensatz dar. /// </summary> /// <param name="code">Code des Zeichens.</param> /// <param name="x">Horizontale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="y">Vertikale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="context">Informationen über das Darstellungsformat.</param> private void DrawG0(byte code, float x, float y, CharDrawingContext context) { // Get the character to draw string ch = m_Charset[code]; // Draw the one Graphics.DrawString(ch, NormalTextFont, context.Foreground, x, y); // Get the rectangle RectangleF rect = new RectangleF ( x * Graphics.Transform.Elements[0], y * Graphics.Transform.Elements[3], CharSize.Width * Graphics.Transform.Elements[0] * (string.IsNullOrEmpty(ch) ? 1 : ch.Length), CharSize.Height * Graphics.Transform.Elements[3] ); // Report if ((ch != null) && !string.IsNullOrEmpty(ch.Trim(' '))) { PageContext.ReportUsage(rect); } // See if this is a number if (ch != null) { if (ch.Length == 1) { // Load char dig = ch[0]; // Test if ((dig >= '0') && (dig <= '9')) { PageContext.Digits.Add(dig - '0', rect); } } } }
/// <summary> /// Stellt ein Zeichen dar und verändert die horizontale Position entsprechend. /// </summary> /// <param name="code">Der Code des Zeichens.</param> /// <param name="context">Informationen über das Darstellungsformat.</param> private void Draw(byte code, CharDrawingContext context) { // Remember bool pendingBlank = m_PendingBlank; // Reset m_PendingBlank = false; // Check mode if (Graphics.Transform.Elements[0] == 2) { if (code == 32) { if (!pendingBlank) { // Wait for pending blank m_PendingBlank = true; // Silent skip return; } } } // There is nothing to draw if (m_InsideSubtitleBox || !PageContext.IsTransparent) { // Attach to unscaled positions float realX = m_X / Graphics.Transform.Elements[0]; float realY = m_Y / Graphics.Transform.Elements[3]; // Set the background if (null != context.Background) { if (m_HasDoubleHeight && (Graphics.Transform.Elements[3] != 2)) { // Erase line below FillRectangle(context.Background, realX, realY, CharSize.Width, CharSize.Height * 2); } else { // Draw as is FillRectangle(context.Background, realX, realY, CharSize.Width, CharSize.Height); } } // Check mode and dispatch if (m_UseG0) { // Normal character DrawG0(code, realX, realY, context); } else { // Eventually a mosaic character DrawG1(code, realX, realY, context); } } // Advance position m_X += Graphics.Transform.Elements[0] * CharSize.Width; }
/// <summary> /// Stellt ein Zeichen aus dem Mosaik Zeichensatz dar. /// </summary> /// <param name="code">Code des Zeichens.</param> /// <param name="x">Horizontale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="y">Vertikale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="context">Informationen über das Darstellungsformat.</param> private void DrawG1( byte code, float x, float y, CharDrawingContext context ) { // See if this is a mosaic character if ((code < '\x40') || (code > '\x5f')) { // Read mosaic bounds SizeF mosaic = PageContext.MosaicElementSize; // Test all bits if (0 != (0x01 & code)) FillRectangle( context.Foreground, x, y, mosaic.Width, mosaic.Height ); if (0 != (0x02 & code)) FillRectangle( context.Foreground, x + mosaic.Width, y, mosaic.Width, mosaic.Height ); if (0 != (0x04 & code)) FillRectangle( context.Foreground, x, y + mosaic.Height, mosaic.Width, mosaic.Height ); if (0 != (0x08 & code)) FillRectangle( context.Foreground, x + mosaic.Width, y + mosaic.Height, mosaic.Width, mosaic.Height ); if (0 != (0x10 & code)) FillRectangle( context.Foreground, x, y + 2 * mosaic.Height, mosaic.Width, mosaic.Height ); if (0 != (0x40 & code)) FillRectangle( context.Foreground, x + mosaic.Width, y + 2 * mosaic.Height, mosaic.Width, mosaic.Height ); // May want to remember as hold character m_HoldContext = m_CurrentContext.Clone(); m_HoldCode = code; } else { // Normal character DrawG0( code, x, y, context ); } }
/// <summary> /// Stellt ein Zeichen aus dem primären Zeichensatz dar. /// </summary> /// <param name="code">Code des Zeichens.</param> /// <param name="x">Horizontale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="y">Vertikale Position in der Seite, an der das Zeichen erscheinen soll.</param> /// <param name="context">Informationen über das Darstellungsformat.</param> private void DrawG0( byte code, float x, float y, CharDrawingContext context ) { // Get the character to draw string ch = m_Charset[code]; // Draw the one Graphics.DrawString( ch, NormalTextFont, context.Foreground, x, y ); // Get the rectangle RectangleF rect = new RectangleF ( x * Graphics.Transform.Elements[0], y * Graphics.Transform.Elements[3], CharSize.Width * Graphics.Transform.Elements[0] * (string.IsNullOrEmpty( ch ) ? 1 : ch.Length), CharSize.Height * Graphics.Transform.Elements[3] ); // Report if ((ch != null) && !string.IsNullOrEmpty( ch.Trim( ' ' ) )) PageContext.ReportUsage( rect ); // See if this is a number if (ch != null) if (ch.Length == 1) { // Load char dig = ch[0]; // Test if ((dig >= '0') && (dig <= '9')) PageContext.Digits.Add( dig - '0', rect ); } }
/// <summary> /// Stellt ein Zeichen dar und verändert die horizontale Position entsprechend. /// </summary> /// <param name="code">Der Code des Zeichens.</param> /// <param name="context">Informationen über das Darstellungsformat.</param> private void Draw( byte code, CharDrawingContext context ) { // Remember bool pendingBlank = m_PendingBlank; // Reset m_PendingBlank = false; // Check mode if (Graphics.Transform.Elements[0] == 2) if (code == 32) if (!pendingBlank) { // Wait for pending blank m_PendingBlank = true; // Silent skip return; } // There is nothing to draw if (m_InsideSubtitleBox || !PageContext.IsTransparent) { // Attach to unscaled positions float realX = m_X / Graphics.Transform.Elements[0]; float realY = m_Y / Graphics.Transform.Elements[3]; // Set the background if (null != context.Background) if (m_HasDoubleHeight && (Graphics.Transform.Elements[3] != 2)) { // Erase line below FillRectangle( context.Background, realX, realY, CharSize.Width, CharSize.Height * 2 ); } else { // Draw as is FillRectangle( context.Background, realX, realY, CharSize.Width, CharSize.Height ); } // Check mode and dispatch if (m_UseG0) { // Normal character DrawG0( code, realX, realY, context ); } else { // Eventually a mosaic character DrawG1( code, realX, realY, context ); } } // Advance position m_X += Graphics.Transform.Elements[0] * CharSize.Width; }
/// <summary> /// Erzeugt eine neue Instanz zum Zeichnen einer Videotext Zeile. /// </summary> /// <param name="page"></param> internal LineDrawingContext( PageDrawingContext page ) { // Remember PageContext = page; // Create helper m_CurrentContext = new CharDrawingContext( this ); }