• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetAlpha函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetAlpha函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAlpha函数的具体用法?C++ GetAlpha怎么用?C++ GetAlpha使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetAlpha函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Modulate

    Color Color::Modulate(const Color& c) const
    {
        uint8 R = static_cast<uint8>(GetRed()   * c.GetRed()   / 255);
        uint8 G = static_cast<uint8>(GetGreen() * c.GetGreen() / 255);
        uint8 B = static_cast<uint8>(GetBlue()  * c.GetBlue()  / 255);
        uint8 A = static_cast<uint8>(GetAlpha() * c.GetAlpha() / 255);

        return Color(R, G, B, A);
    }
开发者ID:FlyingMinuteGames,项目名称:AgmdEngine,代码行数:9,代码来源:Color.cpp


示例17: NUM2CHR

sf::Color rbColor::ToSFML( VALUE aColor )
{
    aColor = rbColor::ToRuby( aColor );
    sf::Uint8 r = NUM2CHR( GetRed( aColor ) );
    sf::Uint8 g = NUM2CHR( GetGreen( aColor ) );
    sf::Uint8 b = NUM2CHR( GetBlue( aColor ) );
	sf::Uint8 a = NUM2CHR( GetAlpha( aColor ) );
    return sf::Color( r, g, b, a );
}
开发者ID:CaptainJet,项目名称:rbSFML,代码行数:9,代码来源:Color.hpp


示例18: GetBlendMode

void SkeletonSprite::Render() const {
	// TAREA: Implementar la especificacion del enunciado
	Renderer::Instance().SetBlendMode( GetBlendMode() );
	Renderer::Instance().SetColor( GetRed(), GetGreen(), GetBlue(), GetAlpha() );
	glPushMatrix();
	glTranslated( GetX(), GetY(), 0 );
	root->Render();
	glPopMatrix();
}
开发者ID:CarlosCasVen,项目名称:UTad,代码行数:9,代码来源:skeletonsprite.cpp


示例19: GenerateTexture

/**
 *  Zeichnet die Textur.
 *
 *  @author FloSoft
 */
void glArchivItem_Bitmap::Draw(short dst_x, short dst_y, short dst_w, short dst_h, short src_x, short src_y, short src_w, short src_h, const unsigned int color, const unsigned int unused)
{
    if(texture == 0)
        GenerateTexture();
    if(texture == 0)
        return;

    if(src_w == 0)
        src_w = width_;
    if(src_h == 0)
        src_h = height_;
    if(dst_w == 0)
        dst_w = src_w;
    if(dst_h == 0)
        dst_h = src_h;

    VIDEODRIVER.BindTexture(texture);

    assert(getBobType() != libsiedler2::BOBTYPE_BITMAP_PLAYER);

    struct GL_T2F_C4UB_V3F_Struct
    {
        GLfloat tx, ty;
        GLubyte r, g, b, a;
        GLfloat x, y, z;
    };

    GL_T2F_C4UB_V3F_Struct tmp[4];

    int x = -nx_ + dst_x;
    int y = -ny_ + dst_y;

    tmp[0].x = tmp[1].x = GLfloat(x);
    tmp[2].x = tmp[3].x = GLfloat(x + dst_w);

    tmp[0].y = tmp[3].y = GLfloat(y);
    tmp[1].y = tmp[2].y = GLfloat(y + dst_h);

    tmp[0].z = tmp[1].z = tmp[2].z = tmp[3].z = 0.0f;

    tmp[0].tx = tmp[1].tx = (GLfloat)src_x / tex_width_;
    tmp[2].tx = tmp[3].tx = (GLfloat)(src_x + src_w) / tex_width_;

    tmp[0].ty = tmp[3].ty = (GLfloat)src_y / tex_height_;
    tmp[1].ty = tmp[2].ty = (GLfloat)(src_y + src_h) / tex_height_;

    tmp[0].r = tmp[1].r = tmp[2].r = tmp[3].r = GetRed(color);
    tmp[0].g = tmp[1].g = tmp[2].g = tmp[3].g = GetGreen(color);
    tmp[0].b = tmp[1].b = tmp[2].b = tmp[3].b = GetBlue(color);
    tmp[0].a = tmp[1].a = tmp[2].a = tmp[3].a = GetAlpha(color);

    glInterleavedArrays(GL_T2F_C4UB_V3F, 0, tmp);
    glDrawArrays(GL_QUADS, 0, 4);

    return;
}
开发者ID:Ribosom,项目名称:s25client,代码行数:61,代码来源:glArchivItem_Bitmap.cpp


示例20: MBAnalyzeBestIntra4Mode

static int MBAnalyzeBestIntra4Mode(VP8EncIterator* const it,
                                   int best_alpha) {
  uint8_t modes[16];
  const int max_mode =
      (it->enc_->method_ >= FAST_ANALYSIS_METHOD) ? MAX_INTRA4_MODE
                                                  : NUM_BMODES;
  int i4_alpha;
  VP8Histogram total_histo = { { 0 } };
  int cur_histo = 0;

  VP8IteratorStartI4(it);
  do {
    int mode;
    int best_mode_alpha = DEFAULT_ALPHA;
    VP8Histogram histos[2];
    const uint8_t* const src = it->yuv_in_ + Y_OFF + VP8Scan[it->i4_];

    VP8MakeIntra4Preds(it);
    for (mode = 0; mode < max_mode; ++mode) {
      int alpha;

      memset(&histos[cur_histo], 0, sizeof(histos[cur_histo]));
      VP8CollectHistogram(src, it->yuv_p_ + VP8I4ModeOffsets[mode],
                          0, 1, &histos[cur_histo]);
      alpha = GetAlpha(&histos[cur_histo]);
      if (IS_BETTER_ALPHA(alpha, best_mode_alpha)) {
        best_mode_alpha = alpha;
        modes[it->i4_] = mode;
        cur_histo ^= 1;   // keep track of best histo so far.
      }
    }
    // accumulate best histogram
    MergeHistograms(&histos[cur_histo ^ 1], &total_histo);
    // Note: we reuse the original samples for predictors
  } while (VP8IteratorRotateI4(it, it->yuv_in_ + Y_OFF));

  i4_alpha = GetAlpha(&total_histo);
  if (IS_BETTER_ALPHA(i4_alpha, best_alpha)) {
    VP8SetIntra4Mode(it, modes);
    best_alpha = i4_alpha;
  }
  return best_alpha;
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:43,代码来源:analysis.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetAncestor函数代码示例发布时间:2022-05-30
下一篇:
C++ GetAllianceFlagPickerGUID函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap