void CHudFlagCarrier::Paint ( void ) { SetBgColor( Color( GetBgColor().r(), GetBgColor().g(), GetBgColor().b(), 128 ) ); DisplayText ( m_Text[ TEAM_BLUE ], m_flBlueTextX, m_flBlueTextY, m_BlueForegroundColor ); DisplayText ( m_Text[ TEAM_RED ], m_flRedTextX, m_flRedTextY, m_RedForegroundColor ); if ( m_iTakenByPlayer[ TEAM_RED ] != TAKEN_INVALID_PLAYER ) { m_pAvatar[ TEAM_RED ].Paint(); } if ( m_iTakenByPlayer[ TEAM_BLUE ] != TAKEN_INVALID_PLAYER ) { m_pAvatar[ TEAM_BLUE ].Paint(); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CDoDHudHealthBar::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); m_clrHealthHigh = pScheme->GetColor( "HudHealthGreen", GetFgColor() ); m_clrHealthMed = pScheme->GetColor( "HudHealthYellow", GetFgColor() ); m_clrHealthLow = pScheme->GetColor( "HudHealthRed", GetFgColor() ); m_clrBackground = pScheme->GetColor( "HudHealthBG", GetBgColor() ); m_clrBorder = pScheme->GetColor( "HudHealthBorder", GetBgColor() ); }
/************************************************** * DISPLAY * DESCRIPION: Displays the input object unless clear is set * in which case the object is removed from the screen and * the background color is used instead. *************************************************/ void display_bar(struct Bar* bar, char clear) { if (clear == 0) { //Vertical if (bar->orientation == BAR_VERTICAL) { if (bar->remove_from == BAR_TOP) //Remove bar from top { ILI9341_fillRect(bar->y_pos, bar->x_pos, (bar->height - bar->pixels), bar->width , bar->contrast); ILI9341_fillRect(bar->y_pos + (bar->height - bar->pixels), bar->x_pos, bar->pixels, bar->width , bar->color); } else if (bar->remove_from == BAR_BOTTOM) //Remove bar from top { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->pixels, bar->width , bar->color); ILI9341_fillRect(bar->y_pos + bar->pixels, bar->x_pos, (bar->height - bar->pixels), bar->width , bar->contrast); } } //Horizontal else { if (bar->remove_from == BAR_LEFT) { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->width, bar->pixels , bar->color); ILI9341_fillRect(bar->y_pos, bar->x_pos + bar->pixels, bar->width, (bar->height - bar->pixels) , bar->contrast); } else if (bar->remove_from == BAR_RIGHT) { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->width, (bar->height - bar->pixels) , bar->contrast); ILI9341_fillRect(bar->y_pos, bar->x_pos + (bar->height - bar->pixels), bar->width, bar->pixels , bar->color); } } } else { //Vertical if (bar->orientation == 0) { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->height, bar->width , GetBgColor()); } //Horizontal else { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->width, bar->pixels, GetBgColor()); } } }
/************************************************** * DISPLAY * DESCRIPION: Displays the input object unless clear is set * in which case the object is removed from the screen and * the background color is used instead. *************************************************/ void display_bar(struct Bar* bar, char clear) { if (clear == 0) { //Vertical if (bar->orientation == OrientVertical) { if (bar->remove_from == BarTop) //Remove bar from top { ILI9341_fillRect(bar->y_pos, bar->x_pos, (bar->height - bar->pixels), bar->width , bar->contrast); ILI9341_fillRect(bar->y_pos + (bar->height - bar->pixels), bar->x_pos, bar->pixels, bar->width , bar->color); } else if (bar->remove_from == BarBottom) //Remove bar from top { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->pixels, bar->width , bar->color); ILI9341_fillRect(bar->y_pos + bar->pixels, bar->x_pos, (bar->height - bar->pixels), bar->width , bar->contrast); } } //Horizontal else { if (bar->remove_from == BarLeft) { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->width, bar->pixels , bar->color); ILI9341_fillRect(bar->y_pos, bar->x_pos + bar->pixels, bar->width, (bar->height - bar->pixels) , bar->contrast); } else if (bar->remove_from == BarRight) { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->width, (bar->height - bar->pixels) , bar->contrast); ILI9341_fillRect(bar->y_pos, bar->x_pos + (bar->height - bar->pixels), bar->width, bar->pixels , bar->color); } } } else { //Vertical if (bar->orientation == OrientVertical) { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->height, bar->width , GetBgColor()); } //Horizontal else { ILI9341_fillRect(bar->y_pos, bar->x_pos, bar->width, bar->pixels, GetBgColor()); } } }
void ColorCmd::Write (ostream& out) { Command::Write(out); Catalog* catalog = unidraw->GetCatalog(); catalog->WriteColor(GetFgColor(), out); catalog->WriteColor(GetBgColor(), out); }
void WebListBox::DrawFrame(WebRect *box, WebGraphics *gc) { WebColor hilite = gc->LightColor(gc->DarkColor(GetBgColor(gc))); WebColor lolite = gc->DarkColor(hilite); gc->Frame3D(box, lolite, hilite, LISTBOX_BORDER); // draw a recessed frame }
void WebDropBox::DrawFrame(WebRect *rect, WebGraphics *gc) { WebColor hilite = gc->LightColor(gc->DarkColor(GetBgColor(gc))); WebColor lolite = gc->DarkColor(hilite); gc->Frame3D(rect, lolite, hilite, DROPBOX_FRAME_WIDTH); }
void CHudChat::ApplySchemeSettings( vgui::IScheme *pScheme ) { if ( m_bIntermissionSet ) LoadControlSettings( "resource/UI/BaseChat_Intermission.res" ); else LoadControlSettings( "resource/UI/BaseChat.res" ); m_IScheme = pScheme; // Skip over the BaseChat so we don't reload non-intermission settings EditablePanel::ApplySchemeSettings( pScheme ); SetPaintBackgroundType( 2 ); SetPaintBorderEnabled( true ); SetPaintBackgroundEnabled( true ); SetKeyBoardInputEnabled( false ); SetMouseInputEnabled( false ); m_nVisibleHeight = 0; Color cColor = pScheme->GetColor( "DullWhite", GetBgColor() ); SetBgColor( Color ( cColor.r(), cColor.g(), cColor.b(), CHAT_HISTORY_ALPHA ) ); GetChatHistory()->SetVerticalScrollbar( false ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CMessageDialog::PaintBackground( void ) { int wide, tall; GetSize( wide, tall ); if ( !( m_nType & MD_SIMPLEFRAME ) ) { int nAlpha = GetAlpha(); m_clrNotSimpleBG[3] = nAlpha; m_clrNotSimpleBGBlack[3] = nAlpha; DrawBox( 0, 0, wide, tall, m_clrNotSimpleBGBlack, 1.0f ); DrawBox( 0, 0, wide, tall - m_FooterTall, m_clrNotSimpleBG, 1.0f ); return; } Color col = GetBgColor(); DrawBox( 0, 0, wide, tall, col, 1.0f ); // offset the inset by title int titleX, titleY, titleWide, titleTall; m_pTitle->GetBounds( titleX, titleY, titleWide, titleTall ); int y = titleY + titleTall; // draw an inset Color darkColor; darkColor.SetColor( 0.70f * (float)col.r(), 0.70f * (float)col.g(), 0.70f * (float)col.b(), col.a() ); vgui::surface()->DrawSetColor( darkColor ); vgui::surface()->DrawFilledRect( 8, y, wide - 8, tall - 8 ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- Color CBaseHudChat::GetTextColorForClient( TextColor colorNum, int clientIndex ) { Color c; switch ( colorNum ) { case COLOR_PLAYERNAME: c = GetClientColor( clientIndex ); break; case COLOR_LOCATION: c = g_ColorDarkGreen; break; case COLOR_ACHIEVEMENT: { vgui::IScheme *pSourceScheme = vgui::scheme()->GetIScheme( vgui::scheme()->GetScheme( "SourceScheme" ) ); if ( pSourceScheme ) { c = pSourceScheme->GetColor( "SteamLightGreen", GetBgColor() ); } else { c = GetDefaultTextColor(); } } break; default: c = GetDefaultTextColor(); } return Color( c[0], c[1], c[2], 255 ); }
NS_IMETHODIMP HTMLBodyElement::GetBgColor(nsAString& aBgColor) { nsString bgColor; GetBgColor(bgColor); aBgColor = bgColor; return NS_OK; }
NS_IMETHODIMP HTMLBodyElement::GetBgColor(nsAString& aBgColor) { DOMString bgColor; GetBgColor(bgColor); bgColor.ToString(aBgColor); return NS_OK; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CHudControlPointIcons::ApplySchemeSettings( IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); m_hTextFont = pScheme->GetFont( "ChatFont" ); m_clrBackground = pScheme->GetColor( "HudPanelBackground", GetFgColor() ); m_clrBorder = pScheme->GetColor( "HudPanelBorder", GetBgColor() ); }
/********************************************** * DISPLAY SOLID * DESCRIPTION: Allows the user to display * or clear the brush object. **********************************************/ void display_brush(struct Brush* brush, char clear) { if (clear == 1) { ILI9341_fillRect(brush->y_pos, brush->x_pos, brush->height, brush->width, GetBgColor()); } else { ILI9341_fillRect(brush->y_pos, brush->x_pos, brush->height, brush->width, brush->color); } }
void CHudDomScore::Paint ( void ) { SetBgColor( Color( GetBgColor().r(), GetBgColor().g(), GetBgColor().b(), 128 ) ); DisplayText ( m_Text[ SDK_TEAM_BLUE ], m_flBlueTextX, m_flBlueTextY, m_BlueForegroundColor ); DisplayText ( m_Text[ SDK_TEAM_RED ], m_flRedTextX, m_flRedTextY, m_RedForegroundColor ); }
void CHudChatFilterPanel::ApplySchemeSettings(vgui::IScheme *pScheme) { LoadControlSettings( "resource/UI/ChatFilters.res" ); BaseClass::ApplySchemeSettings( pScheme ); Color cColor = pScheme->GetColor( "DullWhite", GetBgColor() ); SetBgColor( Color ( cColor.r(), cColor.g(), cColor.b(), CHAT_HISTORY_ALPHA ) ); SetFgColor( pScheme->GetColor( "Blank", GetFgColor() ) ); }
void MsgView::Paint(const os::Rect& r) { FillRect(r, GetBgColor()); float y=20.0f; for(uint i=0;i<lines.size();++i) { MovePenTo(10,y); DrawString(lines[i].c_str()); y+=lineHeight; } }
void CBaseHudChat::FadeChatHistory( void ) { float frac = ( m_flHistoryFadeTime - gpGlobals->curtime ) / CHAT_HISTORY_FADE_TIME; int alpha = frac * CHAT_HISTORY_ALPHA; alpha = clamp( alpha, 0, CHAT_HISTORY_ALPHA ); if ( alpha >= 0 ) { if ( GetChatHistory() ) { if ( IsMouseInputEnabled() ) { SetAlpha( 255 ); GetChatHistory()->SetBgColor( Color( 0, 0, 0, CHAT_HISTORY_ALPHA - alpha ) ); m_pChatInput->GetPrompt()->SetAlpha( (CHAT_HISTORY_ALPHA*2) - alpha ); m_pChatInput->GetInputPanel()->SetAlpha( (CHAT_HISTORY_ALPHA*2) - alpha ); SetBgColor( Color( GetBgColor().r(), GetBgColor().g(), GetBgColor().b(), CHAT_HISTORY_ALPHA - alpha ) ); m_pFiltersButton->SetAlpha( (CHAT_HISTORY_ALPHA*2) - alpha ); } else { GetChatHistory()->SetBgColor( Color( 0, 0, 0, alpha ) ); SetBgColor( Color( GetBgColor().r(), GetBgColor().g(), GetBgColor().b(), alpha ) ); m_pChatInput->GetPrompt()->SetAlpha( alpha ); m_pChatInput->GetInputPanel()->SetAlpha( alpha ); m_pFiltersButton->SetAlpha( alpha ); } } } }
/******************************************************************** * Description: Paints the statusbar * Author: Andreas Engh-Halstvedt(with modifications by Rick Caudill) * Date: Thu Mar 18 20:07:11 2004 *********************************************************************/ void StatusBar::Paint(const os::Rect& cUpdateRect) { os::Rect cBounds=GetBounds(); float vPanel=3; os::font_height sHeight; GetFont()->GetHeight(&sHeight); SetFgColor(GetBgColor()); FillRect(cUpdateRect); SetFgColor(255, 255, 255); DrawLine(os::Point(0, 0), os::Point(cBounds.right, 0)); for(int a=0;a<nPanelCount;++a) { switch(m_pcPanels[a].mode) { case RELATIVE: { if(m_pcPanels[a].vWidth<0) continue; float w=(cBounds.right-cBounds.left)*m_pcPanels[a].vWidth; DrawPanel(m_pcPanels[a].cText, vPanel, 3, vPanel+w, cBounds.bottom-3, sHeight.ascender+sHeight.line_gap); vPanel+=w; break; } case FILL://TODO: handle FILL other places than at the end { float w=cBounds.right-cBounds.left-3-vPanel; if(w<0) continue; DrawPanel(m_pcPanels[a].cText, vPanel, 3, vPanel+w, cBounds.bottom-3, sHeight.ascender+sHeight.line_gap); vPanel+=w; break; } case CONSTANT: default: if(m_pcPanels[a].vWidth<0) continue; DrawPanel(m_pcPanels[a].cText, vPanel, 3, vPanel+m_pcPanels[a].vWidth, cBounds.bottom-3, sHeight.ascender+sHeight.line_gap); vPanel+=m_pcPanels[a].vWidth; break; } vPanel+=5; } }
void BitmapGraphic::Write (ostream& out) { Catalog* catalog = unidraw->GetCatalog(); catalog->WriteBgFilled(BgFilled(), out); catalog->WriteBrush(GetBrush(), out); catalog->WriteColor(GetFgColor(), out); catalog->WriteColor(GetBgColor(), out); catalog->WriteFont(GetFont(), out); catalog->WritePattern(GetPattern(), out); catalog->WriteTransformer(GetTransformer(), out); catalog->WriteString(_fg_name, out); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- Color CHudChat::GetTextColorForClient( TextColor colorNum, int clientIndex ) { IScheme *pScheme = scheme()->GetIScheme( GetScheme() ); if ( pScheme == NULL ) return Color( 255, 255, 255, 255 ); Color c; switch ( colorNum ) { case COLOR_PLAYERNAME: c = GetClientColor( clientIndex ); break; case COLOR_LOCATION: c = g_ColorDarkGreen; break; case COLOR_ACHIEVEMENT: { IScheme *pSourceScheme = scheme()->GetIScheme( scheme()->GetScheme( "SourceScheme" ) ); if ( pSourceScheme ) { c = pSourceScheme->GetColor( "SteamLightGreen", GetBgColor() ); } else { c = pScheme->GetColor( "TFColors.ChatTextYellow", GetBgColor() ); } } break; default: c = pScheme->GetColor( "TFColors.ChatTextYellow", GetBgColor() ); } return Color( c[0], c[1], c[2], 255 ); }
void CBaseHudChat::Paint( void ) { #ifndef _XBOX if ( m_nVisibleHeight == 0 ) return; int w, h; GetSize( w, h ); vgui::surface()->DrawSetColor( GetBgColor() ); vgui::surface()->DrawFilledRect( 0, h - m_nVisibleHeight, w, h ); vgui::surface()->DrawSetColor( GetFgColor() ); vgui::surface()->DrawOutlinedRect( 0, h - m_nVisibleHeight, w, h ); #endif }
virtual void ApplySchemeSettings(IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); m_ArmedFgColor2 = GetSchemeColor("ListPanel.SelectedTextColor", pScheme); m_ArmedBgColor = GetSchemeColor("ListPanel.SelectedBgColor", pScheme); m_FgColor1 = GetSchemeColor("ListPanel.TextColor", pScheme); m_FgColor2 = GetSchemeColor("ListPanel.SelectedTextColor", pScheme); m_BgColor = GetSchemeColor("ListPanel.BgColor", GetBgColor(), pScheme); m_BgColor = GetSchemeColor("ListPanel.TextBgColor", m_BgColor, pScheme); m_SelectionBG2Color = GetSchemeColor("ListPanel.SelectedOutOfFocusBgColor", pScheme); SetBgColor(m_BgColor); SetFgColor(m_FgColor1); UpdateImage(); }
void UpscaleGeometryRenderingApp::renderColorPass(izanagi::graph::CGraphicsDevice* device) { const auto& camera = GetCamera(); const auto& mtxW2C = camera.GetParam().mtxW2C; auto* shd = m_shdColorPass.m_program; device->SetShaderProgram(shd); auto hW2C = shd->GetHandleByName("mtxW2C"); shd->SetMatrix(device, hW2C, mtxW2C); auto bgColor = GetBgColor(); m_gbuffer.beginColorPass(device, bgColor); m_scene.render(device, shd); m_gbuffer.endColorPass(device); }
void CBaseHudChatInputLine::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); // FIXME: Outline vgui::HFont hFont = pScheme->GetFont( "Trebuchet18" ); m_pPrompt->SetFont( hFont ); m_pInput->SetFont( hFont ); SetPaintBackgroundEnabled( false ); m_pPrompt->SetPaintBackgroundEnabled( false ); m_pPrompt->SetContentAlignment( vgui::Label::a_west ); m_pPrompt->SetTextInset( 2, 0 ); #ifdef HL1_CLIENT_DLL m_pInput->SetBgColor( Color( 255, 255, 255, 0 ) ); #else m_pInput->SetFgColor( GetFgColor() ); m_pInput->SetBgColor( GetBgColor() ); #endif }
virtual void PaintBackground() { int wide, tall; GetSize(wide, tall); if ( m_bSelected ) { VPANEL focus = input()->GetFocus(); // if one of the children of the SectionedListPanel has focus, then 'we have focus' if we're selected if (HasFocus() || (focus && ipanel()->HasParent(focus, GetVParent()))) { surface()->DrawSetColor(m_ArmedBgColor); } else { surface()->DrawSetColor(m_SelectionBG2Color); } } else { surface()->DrawSetColor(GetBgColor()); } surface()->DrawFilledRect(0, 0, wide, tall); }
void CBaseHudChat::ApplySchemeSettings( vgui::IScheme *pScheme ) { LoadControlSettings( "resource/UI/BaseChat.res" ); BaseClass::ApplySchemeSettings( pScheme ); SetPaintBackgroundType( 2 ); SetPaintBorderEnabled( true ); SetPaintBackgroundEnabled( true ); SetKeyBoardInputEnabled( false ); SetMouseInputEnabled( false ); m_nVisibleHeight = 0; #ifdef HL1_CLIENT_DLL SetBgColor( Color( 0, 0, 0, 0 ) ); SetFgColor( Color( 0, 0, 0, 0 ) ); #endif Color cColor = pScheme->GetColor( "DullWhite", GetBgColor() ); SetBgColor( Color ( cColor.r(), cColor.g(), cColor.b(), CHAT_HISTORY_ALPHA ) ); GetChatHistory()->SetVerticalScrollbar( false ); }
void CHudCloseCaption::DrawStream( wrect_t &rcText, const CCloseCaptionPhrase *phrase ) { vgui::surface()->DrawSetColor( GetBgColor() ); vgui::surface()->DrawFilledRect( rcText.left, rcText.top, rcText.right, rcText.bottom ); int c = phrase->CountTokens(); int i; int fontheight = vgui::surface()->GetFontTall( fontSet[ FONT_NORMAL ] ); int x = 0; int y = 0; int available_width = rcText.right - rcText.left; color32 clr; clr.r = 255; clr.b = 255; clr.g = 255; clr.a = 255; CUtlVector< color32 > colorStack; colorStack.AddToTail( clr ); int italic = 0; int bold = 0; for ( i = 0; i < c; i++ ) { const wchar_t *token = phrase->GetToken( i ); if ( !token ) continue; wchar_t cmd[ 256 ]; wchar_t args[ 256 ]; if ( phrase->SplitCommand( token, cmd, args ) ) { if ( !wcscmp( cmd, L"cr" ) ) { x = 0; y += ( fontheight + 1 ); } if ( !wcscmp( cmd, L"clr" ) ) { if ( args[0] == 0 && colorStack.Count()>= 2) { colorStack.Remove( colorStack.Count() - 1 ); } else { int r, g, b; color32 newcolor; if ( 3 == swscanf( args, L"%i,%i,%i", &r, &g, &b ) ) { newcolor.r = r; newcolor.g = g; newcolor.b = b; newcolor.a = 255; colorStack.AddToTail( newcolor ); } } } if ( !wcscmp( cmd, L"I" ) ) { italic = !italic; } if ( !wcscmp( cmd, L"B" ) ) { bold = !bold; } continue; } int w, h; if ( italic ) { italic = FONT_ITALIC; } if ( bold ) { bold = FONT_BOLD; } vgui::HFont useF = FindFont( bold | italic ); wchar_t sz[ 1024 ]; swprintf( sz, L"%s ", token ); vgui::surface()->GetTextSize( useF, sz, w, h ); if ( x + w > available_width ) { x = 0; y += ( h + 1 ); } wrect_t rcOut; rcOut.left = rcText.left + x + 5; rcOut.right = rcOut.left + w; rcOut.top = rcText.top + y; rcOut.bottom = rcOut.top + fontheight + 1; color32 useColor = colorStack[ colorStack.Count() - 1 ]; vgui::surface()->DrawSetTextFont( useF ); vgui::surface()->DrawSetTextPos( rcOut.left, rcOut.top ); vgui::surface()->DrawSetTextColor( Color( useColor.r, useColor.g, useColor.b, useColor.a ) ); vgui::surface()->DrawPrintText( sz, wcslen( sz ) ); x += w; } }
void JButton::Render() { Frame ext = GetExt(); uint32_t clr = GetFgColor(); int skinFrame = m_NormalFrame; if (IsBlendAdd()) { g_pDrawServer->SetAdditive( true ); } if (m_bPressed && m_PressedFrame != -1) { skinFrame = m_PressedFrame; } if (!IsEnabled()) { if (m_DisabledFrame != -1) { skinFrame = m_DisabledFrame; } //clr = m_DisableFgColor; } if (IsHovered()) { clr = GetHoverFgColor(); if (m_HoverFrame != -1) { skinFrame = m_HoverFrame; } } g_pDrawServer->Flush(); if (GetSkinPackID() >= 0) { g_pDrawServer->DrawSprite( ext, GetSkinPackID(), skinFrame, GetBgColor() ); } g_pDrawServer->SetLinFilter( IsFilterFont() ); g_pDrawServer->Flush(); const char* text = GetText(); if (text && text[0] != 0) { // draw button text ext.w = g_pDrawServer->GetTextWidth( GetFontID(), text, GetFontHeight() ); ext.h = GetFontHeight(); ext = ApplyAlignment( ext, GetExt(), XAlign_Center, YAlign_Center ); if (m_ShadowColor != 0) { g_pDrawServer->DrawString( ext.x + m_ShadowShiftX, ext.y + m_ShadowShiftY, GetFontID(), GetText(), m_ShadowColor, GetFontHeight() ); g_pDrawServer->Flush(); } g_pDrawServer->DrawString( ext.x, ext.y, GetFontID(), GetText(), clr, GetFontHeight() ); } else if (m_GlyphID >= 0) { // draw button glyph ext.w = g_pDrawServer->GetFrameW( m_GlyphID, m_GlyphFrame ); ext.h = g_pDrawServer->GetFrameH( m_GlyphID, m_GlyphFrame ); ext = ApplyAlignment( ext, GetExt(), XAlign_Center, YAlign_Center ); g_pDrawServer->DrawSprite( ext.x, ext.y, m_GlyphID, m_GlyphFrame, GetFgColor() ); } g_pDrawServer->Flush(); if (IsBlendAdd()) { g_pDrawServer->SetAdditive( false ); } } // JButton::Render
void WebEditBox::DrawThisOnly (DISPLAY_INT x, DISPLAY_INT y, WebGraphics *gc) { WebChar c; long line; WebRect box; GetFrameRect(&box); box.Shift(x,y); // gc->StartBuffer(); // begin buffering graphics commands gc->Rectangle(&box, GetBgColor(gc), GetBgColor(gc), 1); // draw background DrawFrame(&box, gc); // save the current graphics context clip rectangle and set clipping to the // text display region of the widget GetTextRect(&box); box.Shift(x,y); WebRect clipSave; gc->GetClip(&clipSave); if (clipSave.Overlaps(&box)) { WebRect clip(box); clip.And(&clipSave); gc->SetClip(&clip); miXOffset = (mpHScroll)? mpHScroll->GetPosition() : 0; miYOffset = (mpVScroll)? mpVScroll->GetPosition() : 0; // render our text WebFont font = mFont.GetFont(); if (mpText && font) { // this loop draws up to the last line for (line=0; line<(miNumLines-1); line++) { c = mpText[GetLineOffset(line+1)]; mpText[GetLineOffset(line+1)] = 0; DrawText(gc, box.left - miXOffset, box.top - miYOffset + (line * WEB_FONT_HEIGHT(font)), mpText + GetLineOffset(line), GetTextColor(gc), 0, 0, font); mpText[GetLineOffset(line+1)] = c; } // now draw the last line of text. DrawText(gc, box.left - miXOffset, box.top - miYOffset + (line*WEB_FONT_HEIGHT(font)), mpText + GetLineOffset(line), GetTextColor(gc), 0, 0, font); // if we have the focus, draw the cursor if ((mFlags & DISPLAY_FLAG_FOCUS) && !(mFlags & DISPLAY_FLAG_DISABLED)) { // now render the selected portion in reverse video (if we have one) if (mEditFlags & EDIT_FLAG_HAS_SELECTION) { long begin = EBSMIN(miCursorPos, miSelectBegin); long end = EBSMAX(miCursorPos, miSelectBegin); long beginLine = FindLine(begin), endLine = FindLine(end); DISPLAY_INT textLeft; long currentBegin, currentEnd; for (line=beginLine; line<=endLine; line++) { currentBegin = EBSMAX(begin, GetLineOffset(line)); if (line == endLine) { currentEnd = end; } else { currentEnd = EBSMIN(end, GetLineOffset(line+1)); } textLeft = gc->TextWidthLen(mpText + GetLineOffset(line), font, EBSMAX(0, begin - GetLineOffset(line))); c = mpText[currentEnd]; mpText[currentEnd] = 0; DrawText(gc, box.left - miXOffset + textLeft, box.top - miYOffset + (line*WEB_FONT_HEIGHT(font)), mpText + currentBegin, GetBgColor(gc), GetSelectColor(gc), 1, font); mpText[currentEnd] = c; } } DISPLAY_INT cursorX = box.left - miXOffset + gc->TextWidthLen(mpText + GetLineOffset(miCurrentLine), font, miCursorPos - GetLineOffset(miCurrentLine)) ; box.Set(cursorX, box.top - miYOffset + WEB_FONT_HEIGHT(font)*miCurrentLine, cursorX, box.top - miYOffset + WEB_FONT_HEIGHT(font)*(miCurrentLine+1)); gc->Rectangle(&box, GetSelectColor(gc), GetSelectColor(gc), 1); } } gc->SetClip(&clipSave); // restore the clip rectangle } // if clip overlaps /* if (mpVScroll && mpHScroll) { GetCornerRect(&box); box.Shift(x,y); gc->Rectangle(&box, LIGHTGRAY, LIGHTGRAY, 1); }*/ // gc->EndBuffer(); // send all buffered commands to the display }