示例#1
0
void TeletextScreen::DrawStatus(void)
{
    SetForegroundColor(kTTColorWhite);
    SetBackgroundColor(kTTColorBlack);

    if (!m_teletextReader->IsTransparent())
        for (int i = 0; i < 40; ++i)
            DrawBackground(i, 0);

    DrawCharacter(1, 0, 'P', 0);
    DrawCharacter(2, 0, m_teletextReader->GetPageInput(0), 0);
    DrawCharacter(3, 0, m_teletextReader->GetPageInput(1), 0);
    DrawCharacter(4, 0, m_teletextReader->GetPageInput(2), 0);

    const TeletextSubPage *ttpage = m_teletextReader->FindSubPage();

    if (!ttpage)
    {
        QString str = QObject::tr("Page Not Available",
                                  "Requested Teletext page not available");
        for (int i = 0; (i < 30) && i < str.length(); i++)
            DrawCharacter(i+10, 0, str[i], 0);

        return;
    }

    QString str = m_teletextReader->GetPage();
    if (str.isEmpty())
        return;

    SetForegroundColor(kTTColorWhite);
    for (int x = 0; x < 11; x++)
    {
        if (m_teletextReader->IsTransparent())
            SetBackgroundColor(kTTColorTransparent);
        else
            SetBackgroundColor(kTTColorBlack);

        DrawBackground(x * 3 + 7, 0);

        if (str[x * 3] == '*')
        {
            str[x * 3] = ' ';
            SetBackgroundColor(kTTColorRed);
        }

        DrawBackground(x * 3 + 8, 0);
        DrawBackground(x * 3 + 9, 0);

        DrawCharacter(x * 3 + 7, 0, str[x * 3], 0);
        DrawCharacter(x * 3 + 8, 0, str[x * 3 + 1], 0);
        DrawCharacter(x * 3 + 9, 0, str[x * 3 + 2], 0);
    }
}
示例#2
0
文件: Console.cpp 项目: NNNorth/avr
/**
 * Установка параметров текста и фона.
 */
