本文整理汇总了C++中Blend函数的典型用法代码示例。如果您正苦于以下问题:C++ Blend函数的具体用法?C++ Blend怎么用?C++ Blend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Blend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BackgroundDraw
void cUIControl::Draw() {
if ( mVisible ) {
if ( mFlags & UI_FILL_BACKGROUND )
BackgroundDraw();
if ( mFlags & UI_BORDER )
BorderDraw();
if ( NULL != mSkinState )
mSkinState->Draw( (eeFloat)mScreenPos.x, (eeFloat)mScreenPos.y, (eeFloat)mSize.Width(), (eeFloat)mSize.Height(), 255 );
if ( cUIManager::instance()->HighlightFocus() && cUIManager::instance()->FocusControl() == this ) {
cPrimitives P;
P.FillMode( DRAW_LINE );
P.BlendMode( Blend() );
P.SetColor( cUIManager::instance()->HighlightFocusColor() );
P.DrawRectangle( GetRectf() );
}
if ( cUIManager::instance()->HighlightOver() && cUIManager::instance()->OverControl() == this ) {
cPrimitives P;
P.FillMode( DRAW_LINE );
P.BlendMode( Blend() );
P.SetColor( cUIManager::instance()->HighlightOverColor() );
P.DrawRectangle( GetRectf() );
}
}
}
示例2: Blend
void WatchEdit::HighlightLine(int line, Vector<Highlight>& h, int pos)
{
Color cEven = Blend(SColorInfo, White, 220);
Color cOdd = Blend(SColorInfo, White, 128);
for(int i = 0; i < h.GetCount(); i++)
h[i].paper = (line % 2 ? cOdd : cEven);
}
示例3: colonne
// Colonne
float colonne(in vec3 p, in vec3 a, in vec3 b, float rayon, float e, float R){
float d;
float offset = 0.28;
float offsetCube = 0.15;
d = cylindre(p, a, b, rayon, e, R);
for(float i=0.0;i<12.0; i++){
vec3 pos = vec3(cos(i*3.14/6.0)*(rayon+rayon*offset), 0.0, sin(i*3.14/6.0)*(rayon+rayon*offset) );
vec3 newA = pos + a;//vec3(a.x + cos(i*3.14/6.0)*(rayon+rayon*offset), a.y + 0.0, a.z + sin(i*3.14/6.0)*(rayon+rayon*offset) );
vec3 newB = pos + b;//vec3(b.x + cos(i*3.14/6.0)*(rayon+rayon*offset), b.y - 0.0, b.z + sin(i*3.14/6.0)*(rayon+rayon*offset) );
d = Difference(d, cylindre( p, newA, newB, rayon/6.0, e, R/6.0 ) );
}
float d2 = disque(p, a-vec3(0,R*0.7,0), normalize(b-a),rayon*1.5, e, R);
d2 = Blend(d2,disque(p, b+vec3(0,R*0.7,0), normalize(a-b),rayon*1.5, e, R));
d2 = Blend(d2, cube(p, vec3(a.x, a.y-R, a.z), vec3( (rayon)*4., offsetCube, (rayon)*4. ), e, 0.1 ));
d2 = Blend(d2, cube(p, vec3(b.x, b.y+R, b.z), vec3( (rayon)*4., offsetCube, (rayon)*4. ), e, 0.1 ));
d = Union(d,d2);
return d;
}
示例4: MovingSprite
Candle::Candle(const Reader& lisp)
: MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED),
burning(true),
flicker(true),
lightcolor(1.0f, 1.0f, 1.0f),
candle_light_1(sprite_manager->create("images/objects/candle/candle-light-1.sprite")),
candle_light_2(sprite_manager->create("images/objects/candle/candle-light-2.sprite"))
{
lisp.get("name", name);
lisp.get("burning", burning);
lisp.get("flicker", flicker);
//get color from lisp
std::vector<float> vColor;
lisp.get("color", vColor);
//change the light color if defined
if (vColor.size() >= 3) {
lightcolor = Color(vColor);
candle_light_1->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
candle_light_2->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
candle_light_1->set_color(lightcolor);
candle_light_2->set_color(lightcolor);
//the following allows the original candle appearance to be preserved
candle_light_1->set_action("white");
candle_light_2->set_action("white");
}
if (burning) {
sprite->set_action("on");
} else {
sprite->set_action("off");
}
}
示例5: MovingSprite
Candle::Candle(const ReaderMapping& lisp)
: MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED),
ExposedObject<Candle, scripting::Candle>(this),
burning(true),
flicker(true),
lightcolor(1.0f, 1.0f, 1.0f),
candle_light_1(SpriteManager::current()->create("images/objects/candle/candle-light-1.sprite")),
candle_light_2(SpriteManager::current()->create("images/objects/candle/candle-light-2.sprite"))
{
lisp.get("burning", burning, true);
lisp.get("flicker", flicker, true);
std::vector<float> vColor;
if(!lisp.get("color", vColor)) vColor = {1.0f, 1.0f, 1.0f};
//change the light color if defined
if (vColor.size() >= 3) {
lightcolor = Color(vColor);
candle_light_1->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
candle_light_2->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
candle_light_1->set_color(lightcolor);
candle_light_2->set_color(lightcolor);
//the following allows the original candle appearance to be preserved
candle_light_1->set_action("white");
candle_light_2->set_action("white");
}
if (burning) {
sprite->set_action("on");
} else {
sprite->set_action("off");
}
}
示例6: UpdateTrayMenuColors
void UpdateTrayMenuColors()
{
if (!pEBMenuTray) return;
if (!dwNoOwnerDrawMenu)
{
if (dwUseSystemColors)
{
pEBMenuTray->crFontColorOne = GetSysColor(COLOR_HIGHLIGHTTEXT);
pEBMenuTray->crFontColorTwo = Blend(GetSysColor(COLOR_3DDKSHADOW), GetSysColor(COLOR_HIGHLIGHT), 0.6);
pEBMenuTray->crFontColorThree = GetSysColor(COLOR_MENUTEXT);
pEBMenuTray->crBkColorOne = Blend(GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_HIGHLIGHT), 0.2);
pEBMenuTray->crBkColorTwo = GetSysColor(COLOR_MENU);
pEBMenuTray->crBkColorThree = GetMenuBarColor();
pEBMenuTray->crSelColorOne = GetSysColor(COLOR_HIGHLIGHT);
pEBMenuTray->crSelColorTwo = Blend(GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_HIGHLIGHT), 0.1);
pEBMenuTray->crBrColorOne = Blend(GetSysColor(COLOR_HIGHLIGHT), GetSysColor(COLOR_BTNTEXT), 0.1);
pEBMenuTray->crBrColorTwo = Blend(GetSysColor(COLOR_3DHIGHLIGHT), GetSysColor(COLOR_HIGHLIGHT), 0.1);
}
else
{
pEBMenuTray->crFontColorOne = dwTextColor;
pEBMenuTray->crFontColorTwo = dwTextShadowColor;
pEBMenuTray->crFontColorThree = GetSysColor(COLOR_MENUTEXT);
pEBMenuTray->crBkColorOne = dwBackgroundColor;
pEBMenuTray->crBkColorTwo = GetSysColor(COLOR_MENU);
pEBMenuTray->crBkColorThree = GetMenuBarColor();
pEBMenuTray->crSelColorOne = dwGradientColor1;
pEBMenuTray->crSelColorTwo = dwGradientColor2;
pEBMenuTray->crBrColorOne = dwBorderColor1;
pEBMenuTray->crBrColorTwo = dwBorderColor2;
}
}
}
示例7: BindTexture
void Renderer::SetupShader(Shader *shader, int lm_index) {
// the light map could change even though we have the same shaders
// check and set new lightmap, leave everthing else the same
if (shader == current_shader_ && lm_index != -1) {
if (lm_index == current_lightmap_) {
return;
}
if (shader->lightmap_stage_ == -1) {
return;
}
current_lightmap_ = lm_index;
BindTexture(shader->lightmap_stage_, textureLoader::GetLightmap(lm_index));
++num_skipped_shaders_;
return;
}
// THIS ONLY DISABLES BLENDING BUT WE WANT TO ALWAYS BLEND.. maybe
// if (current_shader_ != 0)
//{
// FinishShader(*current_shader_);
//}
// current_shader_ = shader;
// JUST ENABLE BLENDING ALL THE TIME AND BLEND NON TRANSLUCENT TEXTURES WITH
// ONE ZERO
// only enable blending if stage 0 wants to blend with background
// shaders can only blend with textures
// if (i == 0 && stage.blendfunc[0] == GL_ONE && stage.blendfunc[1] == GL_ONE)
//{
if (shader->q3_shader_.stages_.size() > 0) {
Blend(true);
BlendFunc(shader->q3_shader_.stages_[0].blendfunc[0],
shader->q3_shader_.stages_[0].blendfunc[1]);
} else {
Blend(false);
}
// BlendFunc(GL_ONE, GL_ZERO);
//}
for (unsigned int i = 0; i < shader->q3_shader_.stages_.size(); ++i) {
// maybe put lightmap directly into stage so we dont need this if
// seems we can optimize it by first only checking lm_index
if (i == shader->lightmap_stage_ && lm_index != -1) {
BindTexture(i, textureLoader::GetLightmap(lm_index));
current_lightmap_ = lm_index;
} else {
BindTexture(i, shader->texture_id_[i]);
}
}
}
示例8: PickColor
void PickColor(float t, float &r, float &g, float &b)
{
if(t < gSwingDownOptimalTimeMin)
Blend(t * 1.0f / gSwingDownOptimalTimeMin, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, r, g, b);
else if(t > gSwingDownOptimalTimeMax)
Blend(1.0f - ((t - gSwingDownOptimalTimeMax) * gSwingDownLatePunishment), 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, r, g, b);
else
{
r = 0.0f;
b = 0.0f;
g = 1.0f;
}
}
示例9: Blend
CG32bitPixel CG32bitPixel::Blend3 (CG32bitPixel rgbNegative, CG32bitPixel rgbCenter, CG32bitPixel rgbPositive, double rFade)
// Fade3
//
// Fades from negative to center to positive.
{
if (rFade < 0.0)
return Blend(rgbNegative, rgbCenter, rFade + 1.0);
else if (rFade > 0.0)
return Blend(rgbCenter, rgbPositive, rFade);
else
return rgbCenter;
}
示例10: GetSize
void RightTabs::Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, Blend(SColorFace, SColorPaper));
Color hc = Blend(Yellow, LtRed, 100);
Color inactive = Blend(SColorPaper, SColorShadow);
for(int i = 0; i < tab.GetCount(); i++) {
Tab& t = tab[i];
if(i != cursor)
PaintTab(w, 0, t.y + 2, cx - 1, t.GetHeight() - 1, inactive, t.img, i == hl ? hc : Null);
}
if(cursor >= 0) {
Tab& t = tab[cursor];
PaintTab(w, 0, t.y, cx, t.GetHeight() + 3, SColorPaper, t.img, cursor == hl ? hc : Null);
}
}
示例11: glBindTexture
void
GLPainter::draw_surface_part(const DrawingRequest& request)
{
const SurfacePartRequest* surfacepartrequest
= (SurfacePartRequest*) request.request_data;
const Surface* surface = surfacepartrequest->surface;
std::shared_ptr<GLTexture> gltexture = std::dynamic_pointer_cast<GLTexture>(surface->get_texture());
GLSurfaceData *surface_data = reinterpret_cast<GLSurfaceData *>(surface->get_surface_data());
float uv_width = surface_data->get_uv_right() - surface_data->get_uv_left();
float uv_height = surface_data->get_uv_bottom() - surface_data->get_uv_top();
float uv_left = surface_data->get_uv_left() + (uv_width * surfacepartrequest->srcrect.p1.x) / surface->get_width();
float uv_top = surface_data->get_uv_top() + (uv_height * surfacepartrequest->srcrect.p1.y) / surface->get_height();
float uv_right = surface_data->get_uv_left() + (uv_width * surfacepartrequest->srcrect.p2.x) / surface->get_width();
float uv_bottom = surface_data->get_uv_top() + (uv_height * surfacepartrequest->srcrect.p2.y) / surface->get_height();
GLuint th = gltexture->get_handle();
if (th != s_last_texture) {
s_last_texture = th;
glBindTexture(GL_TEXTURE_2D, th);
}
intern_draw(request.pos.x, request.pos.y,
request.pos.x + surfacepartrequest->dstsize.width,
request.pos.y + surfacepartrequest->dstsize.height,
uv_left,
uv_top,
uv_right,
uv_bottom,
0.0,
request.alpha,
request.color,
Blend(),
request.drawing_effect);
}
示例12: type
Flower::Flower(BonusType _type) :
type(_type),
sprite(),
drawing_effect(NO_EFFECT),
light(1.0f,1.0f,1.0f),
lightsprite(SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
{
bbox.set_size(32, 32);
lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
if(type == FIRE_BONUS) {
sprite = SpriteManager::current()->create("images/powerups/fireflower/fireflower.sprite");
SoundManager::current()->preload("sounds/fire-flower.wav");
lightsprite->set_color(Color(0.3f, 0.0f, 0.0f));
}
else if(type == ICE_BONUS) {
sprite = SpriteManager::current()->create("images/powerups/iceflower/iceflower.sprite");
SoundManager::current()->preload("sounds/fire-flower.wav");
lightsprite->set_color(Color(0.0f, 0.1f, 0.2f));
}
else if(type == AIR_BONUS) {
sprite = SpriteManager::current()->create("images/powerups/airflower/airflower.sprite");
SoundManager::current()->preload("sounds/fire-flower.wav");
lightsprite->set_color(Color(0.15f, 0.0f, 0.15f));
}
else if(type == EARTH_BONUS) {
sprite = SpriteManager::current()->create("images/powerups/earthflower/earthflower.sprite");
SoundManager::current()->preload("sounds/fire-flower.wav");
lightsprite->set_color(Color(0.0f, 0.3f, 0.0f));
} else {
assert(false);
}
set_group(COLGROUP_TOUCHABLE);
}
示例13: MovingSprite
PowerUp::PowerUp(const ReaderMapping& lisp) :
MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING),
physic(),
script(),
no_physics(),
light(0.0f,0.0f,0.0f),
lightsprite(SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
{
if (!lisp.get("script", script)) script = "";
if (!lisp.get("disable-physics", no_physics)) no_physics = false;
physic.enable_gravity(true);
SoundManager::current()->preload("sounds/grow.ogg");
SoundManager::current()->preload("sounds/fire-flower.wav");
SoundManager::current()->preload("sounds/gulp.wav");
//set default light for glow effect for standard sprites
lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
lightsprite->set_color(Color(0.0f, 0.0f, 0.0f));
if (sprite_name == "images/powerups/egg/egg.sprite") {
lightsprite->set_color(Color(0.2f, 0.2f, 0.0f));
} else if (sprite_name == "images/powerups/fireflower/fireflower.sprite") {
lightsprite->set_color(Color(0.3f, 0.0f, 0.0f));
} else if (sprite_name == "images/powerups/iceflower/iceflower.sprite") {
lightsprite->set_color(Color(0.0f, 0.1f, 0.2f));
} else if (sprite_name == "images/powerups/airflower/airflower.sprite") {
lightsprite->set_color(Color(0.15f, 0.0f, 0.15f));
} else if (sprite_name == "images/powerups/earthflower/earthflower.sprite") {
lightsprite->set_color(Color(0.0f, 0.3f, 0.0f));
} else if (sprite_name == "images/powerups/star/star.sprite") {
lightsprite->set_color(Color(0.4f, 0.4f, 0.4f));
}
}
示例14: CH_STYLE
NAMESPACE_UPP
CH_STYLE(MultiButton, Style, StyleDefault)
{
for(int i = 0; i < 4; i++) {
simple[i] = left[i] = right[i] = lmiddle[i] = rmiddle[i]
= Button::StyleEdge().look[i];
monocolor[i] = Button::StyleEdge().monocolor[i];
fmonocolor[i] = i == 3 ? SColorDisabled() : SColorText();
look[i] = trivial[i] = ChLookWith(simple[i], CtrlsImg::DA(), monocolor[i]);
edge[i] = EditFieldEdge();
}
activeedge = false;
trivialborder = DPI(1);
border = DPI(1);
pressoffset = Button::StyleEdge().pressoffset;
sep1 = SColorHighlight();
sep2 = SColorLight();
sepm = DPI(2);
stdwidth = FrameButtonWidth();
trivialsep = false;
margin = Rect(DPI(2), 2, DPI(2), 2);
usetrivial = false;
overpaint = loff = roff = 0;
error = Blend(LtRed(), Red());
}
示例15: sprite
SpriteParticle::SpriteParticle(std::string sprite_name, std::string action,
Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration,
int drawing_layer) :
sprite(),
position(position),
velocity(velocity),
acceleration(acceleration),
drawing_layer(drawing_layer),
light(0.0f,0.0f,0.0f),
lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")),
glow(false)
{
sprite = sprite_manager->create(sprite_name);
if (!sprite.get()) throw std::runtime_error("Could not load sprite "+sprite_name);
sprite->set_action(action, 1);
sprite->set_animation_loops(1); //TODO: this is necessary because set_action will not set "loops" when "action" is the default action
this->position -= get_anchor_pos(sprite->get_current_hitbox(), anchor);
if(sprite_name=="images/objects/particles/sparkle.sprite")
glow = true;
if(action=="dark") {
lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
lightsprite->set_color(Color(0.1f, 0.1f, 0.1f));
}
}