当前位置: 首页>>代码示例>>C++>>正文


C++ GetAlpha函数代码示例

本文整理汇总了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;
		}
	}
}
开发者ID:careysky,项目名称:FlyFF,代码行数:27,代码来源:DomWidgetA.cpp

示例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);
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:11,代码来源:asw_vgui_computer_splash.cpp

示例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); }
	}

}
开发者ID:ds84182,项目名称:wiitweet,代码行数:12,代码来源:gui_infomsg.cpp

示例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;

}
开发者ID:nonakap,项目名称:xakane-gtkmm2,代码行数:39,代码来源:VnImage.cpp

示例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);
	}
}
开发者ID:blueantst,项目名称:dulib,代码行数:31,代码来源:duListBox.cpp

示例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);
	}
}
开发者ID:blueantst,项目名称:dulib,代码行数:34,代码来源:duOutlookBar.cpp

示例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;
 }
开发者ID:FlyingMinuteGames,项目名称:AgmdEngine,代码行数:7,代码来源:Color.cpp

示例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;
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:25,代码来源:analysis.c

示例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 );
}
开发者ID:hekar,项目名称:luminousforts-2013,代码行数:35,代码来源:MessageDialog.cpp

示例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);
}
开发者ID:djskual,项目名称:savegame-manager-gx,代码行数:26,代码来源:gui_cross.cpp

示例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();
    }
}
开发者ID:vader1986,项目名称:s25client,代码行数:36,代码来源:IngameMinimap.cpp

示例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;
}
开发者ID:MiyaxinPittahai,项目名称:s25rttr,代码行数:38,代码来源:Minimap.cpp

示例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 );	
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:33,代码来源:BaseShader.cpp

示例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());
}
开发者ID:tantaishan,项目名称:MyEcho,代码行数:8,代码来源:duSplitter.cpp

示例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);
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:17,代码来源:asw_vgui_computer_frame.cpp


注:本文中的GetAlpha函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。