void CConsole::SetColor( EnColor ForegroundColor, EnColor BackgroundColor ) {

    SetTextAttributes( atOff );
    SetForegroundColor( ForegroundColor );
    SetBackgroundColor( BackgroundColor );

}
void DrawPrimFLine(PrimLineFC *line)
{
	//JAM 15Dec03
	BOOL bToggle = FALSE;

/*	if(TheStateStack.context->bZBuffering && DisplayOptions.bZBuffering)
	{
		bToggle = TRUE;
		TheStateStack.context->SetZBuffering(FALSE);
	}

	ShiAssert(line->type == LineF);
	ShiAssert(line->nVerts >= 2);

	verts += line->nVerts;

	SetSpecularFog();
	SetForegroundColor(PRIM_COLOP_COLOR, line->rgba, -1);
	ShiAssert(line->nVerts == 2);

	pvtDraw2DLine(line->xyz);

   //JAM 15Dec03
	if(bToggle && DisplayOptions.bZBuffering)
		TheStateStack.context->SetZBuffering(TRUE);*/
	SetForegroundColor(PRIM_COLOP_COLOR, line->rgba, -1);
	CV->AddPoly(0, (Poly*)line, line->xyz, NULL, NULL, NULL, true);
}
void DrawPrimFPoint(PrimPointFC *point)
{
	//JAM 15Dec03
/*	BOOL bToggle = FALSE;

	if(TheStateStack.context->bZBuffering && DisplayOptions.bZBuffering)
	{
		bToggle = TRUE;
		TheStateStack.context->SetZBuffering(FALSE);
	}

	ShiAssert(point->type == PointF);
	ShiAssert(point->nVerts >= 1);

	verts += point->nVerts;

	SetSpecularFog();
	SetForegroundColor(PRIM_COLOP_COLOR, point->rgba, -1);
	pvtDraw2DPrim(PointF, point->nVerts, point->xyz);


   //JAM 15Dec03
	if(bToggle && DisplayOptions.bZBuffering)
		TheStateStack.context->SetZBuffering(TRUE);*/

	SetForegroundColor(PRIM_COLOP_COLOR, point->rgba, -1);
	CV->AddPoly(0, (Poly*)point, point->xyz, NULL, NULL, NULL, true);

}
avtText2DColleague::avtText2DColleague(VisWindowColleagueProxy &m) 
    : avtAnnotationColleague(m)
{
    useForegroundForTextColor = true;
    addedToRenderer = false;
    textFormatString = 0;
    textString = 0;
    currentTime = initialTime;
    currentCycle = initialCycle;

    //
    // Create and position the actor.
    //
    textActor = vtkVisItTextActor::New();
    textActor->SetTextScaleMode(vtkTextActor::TEXT_SCALE_MODE_VIEWPORT);
    textActor->SetTextHeight(0.03);
    SetText("2D text annotation");
    vtkCoordinate *pos = textActor->GetPositionCoordinate();
    pos->SetCoordinateSystemToNormalizedViewport();
    pos->SetValue(0.5, 0.5, 0.);

    // Make sure that the actor initially has the right fg color.
    double fgColor[3];
    mediator.GetForegroundColor(fgColor);
    SetForegroundColor(fgColor[0], fgColor[1], fgColor[2]);
    textActor->GetTextProperty()->SetOpacity(1.);

    // Store the foreground color into the text color.
    int ifgColor[3];
    ifgColor[0] = int((float)fgColor[0] * 255.f);
    ifgColor[1] = int((float)fgColor[1] * 255.f);
    ifgColor[2] = int((float)fgColor[2] * 255.f);
    textColor = ColorAttribute(ifgColor[0], ifgColor[1], ifgColor[2], 255);
}
void DrawPolyL(PolyFCN *poly)
{
	verts += poly->nVerts;
	SetForegroundColor(PRIM_COLOP_COLOR | PRIM_COLOP_INTENSITY,poly->rgba,poly->I);
	SelectState(RenderStateTable[poly->type]);
	CV->AddPoly(PRIM_COLOP_NONE,poly,poly->xyz,NULL,NULL,NULL,true);
	TheStateStack.context->SetPalID(0);
}
void DrawPolyF(PolyFC *poly)
{
	verts += poly->nVerts;
	SetSpecularFog();
	SetForegroundColor(PRIM_COLOP_COLOR,poly->rgba,-1);
	SelectState(RenderStateTable[poly->type]);
	CV->AddPoly(PRIM_COLOP_NONE,poly,poly->xyz,NULL,NULL,NULL,true);
	TheStateStack.context->SetPalID(0);
}
void DrawPolyATL(PolyTexFCN *poly)
{
	verts += poly->nVerts;
	SetForegroundColor(PRIM_COLOP_COLOR | PRIM_COLOP_INTENSITY,poly->rgba,poly->I);
	SelectState(RenderStateTable[poly->type]);
//	TheTextureBank.Select(TheStateStack.CurrentTextureTable[poly->texIndex]);
	CV->AddUsedTexture(poly->texIndex);								// Updates Texture Index
	CV->AddPoly(PRIM_COLOP_TEXTURE,poly,poly->xyz,NULL,NULL,poly->uv,true);
	TheStateStack.context->SetPalID(0);
}
示例#9
0
CUISimpleBG::CUISimpleBG( unsigned int _uId,
                          float _fPosX, float _fPosY,
                          float _fWidth, float _fHeight )
