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


C++ CFrame::getBackground方法代码示例

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


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

示例1: draw

void CScrollerView::draw(CDrawContext *dstcon)
{
  CPoint cp;
  CRect  cr;
  int x,y,w,h;
  int bar = 0;
  
	setDirty(false);
  if(mParam) bar += mParam->IsBipolar() ? 0: 1;

  w = mLedbmp->getWidth();
  h = mLedbmp->getHeight();

  switch(mType)
  {
  case kScTpVS:
    x = size.left + mHmLeft;
    y = size.top + mHmTop;
    cr = CRect(x,y, x+LEDBAR_WIDTH, y+LEDBAR_HEIGHT);
    cp = CPoint(bar*LEDBAR_WIDTH, (mLedbarValue/2)*LEDBAR_HEIGHT);
    mLedbmp->draw(dstcon, cr, cp);
    break;

  case kScTpHB:
    x = size.left + 1 + mHmLeft;
    y = size.top - 1 + mHmTop;
    cr = CRect(x,y, x+w, y+h);
    int v,b;

    if(bar)
    {
      v = 63-mLedbarValue;;
      for(int l=0; l<10; l++)
      {
        if(mFrame) 
			mFrame->getBackground()->draw(dstcon, cr, CPoint(x,y));
        b = v>7 ? v>16 ? 78-(v/12) : 7 : v<=0 ? 0 : v;
        b *= 36;
        mLedbmp->drawAlphaBlend(dstcon, cr, CPoint(0,0), b);
        cr.offset(w+1,0);
        v -= 6;
      }
    }
    else
    {
      if(mLedbarValue < 33)
      {
        v = 68-mLedbarValue;
        for(int l=0; l<10; l++)
        {
          if(mFrame) 
			  mFrame->getBackground()->draw(dstcon, cr, CPoint(x,y));
          b = l<4 ? 0 : v>7 ? v>16 ? 80-(v/6) : 7 : v<=0 ? 0 : v;
          b *= 36;
          mLedbmp->drawAlphaBlend(dstcon, cr, CPoint(0,0), b);
          cr.offset(w+1,0);
          v -= 6;
        }
      }
      else
      {
        v = mLedbarValue+3;
        cr.offset(9*(w+1),0);
        for(int l=0; l<10; l++)
        {
          if(mFrame) 
			  mFrame->getBackground()->draw(dstcon, cr, CPoint(x,y));
          b = l<4 ? 0 : v>7 ? v>16 ? 80-(v/6) : 7 : v<=0 ? 0 : v;
          b *= 36;
          mLedbmp->drawAlphaBlend(dstcon, cr, CPoint(0,0), b);
          cr.offset(-(w+1),0);
          v -= 6;
        }
      }
    }
    break;
  }

#if 0
  mHitmap->drawAlphaBlend(dstcon, size, cp(0,0));
#endif
}
开发者ID:BernCPlusPlus,项目名称:NeuronVS,代码行数:82,代码来源:CScroller.cpp

示例2: drawofl

void CDisplayView::drawofl(void)
{
  CFrame *parentframe = getParent();
  if(!parentframe) return;

  CDrawContext *srccon;
  long dsplw,dsplh;

#if 1     // quantise near-grey to grey for transparent-draw
          // could be removed if q'ed bitmap is compiled to resource
  if(stConverted==false)
  {
    stConverted = true;

    srccon = new CDrawContext(parentframe,0);
    COffscreenContext *charcon;
    CColor pcl;
    int w,h;

    for(int nf=0; nf<kNumFtTypes; nf++)
    {
      dsplw = stFonts[nf].font->getWidth();
      dsplh = stFonts[nf].font->getHeight();
      charcon = new COffscreenContext(srccon,stFonts[nf].font,true);
      CPoint cp = CPoint(0,0);
      CRect  cr = CRect(0,0, dsplw,dsplh);
      stFonts[nf].font->draw(charcon, cr, cp );
      for(w=0; w<dsplw; w++)
      {
        for(h=0; h<dsplh; h++)
        {
          #define RNG 14

          pcl = charcon->getPoint(CPoint(w,h));
          if( pcl.red==128 && pcl.green==128 && pcl.blue==128 ) continue;
          if(pcl.red<(128-RNG)   || pcl.red>128+RNG)   continue;
          if(pcl.green<(128-RNG) || pcl.green>128+RNG) continue;
          if(pcl.blue<(128-RNG)  || pcl.blue>128+RNG)  continue;
          pcl.red=pcl.green=pcl.blue = 128;
          charcon->drawPoint(CPoint(w,h), pcl);
        }
      }
      delete charcon;
    }
    delete srccon;
  }
#endif

#if 0   // 0=PixelDrawing, else transparent drawing

  COffscreenContext *charcon;
  CPoint cp;
  CRect  cr;
  char c;
  dsplw = mDsplBmp->getWidth();
  dsplh = mDsplBmp->getHeight();
  CBitmap *bgnd = parentframe->getBackground();
  
  // get fresh background image
  cp = CPoint(size.left+mXAlign,size.top+mYAlign);
  cr = CRect(0,0,dsplw,dsplh);
  srccon = new CDrawContext(parentframe,0);
  COffscreenContext *dspcon = new COffscreenContext(srccon,mDsplBmp,true);
  bgnd->draw(dspcon, cr, cp);

  // get fresh font image
  cp = CPoint(0,0);
  cr = CRect(0,0, mFontBmp->getWidth(),mFontBmp->getHeight());
  charcon = new COffscreenContext(parentframe,mFontBmp->getWidth(),mFontBmp->getHeight());

  CColor scl,dcl;
  mFontBmp->draw(charcon, cr, cp );

  for(int i=0; i<mCharsfit && (c = mText[i]); i++)
  {
    int h,w,wd = i*mPaintWidth;
    int ws = (c - 33) * mCharWidth; // left position in font

    if(ws < 0)
    {
      continue;
    }

    for(w=0,ws+=mCharOfs; w<(mCharWidth-mCharOfs); w++,ws++,wd++)
    {
      for(h=0; h<dsplh; h++)
      {
        scl = charcon->getPoint(CPoint(ws,h));
        if( scl.red==128 && scl.green==128 && scl.blue==128 ) continue;
        dcl = dspcon->getPoint(CPoint(wd,h));
        dcl.red   = stClip[scl.red + (scl.red>>1) + dcl.red];
        dcl.green = stClip[scl.green + (scl.green>>1) + dcl.green];
        dcl.blue  = stClip[scl.blue + (scl.blue>>1) + dcl.blue];
        dspcon->drawPoint(CPoint(wd,h), dcl);
      }
    }
  }

  delete srccon;
  delete dspcon;
//.........这里部分代码省略.........
开发者ID:BernCPlusPlus,项目名称:NeuronVS,代码行数:101,代码来源:CDisplay.cpp


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