本文整理汇总了C++中RGBA函数的典型用法代码示例。如果您正苦于以下问题:C++ RGBA函数的具体用法?C++ RGBA怎么用?C++ RGBA使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RGBA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_options_menu_bg
void draw_options_menu_bg(MenuData* menu) {
draw_main_menu_bg(menu, 0, 0, 0.05, "abstract_brown", "stage1/cirnobg");
r_mat_push();
r_mat_scale(SCREEN_W, SCREEN_H, 1);
r_shader_standard_notex();
r_mat_translate(0.5,0.5,0);
r_color(RGBA(0, 0, 0, 0.5));
r_draw_quad();
r_mat_pop();
r_shader_standard();
r_color4(1, 1, 1, 1);
}
示例2: RGBA
void Draw_Dxf::addArc(const DL_ArcData& data)
{
RGBA color = RGBA(150,150,150);
Shape* p;
if(data.angle1 < data.angle2) {
p = CreateArc(_painter,RGBA(255,255,255),(FLOAT)data.cx,(FLOAT)data.cy,(FLOAT)data.radius,(FLOAT)data.angle1,(FLOAT)(data.angle2-data.angle1));
p->regen();
}
else {
p = CreateArc(_painter,RGBA(255,255,255),(FLOAT)data.cx,(FLOAT)data.cy,(FLOAT)data.radius,(FLOAT)data.angle1,(FLOAT)(360+data.angle2-data.angle1));
p->regen();
}
TCHAR* layerName;
if(_isBlockOpen) _block->insert(p);
else {
switch(_entityType) {
case NONE :
for(UINT i=0; i<_layers->size(); i++) {
layerName = _layers->at(i)->getName();
if(0 == _tcscmp(layerName,String2TCHAR(attributes.getLayer()))) {
_layers->at(i)->insert(p);
_layers->at(i)->getLineColor(color);
break;
}
}
break;
}
}
INT32 clValue = attributes.getColor();
if(clValue != 256) color = CL2RGBA(clValue);
p->setLineColor(color);
}
示例3: LoadImgByUrl
/**
* 从profile中读取大头像, 如果本地没有则进行下载
*
* \param pApp
* \param ResponseInfoPhoto
*
* \return
*/
Boolean TPhotosGetAlbumsForm::_UpdateProfilePhoto(TApplication* pApp, tResponseUsersGetInfo* ResponseInfoPhoto)
{
if(ResponseInfoPhoto == NULL)
return FALSE;
if(ResponseInfoPhoto->nArraySize > 0)
{
TBitmap* pDownLoadBitmap = NULL;
pDownLoadBitmap = LoadImgByUrl(ResponseInfoPhoto->Array[0].headurl);
if(pDownLoadBitmap == NULL)
{
RenRenAPICommon_DownloadPhoto(ResponseInfoPhoto->Array[0].headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);
}
else
{
TMaskButton* pLogo = NULL;
pLogo = static_cast<TMaskButton*>(GetControlPtr(m_ProfileImageID));
if(pLogo)
{
TRectangle rc;
TBitmap * pProfileImageTmp = NULL; //Profile的头像
pLogo->GetBounds(&rc);
pProfileImageTmp = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
pProfileImageTmp->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));
pLogo->SetCaption(TUSTR_Re_NULL,0,0);
pLogo->SetImage(pProfileImageTmp, (rc.Width()-pProfileImageTmp->GetWidth())/2, (rc.Height()-pProfileImageTmp->GetHeight())/2);
pLogo->Draw();
//如果先Desroy,则会崩溃,很奇怪,原因不明,暂时这么处理
if( pProfileImage != NULL)
{
pProfileImage->Destroy();
pProfileImage = NULL;
}
pProfileImage = pProfileImageTmp;
}
//释放图片
pDownLoadBitmap->Destroy();
pDownLoadBitmap = NULL;
}
}
return TRUE;
}
示例4: if
void CMapEdit::Draw()
{
if(m_nCurrentStatus == MapEdit_Status_Free)
m_Map.Draw(m_nCurDrawMapFlag);
else if(m_nCurrentStatus == MapEdit_Status_Select)
{
if(m_pTexture!=NULL)
{
m_pVideoDriver->RenderQuad(m_Map.GetBackGroundTexture(),0,0,DISPLAY_WIDTH,DISPLAY_HEIGHT,0,0,1,1,0,0xffffffff);
m_pVideoDriver->RenderQuad(m_pTexture, m_nDisplayLeft,m_nDisplayTop,
DISPLAY_WIDTH, DISPLAY_HEIGHT,
0, 0 ,1,1,0,RGBA(255,255,255,100));
}
}
//Draw cursor
m_pVideoDriver->RenderQuad(m_pTexture, 0, 0, CELL_SIZE, CELL_SIZE,
m_nCurX, m_nCurY,1,1,0,RGBA(255,255,255,100));
}
示例5: Command_Help
static void Command_Help(const CommandConsoleArgs& args)
{
if(args.m_argList.size() == 1)
{
_console->ShowAllRegisteredCmd();
}
else if(args.m_argList.size() == 2)
{
_console->ShowCommandDesc(args.m_argList[1].c_str());
}
else
{
_console->DrawSentence("ERROR: Wrong Arguments. Usage : <Help> <Command>.",RGBA(1.0f,0.0f,0.0f,1.0f));
}
};
示例6: RGBA
AreaLight::AreaLight(std::ifstream &stream, Matrix4x4 transform)
{
m_transform = transform;
stream.read( reinterpret_cast<char *>( &m_strength), sizeof m_strength);
stream.read( reinterpret_cast<char *>( &(m_size[0])), sizeof m_size[0]);
stream.read( reinterpret_cast<char *>( &(m_size[1])), sizeof m_size[1]);
//m_color = RGBA(stream);
m_color = RGBA(1.0f);
m_color[0] = pow(m_color[0],2.2f);
m_color[1] = pow(m_color[1],2.2f);
m_color[2] = pow(m_color[2],2.2f);
m_normal = Vec3(0.0f,0.0f,1.0f);
m_transform.multDirMatrix(m_normal, m_normal);
m_area = m_size[0] * m_size[1];
}
示例7: switch
DWORD CPNGFile::GetPix(int iX, int iY)
{
// image loaded?
if (!pImageData) return 0;
// return pixel value
unsigned char *pPix=pImageData+iY*iRowSize+iX*iPixSize;
switch (iClrType)
{
case PNG_COLOR_TYPE_RGB:
return C4RGB(pPix[2], pPix[1], pPix[0]);
case PNG_COLOR_TYPE_RGB_ALPHA:
return RGBA(pPix[2], pPix[1], pPix[0], pPix[3]);
}
return 0;
}
示例8: getThemeColor
int
getThemeColor(Vbitmap *vbitmap)
{
int colors[8];
int scores[8];
int ncolors;
ncolors = getThemeColors(vbitmap, sizeof(colors) / sizeof(colors[0]), colors, scores);
if (ncolors <= 0 || colors == NULL) {
return RGBA(0, 0, 0, 0);
}
return colors[0];
}
示例9: RGBA
void ParticleUpdateFunctions::DebrisUpdate(Emitter& emitter,Particle& particle,float deltaTime)
{
if(particle.surviveTime == emitter.survivalTime)
{
float yawRadians = (rand() & MOD_MASK_1024) * 0.00628f;
particle.velocity.x = 2.0f*cos(yawRadians);
particle.velocity.y = 2.0f*sin(yawRadians);
particle.color = RGBA(0.0f,0.8f,1.0f,1.0f);
}
Vec3f force;
particle.position += particle.velocity * deltaTime;
force += particle.velocity * -particle.c + Vec3f(0.0f,0.0f,-9.8f*particle.mass);
float massOverOne = 1.0f/particle.mass;
Vec3f acceleration = force * massOverOne;
particle.velocity += acceleration * deltaTime;
particle.surviveTime -= deltaTime;
if(particle.position.z < -2.0f)
{
particle.velocity.z *= -0.5f;
}
if(particle.surviveTime < 0)
{
Vec3f positionDifference = emitter.maxPos - emitter.minPos;
Vec3f randomCoefficient = Vec3f(((rand() & MOD_MASK_1024) * 0.001f),((rand() & MOD_MASK_1024) * 0.001f),((rand() & MOD_MASK_1024) * 0.001f));
particle.position = emitter.minPos + (positionDifference * randomCoefficient);
particle.surviveTime = emitter.survivalTime;
particle.velocity = emitter.velocity;
particle.color = RGBA(0.0f,0.8f,1.0f,1.0f);
}
}
示例10: Vec3f
void ParticleUpdateFunctions::LeafUpdate(Emitter& emitter,Particle& particle,float deltaTime)
{
Vec3f force = Vec3f(((rand() & MOD_MASK_1024) * 0.002f - 1.0f),((rand() & MOD_MASK_1024) * 0.002f - 1.0f),((rand() & MOD_MASK_1024) * 0.002f - 1.0f));
particle.color = RGBA(1.0f,1.0f,1.0f,0.5f);
particle.position += (particle.velocity) * deltaTime;
force += (particle.velocity - windForce) * - particle.c;
float massOverOne = 1.0f/particle.mass;
Vec3f acceleration = force * massOverOne;
particle.velocity += acceleration * deltaTime;
particle.surviveTime -= deltaTime;
if(particle.surviveTime < 0)
{
Vec3f positionDifference = emitter.maxPos - emitter.minPos;
Vec3f randomCoefficient = Vec3f(((rand() & MOD_MASK_1024) * 0.001f),((rand() & MOD_MASK_1024) * 0.001f),((rand() & MOD_MASK_1024) * 0.001f));
particle.position = emitter.minPos + (positionDifference * randomCoefficient);
particle.surviveTime = emitter.survivalTime;
float offset = 512.f;
particle.velocity = Vec3f((((rand() & MOD_MASK_1024) - offset) * 0.001f),(((rand() & MOD_MASK_1024) - offset) * 0.001f),(((rand() & MOD_MASK_1024) - offset) * 0.001f)) * 50.0f + emitter.velocity;
particle.color = RGBA(1.0f,1.0f,1.0f,0.5f);
}
}
示例11: ss
GdkPixbuf *sp_cursor_pixbuf_from_xpm(char const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke)
{
int height = 0;
int width = 0;
int colors = 0;
int pix = 0;
std::stringstream ss (std::stringstream::in | std::stringstream::out);
ss << xpm[0];
ss >> height;
ss >> width;
ss >> colors;
ss >> pix;
std::map<char, RGBA> colorMap;
for (int i = 0; i < colors; i++) {
char const *p = xpm[1 + i];
g_assert(*p >=0);
unsigned char const ccode = (guchar) *p;
p++;
while (isspace(*p)) {
p++;
}
p++;
while (isspace(*p)) {
p++;
}
if (strcmp(p, "None") == 0) {
colorMap[ccode] = RGBA();
} else if (strcmp(p, "Fill") == 0) {
colorMap[ccode] = RGBA(SP_RGBA32_R_U(fill), SP_RGBA32_G_U(fill), SP_RGBA32_B_U(fill), SP_RGBA32_A_U(fill));
} else if (strcmp(p, "Stroke") == 0) {
colorMap[ccode] = RGBA(SP_RGBA32_R_U(stroke), SP_RGBA32_G_U(stroke), SP_RGBA32_B_U(stroke), SP_RGBA32_A_U(stroke));
} else if (strcmp(p, "#000000") == 0) {
colorMap[ccode] = RGBA(black.red, black.green, black.blue, 255);
} else if (strcmp(p, "#FFFFFF") == 0) {
colorMap[ccode] = RGBA(white.red, white.green, white.blue, 255);
} else {
colorMap[ccode] = RGBA();
}
}
guint32 *pixmap_buffer = new guint32[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
std::map<char, RGBA>::const_iterator it = colorMap.find(xpm[1 + colors + y][x]);
pixmap_buffer[y * width + x] = (it == colorMap.end()) ? 0u : it->second;
}
}
return gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL);
}
示例12: bsglCreate
bsglWidget::bsglWidget(int x, int y, int width, int height) {
bsgl = bsglCreate(BSGL_VERSION);
x_ = x;
y_ = y;
w_ = width;
h_ = height;
col_ = RGBA(255, 255, 255, 255);
focus_ = false;
quad_.v[0].z = 0.f;
quad_.v[1].z = 0.f;
quad_.v[2].z = 0.f;
quad_.v[3].z = 0.f;
quad_.tex = 0;
quad_.blend = BLEND_DEFAULT;
}
示例13: ParsePyTupleError
// Reload The Sprite
PyObject* Python::B2D_ReloadSprite (PyObject* Self, PyObject* Args){
// Create Variables
int spriteReference; float x, y; int width, height; char* texturePath, *colour = "FFFFFFFF";
// Look For Errors
if (!PyArg_ParseTuple (Args, "ffiis|s", &spriteReference, &x, &y, &width, &height, &texturePath, &colour)){
ParsePyTupleError (__func__, __LINE__);
}
RGBA rgba = RGBA (colour);
// Set Function
Python::spriteList[spriteReference].Reload (Vector2::Point (x, y), width, height, texturePath, rgba);
Py_RETURN_NONE;
}
示例14: DrawSentence
void DeveloperConsole::Draw()
{
m_widthTable.clear();
OpenGLRenderer::BindWhiteTexture();
OpenGLRenderer::DrawVertexWithVertexArray2D(m_backgroundLayer,8,OpenGLRenderer::SHAPE_QUADS,m_screenSizes.x,m_screenSizes.y);
for(size_t index = 1; index < m_logLines.size(); index++)
{
size_t LogStartLine = m_logLines.size() - index - m_currentStartDrawingLineNum;
if(LogStartLine != 0)
DrawSentence(m_logLines[index].text.c_str(),m_logLines.size() - index - m_currentStartDrawingLineNum,m_logLines[index].fontSize,m_logLines[index].color,m_logLines[index].font);
}
DrawSentence(m_logLines[0].text.c_str(),0,m_logLines[0].fontSize,RGBA(),m_logLines[0].font);
DrawCursor();
}
示例15: AABB2
void MainMenuState::Render() const {
g_theRenderer->ClearScreen(0.f, 0.f, 0.f);
AABB2 quad = AABB2(Vector2(0.f, 0.f), Vector2(1600.f, 900.f));
g_theRenderer->DrawTexturedAABB2(m_screenImage, RGBA::WHITE, quad);
float frequency = 1; // Frequency in Hz
float opacity = 0.5f * (1 + sin(2.f * pi * frequency * m_age));
//float opacity = 0.5f * sin(m_age * 4.f) + 1.f;
//opacity = ClampFloat(opacity, 0.f, 1.f);
String enterText = StringUtils::Stringf("PRESS ENTER");
m_squirrelFont->DrawText2D(Vector2(470.f, 100.f), enterText, 60.f, RGBA(1.f, 1.f, 1.f, opacity), NULL);
}