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

C++ GetGValue函数代码示例

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

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



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

示例1: RGBtoHLS

void CPalGroup::SortPal(int nIndex, int nStartIndex, int nSortFlag)
{

	if(!rgPalettes[nIndex].bAvail)
	{
		return; //Most likeley wont happen
	}

	double * pHSLArray;
	int nPalSz = rgPalettes[nIndex].uPalSz;
	
	if(rgPalettes[nIndex].pSortTable)
	{
		delete [] rgPalettes[nIndex].pSortTable;
	}

	pHSLArray = new double[nPalSz * 3];
	rgPalettes[nIndex].pSortTable = new UINT16[nPalSz];

	for(int i = 0; i < nPalSz; i++)
	{
		rgPalettes[nIndex].pSortTable[i] = (UINT16)i;

		RGBtoHLS(rgPalettes[nIndex].pPal[i], &pHSLArray[i], &pHSLArray[i + nPalSz], &pHSLArray[i + (nPalSz*2)]);
		
		//pHSLArray[i] = (double)(rgPalettes[nIndex].pPal[i] & 0x00FFFFFF);
	}

	//Go through array again
	for(int i = 0; i < nPalSz; i++)
	{		
		//pHSLArray[i] = pHSLArray[i] * pHSLArray[i + nPalSz] / pHSLArray[i + (nPalSz*2)];

		double fpPage;
		double fpPageSz = 20.0f;
		double fpPageAmt;
		
		pHSLArray[i] *= 360.0f;

		fpPageAmt = (double)((int)(pHSLArray[i] / fpPageSz));

		//pHSLArray[i] = fpPageSz * fpPageAmt;
		pHSLArray[i] += fpPageSz;//

		fpPage = 4096.0 * fpPageAmt;

		//pHSLArray[i] /=  fabs((pHSLArray[i + nPalSz * 2])-(pHSLArray[i + nPalSz]));
		
		//pHSLArray[i] /=  pHSLArray[i + nPalSz] + ((pHSLArray[i + (nPalSz * 2)]) / 3.0);
		//pHSLArray[i] /= (double)(rgPalettes[nIndex].pPal[i] & 0x00FFFFFF);

		//if(i && pHSLArray[i -1] == pHSLArray[i])
		//{
		//	pHSLArray[i] += pHSLArray[i + nPalSz];
		//}

		
		COLORREF crCol = rgPalettes[nIndex].pPal[i];
		double nR = (double)GetRValue(rgPalettes[nIndex].pPal[i])/255.0, 
			nG = (double)GetGValue(rgPalettes[nIndex].pPal[i])/255.0, 
			nB = (double)GetBValue(rgPalettes[nIndex].pPal[i])/255.0;

		double fpX, fpY, fpZ;

		ccRGBtoXYZ(nR, nG, nB, &fpX, &fpY, &fpZ);

		//pHSLArray[i] /= sqrt(sq(fpX) + sq(fpY) + sq(fpZ));
		pHSLArray[i] /= sqrt(sq(nR - 0) + sq(nG - 0) + sq(nB- 0));
	
		//pHSLArray[i] /= 
		//	pHSLArray[i + nPalSz] + ((pHSLArray[i + (nPalSz * 2)]) / 0.5) + sqrt(sq(nR - 0) + sq(nG - 0) + sq(nB- 0)) + fpX*4;
		
	

		pHSLArray[i] += fpPage;
	}
	
	/*
    */
	

	//for(int i = 0; i < nPalSz; i++)
	//{
	//	COLORREF crCol = rgPalettes[nIndex].pPal[i];
	//	double nR = (double)GetRValue(rgPalettes[nIndex].pPal[i]), 
	//		nG = (double)GetGValue(rgPalettes[nIndex].pPal[i]), 
	//		nB = (double)GetBValue(rgPalettes[nIndex].pPal[i]);
	//
	//	pHSLArray[i] /= 
	//		sqrt(sq(nR*0.3 - 0) + sq(nG*0.6 - 0) + sq(nB*0.1 - 0));
	//	
	//}
	//Sort again

	if((nSortFlag & SORT_HUE) == SORT_HUE)
	{
		for(int i = 0; i < 10; i++)
		{
			ShellSort(
				&pHSLArray[nStartIndex], 
//.........这里部分代码省略.........
开发者ID:DrewDos,项目名称:palmod,代码行数:101,代码来源:PalGroup.cpp


示例2: AdjustBrightness

VOID
AdjustBrightness(HBITMAP hOrigBitmap,
                 HBITMAP hNewBitmap,
                 HWND hwnd,
                 HDC hdcMem,
                 INT RedVal,
                 INT GreenVal,
                 INT BlueVal)
{
    BITMAPINFO bi;
    BITMAP bitmap;
    BOOL bRes;
    DWORD Count = 0;
    INT i, j;
    PBYTE pBits;
    RECT rc;

    GetObject(hNewBitmap,
              sizeof(BITMAP),
              &bitmap);

    /* Bitmap header */
    bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
    bi.bmiHeader.biWidth = bitmap.bmWidth;
    bi.bmiHeader.biHeight = bitmap.bmHeight;
    bi.bmiHeader.biPlanes = 1;
    bi.bmiHeader.biBitCount = 32;
    bi.bmiHeader.biCompression = BI_RGB;
    bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4;
    bi.bmiHeader.biClrUsed = 0;
    bi.bmiHeader.biClrImportant = 0;

    /* Buffer */
    pBits = (PBYTE)HeapAlloc(ProcessHeap,
                             0,
                             bitmap.bmWidth * bitmap.bmHeight * 4);
    if (!pBits)
        return;

    /* get the bits from the original bitmap */
    bRes = GetDIBits(hdcMem,
                     hOrigBitmap,
                     0,
                     bitmap.bmHeight,
                     pBits,
                     &bi,
                     DIB_RGB_COLORS);

    for (i = 0; i < bitmap.bmHeight; i++)
    {
        for (j = 0; j < bitmap.bmWidth; j++)
        {
            DWORD Val = 0;
            INT b, g, r;

            CopyMemory(&Val,
                       &pBits[Count],
                       4);

            /* Get pixels in reverse order */
            b = GetRValue(Val);
            g = GetGValue(Val);
            r = GetBValue(Val);

            /* Red */
            r += RedVal;
            if (r > 255) r = 255;
            else if (r < 0) r = 0;

            /* Green */
            g += GreenVal;
            if (g > 255) g = 255;
            else if (g < 0) g = 0;

            /* Blue */
            b += BlueVal;
            if (b > 255) b = 255;
            else if (b < 0) b = 0;

            /* Store in reverse order */
            Val = RGB(b, g, r);
            CopyMemory(&pBits[Count],
                       &Val,
                       4);

            /* RGB color take 4 bytes.The high-order byte must be zero */
            Count += 4;
        }
    }

    /* Set the new pixel bits */
    SetDIBits(hdcMem,
              hNewBitmap,
              0,
              bRes,
              pBits,
              &bi,
              DIB_RGB_COLORS);

    HeapFree(ProcessHeap,
//.........这里部分代码省略.........
开发者ID:Moteesh,项目名称:reactos,代码行数:101,代码来源:brightness.c


示例3: GetCursorPos

//属性菜单
void CGuiderView::OnAttribute()
{
	// TODO: 在此添加命令处理程序代码
	CPoint p;
	if(App_Veriable::RelativeContextMenuPos.x==-1&&App_Veriable::RelativeContextMenuPos.y==-1)//没有菜单
	{
		//快捷键
		GetCursorPos(&p);
		this->ScreenToClient(&p);
	}
	else//有菜单
	{
		p=App_Veriable::RelativeContextMenuPos;	
	}
	int sp=sitelist.OnSite(p.x,p.y);//获取地点对象
	Route* rp=routelist.OnRoute(p.x,p.y);//获取路径对象
	if(sp!=0)//优先选中地点
	{
		Site * s=sitelist.GetOfID(sp);
		dlgDySiteAttr.DynamicSiteID=s->ID;

		CString s0;
		s0.Format(L"(%d,%d)",s->Position.x,s->Position.y);
		dlgDySiteAttr.DynamicSitePosition=s0;

		switch(s->Style)
		{
		case'C':s0.Format(L"圆");break;
		case'T':s0.Format(L"三角形");break;
		case'R':s0.Format(L"矩形");break;
		default:s0.Format(L"");break;
		}
		dlgDySiteAttr.DynamicSiteStyle=s0;

		dlgDySiteAttr.DynamicSiteColorR=GetRValue(s->Color);
		dlgDySiteAttr.DynamicSiteColorG=GetGValue(s->Color);
		dlgDySiteAttr.DynamicSiteColorB=GetBValue(s->Color);

		dlgDySiteAttr.DynamicSiteSize=s->Size;

		dlgDySiteAttr.DynamicSiteInfo=s->SiteInfo;

		dlgDySiteAttr.DoModal();
	}
	else if(rp!=NULL)
	{
		dlgDyRouteAttr.DynamicRouteID1=rp->ID1;
		Site * s=sitelist.GetOfID(rp->ID1);
		CString s1;
		s1.Format(L"(%d,%d)",s->Position.x,s->Position.y);
		dlgDyRouteAttr.DynamicRoutePosition1=s1;

		dlgDyRouteAttr.DynamicRouteID2=rp->ID2;
		s=sitelist.GetOfID(rp->ID2);
		s1.Format(L"(%d,%d)",s->Position.x,s->Position.y);
		dlgDyRouteAttr.DynamicRoutePosition2=s1;

		double l=routelist.GetRouteLength(rp->ID1,rp->ID2);
		l*=2.287;//长度系数
		s1.Format(_T("%.4f m"),l);
		dlgDyRouteAttr.DynamicRouteLength=s1;

		dlgDyRouteAttr.DynamicRouteWidth=rp->Width;

		dlgDyRouteAttr.DynamicRouteColorR=GetRValue(rp->Color);
		dlgDyRouteAttr.DynamicRouteColorG=GetGValue(rp->Color);
		dlgDyRouteAttr.DynamicRouteColorB=GetBValue(rp->Color);

		dlgDyRouteAttr.DynamicRouteInfo=rp->RouteInfo;


		dlgDyRouteAttr.DynamicRoutePointSize=rp->Points->size;

		dlgDyRouteAttr.DynamicRoutePointColorR=GetRValue(rp->Points->color);
		dlgDyRouteAttr.DynamicRoutePointColorG=GetGValue(rp->Points->color);
		dlgDyRouteAttr.DynamicRoutePointColorB=GetBValue(rp->Points->color);

		dlgDyRouteAttr.DoModal();
	}

	CPoint q(-1,-1);
	App_Veriable::RelativeContextMenuPos=q;//还原菜单变量
}
开发者ID:fanzhidongyzby,项目名称:Guider,代码行数:84,代码来源:GuiderView.cpp


示例4: switch

INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_DELETEITEM:
		{
			LPDELETEITEMSTRUCT lpdis = (LPDELETEITEMSTRUCT)lParam;
			if (lpdis->CtlID != IDC_ROOM)
				break;

			RoomInfo *info = (RoomInfo *)lpdis->itemData;
			mir_free(info->line1);
			mir_free(info->line2);
			mir_free(info);
		}
		break;

	case WM_MEASUREITEM:
		{
			LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam;
			if (lpmis->CtlID != IDC_ROOM)
				break;

			lpmis->itemHeight = 2 * sttTextLineHeight;
			if (lpmis->itemID == -1)
				lpmis->itemHeight = sttTextLineHeight - 1;

		}
		break;

	case WM_DRAWITEM:
		{
			LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
			if (lpdis->CtlID != IDC_ROOM)
				break;

			RoomInfo *info = (RoomInfo *)SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_GETITEMDATA, lpdis->itemID, 0);
			COLORREF clLine1, clBack;

			if (lpdis->itemState & ODS_SELECTED) {
				FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
				clBack = GetSysColor(COLOR_HIGHLIGHT);
				clLine1 = GetSysColor(COLOR_HIGHLIGHTTEXT);
			}
			else {
				FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_WINDOW));
				clBack = GetSysColor(COLOR_WINDOW);
				clLine1 = GetSysColor(COLOR_WINDOWTEXT);
			}
			COLORREF clLine2 = RGB(
				GetRValue(clLine1) * 0.66 + GetRValue(clBack) * 0.34,
				GetGValue(clLine1) * 0.66 + GetGValue(clBack) * 0.34,
				GetBValue(clLine1) * 0.66 + GetBValue(clBack) * 0.34);

			SetBkMode(lpdis->hDC, TRANSPARENT);

			RECT rc = lpdis->rcItem;
			rc.bottom -= (rc.bottom - rc.top) / 2;
			rc.left += 20;
			SetTextColor(lpdis->hDC, clLine1);
			DrawText(lpdis->hDC, info->line1, -1, &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);

			rc = lpdis->rcItem;
			rc.top += (rc.bottom - rc.top) / 2;
			rc.left += 20;
			SetTextColor(lpdis->hDC, clLine2);
			DrawText(lpdis->hDC, info->line2, -1, &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);

			DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("group"), 16, 16, 0, NULL, DI_NORMAL);
			switch (info->overlay) {
			case RoomInfo::ROOM_WAIT:
				DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_progress"), 16, 16, 0, NULL, DI_NORMAL);
				break;
			case RoomInfo::ROOM_FAIL:
				DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_fail"), 16, 16, 0, NULL, DI_NORMAL);
				break;
			case RoomInfo::ROOM_BOOKMARK:
				DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("disco_ok"), 16, 16, 0, NULL, DI_NORMAL);
				break;
			}
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_SERVER:
			switch (HIWORD(wParam)) {
			case CBN_EDITCHANGE:
			case CBN_SELCHANGE:
				{
					int iqid = GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA);
					if (iqid) {
						m_proto->m_iqManager.ExpireIq(iqid);
						SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_ROOM), GWLP_USERDATA, 0);
					}
					SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_RESETCONTENT, 0, 0);
				}
				break;
			}
			break;

