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


C++ CRGBA类代码示例

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


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

示例1: draw

// ----------------------------------------------------------------------------
void CViewBitmap::draw ()
{
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = pIM->getViewRenderer();

	CRGBA col;
	if(getModulateGlobalColor())
	{
		col.modulateFromColor (_Color, pIM->getGlobalColorForContent());
	}
	else
	{
		col= _Color;
		col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
	}

	if (_InheritGCAlpha)
	{
		// search a parent container
		CInterfaceGroup *gr = getParent();
		while (gr)
		{
			if (gr->isGroupContainer())
			{
				CGroupContainer *gc = static_cast<CGroupContainer *>(gr);
				col.A = (uint8)(((sint32)col.A*((sint32)gc->getCurrentContainerAlpha()+1))>>8);
				break;
			}
			gr = gr->getParent();
		}
	}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:32,代码来源:view_bitmap.cpp

示例2: OnDblclkListVegetableColor

// ***************************************************************************
void CVegetableApperancePage::OnDblclkListVegetableColor()
{
    CRGBA	color;

    // get the current color of the value.
    int		id= ColorList.GetCurSel();
    if(id!=LB_ERR)
    {
        color= ColorList.getValue(id);

        // Open a colorDialog.
        CColorDialog	colorDialog(RGB(color.R, color.G, color.B), CC_FULLOPEN);
        if( colorDialog.DoModal()==IDOK )
        {
            // update view
            COLORREF cref = colorDialog.GetColor();
            color.set(GetRValue(cref), GetGValue(cref), GetBValue(cref));
            ColorList.changeCurSelValue(color);
            // update vegetable
            writeToVegetableColor(_Vegetable);

            // update 3D view
            _VegetableDlg->refreshVegetableDisplay();
        }
    }
}
开发者ID:mixxit,项目名称:solinia,代码行数:27,代码来源:vegetable_apperance_page.cpp

示例3: ReadColor

bool ReadColor (CRGBA &color, xmlNodePtr node)
{
	// Read the color
	float r = DEFAULT_PRIMITIVE_COLOR.R;
	float g = DEFAULT_PRIMITIVE_COLOR.G;
	float b = DEFAULT_PRIMITIVE_COLOR.B;
	float a = DEFAULT_PRIMITIVE_COLOR.A;

	// Read the value
	if (!ReadFloat ("R", r, node))
		return false;
	if (!ReadFloat ("G", g, node))
		return false;
	if (!ReadFloat ("B", b, node))
		return false;
	if (!ReadFloat ("A", a, node))
		a = 255;

	// Clamp
	clamp (r, 0.f, 255.f);
	clamp (g, 0.f, 255.f);
	clamp (b, 0.f, 255.f);
	clamp (a, 0.f, 255.f);

	// Set
	color.set((uint8)r, (uint8)g, (uint8)b, (uint8)a);
	return true;
}
开发者ID:mixxit,项目名称:solinia,代码行数:28,代码来源:primitive_class.cpp

示例4: drawPoint

void
CQImageViewRenderer::
drawPoint(int x, int y, const CRGBA &rgba)
{
  if (x >= 0 && x < width_ && y >= 0 && y < height_)
    //image_->setPixel(x, y, CQUtil::rgbaToColor(rgba).rgba());
    image_->setPixel(x, y, rgba.encodeARGB());
}
开发者ID:colinw7,项目名称:CQImageView,代码行数:8,代码来源:CQImageView.cpp

示例5: getAlphaColor

CRGBA
CSVGStroke::
getAlphaColor() const
{
  CRGBA rgba;

  if (color_.getValid()) {
    rgba = color_.getValue();

    if (getOpacityValid())
      rgba.setAlpha(getOpacity());
  }
  else
    rgba = CRGBA(0,0,0,0);

  return rgba;
}
开发者ID:chagge,项目名称:CSVG,代码行数:17,代码来源:CSVGStroke.cpp

示例6: getPointsColor

void
CGnuPlotStyleRadar::
getPointsColor(CGnuPlotRadarStyleValue *value, int pi, CRGBA &lc, CRGBA &fc)
{
  lc = CGnuPlotStyleInst->indexColor(value->palette(), pi);
  fc = lc;

  fc.setAlpha(0.5);
}
开发者ID:colinw7,项目名称:CQGnuPlot,代码行数:9,代码来源:CGnuPlotStyleRadar.cpp

示例7: modulateIcon

void CIconWnd::modulateIcon(NLMISC::CBitmap &dst, const NLMISC::CRGBA &col)
{
    // modulate an icon by a color

    CObjectVector<uint8> &data = dst.getPixels();

    for (uint y=0 ; y<dst.getHeight() ; y++)
    {
        for (uint x=0 ; x<dst.getWidth() ; x++)
        {
            CRGBA c;
            c.modulateFromColor(col, dst.getPixelColor(x, y));

            data[(x+y*dst.getWidth())*4]   = c.R;
            data[(x+y*dst.getWidth())*4+1] = c.G;
            data[(x+y*dst.getWidth())*4+2] = c.B;
            data[(x+y*dst.getWidth())*4+3] = dst.getPixelColor(x, y).A;
        }
    }
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例8: drawDisc

// ***************************************************************************
void drawDisc(CBitmap &dest, float x, float y, float radius, const CRGBA &color, bool additif /*= false*/, uint numSegs /*= 127*/)
{
	CPolygon2D poly;
	poly.Vertices.resize(numSegs);
	for(uint k = 0; k < numSegs; ++k)
	{
		poly.Vertices[k].set(x + radius * (float) cos(k / (float) numSegs * 2 * Pi), y + radius * (float) sin(k / (float) numSegs * 2 * Pi));
	}
	CPolygon2D::TRasterVect rasters;
	sint minY;
	poly.computeOuterBorders(rasters, minY);
	sint maxY = std::min((sint) dest.getHeight(), (sint) rasters.size() + minY);
	for (sint y = std::max((sint) 0, minY); y < maxY; ++y)
	{
		nlassert(y >= 0 && y < (sint) dest.getHeight());
			sint minX = std::max((sint) 0, rasters[y - minY].first);
		sint maxX = std::min((sint) dest.getWidth(), rasters[y - minY].second);
		if (maxX > minX)
		{
			CRGBA *pt = (CRGBA *) &dest.getPixels(0)[0];
			pt += y * dest.getWidth() + minX;
			const CRGBA *endPt = pt + (maxX - minX);
			while (pt != endPt)
			{
				if (additif)
				{
					pt->add(*pt, color);
				}
				else
				{
					*pt = color;
				}
				++ pt;
			}
		}
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:38,代码来源:misc.cpp

示例9: nlassert

void CIconWnd::blendIcons(NLMISC::CBitmap &dst, const NLMISC::CBitmap &src)
{
    // blend between two icons

    nlassert(dst.getWidth() == src.getWidth());
    nlassert(dst.getHeight() == src.getHeight());

    CObjectVector<uint8> &data = dst.getPixels();

    for (uint y=0 ; y<dst.getHeight() ; y++)
    {
        for (uint x=0 ; x<dst.getWidth() ; x++)
        {
            CRGBA c;
            c.blendFromui(dst.getPixelColor(x, y), src.getPixelColor(x, y), src.getPixelColor(x, y).A);

            data[(x+y*dst.getWidth())*4]   = c.R;
            data[(x+y*dst.getWidth())*4+1] = c.G;
            data[(x+y*dst.getWidth())*4+2] = c.B;
            data[(x+y*dst.getWidth())*4+3] = c.A;

        }
    }
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例10: getRGBAPixel

void
CImageView::
getRGBAPixel(int x, int y, CRGBA &rgba)
{
  image_->getRGBAPixel(x, y, rgba);

  if      (mode_ == Mode::GRAY)
    rgba = rgba.getGrayRGBA();
  else if (mode_ == Mode::SEPIA)
    rgba = rgba.sepia();
  else if (mode_ == Mode::RED) {
    rgba.setGreen(0);
    rgba.setBlue (0);
  }
  else if (mode_ == Mode::GREEN) {
    rgba.setRed (0);
    rgba.setBlue(0);
  }
  else if (mode_ == Mode::BLUE) {
    rgba.setRed  (0);
    rgba.setGreen(0);
  }
}
开发者ID:colinw7,项目名称:CQImageView,代码行数:23,代码来源:CImageView.cpp

示例11: recolor

void
CXCursor::
recolor(const CRGBA &bg, const CRGBA &fg)
{
  Display *display = screen_.getDisplay();

  XColor fg_xcolor;
  XColor bg_xcolor;

  fg_xcolor.red   = (int) (fg.getRed  ()*65535);
  fg_xcolor.green = (int) (fg.getGreen()*65535);
  fg_xcolor.blue  = (int) (fg.getBlue ()*65535);

  bg_xcolor.red   = (int) (bg.getRed  ()*65535);
  bg_xcolor.green = (int) (bg.getGreen()*65535);
  bg_xcolor.blue  = (int) (bg.getBlue ()*65535);

  XRecolorCursor(display, xcursor_, &fg_xcolor, &bg_xcolor);
}
开发者ID:colinw7,项目名称:CXLib,代码行数:19,代码来源:CXCursor.cpp

示例12: CVector

// ----------------------------------------------------------------------------
void CViewRadar::draw ()
{
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = pIM->getViewRenderer();

	CEntityCL *user = EntitiesMngr.entity(0);
	if (user == NULL) return;

	CVectorD xyzRef = user->pos();
	const CVector dir = user->front();

	float angle = (float)(atan2(dir.y, dir.x) - (Pi / 2.0));
	CMatrix mat;
	mat.identity();
	// Scale to transform from world to interface screen
	mat.scale( CVector((float)(_WReal / _WorldSize), (float)(_HReal / _WorldSize), 1) );
	// local to user
	mat.rotateZ(-angle);
	xyzRef.z = 0;
	mat.translate(-xyzRef);

	float	maxSqrRadius= (float)sqr(_WorldSize/2);

	for (sint32 i = 1; i < 256; ++i)
	{
		CEntityCL *entity = EntitiesMngr.entity(i);
		if (entity == NULL) continue;

		// if the entity must not be shown in radar
		if(!entity->getDisplayInRadar())
			continue;

		// get entity pos
		CVectorD xyz = entity->pos();

		xyz.z = 0;
		// if the distance is too big so do not display the entity
		if ((sqr(xyz.x - xyzRef.x)+sqr(xyz.y - xyzRef.y)) > maxSqrRadius) continue;

		// Transform the dot
		xyz = mat * xyz;

		// Convert to screen
		sint32 x = OptFastFloor((float)xyz.x);
		sint32 y = OptFastFloor((float)xyz.y);

		CRGBA col = entity->getColor();

		if(getModulateGlobalColor())
			col.modulateFromColor (col, pIM->getGlobalColorForContent());
		else
			col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);

		// Select the icon to display and draw it
		uint spotId = CNPCIconCache::getInstance().getNPCIcon(entity).getSpotId();
		CRadarSpotDesc spotDesc = _SpotDescriptions[spotId];

		if (!_MissionIconsObs._displayMissionSpots)
			spotDesc = _SpotDescriptions[0];

		if (spotDesc.isMissionSpot)
			col = CRGBA(255, 255, 255, 255);

		if (entity->isTarget())
			spotId = 4; // to make it over other spots

		// Draw it (and make sure mission icons are drawn over regular dot; caution: don't exceed the render layer range)
		if (spotDesc.isMissionSpot && _MiniMissionSpotsObs._displayMiniMissionSpots)
			rVR.drawRotFlipBitmap (_RenderLayer+spotId, _XReal+x-(spotDesc.MTxW/2)+(_WReal/2), _YReal+y-(spotDesc.MTxH/2)+(_HReal/2),
								spotDesc.MTxW, spotDesc.MTxH, 0, false, spotDesc.MiniTextureId, col );
		else
			rVR.drawRotFlipBitmap (_RenderLayer+spotId, _XReal+x-(spotDesc.TxW/2)+(_WReal/2), _YReal+y-(spotDesc.TxH/2)+(_HReal/2),
							spotDesc.TxW, spotDesc.TxH, 0, false, spotDesc.TextureId, col );
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:76,代码来源:view_radar.cpp

示例13: readAnimData


//.........这里部分代码省略.........

                if (num_bytes_read < file_size)
                    memset(&data[num_bytes_read], 0, file_size - num_bytes_read);

                //------

                uchar *raw_data = new uchar [num_image_bytes];

                decompressData(data, num_bytes_read, raw_data, num_image_bytes);

                delete [] data;

                if (image_header->interlaced)
                    deInterlace(raw_data, image_header);

                //------

                CGenImage *image = proto->dup();

                image->setType(CFILE_TYPE_IMAGE_GIF);

                image->setColormap(true);

                image->setDataSize(image_header->width, image_header->height);

                int bottom = gif_data->header->height - image_header->height - image_header->top;
                int right  = gif_data->header->width  - image_header->width  - image_header->left;

                //image->setBorder(image_header->left, bottom, right, image_header->top);
                if (bottom != 0 || right != 0) std::cerr << "Unhandled border" << std::endl;

                if (gif_data->num_local_colors > 0) {
                    for (int i = 0; i < gif_data->num_local_colors; ++i) {
                        CRGBA rgba;

                        rgba.setRGBAI(gif_data->local_colors[i].r,
                                      gif_data->local_colors[i].g,
                                      gif_data->local_colors[i].b);

                        image->addColor(rgba);
                    }
                }
                else {
                    for (int i = 0; i < gif_data->num_global_colors; ++i) {
                        CRGBA rgba;

                        rgba.setRGBAI(gif_data->global_colors[i].r,
                                      gif_data->global_colors[i].g,
                                      gif_data->global_colors[i].b);

                        image->addColor(rgba);
                    }

                    //image->setBackground(image->getColor(gif_data->header->background));
                }

                //------

                if (transparent)
                    image->setTransparentColor(transparent_color);

                //------

                for (int y = 0, k = 0; y < image_header->height; ++y)
                    for (int x = 0; x < image_header->width; ++x, ++k)
                        image->setColorIndex(x, y, raw_data[k]);
开发者ID:colinw7,项目名称:CQGIFDisplay,代码行数:67,代码来源:CGIFImage.cpp

示例14: draw

// ***************************************************************************
void CGroupFrame::draw ()
{
	if (_DisplayFrame)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CViewRenderer &rVR = pIM->getViewRenderer();

		// get global color
		CRGBA col;
		if(getModulateGlobalColor())
			col.modulateFromColor (_Color, pIM->getGlobalColor());
		else
			col= _Color;

		// draw the background
		sint xId = 0, yId = 0;
		for (yId = 0; yId < 3; yId++)
		{
			for (xId = 0; xId < 3; xId++)
			{
				sint32	x = _XReal;
				sint32	y = _YReal;
				sint32	w, h;
				// top
				if (yId == 0)
				{
					y += _HReal-_DispTypes[_DispType].TopBorder;
					h = _DispTypes[_DispType].TopBorder;
				}
				// Middle
				else if (yId == 1)
				{
					y += _DispTypes[_DispType].BottomBorder;
					h = _HReal-_DispTypes[_DispType].TopBorder-_DispTypes[_DispType].BottomBorder;
				}
				// Bottom
				else
				{
					h = _DispTypes[_DispType].BottomBorder;
				}

				// Left
				if (xId == 0)
				{
					w = _DispTypes[_DispType].LeftBorder;
				}
				else if (xId == 1)
				{
					x += _DispTypes[_DispType].LeftBorder;
					w = _WReal-_DispTypes[_DispType].LeftBorder-_DispTypes[_DispType].RightBorder;
				}
				else
				{
					x += _WReal-_DispTypes[_DispType].RightBorder;
					w = _DispTypes[_DispType].RightBorder;
				}

				// render
				uint8 tile = _DispTypes[_DispType].TileBorder[yId*3+xId];
				if (tile == 0)
					rVR.drawRotFlipBitmap (_RenderLayer, x, y, w, h, 0, false, _DispTypes[_DispType].BorderIds[yId*3+xId], col);
				else
					rVR.drawRotFlipBitmapTiled (_RenderLayer, x, y, w, h, 0, false, _DispTypes[_DispType].BorderIds[yId*3+xId], tile-1, col);

			}
		}
	}
	// draw the components
	CInterfaceGroup::draw();
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:71,代码来源:group_frame.cpp

示例15: while

	// ----------------------------------------------------------------------------
	void CGroupList::draw ()
	{
		// TEMP TEMP
		//CViewRenderer &rVR = *CViewRenderer::getInstance();
		//rVR.drawRotFlipBitmap _RenderLayer,   (_XReal,   _YReal,   _WReal,   _HReal,   0,   false,   rVR.getBlankTextureId(),   CRGBA(0,  255,  0,  255) );
		if (_Over)
		{
			CViewRenderer &rVR = *CViewRenderer::getInstance();

			if (CWidgetManager::getInstance()->getModalWindow() == NULL)
			{
				sint32 x = CWidgetManager::getInstance()->getPointer()->getX();
				sint32 y = CWidgetManager::getInstance()->getPointer()->getY();

				CInterfaceGroup	*pIG = CWidgetManager::getInstance()->getWindowUnder(x,  y);
				CInterfaceGroup	*pParent = this;
				bool bFound = false;
				while (pParent != NULL)
				{
					if (pParent == pIG)
					{
						bFound = true;
						break;
					}
					pParent = pParent->getParent();
				}

				sint32 clipx,  clipy,  clipw,  cliph;
				getClip(clipx,  clipy,  clipw,  cliph);
				if ((x < clipx) ||
					(x > (clipx + clipw)) ||
					(y < clipy) ||
					(y > (clipy + cliph)) || !bFound)
				{
					_OverElt = -1;
				}
				else
				{
					for (uint32 i = 0; i < _Elements.size(); ++i)
					if (_Elements[i].Element->getActive())
					{
						CViewBase *pVB = _Elements[i].Element;
						if ((x >= pVB->getXReal()) &&
							(x < (pVB->getXReal() + pVB->getWReal()))&&
							(y >= pVB->getYReal()) &&
							(y < (pVB->getYReal() + pVB->getHReal())))
						{
							_OverElt = i;
						}
					}
				}
			}

			if (_OverElt != -1)
			{
				// Find the first container
				CInterfaceGroup *pIG = _Parent;
				CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(pIG);
				while (pIG != NULL)
				{
					pIG = pIG->_Parent;
					if (pIG == NULL) break;
					if (dynamic_cast<CGroupContainerBase*>(pIG) != NULL)
						pGC = dynamic_cast<CGroupContainerBase*>(pIG);
				}

				bool bDisplayOverSelection = true;
				if (pGC != NULL)
				{
					if (pGC->isGrayed())
						bDisplayOverSelection = false;
				}

				if (bDisplayOverSelection)
				{
					CViewBase *pVB = _Elements[_OverElt].Element;
					CRGBA col = _OverColor;
					if(getModulateGlobalColor())
					{
						col.modulateFromColor (_OverColor,   CWidgetManager::getInstance()->getGlobalColorForContent());
					}
					else
					{
						col= _OverColor;
						col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
					}
					rVR.drawRotFlipBitmap (_RenderLayer,   pVB->getXReal(),   pVB->getYReal(),
											pVB->getWReal(),   pVB->getHReal(),   0,   false,   rVR.getBlankTextureId(),
											col );
				}

			}
		}
开发者ID:junhuac,项目名称:ryzomcore,代码行数:94,代码来源:group_list.cpp


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