コード例 #1
0
void TSensorView::GreyViewer(TDC& dc,PSHORTREAL pData)
{
  dc.SetWindowExt(TSize(m_nDimSize[0],m_nDimSize[1]));
  for (int y = 0; y < m_nDimSize[1]; y++)
  {
    int xStart = 0,
        x = 0;
    int clrLast,
        clrThis;
    while(x < m_nDimSize[0])
    {
      SHORTREAL r = pData[x + y * (LONGINT) m_nDimSize[0]];
      if (r > 1)
        r = 1;
      else if (r < 0)
        r = 0;
      clrThis = (int) (pow(r,m_dBright) * 255);
      if(!x)
        clrLast = clrThis;
      else if(clrThis != clrLast)
      {
        TBrush br(TColor(clrLast,clrLast,clrLast));
        TRect rect(xStart,y,x,y+1);
        dc.FillRect(rect,br);
        xStart = x;
        clrLast = clrThis;
      }
      x++;
    }
    TBrush br(TColor(clrLast,clrLast,clrLast));
    TRect rect(xStart,y,x,y+1);
    dc.FillRect(rect,br);
  }
  Grid2D(dc);
}
コード例 #2
0
ファイル: owlext.cpp プロジェクト: Meridian59/Meridian59
void DrawDisabledButton(TDC& dc, const TRect& rc)
{
  // create a monochrome memory DC
  //
  TMemoryDC ddc;
  TBitmap bmp(ddc, rc.Width(), rc.Height());
  ddc.SelectObject(bmp);

  // build a mask
  //
  ddc.PatBlt(0, 0, rc.Width(), rc.Height(), WHITENESS);
  dc.SetBkColor(TColor::Sys3dFace);
  ddc.BitBlt(0, 0, rc.Width(), rc.Height(), dc, rc.left, rc.top, SRCCOPY);
  dc.SetBkColor(TColor::Sys3dHilight);
  ddc.BitBlt(0, 0, rc.Width(), rc.Height(), dc, rc.left, rc.top, SRCPAINT);

  // Copy the image from the toolbar into the memory DC
  // and draw it (grayed) back into the toolbar.
  //
  dc.FillRect(rc, TBrush(TColor::Sys3dFace));
  dc.SetBkColor(RGB(0, 0, 0));
  dc.SetTextColor(RGB(255, 255, 255));
  TBrush brShadow(TColor::Sys3dShadow);
  TBrush brHilight(TColor::Sys3dHilight);
  dc.SelectObject(brHilight);
  dc.BitBlt(rc.left+1, rc.top+1, rc.Width(), rc.Height(), ddc, 0, 0, 0x00E20746L);
  dc.SelectObject(brShadow);
  dc.BitBlt(rc.left, rc.top, rc.Width(), rc.Height(), ddc, 0, 0, 0x00E20746L);

  // reset DCs
  //
  dc.RestoreBrush();
  dc.RestoreBrush();
  ddc.RestoreBitmap();
}
コード例 #3
0
ファイル: owlext.cpp プロジェクト: Meridian59/Meridian59
void
FillMaskRect(TDC& dc, TRect rect)
{
  THatch8x8Brush br(THatch8x8Brush::Hatch11F1, TColor::Sys3dHilight,
    TColor::Sys3dFace);
  dc.FillRect(rect, br);
}
コード例 #4
0
void TSensorView::ColorViewer(TDC& dc,PSHORTREAL pData)
{
  int zMax = m_nDimSize[m_nDim-1],
      xMax = m_nDim > 1 ? m_nDimSize[0] : 1,
      yMax = m_nDim > 2 ? m_nDimSize[1] : 1;
  dc.SetWindowExt(TSize(xMax,yMax));
  for (int y = 0; y < yMax; y++)
  {
    int xStart = 0,
        x = 0;
    TColor clrLast,
           clrThis;
    while(x < xMax)
    {
      int Color[3] = {0,0,0};
      for (int z = 0; z < zMax; z++)
      {
        SHORTREAL r = pData[x + y * (LONGINT) xMax
                              + z * (LONGINT) xMax
                                  * (LONGINT) yMax];
        if (r > 1)
          r = 1;
        else if (r < 0)
          r = 0;
        Color[z] = (int) (pow(r,m_dBright) * 255);
      }
      clrThis = TColor(Color[0],Color[1],Color[2]);
      if(!x)
        clrLast = clrThis;
      else if(clrThis != clrLast)
      {
        TBrush br(clrLast);
        TRect rect(xStart,y,x,y+1);
        dc.FillRect(rect,br);
        xStart = x;
        clrLast = clrThis;
      }
      x++;
    }
    TBrush br(clrLast);
    TRect rect(xStart,y,x,y+1);
    dc.FillRect(rect,br);
  }
  Grid2D(dc);
}