//.........这里部分代码省略.........
开发者ID:ybznek,项目名称:miranda-ng,代码行数:101,代码来源:jabber_groupchat.cpp


示例5: GetPos


//.........这里部分代码省略.........
		for(loop = 0; loop < loopMax; loop++)
		{
			clrRange clr;
			clr = colorList[loop];
			
			// Get the good values. If not set, then entire range is good
			int lval = clr.lval;
			int hval = clr.hval;
			if((lval < min) || (lval > max)) lval = min;
			if((hval > max) || (hval < min)) hval = max;

			if(lval == min)
			{
				gotStartColor = TRUE;
				startColor = clr.strColor;
			}
			if(hval == max)
			{
				gotEndColor = TRUE;
				endColor = clr.endColor;
			}

			int minVal = lval - min;	// offset into bitmap for this color
			minVal = int(double(minVal)/scale);

			// width (or height for vertical slider) inside bitmap for this color
			int widthVal = hval - lval;
			widthVal = int((double(widthVal)/scale) + 1.0);			
			
			// For drawing a gradient, we need to know the individual RGB values
			int sR,eR,sG,eG,sB,eB;	// start and end R, G, and B values
			sR = GetRValue(clr.strColor);
			eR = GetRValue(clr.endColor);
			sG = GetGValue(clr.strColor);
			eG = GetGValue(clr.endColor);
			sB = GetBValue(clr.strColor);
			eB = GetBValue(clr.endColor);

			if(GradientFill != NULL)
			{
				TRIVERTEX vert[2];	// for specifying range to gradient fill
				GRADIENT_RECT gRect;

// Warning C4244: conversion from 'int' to 'unsigned short', possible loss of data
#pragma warning (push)
#pragma warning (disable : 4244)
				vert[0].Red   = sR<<8;	// expects 16-bit color values!
				vert[0].Green = sG<<8;
				vert[0].Blue  = sB<<8;
				vert[0].Alpha = 0;		// no fading/transparency
				
				vert[1].Red   = eR<<8;
				vert[1].Green = eG<<8;
				vert[1].Blue  = eB<<8;
				vert[1].Alpha = 0;
#pragma warning (pop)

				gRect.UpperLeft = 0;
				gRect.LowerRight = 1;
				
				BOOL retval;
				if(IsVertical)	// vertically oriented?
				{
					vert[0].x = 0;
					vert[0].y = Offset + minVal;
					vert[1].x = iWidth;
开发者ID:caomw,项目名称:sketch-system-with-third-party-libs,代码行数:67,代码来源:SliderCtrlEx.cpp


示例6: ErasedDraw

void CPenBrushUnit::ErasedDraw(CDC *memDC, DataInfo &pDataInfo,HRGN ErasedRgn)
{
	CPoint sPoint,ePoint,psPoint,pePoint,ptPoint;
	double dx,dy,xlen,ylen;
	double preWidth,nWidth;
	int count=1;
	int alpha;
	int v=0;
	int Red,Green,Blue;
	Red=GetRValue(pDataInfo.penColor);
	Green=GetGValue(pDataInfo.penColor);
	Blue=GetBValue(pDataInfo.penColor);
	Color colors[]={Color(10,Red,Green,Blue)};
	Graphics mGraphics(memDC->m_hDC);
	///////////////////////////////////
	Matrix matrix;
	Region tRgn;
	Region *ptRgn=tRgn.FromHRGN(ErasedRgn);	
	mGraphics.ExcludeClip(ptRgn);
	matrix.Reset();
	delete ptRgn;
	////////////////////////////////////
	mGraphics.TranslateTransform(pDataInfo.CenterPoint.x,pDataInfo.CenterPoint.y);
	mGraphics.RotateTransform(pDataInfo.RotateAngle);
	mGraphics.SetSmoothingMode(SmoothingModeAntiAlias);
	sPoint=CaculatePoint(pDataInfo.StartPoint,pDataInfo);
	ePoint=CaculatePoint(pDataInfo.EndPoint,pDataInfo);
	xlen=ePoint.x-sPoint.x;
	ylen=ePoint.y-sPoint.y;
	preWidth=pDataInfo.AllRate[0].preWidth;
	alpha=pDataInfo.AllRate[0].alpha;
	psPoint.x=sPoint.x+xlen*pDataInfo.AllRate[0].xRate;
	psPoint.y=sPoint.y+ylen*pDataInfo.AllRate[0].yRate; 
	int Size=pDataInfo.AllRate.size();
	for(int Index=1;Index<Size;Index++)
	{
		pePoint.x=sPoint.x+xlen*pDataInfo.AllRate[Index].xRate;
		pePoint.y=sPoint.y+ylen*pDataInfo.AllRate[Index].yRate;
		dx=(pePoint.x-psPoint.x);
		dy=(pePoint.y-psPoint.y);
		nWidth=pDataInfo.AllRate[0].preWidth;
		float Angle=atan2(dy,dx)*Rate;
		GraphicsPath path(FillModeWinding);
		GraphicsPath path1,path2,path3,path4;
		RectF sRectF(psPoint.x,psPoint.y,0,0);
		sRectF.Inflate(preWidth,preWidth);
		RectF eRectF(pePoint.x,pePoint.y,0,0);
		eRectF.Inflate(nWidth,nWidth);
		///////////////////////////////////////////
		REAL  left=sRectF.GetLeft();
		REAL  top=sRectF.GetTop();
		REAL  bottom=sRectF.GetBottom();
		REAL  right=sRectF.GetRight();
		Point pts0[]={Point((left+right)/2,top),Point((left+right)/2,bottom)};
		matrix.RotateAt(Angle,PointF(psPoint.x,psPoint.y));
		matrix.TransformPoints(pts0,2);
		Point LeftTop(pts0[0].X,pts0[0].Y);
		Point LeftBottom(pts0[1].X,pts0[1].Y);
		path1.AddArc(sRectF,270.0f,-180.0f);
		path1.Transform(&matrix);
		matrix.Reset();

		top=eRectF.GetTop();
		bottom=eRectF.GetBottom();
		right=eRectF.GetRight();
		left=eRectF.GetLeft();
		Point pts1[]={Point((right+left)/2,bottom),Point((right+left)/2,top)};
		matrix.RotateAt(Angle,PointF(pePoint.x,pePoint.y));
		matrix.TransformPoints(pts1,2);
		Point RightBottom(pts1[0].X,pts1[0].Y);
		Point RightTop(pts1[1].X,pts1[1].Y);
		path3.AddArc(eRectF,90.0f,-180.0f);
		path3.Transform(&matrix);
		matrix.Reset();
		Point pts[]={LeftTop,RightTop,RightBottom,LeftBottom};
		///////////////////////////////////////////
		path2.AddLine(LeftBottom,RightBottom);
		path4.AddLine(RightTop,LeftTop);
		path.AddPath(&path1,true);
		path.AddPath(&path2,true);
		path.AddPath(&path3,true);
		path.AddPath(&path4,true);

		SolidBrush brush(Color(255,Red,Green,Blue));
		mGraphics.FillPath(&brush,&path);
		Pen pen(Color(255,Red,Green,Blue),1);
		mGraphics.DrawPath(&pen,&path);

		preWidth=nWidth;
		psPoint=pePoint;
	}
	mGraphics.ResetTransform();
}
开发者ID:duiniuluantanqin,项目名称:SCT_Board,代码行数:93,代码来源:PenBrushUnit.cpp


示例7: ReDraw

void CPenBrushUnit::ReDraw(CDC* memDC,DataInfo &pDataInfo)
{
	CPoint sPoint,ePoint,psPoint,pePoint,ptPoint;	
	double dx,dy,xlen,ylen;
	double preWidth,nWidth;
	Matrix matrix;
	int count=1;
	int alpha;
	int v=0;
	int Red,Green,Blue;
	Red=GetRValue(pDataInfo.penColor);
	Green=GetGValue(pDataInfo.penColor);
	Blue=GetBValue(pDataInfo.penColor);
	SolidBrush brush(Color(255,Red,Green,Blue));
	SolidBrush brush1(Color(200,Red,Green,Blue));
	Graphics mGraphics(memDC->m_hDC);
	mGraphics.TranslateTransform(pDataInfo.CenterPoint.x,pDataInfo.CenterPoint.y);
	mGraphics.RotateTransform(pDataInfo.RotateAngle);
	mGraphics.SetSmoothingMode(SmoothingModeAntiAlias);
	mGraphics.ScaleTransform(pDataInfo.xScale,pDataInfo.yScale);
	///////////////////////////////////
	Region tRgn;
	Region *ptRgn=tRgn.FromHRGN(pDataInfo.hRgn);
	if(ptRgn != NULL)
	mGraphics.ExcludeClip(ptRgn);	
	delete ptRgn;
	////////////////////////////////////
	int Size=pDataInfo.AllRate.size();
	sPoint=CaculatePoint(pDataInfo.StartPoint,pDataInfo);
	ePoint=CaculatePoint(pDataInfo.EndPoint,pDataInfo);
	xlen=ePoint.x-sPoint.x;
	ylen=ePoint.y-sPoint.y;
	if(xlen<1)
		xlen=1;
	if(ylen<1)
		ylen=1;
	if(fwidth.size()!=0)
		fwidth.clear();
	fwidth.insert(std::map<DWORD,float>::value_type(0,pDataInfo.AllRate[0].preWidth));
	alpha=pDataInfo.AllRate[0].alpha;

	psPoint.x=sPoint.x+xlen*pDataInfo.AllRate[0].xRate;
	psPoint.y=sPoint.y+ylen*pDataInfo.AllRate[0].yRate;
	for(int Index=1;Index<Size;Index++)	
	{
		pePoint.x=sPoint.x+xlen*pDataInfo.AllRate[Index].xRate;
		pePoint.y=sPoint.y+ylen*pDataInfo.AllRate[Index].yRate;

		if(Index==1)
			PushStart(psPoint,0);
		if(Push(psPoint,pePoint,0))
		{
			RectF headRect;
			RectF tailRect;
			float width,dx,dy;
			PointF lfCenter,rtCenter;
			mGraphics.FillPolygon(&brush,pts,npts);
			mGraphics.DrawPolygon(&Pen(Color(200,Red,Green,Blue),1),pts,npts);
			if(npts==4)
			{
				headRect=RectF((pts[0].X+pts[3].X)/2.0f,(pts[0].Y+pts[3].Y)/2.0f,0.0f,0.0f);
				tailRect=RectF((pts[1].X+pts[2].X)/2.0f,(pts[1].Y+pts[2].Y)/2.0f,0.0f,0.0f);
				dx=pts[3].X-pts[0].X;
				dy=pts[3].Y-pts[0].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				headRect.Inflate(width,width);
				dx=pts[2].X-pts[1].X;
				dy=pts[2].Y-pts[1].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				tailRect.Inflate(width,width);
			}
			else
			{
				headRect=RectF((pts[0].X+pts[9].X)/2.0f,(pts[0].Y+pts[9].Y)/2.0f,0.0f,0.0f);
				tailRect=RectF((pts[4].X+pts[5].X)/2.0f,(pts[4].Y+pts[5].Y)/2.0f,0.0f,0.0f);
				dx=pts[9].X-pts[0].X;
				dy=pts[9].Y-pts[0].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				headRect.Inflate(width,width);
				dx=pts[5].X-pts[4].X;
				dy=pts[5].Y-pts[4].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				tailRect.Inflate(width,width);
			}
			mGraphics.FillEllipse(&brush1,headRect);
			mGraphics.FillEllipse(&brush1,tailRect);


			//preWidth=nWidth;
			psPoint=pePoint;
		}
	}
	mGraphics.ResetTransform();
}
开发者ID:duiniuluantanqin,项目名称:SCT_Board,代码行数:94,代码来源:PenBrushUnit.cpp


示例8: UpdateData

//按照等距自动进行分段
void CRangeRenderPage::OnBnClickedBtnAutoSetrange()
{
    UpdateData(TRUE);

	if(m_Breaknum<=0 || m_renderField.IsEmpty())
	{
		return;
	}

    double dmin=0.0,dmax =0.0;

	//获得字段的最大最小值
	GetMinMaxValue(dynamic_cast<Geodatabase::IFeatureClass*>(m_pLayer->GetDataObject().get()),
		            m_renderField,&dmax,&dmin);

    
	m_Classes.clear();
    m_list.DeleteAll();

	COLORREF beginColor =m_ctlColorRamp.get_curStartColor();
	COLORREF endColor =m_ctlColorRamp.get_curEndColor();
    

	RangeItem item;

	Display::ISymbolPtr pDefaultSymbol =CreateDefaultSymbol(dynamic_cast<Geodatabase::IFeatureClass*>(m_pLayer->GetDataObject().get()));

	Display::ISymbolPtr pSymbol;
	//如果最大最小值相等,则只分一个段
    if(dmin ==dmax)
	{
        item.max =dmax;
		item.min =dmin;
		pSymbol =pDefaultSymbol->Clone();
		pSymbol->SetColor(beginColor);
		item.pSymbol =pSymbol;

		item.strLabel.Format("%.6f%s%.6f",item.min,"-",item.max);
		
		m_Classes.push_back(item);
	    
	}
	else
	{
		//获取过渡色彩的各个分量
		int begin_r_color = (int)GetRValue(beginColor);
		int begin_g_color = (int)GetGValue(beginColor);
		int begin_b_color = (int)GetBValue(beginColor);

		int end_r_color =(int) GetRValue(endColor);
		int end_g_color =(int) GetGValue(endColor);
		int end_b_color =(int) GetBValue(endColor);

		double dr,dg,db;
        
		BYTE markr,markg,markb;

		if(m_Breaknum == 1)	
		{
			dr = end_r_color - begin_r_color;
			dg = end_g_color - begin_g_color;
			db = end_b_color - begin_b_color;
		}	  
		else
		{
			dr = (end_r_color - begin_r_color) / (double)(m_Breaknum - 1);
			dg = (end_g_color - begin_g_color) / (double)(m_Breaknum - 1);
			db = (end_b_color - begin_b_color) / (double)(m_Breaknum - 1);
		}
        
		double step =(dmax-dmin)/m_Breaknum;
        
	
		//分段的方法
		/*
		upper = min + i * step
		保留六位有效位
		下一个区间为上一个的上限+0.000001
		*/
		//依次加入区间
		for(int i=0;i<m_Breaknum;i++)
		{
			markr =begin_r_color+i*dr;
			markg =begin_g_color+i*dg;
			markb =begin_b_color +i*db;

			item.min =dmin+step*i+0.000001;
			item.max =dmin+step*(i+1);
			pSymbol =pDefaultSymbol->Clone();
			pSymbol->SetColor(RGB(markr,markg,markb));
			item.pSymbol =pSymbol;
			item.strLabel.Format("%.6f%s%.6f",item.min,"-",item.max);
			m_Classes.push_back(item);
		}

		//设置第一个和最后一个区间
		m_Classes[0].min =dmin;
		m_Classes[m_Breaknum-1].max =dmax;

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


示例9: CreateCompatibleDC

HBITMAP	KGUISkin::CreateGradient(HDC hDC, COLORREF clrBase, COLORREF clrHigh, COLORREF clrLow, bool bVert)
{
	HDC hMemDC = CreateCompatibleDC (hDC) ;
	HBITMAP hDDB = CreateCompatibleBitmap (hDC, m_nWidth, m_nWidth);
	if (hDDB == NULL)
	{
		::DeleteDC (hMemDC) ;
		assert(false);
		return NULL;
	}

	HGDIOBJ	hOldBmp = ::SelectObject (hMemDC, hDDB);	
	TRIVERTEX vertex[4];
	vertex[0].x     = 0;
	vertex[0].y     = 0;
	vertex[0].Red   = GetRValue(clrHigh) * 256;
	vertex[0].Green = GetGValue(clrHigh) * 256;
	vertex[0].Blue  = GetBValue(clrHigh) * 256;
	vertex[0].Alpha = 0x0000;

	vertex[1].Red   = GetRValue(clrBase) * 256;
	vertex[1].Green = GetGValue(clrBase) * 256;
	vertex[1].Blue  = GetBValue(clrBase) * 256;
	vertex[1].Alpha = 0x0000;

	if (bVert)
	{
		vertex[1].x = m_nWidth;
		vertex[1].y = m_nWidth / 2;
		vertex[3].x = 0;
		vertex[3].y = m_nWidth / 2; 
	}
	else
	{
		vertex[3].y = 0;
		vertex[3].x = m_nWidth / 2; 
		vertex[1].y = m_nWidth;
		vertex[1].x = m_nWidth / 2;
	}

	vertex[3].Red   = GetRValue(clrBase) * 256;
	vertex[3].Green = GetGValue(clrBase) * 256;
	vertex[3].Blue  = GetBValue(clrBase) * 256;
	vertex[3].Alpha = 0x0000;

	vertex[2].x     = m_nWidth;
	vertex[2].y     = m_nWidth;
	vertex[2].Red   = GetRValue(clrLow) * 256;
	vertex[2].Green = GetGValue(clrLow) * 256;
	vertex[2].Blue  = GetBValue(clrLow) * 256;
	vertex[2].Alpha = 0x0000;

	GRADIENT_RECT gRect;
	gRect.UpperLeft = 0;
	gRect.LowerRight= 1;

	GRADIENT_RECT gTriangle2;
	gTriangle2.UpperLeft  = 0;
	gTriangle2.LowerRight = 1;

	if (bVert)
	{
		GradientFill(hMemDC, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_V);
		GradientFill(hMemDC, &vertex[2], 2, &gTriangle2, 1, GRADIENT_FILL_RECT_V);
	}
	else
	{
		GradientFill(hMemDC, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_H);
		GradientFill(hMemDC, &vertex[2], 2, &gTriangle2, 1, GRADIENT_FILL_RECT_H);
	}

	BITMAPINFO info;
	UInt32 nPitch	= (m_nWidth * 24 + 31) / 32 * 4;
	UInt32 dibSize	= sizeof(BITMAPINFOHEADER) + (nPitch * m_nWidth);
	BYTE * pBuf		= new BYTE[dibSize];
	BYTE *pData		= (BYTE*)pBuf;
	
	memset(pBuf, 0, dibSize);	
	memset(&info, 0, sizeof(BITMAPINFOHEADER));

	info.bmiHeader.biBitCount	= 24;
	info.bmiHeader.biCompression= BI_RGB;
	info.bmiHeader.biClrUsed	= 0;
	info.bmiHeader.biHeight		= m_nWidth;
	info.bmiHeader.biPlanes		= 1;
	info.bmiHeader.biSizeImage	= 0;
	info.bmiHeader.biSize		= 40;
	info.bmiHeader.biWidth		= m_nWidth;
	pData += sizeof(BITMAPINFOHEADER);

	// Copy the bitmap
	::GetDIBits (hMemDC, hDDB, 0, m_nWidth, pData, &info, DIB_RGB_COLORS) ;	
	HBITMAP hBitmap = ::CreateDIBitmap(hDC, &info.bmiHeader, CBM_INIT, pData, &info, DIB_RGB_COLORS);

	delete[] pBuf;
	::SelectObject (hMemDC, hOldBmp);
	DeleteObject (hDDB) ;
	DeleteDC (hMemDC) ;

	return hBitmap;
//.........这里部分代码省略.........
开发者ID:iShumai,项目名称:GUIEngine,代码行数:101,代码来源:KudGUISkin.cpp


示例10: WndProc

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
  HWND hwndParent = hWndParent;
  HWND hwndImage = hWndImage;

  if (hwnd == hwndParent) {
    if (message == WM_SIZE) {
      ShowWindow(hwndImage, wParam == SIZE_MINIMIZED ? SW_HIDE : SW_SHOW);
    }
    if (message == WM_WINDOWPOSCHANGED) {
      SetWindowPos(hwndImage, hwndParent, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
    }
    return CallWindowProc(
      (long (__stdcall *)(HWND,unsigned int,unsigned int,long))oldProc,
      hwnd,
      message,
      wParam,
      lParam
    );
  }
  switch (message) {
    case WM_PAINT:
    if (bgBitmap.bReady) {
      ECS();

      PAINTSTRUCT ps;
      HDC hdc = BeginPaint(hwnd, &ps);

      if (bgBitmap.iType == MIL_BITMAP) {
        HDC cdc = CreateCompatibleDC(hdc);
        SelectObject(cdc, bgBitmap.hBitmap);
        for (unsigned int x = 0; x < uWndWidth; x += bgBitmap.rPos.right) {
          for (unsigned int y = 0; y < uWndHeight; y += bgBitmap.rPos.bottom) {
            BitBlt(hdc, x, y, bgBitmap.rPos.right, bgBitmap.rPos.bottom, cdc, 0, 0, SRCCOPY);
          }
        }
        DeleteDC(cdc);
      }
      else {
        int r = GetRValue(bgBitmap.cGradientFrom) << 10;
        int g = GetGValue(bgBitmap.cGradientFrom) << 10;
        int b = GetBValue(bgBitmap.cGradientFrom) << 10;
        int dr = ((GetRValue(bgBitmap.cGradientTo) << 10) - r) / (int)uWndHeight * 4;
        int dg = ((GetGValue(bgBitmap.cGradientTo) << 10) - g) / (int)uWndHeight * 4;
        int db = ((GetBValue(bgBitmap.cGradientTo) << 10) - b) / (int)uWndHeight * 4;
        RECT rect;
        rect.left = 0;
        rect.top = 0;
        rect.right = uWndWidth;
        rect.bottom = 4;
        while (rect.top < (int)uWndHeight)
        {
          HBRUSH brush = CreateSolidBrush(RGB(r>>10,g>>10,b>>10));
          FillRect(hdc, &rect, brush);
          DeleteObject(brush);
          rect.top+=4;
          rect.bottom+=4;
          r+=dr;
          g+=dg;
          b+=db;
        }
      }

      myImageList *img = bgBitmap.next;
      while (img) {
        if (img->iType == MIL_TEXT) {
          SetBkMode(hdc, TRANSPARENT);

          SetTextColor(hdc, img->cTextColor);
          SelectObject(hdc, img->hFont);
          DrawText(hdc, img->szText, -1, &img->rPos, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK);
        }
        else if (img->iType == MIL_BITMAP) {
          HDC cdc = CreateCompatibleDC(hdc);
          SelectObject(cdc, img->hBitmap);
          BitBlt(hdc, img->rPos.left, img->rPos.top, img->rPos.right - img->rPos.left, img->rPos.bottom - img->rPos.top, cdc, 0, 0, SRCCOPY);
          DeleteDC(cdc);
        }
        else {
          COLORREF   cColor;
          HBITMAP    bmAndBack, bmAndObject, bmAndMem, bmSave;
          HBITMAP    bmBackOld, bmObjectOld, bmMemOld, bmSaveOld;
          HDC        hdcMem, hdcBack, hdcObject, hdcTemp, hdcSave;
          POINT      ptSize;

          HBITMAP hBitmap = img->hBitmap;

          hdcTemp = CreateCompatibleDC(hdc);
          SelectObject(hdcTemp, hBitmap);   // Select the bitmap

          ptSize.x = img->rPos.right - img->rPos.left;
          ptSize.y = img->rPos.bottom - img->rPos.top;
          DPtoLP(hdcTemp, &ptSize, 1);  // Convert from device to logical points

          // Create some DCs to hold temporary data.
          hdcBack   = CreateCompatibleDC(hdc);
          hdcObject = CreateCompatibleDC(hdc);
          hdcMem    = CreateCompatibleDC(hdc);
          hdcSave   = CreateCompatibleDC(hdc);

          // Create a bitmap for each DC. DCs are required for a number of
//.........这里部分代码省略.........
开发者ID:kichik,项目名称:nsis-1,代码行数:101,代码来源:BgImage.cpp


示例11: if


//.........这里部分代码省略.........
        // Draw button
        if (m_nCurrentSel == nIndex) 
            pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
        else if (m_nChosenColourSel == nIndex)
            pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);

        // Draw custom text
        CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
        pDC->SetBkMode(TRANSPARENT);
        pDC->DrawText(m_strCustomText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
        pDC->SelectObject(pOldFont);

        return;
    }        

    // For the Default Text area
    if (m_strDefaultText.GetLength() && nIndex == DEFAULT_BOX_VALUE)
    {
        // Fill background
        pDC->FillSolidRect(m_DefaultTextRect, ::GetSysColor(COLOR_3DFACE));

        // The extent of the actual text button
        CRect TextButtonRect = m_DefaultTextRect;
        TextButtonRect.DeflateRect(1,1);

        // fill background
        if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
            pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
        else
            pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));

        // Draw thin line around text
        CRect LineRect = TextButtonRect;
        LineRect.DeflateRect(2*m_nMargin,2*m_nMargin);
        CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
        CPen* pOldPen = pDC->SelectObject(&pen);
        pDC->SelectStockObject(NULL_BRUSH);
        pDC->Rectangle(LineRect);
        pDC->SelectObject(pOldPen);

        // Draw button
        if (m_nCurrentSel == nIndex) 
            pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
        else if (m_nChosenColourSel == nIndex)
            pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);

        // Draw custom text
        CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
        pDC->SetBkMode(TRANSPARENT);
        pDC->DrawText(m_strDefaultText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
        pDC->SelectObject(pOldFont);

        return;
    }        

    CRect rect;
    if (!GetCellRect(nIndex, rect)) return;

    // Select and realize the palette
    CPalette* pOldPalette = NULL;
    if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
    {
        pOldPalette = pDC->SelectPalette(&m_Palette, FALSE);
        pDC->RealizePalette();
    }

    // fill background
    if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
        pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DHILIGHT));
    else
        pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));

    // Draw button
    if (m_nCurrentSel == nIndex) 
        pDC->DrawEdge(rect, BDR_RAISEDINNER, BF_RECT);
    else if (m_nChosenColourSel == nIndex)
        pDC->DrawEdge(rect, BDR_SUNKENOUTER, BF_RECT);

    CBrush brush(PALETTERGB(GetRValue(GetColour(nIndex)), 
                            GetGValue(GetColour(nIndex)), 
                            GetBValue(GetColour(nIndex)) ));
    CPen   pen;
    pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));

    CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
    CPen*   pOldPen   = (CPen*)   pDC->SelectObject(&pen);

    // Draw the cell colour
    rect.DeflateRect(m_nMargin+1, m_nMargin+1);
    pDC->Rectangle(rect);

    // restore DC and cleanup
    pDC->SelectObject(pOldBrush);
    pDC->SelectObject(pOldPen);
    brush.DeleteObject();
    pen.DeleteObject();

    if (pOldPalette && pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
        pDC->SelectPalette(pOldPalette, FALSE);
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:101,代码来源:ColourPopup.cpp


示例12: GetDC

void ProgressWindow::draw(int count)
{
  HDC hDC = GetDC(hWnd);
  int prgBase = getProgress();
  int prg = min((prgBase * p_width)/1000, p_width-1);
  int center = int(prg*((cos(count*0.1)+1)*0.8) / 2);

  DWORD c=GetSysColor(COLOR_ACTIVECAPTION);
  double red=GetRValue(c);
  double green=GetGValue(c);
  double blue=GetBValue(c);

  double blue1=min(255., blue*1.4);
  double green1=min(255., green*1.4);
  double red1=min(255., red*1.4);

  int blueD=int(blue/2);
  int redD=int(red/2);
  int greenD=int(green/2);

  SelectObject(hDC, GetStockObject(DC_PEN));
  SelectObject(hDC, GetStockObject(NULL_BRUSH));
  SetDCPenColor(hDC, RGB(redD,greenD,blueD));

  Rectangle(hDC, 0, 0, p_width, p_height-1);
  SelectObject(hDC, GetStockObject(DC_BRUSH));
  SelectObject(hDC, GetStockObject(NULL_PEN));

  SetDCBrushColor(hDC, GetSysColor(COLOR_3DHIGHLIGHT));

  Rectangle(hDC, prg, 1, p_width-1, p_height-2);

  TRIVERTEX vert[4];
  vert [0] .x      = 1;
  vert [0] .y      = 1;
  vert [0] .Red    = 0xff00&DWORD(red*256);
  vert [0] .Green  = 0xff00&DWORD(green*256);
  vert [0] .Blue   = 0xff00&DWORD(blue*256);
  vert [0] .Alpha  = 0x0000;

  vert [1] .x      = center;
  vert [1] .y      = p_height-2;
  vert [1] .Red    = 0xff00&DWORD(red1*256);
  vert [1] .Green  = 0xff00&DWORD(green1*256);
  vert [1] .Blue   = 0xff00&DWORD(blue1*256);
  vert [1] .Alpha  = 0x0000;

  vert [2] .x      = center;
  vert [2] .y      = 1;
  vert [2] .Red    = 0xff00&DWORD(red1*256);
  vert [2] .Green  = 0xff00&DWORD(green1*256);
  vert [2] .Blue   = 0xff00&DWORD(blue1*256);
  vert [2] .Alpha  = 0x0000;

  vert [3] .x      = prg;
  vert [3] .y      = p_height-2;
  vert [3] .Red    = 0xff00&DWORD(red*256);
  vert [3] .Green  = 0xff00&DWORD(green*256);
  vert [3] .Blue   = 0xff00&DWORD(blue*256);
  vert [3] .Alpha  = 0x0000;

  GRADIENT_RECT gr[2];
  gr[0].UpperLeft=0;
  gr[0].LowerRight=1;
  gr[1].UpperLeft=2;
  gr[1].LowerRight=3;

  GradientFill(hDC,vert, 4, gr, 2, GRADIENT_FILL_RECT_H);

  ReleaseDC(hWnd, hDC);
}
开发者ID:ledusledus,项目名称:meos,代码行数:71,代码来源:progress.cpp


示例13: while

bool CRTFParser::ParseBlock (const STextFormatDesc &InitFormat, CString *retsError)

//	ParseBlock
//
//	Parses a block and leaves the input position at the first character after
//	the end of the block.

	{
	//	Better be the beginning of a block

	if (*m_pInput++ != '{')
		{
		*retsError = ERR_BRACE_EXPECTED;
		return false;
		}

	//	Keep track of the current format and text

	STextFormatDesc Format = InitFormat;

	//	Keep looping until we hit the end of the block

	bool bBlockStart = true;
	while (*m_pInput != '}')
		{
		//	End of stream

		if (*m_pInput == '\0')
			{
			*retsError = ERR_UNEXPECTED_EOS;
			return false;
			}

		//	If an escape character then parse an op code

		else if (*m_pInput == '\\' || *m_pInput == '/')
			{
			m_pInput++;

			//	If this is the beginning of the block then parse some codes

			if (bBlockStart)
				{
				CString sCode;
				CString sParam;
				if (!ParseCode(&sCode, &sParam, retsError))
					return false;

				//	Interpret code

				if (strEquals(sCode, CODE_BOLD))
					Format.bBold = true;
				else if (strEquals(sCode, CODE_COLOR))
					{
					DWORD dwRGB = (DWORD)strToInt(sParam, 0);
					Format.wColor = CG16bitImage::RGBValue(GetRValue(dwRGB), GetGValue(dwRGB), GetBValue(dwRGB));
					}
				else if (strEquals(sCode, CODE_TYPEFACE))
					Format.sTypeface = sParam;
				else if (strEquals(sCode, CODE_ITALIC))
					Format.bItalic = true;
				else if (strEquals(sCode, CODE_RTF))
					;
				else
					{
					*retsError = strPatternSubst(ERR_UNKNOWN_CODE, sCode);
					return false;
					}
				}

			//	Parse some escape characters

			else
				{
				switch (*m_pInput)
					{
					case '{':
					case '}':
					case '\\':
					case '/':
						AddSpan(CString(m_pInput, 1), Format);
						break;

					case 'n':
						AddSpan(NULL_STR, Format, true);
						break;

					default:
						{
						*retsError = strPatternSubst(ERR_UNKNOWN_CODE, CString(m_pInput, 1));
						return false;
						}
					}

				m_pInput++;
				}
			}

		//	Special characters

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


示例14: HighlightHexColor

void HighlightHexColor(const HWND h_scintilla, const int start_position, const int end_position){

	int match_count = 0;
	int search_start = start_position;

    while (match_count < MAX_COLOR_CODE_HIGHTLIGHT && search_start < end_position) {

		Sci_TextToFind tf;
		tf.chrg.cpMin = search_start;
		tf.chrg.cpMax = end_position+1;
		tf.lpstrText = "#";

		int target_pos = ::SendMessage(h_scintilla, SCI_FINDTEXT, 0, (LPARAM)&tf);

		// not found
		if(target_pos == -1) {
			break;
		}

		// read in the possible color code sequence
		char hex_color[8];

		int index = 0;
		for(; index<6; index++){
			char t = (char)::SendMessage(h_scintilla, SCI_GETCHARAT, target_pos+1 + index, 0);
			if( t=='\0' )
				break;
			if( strchr("0123456789abcdefABCDEF", t) == NULL )
				break;
			hex_color[index] = t;
		}

		hex_color[index] = '\0';

		// align the positions
        int target_length = strlen(hex_color);
        int target_start = target_pos;
        int target_end = target_pos + target_length + 1; // don't forget the '#'

		// invalid hex color length
        if (target_length !=3 && target_length != 6) {
			search_start = target_end; // move on
            continue;
        }

		// pad 3 char hex string
        if (target_length == 3) {
			hex_color[6] = '\0';
            hex_color[5] = hex_color[2];
            hex_color[4] = hex_color[2];
            hex_color[3] = hex_color[1];
            hex_color[2] = hex_color[1];
            hex_color[1] = hex_color[0];
            hex_color[0] = hex_color[0];
        }

        // parse hex color string to COLORREF
		COLORREF color = strtol(hex_color, NULL, 16);
		color = RGB(GetBValue(color),GetGValue(color),GetRValue(color));

		bool can_proceed = HighlightCode(h_scintilla, color, target_start, target_end);

		// exceeded the indicator count
		if(!can_proceed)
			break;

		search_start = target_end; // move on
        match_count++;

    }

}
开发者ID:ard225,项目名称:nppqcp,代码行数:72,代码来源:NppQCP.cpp


示例15: RGB

COLORREF CColorListCtrl::InvertColor(COLORREF cf)
{
	return RGB(abs(220-GetRValue(cf)),abs(220-GetGValue(cf)),abs(220-GetBValue(cf)));
}
开发者ID:vinhnguyen200893,项目名称:fr-hcm14-mock-project,代码行数:4,代码来源:ColorListCtrl.cpp


示例16: _T

BOOL CRasterPropPage::OnApply()
{
	if(!m_wndPropList)
		return FALSE;

	CBCGPProp* pProp = m_wndPropList.GetProperty(0);
	int nCount = pProp->GetSubItemsCount();
	std::string str = _T("波段组合");
	CBCGPProp* pSubProp = NULL;
	for (int i=0; i<nCount; i++)
	{
		pSubProp = pProp->GetSubItem(i);
		if (0 == strcmp(str.c_str(),pSubProp->GetName()))
		{
			break;
		}
	}
	//
	Carto::CRasterLayer* pRasLayer = dynamic_cast<Carto::CRasterLayer*>(m_player);

	Carto::IRasterRenderPtr pRender =pRasLayer->GetRender();
	Carto::RASTER_RENDER_TYPE rendertype =pRender->GetRenderType();

	if(rendertype != Carto::RASTER_RGBRENDER)
		return FALSE;

	Carto::CRasterRGBRender* pRGBRender = dynamic_cast<Carto::CRasterRGBRender*>(pRasLayer->GetRender().get());
	if (pRGBRender->GetRGBMode())
	{
		pRGBRender->SetRedBandIndex(long(pSubProp->GetSubItem(0)->GetValue()));
		pRGBRender->SetGreenBandIndex(long(pSubProp->GetSubItem(1)->GetValue()));
		pRGBRender->SetBlueBandIndex(long(pSubProp->GetSubItem(2)->GetValue()));
	}

	std::string strColormap = _T("调色板");
	pSubProp = NULL;
	bool bfind=false;
	for (int i=0; i<nCount; i++)
	{
		pSubProp = pProp->GetSubItem(i);
		if (0 == strcmp(strColormap.c_str(),pSubProp->GetName()))
		{
			bfind=true;
			break;
		}
	}

	if (!bfind)
		return TRUE;
	Geodatabase::IRasterDatasetPtr pRaster = m_player->GetDataObject();

	BYTE byRed[256];
	BYTE byGreen[256];
	BYTE byBlue[256];
	for (int i=0; i<256; i++)
	{
		long lValue = pSubProp->GetSubItem(i)->GetValue();
		byRed[i] = GetRValue(lValue);
		byGreen[i] = GetGValue(lValue);
		byBlue[i] = GetBValue(lValue);
	}
	pRaster->SetChannelPalette(1,byRed,byGreen,byBlue);
	

	return TRUE;
}
开发者ID:lozpeng,项目名称:applesales,代码行数:66,代码来源:RasterPropPage.cpp


示例17: GetRValue

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Function Header
void CStaticCounter::Draw(CStaticDC* pDC, DWORD dwChar, int nCol)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
	COLORREF crNotchColor = m_crForeground;
	
	if (dwChar == STCOUNTERALL && !m_bSpecifiedFadeColour)	// The colour used will be a dim version of normal foregroun 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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