: IUInterface( _uId, _fPosX, _fPosY, _fWidth, _fHeight ),
  m_bMoving( false )
{
    // Text Color
    SetForegroundColor( 1.0f, 1.0f, 1.0f, 1.0f );
    // Background
    SetBackgroundColor( 0.2f, 0.7f, 0.2f, 0.4f );
    // Border
    SetBorderColor( 1.0f, 1.0f, 1.0f, 1.0f );
}
示例#10
0
CLCDColorText::CLCDColorText(void)
{
    m_nTextLength = 0;
    m_hFont = NULL;
    m_sText.erase(m_sText.begin(), m_sText.end());
    SetForegroundColor(RGB(255, 0, 255));
    m_bRecalcExtent = TRUE;
    SecureZeroMemory(&m_dtp, sizeof(DRAWTEXTPARAMS));
    m_dtp.cbSize = sizeof(DRAWTEXTPARAMS);
    m_nTextFormat = m_nTextAlignment = (DT_LEFT | DT_NOPREFIX);
    m_nTextAlignment = DT_LEFT;
    SecureZeroMemory(&m_sizeVExtent, sizeof(m_sizeVExtent));
    SecureZeroMemory(&m_sizeHExtent, sizeof(m_sizeHExtent));

    SetBackgroundMode(TRANSPARENT, RGB(255,255,255));

    //Default font
    LOGFONT lf;
    lf.lfCharSet = 0;
    lf.lfClipPrecision = 2;
    lf.lfEscapement = 0;
    lf.lfHeight = -32;
    lf.lfItalic = 0;
    lf.lfOrientation = 0;
    lf.lfOutPrecision = 3;
    lf.lfPitchAndFamily = 18;
    lf.lfQuality = 1;
    lf.lfStrikeOut = 0;
    lf.lfUnderline = 0;
    lf.lfWeight = 400;
    lf.lfWidth = 0;

    wsprintf(lf.lfFaceName, _T("Times New Roman") );

    m_hFont = CreateFontIndirect(&lf);

    m_StartX = 0;
    m_LoopX = 0;
    m_ScrollRate = 0;
    m_PixelLength = 0;
    m_RunningTime = 0;
    m_ScrollBuffer = 20;
    m_JumpDistance = 0;

    m_bAutoScroll = true;
}
示例#11
0
void SPropertyTableCell::Construct( const FArguments& InArgs, const TSharedRef< class IPropertyTableCell >& InCell )
{
	Cell = InCell;
	Presenter = InArgs._Presenter;
	Style = InArgs._Style;

	CellBackground = FEditorStyle::GetBrush( Style, ".ColumnBorder" );

	SetContent( ConstructCellContents() );

	Cell->OnEnteredEditMode().AddSP( this, &SPropertyTableCell::EnteredEditMode );
	Cell->OnExitedEditMode().AddSP( this, &SPropertyTableCell::ExitedEditMode );

	FCoreUObjectDelegates::OnObjectPropertyChanged.AddSP(this, &SPropertyTableCell::OnCellValueChanged);

	static const FName InvertedForegroundName("InvertedForeground");

	SetForegroundColor( FEditorStyle::GetSlateColor(InvertedForegroundName) );
}
示例#12
0
bool
CharacterStyle::SetForegroundColor(uint8 r, uint8 g, uint8 b, uint8 a)
{
	return SetForegroundColor((rgb_color){ r, g, b, a });
}
示例#13
0
Drawer::Drawer(): curX(0), curY(0)
{
    SetForegroundColor(0);
}
示例#14
0
void TeletextScreen::DrawLine(const uint8_t *page, uint row, int lang)
{
    bool mosaic;
    bool conceal;
    MUNUSED bool seperation;
    MUNUSED bool flash;
    bool doubleheight;
    MUNUSED bool blink;
    bool hold;
    bool endbox;
    bool startbox;
    bool withinbox;

    unsigned char last_ch = ' ';
    unsigned char ch;

    uint fgcolor    = kTTColorWhite;
    uint bgcolor    = kTTColorBlack;
    uint newfgcolor = kTTColorWhite;
    uint newbgcolor = kTTColorBlack;

    if (m_teletextReader->IsSubtitle() || m_teletextReader->IsTransparent())
    {
        bgcolor    = kTTColorTransparent;
        newbgcolor = kTTColorTransparent;

        bool isBlank = true;
        for (uint i = (row == 1 ? 8 : 0); i < (uint) kTeletextColumns; i++)
        {
            ch = page[i] & 0x7F;
            if (ch != ' ')
            {
                isBlank = false;
                break;
            }
        }

        if (isBlank)
            return;
    }

    SetForegroundColor(fgcolor);
    SetBackgroundColor(bgcolor);

    mosaic = false;
    seperation = false;
    conceal = false;
    flash = false;
    doubleheight = false;
    blink = false;
    hold = false;
    endbox = false;
    startbox = false;
    withinbox = false;
    uint flof_link_count = 0;
    uint old_bgcolor = bgcolor;

    if (row == 1)
    {
        for (uint x = 0; x < 8; x++)
            DrawBackground(x, 1);
    }

    for (uint x = (row == 1 ? 8 : 0); x < (uint)kTeletextColumns; ++x)
    {
        if (startbox)
        {
            old_bgcolor = bgcolor;
            if (kTTColorTransparent & bgcolor)
                bgcolor = bgcolor & ~kTTColorTransparent;
            startbox = false;
            withinbox = true;
        }

        if (endbox)
        {
            bgcolor = old_bgcolor;
            endbox = false;
            withinbox = false;
        }

        SetForegroundColor(fgcolor);
        SetBackgroundColor(bgcolor);

        ch = page[x] & 0x7F;
        switch (ch)
        {
            case 0x00: case 0x01: case 0x02: case 0x03:
            case 0x04: case 0x05: case 0x06: case 0x07: // alpha + foreground color
                fgcolor = ch & 7;
                mosaic = false;
                conceal = false;
                // increment FLOF/FastText count if menu item detected
                flof_link_count += (row == 25) ? 1 : 0;
                goto ctrl;
            case 0x08: // flash
                // XXX
                goto ctrl;
            case 0x09: // steady
                flash = false;
                goto ctrl;
            case 0x0a: // end box
                endbox = true;
                goto ctrl;
            case 0x0b: // start box
                if (x < kTeletextColumns - 1 && ((page[x + 1] & 0x7F) == 0x0b))
                    startbox = true;
                goto ctrl;
            case 0x0c: // normal height
                doubleheight = false;
                goto ctrl;
            case 0x0d: // double height
                doubleheight = (row < (kTeletextRows-1)) && (x < (kTeletextColumns - 1));
                goto ctrl;

            case 0x10: case 0x11: case 0x12: case 0x13:
            case 0x14: case 0x15: case 0x16: case 0x17: // graphics + foreground color
                fgcolor = ch & 7;
                mosaic = true;
                conceal = false;
                goto ctrl;
            case 0x18: // conceal display
                conceal = true;
                goto ctrl;
            case 0x19: // contiguous graphics
                seperation = false;
                goto ctrl;
            case 0x1a: // separate graphics
                seperation = true;
                goto ctrl;
            case 0x1c: // black background
                bgcolor = kTTColorBlack;
                goto ctrl;
            case 0x1d: // new background
                bgcolor = fgcolor;
                goto ctrl;
            case 0x1e: // hold graphics
                hold = true;
                goto ctrl;
            case 0x1f: // release graphics
                hold = false;
                goto ctrl;
            case 0x0e: // SO (reserved, double width)
            case 0x0f: // SI (reserved, double size)
            case 0x1b: // ESC (reserved)
                ch = ' ';
                break;
            ctrl:
                ch = ' ';
                if (hold && mosaic)
                    ch = last_ch;
            break;

            default:
                if ((ch >= 0x80) && (ch <=0x9f)) // these aren't used
                    ch = ' '; // BAD_CHAR;
                else
                {
                    if (conceal && !m_teletextReader->RevealHidden())
                        ch = ' ';
                }
                break;
        }

        // Hide FastText/FLOF menu characters if not available
        if (flof_link_count && (flof_link_count <= 6))
        {
            const TeletextSubPage *ttpage = m_teletextReader->FindSubPage();

            if (ttpage)
            {
                bool has_flof = ttpage->floflink[flof_link_count - 1];
                ch = (has_flof) ? ch : ' ';
            }
        }

        newfgcolor = fgcolor;
        newbgcolor = bgcolor;

        SetForegroundColor(newfgcolor);
        SetBackgroundColor(newbgcolor);
        if ((row != 0) || (x > 7))
        {
            if (m_teletextReader->IsTransparent())
                SetBackgroundColor(kTTColorTransparent);

            if (withinbox || !m_teletextReader->IsSubtitle())
            {
                DrawBackground(x, row);
                if (doubleheight && row < (uint)kTeletextRows)
                    DrawBackground(x, row + 1);

                if ((mosaic) && (ch < 0x40 || ch > 0x5F))
                {
                    SetBackgroundColor(newfgcolor);
                    DrawMosaic(x, row, ch, doubleheight);
                }
                else
                {
                    char c2 = cvt_char(ch, lang);
                    DrawCharacter(x, row, c2, doubleheight);
                }
            }
        }
    }
}