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

C++ GetRValue函数代码示例

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

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



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

示例1: AFCBmpToRgn

//位图转换到区域 (需要重写)
HRGN AFCBmpToRgn(HBITMAP hBmp, COLORREF cTransparentColor, COLORREF cTolerance)
{
	if (hBmp==NULL) return NULL;

	HRGN hRgn=NULL;
	HDC hMemDC=::CreateCompatibleDC(NULL);
	if (hMemDC!=NULL)
	{
		BITMAP bm;
		GetObject(hBmp, sizeof(bm), &bm);
		VOID * pbits32=NULL; 
		BITMAPINFOHEADER RGB32BITSBITMAPINFO = {sizeof(BITMAPINFOHEADER),bm.bmWidth,bm.bmHeight,1,32,BI_RGB,0,0,0,0,0};
		HBITMAP hbm32 = CreateDIBSection(hMemDC, (BITMAPINFO *)&RGB32BITSBITMAPINFO, DIB_RGB_COLORS, &pbits32, NULL, 0);
		if (hbm32)
		{
			HBITMAP holdBmp = (HBITMAP)SelectObject(hMemDC, hbm32);
			HDC hDC = CreateCompatibleDC(hMemDC);
			if (hDC)
			{
				BITMAP bm32;
				GetObject(hbm32,sizeof(bm32),&bm32);
				while (bm32.bmWidthBytes%4) bm32.bmWidthBytes++;
				HBITMAP holdBmp=(HBITMAP)SelectObject(hDC,hBmp);
				BitBlt(hMemDC,0,0,bm.bmWidth,bm.bmHeight,hDC,0,0,SRCCOPY);
				#define ALLOC_UNIT    100
				DWORD maxRects=ALLOC_UNIT;
				HANDLE hData=GlobalAlloc(GMEM_MOVEABLE, sizeof(RGNDATAHEADER) + (sizeof(RECT) * maxRects));
				RGNDATA *pData=(RGNDATA *)GlobalLock(hData);
				pData->rdh.dwSize=sizeof(RGNDATAHEADER);
				pData->rdh.iType=RDH_RECTANGLES;
				pData->rdh.nCount=pData->rdh.nRgnSize=0;
				SetRect(&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0);

				// Keep on hand highest and lowest values for the "transparent" pixels
				BYTE lr = GetRValue(cTransparentColor);
				BYTE lg = GetGValue(cTransparentColor);
				BYTE lb = GetBValue(cTransparentColor);
				BYTE hr = min(0xff, lr + GetRValue(cTolerance));
				BYTE hg = min(0xff, lg + GetGValue(cTolerance));
				BYTE hb = min(0xff, lb + GetBValue(cTolerance));

				// Scan each bitmap row from bottom to top (the bitmap is inverted vertically)
				BYTE *p32=(BYTE *)bm32.bmBits + (bm32.bmHeight - 1) * bm32.bmWidthBytes;
				for (int y=0;y<bm.bmHeight;y++)
				{
					// Scan each bitmap pixel from left to right
					for (int x=0;x<bm.bmWidth;x++)
					{
						// Search for a continuous range of "non transparent pixels"
						int x0=x;
						LONG *p=(LONG *)p32+x;
						while (x<bm.bmWidth)
						{
							BYTE b=GetRValue(*p);
							if (b>=lr&&b<=hr)
							{
								b=GetGValue(*p);
								if (b>=lg&&b<=hg)
								{
									b = GetBValue(*p);
									if (b >= lb && b <= hb) break;
								}
							}
							p++;
							x++;
						}

						if (x>x0)
						{
							// Add the pixels (x0, y) to (x, y+1) as a new rectangle in the region
							if (pData->rdh.nCount >= maxRects)
							{
								GlobalUnlock(hData);
								maxRects += 100;
								hData = GlobalReAlloc(hData, sizeof(RGNDATAHEADER) + (sizeof(RECT) * maxRects), GMEM_MOVEABLE);
								pData = (RGNDATA *)GlobalLock(hData);
							}
							RECT *pr = (RECT *)&pData->Buffer;
							SetRect(&pr[pData->rdh.nCount], x0, y, x, y+1);
							if (x0 < pData->rdh.rcBound.left)
								pData->rdh.rcBound.left = x0;
							if (y < pData->rdh.rcBound.top)
								pData->rdh.rcBound.top = y;
							if (x > pData->rdh.rcBound.right)
								pData->rdh.rcBound.right = x;
							if (y+1 > pData->rdh.rcBound.bottom)
								pData->rdh.rcBound.bottom = y+1;
							pData->rdh.nCount++;

							// On Windows98, ExtCreateRegion() may fail if the number of rectangles is too
							// large (ie: > 4000). Therefore, we have to create the region by multiple steps.
							if (pData->rdh.nCount == 2000)
							{
								HRGN h = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + (sizeof(RECT) * maxRects), pData);
								if (hRgn)
								{
									CombineRgn(hRgn, hRgn, h, RGN_OR);
									DeleteObject(h);
								}
//.........这里部分代码省略.........
开发者ID:liuwanbing,项目名称:liuwanbing,代码行数:101,代码来源:AFCFunction.cpp


示例2: Red

 /**
  * Returns the red part of the color
  * @return The red part of the color (0-255)
  */
 constexpr
 uint8_t Red() const
 {
   return GetRValue(value);
 }
开发者ID:Exadios,项目名称:xcsoar-exp,代码行数:9,代码来源:Color.hpp


示例3: while

BOOL CImageDialog::OnInitDialog()
{
    CDialog::OnInitDialog();

    // TODO:  Add extra initialization here
    m_btnMask.EnableOtherButton(_T("Other"));
    m_btnMask.SetColor((COLORREF)0);
    m_btnMask.SetColumnsNumber(10);

    m_ctlFade.SetRange(0,255);
    m_ctlFade.SetPos(255);

    m_pManager=g_pMainFrame->GetActiveUIView()->GetPaintManager();
    m_ImagePreview.SetManager(m_pManager);

    g_HookAPI.EnableAddImage(false);

    m_strImagePathName=m_strImageProperty;
    LPCTSTR pStrImage=m_strImageProperty;
    CStdString sItem;
    CStdString sValue;
    LPTSTR pstr = NULL;
    while( *pStrImage != _T('\0') ) {
        sItem.Empty();
        sValue.Empty();
        while( *pStrImage != _T('\0') && *pStrImage != _T('=') ) {
            LPTSTR pstrTemp = ::CharNext(pStrImage);
            while( pStrImage < pstrTemp) {
                sItem += *pStrImage++;
            }
        }
        if( *pStrImage++ != _T('=') ) break;
        if( *pStrImage++ != _T('\'') ) break;
        while( *pStrImage != _T('\0') && *pStrImage != _T('\'') ) {
            LPTSTR pstrTemp = ::CharNext(pStrImage);
            while( pStrImage < pstrTemp) {
                sValue += *pStrImage++;
            }
        }
        if( *pStrImage++ != _T('\'') ) break;
        if( !sValue.IsEmpty() ) {
            if( sItem == _T("file"))
                m_strImagePathName = sValue;
            else if( sItem == _T("dest") )
                m_strDest = sValue;
            else if( sItem == _T("source") )
                m_strSource = sValue;
            else if( sItem == _T("corner") )
                m_strCorner = sValue;
            else if( sItem == _T("mask") ) {
                DWORD dwMask;
                if( sValue[0] == _T('#')) dwMask = _tcstoul(sValue.GetData() + 1, &pstr, 16);
                else dwMask = _tcstoul(sValue.GetData(), &pstr, 16);
                dwMask&=0x00FFFFFF;
                m_btnMask.SetColor(RGB(GetBValue(dwMask),GetGValue(dwMask),GetRValue(dwMask)));
            }
            else if( sItem == _T("fade") ) {
                m_nFade = (BYTE)_tcstoul(sValue.GetData(), &pstr, 10);
            }
            else if( sItem == _T("hole") ) {
                m_bHole = (_tcscmp(sValue.GetData(), _T("true")) == 0);
            }
        }
        if( *pStrImage++ != _T(' ') ) break;
    }
    m_ctlFade.SetPos(m_nFade);

    int nIndex=m_lstImages.AddString(_T("(无)"));
    m_lstImages.SetItemDataPtr(nIndex,(void*)(LPCTSTR)m_strNullImage);
    const CStringArray* parrImage=g_pResourceView->GetAllImage();
    LPCTSTR pstrImage=NULL;
    LPTSTR pszFileName=NULL;
    for(int i=0; i<parrImage->GetSize(); i++)
    {
        pstrImage=parrImage->GetAt(i);
        pszFileName=_tcsrchr((LPTSTR)pstrImage,_T('\\'))+1;
        nIndex=m_lstImages.AddString(pszFileName);
        m_lstImages.SetItemDataPtr(nIndex,(void*)pstrImage);
    }
    pstrImage=m_strImagePathName;
    pszFileName=_tcsrchr((LPTSTR)pstrImage,_T('\\'))+1;
    m_strImagePathName.IsEmpty()?m_lstImages.SelectString(-1,_T("(无)")):m_lstImages.SelectString(-1,pszFileName);

    UpdateData(FALSE);
    SetImageProperty(m_strImagePathName);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:89,代码来源:ImageDialog.cpp


示例4: if

void MaterialPreviewPropView::OnPropertyChangeNotification( NMHDR *nmhdr, LRESULT *lresult ) {
	idVec3			testColor;
	int				lightId = 0;
	COLORREF		color;
	NMPROPTREE		*nmProp;
	CPropTreeItem	*item;
	CPropTreeItem	*parent;

	nmProp = (NMPROPTREE *)nmhdr;
	item = nmProp->pItem;

	// Determine which light this item modifies
	parent = item->GetParent();
	if ( parent ) {
		lightId = parent->GetCtrlID();
	}

	idStr	itemLabel = item->GetLabelText();
	
	if ( itemLabel == "Model Type" ) {
		materialPreview->OnModelChange( item->GetItemValue() );

	} else if ( itemLabel == "Custom Model" ) {
		materialPreview->OnCustomModelChange( (const char *)item->GetItemValue() );

	} else if ( itemLabel == "Show Lights" ) {
		materialPreview->OnShowLightsChange( item->GetItemValue() ? true : false );

	} else if ( itemLabel == "Shader" ) {
		CPropTreeItemCombo	*combo = (CPropTreeItemCombo *)item;
		CString materialName;

		combo->GetLBText( combo->GetCurSel(), materialName );

		materialPreview->OnLightShaderChange( lightId, materialName.GetBuffer() );

	} else if ( itemLabel == "Radius" ) {
		materialPreview->OnLightRadiusChange( lightId, atof( (char *)item->GetItemValue() ) );

	} else if ( itemLabel == "Color" ) {
		color = item->GetItemValue();

		testColor.x = (float)GetRValue( color ) * (float)( 1.f/255.f );
		testColor.y = (float)GetGValue( color ) * (float)( 1.f/255.f );
		testColor.z = (float)GetBValue( color ) * (float)( 1.f/255.f );

		materialPreview->OnLightColorChange( lightId, testColor );

	} else if ( itemLabel == "Move light" ) {
		materialPreview->OnLightAllowMoveChange( lightId, item->GetItemValue() ? true : false );

	} else if ( itemLabel.Left(4) == "parm" ) {
		int index;

		itemLabel.Strip( "parm" );
		index = atoi( itemLabel.c_str() );

		materialPreview->OnLocalParmChange( index, atof( (char *)item->GetItemValue() ) );

	} else if ( itemLabel.Left(6) == "global" ) {
		int index;

		itemLabel.Strip( "global" );
		index = atoi( itemLabel.c_str() );

		materialPreview->OnGlobalParmChange( index, atof( (char *)item->GetItemValue() ) );
	}
}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:68,代码来源:MaterialPreviewPropView.cpp


示例5: GetRValue

long CMUSHclientDoc::FilterPixel(long Pixel, short Operation, double Options) 
{
long r = GetRValue (Pixel),
     g = GetGValue (Pixel),
     b = GetBValue (Pixel);

   switch (Operation)
     {
     case 1:        // Noise
       {
       double threshold = Options / 100.0;
       r += (128 - genrand () * 256) * threshold;
       g += (128 - genrand () * 256) * threshold;
       b += (128 - genrand () * 256) * threshold;
       break;
       }

     case 2:    // MonoNoise
       {
       double threshold = Options / 100.0;
       long j = (128 - genrand () * 256) * threshold;
       r += j;
       g += j;
       b += j;
       break;
       }


     case  7: // Brightness     
        {
        r += Options;
        g += Options;
        b += Options;
        break;
        }


     case  8: // Contrast        
        {
        double c;

        c = r - 128;   // center on zero
        c *= Options;  // multiply by contrast
        r = c + 128;   // put back

        c = g - 128;   // center on zero
        c *= Options;  // multiply by contrast
        g = c + 128;   // put back

        c = b - 128;   // center on zero
        c *= Options;  // multiply by contrast
        b = c + 128;   // put back

        break;
        }


     case  9: // Gamma         
        {
        double c;

        if (Options < 0.0)
          Options = 0.0;

        c = ( (double) r) / 255.0;  // normalize it
        c = pow (c, Options);
        r = c * 255.0;

        c = ( (double) g) / 255.0;  // normalize it
        c = pow (c, Options);
        g = c * 255.0;

        c = ( (double) b) / 255.0;  // normalize it
        c = pow (c, Options);
        b = c * 255.0;

        break;
        }

     case  10: // ColourBrightness - red     
        {
        r += Options;
        break;
        }

     case  11: // ColourContrast - red        
        {
        double c;

        c = r - 128;   // center on zero
        c *= Options;  // multiply by contrast
        r = c + 128;   // put back

        break;
        }

     case  12: // ColourGamma - red         
        {
        double c;

//.........这里部分代码省略.........
开发者ID:RKelson93,项目名称:mushclient,代码行数:101,代码来源:methods_miniwindows.cpp


示例6: memset

void Site::Draw(CDC* pDC)
{	
	//设置TextOut的属性
	CFont   font;   
	LOGFONT   lf;   
	memset(&lf,   0,   sizeof(LOGFONT));   
	lf.lfHeight   =   15;         //字体的高   
	lf.lfWidth    =   8;         //字体宽
	font.CreateFontIndirect(&lf);
	pDC->SelectObject(&font);

	HDC hdc=pDC->GetSafeHdc ();
	::SetBkMode(hdc,TRANSPARENT);
	::SetTextColor (hdc,	RGB(255,255,0));
	if(ID>0)//只绘制动态点,静态点副本不绘制!
	{
		COLORREF c=RGB(255-GetRValue(Color)
			,255-GetGValue(Color)
			,255-GetBValue(Color));
		App_Veriable::DefaultSiteSeletedModeColor=c;
		CPen pen;
		if(ID==App_Veriable::SelectedSiteID)//选中的路径
		{
			pen.CreatePen (PS_SOLID,1,App_Veriable::DefaultSiteSeletedModeColor);
		}
		else
			pen.CreatePen (PS_SOLID,1,Color);
		pDC->SelectObject(pen);

		if(Style=='C')
			pDC->Ellipse(Position.x-Size/2,Position.y-Size/2,Position.x+Size/2,Position.y+Size/2);
		if(Style=='T')
		{
			pDC->MoveTo(Position.x,Position.y-sqrt(3.0)*Size/3);
			pDC->LineTo(Position.x-Size/2,Position.y+sqrt(3.0)*Size/6);

			pDC->MoveTo(Position.x-Size/2,Position.y+sqrt(3.0)*Size/6);
			pDC->LineTo(Position.x+Size/2,Position.y+sqrt(3.0)*Size/6);

			pDC->MoveTo(Position.x+Size/2,Position.y+sqrt(3.0)*Size/6);
			pDC->LineTo(Position.x,Position.y-sqrt(3.0)*Size/3);
		}
		if(Style=='R')
			pDC->Rectangle(Position.x-Size/2,Position.y-Size/2,Position.x+Size/2,Position.y+Size/2);

		pen.DeleteObject();

		CBrush brush;
		if(ID==App_Veriable::SelectedSiteID)//选中的路径
			brush.CreateSolidBrush (App_Veriable::DefaultSiteSeletedModeColor);
		else
			brush.CreateSolidBrush (Color);
		pDC->SelectObject(brush);

		if(Style=='C')
		{
			/*CRgn c;
			c.CreateEllipticRgn(Position.x-Size/2,Position.y-Size/2,Position.x+Size/2,Position.x+Size/2);
			pDC->FillRgn (&c,&brush);
			c.DeleteObject();*/
			pDC->Ellipse(Position.x-Size/2,Position.y-Size/2,Position.x+Size/2,Position.y+Size/2);//效果更好???
		}
		if(Style=='T')
		{
			CPoint points[3];
			points[0].x=Position.x;
			points[0].y=Position.y-sqrt(3.0)*Size/3;
			points[1].x=Position.x-Size/2;
			points[1].y=Position.y+sqrt(3.0)*Size/6;
			points[2].x=Position.x+Size/2;
			points[2].y=Position.y+sqrt(3.0)*Size/6;
			CRgn c;
			c.CreatePolygonRgn (points,3,WINDING);
			pDC->FillRgn (&c,&brush);
			c.DeleteObject();
		}
		if(Style=='R')
		{
			CRgn c;
			c.CreateRectRgn (Position.x-Size/2,Position.y-Size/2,Position.x+Size/2,Position.y+Size/2);
			pDC->FillRgn (&c,&brush);
			c.DeleteObject();
			/*pDC->Rectangle(Position.x-Size/2,Position.y-Size/2,Position.x+Size/2,Position.x+Size/2);*///不能用,好奇怪???
		}

		if(this->SiteInfo!=App_Veriable::DefaultSiteInfo&&App_Veriable::ShowSiteInfo)
			pDC->TextOutW(this->Position.x,this->Position.y,this->SiteInfo);

		brush.DeleteObject();
	}

}
开发者ID:fanzhidongyzby,项目名称:Guider,代码行数:92,代码来源:map.cpp


示例7: sl

// This is what does the work in the background thread
UINT CHexEditDoc::RunAerialThread()
{
    // Keep looping until we are told to die
    for (;;)
    {
        // Signal that we are waiting then wait for start_aerial_event_ to be pulsed
        {
            CSingleLock sl(&docdata_, TRUE);
            aerial_state_ = WAITING;
        }
        TRACE1("+++ BGAerial: waiting for %p\n", this);
        DWORD wait_status = ::WaitForSingleObject(HANDLE(start_aerial_event_), INFINITE);
        docdata_.Lock();
        aerial_state_ = SCANNING;
        docdata_.Unlock();
        start_aerial_event_.ResetEvent();
        ASSERT(wait_status == WAIT_OBJECT_0);
        TRACE1("+++ BGAerial: got event for %p\n", this);

        if (AerialProcessStop())
            continue;

        // Reset for new scan
        docdata_.Lock();
        aerial_fin_ = false;
        aerial_addr_ = 0;
        FILE_ADDRESS file_len = length_;
        int file_bpe = bpe_;
        unsigned char *file_dib = FreeImage_GetBits(dib_);
        unsigned dib_size = FreeImage_GetDIBSize(dib_);
        docdata_.Unlock();
        TRACE("+++ BGAerial: using bitmap at %p\n", file_dib);

        // Get the file buffer
        size_t buf_len = (size_t)min(file_len, 65536);
        ASSERT(aerial_buf_ == NULL);
        aerial_buf_ = new unsigned char[buf_len];

        for (;;)
        {
            // First check if we need to stop
            if (AerialProcessStop())
                break;   // stop processing and go back to WAITING state

            // Check if we have finished scanning the file
            if (aerial_addr_ >= file_len)
            {
                TRACE2("+++ BGAerial: finished scan for %p at address %p\n", this, file_dib + 3*size_t(aerial_addr_/file_bpe));
                CSingleLock sl(&docdata_, TRUE); // Protect shared data access

                aerial_fin_ = true;
                break;                          // falls out to end_scan
            }

            // Get the next buffer full from the file and scan it
            size_t got = GetData(aerial_buf_, buf_len, aerial_addr_, 3);
            ASSERT(got <= buf_len);

            unsigned char *pbm = file_dib + 3*size_t(aerial_addr_/file_bpe);    // where we write to bitmap
            unsigned char *pbuf;                                        // where we read from the file buffer
            for (pbuf = aerial_buf_; pbuf < aerial_buf_ + got; pbuf += file_bpe, pbm += 3)
            {
                int r, g, b;
                r = g = b = 0;
                for (unsigned char *pp = pbuf; pp < pbuf + file_bpe; ++pp)
                {
                    r += GetRValue(kala_[*pp]);
                    g += GetGValue(kala_[*pp]);
                    b += GetBValue(kala_[*pp]);
                }
                *pbm     = unsigned char(b/file_bpe);
                *(pbm+1) = unsigned char(g/file_bpe);
                *(pbm+2) = unsigned char(r/file_bpe);
            }
            aerial_addr_ += got;
        }

        delete[] aerial_buf_;
        aerial_buf_ = NULL;
    }
    return 0;   // never reached
}
开发者ID:AndrewWPhillips,项目名称:HexEdit,代码行数:83,代码来源:BGAerial.cpp


示例8: ASSERT_VALID

//*****************************************************************************************
void CBCGPColorMenuButton::OnDraw (CDC* pDC, const CRect& rect, CBCGPToolBarImages* pImages,
			BOOL bHorz, BOOL bCustomizeMode, BOOL bHighlight,
			BOOL bDrawBorder, BOOL bGrayDisabledButtons)
{
	ASSERT_VALID (this);
	ASSERT_VALID (pDC);

	CBCGPToolbarMenuButton::OnDraw (pDC, rect, pImages, bHorz, bCustomizeMode,
		bHighlight, bDrawBorder, bGrayDisabledButtons);

	if (!IsDrawImage () || pImages == NULL)
	{
		return;
	}

    CPalette* pOldPalette = NULL;
	if (globalData.m_nBitsPerPixel == 8) // 256 colors
	{
		if (m_Palette.GetSafeHandle () == NULL)
		{
			//----------------------------------------
			// Palette not created yet; create it now
			//----------------------------------------
			CBCGPColorBar::CreatePalette (m_Colors, m_Palette);
		}

		ASSERT (m_Palette.GetSafeHandle () != NULL);

		pOldPalette = pDC->SelectPalette (&m_Palette, FALSE);
		pDC->RealizePalette ();
	}
	else if (m_Palette.GetSafeHandle () != NULL)
	{
		::DeleteObject (m_Palette.Detach ());
		ASSERT (m_Palette.GetSafeHandle () == NULL);
	}

	ASSERT (pImages != NULL);
	CRect rectColor = pImages->GetLastImageRect ();
	const int nColorBoxSize = CBCGPToolBar::IsLargeIcons () && !m_bMenuMode ? 10 : 5;

	rectColor.top = rectColor.bottom - nColorBoxSize;
	rectColor.OffsetRect (0, 1);

	//----------------
	// Draw color bar:
	//----------------
	BOOL bDrawImageShadow = 
		bHighlight && !bCustomizeMode &&
		CBCGPVisualManager::GetInstance ()->IsShadowHighlightedImage () &&
		!globalData.IsHighContastMode () &&
		((m_nStyle & TBBS_PRESSED) == 0) &&
		((m_nStyle & TBBS_CHECKED) == 0) &&
		((m_nStyle & TBBS_DISABLED) == 0);

	if (bDrawImageShadow)
	{
		CBrush brShadow (globalData.clrBarShadow);
		pDC->FillRect (rectColor, &brShadow);
		rectColor.OffsetRect (-1, -1);
	}

	COLORREF color = (m_nStyle & TBBS_DISABLED) ?
		globalData.clrBarShadow :
			(m_Color == (COLORREF)-1 ? m_colorAutomatic : m_Color);

	CBrush br (PALETTERGB(	GetRValue (color),
							GetGValue (color), 
							GetBValue (color)));

	CBrush* pOldBrush = pDC->SelectObject (&br);
	CPen* pOldPen = (CPen*) pDC->SelectStockObject (NULL_PEN);
	
	pDC->Rectangle (&rectColor);

	pDC->SelectObject (pOldPen);
	pDC->SelectObject (pOldBrush);

	if (CBCGPVisualManager::GetInstance ()->IsMenuFlatLook ())
	{
		if (color == globalData.clrBarFace)
		{
			pDC->Draw3dRect (rectColor, globalData.clrBarDkShadow, globalData.clrBarDkShadow);
		}
	}
	else
	{
		pDC->Draw3dRect (rectColor, globalData.clrBarShadow, globalData.clrBarLight);
	}
	
    if (pOldPalette != NULL)
	{
        pDC->SelectPalette (pOldPalette, FALSE);
	}
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:96,代码来源:BCGPColorMenuButton.cpp


示例9: CreateCompatibleBitmap

void CAtmoGdiDisplayCaptureInput::CalcColors() 
{
     tRGBColor pixelColor;
#ifdef UseGdiGetPixel
     COLORREF pixel;
#ifdef UseGdiDesktopGetPixel 
 	 HDC hdcScreen;
#endif
#endif

     int xx,yy;

     int capture_area_width  = (m_ScreenSourceRect.right-m_ScreenSourceRect.left);
     int capture_area_height = (m_ScreenSourceRect.bottom-m_ScreenSourceRect.top);

#ifndef UseGdiDesktopGetPixel
     HBITMAP hTempBitmap  = CreateCompatibleBitmap(m_hdcScreen, capture_area_width, capture_area_height);
     HGDIOBJ hOldBmp = SelectObject(m_hTempBitmapDC, hTempBitmap);
#endif

#ifndef UseGdiGetPixel
     BITMAPINFO bmpInfo;
     ZeroMemory(&bmpInfo, sizeof(BITMAPINFO));
     bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);

     GetDIBits(m_hTempBitmapDC,hTempBitmap,0,1,NULL,&bmpInfo,DIB_RGB_COLORS);

   //  bmpInfo.bmiHeader.biWidth  = capture_area_width;
   //  bmpInfo.bmiHeader.biHeight = -capture_area_height;

     if(bmpInfo.bmiHeader.biSizeImage<=0)
        bmpInfo.bmiHeader.biSizeImage=bmpInfo.bmiHeader.biWidth * abs(bmpInfo.bmiHeader.biHeight)*(bmpInfo.bmiHeader.biBitCount+7)/8;

     bmpInfo.bmiHeader.biCompression=BI_RGB;
#endif


//    have a look into VncDesktop.cpp :-) **g vncDesktop::CaptureScreen
//    vncDesktop::EnableOptimisedBlits() vncDesktop::CopyToBuffer(
//    http://cboard.cprogramming.com/archive/index.php/t-89037.html
//    http://cboard.cprogramming.com/showthread.php?t=76907   das schaut gut aus!!!!!!
//    damit spart man die GetDIBits(...) aufrufe... und bekommt mittelsBitBlit gleich alles
//    ins eigene Ram Kopiert... Full Access to display ram... :-)))
//

#ifndef UseGdiDesktopGetPixel
     BitBlt(m_hTempBitmapDC, 0, 0, capture_area_width, capture_area_height, m_hdcScreen, m_ScreenSourceRect.left, m_ScreenSourceRect.top, SRCCOPY);
#endif

     int index = (m_CurrentFrame * CAP_WIDTH);
     int indexSkip = ((m_rowsPerFrame-1) * CAP_WIDTH);
     unsigned int col = 0;

#ifdef UseGdiGetPixel
    #ifdef UseGdiDesktopGetPixel
       hdcScreen      = GetDC(NULL);  
    #endif


      for(int y=m_CurrentFrame; y<CAP_HEIGHT; y+=m_rowsPerFrame ) {
            // yy = (y * capture_area_height) / CAP_HEIGHT;
            // yy = yy + m_ScreenSourceRect.top + m_tShift;
            yy = m_iSrcRows[y];

            for(int x=0;x<CAP_WIDTH;x++) {
                // xx = (x * capture_area_width) / CAP_WIDTH;
                // xx = xx + m_ScreenSourceRect.left + m_lShift;
      #ifndef UseGdiDesktopGetPixel
                pixel = GetPixel(m_hTempBitmapDC, m_iSrcCols[x], yy);
      #else
                pixel = GetPixel(hdcScreen, m_iSrcCols[x], yy);
      #endif
                pixelColor.r = GetRValue(pixel);
                pixelColor.g = GetGValue(pixel);
                pixelColor.b = GetBValue(pixel);

                HSV_Img[index++] = RGB2HSV(pixelColor);
            }
            index += indexSkip;
       }

  #ifdef UseGdiDesktopGetPixel
      ReleaseDC(NULL, hdcScreen);
  #endif


#else
     switch(bmpInfo.bmiHeader.biBitCount) {
            case  8: { // [TF] 8bit support added by Tobias Fleischer/Tobybear - still untested and experimental, might not work!
				int nColors = bmpInfo.bmiHeader.biClrUsed ? bmpInfo.bmiHeader.biClrUsed : 1 << bmpInfo.bmiHeader.biBitCount;
				for( int y=m_CurrentFrame; y<CAP_HEIGHT; y+=m_rowsPerFrame ) {
                    // yy = (y * capture_area_height) / CAP_HEIGHT;
                    // yy = yy + m_ScreenSourceRect.top + m_tShift;

                   if(bmpInfo.bmiHeader.biHeight>0)
                      yy = bmpInfo.bmiHeader.biHeight - m_iSrcRows[y] - 1;
                   else
                      yy = m_iSrcRows[y];


//.........这里部分代码省略.........
开发者ID:Nevcairiel,项目名称:atmowin,代码行数:101,代码来源:AtmoGdiDisplayCaptureInput.cpp


示例10: assert

void vxPaintDC::_FillGradient(const LPRECT lpRect, COLORREF colorStart, COLORREF colorFinish,
			bool bHorz /* = TRUE */, int nStartFlatPercentage /* = 0 */, int nEndFlatPercentage /* = 0 */)
{
	if (NULL == lpRect)
		return;

	if (colorStart == colorFinish)
	{
		HBRUSH hbr = ::CreateSolidBrush(colorStart);
		assert(NULL != hbr);
		::FillRect(m_hDC, lpRect, hbr);
		::DeleteObject((HGDIOBJ)hbr);
		return;
	}

	if (nStartFlatPercentage > 0)
	{
		assert(nStartFlatPercentage <= 100);

		if (bHorz)
		{
			RECT rectTop;
			memcpy(&rectTop, lpRect, sizeof(RECT));
			rectTop.bottom = rectTop.top + (rectTop.bottom - rectTop.top) * nStartFlatPercentage / 100;
			lpRect->top = rectTop.bottom;

			HBRUSH hbr = ::CreateSolidBrush(colorFinish);
			assert(NULL != hbr);
			::FillRect(m_hDC, &rectTop, hbr);
			::DeleteObject((HGDIOBJ)hbr);
		}
		else
		{
			RECT rectLeft;
			memcpy(&rectLeft, lpRect, sizeof(RECT));
			rectLeft.right = rectLeft.left + (rectLeft.right - rectLeft.left) * nStartFlatPercentage / 100;
			lpRect->left = rectLeft.right;

			HBRUSH hbr = ::CreateSolidBrush(colorStart);
			assert(NULL != hbr);
			::FillRect(m_hDC, &rectLeft, hbr);
			::DeleteObject((HGDIOBJ)hbr);
		}
	}

	if (nEndFlatPercentage > 0)
	{
		assert(nEndFlatPercentage <= 100);

		if (bHorz)
		{
			RECT rectBottom;
			memcpy(&rectBottom, lpRect, sizeof(RECT));
			rectBottom.top = rectBottom.bottom - (rectBottom.bottom - rectBottom.top) * nEndFlatPercentage / 100;
			lpRect->bottom = rectBottom.top;

			HBRUSH hbr = ::CreateSolidBrush(colorStart);
			assert(NULL != hbr);
			::FillRect(m_hDC, &rectBottom, hbr);
			::DeleteObject((HGDIOBJ)hbr);
		}
		else
		{
			RECT rectRight;
			memcpy(&rectRight, lpRect, sizeof(RECT));
			rectRight.left = rectRight.right - (rectRight.right - rectRight.left) * nEndFlatPercentage / 100;
			lpRect->right = rectRight.left;

			HBRUSH hbr = ::CreateSolidBrush(colorFinish);
			assert(NULL != hbr);
			::FillRect(m_hDC, &rectRight, hbr);
			::DeleteObject((HGDIOBJ)hbr);
		}
	}

	if (nEndFlatPercentage + nStartFlatPercentage > 100)
	{
		assert(FALSE);
		return;
	}

	// this will make 2^6 = 64 fountain steps
	int nShift = 6;
	int nSteps = 1 << nShift;

	for (int i = 0; i < nSteps; i++)
	{
		// do a little alpha blending
		BYTE bR = (BYTE)((GetRValue(colorStart) * (nSteps - i) + GetRValue(colorFinish) * i) >> nShift);
		BYTE bG = (BYTE)((GetGValue(colorStart) * (nSteps - i) + GetGValue(colorFinish) * i) >> nShift);
		BYTE bB = (BYTE)((GetBValue(colorStart) * (nSteps - i) + GetBValue(colorFinish) * i) >> nShift);

		HBRUSH hbr = ::CreateSolidBrush(RGB(bR, bG, bB));

		// then paint with the resulting color
		RECT r2;
		memcpy(&r2, lpRect, sizeof(RECT));
		if (bHorz)
		{
			r2.bottom = lpRect->bottom - ((i * (lpRect->bottom - lpRect->top)) >> nShift);
//.........这里部分代码省略.........
开发者ID:cpazstido,项目名称:player,代码行数:101,代码来源:vxDC.cpp


示例11: GetClientRect

void CDigistring::OnPaint() 
{
	CRect rect;
	CDoubleRect CharRect;
	GetClientRect(&rect);

	CPaintDC dc(this); // device context for painting
	dc.SetBkColor(m_BackColor);
	CMyMemDC memDC(&dc, &rect);

	CBrush hBrushOff, hBrushOn;
	hBrushOff.CreateSolidBrush(m_OffColor);
	hBrushOn.CreateSolidBrush(m_OnColor);
	CBrush *pOldBrush = memDC.SelectObject(&hBrushOn);

		int r = int(GetRValue(m_OffColor) * 0.75 + GetRValue(m_BackColor) * 0.25);
		int g = int(GetGValue(m_OffColor) * 0.75 + GetGValue(m_BackColor) * 0.25);
		int b = int(GetBValue(m_OffColor) * 0.75 + GetBValue(m_BackColor) * 0.25);

	CPen OffPen(PS_SOLID | PS_ENDCAP_ROUND, 1, RGB(r,g,b));
		r = int(GetRValue(m_OnColor) * 0.75 + GetRValue(m_BackColor) * 0.25);
		g = int(GetGValue(m_OnColor) * 0.75 + GetGValue(m_BackColor) * 0.25);
		b = int(GetBValue(m_OnColor) * 0.75 + GetBValue(m_BackColor) * 0.25);
	CPen OnPen(PS_SOLID | PS_ENDCAP_ROUND, 1, RGB(r,g,b));
	CPen *pOldPen = memDC.SelectObject(&OffPen);

	int iTotWidth = 0;
	double dRelWidth, dRelHeight;
	// TODO: Add your message handler code here

	DigiCharVector::iterator CharIterator;

	// Calculate resizing factors...
	BuildString();
	for (CharIterator = m_CharVector.begin(); CharIterator != m_CharVector.end();
		CharIterator++)
	{
		iTotWidth += CharIterator->GetNormWidth();
	}
	dRelWidth = double(rect.Width()) / iTotWidth;
	dRelHeight = double(rect.Height()) / NORM_DIGIHEIGHT;

	// If proportional make offset for centered text
	if (m_DispStyle & DS_SZ_PROP)
	{
		if (dRelWidth < dRelHeight)
			dRelHeight = dRelWidth;
		else
			dRelWidth = dRelHeight;

		CharRect.left = (rect.Width() - dRelWidth * iTotWidth) / 2;
		CharRect.top = (rect.Height() - dRelHeight * NORM_DIGIHEIGHT) / 2; 
	}
	else
		CharRect.SetRectEmpty();

	// Draw all characters...
	for (CharIterator = m_CharVector.begin(); CharIterator != m_CharVector.end();
		CharIterator++)
	{
		CharRect.SetRect(CharRect.left, CharRect.top,
			CharRect.left + dRelWidth * CharIterator->GetNormWidth(), 
			CharRect.top  + dRelHeight * NORM_DIGIHEIGHT);

		CharIterator->Draw(&memDC, CharRect, &OffPen, &OnPen, &hBrushOff, &hBrushOn);

		CharRect.left += dRelWidth * CharIterator->GetNormWidth();
	}

	// Mama says: Clean up your mess!
	memDC.SelectObject(pOldPen);
	memDC.SelectObject(pOldBrush);
	OffPen.DeleteObject();
	OnPen.DeleteObject();
	hBrushOff.DeleteObject();
	hBrushOn.DeleteObject();
}
开发者ID:SproutOrc,项目名称:BiteProc,代码行数:77,代码来源:Digistring.cpp


示例12: paint_Pathcast

/*
=====================
	paint_Pathcast
=====================
*/
void paint_Pathcast( place_t place ) {
	int xi, yi;
	int xf, yf;
	int i,j;
	COLORREF cr;
	int tmp;
	game_t *game = NULL;
	figure_t *fig = NULL;
	int blocksize = BLOCKSIZE;

	switch( place ) {
		case LEFTGAME:
			game = k_system.pLeftGame;
			break;
		
		case RIGHTGAME:
			game = k_system.pRightGame;
			break;
		
		default:
			return;
	}
	
	if( game == NULL ) {
		return;
	}

	//validate figure
	//
	if( game->pFig == NULL ) {
		return;
	}

	fig = game->pFig;
	if( fig->desintegrated ) {
		return;
	}
	
	//sometimes the figure has an invalid position
	//and seqProc has not been called yet to fix the problem
	//
	if( (fig->pos.y >= CYSPACE) ) {
		return;
	}
	
	cr = kcfTable[VAR_EFF_PATHCAST_COLOR].v.dw;
	glColor3f( GetRValue(cr)/255.0f, GetGValue(cr)/255.0f, GetBValue(cr)/255.0f );

	//draw pathcast effect
	//
	glBegin( GL_QUADS );
	for( j=0; j<CXFIG; j++ ) {
		i = 0;
		tmp = -1;
		while( i<CYFIG ) {
			if( kFigRes[fig->type][i][fig->state*CSTATE + j] == 1 ) {
				tmp=i;
			}
			i++;
		}
		
		//cast "shadow"
		//
		if( (tmp < 4) && (tmp > -1) ) {

			xi = ( j + fig->pos.x );
			yi = ( tmp + fig->pos.y + 1 );
			
			yf = yi;
			xf = xi;

			while( (yf < CYSPACE) && (SPACE_CELL( game->AS, yf, xf ) != MAPCELL_BLOCK) ) {
				yf++;
			}
			
			if( yf > yi ) {
				NGL_polygon( (GLfloat)( xi*blocksize ), (GLfloat)( yf*blocksize - blocksize/3 ),
					(GLfloat)( (xi+1)*blocksize ), (GLfloat)( yf*blocksize ) );
			}
		}
	}
	glEnd();
}
开发者ID:dimovich,项目名称:netrix,代码行数:88,代码来源:effect.c


示例13: RGB

//////////////////////////////////////////////////////////////////////////
//函数名:BitmapToRegion
//功能:输入图像句柄,得到抠除了蒙板色的区域
//原作者:Jean-Edouard Lachand Robert, August 5, 1998
//修改人:C瓜哥(www.cguage.com)
HRGN CAnimateButton::BitmapToRegion(HBITMAP hBmp, int nSplit, int n, 
			COLORREF cTransparentColor = RGB(255, 0, 255), 	COLORREF cTolerance = RGB(255, 0, 255))
{
	HRGN hRgn = NULL;

	if (hBmp)
	{
		// Create a memory DC inside which we will scan the bitmap content
		HDC hMemDC = CreateCompatibleDC(NULL);
		if (hMemDC)
		{
			// Get bitmap size
			BITMAP bm;
			GetObject(hBmp, sizeof(bm), &bm);

			// Create a 32 bits depth bitmap and select it into the memory DC 
			BITMAPINFOHEADER RGB32BITSBITMAPINFO =
			{	
				sizeof(BITMAPINFOHEADER),	// biSize 
				bm.bmWidth,					// biWidth; 
				bm.bmHeight,				// biHeight; 
				1,							// biPlanes; 
				32,							// biBitCount 
				BI_RGB,						// biCompression; 
				0,							// biSizeImage; 
				0,							// biXPelsPerMeter; 
				0,							// biYPelsPerMeter; 
				0,							// biClrUsed; 
				0							// biClrImportant; 
			};

			//每种状态图的宽度
			int nBlockWidth = bm.bmWidth / nSplit;

			VOID * pbits32; 
			HBITMAP hbm32 = CreateDIBSection(hMemDC, (BITMAPINFO *)&RGB32BITSBITMAPINFO, DIB_RGB_COLORS, &pbits32, NULL, 0);
			if (hbm32)
			{
				HBITMAP holdBmp = (HBITMAP)SelectObject(hMemDC, hbm32);

				// Create a DC just to copy the bitmap into the memory DC
				HDC hDC = CreateCompatibleDC(hMemDC);
				if (hDC)
				{
					// Get how many bytes per row we have for the bitmap bits (rounded up to 32 bits)
					BITMAP bm32;
					GetObject(hbm32, sizeof(bm32), &bm32);
					while (bm32.bmWidthBytes % 4)
						bm32.bmWidthBytes++;

					// Copy the bitmap into the memory DC
					HBITMAP holdBmp = (HBITMAP)SelectObject(hDC, hBmp);
					BitBlt(hMemDC, 0, 0, nBlockWidth, bm.bmHeight, hDC, nBlockWidth * n, 0, SRCCOPY);

					// For better performances, we will use the ExtCreateRegion() function to create the
					// region. This function take a RGNDATA structure on entry. We will add rectangles by
					// amount of ALLOC_UNIT number in this structure.
#define ALLOC_UNIT	100
					DWORD maxRects = ALLOC_UNIT;
					HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(RGNDATAHEADER) + (sizeof(RECT) * maxRects));
					RGNDATA *pData = (RGNDATA *)GlobalLock(hData);
					pData->rdh.dwSize = sizeof(RGNDATAHEADER);
					pData->rdh.iType = RDH_RECTANGLES;
					pData->rdh.nCount = pData->rdh.nRgnSize = 0;
					SetRect(&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0);

					// Keep on hand highest and lowest values for the "transparent" pixels
					BYTE lr = GetRValue(cTransparentColor);
					BYTE lg = GetGValue(cTransparentColor);
					BYTE lb = GetBValue(cTransparentColor);
					BYTE hr = min(0xff, lr + GetRValue(cTolerance));
					BYTE hg = min(0xff, lg + GetGValue(cTolerance));
					BYTE hb = min(0xff, lb + GetBValue(cTolerance));

					// Scan each bitmap row from bottom to top (the bitmap is inverted vertically)
					BYTE *p32 = (BYTE *)bm32.bmBits + (bm32.bmHeight - 1) * bm32.bmWidthBytes;
					for (int y = 0; y < bm.bmHeight; y++)
					{
						// Scan each bitmap pixel from left to right
						for (int x = 0; x < nBlockWidth; x++)
						{
							// Search for a continuous range of "non transparent pixels"
							int x0 = x;
							LONG *p = (LONG *)p32 + x;
							while (x < nBlockWidth)
							{

								BYTE b = GetRValue(*p);
								if (b >= lr && b <= hr)
								{
									b = GetGValue(*p);
									if (b >= lg && b <= hg)
									{
										b = GetBValue(*p);
										if (b >= lb && b <= hb)
//.........这里部分代码省略.........
开发者ID:latelan,项目名称:BlueClick,代码行数:101,代码来源:AnimateButton.cpp


示例14: cos

/**
 * colorize an image item (both standalone items with their own bitmap and glyph items).
 *
 * @param item			image item to colorize
 * @param clr			color to use (note: BGRA format required, although, alpha is ignored)
 * @param hue			hue adjustment (in degrees, -180 .. +180
 * @param saturation	scalar value (0.0 ... 1.0)
 * @param value			scalar value (0.0 ... 1.0)
 *
 * note: this isn't performance critical as it only runs at skin loading time or when
 * the user changes colorization options, never during rendering.
 *
 * if clr == 0, hsv transformation will be applied, otherwise it's rgb colorization.
 */
void Gfx::colorizeGlyph(TImageItem *item, const COLORREF clr, float hue, float saturation, float value)
{
	LONG	stride = 0, line, pixel;
	HBITMAP hBitmap = 0;
	LONG	x, y, x1, y1;
	BITMAP 	bmp = {0};
	DWORD	dwLen;
	BYTE*	pOrig, *pLine, alpha;
	float	v_s_u = 0, v_s_w = 0, r = 0, g = 0, b = 0;

    if(0 == clr) {			// do hsv transformation
    	v_s_u = value * saturation * cos(hue * M_PI/180);
    	v_s_w = value * saturation * sin(hue * M_PI/180);
    }
    else {					// rgb colorization
    	BYTE	rValue = GetRValue(clr);
    	BYTE	gValue = GetGValue(clr);
    	BYTE	bValue = GetBValue(clr);

    	r = (float)rValue / 2.55;
    	g = (float)gValue / 2.55;
    	b = (float)bValue / 2.55;
    }
	if(item) {
		/*
		 * colorize a rectangular glyph
		 */
		if(item->dwFlags & IMAGE_GLYPH) {
			hBitmap = Skin::glyphItem->hbm;
			x = item->glyphMetrics[0];
			y = item->glyphMetrics[1];
			x1 = x + item->glyphMetrics[2] - 1;
			y1 = y + item->glyphMetrics[3] - 1;

			GetObject(hBitmap, sizeof(bmp), &bmp);

			if (bmp.bmBitsPixel != 32)
				return;

			dwLen = bmp.bmWidth * bmp.bmHeight * 4;
			if (dwLen > m_sAllocated) {
				m_p = (BYTE *)realloc(m_p, dwLen);
				dwLen = (DWORD)m_sAllocated;
			}
			memset(m_p, 0, dwLen);
			pOrig = m_p;
			GetBitmapBits(hBitmap, dwLen, m_p);

			stride = bmp.bmWidthBytes;

			m_p += ((y * stride) + (4 * x));

			for(line = y; line <= y1; line++) {
				pLine = m_p;
				for(pixel = x; pixel <= x1; pixel++) {
                    alpha = m_p[3];
                    if(alpha > 0) {
                    	if(0 == clr)
                    		hsvTransformPixel(m_p, value, v_s_u, v_s_w, alpha);
                    	else
                    		rgbTransformPixel(m_p, r, g, b, alpha);
                    }
					m_p += 4;
				}
				m_p = pLine + stride;
			}
			SetBitmapBits(hBitmap, dwLen, pOrig);
		}
		else if (item->hbm) {
			GetObject(item->hbm, sizeof(bmp), &bmp);
			if (bmp.bmBitsPixel != 32)
				return;

			dwLen = bmp.bmWidth * bmp.bmHeight * 4;
			if (dwLen > m_sAllocated) {
				m_p = (BYTE *)realloc(m_p, dwLen);
				m_sAllocated = dwLen;
			}
			memset(m_p, 0, dwLen);
			pOrig = m_p;
			GetBitmapBits(item->hbm, dwLen, m_p);

			for(pixel = 0; pixel < (bmp.bmWidth * bmp.bmHeight); pixel++) {
                alpha = m_p[3];
                if(alpha > 0) {
                	if(0 == clr)
//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,代码来源:gfx.cpp


示例15: GetRValue

/**************************************************
void CImg::SetPixel(int x, int y, COLORREF color)

功能:
	设定指定坐标位置像素的颜色值

限制:
	无

参数:
	int x, int y
		指定的像素横、纵坐标值
	COLORREF
		欲设定的指定位置的颜色值,RGB形式给出
返回值:
	无
***************************************************/
void CImg::SetPixel(int x, int y, COLORREF color)
{
	if(m_pBMIH->biBitCount == 8)			// 256色图
	{
		m_lpData[m_pBMIH->biHeight - y - 1][x] = GetRValue(color);
	}
	else if(m_pBMIH->biBitCount == 1)		// 单色图
	{
		BYTE Color = GetRValue(color);


		// 令0代表黑
		RGBQUAD *p = (RGBQUAD*)m_lpvColorTable;
		if(p[0].rgbBlue != 0)
			Color = !Color;

		y = m_pBMIH->biHeight - y - 1;
		
		// 黑色点
		if (Color == 0)  // 设置对应位为0
		{
			if(x % 8==0)
			{
				m_lpData[y][x/8] &= 0x7F;  
			}
			else if(x % 8==1)
			{
				m_lpData[y][x/8] &= 0xBF;
			}
			else if(x % 8==2)
			{
				m_lpData[y][x/8] &= 0xDF;
			}
			else if(x % 8==3)
			{
				m_lpData[y][x/8] &= 0xEF;
			}
			else if(x % 8==4)
			{
				m_lpData[y][x/8] &= 0xF7;
			}
			else if(x % 8==5)
			{
				m_lpData[y][x/8] &= 0xFB;
			}
			else if(x % 8==6)
			{
				m_lpData[y][x/8] &= 0xFD;
			}
			else if(x % 8==7)
			{
				m_lpData[y][x/8] &= 0xFE;
			}
		}
		else // 白色点
		{
			if(x % 8==0)
			{
				m_lpData[y][x/8] |= 0x80;
			}
			else if(x % 8==1)
			{
				m_lpData[y][x/8] |= 0x40;
			}
			else if(x % 8==2)
			{
				m_lpData[y][x/8] |= 0x20;
			}
			else if(x % 8==3)
			{
				m_lpData[y][x/8] |= 0x10;
			}
			else if(x % 8==4)
			{
				m_lpData[y][x/8] |= 0x08;
			}
			else if(x % 8==5)
			{
				m_lpData[y][x/8] |= 0x04;
			}
			else if(x % 8==6)
			{
				m_lpData[y][x/8] |= 0x02;
//.........这里部分代码省略.........
开发者ID:WenjianZhangChina,项目名称:Digital-Image-Process,代码行数:101,代码来源:Img.cpp


示例16: RGB

VOID CZUIRender::DrawRect(HDC hDC, RECT& rc, DWORD dwBorderSize, DWORD dwBorderColor, SIZE* pxyBorderRound /* = NULL */)
{
	HPEN hPen = ::CreatePen(PS_SOLID | PS_INSIDEFRAME, dwBorderSize, RGB(GetBValue(dwBorderColor), GetGValue(dwBorderColor), GetRValue(dwBorderColor)));
	if(hPen != NULL)
	{
		HPEN hOldPen = (HPEN)::SelectObject(hDC, hPen);
		::SelectObject(hDC, ::GetStockObject(NULL_BRUSH));	// »­Ë¢Ñ¡Óÿջ­Ë¢, ¼´²»ÊµÐÄ
		if(pxyBorderRound != NULL)
		{
			// Ô²½Ç¾ØÐÎ
			::RoundRect(hDC, rc.left, rc.top, rc.right, rc.bottom, pxyBorderRound->cx, pxyBorderRound->cy);
		}
		else
		{
			::Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
		}
		::SelectObject(hDC, hOldPen);
		::DeleteObject(hPen);
	}
}
开发者ID:yarpee,项目名称:ZUI,代码行数:20,代码来源:ZUIRender.cpp


示例17: wxColour

bool 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetRadius函数代码示例发布时间:2022-05-30
下一篇:
C++ GetRCState函数代码示例发布时间: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