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


C++ LKSurface::AlphaBlendNotWhite方法代码示例

本文整理汇总了C++中LKSurface::AlphaBlendNotWhite方法的典型用法代码示例。如果您正苦于以下问题:C++ LKSurface::AlphaBlendNotWhite方法的具体用法?C++ LKSurface::AlphaBlendNotWhite怎么用?C++ LKSurface::AlphaBlendNotWhite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LKSurface的用法示例。


在下文中一共展示了LKSurface::AlphaBlendNotWhite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawTerrainAbove

//
// Draw the reachable SHADED terrain glide amoeba
// This is not the outlined perimeter
//
void MapWindow::DrawTerrainAbove(LKSurface& Surface, const RECT& rc) {

  // Lets try to make it better understandable with a goto.
  // If CAR or GA users dont want amoeba, they should disable it in config. 
  // Otherwise we should paint it, not hide it automatically!
  // Here are the conditions we print this amoeba, otherwise we return;

  // First is we are in SIM mode and we changed the altitude;
  if (SIMMODE && DerivedDrawInfo.AltitudeAGL>100) goto _doit;

  // Second, if we are flying
  if (DerivedDrawInfo.Flying) goto _doit;

  if (DerivedDrawInfo.GlideFootPrint_valid)  goto _doit;
    
  return;

_doit:

#ifndef ENABLE_OPENGL
  LKColor whitecolor = LKColor(0xff,0xff,0xff);
  LKColor graycolor = LKColor(0xf0,0xf0,0xf0);
  LKColor origcolor = TempSurface.SetTextColor(whitecolor);

  TempSurface.SetBackgroundTransparent();

  TempSurface.SetBkColor(whitecolor);

  TempSurface.SelectObject(LK_WHITE_PEN);
  TempSurface.SetTextColor(graycolor);
  TempSurface.SelectObject(hAboveTerrainBrush);
  TempSurface.Rectangle(rc.left,rc.top,rc.right,rc.bottom);
  TempSurface.SelectObject(LK_WHITE_PEN);
  TempSurface.SelectObject(LKBrush_White);
  TempSurface.Polygon(Groundline.data(),Groundline.size());

  // need to do this to prevent drawing of colored outline
  TempSurface.SelectObject(LK_WHITE_PEN);
#ifdef HAVE_HATCHED_BRUSH
  Surface.TransparentCopy(
          rc.left,rc.top,
          rc.right-rc.left,rc.bottom-rc.top,
          TempSurface,
          rc.left,rc.top);
#else
  Surface.AlphaBlendNotWhite(rc, TempSurface, rc, 255/2);
#endif


  // restore original color
  TempSurface.SetTextColor(origcolor);
  TempSurface.SetBackgroundOpaque();
#else

    Canvas& canvas = Surface;
  
    const GLEnable<GL_STENCIL_TEST> stencil;
    
    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
    glDepthMask(GL_FALSE);
    glStencilFunc(GL_NEVER, 1, 0xFF);
    glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);  // draw 1s on test fail (always)

    // draw stencil pattern
    glStencilMask(0xFF);
    glClear(GL_STENCIL_BUFFER_BIT);  // needs mask=0xFF

    ScopeVertexPointer vp(Groundline.data());
    glDrawArrays(GL_TRIANGLE_FAN, 0, Groundline.size());

    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
    glDepthMask(GL_TRUE);
    glStencilMask(0x00);
    // draw where stencil's value is 0
    glStencilFunc(GL_EQUAL, 0, 0xFF);

    canvas.DrawFilledRectangle(rc.left,rc.top,rc.right,rc.bottom, AboveTerrainColor);

#endif  

}
开发者ID:LK8000,项目名称:LK8000,代码行数:85,代码来源:DrawTerrainAbove.cpp


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