本文整理汇总了C++中GetAlpha函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAlpha函数的具体用法?C++ GetAlpha怎么用?C++ GetAlpha使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetAlpha函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void CDDomWidgetA::MakeColor( D3DCOLOR& d3dcolor, DOMINATING_TEAM team )
{
if( m_ToBeDominated != DTEAM_NONE )
{
switch( team )
{
case DTEAM_A: d3dcolor = D3DCOLOR_ARGB( 0xFF, GetAlpha(), 0x00, 0x00 ); break;
case DTEAM_B: d3dcolor = D3DCOLOR_ARGB( 0xFF, 0x00, 0x00, GetAlpha() ); break;
default:
{
d3dcolor = 0xDAD5DBBA;
}break;
}
}
else
{
switch( team )
{
case DTEAM_A: d3dcolor = 0xFFE01B1B; break;
case DTEAM_B: d3dcolor = 0xFF3C47DE; break;
default:
{
d3dcolor = 0xDAD5DBBA;
}break;
}
}
}
示例2: if
void CASW_VGUI_Computer_Splash::SetHidden(bool bHidden)
{
if (bHidden && GetAlpha() > 0)
{
vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 0, 0, 0.7f, vgui::AnimationController::INTERPOLATOR_LINEAR);
}
else if (!bHidden && GetAlpha() <= 0)
{
vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 255, 0, 0.7f, vgui::AnimationController::INTERPOLATOR_LINEAR);
}
}
示例3: SetAlpha
void GuiInfomsg::Update(GuiTrigger * t)
{
if(GetAlpha() == 0){
return;
}
if(difftime(time(NULL), timer) >= 2.0f){
SetAlpha(GetAlpha()-10);
if(GetAlpha() < 0){ SetAlpha(0); }
}
}
示例4: src_rect
/* ================================================================
コピー。
ソース画像が透明色を持っていない場合はmemory-to-memoryコピー
そうでない場合は1pixelづつコピー
================================================================ */
void VnImage::Copy(const VnImage& img, const VnRect& srcRect, int dx, int dy)
{
// 範囲内のチェック
VnRect src_rect(0, 0, img.Width(), img.Height());
src_rect &= srcRect;
VnRect dst_rect(0, 0, Width(), Height());
dst_rect &= VnRect(dx, dy, src_rect.width, src_rect.height);
if (GetAlpha(img.mTransColor) == 0xff) {
// 不透明画像をコピー
for(int y = 0; y < dst_rect.height; ++y) {
memcpy(GetPixelBuf(dst_rect.x, dst_rect.y + y), img.GetPixelBuf(src_rect.x, src_rect.y + y), dst_rect.width * 4);
}
} else {
const u_int32_t trans_color = ToMachineColor(img.mTransColor & 0xffffff00);
// 透明色を考慮したコピー
for(int y = 0; y < dst_rect.height; ++y) {
const u_int32_t* src = img.GetPixelBuf(src_rect.x, src_rect.y + y);
u_int32_t* dst = GetPixelBuf(dst_rect.x, dst_rect.y + y);
for(int x = 0; x < dst_rect.width; ++x, ++dst, ++src) {
// ソースが透明色でない場合に書き込む
// リトルエンディアン限定(:TODO:)
if (trans_color != (*src & 0x00ffffff)) {
*dst = *src;
}
}
}
} // end of if (GetAlpha ...)
// cerr << "VnImage::Copy " << t.GetPassed() << "(s)" << endl;
}
示例5: Plugin_GetRect
void WINAPI duListBox::DrawObject(HDC hDC)
{
duRect rcListBox;
Plugin_GetRect(this, &rcListBox);
rcListBox.OffsetRect(-rcListBox.left, -rcListBox.top);
duStyleGroup *pStyleGroup = (duStyleGroup *)GetResObj(GetStyle(), DU_RES_STYLEGROUP);
if (pStyleGroup)
pStyleGroup->Draw(hDC, &rcListBox, GetState(), GetText(), GetAlpha());
pStyleGroup = (duStyleGroup *)GetResObj(m_szItemStyle, DU_RES_STYLEGROUP);
if (pStyleGroup == NULL)
return;
duRect rcItem;
rcItem.SetRectEmpty();
rcItem.right = rcListBox.Width();
rcItem.OffsetRect(0, -m_nYOffset);
ListBoxItem *pItem = NULL;
int i;
int nItemCount = GetItemCount();
for (i = 0;i < nItemCount; i++)
{
pItem = m_vtItem[i];
rcItem.top = rcItem.bottom;
rcItem.bottom = rcItem.top + m_nItemHeight;
DrawItem(pItem, hDC, pStyleGroup, rcItem);
}
}
示例6: GetRect
void WINAPI duOutlookBar::DrawObject(HDC hDC)
{
duRect rect;
GetRect(&rect);
rect.OffsetRect(-rect.left, -rect.top);
duStyleGroup *pStyleGroup = (duStyleGroup *)GetResObj(GetStyle(), DU_RES_STYLEGROUP);
if (pStyleGroup)
pStyleGroup->Draw(hDC, &rect, DU_STATE_ALL, GetText(), GetAlpha());
duStyleGroup *pItemStyleGroup = (duStyleGroup *)GetResObj(m_szItemStyle, DU_RES_STYLEGROUP);
if (pItemStyleGroup == NULL)
return ;
int i;
OutlookBarItem *pOutlookBarItem = NULL;
int nItemCount = GetItemCount();
duRect rectItem = rect;
rectItem.bottom = rectItem.top + m_nItemHeight;
for (i = 0;i < nItemCount; i++)
{
pOutlookBarItem = m_vtItems[i];
pItemStyleGroup->Draw(hDC, &rectItem, pOutlookBarItem->iState, pOutlookBarItem->strText.c_str(), GetAlpha());
if (pOutlookBarItem->fSelected)
{
rectItem.top = rect.bottom - (nItemCount - i - 1) * m_nItemHeight;
rectItem.bottom = rectItem.top + m_nItemHeight;
}
else
rectItem.OffsetRect(0, m_nItemHeight);
}
}
示例7: GetRed
void Color::ToFloat(float Dest[]) const
{
Dest[0] = GetRed() / 255.0f;
Dest[1] = GetGreen() / 255.0f;
Dest[2] = GetBlue() / 255.0f;
Dest[3] = GetAlpha() / 255.0f;
}
示例8: MBAnalyzeBestIntra16Mode
static int MBAnalyzeBestIntra16Mode(VP8EncIterator* const it) {
const int max_mode =
(it->enc_->method_ >= FAST_ANALYSIS_METHOD) ? MAX_INTRA16_MODE
: NUM_PRED_MODES;
int mode;
int best_alpha = DEFAULT_ALPHA;
int best_mode = 0;
VP8MakeLuma16Preds(it);
for (mode = 0; mode < max_mode; ++mode) {
VP8Histogram histo = { { 0 } };
int alpha;
VP8CollectHistogram(it->yuv_in_ + Y_OFF,
it->yuv_p_ + VP8I16ModeOffsets[mode],
0, 16, &histo);
alpha = GetAlpha(&histo);
if (IS_BETTER_ALPHA(alpha, best_alpha)) {
best_alpha = alpha;
best_mode = mode;
}
}
VP8SetIntra16Mode(it, best_mode);
return best_alpha;
}
示例9: GetSize
//-----------------------------------------------------------------------------
// 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 );
}
示例10: GX_SetTevOp
void GuiCross::Draw()
{
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
f32 x1 = GetLeft();
f32 x2 = x1 + width;
f32 y1 = GetTop();
f32 y2 = y1 + height;
int alpha = GetAlpha();
GX_Begin(GX_LINES, GX_VTXFMT0, 4);
GX_Position3f32(x1, y1, 0.0f);
GX_Color4u8(color.r, color.g, color.b, alpha);
GX_Position3f32(x2, y2, 0.0f);
GX_Color4u8(color.r, color.g, color.b, alpha);
GX_Position3f32(x2, y1, 0.0f);
GX_Color4u8(color.r, color.g, color.b, alpha);
GX_Position3f32(x1, y2, 0.0f);
GX_Color4u8(color.r, color.g, color.b, alpha);
GX_End();
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
}
示例11: UpdateAll
/**
* Additional stuff we need to do before drawing (in this case: update the map)
*/
void IngameMinimap::BeforeDrawing()
{
// Ab welcher Knotenanzahl (Teil der Gesamtknotenanzahl) die Textur komplett neu erstellt werden soll
static const unsigned MAX_NODES_UPDATE_DENOMINATOR = 2; // (2 = 1/2, 3 = 1/3 usw.)
if(!nodesToUpdate.empty())
{
// Komplette Textur neu erzeugen, weil es zu viele Knoten sind?
if(nodesToUpdate.size() >= map_width * map_height / MAX_NODES_UPDATE_DENOMINATOR)
{
// Ja, alles neu erzeugen
UpdateAll();
for(MapPoint p(0, 0); p.y < map_height; p.y++)
for(p.x = 0; p.x < map_width; p.x++)
nodes_updated[GetMMIdx(p)] = false;
} else
{
// Entsprechende Pixel updaten
for(std::vector<MapPoint>::iterator it = nodesToUpdate.begin(); it != nodesToUpdate.end(); ++it)
{
for(unsigned t = 0; t < 2; ++t)
{
unsigned color = CalcPixelColor(*it, t);
map.tex_setPixel((it->x * 2 + t + (it->y & 1)) % (map_width * 2), it->y, GetRed(color), GetGreen(color),
GetBlue(color), GetAlpha(color));
}
nodes_updated[GetMMIdx(*it)] = false;
}
}
this->nodesToUpdate.clear();
}
}
示例12: CalcPixelColor
/**
*
* @author OLiver
*/
void Minimap::CreateMapTexture(const void *param)
{
map.DeleteTexture();
if(!param)
return;
/// Buffer für die Daten erzeugen
unsigned char *buffer = new unsigned char[map_width * 2 * map_height * 4];
for(MapCoord y = 0;y<map_height;++y)
{
for(MapCoord x = 0;x<map_width;++x)
{
// Die 2. Terraindreiecke durchgehen
for(unsigned t = 0;t<2;++t)
{
unsigned color = CalcPixelColor(param,x,y,t);
unsigned pos = y*map_width*4*2+(x*4*2+t*4+(y&1)*4)%(map_width*4*2);
buffer[pos+2] = GetRed(color);
buffer[pos+1] = GetGreen(color);
buffer[pos] = GetBlue(color);
buffer[pos+3] = GetAlpha(color);
}
}
}
map.setFilter(GL_LINEAR);
map.create(map_width*2, map_height, buffer, map_width*2, map_height,
libsiedler2::FORMAT_RGBA, LOADER.GetPaletteN("pal5"));
delete [] buffer;
}
示例13: Assert
//-----------------------------------------------------------------------------
// Sets the color + transparency
//-----------------------------------------------------------------------------
void CBaseShader::SetColorState( int colorVar, bool setAlpha )
{
Assert( !IsSnapshotting() );
if ( !s_ppParams )
return;
// Use tint instead of color if it was specified...
IMaterialVar* pColorVar = (colorVar != -1) ? s_ppParams[colorVar] : 0;
float color[4] = { 1.0, 1.0, 1.0, 1.0 };
if (pColorVar)
{
if (pColorVar->GetType() == MATERIAL_VAR_TYPE_VECTOR)
{
pColorVar->GetVecValue( color, 3 );
}
else
{
color[0] = color[1] = color[2] = pColorVar->GetFloatValue();
}
// Clamp...
color[0] = clamp( color[0], 0.0f, 1.0f );
color[1] = clamp( color[1], 0.0f, 1.0f );
color[2] = clamp( color[2], 0.0f, 1.0f );
}
color[3] = setAlpha ? GetAlpha() : 1.0f;
s_pShaderAPI->Color4fv( color );
}
示例14: Plugin_GetRect
void duSplitter::DrawObject(HDC hDC)
{
duRect rectSplitter;
Plugin_GetRect(this, &rectSplitter);
rectSplitter.OffsetRect(-rectSplitter.left, -rectSplitter.top);
DrawByStyle(this, GetStyle(), hDC, &rectSplitter, GetState(), GetText(), GetAlpha());
}
示例15: ASWGameRules
void CASW_VGUI_Computer_Container::OnThink()
{
BaseClass::OnThink();
float fDeathCamInterp = ASWGameRules()->GetMarineDeathCamInterp();
if ( fDeathCamInterp > 0.0f && GetAlpha() >= 255 )
{
SetAlpha( 254 );
vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 0, 0, 0.5f, vgui::AnimationController::INTERPOLATOR_LINEAR);
}
else if ( fDeathCamInterp <= 0.0f && GetAlpha() <= 0 )
{
SetAlpha( 1 );
vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 255, 0, 0.5f, vgui::AnimationController::INTERPOLATOR_LINEAR);
}
}